/* IPTView admin panel. System fonts only (font-src 'none'); no inline styles anywhere. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --line: #e1e4ea;
  --text: #16181d;
  --muted: #5f6673;
  --accent: #3355ff;
  --accent-text: #ffffff;
  --danger: #c62f3b;
  --ok: #1d8a4e;
  --warn: #b26a00;
  --off: #6b7280;
  --focus: #3355ff66;
  --shadow: 0 1px 2px #0000000f, 0 8px 24px #0000000d;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1e222b;
    --line: #2a2f3a;
    --text: #e8eaef;
    --muted: #9aa1ae;
    --accent: #6f86ff;
    --accent-text: #0b0d12;
    --danger: #ff6b76;
    --ok: #4cc987;
    --warn: #f0a93b;
    --off: #9aa1ae;
    --focus: #6f86ff66;
    --shadow: 0 1px 2px #00000066, 0 8px 24px #00000040;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 20px; margin: 0; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 8px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
h4 { font-size: 13px; margin: 14px 0 8px; font-weight: 650; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.noscript { padding: 24px; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.brand-sub { font-weight: 500; color: var(--muted); }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(135deg, var(--accent), #9b5cff); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 20px; }

input, select, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 36px; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 550; margin-bottom: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 10px; }
.check input { width: auto; min-height: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px;
  padding: 7px 14px; min-height: 36px; cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-small { min-height: 28px; padding: 3px 10px; font-size: 12px; }
.btn-block { width: 100%; }

.error { color: var(--danger); font-weight: 550; }
.error.is-info { color: var(--muted); font-weight: 500; }

/* Sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { width: 100%; max-width: 380px; }
.signin-card .brand { margin-bottom: 6px; }

/* App shell */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 4px; }
.tab { border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab[aria-selected=true] { background: var(--surface-2); color: var(--text); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-email { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.who-expiry { font-variant-numeric: tabular-nums; }

.notice { margin: 16px 24px 0; padding: 10px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.notice.is-error { border-color: var(--danger); color: var(--danger); }

.panel { padding: 20px 24px 40px; max-width: 1280px; margin: 0 auto; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { width: 260px; }
.toolbar select { width: auto; }
.spacer { flex: 1; }
.row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; align-items: center; }
.grow { flex: 1; min-width: 180px; }
.new-user { margin-bottom: 16px; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: auto; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover, .table tbody tr.clickable:focus-visible { background: var(--surface-2); outline: none; }
.cell-email { font-weight: 600; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 24px; text-align: center; color: var(--muted); margin: 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--danger); }
.pill.off { color: var(--off); }
.tag { font-size: 11px; font-weight: 650; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.op .btn { margin-top: 4px; }

/* Drawer */
.scrim { position: fixed; inset: 0; background: #00000055; z-index: 9; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 10;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0 0 4px; word-break: break-all; }
.drawer-body { overflow: auto; padding: 8px 20px 32px; }
.block { padding: 16px 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.account { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin-bottom: 12px; }
.account dt { color: var(--muted); }
.account dd { margin: 0; }
.reset { margin-top: 6px; }
.reset .check { display: flex; }
.attach { margin-top: 10px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.list li .grow { min-width: 0; }
.list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .none { background: transparent; border-style: dashed; color: var(--muted); justify-content: center; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .who { margin-left: 0; width: 100%; justify-content: space-between; }
  .panel { padding: 16px; }
  .toolbar .search { width: 100%; }
}
