/* ═══════════════════════════════════════════════════════
   ALLIED REFINERS — Operations Platform
   "Forge & Folio" — Luxury editorial meets industrial
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Karla:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ── CSS Variables ──────────────────────────────────── */
:root {
    --ar-amber: #D4850A;
    --ar-amber-light: #E8A33C;
    --ar-amber-glow: rgba(212, 133, 10, 0.12);
    --ar-amber-deep: #B06E08;
    --ar-amber-hot: #F27D1A;
    --ar-warm-black: #1A1714;
    --ar-warm-dark: #241F1A;
    --ar-warm-mid: #302923;
    --ar-sidebar-bg: #1A1714;
    --ar-cream: #FAF7F2;
    --ar-cream-warm: #FFF9F0;
    --ar-parchment: #F5F0E8;
    --ar-card: #FFFFFF;
    --ar-border: #E6E0D6;
    --ar-border-light: #F0EBE3;
    --ar-text: #1A1714;
    --ar-text-secondary: #6B5E52;
    --ar-text-muted: #A09788;
    --ar-success: #3D8B5E;
    --ar-success-bg: #EEF6F0;
    --ar-warning: #C4860A;
    --ar-warning-bg: #FDF6E8;
    --ar-danger: #B93E3E;
    --ar-danger-bg: #FCEEED;
    --ar-info: #3A6FA0;
    --ar-info-bg: #EDF3FA;
    --ar-gold: #C9A84C;
    --ar-platinum: #B0ADA8;
    --ar-palladium: #8A8580;
    --ar-silver: #9C9890;
    --ar-radius-sm: 4px;
    --ar-radius: 8px;
    --ar-radius-lg: 12px;
    --ar-radius-xl: 20px;
    --ar-shadow-sm: 0 1px 2px rgba(26, 23, 20, 0.05);
    --ar-shadow: 0 2px 8px rgba(26, 23, 20, 0.07), 0 1px 2px rgba(26, 23, 20, 0.04);
    --ar-shadow-lg: 0 8px 30px rgba(26, 23, 20, 0.1), 0 2px 8px rgba(26, 23, 20, 0.05);
    --ar-shadow-amber: 0 4px 16px rgba(212, 133, 10, 0.2);
    --ar-transition: 0.2s ease;
    --sidebar-width: 240px;
    --header-height: 62px;
    /* noise grain overlay */
    --grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ── Reset & Base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14.5px; scroll-behavior: smooth; }

body {
    font-family: 'Karla', sans-serif;
    background: var(--ar-cream);
    color: var(--ar-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Grain texture on body */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--grain);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ══════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--ar-warm-black);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 30% 50%, rgba(212, 133, 10, 0.06) 0%, transparent 100%),
        radial-gradient(ellipse 40% 60% at 80% 30%, rgba(201, 168, 76, 0.04) 0%, transparent 100%);
    pointer-events: none;
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem 2rem;
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: var(--ar-amber);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    box-shadow: var(--ar-shadow-amber);
}

.login-logo svg { width: 40px; height: 40px; }

.login-brand h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--ar-cream);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}

.login-brand p {
    color: var(--ar-text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 500;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--ar-radius-lg);
    padding: 2rem;
}

.login-card h2 {
    font-size: 1.5rem;
    color: var(--ar-cream);
    margin-bottom: 0.25rem;
}

.login-card .login-subtitle {
    color: var(--ar-text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.75rem;
}

.form-group { margin-bottom: 1.1rem; }

.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--ar-radius);
    color: var(--ar-cream);
    font-size: 0.9rem;
    transition: var(--ar-transition);
    outline: none;
}

.form-input::placeholder { color: rgba(255, 255, 255, 0.2); }

.form-input:focus {
    border-color: var(--ar-amber);
    box-shadow: 0 0 0 2px rgba(212, 133, 10, 0.15);
}

.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.form-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--ar-amber);
}

.form-link {
    color: var(--ar-amber-light);
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--ar-transition);
}

.form-link:hover { color: var(--ar-amber); }

