/* 照 artifacts/style/a.html（样板 A 终端窗格）：深色顶栏，下面四个带标题栏的窗格拼满一屏。颜色全部走变量。 */
:root {
  --bg: #e6eaf0; --pane: #ffffff; --pane-head: #f1f4f8; --line: #ccd4de; --ink: #142033; --muted: #5d6a7c;
  --accent: #b3660a; --accent-soft: #fbefd9; --up: #0c8659; --down: #cc382c; --down-soft: #fbe4e1; --up-soft: #dcf2e9;
  --bar: #142033; --bar-ink: #e6ecf5; --bar-muted: #93a1b8; --sel: #eef3fb;
  --alarm: #b8281d; --alarm-ink: #ffffff; --bar-warn: #f5b04a; --ok-dot: #2fbf8a; --shade: rgba(20, 32, 51, .45); --field: #ffffff;
  --ui: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  --num: "DIN Alternate", "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --bg: #0b111c; --pane: #121a29; --pane-head: #172238; --line: #25334b; --ink: #e2e8f1; --muted: #8a97ac;
    --accent: #f0a63a; --accent-soft: #2b2412; --up: #2fbf8a; --down: #f0645a; --down-soft: #3a1c1c; --up-soft: #123226;
    --bar: #070b13; --sel: #1a2740; --alarm: #a3261c; --shade: rgba(0, 0, 0, .6); --field: #0b111c; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; overflow: hidden; font: 14px/1.5 var(--ui); color: var(--ink); background: var(--bg); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .up { color: var(--up); } .down { color: var(--down); }
kbd { display: inline-block; min-width: 18px; padding: 0 4px; margin-left: 6px; font: 11px/16px var(--ui); text-align: center; color: var(--muted); border: 1px solid var(--line); border-radius: 2px; }

.btn { font: inherit; color: inherit; background: none; border: 1px solid var(--line); border-radius: 2px; padding: 1px 6px 1px 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); color: var(--ink); }
.body:focus { outline: none; }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--ink); color: var(--pane); border-color: var(--ink); padding: 5px 10px 5px 14px; font-weight: 600; }
.btn.primary kbd { color: inherit; border-color: currentColor; opacity: .7; }

/* 顶栏 */
#bar { flex: none; height: 46px; display: flex; align-items: center; gap: 22px; background: var(--bar); color: var(--bar-ink); padding: 0 14px; white-space: nowrap; }
#bar b { font-size: 15px; letter-spacing: .06em; }
#bar span { color: var(--bar-muted); font-size: 12.5px; }
#bar #demo { color: var(--bar-ink); border-left: 1px solid var(--bar-muted); padding-left: 12px; }
#bar .r { margin-left: auto; display: flex; align-items: center; gap: 18px; min-width: 0; }
#bar #health { overflow: hidden; text-overflow: ellipsis; }
#bar #health.ok::before { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--ok-dot); margin-right: 6px; }
#bar #phone { flex: none; }
#bar #phone.warn { color: var(--bar-warn); font-weight: 600; }
#bar.bad #phone.warn { color: var(--alarm-ink); }
#bar #clock { font-family: var(--num); font-variant-numeric: tabular-nums; font-size: 13.5px; min-width: 124px; text-align: right; }
#bar .btn { color: var(--bar-ink); border-color: var(--bar-muted); font-size: 12.5px; padding: 2px 10px; }
#bar.bad { background: var(--alarm); color: var(--alarm-ink); }
#bar.bad span, #bar.bad #demo { color: var(--alarm-ink); border-color: var(--alarm-ink); }
#bar.bad #health { font-size: 15px; font-weight: 700; }
#bar.bad .btn { color: var(--alarm-ink); border-color: var(--alarm-ink); }

