/* ═══════════════════════════════════════════════════════════════
   Home Dashboard styles
   Brand-aware: all colors pull --accent-rgb from the workspace
   container's data-brand-theme, set by router.js applyBrandTheme().
   ═══════════════════════════════════════════════════════════════ */

/* Brand theme selectors — site-wide style.css only covers ws-reports /
   ws-data / ws-admin. We add ws-home here so the Ground Control accent
   color follows the active brand. */
#ws-home[data-brand-theme="cyan"]    { --accent-rgb: 0, 229, 255; }
#ws-home[data-brand-theme="magenta"] { --accent-rgb: 255, 110, 199; }
#ws-home[data-brand-theme="amber"]   { --accent-rgb: 255, 176, 32; }
#ws-home[data-brand-theme="green"]   { --accent-rgb: 0, 255, 136; }
#ws-home[data-brand-theme="violet"]  { --accent-rgb: 167, 139, 250; }
#ws-home[data-brand-theme="coral"]   { --accent-rgb: 255, 107, 107; }

#ws-home {
    padding: 20px 28px 60px;
    max-width: 1280px;
    margin: 0 auto;
    /* default shares site dark theme; uses --accent-rgb from [data-brand-theme] */
}

#ws-home .home-page-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 18px;
}
#ws-home .home-page-head h1 {
    margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
    color: var(--text);
}
#ws-home .home-page-head .meta {
    font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
#ws-home .home-page-head .meta b {
    color: rgb(var(--accent-rgb));
    font-weight: 600;
    text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.35);
}

#ws-home .home-loading-head { margin-bottom: 10px; }
#ws-home .home-loading-shell {
    min-height: min(460px, calc(100vh - 210px));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 0;
}
#ws-home .home-loading-panel {
    width: min(680px, 100%);
    padding: 34px 38px;
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), rgba(255,255,255,0.015)),
        var(--bg-card);
    box-shadow:
        0 20px 70px rgba(0,0,0,0.42),
        0 0 34px rgba(var(--accent-rgb), 0.09);
}
#ws-home .home-loading-orb {
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 18px;
    box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.18);
}
#ws-home .home-loading-orb span {
    width: 18px; height: 18px; border-radius: 50%;
    background: rgb(var(--accent-rgb));
    animation: home-loading-pulse 1.4s ease-in-out infinite;
}
#ws-home .home-loading-copy {
    display: grid; gap: 8px; margin-bottom: 24px;
}
#ws-home .home-loading-kicker {
    font-size: 11px; font-weight: 800; color: rgb(var(--accent-rgb));
    text-transform: uppercase; letter-spacing: 0.14em;
}
#ws-home .home-loading-copy h2 {
    margin: 0; font-size: 26px; color: var(--text); letter-spacing: 0;
}
#ws-home .home-loading-copy p {
    margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.6;
}
#ws-home .home-loading-progress {
    height: 9px; border-radius: 999px; overflow: hidden;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.06);
}
#ws-home .home-loading-progress span {
    display: block; height: 100%; width: 42%;
    border-radius: inherit;
    background: linear-gradient(90deg,
        rgba(var(--accent-rgb), 0.1),
        rgba(var(--accent-rgb), 0.85),
        rgba(255,255,255,0.92),
        rgba(var(--accent-rgb), 0.85),
        rgba(var(--accent-rgb), 0.1));
    animation: home-loading-sweep 1.55s ease-in-out infinite;
}
#ws-home .home-loading-meta {
    margin-top: 12px; color: var(--text-dim);
    font-size: 12px; letter-spacing: 0.02em;
}
@keyframes home-loading-sweep {
    0% { transform: translateX(-115%); }
    100% { transform: translateX(255%); }
}
@keyframes home-loading-pulse {
    0%, 100% { transform: scale(0.7); opacity: 0.45; }
    50% { transform: scale(1); opacity: 1; }
}
@media (max-width: 640px) {
    #ws-home .home-loading-panel { padding: 28px 22px; }
    #ws-home .home-loading-copy h2 { font-size: 22px; }
}

#ws-home .home-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 1px rgba(var(--accent-rgb), 0.12);
}
#ws-home .home-card h2 {
    margin: 0 0 14px 0;
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.08em;
}

