* {
    box-sizing: border-box;
}

:root {
    /* Core surfaces, lifted straight from Discord's dark theme layers */
    --bg: #313338;
    --panel: #2b2d31;
    --panel-2: #232428;
    --input-bg: #1e1f22;
    --border: #1e1f22;
    --border-strong: #3f4147;

    --text: #f2f3f5;
    --muted: #b5bac1;
    --muted-2: #949ba4;

    --accent: #ff5fa8;
    --accent-hover: #e63f8f;
    --accent-text: #ff9fc9;
    --accent-light: rgba(255, 95, 168, 0.16);
    --accent-border: rgba(255, 95, 168, 0.45);
    --accent-gradient: linear-gradient(135deg, #ff8fc7 0%, #ffffff 100%);

    --success: #23a559;
    --success-bg: rgba(35, 165, 89, 0.16);
    --danger: #f23f42;
    --danger-bg: rgba(242, 63, 66, 0.16);

    --shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);

    --bg-translucent: rgba(49, 51, 56, 0.82);

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 8px;

    /* SIDEBAR (channel-list styling) */
    --sidebar: #2b2d31;
    --sidebar-hover: #35373c;
    --sidebar-active: #404249;
    --sidebar-text: #f2f3f5;
    --sidebar-muted: #949ba4;

    --focus-ring: 0 0 0 2px rgba(255, 95, 168, 0.6);
}


/* Discord-style LIGHT theme, same variable set */

[data-theme="light"] {

    --bg: #ffffff;
    --panel: #f2f3f5;
    --panel-2: #e3e5e8;
    --input-bg: #ebedef;
    --border: #e3e5e8;
    --border-strong: #d3d5d9;

    --text: #060607;
    --muted: #5c5e66;
    --muted-2: #6d6f78;

    --accent: #ff5fa8;
    --accent-hover: #e63f8f;
    --accent-text: #d6337f;
    --accent-light: rgba(255, 95, 168, 0.14);
    --accent-border: rgba(255, 95, 168, 0.35);
    --accent-gradient: linear-gradient(135deg, #ff8fc7 0%, #ffffff 100%);

    --success: #15803d;
    --success-bg: rgba(21, 128, 61, 0.14);
    --danger: #d83c3e;
    --danger-bg: rgba(216, 60, 62, 0.14);

    --shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.16);

    --bg-translucent: rgba(255, 255, 255, 0.82);

    --sidebar: #f2f3f5;
    --sidebar-hover: #e3e5e8;
    --sidebar-active: #d8dade;
    --sidebar-text: #060607;
    --sidebar-muted: #5c5e66;

    --focus-ring: 0 0 0 2px rgba(255, 95, 168, 0.5);
}


[data-theme="light"] .logo span {
    color: #d6337f;
}


[data-theme="light"] .sidebar-note span {
    color: #80838b;
}


[data-theme="light"] .history-target-badge.hit {
    color: #15803d;
}


[data-theme="light"] .btn {
    background: #e3e5e8;
    color: #060607;
}


[data-theme="light"] .btn:hover {
    background: #d3d5d9;
}


[data-theme="light"] .btn.primary {
    background: var(--accent-gradient);
    color: #3d1a2b;
}


[data-theme="light"] .btn.primary:hover {
    background: var(--accent-hover);
}


[data-theme="light"] .sale-net {
    color: #15803d;
}


html {
    font-size: 16px;
}


body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    transition: background 0.15s ease, color 0.15s ease;
    font-family:
        "gg sans",
        "Noto Sans",
        "Helvetica Neue",
        Helvetica,
        Arial,
        sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}


button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}


button {
    cursor: pointer;
}


/* Discord-style thin scrollbars */

* {
    scrollbar-width: thin;
    scrollbar-color: #1a1b1e transparent;
}


::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}


::-webkit-scrollbar-track {
    background: transparent;
}


::-webkit-scrollbar-thumb {
    background: #1a1b1e;
    border-radius: 4px;
}


::-webkit-scrollbar-thumb:hover {
    background: #131316;
}


/* Visible keyboard focus everywhere */

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}


/* ================= APP ================= */

.app {
    height: 100vh;
    display: flex;
}


/* ================= SIDEBAR ================= */

.sidebar {
    width: 224px;
    flex: 0 0 224px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 22px 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: width 0.18s ease, flex-basis 0.18s ease, padding 0.18s ease;
    overflow-x: hidden;
    z-index: 30;
}


