:root {
  --bg: #f6f7f9; --panel: #ffffff; --line: #e3e6eb; --text: #14181f; --muted: #667085;
  --accent: #2f6fed; --up: #11875d; --down: #d23c3c; --warn: #b7791f; --band: 47,111,237;
  --chip: #eef1f6; --shadow: 0 1px 2px rgba(16,24,40,.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1117; --panel: #151b23; --line: #263040; --text: #e6edf3; --muted: #8b98a9;
    --accent: #5b8def; --up: #3fb47c; --down: #f16d6d; --warn: #e0a83c; --band: 91,141,239;
    --chip: #1d2633; --shadow: none; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
code { font-family: var(--mono); font-size: 12px; background: var(--chip); padding: 1px 5px; border-radius: 4px; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 15px; margin: 0 0 10px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 16px; }
.logo { color: var(--up); }
.clock { flex: 1; color: var(--muted); font-size: 13px; }
.clock b.open { color: var(--up); } .clock b.closed { color: var(--down); }
.mode { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mode button { border: 0; border-radius: 0; background: transparent; padding: 6px 14px; }
.mode button.on { background: var(--accent); color: #fff; }
.banner { background: rgba(var(--band), .12); color: var(--text); padding: 7px 18px; font-size: 13px;
  border-bottom: 1px solid var(--line); }
.banner[hidden] { display: none; }

.shell { display: grid; grid-template-columns: 190px 1fr; min-height: calc(100vh - 90px); }
.side { padding: 14px 10px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.side a { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: 7px; }
.side a:hover { background: var(--chip); }
.side a.on { background: var(--accent); color: #fff; }
main { padding: 20px 24px 40px; min-width: 0; max-width: 1300px; }
.view { display: none; } .view.on { display: block; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px;
  margin-bottom: 14px; box-shadow: var(--shadow); min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.grid2 > .card { margin-bottom: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.row h1, .row h2 { margin: 0; }

.form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form label.check { flex-direction: row; align-items: center; padding-bottom: 8px; }
.inline { display: flex; gap: 6px; flex-wrap: wrap; }
input, select, button { font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; }
input:focus, select:focus { outline: 2px solid rgba(var(--band), .45); outline-offset: 0; }
button { cursor: pointer; background: var(--chip); }
button:hover { filter: brightness(.97); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.ghost { background: transparent; }
button.yes { background: var(--up); color: #fff; border-color: var(--up); }
button.no { background: transparent; color: var(--down); border-color: var(--down); }
button:disabled { opacity: .55; cursor: progress; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12px; margin-top: 24px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; cursor: default; }
th.sort { cursor: pointer; } th.sort:hover { color: var(--text); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--chip); }
.tablewrap { overflow-x: auto; }
.up { color: var(--up); } .down { color: var(--down); } .warn { color: var(--warn); }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 1px 8px; font-size: 11px; margin: 1px 2px 1px 0; }
.chip.hot { background: rgba(210,60,60,.15); color: var(--down); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.kpi { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.kpi .l { color: var(--muted); font-size: 12px; } .kpi .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.status { display: inline-block; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--chip); }
.status.good { background: rgba(17,135,93,.15); color: var(--up); }
.status.bad { background: rgba(210,60,60,.15); color: var(--down); }
.status.wait { background: rgba(183,121,31,.15); color: var(--warn); }
.note { color: var(--muted); font-size: 12px; margin-top: 8px; }
.err { color: var(--down); background: rgba(210,60,60,.08); border-radius: 7px; padding: 8px 10px; margin-top: 10px; white-space: pre-wrap; }
.out { margin-top: 12px; }

.chart { width: 100%; height: 260px; margin-top: 12px; position: relative; }
.chart.tall { height: 340px; }
.chart:empty { display: none; }
.chart svg { width: 100%; height: 100%; display: block; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; font: 11px/1.4 var(--mono); box-shadow: 0 4px 12px rgba(0,0,0,.12); white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 5px; }

.bar3 { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin: 10px 0 4px; font-size: 12px; color: #fff; font-weight: 600; }
.bar3 div { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; }

.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; flex-wrap: wrap; }
.steps li { padding: 5px 12px; border-radius: 999px; background: var(--chip); color: var(--muted); font-size: 12px; }
.steps li.done { background: rgba(17,135,93,.15); color: var(--up); }
.num { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
  align-items: center; justify-content: center; font-size: 12px; margin-right: 6px; }

.ticket { font-family: var(--mono); font-size: 12.5px; background: var(--chip); border-radius: 8px; padding: 12px; white-space: pre-wrap; margin: 10px 0; }
.news-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: 0; }
.news-item .meta { color: var(--muted); font-size: 12px; }
.news-item a { color: var(--text); font-weight: 500; text-decoration: none; }
.news-item a:hover { text-decoration: underline; }

.cfg { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.cfg label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.cfg label.check { flex-direction: row; align-items: center; gap: 8px; }
.cfg .full { grid-column: 1 / -1; }

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: s .8s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes s { to { transform: rotate(360deg); } }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 9px 16px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: .95; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .side a { white-space: nowrap; }
  .grid2 { grid-template-columns: 1fr; }
  main { padding: 16px; }
  .clock { display: none; }
}
a.rh { display: inline-block; background: var(--up); color: #fff; text-decoration: none; font-weight: 600;
  padding: 8px 14px; border-radius: 7px; }
a.rh:hover { filter: brightness(.95); }

.review { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; }
.review summary { cursor: pointer; }
.review p { margin: 6px 0; }
.review ul { margin: 4px 0 6px; padding-left: 18px; }

.chatfab { position: fixed; right: 18px; bottom: 18px; z-index: 20; background: var(--accent); color: #fff; border: 0;
  border-radius: 999px; padding: 11px 16px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.chatpanel { position: fixed; right: 0; top: 0; bottom: 0; width: min(440px, 100vw); z-index: 30; background: var(--panel);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: -6px 0 24px rgba(0,0,0,.12); }
.chatpanel[hidden] { display: none; }
.chathead { padding: 12px 14px; border-bottom: 1px solid var(--line); margin: 0; }
.chatlog { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chatmsg { padding: 9px 12px; border-radius: 10px; max-width: 92%; line-height: 1.45; font-size: 13.5px; overflow-wrap: anywhere; }
.chatmsg.me { align-self: flex-end; background: var(--accent); color: #fff; white-space: pre-wrap; }
.chatmsg.bot { align-self: flex-start; background: var(--chip); }
.chatmsg.bot ul { margin: 4px 0; padding-left: 18px; }
.chatmsg.bot p { margin: 4px 0; }
.chatmsg .src { margin-top: 6px; font-size: 11px; }
.chatsugg { display: flex; flex-wrap: wrap; gap: 6px; }
.chatsugg button { font-size: 12px; padding: 5px 9px; border-radius: 999px; }
.chatform { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.chatform textarea { flex: 1; resize: none; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.chatfoot { padding: 0 14px 10px; }

button.buy { background: #c2410c; color: #fff; border-color: #c2410c; font-weight: 600; margin-right: 8px; }
.banner.live { background: rgba(194,65,12,.14); color: #c2410c; font-weight: 600; border-radius: 8px; margin-bottom: 10px; border: 0; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: #c2410c; }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }

.shortlist { border-color: var(--up); }

button.ticketbtn { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; margin-right: 6px; }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; overflow-y: auto; }
.modal .mbody { width: min(480px, 100%); margin: 0; }
.modal h3 { font-size: 14px; margin: 16px 0 6px; }
.trow { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 4px 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.trow .tv { font-size: 16px; font-variant-numeric: tabular-nums; }
.trow .tn { grid-column: 1 / -1; }

.shortrow { margin: 4px 0; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.shortrow:hover { background: var(--chip); }
.card.flash { outline: 3px solid var(--accent); transition: outline .3s; }

.recheck { margin-top: 8px; padding: 7px 10px; border-radius: 7px; background: rgba(17,135,93,.10); color: var(--up); font-size: 13px; }
.reasoncell { display: block; white-space: normal; min-width: 260px; max-width: 420px; }

.claude-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; vertical-align: middle; white-space: nowrap; border: 1px solid; }
.cb-good { color: var(--up); border-color: var(--up); background: rgba(17,135,93,.10); }
.cb-pass { color: var(--down); border-color: var(--down); background: rgba(210,60,60,.08); }
.cb-red { color: #c2410c; border-color: #c2410c; background: rgba(194,65,12,.10); }

.histline { margin-top: 8px; padding: 8px 10px; border-radius: 7px; background: var(--chip); font-size: 13px; }

.earnbox { margin-top: 10px; padding: 9px 11px; border-radius: 8px; border: 1px dashed var(--line); font-size: 13px; }
.earnbox p { margin: 5px 0; }
