:root {
  --bg: #0b1220; --panel: #111b2d; --control: #172338; --line: #26364f;
  --text: #e6eefc; --muted: #93a4bd; --faint: #64748b; --accent: #38bdf8;
  --accent-2: #22d3ee;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --radius: 12px;
  --card-bg: linear-gradient(180deg, rgba(17,25,38,.78), rgba(12,18,28,.82));
  --th-bg: rgba(23,35,56,.45);
  --host-bg: linear-gradient(180deg, var(--panel), transparent);
  --feature-bg: rgba(15,23,35,.45);
}
:root[data-theme="light"] {
  --bg: #f4f7fc; --panel: #ffffff; --control: #eef3fa; --line: #d3deeb;
  --text: #111827; --muted: #40526b; --faint: #566780; --accent: #0284c7;
  --accent-2: #0891b2;
  --ok: #059669; --warn: #b45309; --bad: #dc2626;
  --card-bg: #ffffff;
  --th-bg: #f1f5fb;
  --host-bg: #ffffff;
  --feature-bg: #ffffff;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif; }
body { font-size: 14px; zoom: var(--zoom, 1); }
button, input { font: inherit; }
.boot { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; color: var(--muted); background: radial-gradient(600px 420px at 50% 38%, rgba(56,189,248,.12), transparent 70%), var(--bg); }
.boot-logo { width: 62px; height: 62px; filter: drop-shadow(0 12px 30px rgba(56,189,248,.25)); animation: bootFloat 2.6s ease-in-out infinite; }
.boot-logo svg { width: 100%; height: 100%; }
.boot-title { color: var(--text); font-size: 20px; font-weight: 750; letter-spacing: .01em; }
.boot-title span { color: var(--muted); font-weight: 500; }
.boot-sub { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.boot-dots { display: inline-flex; gap: 4px; }
.boot-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: dotPulse 1.1s ease-in-out infinite; }
.boot-dots i:nth-child(2) { animation-delay: .15s; }
.boot-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bootFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes dotPulse { 0%,100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1.1fr) minmax(360px,.9fr); align-items: center; gap: 7vw; padding: 40px 7vw; background: radial-gradient(circle at 20% 0, #12304a, var(--bg) 55%); }
.login-card { width: min(390px, 100%); justify-self: center; padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 13px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, #38bdf8, #2dd4bf); color: #04121d; font-weight: 800; letter-spacing: .02em; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; }
.login-card input { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--control); color: var(--text); outline: none; }
.login-card input:focus { border-color: var(--accent); }
.login-error { color: var(--bad); font-size: 12px; padding: 8px 10px; border: 1px solid rgba(248,113,113,.3); border-radius: 8px; background: rgba(248,113,113,.08); }
.btn { border: 1px solid var(--line); border-radius: 8px; background: var(--control); color: var(--text); padding: 9px 13px; cursor: pointer; }
.btn.primary { border-color: transparent; background: var(--accent); color: #04121d; font-weight: 700; }
.btn:hover { filter: brightness(1.08); }
.link { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.faint { color: var(--faint); font-size: 11px; line-height: 1.5; }
.shell { min-height: 100vh; display: flex; }
.sidebar { width: 230px; min-height: 100vh; border-right: 1px solid var(--line); background: #091120; display: flex; flex-direction: column; padding: 18px 12px; gap: 18px; position: sticky; top: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.brand-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg,#38bdf8,#2dd4bf); color:#04121d; font-weight:800; font-size:12px; }
.brand strong { display: block; font-size: 14px; }
.brand small { display: block; color: var(--faint); font-size: 8px; letter-spacing: .14em; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { margin: 11px 10px 3px; color: var(--faint); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 0; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-item .icon { width: 15px; height: 15px; opacity: .86; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.chip .dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--ok); margin-right: 5px; box-shadow: 0 0 0 3px rgba(52,211,153,.12); }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.nav-item:hover { background: var(--control); color: var(--text); }
.nav-item.active { background: rgba(56,189,248,.12); color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; color: var(--faint); font-size: 11px; padding: 6px; }
.main { flex: 1; min-width: 0; }
.topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(11,18,32,.86); position: sticky; top: 0; z-index: 2; backdrop-filter: blur(10px); }
.eyebrow { color: var(--faint); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.topbar h1 { margin: 2px 0 0; font-size: 19px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; color: var(--muted); font-size: 10px; }
.view { max-width: 1400px; margin: 0 auto; padding: 26px 28px 60px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.card-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 14px; }
.card-head p { margin: 4px 0 0; color: var(--faint); font-size: 11px; }
.card-body { padding: 14px 16px; }
.stat-value { font-size: 28px; font-weight: 800; margin-top: 8px; }
.stat-label { color: var(--muted); font-size: 11px; }
.stat-note { color: var(--faint); font-size: 10px; margin-top: 6px; }
.toolbar { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar input { flex: 1; max-width: 360px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--control); color: var(--text); outline: none; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
th { color: var(--faint); font-size: 10px; letter-spacing: .04em; font-weight: 600; background: var(--th-bg); }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(56,189,248,.05); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px; font-size: 10px; background: var(--control); color: var(--muted); }
.badge.ok { background: rgba(52,211,153,.12); color: var(--ok); }
.badge.bad { background: rgba(248,113,113,.12); color: var(--bad); }
.badge.warn { background: rgba(251,191,36,.12); color: var(--warn); }
.empty { color: var(--faint); text-align: center; padding: 28px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 10px 16px; color: var(--muted); font-size: 11px; }
.pager button { border: 1px solid var(--line); background: var(--control); color: var(--text); border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.drawer { position: fixed; inset: 0; background: rgba(2,8,20,.6); display: flex; justify-content: flex-end; z-index: 10; }
.drawer-panel { width: min(620px, 100%); height: 100%; overflow: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 22px; position: relative; }
.drawer-close { position: absolute; right: 14px; top: 10px; border: 0; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.drawer h2 { margin: 0 0 4px; }
.member-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.member { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
:root[data-theme="light"] .sidebar { background: #eaf1fa; }
:root[data-theme="light"] .topbar { background: rgba(255,255,255,.88); }
:root[data-theme="light"] .toast { background: #ffffff; }
:root[data-theme="light"] .upgrade-log { background: #f8fafc; color: #334155; }
:root[data-theme="light"] .login { background: radial-gradient(circle at 20% 0, #dbeafe, var(--bg) 55%); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; background: #0f1a2c; box-shadow: 0 12px 40px rgba(0,0,0,.35); z-index: 20; font-size: 12px; }
[hidden] { display: none !important; }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 680px) { .sidebar { width: 64px; padding: 14px 8px; } .brand div, .sidebar-foot span, .nav-item span, .nav-label { display: none; } .view { padding: 18px; } .grid { grid-template-columns: 1fr; } .topbar { padding: 0 18px; } }

.member-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.member-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.btn.tiny { padding: 3px 7px; font-size: 10px; border-radius: 6px; }
.btn.danger { color: var(--bad); border-color: rgba(248,113,113,.3); }
.drawer-actions { margin-top: 12px; display: flex; gap: 7px; }

.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }

.select { padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--control); color: var(--text); font-size: 11px; }

.update-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.update-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.update-row.muted { opacity: .65; }
.update-actions { display: flex; align-items: center; gap: 7px; }
.upgrade-status { margin-top: 12px; padding: 9px 11px; border: 1px solid rgba(56,189,248,.3); border-radius: 8px; background: rgba(56,189,248,.08); color: var(--accent); font-size: 12px; }

.settings-list { display: flex; flex-direction: column; gap: 0; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.settings-row:last-child { border-bottom: 0; }
.settings-row > span:first-child { color: var(--muted); }
.settings-row > span:last-child, .settings-row > div { text-align: right; word-break: break-all; }
.device-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.device { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.drawer-search { border: 0; padding: 10px 0 0; }
.drawer-search input { max-width: none; }

.upgrade-log { margin-top: 10px; max-height: 260px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #07101e; color: #b9c8dd; font-family: ui-monospace, Consolas, monospace; font-size: 10px; line-height: 1.55; white-space: pre-wrap; }

.prefs-panel { position: fixed; right: 22px; top: 66px; z-index: 30; width: 330px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 18px 50px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 9px; }
.prefs-panel strong { font-size: 12px; }
.prefs-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.prefs-row > span { width: 48px; color: var(--faint); font-size: 10px; }
.prefs-row button { border: 1px solid var(--line); border-radius: 6px; background: var(--control); color: var(--muted); padding: 4px 7px; cursor: pointer; font-size: 10px; }
.prefs-row button.active { border-color: var(--accent); color: var(--accent); }

.identity { display: flex; align-items: center; gap: 9px; }
.avatar { width: 28px; height: 28px; flex: none; display: inline-grid; place-items: center; border-radius: 8px; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.skeleton-card, .skeleton-table { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(100deg, var(--panel) 20%, var(--control) 40%, var(--panel) 60%); background-size: 300% 100%; animation: shimmer 1.4s ease infinite; }
.skeleton-card { height: 112px; }
.skeleton-table { height: 300px; margin-top: 14px; }
@keyframes shimmer { to { background-position: -150% 0; } }
.stats-grid .stat-card { position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; right: -20px; bottom: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(56,189,248,.14), transparent 68%); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-index { color: var(--faint); font-size: 9px; letter-spacing: .1em; }
.online-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px; }
.online-main { display: flex; align-items: center; gap: 12px; }
.online-dot { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle, rgba(52,211,153,.38), rgba(52,211,153,.06) 66%); box-shadow: inset 0 0 0 1px rgba(52,211,153,.28); }
.online-value { font-size: 24px; font-weight: 800; margin-top: 3px; }
.dashboard-row { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 12px; margin-top: 12px; }
.chart-card .card-body { padding-top: 18px; }
.chart { height: 150px; display: flex; align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--line); padding: 0 2px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; height: 100%; }
.chart-bar-wrap { width: 100%; flex: 1; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; max-width: 30px; margin: 0 auto; border-radius: 4px 4px 2px 2px; min-height: 4px; opacity: .92; transition: height .3s ease; }
.chart-label { color: var(--faint); font-size: 9px; }
.quick-grid { grid-template-columns: 1fr; gap: 9px; align-content: stretch; }
.quick-card { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 3px 10px; text-align: left; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); cursor: pointer; }
.quick-card:hover { border-color: var(--accent); }
.quick-card strong { font-size: 12px; }
.quick-card span { color: var(--faint); font-size: 10px; }
.quick-card b { grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--accent); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 16px; color: var(--muted); }
.empty-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--faint); font-size: 18px; }
@media (max-width: 1000px) { .dashboard-row { grid-template-columns: 1fr; } .skeleton-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }

.online-card { min-height: 100%; }
.online-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.mini-stats { display: flex; gap: 16px; }
.mini-stats > div { display: flex; flex-direction: column; align-items: flex-end; }
.mini-stats b { font-size: 15px; }
.mini-stats span { color: var(--faint); font-size: 9px; }

.login { position: relative; overflow: hidden; }
.login::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(56,189,248,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(56,189,248,.035) 1px, transparent 1px); background-size: 34px 34px; mask-image: radial-gradient(circle at 50% 45%, #000, transparent 72%); pointer-events: none; }
.login-card { position: relative; backdrop-filter: blur(8px); }
.login-points { display: flex; gap: 6px; flex-wrap: wrap; }
.login-points span { border: 1px solid var(--line); border-radius: 999px; color: var(--faint); font-size: 9px; padding: 3px 7px; letter-spacing: .04em; }
.login-card .btn.primary { margin-top: 4px; padding: 11px; }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(2,7,15,.66); backdrop-filter: blur(4px); }
.modal-card { width: min(440px, 100%); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 28px 80px rgba(0,0,0,.42); padding: 18px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-x { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-message { margin: 11px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; white-space: pre-line; }
.modal-label { display: flex; flex-direction: column; gap: 6px; margin-top: 13px; color: var(--muted); font-size: 11px; }
.modal-input { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--control); color: var(--text); outline: none; }
.modal-input:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.btn.danger { border-color: rgba(248,113,113,.35); color: var(--bad); background: rgba(248,113,113,.08); }
.btn.primary { border-color: transparent; background: var(--accent); color: #04121d; font-weight: 700; }

.login-visual { max-width: 620px; position: relative; z-index: 1; }
.login-eyebrow { color: var(--accent); font-size: 9px; letter-spacing: .18em; margin-bottom: 18px; }
.login-visual h2 { margin: 0; font-size: clamp(34px, 4.6vw, 60px); line-height: 1.08; letter-spacing: -.045em; }
.login-visual h2 span { color: var(--muted); }
.login-visual > p { max-width: 440px; margin: 22px 0 30px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.login-features { display: grid; gap: 9px; max-width: 430px; }
.login-features > div { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--feature-bg); }
.login-features b { color: var(--accent); font-size: 9px; letter-spacing: .08em; }
.login-features span { color: var(--text-2, var(--muted)); font-size: 11px; }
.login-visual-foot { display: flex; align-items: center; gap: 7px; margin-top: 28px; color: var(--faint); font-size: 10px; }
.login-visual-foot .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.icon-btn { width: 31px; height: 31px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--control); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.host-card { margin-top: auto; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--host-bg); }
.host-card-top { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 11px; }
.host-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,.12); }
.host-card small { display: block; margin-top: 4px; color: var(--faint); font-size: 9px; }
.host-bars { display: flex; align-items: flex-end; gap: 3px; height: 18px; margin-top: 8px; }
.host-bars i { flex: 1; border-radius: 2px; background: linear-gradient(180deg, var(--accent), rgba(56,189,248,.15)); }
.host-bars i:nth-child(1) { height: 35%; } .host-bars i:nth-child(2) { height: 62%; } .host-bars i:nth-child(3) { height: 45%; } .host-bars i:nth-child(4) { height: 78%; } .host-bars i:nth-child(5) { height: 55%; } .host-bars i:nth-child(6) { height: 86%; } .host-bars i:nth-child(7) { height: 40%; } .host-bars i:nth-child(8) { height: 68%; }
.sidebar { background: linear-gradient(180deg, rgba(8, 13, 20, .98), rgba(6, 10, 16, .96)); }
.card { background: var(--card-bg); box-shadow: 0 5px 16px -12px rgba(0,0,0,.4); }
.card:hover { border-color: rgba(148,163,184,.2); }
.topbar { background: rgba(6,10,16,.72); }
.btn { transition: border-color .15s ease, filter .15s ease, background .15s ease; }
.btn:hover { border-color: rgba(148,163,184,.3); }
th { position: sticky; top: 0; z-index: 1; backdrop-filter: blur(8px); }
@media (max-width: 980px) { .login-visual { display: none; } .login { grid-template-columns: 1fr; padding: 24px; } }

.snippet { margin: 9px 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--control); color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 10px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
:root[data-theme="light"] .login { background: radial-gradient(circle at 20% 0, #dbeafe, var(--bg) 55%); }
:root[data-theme="light"] .login-card { box-shadow: 0 24px 80px rgba(15,23,42,.12); }
:root[data-theme="light"] .modal { background: rgba(15,23,42,.28); }
:root[data-theme="light"] .card:hover { border-color: rgba(2,132,199,.3); }

:root[data-theme="light"] .btn.primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
:root[data-theme="light"] .btn.primary:hover { color: #fff; }
:root[data-theme="light"] .card { box-shadow: 0 4px 14px -12px rgba(15,23,42,.28); }
:root[data-theme="light"] .card-head { background: rgba(248,250,252,.55); }
:root[data-theme="light"] .history-card .card-body { opacity: .92; }
:root[data-theme="light"] .mono { color: #52637a; }
:root[data-theme="light"] .faint { color: #566780; }
:root[data-theme="light"] th { color: #4b5d75; }
:root[data-theme="light"] .stat-note, :root[data-theme="light"] .card-head p { color: #5b6b82; }
:root[data-theme="light"] .badge { color: #3f5169; }
.history-card { margin-top: 14px; }
.history-card .update-row { background: var(--control); }

.card-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.announcement { margin-top: 14px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--control); }
.announcement-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.announcement p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; white-space: pre-wrap; }
.modal-input[rows] { resize: vertical; min-height: 92px; font: inherit; }

td input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.member-bulk { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding: 8px 9px; border: 1px dashed var(--line); border-radius: 8px; }
.member-bulk span { margin-right: auto; }
.member input[type="checkbox"] { flex: none; }

.message-filters { flex-wrap: wrap; }
.message-filters input { max-width: 220px; }
.message-filters .select { min-width: 110px; }

.update-info { min-width: 0; flex: 1; }
.update-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 4px; }
.update-meta > span { color: var(--faint); font-size: 10px; }
.hash { max-width: 100%; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 9px; word-break: break-all; }
.hash-copy { border: 0; background: transparent; color: var(--accent); font-size: 9px; padding: 0 2px; cursor: pointer; }
.update-actions { flex-wrap: wrap; justify-content: flex-end; }
.message-table { table-layout: fixed; min-width: 760px; }
.message-table .col-sender { width: 15%; }
.message-table .col-recv { width: 14%; }
.message-table .col-content { width: 38%; }
.message-table .col-seq { width: 6%; }
.message-table .col-time { width: 12%; }
.message-table .col-status { width: 7%; }
.message-table .col-actions { width: 8%; }
.message-table td { overflow-wrap: anywhere; }
.message-content { color: var(--text-2, var(--muted)); line-height: 1.55; }
.message-content::before { color: var(--faint); font-family: var(--sans); }
@media (max-width: 900px) {
  .update-row { align-items: flex-start; flex-direction: column; }
  .update-actions { justify-content: flex-start; }
  .message-table { min-width: 0; }
  .message-table thead { display: none; }
  .message-table, .message-table tbody, .message-table tr, .message-table td { display: block; width: 100%; }
  .message-table tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .message-table td { border: 0; padding: 3px 12px; }
  .message-table td::before { content: attr(data-label); display: inline-block; min-width: 52px; color: var(--faint); font-size: 9px; }
  .message-table td[data-label="操作"]::before { display: none; }
  .message-table .row-actions { margin-top: 3px; }
}

.upgrade-status { margin-top: 12px; padding: 0; border: 0; background: transparent; }
.upgrade-progress { border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; background: var(--control); }
.upgrade-progress.bad { border-color: rgba(248,113,113,.35); }
.upgrade-progress.ok { border-color: rgba(52,211,153,.3); }
.upgrade-progress-head { display: flex; align-items: center; gap: 10px; }
.upgrade-indicator { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--accent); font-weight: 800; }
.upgrade-progress.running .upgrade-indicator { border-color: rgba(56,189,248,.35); }
.upgrade-progress.running .upgrade-indicator::before { content: ''; width: 11px; height: 11px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.upgrade-progress.ok .upgrade-indicator { color: var(--ok); border-color: rgba(52,211,153,.35); }
.upgrade-progress.bad .upgrade-indicator { color: var(--bad); border-color: rgba(248,113,113,.35); }
.upgrade-title { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.upgrade-title strong { font-size: 12px; }
.upgrade-title span { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upgrade-track { height: 5px; border-radius: 99px; background: var(--line); margin: 11px 0 8px; overflow: hidden; }
.upgrade-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--ok)); transition: width .35s ease; }
.upgrade-meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--faint); font-size: 9px; }
.upgrade-meta-row .btn { margin-left: auto; }
.upgrade-steps { display: flex; gap: 5px; margin-top: 10px; }
.upgrade-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--faint); font-size: 9px; }
.upgrade-step i { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.upgrade-step.done { color: var(--ok); }
.upgrade-step.done i { background: var(--ok); }
.upgrade-step.current { color: var(--accent); }
.upgrade-step.current i { background: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.12); }
.upgrade-success-hint { color: var(--ok); font-size: 9px; }
@media (max-width: 680px) { .upgrade-steps { display: grid; grid-template-columns: repeat(3,1fr); } .upgrade-title span { white-space: normal; } }

/* Responsive layout pass */
.prefs-panel { width: min(330px, calc(100vw - 24px)); }
@media (max-width: 820px) {
  .topbar { height: auto; min-height: 64px; padding: 10px 14px; gap: 8px; }
  .topbar h1 { font-size: 17px; }
  .eyebrow { font-size: 8px; }
  .topbar-actions { gap: 5px; flex: none; }
  .topbar-actions .chip { display: none; }
  .topbar-actions .btn { padding: 6px 8px; }
  .view { padding: 14px 12px 40px; }
  .card-head { padding: 12px; flex-direction: column; align-items: stretch; gap: 9px; }
  .card-head > div:last-child { width: 100%; }
  .card-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .card-actions .btn { width: 100%; justify-content: center; }
  .toolbar { flex-wrap: wrap; padding: 10px 12px; }
  .toolbar input { max-width: none; width: 100%; flex: 1 1 100%; }
  .table-wrap { overflow: visible; }
  .data-table { min-width: 0; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 0; padding: 3px 12px; text-align: right; }
  .data-table td::before { content: attr(data-label); color: var(--faint); font-size: 9px; font-weight: 500; text-align: left; flex: none; }
  .data-table td[data-label="选择"] { justify-content: flex-start; }
  .data-table td[data-label="选择"]::before { display: none; }
  .data-table td[data-label="用户"], .data-table td[data-label="账号"], .data-table td[data-label="群组"] { justify-content: flex-end; }
  .data-table td[data-label="操作"] { justify-content: flex-end; padding-top: 6px; }
  .data-table .row-actions { justify-content: flex-end; flex-wrap: wrap; }
  .data-table .empty { display: block; text-align: center; }
  .data-table .empty::before { display: none; }
  .pager { flex-wrap: wrap; justify-content: flex-start; }
  .member { flex-wrap: wrap; }
  .member-side { width: 100%; align-items: flex-start; }
  .drawer-panel { width: 100%; padding: 16px; }
  .drawer-actions { flex-wrap: wrap; }
  .modal-card { padding: 15px; }
  .prefs-panel { right: 12px; top: 58px; }
  .sidebar { width: 58px; padding: 12px 7px; }
  .sidebar .host-card { display: none; }
  .sidebar .brand { padding: 0 0 6px; justify-content: center; }
  .sidebar .brand-icon { width: 32px; height: 32px; }
  .sidebar-foot { padding: 4px 0; justify-content: center; }
  .sidebar-foot #admin-name { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-item .icon { width: 17px; height: 17px; }
  .nav-label { display: none; }
  .upgrade-row { gap: 8px; }
}
@media (max-width: 420px) {
  .sidebar { width: 52px; padding: 10px 6px; }
  .topbar h1 { font-size: 16px; }
  .stat-value { font-size: 24px; }
  .online-card { align-items: flex-start; flex-direction: column; }
  .online-meta { align-items: flex-start; }
  .message-table td::before { min-width: 44px; }
}

.group-hero { display: flex; gap: 13px; align-items: flex-start; padding: 2px 0 14px; border-bottom: 1px solid var(--line); }
.group-hero > .avatar { width: 48px; height: 48px; border-radius: 13px; font-size: 16px; }
.group-hero-main { min-width: 0; flex: 1; }
.group-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.group-name-row h2 { margin: 0; }
.group-id-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tiny-link { border: 0; background: transparent; padding: 0; color: var(--accent); font-size: 9px; cursor: pointer; }
.group-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 11px; }
.group-stats span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.group-stats b { color: var(--text); font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.group-stats em { color: var(--faint); font-size: 9px; font-style: normal; }
.group-actionbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 0; }
.action-group { display: flex; align-items: center; gap: 5px; padding-right: 8px; border-right: 1px solid var(--line); }
.action-group.action-end { border-right: 0; margin-left: auto; padding-right: 0; }
.action-group .select { height: 28px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 0; }
.section-title h3 { margin: 0; font-size: 13px; }
.select-all { display: flex; align-items: center; gap: 5px; color: var(--faint); font-size: 10px; }
.member-check { width: 15px; height: 15px; flex: none; accent-color: var(--accent); }
.member-card { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.member-card.owner { border-color: rgba(56,189,248,.22); }
.member-card .avatar { width: 30px; height: 30px; border-radius: 50%; }
.member-main { min-width: 0; }
.member-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.member-name strong { font-size: 12px; }
.member-main .mono { font-size: 9px; overflow: hidden; text-overflow: ellipsis; }
.member-card .member-actions { align-items: center; justify-content: flex-end; }
.member-card .member-actions .btn { padding: 3px 6px; font-size: 9px; }
.bulk-count { margin-left: auto; color: var(--faint); font-size: 9px; }
@media (max-width: 820px) {
  .group-actionbar { gap: 6px; }
  .action-group { border-right: 0; padding-right: 0; }
  .action-group.action-end { margin-left: 0; }
  .member-card { grid-template-columns: auto auto minmax(0,1fr); }
  .member-card .member-actions { grid-column: 2 / -1; justify-content: flex-start; flex-wrap: wrap; }
  .group-stats { gap: 12px; }
}
@media (max-width: 480px) {
  .group-hero > .avatar { width: 40px; height: 40px; font-size: 14px; }
  .group-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .group-stats b { max-width: 130px; }
}

.password-form { display: flex; gap: 8px; flex-wrap: wrap; }
.password-form .input { flex: 1; min-width: 180px; }
@media (max-width: 600px) { .password-form { flex-direction: column; } .password-form .input, .password-form .btn { width: 100%; } }

.upgrade-complete-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.upgrade-countdown { color: var(--muted); font-size: 10px; }

:root[data-accent="teal"] { --accent: #2dd4bf; --accent-2: #22d3ee; }
:root[data-accent="violet"] { --accent: #a78bfa; --accent-2: #818cf8; }
:root[data-accent="amber"] { --accent: #fbbf24; --accent-2: #fb923c; }
:root[data-accent="rose"] { --accent: #fb7185; --accent-2: #f472b6; }
:root[data-theme="light"][data-accent="teal"] { --accent: #0d9488; --accent-2: #0891b2; }
:root[data-theme="light"][data-accent="violet"] { --accent: #7c3aed; --accent-2: #6366f1; }
:root[data-theme="light"][data-accent="amber"] { --accent: #b45309; --accent-2: #d97706; }
:root[data-theme="light"][data-accent="rose"] { --accent: #be123c; --accent-2: #db2777; }

.avatar-img { object-fit: cover; border: 1px solid var(--line); background: var(--control); }
