/* ═══════════════════════════════════════════════════════
   GẠO NÂU CENTER — Beige Liquid Glass Design System
   ═══════════════════════════════════════════════════════ */

:root {
    /* Core — Warm Beige Palette */
    --bg-deep: #F9F7F1;
    --bg-main: #F9F7F1;
    --bg-card: rgba(235, 226, 199, 0.35);
    --bg-card-hover: rgba(235, 226, 199, 0.55);
    --bg-sidebar: #555E34;
    --border: rgba(186, 158, 105, 0.25);
    --border-light: rgba(186, 158, 105, 0.45);

    /* Glass effect */
    --glass: rgba(235, 226, 199, 0.4);
    --glass-strong: rgba(235, 226, 199, 0.6);
    --glass-blur: blur(20px);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);

    /* Brand accent — Lion Beige & Moss Green */
    --accent: #BA9E69;
    --accent-dim: rgba(186, 158, 105, 0.18);
    --accent-glow: rgba(186, 158, 105, 0.35);
    --moss: #555E34;
    --moss-dim: rgba(85, 94, 52, 0.12);

    /* Text hierarchy */
    --text: #333333;
    --text-dim: #7A7668;
    --text-muted: #A39E91;
    --text-sidebar: #EBE2C7;
    --text-sidebar-dim: rgba(235, 226, 199, 0.6);

    /* Semantic colors */
    --green: #4A7C59;
    --green-bg: rgba(74, 124, 89, 0.12);
    --red: #C45B5B;
    --red-bg: rgba(196, 91, 91, 0.1);
    --blue: #5B8CB5;
    --blue-bg: rgba(91, 140, 181, 0.1);
    --purple: #8B6FB0;
    --orange: #C4883A;

    /* Brand colors */
    --brand-gnca: #BA9E69;
    --brand-gnpf: #5B8CB5;
    --brand-gnpm: #B07498;
    --brand-gnt: #4A7C59;

    /* Layout */
    --sidebar-w: 260px;
    --header-h: 64px;
    --radius: 16px;
    --radius-sm: 12px;

    /* Typography */
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
    font-size: 14px;
}

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Gradient mesh background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 500px at 20% 20%, rgba(186, 158, 105, 0.15), transparent),
        radial-gradient(ellipse 500px 600px at 80% 30%, rgba(85, 94, 52, 0.08), transparent),
        radial-gradient(ellipse 700px 400px at 60% 80%, rgba(235, 226, 199, 0.25), transparent),
        radial-gradient(ellipse 400px 500px at 30% 70%, rgba(186, 158, 105, 0.1), transparent);
    z-index: 0;
    pointer-events: none;
}

/* ═══ Loading Screen ═══ */
.loading-screen {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: var(--bg-deep);
    z-index: 9999;
}

.loading-screen.active {
    display: grid;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 40px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--moss);
    letter-spacing: 1px;
}

.loading-bar {
    width: 200px;
    height: 3px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 16px;
}

.loading-fill {
    width: 30%;
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    animation: loadSlide 1.5s ease infinite;
}

@keyframes loadSlide {
    0% {
        transform: translateX(-100%);
        width: 30%;
    }

    50% {
        width: 60%;
    }

    100% {
        transform: translateX(400%);
        width: 30%;
    }
}

.loading-status {
    color: var(--text-dim);
    font-size: 13px;
}

/* ═══ App Layout ═══ */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ═══ Sidebar — Dark Moss Green Glass ═══ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #4A5230 0%, #555E34 40%, #4D5530 100%);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(186, 158, 105, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(85, 94, 52, 0.15);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(235, 226, 199, 0.12);
}

.logo-icon-sm {
    font-size: 28px;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 1px;
}

.sidebar-sub {
    font-size: 11px;
    color: var(--text-sidebar-dim);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-sidebar-dim);
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: rgba(235, 226, 199, 0.1);
    color: var(--text-sidebar);
}

.nav-item.active {
    background: rgba(186, 158, 105, 0.25);
    color: var(--accent);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(186, 158, 105, 0.2);
}

.nav-item .material-symbols-rounded {
    font-size: 20px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(235, 226, 199, 0.12);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.user-badge .material-symbols-rounded {
    font-size: 20px;
    color: var(--accent);
    background: rgba(186, 158, 105, 0.2);
    padding: 6px;
    border-radius: 10px;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sidebar);
}