/* ── 1. KPI ── */
#ws-home .kpi-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
#ws-home .kpi-head h2 { margin: 0; font-size: 14px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 600; }
#ws-home .kpi-head h2::before { content: "▸ "; color: rgb(var(--accent-rgb)); }
#ws-home .kpi-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
#ws-home .kpi-head .month-meta { font-size: 11px; color: var(--text-muted); }
#ws-home .kpi-head .month-meta b { color: var(--text); font-weight: 600; }
#ws-home .kpi-ai-badge {
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    background: rgba(var(--accent-rgb), 0.11);
    color: rgb(var(--accent-rgb));
    border-radius: 6px;
    padding: 4px 7px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}
#ws-home .home-kpi-btn {
    background: rgba(var(--accent-rgb), 0.15);
    color: rgb(var(--accent-rgb));
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 700;
}
#ws-home .home-kpi-btn.ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
#ws-home .home-kpi-btn:hover { background: rgba(var(--accent-rgb), 0.25); color: rgb(var(--accent-rgb)); }

#ws-home .kpi-row {
    display: grid;
    grid-template-columns: 100px 1fr 160px;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
}
#ws-home .kpi-label { font-size: 13px; font-weight: 600; color: var(--text); }

#ws-home .kpi-bar-stack { display: flex; flex-direction: column; gap: 7px; }
#ws-home .kpi-bar-wrap {
    position: relative; height: 14px; border-radius: 7px;
    background: #0a0d14;
    border: 1px solid var(--border);
    overflow: visible;
}
#ws-home .kpi-bar {
    height: 100%; border-radius: 7px;
    transition: width 0.8s cubic-bezier(.22,.61,.36,1);
    position: relative;
    overflow: hidden;
}

#ws-home .kpi-bar.state-low {
    background: linear-gradient(90deg, #2a3142, #3a4356);
}
#ws-home .kpi-bar.state-normal {
    background: linear-gradient(90deg,
        rgba(var(--accent-rgb), 0.3),
        rgba(var(--accent-rgb), 0.6) 50%,
        rgba(var(--accent-rgb), 1) 100%);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.4);
}
#ws-home .kpi-bar.state-hit {
    background: linear-gradient(90deg,
        rgba(var(--accent-rgb), 0.7) 0%,
        rgba(var(--accent-rgb), 1)   30%,
        rgba(255, 255, 255, 0.95)    50%,
        rgba(var(--accent-rgb), 1)   70%,
        rgba(var(--accent-rgb), 0.7) 100%);
    background-size: 250% 100%;
    animation: home-neon-shimmer 8s linear infinite;
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.7);
}
@keyframes home-neon-shimmer {
    0%   { background-position: 250% 50%; }
    100% { background-position: -50% 50%; }
}

#ws-home .kpi-bar.state-exceed {
    background: linear-gradient(90deg, #FF6B8A, #A855F7, #00E5FF, #E8C547, #FF6B8A);
    background-size: 400% 100%;
    animation: home-signal-shift 8s linear infinite reverse;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.5), 0 0 28px rgba(0, 229, 255, 0.3);
}
@keyframes home-signal-shift {
    0%   { background-position: 0% 50%; }
    100% { background-position: 400% 50%; }
}

#ws-home .kpi-annotations {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; min-height: 18px; padding-left: 2px;
}
#ws-home .kpi-streak {
    display: inline-block;
    padding: 1px 6px;
    font-size: 10px; font-weight: 600;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.12);
    color: var(--amber);
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-variant-numeric: tabular-nums;
}
#ws-home .achieved-badge {
    display: inline-block;
    padding: 2px 8px; border-radius: 4px;
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    background: rgba(var(--accent-rgb), 0.08);
    color: rgb(var(--accent-rgb));
    font-weight: 700; font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.12em;
}
#ws-home .exceed-badge {
    display: inline-block;
    padding: 2px 8px; border-radius: 4px;
    border: 1px solid rgba(168, 85, 247, 0.45);
    background: linear-gradient(90deg, #FF6B8A, #A855F7, #00E5FF, #E8C547, #FF6B8A);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: home-signal-shift 8s linear infinite reverse;
    font-weight: 700; font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.12em;
    box-shadow: 0 0 6px rgba(168, 85, 247, 0.15);
}
#ws-home .kpi-proj-text {
    font-size: 10px; color: var(--text-dim); letter-spacing: 0.02em;
}
#ws-home .kpi-proj-text b { color: var(--text-muted); font-weight: 600; }
#ws-home .kpi-proj-tick {
    position: absolute; top: -3px; bottom: -3px; width: 0;
    border-left: 1.5px dashed rgba(255, 255, 255, 0.55);
}
#ws-home .kpi-proj-tick::before {
    content: ""; position: absolute; top: -4px; left: -3px;
    width: 5px; height: 5px; border-radius: 50%;
    background: rgba(255,255,255,0.8);
    box-shadow: 0 0 4px rgba(255,255,255,0.6);
}