.sidebar-collapse-btn {
    position: absolute;
    top: 14px;
    right: -12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-2);
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    color: var(--sidebar-muted);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    z-index: 6;
    transition: background 0.12s, color 0.12s, transform 0.18s ease;
}


.sidebar-collapse-btn:hover {
    background: var(--sidebar-hover);
    color: var(--text);
}


.logo {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.2px;
    padding: 4px 10px 24px;
    color: var(--sidebar-text);
}


.logo span {
    color: #ff9fc9;
}


nav {
    display: grid;
    gap: 2px;
}


.nav-btn {
    position: relative;
    border: 0;
    background: transparent;
    color: var(--sidebar-muted);
    text-align: left;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}


.nav-btn:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}


.nav-btn.active {
    background: var(--sidebar-active);
    color: #ffffff;
    font-weight: 600;
}


.nav-btn.active::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    border-radius: 2px;
    background: var(--accent-gradient);
}


.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}


.settings-group {
    position: relative;
    width: 100%;
}


.settings-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 36px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--sidebar-text);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, width 0.18s ease, height 0.18s ease, padding 0.18s ease;
}


.settings-btn:hover,
.settings-group.open .settings-btn {
    background: var(--sidebar-hover);
    border-color: var(--border-strong);
}


.settings-btn-icon {
    font-size: 14px;
}


.settings-popover {
    display: none;
    flex-direction: column;
    gap: 10px;
    position: absolute;
    left: 8px;
    bottom: calc(100% + 8px);
    width: 190px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 9999;
}


.settings-group.open .settings-popover {
    display: flex;
}


.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--sidebar-text);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    transition: background 0.12s, border-color 0.12s;
}


.theme-toggle:hover {
    background: var(--sidebar-hover);
    border-color: var(--border-strong);
}


.theme-toggle .theme-toggle-icon {
    font-size: 14px;
}


.backup-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


.backup-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 36px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--sidebar-text);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, width 0.18s ease, height 0.18s ease, padding 0.18s ease;
}


.backup-btn:hover {
    background: var(--sidebar-hover);
    border-color: var(--border-strong);
}


.backup-btn .backup-btn-icon {
    font-size: 14px;
}


.account-btn.hidden {
    display: none;
}

.account-btn {
    justify-content: space-between;
}

.account-btn #accountEmail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    text-align: left;
}

.account-btn-signout {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-text);
    opacity: 0.75;
    flex-shrink: 0;
}

.account-btn:hover .account-btn-signout {
    opacity: 1;
}


.google-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    color: #4285f4;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}


.sidebar-note {
    color: var(--sidebar-muted);
    font-size: 11.5px;
    line-height: 1.6;
    padding: 12px 10px 4px;
    border-top: 1px solid var(--border);
}


.sidebar-note span {
    display: block;
    color: #6f7481;
    margin-top: 2px;
}


/* ================= SIDEBAR COLLAPSED ================= */

.app.sidebar-collapsed .sidebar {
    width: 48px;
    flex-basis: 48px;
    padding: 12px 0;
    overflow: visible;
}


.app.sidebar-collapsed .sidebar-collapse-btn {
    transform: rotate(180deg);
}


.app.sidebar-collapsed .logo,
.app.sidebar-collapsed .nav-btn span,
.app.sidebar-collapsed .settings-btn span:not(.settings-btn-icon),
.app.sidebar-collapsed .account-btn span:not(.backup-btn-icon),
.app.sidebar-collapsed .sidebar-note {
    display: none;
}


.app.sidebar-collapsed .settings-group {
    display: flex;
    justify-content: center;
}


.app.sidebar-collapsed nav {
    gap: 0;
    margin-top: 28px;
}


.app.sidebar-collapsed .nav-btn {
    justify-content: center;
    text-align: center;
    width: 48px;
    height: 48px;
    padding: 0;
    margin: 0;
    border-radius: 0;
    font-size: 20px;
}


.app.sidebar-collapsed .nav-btn.active::before {
    left: 0;
    width: 2px;
    height: 22px;
}


.app.sidebar-collapsed .sidebar-bottom {
    align-items: center;
    gap: 6px;
}


.app.sidebar-collapsed .settings-btn,
.app.sidebar-collapsed .account-btn {
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}


.app.sidebar-collapsed .settings-btn-icon {
    font-size: 15px;
}

/* ================= MAIN ================= */

.main {
    flex: 1;
    min-width: 0;
    max-width: 1080px;
    padding: 0 32px 40px;
    overflow-y: auto;
}


.mobile-header {
    display: none;
}


.mobile-theme-toggle {
    display: none;
}


.page {
    display: none;
}