.user-role {
    font-size: 11px;
    color: var(--text-sidebar-dim);
}

.sidebar-version {
    font-size: 10px;
    color: rgba(235, 226, 199, 0.3);
    margin-top: 4px;
}

/* ═══ Main Content ═══ */
.main-content {
    grid-column: 2;
    min-height: 100vh;
}

/* Header — Frosted Glass */
.main-header {
    position: sticky;
    top: 0;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: rgba(249, 247, 241, 0.75);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

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

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--moss);
}

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

.period-selector {
    display: flex;
    gap: 6px;
}

.sel-input {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

.sel-input:focus {
    border-color: var(--accent);
}

.sel-input option {
    background: #F5F0E8;
}

.refresh-btn {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s;
}

.refresh-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.refresh-btn.spinning .material-symbols-rounded {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.last-update {
    font-size: 11px;
    color: var(--text-muted);
}

/* ═══ Freshness Badge ═══ */
.freshness-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    transition: all 0.3s ease;
    cursor: default;
}

.freshness-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s ease;
    flex-shrink: 0;
}

/* Fresh — Green pulse */
.freshness-badge.fresh {
    border-color: rgba(74, 124, 89, 0.3);
    color: var(--green);
}

.freshness-badge.fresh .freshness-dot {
    background: var(--green);
    box-shadow: 0 0 6px rgba(74, 124, 89, 0.5);
    animation: freshPulse 2s ease-in-out infinite;
}

@keyframes freshPulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 4px rgba(74, 124, 89, 0.4);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 10px rgba(74, 124, 89, 0.6);
    }
}

/* Stale — Amber */
.freshness-badge.stale {
    border-color: rgba(196, 136, 58, 0.3);
    color: var(--orange);
}

.freshness-badge.stale .freshness-dot {
    background: var(--orange);
    box-shadow: 0 0 4px rgba(196, 136, 58, 0.4);
}

/* Expired — Red */
.freshness-badge.expired {
    border-color: rgba(196, 91, 91, 0.3);
    color: var(--red);
}

.freshness-badge.expired .freshness-dot {
    background: var(--red);
    box-shadow: 0 0 6px rgba(196, 91, 91, 0.4);
    animation: expiredPulse 1s ease-in-out infinite;
}

@keyframes expiredPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* None — dim */
.freshness-badge.none {
    opacity: 0.5;
}

/* ═══ HR Department Bars ═══ */
.hr-dept-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dept-bar-item {
    display: grid;
    grid-template-columns: 100px 1fr 80px;
    align-items: center;
    gap: 12px;
}

.dept-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.dept-bar-wrap {
    background: rgba(235, 226, 199, 0.1);
    border-radius: 6px;
    height: 28px;
    overflow: hidden;
}

.dept-bar {
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    min-width: 30px;
    transition: width 0.6s ease;
}

.dept-bar-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bg);
}

