/* ========================================
   INCI BIBLE v2 — Biences Swiss Cosmetics
   Luxury / Refined Design System
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,300;0,400;0,700;1,300&display=swap');

:root {
    --orange: #E87722;
    --orange-dark: #c65500;
    --orange-glow: rgba(232, 119, 34, 0.12);
    --brown: #43372C;
    --brown-light: #6A4B3C;
    --taupe: #7A6D64;
    --beige: #F1E8DE;
    --beige-dark: #e8ddd0;
    --bg: #FBF8F6;
    --white: #ffffff;
    --border: #E5DDD4;
    --border-hover: #c8bfb3;
    --green: #2e7d5b;
    --green-light: #e8f5e9;
    --red: #c0392b;
    --red-light: #fce4e4;
    --yellow: #e8a817;
    --yellow-light: #fff8e1;
    --shadow-sm: 0 2px 8px rgba(67, 55, 44, 0.04);
    --shadow-md: 0 8px 28px rgba(67, 55, 44, 0.08);
    --shadow-lg: 0 16px 48px rgba(67, 55, 44, 0.12);
    --shadow-glow: 0 4px 14px rgba(232, 119, 34, 0.25);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 999px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Lato", system-ui, -apple-system, sans-serif;
    letter-spacing: 0.03em;
    line-height: 1.65;
    background: var(--bg);
    color: var(--brown);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Layout ---- */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---- Header / Nav ---- */

.header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(222, 213, 204, 0.6);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--brown);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.08em;
    transition: var(--transition-fast);
}

.logo:hover {
    opacity: 0.8;
}

.logo span {
    color: var(--orange);
}

.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--beige);
    border-radius: var(--radius-full);
    padding: 3px;
}

.nav-tab {
    padding: 8px 22px;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--taupe);
    border: none;
    transition: var(--transition);
}

.nav-tab:hover {
    color: var(--brown);
    background: rgba(255, 255, 255, 0.7);
}

.nav-tab.active {
    background: var(--brown);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(67, 55, 44, 0.2);
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-full);
    padding: 10px 22px;
    font-family: "Lato", sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--orange);
    color: var(--white);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background: var(--orange-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(232, 119, 34, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--taupe);
}

.btn-secondary:hover {
    border-color: var(--orange);
    color: var(--orange);
    box-shadow: var(--shadow-sm);
}

.btn-small {
    padding: 6px 14px;
    font-size: 10px;
}

/* ---- Cards ---- */

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ---- Inputs ---- */

.input {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 13px 20px;
    font-family: "Lato", sans-serif;
    font-size: 14px;
    letter-spacing: 0.03em;
    color: var(--brown);
    box-shadow: var(--shadow-sm);
    width: 100%;
    transition: var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-glow), 0 4px 16px rgba(67, 55, 44, 0.06);
}

.input::placeholder {
    color: var(--taupe);
    font-weight: 300;
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237A6D64' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* ---- Bible Page ---- */

.page-section {
    padding: 36px 0 48px;
}

.page-section > *:nth-child(1) { animation: fadeUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both; }
.page-section > *:nth-child(2) { animation: fadeUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.06s both; }
.page-section > *:nth-child(3) { animation: fadeUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.12s both; }
.page-section > *:nth-child(4) { animation: fadeUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.18s both; }

.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.search-bar .input-wrapper {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-bar .input-wrapper .input {
    width: 100%;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    overflow: hidden;
    max-height: 380px;
    overflow-y: auto;
    display: none;
}

.autocomplete-dropdown.visible {
    display: block;
    animation: slideDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid rgba(222, 213, 204, 0.4);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--beige);
}

.autocomplete-item .ac-article {
    font-size: 12px;
    font-weight: 700;
    color: var(--orange);
    min-width: 36px;
    letter-spacing: 0.04em;
}

.autocomplete-item .ac-name {
    flex: 1;
    font-size: 14px;
    color: var(--brown);
}

.autocomplete-item .ac-name mark {
    background: var(--orange-glow);
    color: var(--orange-dark);
    border-radius: 2px;
    padding: 0 2px;
}

.autocomplete-item .ac-gamme {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--taupe);
    padding: 3px 10px;
    background: var(--beige);
    border-radius: var(--radius-full);
}