.page.active {
    display: flow-root;
}


/* ================= HEADERS ================= */

.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}


/* ================= STICKY TOP BAR =================
   Used on Models, Scripts, and Sales tabs so the header/search/
   stats stay pinned while the list below scrolls underneath. */

.page-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-translucent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    margin: 0 -32px 16px;
    padding: 15px 32px 10px;
    box-shadow: 0 8px 12px -6px rgba(0, 0, 0, 0.35);
}


.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}


.sales-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}


.active-model-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--badge-text, #fff);
    background: var(--badge-color, var(--accent));
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.25);
    animation: badge-pop 0.18s ease;
    cursor: pointer;
}

.active-model-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--badge-dot, #fff);
    opacity: 0.85;
    flex-shrink: 0;
}

.active-model-badge.hidden {
    display: none;
}

@keyframes badge-pop {
    from {
        transform: scale(0.85);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}


h1 {
    font-family: "Playfair Display", "Georgia", serif;
    font-style: italic;
    font-weight: 600;
    font-size: 30px;
    margin: 0 0 4px;
    letter-spacing: 0.2px;
    color: var(--text);
}


h2 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text);
}


.sub {
    color: var(--muted);
    font-size: 13.5px;
    margin: 0;
}


#todayLabel {
    color: var(--accent-text);
    font-weight: 600;
}


/* ================= CARDS ================= */

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow);
}


.section {
    margin-top: 14px;
}


.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}


/* ================= SALES ================= */

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}


.stat-icon {
    display: inline-flex;
    font-size: 13px;
    margin-right: 5px;
    opacity: 0.85;
}


.stat-label {
    display: flex;
    align-items: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}


.stat {
    font-size: 28px;
    font-weight: 800;
    margin-top: 8px;
    letter-spacing: -0.3px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}


.net {
    color: var(--success);
}


.card:has(#saleForm) {
    padding: 14px 18px;
}


.card-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: stretch;
}


.card-row .card {
    display: flex;
    flex-direction: column;
}


.card-row .card form,
.card-row .card .target-progress {
    margin-top: auto;
}


/* Add sale + Daily target stacked on the left, Today's sales filling the right */

.sales-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}


.sales-layout-left {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    min-width: 0;
}


.sales-layout-left .target-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 140px;
    min-width: 0;
}


.target-progress.hidden {
    display: none;
}


.target-breakdown-wrap {
    position: relative;
    margin-top: 14px;
    display: none;
}


.target-breakdown-wrap.active {
    display: block;
}


.target-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 2px;
}


.target-breakdown-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: grab;
    padding: 6px 12px;
    min-height: 74px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: var(--badge-color, var(--panel-2));
    color: var(--row-strong, rgba(0, 0, 0, 0.8));
    transition: filter 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}


.target-breakdown-row:hover {
    filter: brightness(0.96);
}


.target-breakdown-row.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), 0 6px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}


.target-breakdown-row.selected:hover {
    filter: brightness(0.97);
}


.target-breakdown-row.selected .target-breakdown-title {
    font-weight: 800;
}


.target-breakdown-row.dragging {
    opacity: 0.4;
}


.target-breakdown-row.drag-over {
    box-shadow: inset 0 0 0 1px var(--accent);
}


.target-breakdown-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 27px;
    font-size: 13px;
    font-weight: 600;
}


.target-breakdown-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}


.target-breakdown-title {
    display: inline-block;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(0, 0, 0, 0.92);
    font-size: 23px;
    line-height: 1.1;
    font-family: "Playfair Display", "Georgia", serif;
    font-style: italic;
}


.target-breakdown-percent {
    flex-shrink: 0;
    color: var(--row-muted, rgba(0, 0, 0, 0.55));
    font-weight: 400;
}


/* "On fire" model names — the further past target, the hotter it burns.
   Tier 1 = exactly 100% · 2 = 101–130% · 3 = 131–160% · 4 = 161–199% · 5 = 200%+ */
.target-breakdown-title.on-fire {
    display: inline-block;
}


/* Tier 1 — 100% exactly: bright gold/white pulse + subtle glow */
.target-breakdown-title.on-fire-1 {
    color: #b8860b;
    text-shadow:
        0 0 6px rgba(255, 255, 255, 0.75),
        0 0 12px rgba(255, 215, 0, 0.5);
    animation: fire-pulse-1 1.6s ease-in-out infinite;
}


/* Tier 2 — 101–130%: subtle, steady orange glow */
.target-breakdown-title.on-fire-2 {
    color: #d9660b;
    text-shadow:
        0 0 6px rgba(255, 140, 0, 0.55),
        0 0 12px rgba(255, 90, 0, 0.3);
}