.dept-branch {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ═══ Sale Leaderboard ═══ */
.leaderboard-item {
    display: grid;
    grid-template-columns: 36px 1fr 100px;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

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

.lb-rank {
    text-align: center;
}

.lb-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lb-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.lb-branch {
    font-size: 0.75rem;
    font-weight: 400;
    margin-left: 6px;
}

.lb-bar-wrap {
    height: 6px;
    background: rgba(235, 226, 199, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.lb-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.lb-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.lb-don {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.lb-rate {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ═══ Schedule Cards ═══ */
.schedule-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.schedule-card {
    background: rgba(235, 226, 199, 0.06);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.schedule-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.schedule-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.schedule-detail {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ═══ Status Badges ═══ */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.active {
    background: rgba(125, 145, 95, 0.15);
    color: var(--green);
}

.status-badge.live {
    background: rgba(174, 149, 108, 0.15);
    color: var(--accent);
}

.status-badge.overdue {
    background: rgba(200, 85, 61, 0.15);
    color: var(--red);
}

/* ═══ KPI Alert ═══ */
.kpi-alert {
    animation: alertPulse 2s ease-in-out infinite;
}

@keyframes alertPulse {

    0%,
    100% {
        box-shadow: none;
    }

    50% {
        box-shadow: 0 0 0 3px rgba(200, 85, 61, 0.2);
    }
}

/* ═══ Full-width Chart Card ═══ */
.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-wrap.chart-wide {
    height: 300px;
}

/* ═══ Pages ═══ */
.page {
    display: none;
    padding: 24px 28px;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══ KPI Grid — Glass Cards ═══ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(186, 158, 105, 0.08);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--kpi-color, var(--accent));
    opacity: 0.7;
}

.kpi-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(186, 158, 105, 0.15);
}

.kpi-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 6px;
    color: var(--moss);
}

.kpi-delta {
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 8px;
}

.kpi-delta.up {
    color: var(--green);
    background: var(--green-bg);
}

.kpi-delta.down {
    color: var(--red);
    background: var(--red-bg);
}

.kpi-delta.neutral {
    color: var(--text-dim);
    background: var(--glass);
}

/* ═══ Cards — Glass Style ═══ */
.card {
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(186, 158, 105, 0.06);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: 0 8px 24px rgba(186, 158, 105, 0.1);
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--moss);
    margin-bottom: 16px;
}

/* Charts — Glass */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 24px;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(186, 158, 105, 0.06);
}

.chart-card:hover {
    border-color: var(--border-light);
    box-shadow: 0 8px 24px rgba(186, 158, 105, 0.1);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-wrap {
    position: relative;
    height: 280px;
}

.chart-wide {
    height: 320px;
}

/* ═══ Data Table — Glass ═══ */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(186, 158, 105, 0.12);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(235, 226, 199, 0.3);
}

.data-table .brand-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.data-table .total-row {
    font-weight: 700;
    background: var(--accent-dim);
}

.data-table .total-row td {
    border-bottom: none;
}

/* ═══ Brand Ranking — Glass ═══ */
.brand-ranking {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rank-item {
    display: grid;
    grid-template-columns: 40px 1fr 120px;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(186, 158, 105, 0.06);
}

.rank-item:hover {
    border-color: var(--accent);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(186, 158, 105, 0.12);
}

.rank-num {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
}

.rank-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--moss);
    margin-bottom: 4px;
}

.rank-info p {
    font-size: 12px;
    color: var(--text-dim);
}

.rank-value {
    text-align: right;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.rank-bar {
    grid-column: 1 / -1;
    height: 6px;
    background: rgba(186, 158, 105, 0.15);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.rank-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease;
}

/* ═══ Alerts ═══ */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(8px);
}

.alert-item.warn {
    background: rgba(196, 136, 58, 0.1);
    border: 1px solid rgba(196, 136, 58, 0.25);
    color: var(--orange);
}

.alert-item.danger {
    background: var(--red-bg);
    border: 1px solid rgba(196, 91, 91, 0.2);
    color: var(--red);
}

.alert-item.info {
    background: var(--blue-bg);
    border: 1px solid rgba(91, 140, 181, 0.2);
    color: var(--blue);
}

.alert-item .material-symbols-rounded {
    font-size: 20px;
}

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
    }

    .main-content {
        grid-column: 1;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(85, 94, 52, 0.3);
    }

    .mobile-menu-btn {
        display: grid;
    }

    .page {
        padding: 16px;
    }

    .main-header {
        padding: 0 16px;
    }

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

    .charts-row {
        grid-template-columns: 1fr;
    }

    .header-right {
        gap: 8px;
    }

    .last-update {
        display: none;
    }

    .freshness-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 22px;
    }
}

/* ═══ Data Sources Page — Glass ═══ */
.badge {
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-dim);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 20px;
    margin-left: 4px;
}

.ds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.ds-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(186, 158, 105, 0.06);
}

.ds-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(186, 158, 105, 0.12);
}

.ds-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ds-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--moss);
}