.btn-login {
    width: 100%;
    padding: 0.8rem;
    background: var(--ar-amber);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: var(--ar-radius);
    transition: var(--ar-transition);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.btn-login:hover {
    background: var(--ar-amber-deep);
    box-shadow: var(--ar-shadow-amber);
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-visual {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-triangle {
    width: 360px;
    height: 360px;
    opacity: 0.04;
}

.login-triangle svg { width: 100%; height: 100%; fill: var(--ar-amber); }

.login-stats {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    z-index: 2;
}

.login-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--ar-radius);
    padding: 1rem 1.25rem;
    min-width: 200px;
    animation: floatStat 6s ease-in-out infinite;
}

.login-stat-card:nth-child(2) { animation-delay: -2s; }
.login-stat-card:nth-child(3) { animation-delay: -4s; }

@keyframes floatStat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.login-stat-card .stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ar-text-muted);
    margin-bottom: 0.15rem;
    font-weight: 600;
}

.login-stat-card .stat-value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ar-cream);
}

.login-stat-card .stat-value .accent { color: var(--ar-amber-light); }

/* ══════════════════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════════════════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    background: var(--ar-sidebar-bg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
    z-index: 200;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: none;
    overflow: hidden;
    contain: paint;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-close {
    display: none;
    color: rgba(255,255,255,0.4);
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.sidebar-close svg { width: 18px; height: 18px; }

.sidebar-header {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    background: var(--ar-amber);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo svg { width: 22px; height: 22px; }

.sidebar-brand h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.15rem;
    color: var(--ar-cream);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    line-height: 1;
}

.sidebar-brand span {
    font-family: 'Karla', sans-serif;
    font-size: 0.6rem;
    color: var(--ar-text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
}

.nav-section { margin-bottom: 1.25rem; }

.nav-section-title {
    font-family: 'Karla', sans-serif;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.2);
    padding: 0 0.6rem;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.6rem;
    border-radius: var(--ar-radius-sm);
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--ar-transition);
    margin-bottom: 1px;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.75);
}

.nav-item.active {
    background: rgba(212, 133, 10, 0.1);
    color: var(--ar-amber-light);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 55%;
    background: var(--ar-amber);
    border-radius: 0 2px 2px 0;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
}

.nav-item.active svg { opacity: 1; }

.nav-item .badge {
    margin-left: auto;
    background: var(--ar-amber);
    color: #FFFFFF;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem;
    border-radius: var(--ar-radius-sm);
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    background: var(--ar-amber);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.sidebar-user-info .name {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-user-info .role {
    font-size: 0.65rem;
    color: var(--ar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Mobile Overlay & Toggle ────────────────────────── */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 23, 20, 0.6);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    padding: 8px 6px;
    border-radius: var(--ar-radius-sm);
    transition: var(--ar-transition);
}

.mobile-menu-btn:hover { background: var(--ar-parchment); }

.mobile-menu-btn span {
    display: block;
    height: 2px;
    background: var(--ar-text);
    border-radius: 1px;
    transition: 0.25s ease;
}

.mobile-menu-btn span:nth-child(1) { width: 20px; }
.mobile-menu-btn span:nth-child(2) { width: 16px; }
.mobile-menu-btn span:nth-child(3) { width: 12px; }

.header-logo-mobile { display: none; }

/* ── Main Content ───────────────────────────────────── */
.main-content {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    background: var(--ar-cream);
    position: relative;
    isolation: isolate;
    z-index: 1;
}

.main-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 28px;
    background: var(--ar-cream);
    pointer-events: none;
    z-index: 1;
}

/* ── Top Header ─────────────────────────────────────── */
.top-header {
    height: var(--header-height);
    background: var(--ar-card);
    border-bottom: 1px solid var(--ar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--ar-text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    background: var(--ar-cream);
    border: 1px solid var(--ar-border);
    border-radius: var(--ar-radius);
    min-width: 220px;
    transition: var(--ar-transition);
}

.header-search:focus-within {
    border-color: var(--ar-amber);
    box-shadow: 0 0 0 2px var(--ar-amber-glow);
}

.header-search svg {
    width: 15px;
    height: 15px;
    color: var(--ar-text-muted);
    flex-shrink: 0;
}

.header-search input {
    border: none;
    background: none;
    outline: none;
    font-size: 0.82rem;
    color: var(--ar-text);
    width: 100%;
}

.header-search input::placeholder { color: var(--ar-text-muted); }

.header-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--ar-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ar-text-secondary);
    transition: var(--ar-transition);
    position: relative;
}

