:root { color-scheme:dark;
  --bg:#0b0f17; --card:#121826; --card2:#182033; --hover:#1c2538; --text:#e8edf5; --muted:#8a94a7; --line:#232c3d;
  --input:#0b0f17; --input-line:#2f3a50; --primary:#4f7cff; --primary-hover:#3d6af0;
  --ok:#3fb950; --bad:#f85149; --warn:#d29922; --side-w:236px; --radius:14px; }
* { box-sizing:border-box; }
body { margin:0; font:14px/1.5 "Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; background:var(--bg); color:var(--text);
  -webkit-font-smoothing:antialiased; }
a { color:#7aa2ff; text-decoration:none; } a:hover { text-decoration:underline; }
h1 { font-size:22px; margin:0 0 12px; display:flex; gap:10px; align-items:center; flex-wrap:wrap; letter-spacing:-.01em; }
h2 { font-size:15px; margin:0 0 12px; display:flex; gap:8px; align-items:center; } h3 { font-size:14px; margin:0 0 6px; }
.ico { flex:none; }

/* ---------- TEST instance banner ---------- */
.test-banner { position:sticky; top:0; z-index:60; padding:7px 12px; text-align:center; font-weight:800; letter-spacing:.06em;
  color:#3d2c00; background:repeating-linear-gradient(45deg,#ffd33d,#ffd33d 14px,#f0b400 14px,#f0b400 28px); }

/* ---------- app shell: side menu + top bar ---------- */
body.app { display:flex; min-height:100vh; flex-direction:column; }
.side { position:fixed; inset:0 auto 0 0; width:var(--side-w); background:#0e1422; border-right:1px solid var(--line);
  display:flex; flex-direction:column; padding:16px 12px; z-index:30; overflow-y:auto; transition:transform .2s; }
.brand { display:flex; align-items:center; gap:10px; padding:6px 8px 18px; color:var(--text) !important; text-decoration:none !important; }
.brand-text { display:flex; flex-direction:column; line-height:1.15; } .brand-text small { color:var(--muted); font-size:12px; }
.nav { display:flex; flex-direction:column; gap:2px; }
.nav-group { font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:#5d687d; padding:14px 10px 6px; }
.nav-item { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:9px; color:#b5bfd0; font-weight:500; }
.nav-item:hover { background:var(--hover); color:var(--text); text-decoration:none; }
.nav-item.active { background:rgba(79,124,255,.14); color:#fff; box-shadow:inset 3px 0 0 var(--primary); }
.nav-item.active .ico { color:#8fb0ff; }
.shell { flex:1; margin-left:var(--side-w); min-width:0; display:flex; flex-direction:column; min-height:100vh; }
.topbar { position:sticky; top:0; z-index:20; height:58px; display:flex; align-items:center; gap:12px; padding:0 24px;
  background:rgba(11,15,23,.82); backdrop-filter:blur(10px); border-bottom:1px solid var(--line); }
.topbar-title { flex:1; font-weight:600; }
.icon-btn { background:none; border:0; color:var(--text); padding:6px; border-radius:8px; cursor:pointer; }
.icon-btn:hover { background:var(--hover); }
.menu-btn { display:none; }
.usermenu { position:relative; }
.usermenu summary { list-style:none; display:flex; align-items:center; gap:10px; cursor:pointer; padding:5px 8px; border-radius:10px; }
.usermenu summary::-webkit-details-marker { display:none; }
.usermenu summary:hover, .usermenu[open] summary { background:var(--hover); }
.avatar { display:grid; place-items:center; width:32px; height:32px; border-radius:50%; font-weight:700; color:#fff;
  background:linear-gradient(135deg,#4f7cff,#8b5cf6); }
.avatar.big { width:52px; height:52px; font-size:20px; }
.who { display:flex; flex-direction:column; line-height:1.15; } .who small { color:var(--muted); font-size:12px; }
.usermenu .menu { position:absolute; right:0; top:calc(100% + 8px); min-width:230px; background:var(--card2); border:1px solid var(--line);
  border-radius:12px; padding:6px; box-shadow:0 18px 40px rgba(0,0,0,.45); }
.usermenu .menu a, .menu-row { display:flex; align-items:center; gap:10px; width:100%; padding:9px 10px; border-radius:8px; color:var(--text);
  background:none; border:0; font:inherit; cursor:pointer; text-align:left; }
.usermenu .menu a:hover, .menu-row:hover { background:var(--hover); text-decoration:none; }
.shell main { width:100%; max-width:1360px; margin:0 auto; padding:24px; flex:1; }
.foot { display:flex; justify-content:space-between; gap:12px; padding:14px 24px; border-top:1px solid var(--line); color:#5d687d; font-size:12px; }
.scrim { display:none; }
@media (max-width:900px) {
  .side { transform:translateX(-100%); box-shadow:0 0 40px rgba(0,0,0,.6); }
  body.side-open .side { transform:none; }
  body.side-open .scrim { display:block; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:25; }
  .shell { margin-left:0; } .menu-btn { display:inline-flex; }
  .topbar { padding:0 12px; } .shell main { padding:16px 12px; } .who { display:none; }
}

/* ---------- plain pages (sign in) ---------- */
body.plain { min-height:100vh; background:radial-gradient(1200px 600px at 50% -10%, rgba(79,124,255,.18), transparent 60%), var(--bg); }
.plain-main { max-width:560px; margin:0 auto; padding:9vh 16px 40px; }
.login-card { max-width:400px; margin:0 auto; padding:28px; }
.login-brand { display:flex; align-items:center; gap:12px; margin-bottom:22px; }
.login-card h1 { font-size:20px; margin-bottom:14px; }
.login-foot { text-align:center; margin-top:18px; }
button.wide, .button.wide { width:100%; padding:10px; margin-top:4px; }
.narrow { max-width:380px; margin:80px auto; }

/* ---------- page pieces ---------- */
.page-head { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:18px; }
.page-head h1 { margin:0; } .page-head p { margin:2px 0 0; }
.section-title { margin:6px 0 10px; color:var(--muted); font-size:13px; text-transform:uppercase; letter-spacing:.06em; }
.tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:14px; margin-bottom:18px; }
.tile { padding:16px 18px; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); color:var(--text);
  transition:border-color .15s, transform .15s; }
.tile:hover { border-color:#3a4766; }
.tile-num { font-size:26px; font-weight:700; line-height:1.1; font-variant-numeric:tabular-nums; min-height:29px; }
.tile-label { color:#c2cad8; font-weight:500; } .tile-sub { color:var(--muted); font-size:12px; margin-top:4px; }
.tile.soon { border-style:dashed; }
.tile.sensitive { border-color:rgba(210,153,34,.4); }
.grid.dash-grid { grid-template-columns:repeat(auto-fit,minmax(360px,1fr)); align-items:start; }
.card-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; } .card-head h2 { margin:0; }
.mini-list { list-style:none; margin:0; padding:0; }
.mini-list li { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; padding:9px 0;
  border-bottom:1px solid var(--line); }
.mini-list li:last-child { border-bottom:0; }
.mini-list li > :first-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mini-right { text-align:right; white-space:nowrap; }
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:18px; margin-bottom:16px; }
.table-wrap { overflow-x:auto; border-radius:var(--radius); border:1px solid var(--line); }
.table-wrap > table.list { border:0; border-radius:0; }
.pill, button, .button { white-space:nowrap; }
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:16px; }
.grid .card { margin-bottom:0; } .grid + .card { margin-top:16px; }
.profile { display:flex; gap:14px; align-items:center; margin-bottom:14px; }
.grid.account-grid { grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); align-items:start; }
.filters { padding:14px 18px; }
.filter-row { display:flex; gap:14px; align-items:flex-end; flex-wrap:wrap; }
.filter-row label { margin:0; min-width:140px; } .filter-row label:last-of-type { flex:1; min-width:180px; }
label { display:block; margin-bottom:12px; font-weight:500; }
input, select { display:block; width:100%; margin-top:4px; padding:8px 10px; border:1px solid var(--input-line); border-radius:6px;
  font:inherit; background:var(--input); color:var(--text); }
input:focus, select:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(59,130,246,.25); }
input::placeholder { color:#6e7681; }
button, .button { display:inline-block; padding:8px 14px; border:1px solid var(--input-line); border-radius:6px; background:var(--card2);
  font:inherit; cursor:pointer; color:var(--text); }
button:hover, .button:hover { background:var(--hover); border-color:#4a5363; text-decoration:none; }
.primary { background:var(--primary); border-color:var(--primary); color:#fff !important; }
.primary:hover { background:var(--primary-hover); border-color:var(--primary-hover); }
table.list { width:100%; border-collapse:collapse; background:var(--card); border:1px solid var(--line); border-radius:10px; overflow:hidden; }
table.list th, table.list td { text-align:left; padding:8px 10px; border-bottom:1px solid var(--line); vertical-align:top; }
table.list tr:last-child td { border-bottom:0; }
table.list th { background:var(--card2); font-weight:600; font-size:12px; text-transform:uppercase; color:var(--muted); }
table.compact th, table.compact td { padding:5px 8px; }
td.detail { max-width:420px; word-break:break-word; color:var(--muted); }
.pager { display:flex; gap:8px; margin-top:12px; }
dl { display:grid; grid-template-columns:130px 1fr; gap:6px 10px; margin:0; } dt { color:var(--muted); } dd { margin:0; word-break:break-word; }
.pill { display:inline-block; padding:1px 8px; border-radius:999px; font-size:12px; font-weight:600; border:1px solid transparent; }
.pill.on { background:rgba(63,185,80,.15); color:#56d364; border-color:rgba(63,185,80,.4); }
.pill.off { background:rgba(139,148,158,.12); color:#9ea7b3; border-color:rgba(139,148,158,.3); }
.pill.bad { background:rgba(248,81,73,.15); color:#ff7b72; border-color:rgba(248,81,73,.4); }
.pill.lvl1 { background:rgba(139,148,158,.12); color:#9ea7b3; border-color:rgba(139,148,158,.3); }
.pill.lvl2 { background:rgba(79,124,255,.15); color:#8fb0ff; border-color:rgba(79,124,255,.4); }
.pill.lvl3 { background:rgba(248,81,73,.15); color:#ff7b72; border-color:rgba(248,81,73,.4); }
.muted { color:var(--muted); } .small { font-size:12px; } .nowrap { white-space:nowrap; }
.flash { padding:10px 14px; border-radius:8px; margin-bottom:14px; border:1px solid transparent; }
.flash.ok { background:rgba(63,185,80,.12); color:#7ee787; border-color:rgba(63,185,80,.4); }
.flash.err { background:rgba(248,81,73,.12); color:#ffa198; border-color:rgba(248,81,73,.4); }
.flash.warn { background:rgba(210,153,34,.15); color:#e3b341; border-color:rgba(210,153,34,.4); }

/* ---------- idle sign-out warning ---------- */
#idle-banner { position:fixed; left:50%; bottom:18px; transform:translateX(-50%); z-index:80; padding:12px 20px;
  border-radius:12px; background:rgba(210,153,34,.97); color:#241a00; font-weight:700; box-shadow:0 12px 32px rgba(0,0,0,.5); }

::-webkit-scrollbar { width:10px; height:10px; } ::-webkit-scrollbar-track { background:var(--bg); }
::-webkit-scrollbar-thumb { background:#30363d; border-radius:5px; } ::-webkit-scrollbar-thumb:hover { background:#484f58; }