#ws-home .kpi-meta {
    font-size: 11px; color: var(--text-muted);
    text-align: right; font-variant-numeric: tabular-nums;
    display: flex; flex-direction: column; gap: 3px;
}
#ws-home .kpi-meta .pct { font-weight: 700; color: var(--text); font-size: 20px; line-height: 1.1; }
#ws-home .kpi-meta .pct.under { color: var(--text-dim); }

#ws-home .kpi-pace {
    font-size: 11px; color: var(--text-dim);
    margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border);
    display: flex; justify-content: space-between;
}
#ws-home .kpi-pace b { color: var(--text); }

/* ── 2. Summary ── */
#ws-home .summary-card { border-left: 3px solid var(--amber); }
#ws-home .summary-card.tone-positive { border-left-color: var(--green); }
#ws-home .summary-card.tone-critical { border-left-color: var(--red); }
#ws-home .summary-head { font-size: 15px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
#ws-home .summary-head::before { content: "📋  "; }
#ws-home .summary-body { font-size: 13px; color: var(--text); line-height: 1.7; }
#ws-home .summary-meta { font-size: 10px; color: var(--text-dim); margin-top: 10px; letter-spacing: 0.05em; text-transform: uppercase; }
#ws-home .summary-empty { color: var(--text-muted); font-style: italic; }
#ws-home .summary-headline { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; line-height: 1.5; }
#ws-home .summary-growth { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.6; }
#ws-home .summary-actions { list-style: none; padding: 0; margin: 8px 0 0 0; }
#ws-home .summary-actions li {
    padding: 10px 12px; margin-bottom: 6px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px; color: var(--text); line-height: 1.5;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
#ws-home .summary-actions li:last-child { margin-bottom: 0; }
#ws-home .summary-action-pri {
    display: inline-block; font-size: 10px; font-weight: 700;
    padding: 2px 6px; border-radius: 4px; letter-spacing: 0.08em;
}
#ws-home .summary-action-pri.p1 { background: var(--red-soft); color: var(--red); border: 1px solid rgba(255,51,102,0.3); }
#ws-home .summary-action-pri.p2 { background: rgba(245,158,11,0.12); color: var(--amber); border: 1px solid rgba(245,158,11,0.3); }
#ws-home .summary-action-pri.p3 { background: rgba(var(--accent-rgb),0.1); color: rgb(var(--accent-rgb)); border: 1px solid rgba(var(--accent-rgb),0.3); }
#ws-home .summary-action-plat {
    display: inline-block; font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
    padding: 1px 7px; border-radius: 3px; border: 1px solid var(--border);
}
#ws-home .summary-action-text { flex: 1 1 auto; min-width: 200px; }
#ws-home .summary-action-reason { flex-basis: 100%; font-size: 11px; color: var(--text-muted); font-style: italic; margin-top: 2px; }

/* ── 3. GMV Hero ── */
#ws-home .gmv-card h2::before { content: "💰 "; }
#ws-home .gmv-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1.8fr;
    gap: 28px; align-items: end;
    padding: 8px 0 4px;
}
#ws-home .gmv-primary .lbl { font-size: 11px; color: rgb(var(--accent-rgb)); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin-bottom: 6px; }
#ws-home .gmv-primary .lbl .zh { color: var(--text-muted); font-weight: 400; margin-left: 6px; }
#ws-home .gmv-primary .val {
    font-size: 46px; font-weight: 700; letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums; color: var(--text);
    text-shadow: 0 0 24px rgba(var(--accent-rgb), 0.3);
}
#ws-home .gmv-secondary .lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin-bottom: 4px; }
#ws-home .gmv-secondary .lbl .zh { color: var(--text-dim); font-weight: 400; margin-left: 5px; }
#ws-home .gmv-secondary .val { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-muted); }
#ws-home .gmv-delta { font-size: 12px; margin-top: 4px; font-variant-numeric: tabular-nums; }
#ws-home .gmv-confirm { padding-left: 18px; border-left: 1px solid var(--border); }
#ws-home .gmv-confirm .val { font-size: 28px; color: var(--green); font-weight: 600; }
#ws-home .gmv-spark {
    padding-left: 20px; border-left: 1px solid var(--border);
    height: 90px; display: flex; flex-direction: column; justify-content: space-between;
}
#ws-home .gmv-spark .lbl {
    font-size: 10px; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.1em; font-weight: 600; margin-bottom: 4px;
}
#ws-home .gmv-spark svg { width: 100%; height: 44px; }
#ws-home .gmv-spark-axis {
    display: flex; justify-content: space-between;
    font-size: 9px; color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
    letter-spacing: -0.01em;
}
#ws-home .gmv-spark-latest {
    font-size: 10px; color: rgb(var(--accent-rgb));
    font-weight: 600; text-align: right;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