.header-btn:hover {
    background: var(--ar-parchment);
    color: var(--ar-text);
}

.header-btn .notif-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    background: var(--ar-amber);
    border-radius: 50%;
    border: 2px solid var(--ar-card);
}

.header-btn svg { width: 18px; height: 18px; }

/* ── Page Content ───────────────────────────────────── */
.page-content {
    padding: 1.5rem 1.75rem;
    position: relative;
    z-index: 2;
}

/* ── Geo Pattern (removed — cleaner without it) ─────── */
.geo-pattern { display: none; }

/* ══════════════════════════════════════════════════════
   CARDS — Warm, textured, editorial feel
   ══════════════════════════════════════════════════════ */
.card {
    background: var(--ar-card);
    border: 1px solid var(--ar-border);
    border-radius: var(--ar-radius-lg);
    box-shadow: var(--ar-shadow-sm);
    transition: var(--ar-transition);
    position: relative;
}

.card:hover { box-shadow: var(--ar-shadow); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ar-border-light);
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ar-text);
}

.card-body { padding: 1.25rem; }

/* ── KPI Stat Cards — Editorial number style ────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--ar-card);
    border: 1px solid var(--ar-border);
    border-radius: var(--ar-radius-lg);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: var(--ar-transition);
}

/* Angled accent — not a boring top bar */
.stat-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 40px;
    height: 40px;
    border-radius: var(--ar-radius-lg) 0 0 0;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 28px;
    border-radius: 0 0 3px 0;
}

.stat-card:hover { transform: translateY(-1px); box-shadow: var(--ar-shadow); }

.stat-card.orange::after { background: var(--ar-amber); }
.stat-card.green::after { background: var(--ar-success); }
.stat-card.blue::after { background: var(--ar-info); }
.stat-card.gold::after { background: var(--ar-gold); }

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--ar-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.stat-card.orange .stat-icon { background: var(--ar-amber-glow); color: var(--ar-amber); }
.stat-card.green .stat-icon { background: var(--ar-success-bg); color: var(--ar-success); }
.stat-card.blue .stat-icon { background: var(--ar-info-bg); color: var(--ar-info); }
.stat-card.gold .stat-icon { background: rgba(201, 168, 76, 0.1); color: var(--ar-gold); }

.stat-icon svg { width: 20px; height: 20px; }

.stat-label {
    font-size: 0.68rem;
    color: var(--ar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--ar-text);
    line-height: 1;
    margin-bottom: 0.35rem;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
}

.stat-trend.up { color: var(--ar-success); }
.stat-trend.down { color: var(--ar-danger); }
.stat-trend.neutral { color: var(--ar-text-muted); }

.stat-trend svg { width: 13px; height: 13px; }

/* ── Content Grids ──────────────────────────────────── */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.content-grid.triple { grid-template-columns: 1fr 1fr 1fr; }
.content-grid.wide-left { grid-template-columns: 5fr 3fr; }
.content-grid.wide-right { grid-template-columns: 3fr 5fr; }
.content-grid .full-width { grid-column: 1 / -1; }

/* ── Tables — Tighter, editorial ────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ar-text-muted);
    font-weight: 700;
    border-bottom: 2px solid var(--ar-border);
    background: transparent;
}

.data-table tbody td {
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--ar-border-light);
    vertical-align: middle;
}

.data-table tbody tr { transition: var(--ar-transition); }
.data-table tbody tr:hover { background: var(--ar-cream-warm); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Status Badges ──────────────────────────────────── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-status.active { background: var(--ar-success-bg); color: var(--ar-success); }
.badge-status.pending { background: var(--ar-warning-bg); color: var(--ar-warning); }
.badge-status.inactive { background: var(--ar-danger-bg); color: var(--ar-danger); }
.badge-status.info { background: var(--ar-info-bg); color: var(--ar-info); }
.badge-status.orange { background: var(--ar-amber-glow); color: var(--ar-amber); }

.badge-status .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--ar-radius-sm);
    font-weight: 700;
    font-size: 0.8rem;
    transition: var(--ar-transition);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary {
    background: var(--ar-amber);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--ar-amber-deep);
    box-shadow: var(--ar-shadow-amber);
}

.btn-secondary {
    background: var(--ar-card);
    color: var(--ar-text);
    border: 1px solid var(--ar-border);
}

.btn-secondary:hover { background: var(--ar-parchment); }

.btn-ghost {
    color: var(--ar-text-secondary);
    padding: 0.4rem 0.6rem;
}

.btn-ghost:hover { background: var(--ar-parchment); color: var(--ar-text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.72rem; }

/* ── Chart Container ────────────────────────────────── */
.chart-container {
    position: relative;
    height: 260px;
    width: 100%;
}