/* Tier 3 — 131–160%: orange-red glow + flicker */
.target-breakdown-title.on-fire-3 {
    color: #c1440e;
    text-shadow:
        0 0 8px rgba(255, 140, 0, 0.85),
        0 0 16px rgba(255, 60, 0, 0.6),
        0 0 24px rgba(255, 0, 0, 0.35);
    animation: fire-flicker 0.9s ease-in-out infinite;
}


/* Tier 4 — 161–199%: intense multi-layer glow */
.target-breakdown-title.on-fire-4 {
    color: #a12a00;
    text-shadow:
        0 0 10px rgba(255, 180, 0, 0.95),
        0 0 20px rgba(255, 80, 0, 0.75),
        0 0 32px rgba(255, 0, 0, 0.55),
        0 0 46px rgba(255, 0, 0, 0.3);
    animation: fire-flicker 0.6s ease-in-out infinite;
}


/* Tier 5 — 200%+: maximum "blazing" effect */
.target-breakdown-title.on-fire-5 {
    color: #7a1d00;
    text-shadow:
        0 0 12px rgba(255, 225, 0, 1),
        0 0 24px rgba(255, 120, 0, 0.9),
        0 0 38px rgba(255, 40, 0, 0.75),
        0 0 55px rgba(255, 0, 0, 0.55),
        0 0 75px rgba(255, 0, 0, 0.35);
    animation: fire-flicker-intense 0.4s ease-in-out infinite;
}


/* Emoji badge next to the name, echoing the current heat tier */
.fire-badge {
    display: inline-block;
    font-size: 0.62em;
    line-height: 1;
    flex-shrink: 0;
    transform-origin: center;
}


.fire-badge-1 {
    animation: fire-pulse-1 1.6s ease-in-out infinite;
}


.fire-badge-3 {
    animation: fire-flicker 0.9s ease-in-out infinite;
}


.fire-badge-4 {
    animation: fire-flicker-intense 0.6s ease-in-out infinite;
}


.fire-badge-5 {
    animation: fire-flicker-intense 0.4s ease-in-out infinite,
        fire-badge-shake 0.4s ease-in-out infinite;
}


@keyframes fire-pulse-1 {
    0%, 100% {
        filter: brightness(1) saturate(1);
        text-shadow:
            0 0 6px rgba(255, 255, 255, 0.55),
            0 0 12px rgba(255, 215, 0, 0.35);
    }
    50% {
        filter: brightness(1.3) saturate(1.15);
        text-shadow:
            0 0 10px rgba(255, 255, 255, 1),
            0 0 20px rgba(255, 215, 0, 0.85);
    }
}


@keyframes fire-flicker {
    0%, 100% {
        filter: brightness(1) saturate(1);
    }
    25% {
        filter: brightness(1.15) saturate(1.3);
    }
    50% {
        filter: brightness(0.95) saturate(1.05);
    }
    75% {
        filter: brightness(1.2) saturate(1.4);
    }
}


@keyframes fire-flicker-intense {
    0%, 100% {
        filter: brightness(1) saturate(1);
    }
    20% {
        filter: brightness(1.35) saturate(1.5);
    }
    45% {
        filter: brightness(0.9) saturate(1.1);
    }
    70% {
        filter: brightness(1.4) saturate(1.6);
    }
    85% {
        filter: brightness(1.05) saturate(1.25);
    }
}


@keyframes fire-badge-shake {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.12) rotate(-3deg);
    }
    50% {
        transform: scale(0.96) rotate(2deg);
    }
    75% {
        transform: scale(1.1) rotate(-1deg);
    }
}


.target-breakdown-row.selected .target-breakdown-percent {
    color: var(--row-strong, rgba(0, 0, 0, 0.8));
}


.target-breakdown-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}


.target-breakdown-wrap #targetBreakdownEmpty {
    margin: 0;
}


.sales-layout-right {
    display: flex;
    flex-direction: column;
    height: 440px;
    min-height: 0;
}


.sales-layout-right .sales-list-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}


.sales-layout-right .sales-list {
    position: absolute;
    inset: 0;
    height: auto;
    max-height: none;
    overflow-y: auto;
}


.sales-layout-right #emptySales {
    position: absolute;
    inset: 0;
    margin: 0;
}


.sales-layout-right {
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    border-width: 1px;
    border-color: var(--border);
    box-shadow: var(--shadow);
}


