/**
 * 紀律之眼 · 與 hub-theme 視覺銜接（不重寫功能樣式）
 */
body.hub-discipline-bridge {
  font-variant-numeric: tabular-nums;
}

body.hub-discipline-bridge .container {
  max-width: 720px;
}

body.hub-discipline-bridge header {
  margin-bottom: 20px;
}

body.hub-discipline-bridge .title {
  font-family: Georgia, "Source Han Serif TC", serif;
  font-size: 24px;
}

body.hub-discipline-bridge .subtitle {
  letter-spacing: 0.12em;
}

/* 分頁對齊 hub-tabs */
body.hub-discipline-bridge .tabs {
  margin-bottom: 16px;
}

body.hub-discipline-bridge .tab {
  flex: 1 0 auto;
  min-width: max-content;
  padding: 10px 12px;
  white-space: nowrap;
}

body.hub-discipline-bridge .tab.active {
  background: var(--ink);
  color: var(--paper);
}

/* 區塊卡片 */
body.hub-discipline-bridge .daily-section,
body.hub-discipline-bridge .section-block {
  border-radius: 10px;
  box-shadow: var(--shadow);
}

body.hub-discipline-bridge .section-title {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  font-size: 17px;
  color: var(--ink);
}

body.hub-discipline-bridge .section-title .num {
  color: var(--accent);
}

/* 按鈕族 */
body.hub-discipline-bridge .fetch-all-btn,
body.hub-discipline-bridge .field-fetch-btn {
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}

body.hub-discipline-bridge .fetch-all-btn {
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--accent);
}

body.hub-discipline-bridge .fetch-all-btn:hover {
  background: #f5f2ec;
  border-color: var(--accent);
}

body.hub-discipline-bridge .fetch-all-btn-secondary {
  background: #f5f2ec;
  color: var(--ink-soft);
}

/* 輸入框 */
body.hub-discipline-bridge input[type="number"],
body.hub-discipline-bridge input[type="text"],
body.hub-discipline-bridge select,
body.hub-discipline-bridge textarea,
body.hub-discipline-bridge input[type="date"] {
  border-radius: 8px;
  border-color: var(--line);
}

body.hub-discipline-bridge input:focus-visible,
body.hub-discipline-bridge select:focus-visible,
body.hub-discipline-bridge textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* 持倉卡 */
body.hub-discipline-bridge .position-card {
  border-radius: 10px;
  border-color: var(--line);
  box-shadow: var(--shadow);
}

/* 橫幅 */
body.hub-discipline-bridge .discipline-banner {
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(165deg, #fff 0%, #faf8f5 100%);
}

body.hub-discipline-bridge.hub-theme-dark .discipline-banner {
  background: linear-gradient(165deg, #1e293b 0%, #0f1729 100%);
  border-color: var(--line-strong);
}

body.hub-discipline-bridge.hub-theme-dark .fetch-all-btn:hover {
  background: #334155;
}

body.hub-discipline-bridge.hub-theme-dark .cross-day-banner {
  background: linear-gradient(165deg, #1e293b 0%, #0f1729 100%);
}

body.hub-discipline-bridge.hub-theme-dark .quick-links {
  background: #1e3a5f;
  border-color: #334155;
}

body.hub-discipline-bridge.hub-theme-dark .ql-btn {
  background: var(--paper);
  border-color: #475569;
  color: #93c5fd;
}

/* ── 深色模式細部（第五階段） ── */
body.hub-discipline-bridge.hub-theme-dark .fetch-all-btn-secondary {
  background: #334155;
  color: var(--ink-soft);
}

body.hub-discipline-bridge.hub-theme-dark .field-warning {
  background: var(--red-bg);
  color: #fecaca;
  border-left-color: var(--red);
}

body.hub-discipline-bridge.hub-theme-dark .position-card,
body.hub-discipline-bridge.hub-theme-dark button.btn-recalc-cost,
body.hub-discipline-bridge.hub-theme-dark .position-card .pc-actions button {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line-strong);
}

body.hub-discipline-bridge.hub-theme-dark .position-card.warn {
  background: var(--yellow-bg);
  border-left-color: var(--yellow);
}

body.hub-discipline-bridge.hub-theme-dark .position-card.danger {
  background: var(--red-bg);
}

body.hub-discipline-bridge.hub-theme-dark .position-card .pc-actions .btn-close {
  background: var(--accent);
  color: #0f1729;
  border-color: var(--accent);
}

body.hub-discipline-bridge.hub-theme-dark .modal-backdrop {
  background: rgba(0, 0, 0, 0.65);
}

body.hub-discipline-bridge.hub-theme-dark .modal {
  background: var(--paper);
  color: var(--ink);
}

body.hub-discipline-bridge.hub-theme-dark .modal-close {
  color: var(--ink-soft);
}

body.hub-discipline-bridge.hub-theme-dark .dictionary-panel {
  background: var(--paper);
  border-color: var(--line);
}

body.hub-discipline-bridge.hub-theme-dark details.premarket-details,
body.hub-discipline-bridge.hub-theme-dark .daily-section,
body.hub-discipline-bridge.hub-theme-dark .section-block {
  background: var(--paper);
  border-color: var(--line);
}

body.hub-discipline-bridge.hub-theme-dark .market-field,
body.hub-discipline-bridge.hub-theme-dark .toolbar button:not(.primary):not(.danger) {
  background: var(--paper);
  color: var(--ink);
}

body.hub-discipline-bridge.hub-theme-dark .toolbar button.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

body.hub-discipline-bridge.hub-theme-dark .pos-balance-table tbody tr:hover td,
body.hub-discipline-bridge.hub-theme-dark .pos-bal-main:hover td {
  background: #334155;
}

body.hub-discipline-bridge.hub-theme-dark .pos-balance-table tr.pos-bal-zero td {
  background: var(--bg);
  color: var(--ink-faint);
}

body.hub-discipline-bridge.hub-theme-dark .pos-balance-table thead th {
  background: var(--bg);
}

body.hub-discipline-bridge.hub-theme-dark .data-source-banner,
body.hub-discipline-bridge.hub-theme-dark #researchCardBanner,
body.hub-discipline-bridge.hub-theme-dark #storageRecoveryBanner {
  background: var(--yellow-bg) !important;
  border-color: #854d0e !important;
  color: var(--ink) !important;
}

body.hub-discipline-bridge.hub-theme-dark #fileProtocolWarning {
  background: var(--red-bg) !important;
  border-color: var(--red) !important;
  color: #fecaca !important;
}

body.hub-discipline-bridge.hub-theme-dark #fileProtocolWarning code {
  background: var(--paper) !important;
  color: var(--ink) !important;
}

@media (max-width: 639px) {
  body.hub-discipline-bridge .container {
    padding-bottom: calc(var(--hub-bottom-nav-h, 56px) + 24px);
  }

  body.hub-discipline-bridge .title {
    font-size: 22px;
  }
}