.search-bar select.input {
    flex: 0 0 220px;
}

/* Product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.product-card {
    cursor: pointer;
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--orange);
    opacity: 0;
    transition: var(--transition);
}

.product-card:hover::before {
    opacity: 1;
}

.product-card .article-number {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--taupe);
    margin-bottom: 6px;
}

.product-card .product-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--brown);
    margin-bottom: 10px;
    line-height: 1.35;
}

.product-card .gamme-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--beige);
    color: var(--brown-light);
}

.product-card .scores-row {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---- Product Detail ---- */

.product-detail {
    animation: fadeUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 20px;
}

.detail-header .header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.detail-header .header-right svg {
    max-width: 180px;
    height: auto;
}

.detail-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--brown);
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.detail-header .gamme-tag {
    display: inline-block;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--beige);
    color: var(--brown-light);
    margin-top: 8px;
}

.detail-header .article-num {
    font-size: 13px;
    color: var(--taupe);
    font-weight: 300;
    margin-top: 4px;
    letter-spacing: 0.06em;
}

.back-btn {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--taupe);
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    transition: var(--transition-fast);
    padding: 6px 0;
}

.back-btn:hover {
    color: var(--orange);
}

/* Scores */
.scores-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}

.score-card {
    text-align: center;
    padding: 20px 14px;
}

.score-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.score-circle {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.02em;
}

.score-circle.green { background: linear-gradient(135deg, #2e7d5b, #43a775); box-shadow: 0 4px 14px rgba(46, 125, 91, 0.25); }
.score-circle.yellow { background: linear-gradient(135deg, #d4a017, #e8b817); box-shadow: 0 4px 14px rgba(232, 184, 23, 0.25); }
.score-circle.orange { background: linear-gradient(135deg, #d4752e, #e8943a); box-shadow: 0 4px 14px rgba(232, 148, 58, 0.25); }
.score-circle.red { background: linear-gradient(135deg, #b83226, #d44637); box-shadow: 0 4px 14px rgba(212, 70, 55, 0.25); }

.score-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--taupe);
}

.flag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.flag-badge.yes {
    background: var(--green-light);
    color: var(--green);
}

.flag-badge.no {
    background: var(--red-light);
    color: var(--red);
}

/* INCI List */
.inci-section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--taupe);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--orange);
}

.inci-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inci-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--white);
    border: 1px solid transparent;
    transition: var(--transition-fast);
    font-size: 14px;
}

.inci-item:nth-child(odd) {
    background: rgba(241, 232, 222, 0.25);
}

.inci-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.inci-item .position {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--beige);
    color: var(--taupe);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0;
}

.inci-item .inci-name {
    font-weight: 400;
    color: var(--brown);
    flex: 1;
    font-size: 13px;
}

.inci-item.has-pa {
    cursor: pointer;
}

.inci-item.has-pa .inci-name {
    color: var(--orange);
    font-weight: 700;
}

.inci-item.has-pa:hover {
    border-color: rgba(232, 119, 34, 0.3);
    background: rgba(232, 119, 34, 0.03);
}

.inci-item .pa-name {
    font-size: 11px;
    color: var(--taupe);
    font-weight: 300;
    font-style: italic;
}

/* Principes actifs */
.pa-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pa-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(232, 119, 34, 0.06), rgba(232, 119, 34, 0.02));
    border: 1px solid rgba(232, 119, 34, 0.18);
    color: var(--orange-dark);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition-fast);
}

.pa-chip:hover {
    background: linear-gradient(135deg, rgba(232, 119, 34, 0.12), rgba(232, 119, 34, 0.06));
    border-color: rgba(232, 119, 34, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 119, 34, 0.1);
}

.pa-chip .pa-inci {
    font-size: 10px;
    color: var(--taupe);
    font-weight: 300;
    letter-spacing: 0.02em;
}

