:root {
  color-scheme: dark;
  
  /* Financial Terminal Color Scheme */
  --bg: #090c12;
  --bg-gradient: none;
  --panel: #111520;
  --panel-border: rgba(255, 255, 255, 0.07);
  --panel-hover: #161b2a;
  
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --line: rgba(255, 255, 255, 0.06);
  
  /* Flat buttons and borders (No neon gradients, no gaming glow) */
  --primary: #1d4ed8;
  --primary-hover: #2563eb;
  --primary-bg: rgba(29, 78, 216, 0.15);
  
  /* Financial A-Share Trend Colors */
  --up: #ff5c5c; /* Serious red for stock up */
  --up-bg: rgba(255, 92, 92, 0.18);
  --down: #24c767; /* Serious green for stock down */
  --down-bg: rgba(36, 199, 103, 0.1);
  
  /* Risk Warnings */
  --risk-high: #f84d4d;
  --risk-medium: #f59e0b; /* Orange/Amber */
  --risk-neutral: #64748b;
  
  /* Radius & Density Padding */
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;
  
  --input-bg: #0b0d13;
  --input-border: rgba(255, 255, 255, 0.08);
  
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Plus Jakarta Sans", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  padding: 16px 20px;
  max-width: 1600px;
  margin: 0 auto;
}

/* Header Section */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 16px;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h1::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--down);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--down);
  animation: pulse 2s infinite;
}

#subtitle {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
}

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

/* Terminal Buttons */
button {
  align-items: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  outline: none;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
  min-height: 32px;
  padding: 0 12px;
}
.primary-button:hover:not(:disabled) {
  background: var(--primary-hover);
}

.icon-button,
.small-button {
  background: #161b26;
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  min-height: 32px;
  padding: 0 12px;
}
.icon-button:hover:not(:disabled),
.small-button:hover:not(:disabled) {
  background: var(--panel-hover);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.15);
}

.small-button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.mini-button {
  background: transparent;
  color: var(--text-secondary);
  min-height: 24px;
  width: 24px;
  padding: 0;
  font-size: 16px;
  border-radius: var(--radius-sm);
}
.mini-button:hover {
  background: rgba(248, 77, 77, 0.15);
  color: var(--up);
}

.danger-button {
  color: var(--up);
  border-color: rgba(248, 77, 77, 0.25);
  background: rgba(248, 77, 77, 0.05);
}
.danger-button:hover:not(:disabled) {
  background: var(--up-bg);
  border-color: var(--up);
  color: #ffffff;
}

/* Status Strip */
.status-strip {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.status-strip > div {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-strip span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.status-strip strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

/* Layout System */
.layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.panel-title h2 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-title h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background-color: var(--primary);
  border-radius: 1px;
}

/* Today's Market Brief Section (3 cards layout) */
.brief-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.brief-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 80px;
  position: relative;
}

.brief-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.brief-card.risk::before { background-color: var(--risk-high); }
.brief-card.active::before { background-color: var(--risk-medium); }
.brief-card.resilient::before { background-color: var(--down); }

.brief-card-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.brief-card-value {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
}

.brief-card-value strong {
  font-family: var(--font-display);
  font-size: 14px;
  color: #ffffff;
  font-weight: 700;
}

