:root {
  --bg: #15111d; --panel: #1e1829; --panel2: #241d33; --line: #3a3150; --line2: #2e2640;
  --text: #ece8f5; --muted: #a79fbd; --faint: #8f86a8;
  --accent: #c9b8f2; --accent2: #b8a6e6; --wisteria: #9b8ac4; --deep: #6f5ba7;
  --gold: #d8b25a; --ok: #8fd6a8; --bad: #e58c9a; --pink: #e9b8d0; --warn: #e8c878;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.55 system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent2); text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { padding: 40vh 0 0; text-align: center; color: var(--muted); }

/* 版面：手機是上面一排分頁，電腦是左邊選單 */
.app { max-width: 1280px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 14px 40px; }
.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); }
.brand .nm { font-size: 20px; color: var(--accent); letter-spacing: 2px; }
.brand .en { font-size: 11px; color: var(--faint); letter-spacing: 2px; display: block; }
.status { font-size: 13px; margin: 6px 0 10px; color: var(--ok); }
.status.off { color: var(--bad); }
.me { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.me img { width: 28px; height: 28px; border-radius: 50%; }
.me .who { font-size: 13px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .me .who { display: none; } }
.ghost { background: var(--panel); border: 0.5px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 13px; color: var(--muted); }
.ghost:hover { color: var(--text); }
.picker { display: flex; align-items: center; gap: 10px; background: #211b2d; border: 0.5px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-bottom: 10px; }
.picker img { width: 26px; height: 26px; border-radius: 8px; }
.picker select { flex: 1; min-width: 0; background: transparent; border: none; font-size: 14px; outline: none; }
.picker select option { background: var(--panel); }
.nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 0.5px solid var(--line); scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; background: var(--panel); color: var(--muted); border-radius: 8px; padding: 7px 13px; font-size: 14px; }
.nav a.on { background: #2c2440; color: #e3d6ff; }
.nav a .n { font-size: 11px; background: var(--deep); color: #fff; border-radius: 999px; padding: 0 6px; margin-left: 4px; }
@media (min-width: 900px) {
  .app { padding-top: 22px; }
  .body { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; }
  .nav { flex-direction: column; overflow: visible; border-bottom: none; border-right: 0.5px solid var(--line); padding: 0 12px 0 0; margin: 0; align-self: start; position: sticky; top: 16px; }
  .nav a { padding: 8px 12px; }
}

/* 卡片 */
.cd { background: var(--panel); border: 0.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; min-width: 0; }
.ct { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; color: var(--accent); margin-bottom: 8px; }
.ct small { font-size: 12px; color: var(--faint); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 10px; }
@media (min-width: 700px) { .grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.m { background: var(--panel2); border-radius: 10px; padding: 10px 12px; }
.m b { display: block; font: 500 22px/1.2 var(--mono); }
.m span { font-size: 12px; color: var(--muted); }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 0.5px solid var(--line2); }
.row:first-child { border-top: none; }
.row > :first-child { color: var(--muted); flex: none; }
.row > :last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.mu { color: var(--muted); } .fa { color: var(--faint); font-size: 12px; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .gold { color: var(--gold); } .warn { color: var(--warn); }
.big { font-size: 22px; }
.hint { font-size: 12px; color: var(--faint); margin-top: 6px; }
.empty { color: var(--faint); padding: 8px 0; }
.chip { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #2c2440; color: #d8c8ff; margin: 0 4px 5px 0; }
.chip.off { background: #2a2230; color: var(--faint); text-decoration: line-through; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #3a2a4a; color: var(--pink); margin-right: 6px; white-space: nowrap; vertical-align: 1px; }
.tag.n { background: #2c2440; color: var(--accent); } .tag.y { background: #3a3220; color: var(--warn); } .tag.g { background: #213328; color: var(--ok); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pills button { background: var(--panel); border: 0.5px solid var(--line); color: var(--muted); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.pills button.on { background: var(--accent2); color: #1c1530; border-color: var(--accent2); }
.bar { display: grid; grid-template-columns: minmax(84px, 40%) minmax(0, 1fr) 34px; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0; }
.bar.click { cursor: pointer; }
.bar .lb { color: #c8c0dc; overflow-wrap: anywhere; line-height: 1.3; }
.bar i { display: block; height: 9px; border-radius: 4px; background: var(--wisteria); min-width: 4px; }
.bar.sel i { background: var(--gold); } .bar.sel .lb { color: var(--gold); }
.bar .v { text-align: right; font-family: var(--mono); }
.risk { height: 8px; background: #2c2440; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.risk i { display: block; height: 100%; background: var(--ok); }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 90px; margin-top: 8px; }
.chart div { flex: 1; background: var(--deep); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart div:hover { background: var(--wisteria); }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 4px; }

/* 案件列表 */
.case { display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; border-top: 0.5px solid var(--line2); cursor: pointer; border-radius: 6px; }
.case:first-child { border-top: none; }
.case:hover { background: #231c30; }
.case img, .av { width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--panel2); }
.case .body2 { min-width: 0; flex: 1; }
.case .l1 { overflow-wrap: anywhere; }
.case .l2 { font-size: 12px; color: var(--faint); overflow-wrap: anywhere; }
.more { width: 100%; margin-top: 8px; }
.back { background: none; border: none; color: var(--accent2); padding: 0 0 10px; font-size: 14px; }
.q { border-left: 3px solid #4e4466; padding: 2px 0 2px 10px; color: #d6cfe8; white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; }
.tl { border-left: 2px solid var(--line); margin-left: 4px; padding-left: 12px; }
.tl div { padding: 4px 0; overflow-wrap: anywhere; }
.person { display: flex; align-items: center; gap: 12px; }
.person img { width: 48px; height: 48px; border-radius: 50%; }
.person .nm { font-size: 17px; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; background: var(--panel2); border: 0.5px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; }
.search input:focus { border-color: var(--accent2); }
.err { color: var(--bad); padding: 10px 0; }

/* 終端 */
.term { background: #0d0a13; border: 0.5px solid var(--line); border-radius: 10px; font: 12.5px/1.5 var(--mono); padding: 10px 12px; height: 62vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.term .t { color: #6f6687; }
.term .INFO { color: #cfc7e3; } .term .DEBUG { color: #6f6687; }
.term .WARNING { color: var(--warn); } .term .ERROR, .term .CRITICAL { color: #ff9aa8; }
.term .ln.more { padding-left: 2ch; }
.term .ln.ERROR, .term .ln.CRITICAL { background: #2a1520; }
.termbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.termbar label { font-size: 13px; color: var(--muted); display: flex; gap: 5px; align-items: center; }

/* 登入 */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .box { background: var(--panel); border: 0.5px solid var(--line); border-radius: 16px; padding: 28px 24px; text-align: center; max-width: 340px; width: 100%; }
.login img { width: 84px; height: 84px; border-radius: 50%; border: 1px solid var(--line); }
.login h1 { font-size: 22px; font-weight: 500; color: var(--accent); letter-spacing: 3px; margin: 12px 0 2px; }
.login p { color: var(--muted); font-size: 13px; }
.btn { display: inline-block; background: var(--accent2); color: #1c1530; border-radius: 10px; padding: 10px 22px; font-size: 15px; border: none; margin-top: 8px; }
