/* ============================================================
   家庭财经日报 · 编辑部行情终端
   Design: paper / ink / vermilion / pine green (A股红涨绿跌)
   ============================================================ */

:root {
  --paper: #f4efe3;
  --paper-2: #ede5d1;
  --card: #faf6ea;
  --ink: #231f18;
  --ink-2: #4c463a;
  --ink-3: #8b8371;
  --line: #d9cfb8;
  --line-2: #c0b497;
  --red: #c0392b;
  --red-2: #9e2a1d;
  --green: #1e6b4c;
  --green-2: #15543b;
  --brass: #a97e2f;
  --brass-soft: #dcc58f;
  --black: #16130d;
  --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "WenQuanYi Micro Hei", sans-serif;
  --font-mono: "Cascadia Mono", "JetBrains Mono", "SF Mono", "Consolas", "Courier New", monospace;
  --shadow-1: 0 1px 2px rgba(35, 31, 24, .08), 0 6px 18px -10px rgba(35, 31, 24, .25);
  --shadow-stamp: 7px 7px 0 rgba(35, 31, 24, .12);
  --radius: 2px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(169, 126, 47, .10), transparent 60%),
    linear-gradient(90deg, rgba(35, 31, 24, .028) 1px, transparent 1px),
    linear-gradient(rgba(35, 31, 24, .025) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 72px 72px, 72px 72px, auto;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
}

/* 纸质噪点 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--red); color: #fff; }

a { color: inherit; text-decoration: none; }

.wrap {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 2.4rem));
  margin: 0 auto;
}

/* ---------- 顶栏 ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(244, 239, 227, .88);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem 0;
  font-size: 13px;
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-serif);
  font-weight: 800;
  letter-spacing: .06em;
}

.brand-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  background: var(--red);
  color: var(--paper);
  font-size: .82rem;
  transform: rotate(-3deg);
  box-shadow: var(--shadow-stamp);
}

.nav {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}

.nav a {
  padding: .3rem .7rem;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}

.nav a:hover { color: var(--ink); }

.nav a.active {
  color: var(--ink);
  border-bottom-color: var(--red);
  font-weight: 700;
}

.nav .lock-btn {
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  padding: .28rem .6rem;
  border-radius: var(--radius);
  transition: all .15s;
}

.nav .lock-btn:hover { border-color: var(--red); color: var(--red); }

/* ---------- 报头 ---------- */
.masthead {
  padding: 1.3rem 0 .8rem;
  border-bottom: 3px double var(--ink);
  position: relative;
}

.masthead-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 1rem;
}

.mast-meta {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.7;
}

.mast-meta .mono { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

.mast-meta.right { text-align: right; }

.mast-title {
  text-align: center;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(1.7rem, 4.2vw, 2.7rem);
  letter-spacing: .16em;
  margin: 0;
  line-height: 1.15;
}

.mast-title .kicker {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: .42em;
  color: var(--ink-3);
  margin-top: .35rem;
}

.mast-stamp {
  position: absolute;
  right: 0;
  bottom: -14px;
  width: 52px;
  height: 52px;
  border: 2px solid var(--red);
  color: var(--red);
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .12em;
  transform: rotate(4deg);
  opacity: .82;
}

.mast-stamp::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid currentColor;
}

@media (min-width: 700px) { .mast-stamp { display: flex; } }

/* ---------- 行情跑马灯 ---------- */
.ticker {
  margin: 1.1rem 0 1.4rem;
  background: var(--black);
  color: #efe8d6;
  overflow: hidden;
  position: relative;
}

.ticker::before,
.ticker::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 34px;
  z-index: 2;
  pointer-events: none;
}

.ticker::before { left: 0; background: linear-gradient(90deg, rgba(22, 19, 13, .9), transparent); }
.ticker::after { right: 0; background: linear-gradient(-90deg, rgba(22, 19, 13, .9), transparent); }