/* Free-ofs */
.freeofs-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.freeof-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: var(--transition-fast);
}

.freeof-badge.free {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid rgba(46, 125, 91, 0.15);
}

.freeof-badge.not-free {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid rgba(192, 57, 43, 0.1);
    opacity: 0.5;
    font-weight: 400;
}

.freeof-badge:hover {
    transform: translateY(-1px);
}

/* INCI Label */
.inci-label-box {
    background: var(--beige);
    border-radius: var(--radius-md);
    padding: 24px;
    font-size: 13px;
    line-height: 1.8;
    color: var(--brown-light);
    font-weight: 300;
    word-break: break-word;
    border: 1px solid rgba(222, 213, 204, 0.5);
}

/* ---- INCI Files Page ---- */

.files-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.files-table th {
    padding: 14px 20px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--taupe);
    background: var(--beige);
    border-bottom: 1px solid var(--border);
}

.files-table td {
    padding: 14px 20px;
    font-size: 13px;
    border-bottom: 1px solid rgba(222, 213, 204, 0.4);
    color: var(--brown);
}

.files-table tr:last-child td {
    border-bottom: none;
}

.files-table tr:hover td {
    background: rgba(241, 232, 222, 0.2);
}

.files-table .clickable {
    cursor: pointer;
}

.files-table .clickable:hover td {
    background: rgba(241, 232, 222, 0.4);
}

/* ---- Login Page ---- */

.login-container {
    max-width: 380px;
    margin: 100px auto;
    text-align: center;
    animation: fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-logo {
    width: 180px;
    height: auto;
    margin-bottom: 40px;
    opacity: 0;
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.1s forwards;
}

.login-container h1 {
    font-size: 22px;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.login-container p {
    color: var(--taupe);
    font-weight: 300;
    margin-bottom: 32px;
    font-size: 14px;
    line-height: 1.6;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-error {
    color: var(--red);
    font-size: 13px;
    font-weight: 400;
    display: none;
}

/* ---- Modal ---- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(67, 55, 44, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 36px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h2 {
    font-size: 20px;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 28px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--taupe);
    margin-bottom: 6px;
}

.form-group .input {
    border-radius: var(--radius-sm);
}

/* ---- Upload ---- */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 48px 24px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--orange);
    background: rgba(232, 119, 34, 0.03);
}

.upload-zone p {
    color: var(--taupe);
    font-weight: 300;
    margin-top: 8px;
    font-size: 13px;
}

/* ---- Chat Panel ---- */

.chat-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--orange);
    color: var(--white);
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(232, 119, 34, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: var(--transition);
    z-index: 150;
}

.chat-fab:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(232, 119, 34, 0.4);
}

.chat-panel {
    position: fixed;
    top: 0;
    right: -520px;
    width: 500px;
    height: 100vh;
    background: var(--white);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(67, 55, 44, 0.1);
    z-index: 160;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-panel.open {
    right: 0;
}

.chat-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--beige);
    flex-shrink: 0;
}

.chat-header h3 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brown);
}

.chat-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--taupe);
    padding: 4px;
    transition: var(--transition-fast);
}

.chat-close:hover {
    color: var(--orange);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-message {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14.5px;
    line-height: 1.7;
    max-width: 88%;
    word-wrap: break-word;
    animation: fadeUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-message.user {
    background: var(--orange);
    color: var(--white);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    background: var(--beige);
    color: var(--brown);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    font-weight: 300;
    padding: 18px 22px;
    max-width: 92%;
}

/* Structured HTML inside assistant messages */
.chat-message.assistant > *:first-child {
    margin-top: 0;
}

.chat-message.assistant > *:last-child {
    margin-bottom: 0;
}

.chat-message.assistant h3 {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--brown);
    margin: 20px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(232, 119, 34, 0.25);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chat-message.assistant h4 {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--brown);
    margin: 16px 0 6px 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
    padding-left: 10px;
}

.chat-message.assistant h4::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--orange);
    border-radius: 2px;
}

