/* Neutral charcoal theme. All screen rules are scoped to the night mode. */
@media screen {
  body.theme-dark {
    --bg: #131313;
    --surface: #1f1f1f;
    --surface-raised: #292929;
    --surface-hover: #2e2e2e;
    --ink: #f0f0f0;
    --muted: #b0b0b0;
    --line: #363636;
    --green: #39d774;
    --red: #ff858b;
    --amber: #e7b665;
    --action: #008637;
    --action-hover: #00772f;
    --purple: var(--action);
    --purple-soft: #183c27;
    --shadow: none;
    background: var(--bg);
    color: var(--ink);
    color-scheme: dark;
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    scrollbar-color: #4a4a4a #1b1b1b;
  }

  body.theme-dark .main { background: var(--bg); }
  body.theme-dark .topbar { flex-wrap: wrap; gap: 14px; }
  body.theme-dark .top-actions { flex-wrap: wrap; gap: 10px; margin-left: auto; }
  body.theme-dark .today { white-space: nowrap; }
  body.theme-dark .sidebar { background: #191919; border-color: #303030; }
  body.theme-dark .panel,
  body.theme-dark .stat-card,
  body.theme-dark .task-card,
  body.theme-dark .link-card,
  body.theme-dark .finance-summary article,
  body.theme-dark .temu-placeholder,
  body.theme-dark .auth-card,
  body.theme-dark dialog {
    color: var(--ink);
    background: var(--surface);
    border-color: #303030;
    box-shadow: none;
  }
  body.theme-dark .auth-gate { background: var(--bg); }
  body.theme-dark .brand-mark { background: var(--action); box-shadow: none; }
  body.theme-dark .avatar { background: #183c27; color: #a4edbc; }
  body.theme-dark .nav-item { color: #bcbcbc; font-size: 15px; }
  body.theme-dark .nav-item:hover { background: var(--surface-raised); color: #fff; }
  body.theme-dark .nav-item.active { background: var(--action); color: #fff; }
  body.theme-dark .nav-item.active em { color: #fff; }
  body.theme-dark .brand span,
  body.theme-dark .nav-label,
  body.theme-dark .sidebar-bottom,
  body.theme-dark .eyebrow,
  body.theme-dark .today,
  body.theme-dark .current-username,
  body.theme-dark footer { color: #a9a9a9; }
  body.theme-dark .status-dot { background: var(--green); }

  body.theme-dark h1,
  body.theme-dark h2,
  body.theme-dark h3,
  body.theme-dark .welcome h2,
  body.theme-dark .topbar h1,
  body.theme-dark .section-intro h2,
  body.theme-dark .panel-head h3 { color: #f5f5f5; font-weight: 650; }
  body.theme-dark .panel-head h3 { font-size: 17px; }
  body.theme-dark .section-intro p,
  body.theme-dark .panel-head p,
  body.theme-dark .muted,
  body.theme-dark .auth-card p,
  body.theme-dark .auth-card label,
  body.theme-dark .temu-shop-picker label,
  body.theme-dark .stat-top,
  body.theme-dark .stat-card small,
  body.theme-dark .finance-summary span,
  body.theme-dark .finance-summary small,
  body.theme-dark .task-note,
  body.theme-dark .due-label,
  body.theme-dark .task-mini-meta,
  body.theme-dark .recent-sub,
  body.theme-dark .recent-date,
  body.theme-dark .link-url,
  body.theme-dark .empty { color: var(--muted); }
  body.theme-dark .section-intro p,
  body.theme-dark .panel-head p,
  body.theme-dark .muted,
  body.theme-dark .task-note { font-size: 13px; line-height: 1.7; }
  body.theme-dark .stat-card strong,
  body.theme-dark .finance-summary strong { color: #f5f5f5; font-variant-numeric: tabular-nums; }

  /* Green actions, red destructive actions, quiet neutral cancellation. */
  body.theme-dark .primary {
    background: var(--action);
    color: #fff;
    border: 1px solid var(--action);
    box-shadow: none;
    font-size: 14px;
    font-weight: 600;
  }
  body.theme-dark .primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
  body.theme-dark .secondary {
    background: #183b27;
    border-color: #2d6240;
    color: #a5edbe;
    font-size: 14px;
    font-weight: 500;
    box-shadow: none;
  }
  body.theme-dark .secondary:hover { background: #214c32; border-color: #438c5b; color: #d9ffe5; }
  body.theme-dark .text-btn { background: transparent; color: #66df91; font-size: 13px; }
  body.theme-dark .text-btn:hover { color: #b0f4c6; }
  body.theme-dark .theme-toggle,
  body.theme-dark .dialog-actions button[value="cancel"] {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
  }
  body.theme-dark .theme-toggle:hover,
  body.theme-dark .dialog-actions button[value="cancel"]:hover { background: #353535; border-color: #626262; }
  body.theme-dark #logout { background: #382225; border-color: #704047; color: #ffb0b5; }
  body.theme-dark #logout:hover { background: #532b30; border-color: #ac555e; }
  body.theme-dark .icon-btn { color: #77dc9b; }
  body.theme-dark .icon-btn:hover { background: #173c27; color: #a6f0bf; border-radius: 5px; }
  body.theme-dark .icon-btn[data-delete] { color: #ff999f; }
  body.theme-dark .icon-btn[data-delete]:hover { background: #48272b; color: #ffc3c7; }
  body.theme-dark .icon-close { color: #bcbcbc; background: transparent; }
  body.theme-dark .icon-close:hover { color: #fff; }
  body.theme-dark .temu-action-icon {
    background: #193d28;
    color: #9de8b6;
    border-color: #315c40;
  }
  body.theme-dark .temu-action-icon:hover { background: #265338; color: #d5ffe3; border-color: #518e64; }
  body.theme-dark button.danger,
  body.theme-dark .temu-action-icon.danger {
    background: #bf303a;
    color: #fff;
    border-color: #ce454e;
  }
  body.theme-dark button.danger:hover,
  body.theme-dark .temu-action-icon.danger:hover { background: #a6242e; color: #fff; border-color: #e5757d; }
  body.theme-dark button:focus-visible,
  body.theme-dark a:focus-visible,
  body.theme-dark .temu-import-button:focus-visible { outline: 2px solid #70e699; outline-offset: 3px; }
  body.theme-dark button:disabled { cursor: not-allowed; }

  body.theme-dark .select,
  body.theme-dark .temu-list-tools input,
  body.theme-dark .task-controls select,
  body.theme-dark .progress-input,
  body.theme-dark .field input,
  body.theme-dark .field select,
  body.theme-dark .field textarea,
  body.theme-dark .auth-card input,
  body.theme-dark .temu-page-size select,
  body.theme-dark .temu-sales-filters input,
  body.theme-dark .temu-sales-filters select,
  body.theme-dark .temu-cost-input {
    color: #eee;
    background: #202020;
    border-color: #414141;
    font-family: inherit;
    font-size: 14px;
  }
  body.theme-dark input::placeholder,
  body.theme-dark textarea::placeholder { color: #969696; opacity: 1; }
  body.theme-dark input:focus,
  body.theme-dark select:focus,
  body.theme-dark textarea:focus { border-color: #5cc77e; outline: none; box-shadow: 0 0 0 2px #31bc5d26; }
  body.theme-dark .field label { color: #bcbcbc; font-size: 14px; }
  body.theme-dark .auth-card #authError { color: #ff999f; }

  /* Thin neutral dividers and product-level stripes retain multi-SKU grouping. */
  body.theme-dark .temu-table-wrap,
  body.theme-dark .temu-sales-table-wrap { background: var(--surface); border: 1px solid #393939; border-radius: 10px; }
  body.theme-dark .temu-table { border: 0; }
  body.theme-dark table th {
    color: #bcbcbc;
    background: #292929;
    border-color: #3a3a3a;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
  }
  body.theme-dark table td { color: #ededed; border-color: #353535; font-size: 14px; font-weight: 400; }
  body.theme-dark .temu-table th,
  body.theme-dark .temu-table td { border-color: #353535; padding-top: 14px; padding-bottom: 14px; }
  body.theme-dark .temu-table th { background: #2a2a2a; color: #c0c0c0; font-size: 14px; }
  body.theme-dark .temu-table td { background: var(--surface); font-size: 15px; line-height: 1.65; }
  body.theme-dark .temu-table tr.temu-product-first td,
  body.theme-dark .temu-table tr.temu-skc-first td { border-top: 0; }
  body.theme-dark .temu-table th:last-child,
  body.theme-dark .temu-table td:last-child { border-right: 0; }
  body.theme-dark .temu-table tbody tr:last-child td { border-bottom: 0; }
  body.theme-dark .temu-table tbody tr:nth-child(even) td { background: var(--surface); }
  body.theme-dark .temu-table tbody tr.temu-product-shade td { background: #242424; }
  body.theme-dark .temu-table tbody tr:hover td,
  body.theme-dark .temu-table tbody tr.temu-product-shade:hover td { background: var(--surface-hover); }
  body.theme-dark .temu-table tbody tr.temu-product-hover td { background: var(--surface-hover) !important; }
  body.theme-dark .temu-title-copy { color: #f5f5f5; font-size: 15px; line-height: 1.7; font-weight: 600; }
  body.theme-dark .temu-title-copy:hover { color: #b2efc5; }
  body.theme-dark .temu-category-full { color: #b7b7b7; text-decoration: none; }
  body.theme-dark .temu-id-line > span,
  body.theme-dark .temu-sku-line > span:first-child { color: #b8b8b8; font-size: 13px; }
  body.theme-dark .temu-id-line code,
  body.theme-dark .temu-sku-line code,
  body.theme-dark .temu-sku-line > span:nth-child(2) { color: #efefef; font-family: inherit; font-size: 14px; font-weight: 400; }
  body.theme-dark .temu-sku-info-cell + td { color: #53e382; font-weight: 600; font-variant-numeric: tabular-nums; }
  body.theme-dark .temu-profit-rate { color: #bcbcbc; font-size: 13px; }
  body.theme-dark .temu-profit-cell strong { font-weight: 500; }
  body.theme-dark .temu-thumb-empty,
  body.theme-dark .temu-thumb { background: #303030; border: 1px solid #414141; color: #bdbdbd; }
  body.theme-dark .temu-cost-editable:hover { box-shadow: inset 0 0 0 1px #497b59; }
  body.theme-dark .temu-copy-btn { background: transparent; color: #8b8b8b; border: 0; }
  body.theme-dark .temu-copy-btn:hover,
  body.theme-dark .temu-copy-btn:focus-visible { background: transparent; color: #dadada; }
  body.theme-dark .temu-table-wrap .empty,
  body.theme-dark .temu-sales-table-wrap .empty { background: var(--surface); color: var(--muted); }
  body.theme-dark .temu-page-button:hover,
  body.theme-dark .temu-page-arrow:not(:disabled):hover { background: #2c2c2c; border-color: #4b4b4b; }
  body.theme-dark .temu-page-button.active { background: var(--action); border-color: var(--action); color: #fff; }

  body.theme-dark .welcome { background: #1b3023; }
  body.theme-dark .welcome p,
  body.theme-dark .welcome-overline { color: #b9cebf; }
  body.theme-dark .orb-a { background: linear-gradient(145deg,#294a34,#3b7150); }
  body.theme-dark .orb-b { background: linear-gradient(145deg,#294d36,#25432e); }
  body.theme-dark .art-card { background: #203c2be6; color: #a0e4b5; box-shadow: none; }
  body.theme-dark .purple,
  body.theme-dark .green,
  body.theme-dark .tx-symbol.income,
  body.theme-dark .tx-kind.income { background: #193b28; color: #73e39a; }
  body.theme-dark .coral,
  body.theme-dark .tx-symbol.expense,
  body.theme-dark .tx-kind.expense { background: #40272a; color: #ff9aa0; }
  body.theme-dark .amber { background: #3e3220; color: #e8bd77; }
  body.theme-dark .tag.urgent { background: #42272b; color: #ffa1a7; }
  body.theme-dark .tag.normal,
  body.theme-dark .tag.long { background: #1f3c2b; color: #9ce8b5; }
  body.theme-dark .filter { color: #b9b9b9; font-size: 13px; }
  body.theme-dark .filter.active { background: #1b402b; color: #b1efc5; box-shadow: none; }
  body.theme-dark .filter span { color: #aaa; }
  body.theme-dark .progress-track { background: #383838; }
  body.theme-dark .link-name { color: var(--ink); }
  body.theme-dark .link-actions { opacity: 1; }
  body.theme-dark .quick-link { background: #242424; border-color: #373737; color: #e8e8e8; }
  body.theme-dark .quick-link:hover,
  body.theme-dark .link-card:hover { background: #252d27; border-color: #467052; }
  body.theme-dark .favicon { background: #303030; color: #a5edbe; }
  body.theme-dark .add-dashed { background: #202820; color: #a8ddb8; border-color: #405b47; }
  body.theme-dark .tip-box,
  body.theme-dark .coming-pill { background: #203127; color: #b5d8c0; }
  body.theme-dark .recent-row { border-color: var(--line); }
  body.theme-dark .home-task-title,
  body.theme-dark .recent-name { font-size: 14px; }
  body.theme-dark .tx-amount.expense { color: #ff999f; }
  body.theme-dark .tx-amount.income { color: #67e291; }
  body.theme-dark .ocr-text,
  body.theme-dark .sync-token { background: #292929; border-color: #3e3e3e; color: #dedede; }
  body.theme-dark .ocr-status { color: #9ce8b5; }
  body.theme-dark .upload-box { background: #242424; border-color: #505050; color: #d4d4d4; }
  body.theme-dark .upload-box span { color: #84dfa3; }
  body.theme-dark .upload-box small { color: #aaa; }
  body.theme-dark dialog::backdrop { background: #0009; }
  body.theme-dark .toast { background: #303030; border: 1px solid #505050; color: #fff; }
}

@media print {
  body.theme-dark { --ink: #222; --muted: #555; --line: #bbb; color: #222; background: #fff; color-scheme: light; }
  body.theme-dark .panel,
  body.theme-dark .temu-table th,
  body.theme-dark .temu-table td,
  body.theme-dark .temu-table tbody tr td,
  body.theme-dark .temu-table tbody tr.temu-product-hover td { color: #222; background: #fff !important; border-color: #bbb; }
  body.theme-dark .temu-title-copy,
  body.theme-dark .temu-id-line code,
  body.theme-dark .temu-sku-line code { color: #222; }
}