.ticker-track {
  display: inline-flex;
  gap: 2.6rem;
  white-space: nowrap;
  padding: .5rem 0;
  animation: ticker 80s linear infinite;
  will-change: transform;
}

.ticker:hover .ticker-track { animation-play-state: paused; }

.ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: .45rem;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.ticker-item .nm { color: #bfb49b; font-family: var(--font-sans); }
.ticker-item .pr { font-weight: 600; }
.ticker-item .up { color: #ef6a58; }
.ticker-item .down { color: #57b98d; }
.ticker-item .flat { color: #bfb49b; }

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- 通用区块 ---------- */
.section {
  margin: 0 0 1.8rem;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid var(--ink);
  padding-bottom: .5rem;
  margin-bottom: .9rem;
}

.section-head .no {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--paper);
  background: var(--red);
  padding: .15rem .45rem;
  margin-right: .5rem;
  letter-spacing: .08em;
}

.section-head h2 {
  display: inline;
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.section-head .hint {
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
}

.refresh-row {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
  display: inline-block;
  margin-right: .35rem;
}

.live-dot.on { background: var(--red); animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, .45); }
  50% { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: .48rem 1rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all .15s;
  white-space: nowrap;
}

.btn:hover { background: var(--ink); color: var(--paper); }

.btn-primary { background: var(--red); border-color: var(--red); color: var(--paper); }
.btn-primary:hover { background: var(--red-2); border-color: var(--red-2); }

.btn-ghost { border-color: var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--line-2); }

.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: var(--paper); }

.btn-sm { padding: .28rem .6rem; font-size: 12px; }

.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn .spin {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 行情卡片 ---------- */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: .8rem;
}

.quote-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  padding: .85rem .95rem .8rem;
  transition: transform .16s, box-shadow .16s;
  animation: reveal .5s both;
}

.quote-card::before,
.quote-card::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  pointer-events: none;
}

.quote-card::before { top: -1px; left: -1px; border-top: 2px solid var(--brass); border-left: 2px solid var(--brass); }
.quote-card::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--brass); border-right: 2px solid var(--brass); }

.quote-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }

.quote-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
}

.quote-top .nm {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 14px;
}

.quote-top .code { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }

.quote-price {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: .4rem 0 .3rem;
  line-height: 1.1;
}

.quote-price .pct-chip {
  font-size: 12px;
  font-weight: 600;
  padding: .12rem .4rem;
  margin-left: .4rem;
  vertical-align: 3px;
  border: 1px solid currentColor;
}

.quote-sub {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  border-top: 1px dashed var(--line);
  padding-top: .45rem;
}

.up { color: var(--red); }
.down { color: var(--green); }
.flat { color: var(--ink-3); }

/* ---------- 涨跌分布 ---------- */
.breadth-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: .8rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1rem 1.05rem;
}

.panel-title {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .08em;
  margin: 0 0 .7rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.panel-title .tag { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); font-weight: 400; }

.breadth-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  margin-bottom: .8rem;
}

.bstat {
  border: 1px solid var(--line);
  padding: .5rem .6rem;
  text-align: center;
}

.bstat .v { font-family: var(--font-mono); font-size: 21px; font-weight: 700; line-height: 1.15; }
.bstat .l { font-size: 11.5px; color: var(--ink-3); margin-top: .1rem; }

.bar-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: .38rem 0;
  font-size: 12px;
}

.bar-row .lab { width: 42px; color: var(--ink-2); text-align: right; font-family: var(--font-mono); font-size: 11px; }

.bar-track {
  flex: 1;
  height: 14px;
  background: repeating-linear-gradient(90deg, rgba(35,31,24,.05) 0 1px, transparent 1px 14px), var(--paper-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  transition: width .7s cubic-bezier(.22, .8, .3, 1);
}

.bar-fill.up { background: linear-gradient(90deg, var(--red-2), var(--red)); }
.bar-fill.down { background: linear-gradient(90deg, var(--green-2), var(--green)); }
.bar-fill.flat { background: var(--ink-3); }

.bar-row .cnt { width: 42px; font-family: var(--font-mono); font-size: 11.5px; }

.mini-list { display: grid; gap: .35rem; }

.mini-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px dotted var(--line);
  padding: .28rem 0;
  font-size: 12.5px;
}