.brief-card-value span {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Watchlist Drawer Table */
.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

.watch-table {
  table-layout: fixed;
  min-width: 680px;
}

.watch-table th:nth-child(1), .watch-table td:nth-child(1) { width: 38px; text-align: center; }
.watch-table th:nth-child(2), .watch-table td:nth-child(2) { width: 50px; text-align: center; }
.watch-table th:nth-child(3), .watch-table td:nth-child(3) { width: 75px; }
.watch-table th:nth-child(4), .watch-table td:nth-child(4) { width: 140px; }
.watch-table th:nth-child(5), .watch-table td:nth-child(5),
.watch-table th:nth-child(6), .watch-table td:nth-child(6),
.watch-table th:nth-child(7), .watch-table td:nth-child(7) { width: 62px; }
.watch-table th:nth-child(8), .watch-table td:nth-child(8),
.watch-table th:nth-child(9), .watch-table td:nth-child(9) { width: 75px; }

.batch-threshold-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.batch-threshold-bar input {
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
}
.asset-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.asset-tag.stock { background: rgba(37, 99, 235, 0.15); color: #60a5fa; }
.asset-tag.gold { background: rgba(214, 168, 63, 0.15); color: #fbbf24; }
.asset-tag.fund { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
.code-badge { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.name-input { width: 100%; border: 1px solid transparent; background: transparent; color: var(--text); padding: 4px 6px; border-radius: 4px; }
.name-input:focus { border-color: var(--line); background: var(--bg); }
.watch-table input[type="number"] { width: 100%; padding: 4px 6px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-family: var(--font-mono); text-align: right; }

th {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 10px 8px;
  border-bottom: 2px solid var(--panel-border);
  background-color: rgba(255, 255, 255, 0.01);
}

td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  vertical-align: middle;
}

tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

/* Inputs in Watchlist Drawer Table */
td input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  min-height: 28px;
  padding: 0 6px;
  width: 100%;
  font-size: 12px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

td input:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

td input:focus {
  border-color: var(--primary);
  background-color: #0d1017;
}

.watch-table tr.invalid-row input[data-field="symbol"] {
  border-color: var(--up);
  color: var(--up);
  background-color: rgba(248, 77, 77, 0.05);
}

td input[type="checkbox"] {
  min-height: auto;
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary);
}

.code-input {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* Price Rules List */
.rule-list {
  display: grid;
  gap: 8px;
}

.rule-row {
  background: #161a25;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 12px;
  grid-template-columns: 72px repeat(2, minmax(0, 1fr));
  padding: 10px 12px;
  align-items: center;
}

.rule-row strong {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.rule-row label {
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  font-size: 10px;
  font-weight: 600;
  gap: 4px;
}

.rule-row input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  min-height: 28px;
  padding: 0 8px;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Locked 3-Column Quote Grid */
.quote-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
}

/* Professional Financial Terminal Quote Card */
.quote-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  min-height: 240px; /* Force unified height */
}

.quote-card:hover {
  background-color: var(--panel-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

.quote-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.quote-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-symbol {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

/* Price & Change Row */
.quote-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 12px 0 10px;
}

.price {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.price.up { color: var(--up); }
.price.down { color: var(--down); }
.price.flat { color: var(--text); }

/* A-Share Standard Trend Colors: 涨红 跌/亏绿 (Up: Red, Down/Loss: Green) */
.up,
.text-up,
.num.up,
td.up,
td.num.up,
strong.up,
span.up,
div.up,
em.up,
.kpi strong.up,
.kpi em.up,
.kpi.highlight-gold strong.up,
.kpi.highlight-gold em.up {
  color: var(--up);
}

.down,
.text-down,
.num.down,
td.down,
td.num.down,
strong.down,
span.down,
div.down,
em.down,
.kpi strong.down,
.kpi em.down,
.kpi.highlight-gold strong.down,
.kpi.highlight-gold em.down {
  color: var(--down);
}

.flat,
.text-flat,
.num.flat,
td.flat,
td.num.flat,
strong.flat,
span.flat,
div.flat,
em.flat,
.kpi strong.flat,
.kpi em.flat,
.kpi.highlight-gold strong.flat,
.kpi.highlight-gold em.flat {
  color: var(--text-secondary);
}

#kpiToday.up,
#kpiPnl.up {
  color: var(--up) !important;
}

#kpiToday.down,
#kpiPnl.down {
  color: var(--down) !important;
}

#kpiToday.flat,
#kpiPnl.flat {
  color: var(--text) !important;
}

/* Ensure child .hold-meta (e.g., percentage under price/PnL) inherits the trend color */
.hold-table td.up .hold-meta,
.hold-table td.down .hold-meta,
.hold-table td.num.up .hold-meta,
.hold-table td.num.down .hold-meta {
  color: inherit;
  opacity: 0.88;
}

.change {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.change.up {
  color: var(--up);
  background: var(--up-bg);
}

.change.down {
  color: var(--down);
  background: var(--down-bg);
}

.change.flat {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.change.up::before { content: '+'; }

/* Core Metrics Grid inside Card */
.quote-meta {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.quote-meta div {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quote-meta span {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
}

.quote-meta strong {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
}

/* Warning Reason Box in Quote Card */
.quote-warning-box {
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  margin-top: auto;
  font-size: 11px;
  min-height: 42px; /* Force uniform size to keep cards matching */
  display: flex;
  align-items: center;
}

.quote-warning-box.active {
  color: var(--risk-high);
  font-weight: 600;
}

.quote-warning-box.active::before {
  content: '⚠ ';
  font-size: 12px;
}

.quote-warning-box.inactive {
  color: var(--text-muted);
}

/* Warnings Table (High Risk Highlight) */
.alert-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.alert-table th, .alert-table td {
  padding: 10px 10px;
  font-size: 12px;
}
.alert-table th:nth-child(1), .alert-table td:nth-child(1) { width: 140px; }
.alert-table th:nth-child(2), .alert-table td:nth-child(2) { width: 140px; }
.alert-table th:nth-child(3), .alert-table td:nth-child(3) { width: 90px; text-align: center; }
.alert-table th:nth-child(4), .alert-table td:nth-child(4) { width: auto; }

.alert-table td {
  font-family: var(--font-sans);
}

.alert-table td span.quote-symbol {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* Row-level risk warnings styles */
.row-risk-high {
  background-color: rgba(248, 77, 77, 0.04) !important;
}
.row-risk-high td:first-child {
  border-left: 3px solid var(--risk-high);
}

.row-risk-medium {
  background-color: rgba(245, 158, 11, 0.03) !important;
}
.row-risk-medium td:first-child {
  border-left: 3px solid var(--risk-medium);
}

.alert-level {
  border-radius: var(--radius-sm);
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  min-width: 46px;
  padding: 2px 6px;
  text-align: center;
  border: 1px solid transparent;
}

.alert-level.high {
  background: rgba(248, 77, 77, 0.08);
  color: var(--risk-high);
  border-color: rgba(248, 77, 77, 0.2);
}
.alert-level.medium {
  background: rgba(245, 158, 11, 0.08);
  color: var(--risk-medium);
  border-color: rgba(245, 158, 11, 0.2);
}
.alert-level.danger {
  background: rgba(36, 199, 103, 0.08);
  color: var(--down);
  border-color: rgba(36, 199, 103, 0.2);
}

.empty {
  color: var(--text-muted);
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
}

/* Slide-out Settings Drawer Panel */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 6, 12, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 760px;
  max-width: 96vw;
  height: 100vh;
  background: #0f121b;
  border-left: 1px solid var(--panel-border);
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.5);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.drawer-header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: #0b0d13;
  flex-shrink: 0;
}

/* ============================= */
/* Gold Price Panel               */
/* ============================= */
.gold-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.gold-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.gold-data-source {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

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

.gold-update-time {
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
}

/* 3-Card Grid */
.gold-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 320px;
  gap: 10px;
}

/* Gold Card Base — left gold stripe */
.gold-card {
  background: #0e131e;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

/* Gold accent: thin top strip with subtle amber */
.gold-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0.5;
}

.gold-card.intl::before  { background: linear-gradient(90deg, #c9a84c, transparent 70%); }
.gold-card.dom::before   { background: linear-gradient(90deg, #d4a017, transparent 70%); }
.gold-card.converter::before { background: linear-gradient(90deg, #5b7bb5, transparent 70%); }

.gold-card:hover {
  background-color: #121826;
  border-color: rgba(197, 165, 80, 0.18);
}

.gold-card.intl:hover::before,
.gold-card.dom:hover::before { opacity: 0.8; }

.gold-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.gold-card-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.gold-card-unit {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
}

/* Price & Change Row */
.gold-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 8px 0 6px;
}

.gold-price {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  transition: opacity 0.15s ease;
}

/* Flash animation on price update */
@keyframes goldFlash {
  0%   { opacity: 1; }
  25%  { opacity: 0.4; }
  50%  { opacity: 1; }
  75%  { opacity: 0.5; }
  100% { opacity: 1; }
}

.gold-price.flash {
  animation: goldFlash 0.5s ease-out;
}

.gold-price.up   { color: var(--up); }
.gold-price.down { color: var(--down); }
.gold-price.flat { color: var(--text); }

.gold-change {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.gold-change.up {
  color: var(--up);
  background: var(--up-bg);
}
.gold-change.up::before { content: '+'; }

.gold-change.down {
  color: var(--down);
  background: var(--down-bg);
}

.gold-change.flat {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

/* Meta Grid — 4 cells */
.gold-meta {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(4, 1fr);
}

.gold-meta div {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.gold-meta span {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gold-meta strong {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  transition: opacity 0.15s ease;
}

/* Converter Card */
.converter-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.converter-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.converter-label {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.converter-inputs {
  display: flex;
  gap: 6px;
  align-items: center;
}

.converter-inputs input {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  min-height: 32px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.converter-inputs input:focus {
  border-color: var(--primary);
  background-color: #0d1017;
  outline: none;
}

.converter-inputs input::placeholder {
  color: var(--text-muted);
  font-size: 10px;
}

.converter-eq {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.converter-formula {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
  font-family: var(--font-mono);
  opacity: 0.6;
}

/* Animations & Keyframes */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(36, 199, 103, 0.3); }
  70% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 4px rgba(36, 199, 103, 0); }
  100% { transform: scale(1); opacity: 0; box-shadow: 0 0 0 0 rgba(36, 199, 103, 0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .quote-grid { grid-template-columns: repeat(2, 1fr); }
  .brief-panel { grid-template-columns: repeat(3, 1fr); }
  .gold-cards { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 900px) {
  .gold-cards { grid-template-columns: 1fr; }
  .gold-meta { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .app-shell { padding: 12px 10px; }
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .top-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .brief-panel { grid-template-columns: 1fr; gap: 8px; }
  .quote-grid { grid-template-columns: 1fr; }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gold-cards { grid-template-columns: 1fr; }
}

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

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: #161b26;
}
.nav-link:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.15);
}

.kpi-strip {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 16px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.kpi.highlight-gold {
  border-color: rgba(214, 168, 63, 0.4);
  background: linear-gradient(180deg, rgba(214, 168, 63, 0.1) 0%, var(--panel) 100%);
}
.kpi.highlight-gold span {
  color: #f59e0b;
}
.kpi.highlight-gold strong {
  color: #fbbf24;
}
.kpi span {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.kpi strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: -0.4px;
}
.kpi em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 12px;
  color: var(--text-muted);
}

.alloc-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #0b0d13;
  margin: 8px 0 12px;
}
.alloc-bar i {
  display: block;
  height: 100%;
}
.alloc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}
.alloc-legend b {
  color: var(--text);
  font-weight: 600;
}

.hold-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
  min-width: 680px;
}
.hold-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.01);
}
.hold-table th.num {
  text-align: right;
}

th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}
th.sortable:hover {
  color: var(--text);
  background-color: rgba(255, 255, 255, 0.05);
}
.sort-icon {
  display: inline-block;
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.25;
  vertical-align: baseline;
  font-family: var(--font-sans);
}
th.sortable:hover .sort-icon {
  opacity: 0.65;
}
th.sort-active {
  color: #60a5fa !important;
}
th.sort-active .sort-icon {
  opacity: 1;
  color: #60a5fa;
  font-weight: bold;
}
.hold-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.hold-table td.num {
  font-family: var(--font-mono);
  text-align: right;
  white-space: nowrap;
}

/* Explicit 7-column percentage widths for identical vertical alignment across tables */
.hold-table th:nth-child(1), .hold-table td:nth-child(1) { width: 26%; }
.hold-table th:nth-child(2), .hold-table td:nth-child(2) { width: 10%; text-align: right; }
.hold-table th:nth-child(3), .hold-table td:nth-child(3) { width: 12%; text-align: right; }
.hold-table th:nth-child(4), .hold-table td:nth-child(4) { width: 12%; text-align: right; }
.hold-table th:nth-child(5), .hold-table td:nth-child(5) { width: 14%; text-align: right; }
.hold-table th:nth-child(6), .hold-table td:nth-child(6) { width: 13%; text-align: right; }
.hold-table th:nth-child(7), .hold-table td:nth-child(7) { width: 13%; text-align: right; }

.hold-name {
  font-weight: 700;
}
.hold-meta {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.fund-group-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--panel);
}
.fund-group-box .fund-group-header {
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.02);
}
.fund-group-box .table-wrap {
  border: none;
}

.fund-groups {
  display: grid;
  gap: 16px;
}

.lab-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.lab-controls button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.asset-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.asset-card h3 {
  font-size: 13px;
  margin: 0 0 8px;
}
.asset-card p {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

/* Market Summary Banner */
.market-summary-banner {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text);
}
.market-summary-banner.danger {
  background: rgba(248, 77, 77, 0.08);
  border-color: rgba(248, 77, 77, 0.25);
}
.market-summary-banner.positive {
  background: rgba(36, 199, 103, 0.08);
  border-color: rgba(36, 199, 103, 0.25);
}
.market-summary-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.market-summary-item {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

/* Fund Channel Header & Subtotal */
.fund-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin-bottom: -1px;
}
.fund-group-title {
  font-size: 14px;
  font-weight: 700;
}
.fund-group-subtotal {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  align-items: center;
}

/* News Search & Filter */
.news-header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.news-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.news-search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.news-search-box input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 5px 26px 5px 10px;
  font-size: 12px;
  width: 220px;
  transition: border-color 0.2s ease, width 0.2s ease, background 0.2s ease;
}
.news-search-box input:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(15, 23, 42, 0.95);
  width: 280px;
}
.news-search-box input::placeholder {
  color: var(--text-muted);
  font-size: 11px;
}
.search-clear-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  line-height: 1;
}
.search-clear-btn:hover {
  color: var(--text);
}
.news-quick-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 0 10px 0;
}
.news-filter-tag {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.news-filter-tag:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}
.news-filter-tag.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: #3b82f6;
  font-weight: 600;
}
.news-highlight {
  background: rgba(234, 179, 8, 0.25);
  color: #fef08a;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 600;
}
.news-empty-box {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}
.news-empty-box button {
  background: none;
  border: none;
  color: #60a5fa;
  cursor: pointer;
  text-decoration: underline;
  margin-left: 6px;
  font-size: 12px;
}

/* News List */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}
.news-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
}
.news-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.news-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}
.news-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  font-weight: 600;
  white-space: nowrap;
}
.news-tag.gold {
  background: rgba(214, 168, 63, 0.2);
  color: #fbbf24;
}
.news-tag.fed {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}
.news-tag.stock {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}
.news-title {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.news-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* Modal Dialog for Briefing */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 6, 12, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 800px;
  max-width: 94vw;
  max-height: 88vh;
  background: #111520;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  z-index: 201;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-dialog.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
}