#ws-home .delta-up { color: var(--green); }
#ws-home .delta-down { color: var(--red); }

/* ── 4. Trend ── */
#ws-home .trend-card h2::before { content: "📈 "; }
#ws-home .trend-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
#ws-home .trend-tab {
    padding: 4px 12px; border-radius: 6px; font-size: 11px; cursor: pointer;
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    user-select: none;
}
#ws-home .trend-tab.active {
    background: rgba(var(--accent-rgb), 0.15);
    color: rgb(var(--accent-rgb));
    border-color: rgba(var(--accent-rgb), 0.4);
}
#ws-home .trend-legend { display: flex; gap: 16px; font-size: 11px; color: var(--text-muted); margin-top: 8px; }
#ws-home .trend-legend .dot { display: inline-block; width: 10px; height: 2px; margin-right: 5px; vertical-align: middle; }

/* ── 5. Advertising ── */
#ws-home .ads-card h2::before { content: "🎯 "; }
#ws-home .ads-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
#ws-home .ads-tile {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.015);
}
#ws-home .ads-tile.all    { border-color: rgba(var(--accent-rgb), 0.3); background: rgba(var(--accent-rgb), 0.05); }
#ws-home .ads-tile.tt     { border-color: rgba(255, 0, 80, 0.25); }
#ws-home .ads-tile.shopee { border-color: rgba(238, 77, 45, 0.25); }
#ws-home .ads-tile .tile-head {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
#ws-home .ads-tile .tile-head .name { display: flex; align-items: center; gap: 6px; }
#ws-home .ads-tile.all    .tile-head { color: rgb(var(--accent-rgb)); }
#ws-home .ads-tile.tt     .tile-head { color: #FF0050; }
#ws-home .ads-tile.shopee .tile-head { color: #EE4D2D; }
#ws-home .ads-tile .dot-platform { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
#ws-home .ads-tile.all    .dot-platform { background: rgb(var(--accent-rgb)); box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.5); }
#ws-home .ads-tile.tt     .dot-platform { background: #FF0050; }
#ws-home .ads-tile.shopee .dot-platform { background: #EE4D2D; }
#ws-home .ads-top { display: grid; grid-template-columns: 1fr 90px; gap: 12px; align-items: end; margin-bottom: 12px; }
#ws-home .ads-big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1; }
#ws-home .ads-big .unit { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-left: 2px; }
#ws-home .ads-wow { font-size: 11px; font-variant-numeric: tabular-nums; margin-top: 4px; }
#ws-home .ads-spark { height: 38px; }
#ws-home .ads-spark svg { width: 100%; height: 100%; }
#ws-home .ads-sub {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 11px;
    padding-top: 10px; border-top: 1px solid var(--border);
}
#ws-home .ads-sub .lbl { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 9px; font-weight: 600; }
#ws-home .ads-sub .val { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; margin-top: 2px; }
#ws-home .ads-unavailable {
    padding: 30px 20px; text-align: center; color: var(--text-muted); font-size: 13px;
    background: rgba(255,255,255,0.015); border: 1px dashed var(--border); border-radius: var(--radius);
}