.mini-item:last-child { border-bottom: 0; }

.mini-item .nm { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-right: .5rem; }
.mini-item .val { font-family: var(--font-mono); font-weight: 600; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--card);
}

table.data th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .08em;
  border-bottom: 1px solid var(--ink);
  padding: .45rem .55rem;
  white-space: nowrap;
}

table.data td {
  padding: .48rem .55rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data tr:last-child td { border-bottom: 0; }

table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--paper-2); }

table.data .num { font-family: var(--font-mono); text-align: right; }
table.data .nm-cell { font-family: var(--font-serif); font-weight: 700; }
table.data .sub { color: var(--ink-3); font-size: 11px; }

/* ---------- 新闻 ---------- */
.news-list { display: grid; gap: 0; background: var(--card); border: 1px solid var(--line); }

.news-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .4rem 1rem;
  padding: .65rem .8rem;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
  cursor: pointer;
}

.news-item:last-child { border-bottom: 0; }
.news-item:hover { background: var(--paper-2); }
.news-item.sel { background: rgba(192, 57, 43, .07); box-shadow: inset 3px 0 0 var(--red); }
.news-item .sel-tag {
  display: inline-block;
  font-size: 10px;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 999px;
  padding: 0 .3rem;
  margin-left: .35rem;
  vertical-align: middle;
}

.news-item .t { font-size: 13.5px; line-height: 1.45; }
.news-item .t a:hover { color: var(--red); }

.news-item .meta {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  gap: .8rem;
}

.news-item .meta .src { font-family: var(--font-mono); color: var(--brass); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  margin-top: .8rem;
}

.pager-info { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .9rem;
}

.video-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform .12s, box-shadow .12s;
}

.video-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback { font-size: 2rem; color: var(--ink-3); }

.video-body {
  padding: .65rem .75rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex: 1;
}

.video-title {
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  font-size: 11.5px;
  color: var(--ink-3);
}

.video-meta .src { color: var(--brass); font-family: var(--font-mono); }

.gsearch-panel { padding: 1rem 1.1rem; }

.gsearch-row { display: flex; gap: .6rem; }

.gsearch-row input { flex: 1; min-width: 0; }

.gsearch-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .6rem;
  flex-wrap: wrap;
}

/* ---------- 日报页 ---------- */
.report-tabs { margin-bottom: .8rem; }

.report-tabs button { min-height: 48px; }

.report-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .8rem;
}

.report-article {
  max-width: 760px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.2rem 1.2rem 1.4rem;
  font-size: 15px;
  line-height: 1.75;
}

.report-article h1 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin: 0 0 .8rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--line);
}

.report-article h2 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin: 1.1rem 0 .45rem;
  padding-left: .5rem;
  border-left: 3px solid var(--red);
}

.report-article h3 { font-size: .98rem; margin: .9rem 0 .35rem; }
.report-article p { margin: .5em 0; }
.report-article ul, .report-article ol { margin: .45em 0 .55em; padding-left: 1.4em; }
.report-article li { margin: .28em 0; }
.report-article blockquote {
  margin: .8em 0;
  padding: .45rem .8rem;
  border-left: 3px solid var(--brass);
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 13px;
}

.report-toolbar {
  max-width: 760px;
  margin: .8rem auto 0;
  display: flex;
  justify-content: flex-end;
}

/* ---------- 提示条 ---------- */
.notice {
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--brass);
  background: var(--card);
  padding: .7rem .9rem;
  font-size: 12.5px;
  color: var(--ink-2);
}

.notice.warn { border-left-color: var(--red); }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 3px double var(--ink);
  margin-top: 2.2rem;
  padding: 1.2rem 0 2.2rem;
  font-size: 12px;
  color: var(--ink-3);
}