/* Briefing Rendered Content */
.brief-content {
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}
.brief-header h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--text);
}
.brief-meta-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.brief-section-title {
  margin: 20px 0 10px 0;
}
.brief-section-title h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.brief-section-title h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 14px;
  background: #3b82f6;
  border-radius: 2px;
}
.brief-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.brief-kpi-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brief-kpi-card span {
  font-size: 11px;
  color: var(--text-muted);
}
.brief-kpi-card strong {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
}
.brief-alloc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.brief-alloc-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
}
.brief-alloc-item.stock { border-left: 3px solid #2563eb; }
.brief-alloc-item.gold { border-left: 3px solid #d6a83f; }
.brief-alloc-item.fund { border-left: 3px solid #64748b; }
.brief-alloc-tag {
  font-weight: 600;
  font-size: 11px;
}
.brief-alloc-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}
.brief-alloc-pnl {
  font-family: var(--font-mono);
  font-size: 11px;
}
.brief-callout {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid #3b82f6;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 12px;
}
.brief-targets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.brief-target-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: background 0.15s ease;
}
.brief-target-card:hover {
  background: rgba(255, 255, 255, 0.04);
}
.brief-target-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.brief-target-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.brief-target-title strong {
  font-size: 13px;
  color: var(--text);
}
.brief-target-meta {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
.brief-action-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.brief-action-badge.hold {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.brief-action-badge.reduce {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.brief-action-badge.buy {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.brief-action-badge.skip {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}
.brief-target-strategy {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.5;
}
.brief-target-news {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brief-skip-box {
  background: rgba(148, 163, 184, 0.08);
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.brief-disclaimer {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 16px;
}
.brief-news-list {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.brief-news-list li {
  margin-bottom: 4px;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #0b0d13;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Daily Advice Action Board */
.advice-panel {
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.5) 0%, rgba(11, 15, 25, 0.7) 100%);
  border-radius: var(--radius-lg);
}
.advice-title-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.advice-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}
.advice-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.advice-macro-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.advice-macro-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 280px;
}
.compass-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.compass-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.advice-macro-badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.advice-stat-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.advice-stat-pill.buy {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}
.advice-stat-pill.reduce {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}
.advice-stat-pill.hold {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}
.advice-stat-pill.skip {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.25);
}

.advice-tab.active.blue {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border-color: #3b82f6;
}

.advice-filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.advice-tab {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.advice-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.advice-tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #3b82f6;
  font-weight: 600;
}
.advice-tab.active.red {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: #ef4444;
}
.advice-tab.active.green {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border-color: #10b981;
}
.advice-tab.active.gray {
  background: rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  border-color: #94a3b8;
}

.advice-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}
.advice-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.advice-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.advice-card.buy {
  border-left: 3px solid #3b82f6;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, rgba(255, 255, 255, 0.02) 40%);
}
.advice-card.reduce {
  border-left: 3px solid #ef4444;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, rgba(255, 255, 255, 0.02) 40%);
}
.advice-card.hold {
  border-left: 3px solid #10b981;
}
.advice-card.skip {
  border-left: 3px solid #94a3b8;
  opacity: 0.85;
}

.advice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.advice-card-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.advice-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.advice-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.advice-badge.buy {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.advice-badge.reduce {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.advice-badge.hold {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.advice-badge.skip {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.advice-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.advice-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.advice-metric .label {
  font-size: 10px;
  color: var(--text-muted);
}
.advice-metric .val {
  font-size: 12px;
  font-weight: 600;
}

.advice-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.advice-point {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.5;
}
.point-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  margin-top: 2px;
}
.point-badge.reason {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.point-badge.discipline {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}
.point-text {
  color: var(--text-secondary);
  flex: 1;
}

.advice-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}
.advice-news-snip {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.open-cfg-btn {
  font-size: 11px;
  padding: 3px 8px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--line);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.open-cfg-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: #3b82f6;
}

/* Fed History Module */
.fed-history-panel {
  margin-top: 18px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.6) 0%, rgba(11, 15, 25, 0.8) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.fed-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.fed-history-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fed-stat-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  font-weight: 500;
}
.fed-stat-badge.highlight {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

.fed-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.fed-filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}
.fed-tab {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.fed-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.fed-tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #3b82f6;
  font-weight: 600;
}

.fed-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fed-history-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.fed-history-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.fed-history-card.cut {
  border-left: 3px solid #10b981;
}
.fed-history-card.hold {
  border-left: 3px solid #64748b;
}

.fed-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.fed-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fed-date {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.fed-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.fed-badge.cut {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.fed-badge.hold {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}
.fed-rate-range {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 3px;
}
.replay-btn {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.replay-btn:hover {
  background: #2563eb;
  color: #fff;
  border-color: #3b82f6;
}

.fed-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.fed-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.fed-transmission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.fed-transmission-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  line-height: 1.5;
}
.fed-transmission-item .tag {
  color: var(--text-muted);
  white-space: nowrap;
}
.fed-transmission-item .val {
  color: var(--text-secondary);
  flex: 1;
}

/* ==============================================================================
   Standardized Confirm & Action Dialogs (标准化操作弹窗)
   ============================================================================== */
.confirm-dialog {
  max-width: 440px;
  width: 90vw;
  background: rgba(17, 21, 32, 0.96);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.75);
}

.confirm-dialog .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.confirm-dialog .modal-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--text, #f8fafc);
}

.confirm-dialog .confirm-icon {
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.confirm-dialog .modal-body {
  padding: 22px 20px;
}

.confirm-dialog .confirm-title-msg {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #f8fafc);
  margin-bottom: 8px;
  line-height: 1.5;
}

.confirm-dialog .confirm-sub-msg {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  line-height: 1.6;
}

.confirm-dialog .modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom-left-radius: var(--radius-lg, 12px);
  border-bottom-right-radius: var(--radius-lg, 12px);
}

.danger-button {
  background: #ef4444;
  color: #fff;
  border: 1px solid #f87171;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.danger-button:hover {
  background: #dc2626;
  border-color: #ef4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}