.sales-layout-right.has-model-color {
    border-color: color-mix(in srgb, var(--card-accent, var(--border)) 55%, transparent);
    box-shadow: var(--shadow), inset 0 0 0 5px color-mix(in srgb, var(--card-accent, var(--border)) 55%, transparent);
}


#todaySalesCard {
    padding-top: 5px;
    overflow: hidden;
}


#todaySalesCard .section-head {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    row-gap: 1px;
    height: 62px;
    overflow: hidden;
    margin: 0 -13px 14px;
    padding: 6px 13px;
    background: var(--panel);
    border-bottom: none;
}


#todaySalesCard .section-head h2 {
    flex: 0 0 auto;
    white-space: nowrap;
}


.today-sales-model-name {
    display: -webkit-box;
    width: 100%;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: break-word;
    font-family: "Playfair Display", "Georgia", serif;
    font-style: italic;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.15;
    letter-spacing: 0.3px;
    text-align: right;
    color: var(--card-accent-text, var(--accent));
}


[data-theme="light"] .today-sales-model-name {
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.4);
}


.today-sales-model-name.hidden {
    display: none;
}


.sale-box,
.target-box {
    display: flex;
    gap: 8px;
}


.sale-box input,
.target-box input {
    font-size: 14px;
    padding: 10px 12px;
}


#saleAmount {
    -moz-appearance: textfield;
    appearance: textfield;
}


#saleAmount::-webkit-inner-spin-button,
#saleAmount::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


.sale-box .btn {
    flex-shrink: 0;
    padding: 10px 16px;
    font-size: 13.5px;
}


/* ================= OUTSIDE SHIFT (target card) ================= */

.outside-shift-picker {
    position: relative;
}


.outside-shift-btn {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid var(--border);
    background: none;
    color: var(--muted-2);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border-radius: 8px;
}


.outside-shift-btn:hover {
    color: var(--text);
    background: var(--panel-2);
}


.outside-shift-btn.active {
    color: var(--accent-text);
    background: var(--accent-light);
    border-color: var(--accent-border);
}


.outside-shift-popover {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    z-index: 20;
    width: 220px;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    box-shadow: var(--shadow);
}


.outside-shift-popover.hidden {
    display: none;
}


.outside-shift-popover form {
    display: flex;
    gap: 6px;
}


.outside-shift-popover input {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    padding: 8px 10px;
}


.outside-shift-popover .btn {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 13px;
}


/* ================= MODEL PICKER (target card) ================= */

.target-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.model-picker {
    position: relative;
}

.model-picker-list {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    min-width: 160px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    box-shadow: var(--shadow);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.model-picker-list.hidden {
    display: none;
}

.model-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}

.model-picker-item:hover {
    background: var(--panel-2);
}

.model-picker-empty {
    padding: 8px 10px;
    color: var(--muted);
    font-size: 13px;
}


/* ================= MODEL COLOR PICKER (pastel swatches) ================= */

.color-swatch-popover {
    position: fixed;
    z-index: 500;
    width: 200px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow-lg);
}


.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.12);
    padding: 0;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.1s ease;
}


.color-swatch:hover {
    transform: scale(1.15);
}


.color-swatch.active {
    border-color: var(--text);
    box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--text);
}


.color-swatch-custom {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}


.color-swatch-custom label {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
}


.color-swatch-custom input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
}


/* ================= TARGET PROGRESS ================= */

.target-progress {
    margin-top: 14px;
}


.progress-track {
    width: 100%;
    height: 10px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}


.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 999px;
    transition: width 0.3s ease;
}


.progress-fill.hit {
    background: var(--success);
}


.progress-label {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}


/* Inside a model row, the progress bar's ink adapts to that
   row's own brightness (--row-track-bg / --row-track-fill),
   since the background isn't guaranteed to be light. */
.target-breakdown-row .progress-track {
    background: var(--row-track-bg, rgba(0, 0, 0, 0.14));
    border-color: var(--row-track-bg, rgba(0, 0, 0, 0.12));
}


.target-breakdown-row .progress-fill {
    background: var(--row-track-fill, rgba(0, 0, 0, 0.55));
}


.target-breakdown-row .progress-fill.hit {
    background: var(--success);
}


.target-breakdown-row .progress-label {
    color: var(--row-muted, rgba(0, 0, 0, 0.6));
    font-weight: 400;
}


.history-target-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-text);
    background: var(--accent-light);
}


.history-target-badge.hit {
    color: #6de6a0;
    background: var(--success-bg);
}


input,
textarea,
select {
    width: 100%;
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}


input::placeholder,
textarea::placeholder {
    color: var(--muted-2);
}