/* ── 6. Platform split ── */
#ws-home .platform-card h2::before { content: "🛒 "; }
#ws-home .platform-row { display: grid; grid-template-columns: 1fr 150px 1fr; gap: 24px; align-items: center; }
#ws-home .platform-side { display: flex; flex-direction: column; gap: 14px; }
#ws-home .platform-side.right { text-align: right; }
#ws-home .platform-head {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; font-weight: 600; color: var(--text);
}
#ws-home .platform-side.right .platform-head { justify-content: flex-end; }
#ws-home .platform-head .dot { width: 10px; height: 10px; border-radius: 50%; }
#ws-home .platform-main {
    font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text);
    letter-spacing: -0.01em; line-height: 1;
}
#ws-home .platform-pct { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
#ws-home .platform-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    padding-top: 10px; border-top: 1px solid var(--border);
}
#ws-home .platform-side.right .platform-stats { direction: rtl; }
#ws-home .platform-side.right .platform-stats > * { direction: ltr; text-align: right; }
#ws-home .platform-stats .lbl { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
#ws-home .platform-stats .val { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; margin-top: 2px; }
#ws-home .platform-center-donut { display: flex; flex-direction: column; align-items: center; }

/* ── 7. Insights ── */
#ws-home .insights-card h2::before { content: "🔍 "; }
#ws-home .insight-block { padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px; }
#ws-home .insight-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
#ws-home .insight-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#ws-home .insight-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); }
#ws-home .insight-head .count {
    font-size: 10px; color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    padding: 2px 8px; border-radius: 10px;
}
#ws-home .insight-empty {
    font-size: 12px; color: var(--text-muted); font-style: italic; padding: 10px 0;
}
#ws-home .events-tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
#ws-home .events-tab {
    padding: 6px 12px; border-radius: var(--radius); font-size: 11px; cursor: pointer;
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    user-select: none;
}
#ws-home .events-tab.active {
    background: rgba(var(--accent-rgb), 0.15);
    color: rgb(var(--accent-rgb));
    border-color: rgba(var(--accent-rgb), 0.4);
}
#ws-home .events-tab .badge { margin-left: 5px; background: rgba(255,255,255,0.05); padding: 0 5px; border-radius: 8px; font-size: 10px; }
#ws-home .event-row { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
#ws-home .event-row:last-child { border-bottom: 0; }
#ws-home .event-impact { font-size: 16px; width: 24px; text-align: center; }
#ws-home .event-impact.up { color: var(--green); }
#ws-home .event-impact.down { color: var(--red); }
#ws-home .event-body .title { font-size: 13px; font-weight: 600; margin-bottom: 2px; color: var(--text); }
#ws-home .event-body .desc { font-size: 11px; color: var(--text-muted); }
#ws-home .event-body .meta { font-size: 10px; color: var(--text-dim); margin-top: 3px; letter-spacing: 0.03em; }
#ws-home .add-event-btn {
    background: rgba(var(--accent-rgb), 0.15); color: rgb(var(--accent-rgb));
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    padding: 4px 10px; border-radius: 6px; font-size: 11px; cursor: pointer; font-weight: 600;
}
#ws-home .event-delete-btn {
    background: transparent; border: 0; color: var(--text-dim); cursor: pointer; font-size: 14px;
}
#ws-home .event-delete-btn:hover { color: var(--red); }

/* ── Footer ── */
#ws-home .home-footer {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11px; color: var(--text-muted);
    padding: 16px 4px 8px; letter-spacing: 0.05em;
}
#ws-home .sync-btn {
    background: rgba(var(--accent-rgb), 0.15);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    padding: 6px 14px; border-radius: var(--radius); font-size: 11px; cursor: pointer;
    color: rgb(var(--accent-rgb)); font-weight: 600; letter-spacing: 0.05em;
}
#ws-home .sync-btn:hover { background: rgba(var(--accent-rgb), 0.25); }

/* ── Empty state ── */
#ws-home .home-empty {
    padding: 80px 30px; text-align: center;
}
#ws-home .home-empty .title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
#ws-home .home-empty .sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
#ws-home .home-empty .btn {
    display: inline-block; padding: 10px 24px;
    background: rgba(var(--accent-rgb), 0.15);
    border: 1px solid rgb(var(--accent-rgb));
    color: rgb(var(--accent-rgb)); border-radius: var(--radius);
    font-weight: 600; cursor: pointer; text-decoration: none;
}