.footer .srcs { font-family: var(--font-mono); font-size: 10.5px; line-height: 2; margin: .4rem 0; }
.footer .disc { color: var(--red-2); font-weight: 600; }

/* ---------- 锁屏 ---------- */
#gate-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(800px 500px at 50% -10%, rgba(192, 57, 43, .10), transparent 60%),
    linear-gradient(90deg, rgba(35, 31, 24, .03) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 64px 64px, auto;
}

#gate-root[hidden] { display: none; }

.gate-card {
  width: min(430px, 100%);
  background: var(--card);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-stamp);
  padding: 2rem 1.9rem 1.8rem;
  position: relative;
  animation: reveal .45s both;
}

.gate-card.error { animation: shake .35s both; }

.gate-seal {
  width: 58px;
  height: 58px;
  border: 2px solid var(--red);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: .1em;
  transform: rotate(-4deg);
  margin-bottom: 1rem;
}

.gate-card h1 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin: 0 0 .35rem;
  letter-spacing: .08em;
}

.gate-card .sub { color: var(--ink-3); font-size: 12.5px; margin: 0 0 1.2rem; line-height: 1.6; }

.gate-hint { font-size: 11.5px; color: var(--ink-3); margin-top: .9rem; line-height: 1.6; }

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--ink-2);
  margin-bottom: .32rem;
}

.field .help { font-size: 11px; color: var(--ink-3); margin-top: .28rem; line-height: 1.5; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: .52rem .6rem;
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 2px rgba(169, 126, 47, .18);
}

textarea { resize: vertical; min-height: 88px; line-height: 1.6; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.radio-row { display: flex; gap: 1.2rem; flex-wrap: wrap; }

.radio-row label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  letter-spacing: 0;
  margin: 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- 设置页 ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: .9rem;
  align-items: start;
}

.setting-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.15rem 1.2rem 1.3rem;
  margin-bottom: .9rem;
}

.setting-card h3 {
  font-family: var(--font-serif);
  margin: 0 0 .15rem;
  font-size: 1.02rem;
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.setting-card .desc { font-size: 12.5px; color: var(--ink-3); margin: 0 0 1rem; line-height: 1.6; }

.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .4rem; }

.key-status { font-size: 12px; margin-top: .5rem; }
.key-status.ok { color: var(--green); }
.key-status.err { color: var(--red); }

/* ---------- 分析页 ---------- */
.analysis-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: .9rem;
  align-items: start;
}

.sector-panel {
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  max-height: calc(100vh - 140px);
  min-height: 420px;
}

.sector-tabs { display: flex; border-bottom: 1px solid var(--line); }

.sector-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  padding: .6rem 0;
  cursor: pointer;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
}

.sector-tabs button.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--red); }

.sector-search {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--card);
  padding: .55rem .7rem;
  font-size: 13px;
}

.sector-search:focus { box-shadow: none; border-bottom-color: var(--brass); }

.sector-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.sector-panel #board-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sector-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .48rem .7rem;
  border-bottom: 1px dotted var(--line);
  cursor: pointer;
  transition: background .1s;
  font-size: 13px;
}

.sector-item:hover { background: var(--paper-2); }
.sector-item.sel { background: rgba(192, 57, 43, .08); }

.sector-item .nm { flex: 1; font-family: var(--font-serif); font-weight: 700; }
.sector-item .pct { font-family: var(--font-mono); font-weight: 600; width: 62px; text-align: right; }
.sector-item .lead { font-size: 11px; color: var(--ink-3); width: 90px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sector-item input[type="checkbox"], .sector-item input[type="radio"] { accent-color: var(--red); width: 14px; height: 14px; }

[hidden] { display: none !important; }

.mode-toggle { display: flex; border-bottom: 1px solid var(--line); }

.mode-toggle button {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  padding: .6rem 0;
  cursor: pointer;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
}

.mode-toggle button.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--red); }