.chart-container canvas { width: 100% !important; height: 100% !important; }

/* ── Calendar ───────────────────────────────────────── */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}

.calendar-header-cell {
    padding: 0.4rem;
    text-align: center;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ar-text-muted);
    font-weight: 700;
}

.calendar-cell {
    aspect-ratio: 1;
    padding: 0.35rem;
    border: 1px solid var(--ar-border-light);
    border-radius: 3px;
    font-size: 0.75rem;
    position: relative;
    transition: var(--ar-transition);
    min-height: 55px;
}

.calendar-cell:hover { background: var(--ar-cream-warm); }

.calendar-cell .day-num {
    font-weight: 700;
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.9rem;
    color: var(--ar-text-secondary);
}

.calendar-cell.today { background: var(--ar-amber-glow); }
.calendar-cell.today .day-num { color: var(--ar-amber); }
.calendar-cell.other-month { opacity: 0.3; }

.calendar-event {
    display: block;
    font-size: 0.55rem;
    padding: 0.05rem 0.25rem;
    border-radius: 2px;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.calendar-event.visit { background: var(--ar-amber-glow); color: var(--ar-amber); }
.calendar-event.priority { background: var(--ar-danger-bg); color: var(--ar-danger); }
.calendar-event.collection { background: var(--ar-success-bg); color: var(--ar-success); }

/* ── Progress Bar ───────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 5px;
    background: var(--ar-border-light);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.orange { background: var(--ar-amber); }
.progress-fill.green { background: var(--ar-success); }
.progress-fill.blue { background: var(--ar-info); }
.progress-fill.gold { background: var(--ar-gold); }

/* ── Activity Feed ──────────────────────────────────── */
.activity-list { list-style: none; }

.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--ar-border-light);
}

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

.activity-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-top: 0.45rem;
    flex-shrink: 0;
}

.activity-dot.orange { background: var(--ar-amber); }
.activity-dot.green { background: var(--ar-success); }
.activity-dot.blue { background: var(--ar-info); }
.activity-dot.gold { background: var(--ar-gold); }

.activity-text {
    font-size: 0.82rem;
    color: var(--ar-text-secondary);
    line-height: 1.4;
}

.activity-text strong { color: var(--ar-text); font-weight: 600; }

.activity-time {
    font-size: 0.68rem;
    color: var(--ar-text-muted);
    margin-top: 0.1rem;
}

/* ── Metal Bars ─────────────────────────────────────── */
.metal-bars {
    display: flex;
    gap: 0.85rem;
    justify-content: center;
    padding: 0.75rem 0;
}

.metal-bar { text-align: center; }

.metal-bar-visual {
    width: 44px;
    height: 100px;
    border-radius: 4px 4px 1px 1px;
    margin: 0 auto 0.4rem;
    position: relative;
    overflow: hidden;
}

.metal-bar-visual::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 50%;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
}