.ds-card-status {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ds-card-status.connected {
    color: var(--green);
    background: var(--green-bg);
}

.ds-card-status.empty {
    color: var(--orange);
    background: rgba(196, 136, 58, 0.1);
}

.ds-card-status.offline {
    color: var(--red);
    background: var(--red-bg);
}

.ds-card-desc {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 10px;
    line-height: 1.5;
}

.ds-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ds-card-tag {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ds-card-tag .material-symbols-rounded {
    font-size: 14px;
}

/* Add Sheet Form */
.add-sheet-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.ds-input {
    background: rgba(249, 247, 241, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    grid-column: 1 / -1;
}

.ds-input:focus {
    border-color: var(--accent);
}

.ds-select {
    background: rgba(249, 247, 241, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

.ds-select option {
    background: #F5F0E8;
}

.ds-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ds-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(186, 158, 105, 0.3);
}

/* Brand Summary Grid */
.ds-brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.ds-brand-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-sm);
    padding: 16px;
    border-top: 3px solid var(--brand-color, var(--accent));
}

.ds-brand-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--moss);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ds-brand-card .ds-brand-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ds-brand-stat {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.ds-brand-stat span:first-child {
    color: var(--text-dim);
}

.ds-brand-stat span:last-child {
    font-weight: 600;
}

/* ═══ AI Advisor Chat — Glass ═══ */
.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h) - 48px);
    max-height: 800px;
}

.ai-welcome {
    text-align: center;
    padding: 48px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ai-welcome-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.ai-welcome h3 {
    font-size: 22px;
    font-weight: 800;
    color: var(--moss);
    margin-bottom: 8px;
}

.ai-welcome p {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.7;
    max-width: 400px;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

.ai-suggest-btn {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 20px;
    font-family: var(--font);
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-suggest-btn:hover {
    border-color: var(--accent);
    color: var(--moss);
    transform: translateY(-1px);
    background: var(--accent-dim);
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-msg {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.ai-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ai-msg.ai .ai-msg-avatar {
    background: var(--moss-dim);
}

.ai-msg.user .ai-msg-avatar {
    background: var(--accent-dim);
}

.ai-msg-bubble {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    line-height: 1.7;
}

.ai-msg.ai .ai-msg-bubble {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-top-left-radius: 4px;
    box-shadow: 0 2px 12px rgba(186, 158, 105, 0.06);
}

.ai-msg.user .ai-msg-bubble {
    background: var(--accent-dim);
    border: 1px solid rgba(186, 158, 105, 0.3);
    color: var(--moss);
    border-top-right-radius: 4px;
}

.ai-msg-bubble strong {
    color: var(--moss);
}

.ai-msg-bubble ul,
.ai-msg-bubble ol {
    margin-left: 16px;
}

.ai-input-area {
    padding: 16px 0 0;
    border-top: 1px solid var(--border);
}

.ai-input-wrap {
    display: flex;
    gap: 8px;
}

.ai-input {
    flex: 1;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: var(--text);
    padding: 14px 18px;
    border-radius: 24px;
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-input::placeholder {
    color: var(--text-muted);
}

.ai-input:focus {
    border-color: var(--accent);
}

.ai-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(186, 158, 105, 0.3);
}

.ai-send-btn:hover {
    background: #A88D5C;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(186, 158, 105, 0.4);
}

.ai-disclaimer {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

.ai-typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.ai-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: typingBounce 1.2s infinite;
}

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

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

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }
}

/* ═══════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════ */

.login-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F9F7F1 0%, #EBE2C7 40%, #D4C8A0 70%, #BA9E69 100%);
    background-size: 400% 400%;
    animation: loginBg 12s ease infinite;
}

@keyframes loginBg {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.login-logo {
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 2px;
    margin: 0;
}

.login-logo p {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 4px;
}

.login-field {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(235, 226, 199, 0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.login-field:focus-within {
    border-color: var(--accent);
    background: rgba(235, 226, 199, 0.5);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.login-field .material-symbols-rounded {
    color: var(--text-dim);
    font-size: 20px;
}

.login-field input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
}

.login-field input::placeholder {
    color: var(--text-dim);
    opacity: 0.7;
}

.login-error {
    color: #d32f2f;
    font-size: 0.82rem;
    margin: 4px 0 12px;
    text-align: left;
    padding-left: 4px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--moss);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.login-btn:hover {
    background: #6a7a3f;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(85, 94, 52, 0.3);
}

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

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-footer {
    margin-top: 24px;
    font-size: 0.75rem;
    color: var(--text-dim);
    opacity: 0.7;
}

/* ─── Sidebar Logout Button ─── */

.user-badge {
    position: relative;
}

.logout-btn {
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.logout-btn .material-symbols-rounded {
    font-size: 18px;
}