:root {
  --bg: #f4f5f7; --card: #fff; --line: #e6e7eb; --text: #1b1c1f; --text2: #5a5d66; --muted: #8b8f99;
  --brand: #2a78d6; --brand-soft: #e8f1fc; --side: #15171c; --side2: #23262e;
  --good: #1a8f4c; --good-soft: #e6f5ec; --warn: #b57400; --warn-soft: #fdf3dd; --bad: #d23c3b; --bad-soft: #fdeaea;
  --series-1: #2a78d6; --series-cmp: #b9bcc4;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; }
a { color: var(--brand); }

.layout { display: flex; height: 100vh; height: 100dvh; }
.side { width: 220px; flex: none; background: var(--side); color: #cfd2da; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; }
.brand b { color: #fff; font-size: 16px; display: block; }
.brand small { color: #8b8f99; font-size: 12px; display: block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #2a78d6, #6250d6); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
nav { flex: 1; padding: 4px 8px 12px; }
.grp { font-size: 12px; color: #6d717c; padding: 14px 10px 4px; letter-spacing: 1px; }
.nav-i { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: #cfd2da; text-decoration: none; position: relative; }
.nav-i:hover { background: var(--side2); color: #fff; }
.nav-i.on { background: var(--brand); color: #fff; }
.nav-i .ic { width: 20px; text-align: center; }
.badge { margin-left: auto; background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; line-height: 18px; min-width: 18px; text-align: center; }
.side-foot { padding: 12px 16px; font-size: 12px; color: #6d717c; border-top: 1px solid #262931; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 18px; margin: 0; flex: 1; }
.top-act { display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; padding: 0 4px; }
.content { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }
.mask { display: none; }

.card { background: var(--card); border-radius: var(--r); border: 1px solid var(--line); padding: 16px 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h3 .sub { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: auto; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat .k { color: var(--text2); font-size: 13px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.stat .d { color: var(--muted); font-size: 12px; margin-top: 2px; }
.up { color: var(--good); } .down { color: var(--bad); }

a.btn { text-decoration: none; display: inline-block; }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; padding: 6px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { opacity: .9; color: #fff; }
.btn.sm { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.bar .grow { flex: 1; }
input.in, select.in, textarea.in { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #fff; min-width: 0; }
textarea.in { width: 100%; resize: vertical; }
input.in:focus, select.in:focus, textarea.in:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; color: var(--text2); }
.seg button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th, .t td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t th { color: var(--text2); font-weight: 500; background: #fafbfc; position: sticky; top: 0; }
.t td.n, .t th.n { text-align: right; font-variant-numeric: tabular-nums; }
.t tr:hover td { background: #fafbfc; }
.tw { overflow-x: auto; }
.av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; background: #eee; margin-right: 6px; }

.tag { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: 10px; line-height: 20px; background: #eef0f3; color: var(--text2); white-space: nowrap; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.blue { background: var(--brand-soft); color: var(--brand); }

.empty { text-align: center; color: var(--muted); padding: 36px 10px; }
.err { background: var(--bad-soft); color: var(--bad); padding: 12px 14px; border-radius: 10px; }
.loading { color: var(--muted); padding: 30px; text-align: center; }
.loading::before { content: ""; display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; margin-right: 8px; vertical-align: -2px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); } .small { font-size: 12px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--text2); }

/* 提醒 */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: #f7f8fa; cursor: pointer; }
.alert:hover { background: var(--brand-soft); }
.alert .ai { font-size: 18px; line-height: 1.2; }
.alert b { display: block; }
.alert.bad { background: var(--bad-soft); } .alert.warn { background: var(--warn-soft); } .alert.good { background: var(--good-soft); }

/* 图表 */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; pointer-events: none; background: #1b1c1f; color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 8px; opacity: 0; transition: opacity .1s; z-index: 50; white-space: nowrap; }
.tip.show { opacity: .95; }

/* 机位 */
.seat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.seat-grid > .loading, .seat-grid > .empty { grid-column: 1 / -1; }
.seat { border-radius: 10px; padding: 8px; border: 1px solid var(--line); background: #fff; min-height: 66px; cursor: default; }
.seat b { display: block; font-size: 14px; }
.seat .s { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat.on { background: var(--brand-soft); border-color: #b8d3f3; }
.seat.on b { color: var(--brand); }
.seat.fault { background: var(--bad-soft); border-color: #f3c0bf; }
.seat.resv { background: var(--warn-soft); border-color: #f0d9a2; }
.seat .ic { font-size: 11px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.ok { background: var(--good); } .dot.no { background: var(--bad); }

/* 嵌入 */
.embed { width: 100%; height: calc(100vh - 170px); min-height: 480px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }

/* 表单 */
.form-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; margin-bottom: 12px; }
.form-row > label { color: var(--text2); padding-top: 6px; }
.rows .r { display: flex; gap: 8px; margin-bottom: 6px; }
.rows .r .in { flex: 1; }
.qr { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }
.msg { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.msg:last-child { border-bottom: 0; }
.msg .body { flex: 1; min-width: 0; }
.msg.done { opacity: .55; }
.stars { color: #eda100; letter-spacing: 1px; }

.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px); background: #1b1c1f; color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; }
.toast.show { opacity: .95; transform: translateX(-50%); }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .side { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .mask.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .menu-btn { display: block; }
  .top { padding: 12px 14px; }
  .content { padding: 14px 12px 40px; }
  .g2 { grid-template-columns: 1fr; }
  .stat .v { font-size: 22px; }
  .form-row { grid-template-columns: 1fr; gap: 4px; }
  .embed { height: calc(100vh - 150px); }
}