.metal-bar-visual.gold-bar { background: linear-gradient(180deg, #E8C44A, #A07818); }
.metal-bar-visual.platinum-bar { background: linear-gradient(180deg, #D0D2D8, #8A8C92); }
.metal-bar-visual.palladium-bar { background: linear-gradient(180deg, #B8BAC0, #707478); }
.metal-bar-visual.silver-bar { background: linear-gradient(180deg, #C4C8D0, #808488); }

.metal-bar .metal-name {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--ar-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metal-bar .metal-pct {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ar-text);
}

/* ── Rep Cards ──────────────────────────────────────── */
.rep-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem;
    border: 1px solid var(--ar-border-light);
    border-radius: var(--ar-radius);
    transition: var(--ar-transition);
    margin-bottom: 0.6rem;
}

.rep-card:hover {
    border-color: var(--ar-amber);
    background: var(--ar-cream-warm);
}

.rep-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--ar-radius);
    background: var(--ar-warm-black);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ar-cream);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.rep-info { flex: 1; }
.rep-info .rep-name { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.1rem; }
.rep-info .rep-region { font-size: 0.72rem; color: var(--ar-text-muted); }

.rep-stats { display: flex; gap: 1rem; text-align: center; }

.rep-stat-item .rs-val {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--ar-text);
}

.rep-stat-item .rs-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ar-text-muted);
    font-weight: 600;
}

/* ── Tabs ───────────────────────────────────────────── */
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--ar-border);
    margin-bottom: 1.25rem;
    overflow-x: auto;
}

.tab-btn {
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ar-text-muted);
    border-bottom: 2px solid transparent;
    transition: var(--ar-transition);
    margin-bottom: -2px;
    white-space: nowrap;
}

.tab-btn:hover { color: var(--ar-text); }

.tab-btn.active {
    color: var(--ar-amber);
    border-bottom-color: var(--ar-amber);
    font-weight: 700;
}

/* ── Timeline ───────────────────────────────────────── */
.timeline { position: relative; padding-left: 1.5rem; }

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--ar-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.1rem;
    padding-left: 1.1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.35rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ar-card);
    border: 2px solid var(--ar-amber);
}

.timeline-item.completed::before {
    background: var(--ar-success);
    border-color: var(--ar-success);
}

.timeline-item .tl-time {
    font-size: 0.68rem;
    color: var(--ar-text-muted);
    font-weight: 600;
}

.timeline-item .tl-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin: 0.1rem 0;
}

.timeline-item .tl-desc {
    font-size: 0.78rem;
    color: var(--ar-text-secondary);
}

/* ── Filter Bar ─────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--ar-border);
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ar-text-secondary);
    transition: var(--ar-transition);
    background: var(--ar-card);
}

.filter-chip:hover, .filter-chip.active {
    border-color: var(--ar-amber);
    color: var(--ar-amber);
    background: var(--ar-amber-glow);
}

.filter-chip svg { width: 13px; height: 13px; }

/* ── Form controls ──────────────────────────────────── */
.form-control {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--ar-border);
    border-radius: var(--ar-radius-sm);
    background: var(--ar-card);
    color: var(--ar-text);
    font-size: 0.82rem;
    outline: none;
    transition: var(--ar-transition);
}

.form-control:focus {
    border-color: var(--ar-amber);
    box-shadow: 0 0 0 2px var(--ar-amber-glow);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B5E52' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 1.75rem;
}

/* ── WTN Form ───────────────────────────────────────── */
.wtn-form { max-width: 600px; }
.wtn-form .form-group { margin-bottom: 0.85rem; }

.wtn-form label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--ar-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
}

.wtn-form .form-control { width: 100%; }
.wtn-form textarea.form-control { min-height: 70px; resize: vertical; }

.signature-pad {
    width: 100%;
    height: 100px;
    border: 1px dashed var(--ar-border);
    border-radius: var(--ar-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ar-text-muted);
    font-size: 0.8rem;
    background: var(--ar-cream);
    cursor: pointer;
    transition: var(--ar-transition);
}

.signature-pad:hover { border-color: var(--ar-amber); color: var(--ar-amber); }

/* ── Finance ────────────────────────────────────────── */
.finance-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.finance-item {
    text-align: center;
    padding: 1.1rem;
    background: var(--ar-parchment);
    border-radius: var(--ar-radius);
    border: 1px solid var(--ar-border-light);
}

.finance-item .fi-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ar-text-muted);
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.finance-item .fi-value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 700;
}

.finance-item .fi-value.revenue { color: var(--ar-success); }
.finance-item .fi-value.expense { color: var(--ar-danger); }
.finance-item .fi-value.profit { color: var(--ar-amber); }

.integration-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    background: var(--ar-cream);
    border: 1px solid var(--ar-border);
    border-radius: var(--ar-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.integration-badge .int-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ar-success);
    animation: pulse 2s infinite;
}