/* ── KPI editor modal ── */
.home-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.68);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}
.home-kpi-modal {
    --kpi-accent-rgb: var(--accent-rgb);
    --kpi-accent: rgb(var(--kpi-accent-rgb));
    --kpi-accent-soft: rgba(var(--kpi-accent-rgb), 0.16);
    --kpi-accent-border: rgba(var(--kpi-accent-rgb), 0.48);
    width: min(860px, 100%);
    max-height: min(820px, calc(100vh - 44px));
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 80px rgba(0,0,0,0.55);
    padding: 20px;
}
.home-kpi-brand-banner,
.kpi-brand-banner {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    padding: 14px 16px 13px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--kpi-brand-top, rgba(var(--accent-rgb),0.7)), var(--kpi-brand-bottom, rgba(var(--accent-rgb),0.28)));
    border: 1px solid var(--kpi-brand-ring, rgba(var(--accent-rgb),0.35));
    box-shadow: 0 8px 24px var(--kpi-brand-glow, rgba(var(--accent-rgb),0.18));
}
.home-kpi-brand-watermark,
.kpi-brand-watermark {
    position: absolute;
    right: -10px;
    bottom: -34px;
    max-width: 135%;
    overflow: hidden;
    color: rgba(255,255,255,0.13);
    font-size: clamp(54px, 9vw, 92px);
    font-weight: 900;
    letter-spacing: -3px;
    line-height: 1;
    pointer-events: none;
    text-transform: uppercase;
    white-space: nowrap;
}
.home-kpi-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
}
.home-kpi-modal-title {
    font-size: 11px;
    font-weight: 800;
    color: rgba(255,255,255,0.82);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.home-kpi-brand-name,
.kpi-brand-name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    color: #fff;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.05;
    text-shadow: 0 1px 2px rgba(0,0,0,0.24);
}
.home-kpi-brand-name span,
.kpi-brand-name span {
    padding: 2px 8px;
    border: 1px solid rgba(255,255,255,0.38);
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
    color: rgba(255,255,255,0.9);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.home-kpi-current-month {
    display: inline-flex;
    margin: 0 0 14px;
    padding: 7px 10px;
    border: 1px solid var(--kpi-accent-border);
    border-radius: 6px;
    background: var(--kpi-accent-soft);
    color: rgba(255,255,255,0.88);
    font-size: 12px;
    font-weight: 700;
}
.home-kpi-close {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.76);
    font-size: 24px;
    cursor: pointer;
}
.home-kpi-close:hover { color: #fff; }
.home-kpi-form-top,
.home-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}
.home-kpi-form-top { margin-bottom: 16px; }
.home-kpi-section-title {
    margin: 16px 0 8px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.home-kpi-modal label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.home-kpi-modal label span {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.home-kpi-modal label span b { color: var(--kpi-accent); font-size: 10px; }
.home-kpi-modal input,
.home-kpi-modal textarea {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
}
.home-kpi-modal input:focus,
.home-kpi-modal textarea:focus {
    outline: none;
    border-color: var(--kpi-accent-border);
    box-shadow: 0 0 0 1px var(--kpi-accent-soft);
}
.home-kpi-modal textarea { resize: vertical; }
.home-kpi-notes { margin-top: 14px; }
.home-kpi-modal-status {
    min-height: 18px;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 12px;
}
.home-kpi-modal-status.warning { color: rgba(255,255,255,0.86); }
.home-kpi-modal-status.error { color: var(--red); }
.home-kpi-modal-status.success { color: var(--kpi-accent); }
.home-kpi-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}
.home-kpi-secondary,
.home-kpi-primary {
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.home-kpi-secondary { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.home-kpi-secondary:hover { border-color: var(--kpi-accent-border); color: #fff; }
.home-kpi-primary { background: var(--kpi-accent); border: 1px solid var(--kpi-accent); color: #050505; }

.kpi-target-card {
    --kpi-accent-rgb: var(--accent-rgb);
    --kpi-accent: rgb(var(--kpi-accent-rgb));
    --kpi-accent-soft: rgba(var(--kpi-accent-rgb), 0.16);
    --kpi-accent-border: rgba(var(--kpi-accent-rgb), 0.48);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    max-width: 980px;
}
.kpi-brand-main {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.kpi-brand-kicker {
    color: rgba(255,255,255,0.82);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.kpi-brand-status {
    margin-top: 7px;
    color: rgba(255,255,255,0.76);
    font-size: 12px;
}
.kpi-brand-status.warning { color: rgba(255,255,255,0.86); }

.kpi-chip {
    padding: 8px 10px;
    border: 1px solid var(--kpi-accent-border);
    border-radius: 6px;
    background: var(--kpi-accent-soft);
    color: rgba(255,255,255,0.84);
    font-size: 12px;
    font-weight: 700;
}
.kpi-chip span {
    margin-left: 6px;
    color: #fff;
    font-weight: 800;
}
.kpi-month-chip {
    padding: 9px 12px;
}
.kpi-system-prefill {
    color: #fff;
}
.kpi-save-btn {
    padding: 9px 16px;
    border: 1px solid var(--kpi-accent);
    border-radius: 6px;
    background: var(--kpi-accent);
    color: #050505;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.kpi-save-btn:disabled {
    border-color: rgba(255,255,255,0.22);
    background: transparent;
    color: rgba(255,255,255,0.42);
    cursor: not-allowed;
}

/* ── First-hit toast ── */
.home-toast {
    position: fixed; bottom: 22px; right: 22px; z-index: 200;
    max-width: 340px;
    padding: 14px 32px 14px 14px;
    background: var(--bg-card);
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 24px rgba(var(--accent-rgb), 0.25);
    display: flex; align-items: center; gap: 12px;
    animation: home-toast-in 0.55s cubic-bezier(.22,.61,.36,1);
}
.home-toast.fading { animation: home-toast-out 0.4s ease-in forwards; }
@keyframes home-toast-in  { from { transform: translateX(130%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes home-toast-out { to { transform: translateX(130%); opacity: 0; } }
.home-toast .toast-icon { font-size: 26px; line-height: 1; filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.5)); }
.home-toast .toast-title { font-size: 13px; font-weight: 600; color: var(--text); }
.home-toast .toast-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.home-toast .toast-close {
    position: absolute; top: 4px; right: 6px;
    background: transparent; border: 0; color: var(--text-dim);
    cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px;
}
.home-toast .toast-close:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 1024px) {
    #ws-home { padding: 16px; }
    #ws-home .kpi-row { grid-template-columns: 90px 1fr 140px; }
    #ws-home .gmv-grid { grid-template-columns: 1fr; gap: 16px; }
    #ws-home .gmv-confirm, #ws-home .gmv-spark { padding-left: 0; border-left: 0; border-top: 1px solid var(--border); padding-top: 12px; }
    #ws-home .ads-grid { grid-template-columns: 1fr; }
    #ws-home .platform-row { grid-template-columns: 1fr; }
    #ws-home .gmv-primary .val { font-size: 36px; }
}

/* ═══════════════════════════════════════════════════════════════
   PRINT / PDF EXPORT
   Triggered by Reports → Existing Reports → "⤓ Download PDF"
   (or by Cmd+P from any page).

   Strategy: hide all site chrome, print only what's currently visible
   in the active workspace. Force dark theme through with
   print-color-adjust: exact.
   ═══════════════════════════════════════════════════════════════ */
@media print {
    @page {
        size: A4;
        margin: 12mm 10mm;
    }

    /* ── Top-level chrome to never print ── */
    body > header,
    body > footer,
    #login-screen,
    .lang-switch,
    #m-nav,
    .modal-backdrop,
    .home-modal-backdrop,
    .home-toast,
    .print-hide {
        display: none !important;
    }

    /* ── Inside Reports: hide nav-bar (Generate / Existing tabs), the
         Generate page, and the existing-reports list (we want only the
         currently-open report detail). ── */
    #ws-reports .nav-bar,
    #ws-reports [data-page="generate"],
    #ws-reports #rpt-existing-list {
        display: none !important;
    }
    #ws-reports [data-page="archive"] { display: block !important; }
    #ws-reports #rpt-existing-detail { display: block !important; }

    /* ── Force-print background colors and gradients ── */
    *, *::before, *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: var(--bg) !important;
        color: var(--text) !important;
    }

    /* Strip card boundaries that read as visual clutter on paper */
    .home-card,
    .report-section,
    .report-card {
        page-break-inside: avoid;
        break-inside: avoid;
        box-shadow: none !important;
    }

    /* Freeze animations so PDF gets a stable frame */
    *, *::before, *::after { animation: none !important; }

    /* Home: kept usable in case someone Cmd+P's from Ground Control too */
    #ws-home {
        max-width: 100%;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }
    #ws-home .home-page-head h1 { font-size: 18px; }
    #ws-home .gmv-primary .val { font-size: 32px; }
    #ws-home .ads-big { font-size: 24px; }
    #ws-home .home-footer,
    #ws-home .add-event-btn,
    #ws-home .event-delete-btn,
    #ws-home .trend-tabs,
    #ws-home .events-tabs {
        display: none !important;
    }
    #ws-home .home-card { border-color: #2a3142 !important; }
}
