:root {
  color-scheme: dark;
  --bg: #0a0e14;
  --panel: #121821;
  --panel-2: #171f2b;
  --border: rgba(255,255,255,.09);
  --text: #e8eef6;
  --muted: #8796a9;
  --accent: #45d6a4;
  --accent-2: #2f8fff;
  --danger: #ff6b7a;
  --warn: #f6c76b;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: radial-gradient(1000px 560px at 20% -10%, #163042 0%, var(--bg) 62%); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
button, input { font: inherit; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.auth-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(430px, 100%); background: rgba(18,24,33,.94); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: 0 30px 100px rgba(0,0,0,.45); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand.small { margin-bottom: 16px; padding: 2px 2px 0; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #061019; font-weight: 900; font-size: 21px; flex: 0 0 auto; }
.brand-title { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 1px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 12px 0; }
.field > span { color: var(--muted); font-size: 11px; }
.field input { height: 40px; border: 1px solid var(--border); border-radius: 10px; background: rgba(0,0,0,.22); color: var(--text); padding: 0 11px; outline: none; }
.field input:focus { border-color: rgba(69,214,164,.6); box-shadow: 0 0 0 3px rgba(69,214,164,.08); }
.btn { border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.04); color: var(--text); padding: 9px 14px; cursor: pointer; transition: .15s; }
.btn:hover { background: rgba(255,255,255,.08); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #34b98b); border-color: transparent; color: #061019; font-weight: 750; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 9px; font-size: 11px; }
.btn.wide { width: 100%; margin-top: 6px; }
.btn.danger { border-color: rgba(255,107,122,.35); color: #ff9aa4; }
.form-error { color: #ff9aa4; background: rgba(255,107,122,.1); border: 1px solid rgba(255,107,122,.22); border-radius: 9px; padding: 8px 10px; font-size: 12px; margin: 10px 0; }
.auth-note { color: var(--muted); font-size: 10.5px; line-height: 1.5; margin: 14px 0 0; }
.qr-wrap { display: flex; justify-content: center; padding: 10px; background: #fff; border-radius: 12px; margin: 10px 0; }
.qr-wrap img { width: 220px; height: 220px; display: block; }
.manual-key { color: var(--muted); font-size: 11px; margin: 6px 0; }
.manual-key summary { cursor: pointer; }
.manual-key code { display: block; margin-top: 6px; padding: 7px; background: rgba(0,0,0,.25); border-radius: 7px; word-break: break-all; color: var(--text); }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex: 0 0 auto; background: rgba(13,18,26,.92); border-right: 1px solid var(--border); padding: 14px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button { text-align: left; border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: 9px 10px; cursor: pointer; }
.nav button:hover { background: rgba(255,255,255,.05); color: var(--text); }
.nav button.active { background: rgba(69,214,164,.1); color: var(--accent); font-weight: 650; }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.host-label { color: var(--muted); font-size: 10px; word-break: break-all; }
.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.topbar h1 { font-size: 19px; margin: 0; letter-spacing: -.02em; }
.top-meta { margin-left: auto; color: var(--muted); font-size: 11px; }
.content { max-width: 1180px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 13px; padding: 14px; }
.card .label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.card .value { margin-top: 4px; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .hint { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.section-title { font-size: 13px; font-weight: 700; margin: 22px 0 9px; display: flex; align-items: center; gap: 10px; }
.section-title .spacer { flex: 1; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 13px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.055); font-size: 12px; vertical-align: middle; }
th { color: var(--muted); font-weight: 550; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.02); }
tr:last-child td { border-bottom: 0; }
td.actions { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 99px; font-size: 10px; background: rgba(255,255,255,.06); color: var(--muted); }
.pill.ok { background: rgba(69,214,164,.1); color: var(--accent); }
.pill.bad { background: rgba(255,107,122,.1); color: var(--danger); }
.pill.warn { background: rgba(246,199,107,.1); color: var(--warn); }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar input { height: 34px; border: 1px solid var(--border); border-radius: 9px; background: rgba(0,0,0,.2); color: var(--text); padding: 0 10px; outline: none; }
.toolbar .btn { padding: 7px 11px; font-size: 11px; }
.empty { color: var(--muted); text-align: center; padding: 26px; font-size: 12px; }
.permission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 7px; margin: 8px 0; }
.permission-grid label { display: flex; align-items: flex-start; gap: 8px; padding: 8px 9px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,.025); font-size: 11px; cursor: pointer; }
.permission-grid input { margin-top: 2px; accent-color: var(--accent); }
.permission-grid span { display: flex; flex-direction: column; gap: 1px; }
.permission-grid small { color: var(--muted); font-size: 9.5px; }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.code { font: 12px ui-monospace, Consolas, monospace; color: var(--accent); background: rgba(69,214,164,.07); padding: 2px 5px; border-radius: 5px; }
.details { color: var(--muted); font-size: 10.5px; word-break: break-word; max-width: 320px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 50; max-width: 360px; padding: 11px 14px; border-radius: 11px; background: #17212c; border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(0,0,0,.4); font-size: 12px; }
.toast.error { border-color: rgba(255,107,122,.4); color: #ffb5bc; }
.toast.ok { border-color: rgba(69,214,164,.4); color: #8ff0d1; }
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
.modal-box { width: min(520px, 100%); background: var(--panel-2); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: 0 30px 100px rgba(0,0,0,.5); }
.modal-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.modal-body { color: var(--muted); font-size: 12px; line-height: 1.55; max-height: 56vh; overflow: auto; }
.modal-body input, .modal-body select, .modal-body textarea { width: 100%; margin-top: 7px; border: 1px solid var(--border); border-radius: 9px; background: rgba(0,0,0,.22); color: var(--text); padding: 8px 9px; outline: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.muted-link { color: var(--accent); text-decoration: none; }
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav button { white-space: nowrap; }
  .sidebar-bottom { flex-direction: row; align-items: center; justify-content: space-between; margin-top: 10px; }
  .main { padding: 16px 13px 30px; }
}
