/* ==========================================================================
   NetValue Ledger Pro v2.0 - Swiss Grid + Micro-interactions Design System
   - High contrast (WCAG AA+), tabular numeric alignment, zero gradient purple
   - Full mobile safe-area inset support + desktop wide-screen adaptation
   ========================================================================== */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --text: #111827;
  --text-secondary: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  /* Chinese financial convention: Red = Gain/Positive, Green = Drop/Negative */
  --up: #dc2626;
  --up-soft: #fef2f2;
  --down: #059669;
  --down-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --base-font-size: 14px;
}

body.font-sm { --base-font-size: 13px; }
body.font-md { --base-font-size: 14px; }
body.font-lg { --base-font-size: 16px; }

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--base-font-size);
  line-height: 1.5;
}

.num, td, .metric-val {
  font-variant-numeric: tabular-nums;
}

.up { color: var(--up) !important; font-weight: 600; }
.down { color: var(--down) !important; font-weight: 600; }
.muted { color: var(--muted); }

/* Offline Banner */
.offline-banner {
  background: var(--warn);
  color: #fff;
  text-align: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}

/* App Shell & Safe Areas */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.account-select {
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-subtle);
  color: var(--text);
}

/* Announcement Bar */
.ann-bar {
  background: var(--warn-soft);
  border-top: 1px solid #fde68a;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.ann-tag {
  background: var(--warn);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.ann-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #92400e;
}

.ann-close {
  border: 0;
  background: transparent;
  font-size: 18px;
  color: #92400e;
  cursor: pointer;
  padding: 0 4px;
}

/* Main Content Area */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 14px 16px;
}

/* Toolbar & Filters */
.toolbar-panel, .subnav-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.subnav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.scope-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.count-pill {
  display: inline-block;
  background: var(--up);
  color: #fff;
  border-radius: 99px;
  padding: 0 6px;
  font-size: 11px;
  margin-left: 4px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 200px;
}