/* 四个窗格 */
main { flex: 1; min-height: 0; display: grid; grid-template-columns: 400px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 222px; gap: 8px; padding: 8px; }
.pane { background: var(--pane); border: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pane > h2 { flex: none; margin: 0; height: 32px; display: flex; align-items: center; gap: 12px; padding: 0 12px; font-size: 13px; font-weight: 600; background: var(--pane-head); border-bottom: 1px solid var(--line); white-space: nowrap; }
.pane > h2 > span:first-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pane > h2 .tools { margin-left: auto; flex: none; font-weight: 400; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.pane > h2 .tools.confirm { color: var(--down); font-weight: 600; }
.pane > h2 .tools.confirm kbd { color: var(--down); border-color: var(--down); margin-right: 2px; }
.body { flex: 1; min-height: 0; overflow: auto; }
.empty { padding: 18px 12px; color: var(--muted); font-size: 13px; }

/* 现在要做的 */
.todo { padding: 11px 12px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; cursor: default; }
.todo.l0 { border-left-color: var(--down); background: var(--down-soft); }
.todo.l1 { border-left-color: var(--accent); }
.todo h3 { margin: 0 0 3px; font-size: 15px; display: flex; align-items: baseline; }
.todo h3 small { font-weight: 400; font-size: 12px; margin-left: 8px; color: var(--muted); flex: none; }
.todo h3 .btn { margin-left: auto; flex: none; font-size: 12px; font-weight: 400; color: var(--muted); visibility: hidden; }
.todo.on h3 .btn, .todo:hover h3 .btn { visibility: visible; }
.todo h3 .btn kbd { display: none; }
.todo.on h3 .btn kbd { display: inline-block; }
.todo.on h3 .btn { color: var(--ink); border-color: var(--muted); }
.todo p.confirm { margin-top: 4px; color: var(--down); font-weight: 600; }
.todo p { margin: 0; font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; }

/* 盯着的股票 */
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; background: var(--pane); font-weight: 400; font-size: 12px; color: var(--muted); text-align: right; padding: 7px 12px; box-shadow: inset 0 -1px 0 var(--line); white-space: nowrap; }
td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 15px; white-space: nowrap; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
tbody tr { cursor: default; }
tr.on td { background: var(--sel); }
td small { display: block; font-size: 12px; color: var(--muted); font-family: var(--ui); }
td small.up { color: var(--up); } td small.down { color: var(--down); }
td small.num { font-family: var(--num); }
.code { font-weight: 700; font-size: 16px; }
.warn { color: var(--down); font-weight: 600; }

/* 详情和价位尺 */
.detail { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.detail .line { font-size: 13px; }
.ruler { position: relative; flex: none; height: 62px; margin: 20px 40px 0; }
.ruler .track { position: absolute; left: 0; right: 0; top: 26px; height: 2px; background: var(--line); }
.ruler .zone { position: absolute; top: 20px; height: 14px; }
.ruler .zone.loss { background: var(--down-soft); } .ruler .zone.gain { background: var(--up-soft); }
.ruler .tick { position: absolute; top: 14px; width: 1px; height: 26px; background: var(--muted); }
.ruler .tick span { position: absolute; top: 28px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; color: var(--muted); }
.ruler .now { position: absolute; top: 6px; width: 3px; height: 42px; margin-left: -1px; background: var(--ink); }
.ruler .now span { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 13px; font-weight: 700; }
/* 现价超出尺子两头：夹在边上，换颜色，字靠边排，不画到外面 */
.ruler .now.out-l { background: var(--down); } .ruler .now.out-l span { left: -1px; transform: none; color: var(--down); }
.ruler .now.out-r { background: var(--up); } .ruler .now.out-r span { left: auto; right: -1px; transform: none; color: var(--up); }

/* 提醒记录 */
.log { padding: 4px 0; }
.log div { display: grid; grid-template-columns: 52px 54px 1fr; padding: 4px 12px; font-size: 13px; }
.log.full div { grid-template-columns: 104px 64px 1fr; }
.log b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; }

/* 盖在页面上的窗格 */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: var(--shade); }
.overlay.gate { background: var(--bg); }
.sheet { width: 620px; max-height: 620px; margin: 0; }
.sheet.wide { width: 820px; height: 600px; }
.sheet.narrow { width: 400px; }
.formbody { display: grid; grid-template-columns: 1fr 240px; gap: 0; }
.fields { padding: 14px 16px 4px; display: flex; flex-direction: column; gap: 10px; }
.fields label { display: grid; grid-template-columns: 1fr 150px; align-items: center; font-size: 13px; }
input[type=text], input[type=password] { font: 16px/1.4 var(--num); font-variant-numeric: tabular-nums; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 0; padding: 5px 8px; width: 100%; }
input[readonly] { color: var(--muted); background: var(--pane-head); }
.fields .row { display: grid; grid-template-columns: 1fr 150px; align-items: center; font-size: 13px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; }
.fields .seg label { display: block; position: relative; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 6px 0; font-size: 14px; background: var(--field); border: 1px solid var(--line); }
.seg label + label span { border-left: 0; }
.seg input:checked + span { background: var(--ink); color: var(--pane); border-color: var(--ink); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.calc { border-left: 1px solid var(--line); padding: 14px 16px; }
.calc-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.calc dl { margin: 0; display: grid; grid-template-columns: 64px 1fr; row-gap: 6px; font-size: 13px; align-items: baseline; }
.calc dt { color: var(--muted); } .calc dd { margin: 0; text-align: right; }
.calc dd b { font-size: 18px; }
.calc p { margin: 10px 0 0; font-size: 12px; }
.formfoot { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); min-height: 56px; }
.formfoot .btn { margin-left: auto; flex: none; }
.err { color: var(--down); font-size: 13px; font-weight: 600; }
.gatebody { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.gatebody p { margin: 0; font-size: 13px; }
.gatebody .formfoot { padding: 0; border: 0; min-height: 0; }

/* 成绩单：上面两组汇总并排，下面一张在窗格里滚动的表 */
.sheet.score { width: 1100px; height: 656px; max-height: calc(100% - 32px); }
.score-sum { flex: none; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.grp { min-width: 0; padding: 12px 16px 14px; display: flex; flex-direction: column; }
.grp + .grp { border-left: 1px solid var(--line); }
.ghead { display: flex; align-items: baseline; gap: 14px; font-size: 15px; }
.ghead .rate { font-size: 13px; }
.ghead .rate b { font-size: 22px; line-height: 1; }
.grp p { margin: 2px 0 0; font-size: 13px; }
.ruler.rate { margin: 24px 30px 2px; }
.grp dl { margin: auto 0 0; padding-top: 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 12px; }
.grp dt { font-size: 12px; color: var(--muted); }
.grp dd { margin: 0; font-size: 13px; white-space: nowrap; }
.grp dd b { font-size: 18px; }
#score-rows td { padding: 6px 12px; font-size: 14px; }
#score-rows th:nth-child(3), #score-rows td:nth-child(3) { text-align: left; }
#score-rows .code { font-size: 14px; }
#score-rows tr.dim td { color: var(--muted); }
#score-rows tr.dim .code { font-weight: 400; }

#toast { position: fixed; z-index: 20; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: 720px; padding: 8px 16px; font-size: 13px; background: var(--ink); color: var(--pane); border: 1px solid var(--ink); }
#toast.bad { background: var(--alarm); color: var(--alarm-ink); border-color: var(--alarm); }