/* ── Map Placeholder ────────────────────────────────── */
.map-placeholder {
    height: 220px;
    background: var(--ar-parchment);
    border-radius: var(--ar-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ar-text-muted);
    font-size: 0.82rem;
    border: 1px dashed var(--ar-border);
    position: relative;
    overflow: hidden;
}

.map-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 25% 35%, rgba(212, 133, 10, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 75% 65%, rgba(201, 168, 76, 0.05) 0%, transparent 40%);
}

.map-placeholder span { position: relative; z-index: 1; }

/* ── Donut Chart ────────────────────────────────────── */
.donut-chart { width: 140px; height: 140px; margin: 0 auto; position: relative; }

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-center .donut-val {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ar-text);
}

.donut-center .donut-label {
    font-size: 0.65rem;
    color: var(--ar-text-muted);
}

/* ── Animations ─────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn 0.4s ease-out both; }
.animate-fade-up { animation: fadeInUp 0.4s ease-out both; }

.delay-1 { animation-delay: 0.04s; }
.delay-2 { animation-delay: 0.08s; }
.delay-3 { animation-delay: 0.12s; }
.delay-4 { animation-delay: 0.16s; }
.delay-5 { animation-delay: 0.2s; }
.delay-6 { animation-delay: 0.24s; }
.delay-7 { animation-delay: 0.28s; }
.delay-8 { animation-delay: 0.32s; }

/* ── Tooltip ────────────────────────────────────────── */
[data-tooltip] { position: relative; }

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--ar-warm-black);
    color: var(--ar-cream);
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 200;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ar-border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--ar-text-muted); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE — Mobile first approach
   ══════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-grid,
    .content-grid.triple,
    .content-grid.wide-left,
    .content-grid.wide-right { grid-template-columns: 1fr; }
    .finance-summary { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 56px;
    }

    /* Sidebar: off-canvas drawer */
    .sidebar {
        flex: 0 0 auto;
        transform: translateX(-100%);
        width: var(--sidebar-width);
        position: fixed;
        left: 0;
        bottom: 0;
        height: auto;
        align-self: auto;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(26, 23, 20, 0.3);
    }

    .sidebar-close { display: flex; }

    .mobile-overlay { display: block; pointer-events: none; }
    .mobile-overlay.active { pointer-events: auto; }

    .mobile-menu-btn { display: flex; }
    .header-logo-mobile { display: block; }

    /* Main content fills screen */
    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .top-header {
        padding: 0 1rem;
    }

    .header-left h1 {
        font-size: 1.15rem;
    }

    /* Hide search on mobile, show compact version */
    .header-search { display: none; }

    .page-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .stat-card { padding: 1rem; }

    .stat-value { font-size: 1.6rem; }

    .stat-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 0.5rem;
    }

    .stat-icon svg { width: 16px; height: 16px; }

    .content-grid,
    .content-grid.triple,
    .content-grid.wide-left,
    .content-grid.wide-right {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .finance-summary {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .card-header { padding: 0.85rem 1rem; }
    .card-body { padding: 1rem; }

    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-btn { padding: 0.5rem 0.75rem; font-size: 0.78rem; }

    .filter-bar { gap: 0.4rem; }
    .filter-chip { padding: 0.3rem 0.6rem; font-size: 0.7rem; }

    .rep-card { padding: 0.7rem; gap: 0.65rem; }
    .rep-stats { gap: 0.75rem; }

    .metal-bars { gap: 0.6rem; }
    .metal-bar-visual { width: 36px; height: 80px; }

    .calendar-cell { min-height: 44px; padding: 0.2rem; }
    .calendar-cell .day-num { font-size: 0.78rem; }
    .calendar-event { font-size: 0.5rem; }

    /* Login page mobile */
    .login-page { flex-direction: column; }
    .login-right { display: none; }
    .login-left { padding: 2rem 1.5rem; }
    .login-card { max-width: 100%; padding: 1.5rem; }
    .login-brand h1 { font-size: 1.75rem; }
}

/* Small mobile */
@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { display: flex; align-items: center; gap: 0.85rem; }
    .stat-icon { margin-bottom: 0; }
    .header-left h1 { font-size: 1rem; }
}