input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="password"], select, textarea {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-wrap input {
  width: 100%;
}

textarea {
  height: auto;
  min-height: 84px;
  padding: 8px 10px;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:hover {
  border-color: #9ca3af;
  background: var(--surface-subtle);
}

.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.btn-danger {
  color: var(--up);
  border-color: #fca5a5;
}

.btn-danger:hover {
  background: var(--up-soft);
}

/* Data Tables & Swiss Grid Cards */
.table-card, .panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.panel-card {
  padding: 16px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.data-table th, .data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #f1f5f9;
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child, .data-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 2;
  border-right: 1px solid #f1f5f9;
}

.data-table thead th {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.data-table thead th.sortable {
  cursor: pointer;
}

.data-table thead th.sortable:hover {
  color: var(--primary);
  background: #eff6ff;
}

.data-table tbody tr {
  background: #ffffff;
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.prod-title-cell {
  cursor: pointer;
  min-width: 185px;
}

.prod-name-line {
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.prod-meta-line {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: #f3f4f6;
  color: #4b5563;
}

.tag-blue { background: var(--primary-soft); color: var(--primary); }
.tag-red { background: var(--up-soft); color: var(--up); }
.tag-green { background: var(--down-soft); color: var(--down); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }

.best-cell {
  background: #fef2f2 !important;
  color: var(--up);
  font-weight: 700;
}

/* Metrics Summary Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.metric-val {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.metric-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Pagination */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  font-size: 13px;
  color: var(--muted);
}

/* Empty, Loading & Error States */
.loading-state, .empty-state, .error-state {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
}

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

.cal-cell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 76px;
  padding: 6px 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s;
}

.cal-cell:hover, .cal-cell.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.cal-day {
  font-weight: 700;
  font-size: 13px;
}

.cal-count {
  margin-top: 6px;
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* Mine Grid */
.mine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

/* Bottom TabBar */
.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(56px + env(safe-area-inset-bottom));
}

.tabbar-item {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.tabbar-item.active {
  color: var(--primary);
}

.tabbar-icon {
  width: 20px;
  height: 20px;
}

/* Modal System */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(17, 24, 39, 0.48);
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
}

.modal-overlay.is-open {
  display: flex;
}

.modal-close {
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.modal-close:hover, .modal-close:active {
  background: #f3f4f6;
  color: #111827;
}

.modal-card {
  width: min(820px, 100%);
  max-height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.16);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-field input, .form-field select, .form-field textarea {
  width: 100%;
}

/* Toast */
.toast-container {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #111827;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.toast.ok { background: var(--down); }
.toast.err { background: var(--up); }

@media (max-width: 680px) {
  .brand-sub { display: none; }
  .app-main { padding: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: 60px; padding: 4px; }
}


/* v2.1.0 Automation Bar, Profit Heatmap Calendar & Diagnostics */
.auto-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.auto-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--down);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
  flex-shrink: 0;
}

.auto-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.heatmap-head {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 0;
}

.heatmap-cell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 64px;
  padding: 6px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.heatmap-cell.gain {
  background: #fef2f2;
  border-color: #fecaca;
}

.heatmap-cell.loss {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.heatmap-day {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.heatmap-val {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
}

/* ==========================================================================
   v2.5.0 Mobile-First Responsive Layout, Clean 4-Tab Bar & Overview Cards
   ========================================================================== */
.scope-tabs::-webkit-scrollbar { display: none; }
.scope-tabs { scrollbar-width: none; -ms-overflow-style: none; }

.search-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.filter-select-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.filter-select-grid select {
  width: 100%;
  min-width: 0;
  padding: 0 6px;
  font-size: 12px;
  height: 34px;
}

.interest-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  margin-top: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.interest-bar-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.interest-label {
  font-weight: 700;
  color: var(--text-secondary);
}

.chip-xs {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 6px;
}

.principal-input {
  width: 88px !important;
  height: 28px !important;
  padding: 0 6px !important;
  font-size: 12px !important;
  font-weight: 600;
}

.interest-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.interest-cell-hl {
  font-weight: 700;
  background: rgba(239, 68, 68, 0.04);
}

/* Color scheme reversal support (盈绿亏红 when .scheme-green-up is active) */
body.scheme-green-up { --up: #059669; --down: #dc2626; }
body.scheme-green-up .up { color: #059669 !important; }
body.scheme-green-up .down { color: #dc2626 !important; }
body.scheme-green-up .cal-cell.gain { background: #ecfdf5; border-color: #a7f3d0; color: #059669; }
body.scheme-green-up .cal-cell.loss { background: #fef2f2; border-color: #fecaca; color: #dc2626; }

/* Segmented Pill Bar & Dark Navy Hero Card */
.seg-bar { display: flex; background: #eef2f6; padding: 4px; border-radius: 10px; gap: 4px; margin-bottom: 12px; }
.seg-btn { flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; color: #64748b; cursor: pointer; transition: all .15s; white-space: nowrap; }
.seg-btn.active { background: #ffffff; color: #0f172a; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.navy-hero { background: linear-gradient(135deg, #141b2d 0%, #1e293b 100%); color: #ffffff; border-radius: 14px; padding: 18px; margin-bottom: 12px; position: relative; box-shadow: 0 8px 20px rgba(15,23,42,0.12); }
.navy-hero-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #94a3b8; }
.navy-hero-val { font-size: 30px; font-weight: 800; margin: 6px 0 8px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.navy-hero-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: rgba(244,63,94,0.18); color: #fda4af; font-size: 12px; font-weight: 600; }
.navy-icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.06); color: #e2e8f0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; }
.navy-subgrid { background: #ffffff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin-bottom: 14px; }
.navy-subitem { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.navy-subitem span { color: #64748b; }
.navy-subitem b { color: #0f172a; font-variant-numeric: tabular-nums; }

/* 3D Calendar (日/月/年 + 金额/收益率) */
.cal-card { background: #ffffff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-nav-btn { border: 0; background: #f1f5f9; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-weight: 700; color: #334155; }
.cal-week-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; text-align: center; font-size: 12px; color: #94a3b8; margin-bottom: 6px; }
.cal-day-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cal-cell { background: #f8fafc; border: 1px solid #f1f5f9; border-radius: 8px; padding: 6px 2px; text-align: center; min-height: 52px; display: flex; flex-direction: column; justify-content: center; align-items: center; font-variant-numeric: tabular-nums; }
.cal-cell.gain { background: #fff1f2; border-color: #ffe4e6; color: #e11d48; }
.cal-cell.loss { background: #ecfdf5; border-color: #d1fae5; color: #059669; }
.cal-cell.today { border: 2px solid #94a3b8; }
.cal-cell-num { font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 2px; }
.cal-cell.gain .cal-cell-num { color: #be123c; }
.cal-cell.loss .cal-cell-num { color: #047857; }
.cal-cell-val { font-size: 10px; font-weight: 700; line-height: 1.15; word-break: break-all; }

.action-row-card { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: 8px; cursor: pointer; transition: border-color .15s; }
.action-row-card:hover { border-color: var(--primary); }

@media (max-width: 680px) {
  .header-inner { padding: 8px 12px; gap: 6px; flex-wrap: nowrap; }
  .brand-logo { width: 28px; height: 28px; }
  .brand-title { font-size: 15px; white-space: nowrap; }
  .account-bar { gap: 5px; flex-shrink: 0; }
  .account-select { height: 30px; padding: 0 6px; font-size: 12px; max-width: 102px; }
  .toolbar-panel, .subnav-bar { padding: 10px; }
  .search-wrap { min-width: 140px; }
  .navy-subgrid { grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 10px 12px; }
  .navy-subitem { font-size: 12px; }
  .app-tabbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(56px + env(safe-area-inset-bottom));
  }
  .tabbar-item {
    min-width: 0;
    padding: 4px 2px;
    font-size: 11px;
    white-space: nowrap;
  }
}

/* v2.6.0 Dual-End (Mobile 360~430px & PC 1024~1920px) Responsive Layout & Alipay/CardKey UI */
.overview-dual-grid {
  display: block;
}
.alipay-qr-box {
  text-align: center;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 10px 0;
}
.alipay-qr-box img {
  width: 220px;
  height: 220px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 6px;
}
.cardkey-redeem-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.cardkey-redeem-bar input {
  flex: 1;
  min-width: 200px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

@media (min-width: 1024px) {
  .overview-dual-grid {
    display: grid;
    grid-template-columns: minmax(390px, 460px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }
  .cal-day-grid .cal-cell {
    min-height: 62px;
    padding: 8px 4px;
  }
  .cal-cell-num {
    font-size: 13px;
  }
  .cal-cell-val {
    font-size: 11.5px;
  }
}

@media (max-width: 680px) {
  .subnav-bar .scope-tabs {
    width: 100%;
    padding-bottom: 4px;
  }
  .subnav-bar .toolbar-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: minmax(100px, 1fr) auto auto auto;
    gap: 6px;
    align-items: center;
  }
  .subnav-bar .toolbar-actions select {
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 0 8px;
    font-size: 12.5px;
  }
  .subnav-bar .toolbar-actions .btn {
    height: 32px;
    padding: 0 9px;
    font-size: 12.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .filter-row .toolbar-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .filter-row .toolbar-actions select,
  .filter-row .toolbar-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
  .cardkey-redeem-bar input {
    min-width: 100%;
  }
  .cardkey-redeem-bar .btn {
    width: 100%;
  }
}

/* v2.7.0 Redemption Pitfall Banner, Assassin Scanner & Profit Poster Styles */
.pitfall-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #92400e;
}
.pitfall-card.ok {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
  color: #166534;
}
.pitfall-card.info {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #bfdbfe;
  color: #1e40af;
}
.assassin-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.assassin-card.has-warn {
  border-color: #fecdd3;
  background: linear-gradient(180deg, #fff1f2 0%, #ffffff 42%);
}
.poster-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.poster-preview-wrap canvas {
  width: 100%;
  max-width: 340px;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  border: 1px solid var(--line);
}

/* v2.9.0 Progressive Disclosure (1-Line Smart Capsule, 4-Money Pools, 12M Ladder & Multi-End Responsive) */
.smart-digest-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid #dbeafe;
  margin-bottom: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.smart-digest-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.08);
}
.smart-digest-pill.has-warn {
  background: linear-gradient(90deg, #fff1f2 0%, #fffbeb 100%);
  border-color: #fecdd3;
}
.smart-digest-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 12.5px;
  color: #1e293b;
}
.smart-digest-right {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}
.four-pools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.pool-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}
.ladder-grid-12m {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.ladder-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  background: #f8fafc;
}
.ladder-cell.has-fund {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.ladder-cell.empty-month {
  background: #fff;
  border-style: dashed;
  opacity: 0.78;
}
.health-capsules-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 12px;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .overview-dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }
  .ladder-grid-12m {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 680px) {
  .ladder-grid-12m {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .four-pools-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .smart-digest-pill {
    padding: 9px 11px;
  }
}

/* ============================================================================
 * v3.0.0 iOS 18 Minimalist Theme, PC Top Nav vs Mobile Tabbar & Sticky Col Fix
 * ============================================================================ */
:root {
  --bg: #F2F2F7;
  --surface: #FFFFFF;
  --surface-subtle: #F9F9FB;
  --line: rgba(60, 60, 67, 0.11);
  --primary: #007AFF;
  --primary-hover: #0062CC;
  --primary-soft: rgba(0, 122, 255, 0.10);
  --radius: 14px;
  --radius-sm: 8px;
}

.app-header {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.14);
}

.brand-logo {
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.18);
}

/* PC Desktop Top Segmented Navigation */
.pc-top-nav {
  display: inline-flex;
  align-items: center;
  background: rgba(118, 118, 128, 0.10);
  padding: 3px;
  border-radius: 11px;
  gap: 2px;
}

.pc-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #3C3C43;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.pc-nav-item:hover {
  color: var(--primary);
}

.pc-nav-item.active {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.nav-svg-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.mobile-filter-triggers {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Fix Market Table Sticky First Column Opaque Background & Width on Both Ends */
.data-table thead th {
  background: #F9F9FB !important;
}

.data-table thead th:first-child {
  background: #F9F9FB !important;
  z-index: 5 !important;
  box-shadow: 1px 0 0 rgba(60, 60, 67, 0.10);
}

.data-table tbody td:first-child {
  background: #FFFFFF !important;
  z-index: 3 !important;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.03);
}

.data-table tbody tr:hover td:first-child {
  background: #F8FAFC !important;
}

/* PC & Tablet >= 768px: Show Top Nav, Hide Bottom Tabbar completely */
@media (min-width: 768px) {
  .app-tabbar {
    display: none !important;
  }
  body {
    padding-bottom: 24px !important;
  }
  #mobileFilterToggleBtn {
    display: none !important;
  }
  .market-filter-drawer {
    display: block !important;
  }
  .data-table th:first-child,
  .data-table td:first-child {
    width: 210px;
    min-width: 200px;
    max-width: 230px;
    white-space: normal;
  }
  .prod-name-line {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
  }
}

/* Mobile < 768px: Hide PC Top Nav, Show iOS Frosted Bottom Tabbar, Fix First Column Width to 126px */
@media (max-width: 767px) {
  .pc-top-nav {
    display: none !important;
  }
  .brand-sub {
    display: none !important;
  }
  .app-tabbar {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(54px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid rgba(60, 60, 67, 0.16);
  }
  .market-filter-drawer {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 0.5px solid var(--line);
  }
  .market-filter-drawer.open {
    display: block;
  }
  .search-action-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .search-wrap {
    flex: 1;
    min-width: 0;
  }
  /* Strictly limit mobile sticky column to 126px so 240px+ of data columns are visible on the right */
  .data-table {
    min-width: 620px;
  }
  .data-table th,
  .data-table td {
    padding: 9px 8px;
    font-size: 12.5px;
  }
  .data-table th:first-child,
  .data-table td:first-child {
    width: 126px !important;
    min-width: 126px !important;
    max-width: 126px !important;
    padding: 8px 8px !important;
    white-space: normal !important;
  }
  .prod-title-cell {
    min-width: 110px !important;
    max-width: 126px !important;
  }
  .prod-name-line {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.28;
    color: #1C1C1E;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-all;
  }
  .prod-meta-line {
    font-size: 10.5px;
    color: #8E8E93;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
}