input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}


.sales-list,
.history-list {
    display: grid;
    align-content: start;
    gap: 6px;
}


.sales-list {
    max-height: 280px;
    overflow-y: auto;
    padding-right: 2px;
}


.sale-row,
.history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    gap: 10px;
}


.history-row > div:first-child {
    min-width: 0;
    overflow: hidden;
}


.history-row > div:first-child .history-date,
.history-row > div:first-child .sub {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.history-row > div:last-child {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
}


.sale-right {
    display: flex;
    align-items: center;
    gap: 14px;
}


.sale-net {
    color: #6de6a0;
    background: var(--success-bg);
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
}


.delete {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    color: var(--muted-2);
    font-size: 17px;
    line-height: 1;
    padding: 0;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}


.delete:hover {
    color: var(--danger);
    background: var(--danger-bg);
}


.history-date {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
}


.history-net {
    color: #6de6a0;
    font-size: 13px;
    font-weight: 600;
}


/* Sales history per-model breakdown */
.history-model-breakdown {
    padding: 8px 12px;
    margin: -4px 0 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}


.history-model-breakdown.hidden {
    display: none;
}


.history-model-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.9em;
    flex-wrap: wrap;
}


.history-model-row.empty {
    opacity: 0.6;
    font-style: italic;
}


.history-model-title {
    flex: 1;
}


.history-model-amount {
    margin-left: auto;
}


.avatar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}


/* Sales history — model name header shown when a specific
   model is selected on the Sales page */
.history-model-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    margin: -6px 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}


.history-model-name.hidden {
    display: none;
}


/* Sales history — single-model day detail (gross/net/PPVs +
   list of that day's sales for the selected model) */
.history-detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}


.history-detail-stat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}


.history-detail-stat-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}


.history-detail-stat-value {
    font-size: 16px;
    font-weight: 800;
    margin-top: 4px;
    color: var(--text);
}


.history-detail-sales-list {
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 2px;
}


.history-detail-sale-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}


/* ================= BUTTONS ================= */

.btn {
    border: 0;
    background: #4e5058;
    color: var(--text);
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 14px;
    transition: background 0.12s, transform 0.1s;
}


.btn:hover {
    background: #5c5e66;
}


.btn:active {
    transform: translateY(1px);
}


.btn.primary {
    background: var(--accent-gradient);
    color: #3d1a2b;
    font-weight: 600;
}


.btn.primary:hover {
    background: var(--accent-hover);
}


.top-btn {
    flex: 0 0 160px;
    width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    white-space: nowrap;
}


/* ================= EMPTY ================= */

.empty {
    color: var(--muted);
    text-align: center;
    padding: 30px 20px;
    display: none;
    font-size: 13.5px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--panel-2);
}


/* ================= CONTENT ================= */

.toolbar {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}


.chips {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    row-gap: 0;
    column-gap: 2px;
    border-bottom: 1px solid var(--border-strong);
}


.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--muted);
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 9px 12px 11px;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}


.chip:hover {
    color: var(--text);
}


.chip.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}


.chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--muted-2);
    font-size: 11px;
    font-weight: 700;
    transition: background 0.15s, color 0.15s;
}


.chip.active .chip-count {
    background: var(--accent-light);
    color: var(--accent-text);
}


.chip.add-chip {
    color: var(--accent-text);
    font-weight: 600;
}


.chip.add-chip:hover {
    color: var(--accent-hover);
}


.chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: -2px;
    border-radius: 4px;
    color: var(--muted-2);
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}


.chip:hover .chip-remove,
.chip.active .chip-remove {
    opacity: 1;
}


.chip-remove:hover {
    color: var(--danger);
    background: var(--danger-bg);
}


.chip.chip-draggable {
    cursor: grab;
}


.chip.chip-draggable.dragging {
    opacity: 0.4;
}


.chip.chip-draggable.drag-over {
    border-bottom-color: var(--accent-border);
}


.content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}


.content-card {
    position: relative;
    background: var(--panel);
    border-color: var(--border);
    height: 280px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color 0.15s;
}


.content-card:hover {
    border-color: var(--border-strong);
}


.content-card.dragging {
    opacity: 0.4;
}


.content-card.drag-over {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}


.content-card h3 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    /* clamp long titles to 2 lines so card headers stay consistent */
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}


.content-meta {
    display: inline-block;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: var(--panel-2);
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}


.content-text {
    white-space: pre-wrap;
    color: var(--muted);
    line-height: 1.6;
    font-size: 13.5px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}