/* ═══════════════════════════════════════════════════════
   AI CHAT WIDGET
   ═══════════════════════════════════════════════════════ */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Karla', sans-serif;
}

/* ── Floating Action Button ─────────────────── */
.chat-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ar-amber) 0%, var(--ar-amber-deep) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(212, 133, 10, 0.4), 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    position: relative;
}

.chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(212, 133, 10, 0.5), 0 4px 12px rgba(0,0,0,0.2);
}

.chat-fab:active { transform: scale(0.95); }

.chat-fab svg {
    width: 26px;
    height: 26px;
    color: white;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-fab .chat-fab-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.chat-widget.open .chat-fab .chat-fab-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.chat-widget.open .chat-fab .chat-fab-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Ping animation */
.chat-fab-ping {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--ar-danger);
    border-radius: 50%;
    border: 2.5px solid var(--ar-cream);
    animation: chatPing 2s ease-in-out infinite;
}

.chat-widget.open .chat-fab-ping { display: none; }

@keyframes chatPing {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ── Chat Panel ─────────────────────────────── */
.chat-panel {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    max-height: 520px;
    background: var(--ar-card);
    border-radius: var(--ar-radius-lg);
    box-shadow: 0 12px 48px rgba(26, 23, 20, 0.18), 0 4px 16px rgba(26, 23, 20, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
    border: 1px solid var(--ar-border-light);
}

.chat-widget.open .chat-panel {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ── Chat Header ────────────────────────────── */
.chat-header {
    background: var(--ar-warm-black);
    color: white;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--ar-amber);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar svg {
    width: 20px;
    height: 20px;
}

.chat-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.chat-status {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}

.chat-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ADE80;
    display: inline-block;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.chat-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.chat-close:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.chat-close svg { width: 18px; height: 18px; }

/* ── Chat Messages ──────────────────────────── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--ar-cream);
    min-height: 280px;
    max-height: 340px;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--ar-border); border-radius: 3px; }

.chat-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: chatMsgIn 0.3s ease-out;
}

.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; }

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

.chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--ar-text);
}

.chat-msg.bot .chat-msg-bubble {
    background: var(--ar-card);
    border: 1px solid var(--ar-border-light);
    border-top-left-radius: 4px;
    box-shadow: var(--ar-shadow-sm);
}

.chat-msg.user .chat-msg-bubble {
    background: var(--ar-warm-black);
    color: white;
    border-top-right-radius: 4px;
}

/* Typing indicator */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    background: var(--ar-text-muted);
    border-radius: 50%;
    animation: chatTypingDot 1.4s ease-in-out infinite;
}

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

@keyframes chatTypingDot {
    0%, 60%, 100% { transform: scale(0.6); opacity: 0.4; }
    30% { transform: scale(1); opacity: 1; }
}

/* ── Chat Input ─────────────────────────────── */
.chat-input-area {
    padding: 12px 14px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--ar-border-light);
    background: var(--ar-card);
    flex-shrink: 0;
}

.chat-input-area input {
    flex: 1;
    border: 1px solid var(--ar-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Karla', sans-serif;
    font-size: 0.875rem;
    background: var(--ar-cream);
    color: var(--ar-text);
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--ar-amber);
    box-shadow: 0 0 0 3px var(--ar-amber-glow);
}

.chat-input-area input::placeholder { color: var(--ar-text-muted); }

#chatSend {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: var(--ar-amber);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}

#chatSend:hover { background: var(--ar-amber-deep); }
#chatSend:active { transform: scale(0.92); }
#chatSend svg { width: 18px; height: 18px; }

/* ── Mobile Chat ────────────────────────────── */
@media (max-width: 768px) {
    .chat-widget { bottom: 16px; right: 16px; }

    .chat-fab { width: 54px; height: 54px; }
    .chat-fab svg { width: 22px; height: 22px; }

    .chat-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: var(--ar-radius-lg) var(--ar-radius-lg) 0 0;
        transform: translateY(100%);
        transform-origin: bottom center;
    }

    .chat-widget.open .chat-panel {
        transform: translateY(0);
    }

    .chat-messages { max-height: 55vh; }
}
