:root {
  --navy: #0b1c33;
  --navy-2: #12304f;
  --gold: #e8a317;
  --gold-2: #c4890d;
  --bg: #eef2f6;
  --card: #fff;
  --text: #1a2433;
  --muted: #6b7788;
  --line: #dbe3ec;
  --danger: #c0392b;
  --ok: #1e9e62;
}
* { box-sizing: border-box; }
html, body { margin: 0; font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; }
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 20px 16px; }
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 28px; }
.brand.center { justify-content: center; text-align: center; flex-direction: column; }
.brand strong { display: block; }
.brand small { opacity: .7; }
.logo-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--gold); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.logo-mark.lg { width: 56px; height: 56px; font-size: 20px; }
.side nav a { display: block; color: #d5deea; text-decoration: none; padding: 10px 12px; border-radius: 8px; margin-bottom: 4px; }
.side nav a.on, .side nav a:hover { background: var(--navy-2); color: #fff; }
.side-foot { margin-top: auto; }
.tenant-pill { background: var(--navy-2); padding: 6px 10px; border-radius: 999px; font-size: 12px; margin-bottom: 10px; display: inline-block; }
.who { font-size: 13px; margin-bottom: 10px; }
.who span { opacity: .65; font-size: 12px; }
.main { flex: 1; padding: 28px 32px 48px; }
.top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; }
.top h1 { margin: 0; font-size: 26px; }
.plan { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border-radius: 14px; padding: 20px; margin-bottom: 18px; box-shadow: 0 8px 24px rgba(11,28,51,.05); }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card h2 { margin: 0 0 14px; font-size: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stats article { background: var(--card); border-radius: 14px; padding: 18px; }
.stats span { color: var(--muted); font-size: 13px; }
.stats b { display: block; font-size: 28px; margin: 6px 0 2px; }
.stats small { color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.right { text-align: right; }
.btn { display: inline-block; background: var(--navy); color: #fff; border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer; text-decoration: none; font-size: 14px; }
.btn.primary { background: var(--gold); color: var(--navy); font-weight: 700; }
.btn.ghost { background: transparent; border: 1px solid #3d5673; color: #fff; }
.btn.block { display: block; width: 100%; text-align: center; }
.btn.tiny { padding: 4px 8px; font-size: 12px; margin-left: 4px; }
.btn.danger { background: var(--danger); color: #fff; }
.btn:hover { filter: brightness(1.05); }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
label { display: block; margin: 10px 0 6px; font-size: 13px; color: var(--muted); }
.row-form { display: flex; gap: 8px; align-items: center; }
.row-form.wrap { flex-wrap: wrap; }
.row-form input, .row-form select { width: auto; min-width: 160px; }
.stack > * { margin-bottom: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint, .muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); }
.alert { background: #e8f6ee; color: #145c38; padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; }
.alert.err { background: #fdecea; color: #8a1f16; }
.dot { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #eee; font-size: 12px; }
.dot.ok { background: #d6f5e5; color: var(--ok); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.media-item img, .media-item video, .video-ph { width: 100%; height: 130px; object-fit: cover; background: #111; border-radius: 8px; }
.video-ph { display: flex; align-items: center; justify-content: center; color: #fff; letter-spacing: .2em; }
.media-item .meta { padding-top: 8px; font-size: 13px; }
.media-item .meta strong { display: block; word-break: break-all; }
.inline { display: inline-block; }
.inline input[type=number] { width: 70px; padding: 4px; }
.playlist { padding-left: 18px; }
.playlist li { margin-bottom: 8px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: #f3f6fa; padding: 6px 8px; border-radius: 8px; }
.pair-box .code { font-size: 48px; letter-spacing: .25em; font-weight: 800; color: var(--navy); }
.device-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.1fr auto auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--navy), #1b4b73); }
.login-card { width: min(420px, 92vw); background: #fff; padding: 28px; border-radius: 16px; }
.login-card h1 { margin: 8px 0 16px; text-align: center; font-size: 22px; }
code { background: #f3f6fa; padding: 2px 6px; border-radius: 4px; }
.plain { line-height: 1.9; }
@media (max-width: 900px) {
  .shell { display: block; }
  .side { width: auto; }
  .stats, .grid-2, .device-row { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