.content-actions {
    display: flex;
    gap: 7px;
    margin-top: 16px;
    flex-shrink: 0;
}


.content-actions .btn {
    flex: 1;
    font-size: 12.5px;
    padding: 8px 6px;
    text-align: center;
}


/* ================= MODAL ================= */

.auth-error {
    color: #ff6767;
    font-size: 13px;
    margin: -6px 0 0;
}

.auth-error.hidden {
    display: none;
}


.sync-status {
    position: fixed;
    bottom: 16px;
    right: 16px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--muted);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.sync-status.show {
    opacity: 1;
}

.sync-status.hidden {
    display: none;
}

.sync-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
}

.sync-status.synced::before {
    background: #3ecf8e;
}

.sync-status.syncing::before {
    background: #f5c542;
}

.sync-status.offline::before {
    background: #ff6767;
}


.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 50;
}


.modal.hidden {
    display: none;
}


.modal-card {
    width: min(520px, 100%);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-lg);
}


.modal-card.wide {
    width: min(680px, 100%);
    height: min(800px, 82vh);
    display: flex;
    flex-direction: column;
}


.modal-card.wide .section-head,
.modal-card.wide .view-modal-meta,
.modal-card.wide .modal-actions {
    flex: 0 0 auto;
}


.view-modal-meta {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-2);
    margin: -6px 0 12px;
}


.view-modal-text {
    white-space: pre-wrap;
    color: var(--text);
    line-height: 1.7;
    font-size: 14px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}


.view-modal-text-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}


.view-modal-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    background: linear-gradient(to bottom, transparent, var(--bg) 65%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}


.view-modal-fade.visible {
    opacity: 1;
}


.view-modal-fade span {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    background: var(--panel-2);
    border: 1px solid var(--border);
    padding: 4px 11px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow);
}


label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 14px 0;
}


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


/* Sits at the bottom-left of the history modal, opposite
   Clear history, and only appears once a day is expanded. */
#copyLogoutBtn {
    margin-right: auto;
    opacity: 1;
    transition: opacity 0.25s ease;
}


#copyLogoutBtn.hidden {
    display: flex;
    opacity: 0;
    pointer-events: none;
}


.icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    color: var(--muted-2);
    font-size: 18px;
    line-height: 1;
    padding: 0;
    border-radius: 8px;
}


.icon-btn:hover {
    color: var(--text);
    background: var(--panel-2);
}


.icon-btn.small {
    width: 26px;
    height: 26px;
    font-size: 13px;
    border-radius: 6px;
}


.icon-btn.hidden {
    display: none;
}


.target-modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}


.color-picker-trigger {
    border-radius: 8px;
    border: 2px solid var(--border-strong);
    transition: transform 0.12s ease, border-color 0.12s ease;
}


.color-picker-trigger svg {
    width: 17px;
    height: 17px;
    color: rgba(0, 0, 0, 0.65);
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.5));
}


.color-picker-trigger:hover {
    transform: scale(1.06);
    border-color: rgba(0, 0, 0, 0.4);
}


/* ================= MOBILE ================= */

@media (max-width: 700px) {

    .sidebar {
        position: fixed;
        inset: auto 0 0 0;
        width: 100%;
        height: 66px;
        padding: 6px 6px;
        z-index: 5;
        border-right: 0;
        border-top: 1px solid var(--border);
        background: var(--sidebar);
    }


    .sidebar .logo,
    .sidebar-bottom,
    .sidebar-collapse-btn {
        display: none;
    }


    .app.sidebar-collapsed .sidebar {
        width: 100%;
        padding: 6px 6px;
    }


    .app.sidebar-collapsed .main {
        margin-left: 0;
        width: 100%;
    }


    nav {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 3px;
    }


    .nav-btn {
        text-align: center;
        padding: 9px 2px;
        font-size: 10.5px;
        color: var(--sidebar-muted);
        border-radius: 8px;
    }


    .nav-btn.active {
        background: var(--sidebar-active);
        color: #ffffff;
    }


    .nav-btn.active::before {
        left: 50%;
        top: 2px;
        transform: translateX(-50%);
        width: 16px;
        height: 3px;
    }


    .nav-btn span {
        display: block;
        margin-top: 3px;
    }


    .main {
        margin: 0;
        width: 100%;
        padding: 0 16px 90px;
    }


    .page-topbar {
        margin: 0 -16px 14px;
        padding: 18px 16px 10px;
    }


    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
    }


    .mobile-header .logo {
        padding: 0;
        font-size: 18px;
        color: var(--text);
        font-weight: 800;
    }


    .mobile-theme-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        background: var(--panel-2);
        border: 1px solid var(--border);
        border-radius: 50%;
        font-size: 15px;
        line-height: 1;
        flex-shrink: 0;
    }


    .mobile-theme-toggle:hover {
        background: var(--sidebar-hover);
        border-color: var(--border-strong);
    }


    .top {
        align-items: flex-start;
        gap: 10px;
    }


    .top .btn {
        font-size: 12px;
        padding: 9px 10px;
    }


    .top-btn {
        flex: 0 0 110px;
        width: 110px;
    }


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


    .stats .card:first-child {
        grid-column: span 2;
    }


    .stat {
        font-size: 24px;
    }


    .sale-box,
    .target-box {
        flex-direction: column;
    }


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


    .sales-layout {
        grid-template-columns: 1fr;
    }


    .sales-layout-right .sales-list-wrap {
        height: 280px;
        flex: 0 0 auto;
    }


    .sales-layout-left .target-card {
        flex: 0 0 auto;
    }


    .target-breakdown-wrap {
        flex: 0 0 auto;
    }


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


}