.stock-area { padding: .8rem; display: grid; gap: .6rem; }

.stock-result {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: .7rem .8rem;
  font-size: 13px;
}

.stock-result .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 15px;
}

.stock-result .grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .25rem .5rem;
  margin-top: .45rem;
  font-size: 12px;
  color: var(--ink-2);
}

.stock-result .grid .v { font-family: var(--font-mono); font-weight: 600; }

.ai-panel {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.1rem 1.2rem 1.3rem;
}

.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .5rem 0 1rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--line-2);
  background: var(--paper);
  font-size: 12.5px;
  padding: .28rem .55rem;
  border-radius: 999px;
}

.chip .x {
  cursor: pointer;
  color: var(--red);
  font-weight: 700;
  padding: 0 .1rem;
}

.prompt-type { display: flex; gap: .5rem; flex-wrap: wrap; }

.ptab {
  border: 1px solid var(--line-2);
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  padding: .4rem .75rem;
  cursor: pointer;
  border-radius: 999px;
  color: var(--ink-2);
}

.ptab.active { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.ai-output {
  margin-top: 1rem;
  border: 1px solid var(--line);
  background: var(--paper);
  min-height: 260px;
  padding: 1rem 1.1rem;
  font-size: 14px;
  line-height: 1.75;
  position: relative;
}

.ai-output .placeholder { color: var(--ink-3); font-size: 13px; }

.ai-output .caret::after {
  content: "▍";
  color: var(--red);
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.md h1, .md h2, .md h3 { font-family: var(--font-serif); margin: 1.1em 0 .4em; line-height: 1.3; }
.md h1 { font-size: 1.25rem; border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.md h2 { font-size: 1.08rem; }
.md h3 { font-size: .98rem; }
.md p { margin: .55em 0; }
.md ul, .md ol { margin: .5em 0; padding-left: 1.4em; }
.md li { margin: .25em 0; }
.md strong { font-weight: 800; }
.md blockquote {
  margin: .7em 0;
  padding: .4em .8em;
  border-left: 3px solid var(--brass);
  background: rgba(169, 126, 47, .08);
  color: var(--ink-2);
}
.md code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: rgba(35, 31, 24, .07);
  padding: .08em .35em;
}
.md hr { border: 0; border-top: 1px dashed var(--line-2); margin: 1em 0; }
.md table { border-collapse: collapse; font-size: 12.5px; margin: .6em 0; }
.md table td, .md table th { border: 1px solid var(--line-2); padding: .3em .6em; }

.ai-toolbar { display: flex; gap: .5rem; margin-top: .7rem; flex-wrap: wrap; }

.history-select { max-width: 260px; }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  pointer-events: none;
}

.toast {
  background: var(--black);
  color: var(--paper);
  font-size: 13px;
  padding: .55rem 1rem;
  border-radius: 2px;
  box-shadow: var(--shadow-1);
  animation: toast-in .25s both;
  max-width: min(480px, 90vw);
}

.toast.err { background: var(--red-2); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--line);
  min-height: 76px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- 响应式 ---------- */
@media (max-width: 920px) {
  .breadth-grid, .settings-grid, .analysis-layout { grid-template-columns: 1fr; }
  .sector-panel { height: 460px; max-height: 460px; min-height: 0; }
  .masthead-grid { grid-template-columns: 1fr auto; }
  .mast-meta.right { display: none; }
}

@media (max-width: 620px) {
  .wrap { width: calc(100% - 1.4rem); }
  .topbar-inner { flex-direction: column; align-items: flex-start; gap: .3rem; }
  .nav { width: 100%; flex-wrap: wrap; }
  .nav a { flex: 1 1 auto; min-width: 46px; text-align: center; font-size: 12.5px; padding: .38rem .15rem; }
  .row-2 { grid-template-columns: 1fr; }
  .quote-price { font-size: 20px; }
}