.chat-message.assistant p {
    margin: 0 0 10px 0;
}

.chat-message.assistant h3 + p,
.chat-message.assistant h4 + p,
.chat-message.assistant h3 + ul,
.chat-message.assistant h4 + ul,
.chat-message.assistant h3 + ol,
.chat-message.assistant h4 + ol {
    margin-top: 0;
}

.chat-message.assistant ul,
.chat-message.assistant ol {
    margin: 8px 0 14px 0;
    padding-left: 0;
    list-style: none;
}

.chat-message.assistant ul li,
.chat-message.assistant ol li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 6px;
    line-height: 1.65;
}

.chat-message.assistant ul li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.75em;
    width: 5px;
    height: 5px;
    background: var(--orange);
    border-radius: 50%;
    transform: translateY(-50%);
}

.chat-message.assistant ol {
    counter-reset: chat-counter;
}

.chat-message.assistant ol li {
    counter-increment: chat-counter;
}

.chat-message.assistant ol li::before {
    content: counter(chat-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--orange);
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: 0.03em;
}

.chat-message.assistant li > ul,
.chat-message.assistant li > ol {
    margin: 4px 0 4px 0;
}

.chat-message.assistant strong {
    font-weight: 700;
    color: var(--brown);
}

.chat-message.assistant em {
    font-style: italic;
    color: var(--brown-light);
}

.chat-message.assistant code {
    background: rgba(67, 55, 44, 0.08);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12.5px;
    color: var(--brown);
}

.chat-message.assistant hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(67, 55, 44, 0.18), transparent);
    margin: 18px 0;
}

.chat-message.assistant a.chat-link {
    color: var(--orange);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(232, 119, 34, 0.35);
    transition: border-color 0.15s ease, color 0.15s ease;
}

.chat-message.assistant a.chat-link:hover {
    color: var(--brown);
    border-bottom-color: var(--orange);
}

/* Copyable chips */
.copy-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--orange);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.copy-chip:hover {
    background: var(--orange);
    color: var(--white);
    border-color: var(--orange);
}

.copy-chip:hover .copy-icon {
    stroke: var(--white);
}

.copy-chip .copy-icon {
    stroke: var(--orange);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.copy-chip.copied {
    background: var(--green);
    color: var(--white);
    border-color: var(--green);
}

.copy-chip.copied .copy-icon {
    stroke: var(--white);
}

.chat-message.typing {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--taupe);
    animation: pulse 1.2s ease infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    background: var(--bg);
    flex-shrink: 0;
}

.chat-input-area textarea {
    flex: 1;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 10px 18px;
    font-family: "Lato", sans-serif;
    font-size: 14px;
    color: var(--brown);
    transition: var(--transition-fast);
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    overflow-y: auto;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--orange);
}

.chat-input-area button {
    background: var(--orange);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--white);
    font-size: 16px;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-input-area button:hover {
    background: var(--orange-dark);
}

/* ---- Animations ---- */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.7); }
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 6px;
}

.loading-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--orange);
    animation: pulse 1.2s ease infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 10px;
    }

    .nav-tabs {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-bar select.input {
        flex: 1;
    }

    .scores-section {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-header h1 {
        font-size: 22px;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .chat-panel {
        width: 100%;
        right: -100%;
    }

    .chat-panel.open ~ .chat-fab {
        display: none;
    }

    .chat-fab {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }

    .nav-tab {
        padding: 7px 14px;
        font-size: 10px;
    }

    .card {
        padding: 18px;
    }

    .scores-section {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .modal {
        width: 96%;
        padding: 24px;
        border-radius: var(--radius-md);
    }

    .files-table th, .files-table td {
        padding: 10px 12px;
        font-size: 11px;
    }

    .login-container {
        margin: 60px auto;
        padding: 0 16px;
    }

    .login-logo {
        width: 140px;
    }
}

/* ---- Utility ---- */

.text-muted { color: var(--taupe); }
.text-small { font-size: 12px; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