/* ================= TOASTS ================= */

.toast-stack {
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}


.toast {
    background: var(--panel-2, #2b2d31);
    border: 1px solid var(--border, #3f4147);
    color: var(--text, #fff);
    padding: 10px 14px;
    border-radius: var(--radius-sm, 8px);
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: 280px;
}


.toast.show {
    opacity: 1;
    transform: translateY(0);
}


.toast.success {
    border-color: var(--success-bg, #1f4d38);
    color: #6de6a0;
}


/* ================= TRENDS ================= */

.trends-card {
    /* Pinned so the card is the same size whether a model is
       selected (full chart) or not (the "select a model" message) —
       nothing here should ever depend on that state. */
    min-height: 300px;
}


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


.trend-toggle {
    display: flex;
    gap: 4px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
}


.trend-toggle-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}


.trend-toggle-btn.active {
    background: var(--accent-gradient);
    color: rgba(0, 0, 0, 0.82);
}


.trend-summary {
    font-size: 13.5px;
    color: var(--text);
    margin-bottom: 14px;
    height: 1.3em;
    line-height: 1.3em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}


.trend-up {
    color: #6de6a0;
    font-weight: 600;
}


.trend-down {
    color: var(--danger, #f26d6d);
    font-weight: 600;
}


.trend-flat {
    color: var(--muted);
    font-weight: 600;
}


.trend-bars {
    position: relative;
    height: 138px;
}


.trend-bars-inner {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100%;
}


.trend-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    font-size: 0.9em;
    text-align: center;
}


.trend-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    border-radius: 8px;
    padding: 2px 0;
}


.trend-bar-col.trend-bar-current {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .trend-bar-col.trend-bar-current {
    background: rgba(0, 0, 0, 0.05);
}


.trend-bar-col.clickable {
    cursor: pointer;
}

.trend-bar-col.clickable:hover .trend-bar-fill {
    filter: brightness(1.15);
}


.trend-bar-value {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    margin-bottom: 4px;
    height: 1.2em;
    line-height: 1.2em;
}


.trend-bar-pct {
    display: inline-block;
    margin-left: 3px;
    font-size: 9px;
    font-weight: 600;
    color: var(--accent-text);
}

.trend-bar-pct.hit {
    color: #35b978;
}


.trend-bar-track {
    width: 100%;
    max-width: 26px;
    height: 84px;
    display: flex;
    align-items: flex-end;
}


.trend-bar-fill {
    width: 100%;
    min-height: 0;
    background: var(--accent-gradient);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease, filter 0.15s ease;
}


.trend-bar-fill.target-hit {
    background: linear-gradient(180deg, #6de6a0, #2ea86a);
}


.trend-bar-fill.target-missed {
    background: linear-gradient(180deg, #ff9fc9, #d6337f);
}


.trend-bar-label {
    margin-top: 6px;
    font-size: 10.5px;
    color: var(--muted);
    white-space: nowrap;
    line-height: 1.2;
}


.trend-bar-col.trend-bar-current .trend-bar-label {
    color: var(--text);
    font-weight: 700;
}


.trend-target-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed var(--muted-2);
    opacity: 0.6;
    pointer-events: none;
}

.trend-target-line span {
    position: absolute;
    top: -14px;
    font-size: 9px;
    font-weight: 600;
    color: var(--muted);
    background: var(--panel);
    padding: 0 5px;
    white-space: nowrap;
}


.trend-extra {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    line-height: 1.3em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
