:root {
  --bg: #0f1115; --panel: #181b22; --panel2: #1f232c; --line: #2b303b; --text: #e6e8ee; --muted: #9aa3b2;
  --accent: #5865f2; --accent2: #4752c4; --ok: #3ba55d; --warn: #faa61a; --bad: #ed4245; --info: #3498db;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: #8ea1ff; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
h3 { font-size: 15px; margin: 14px 0 8px; }
.boot, .muted { color: var(--muted); }
.small { font-size: 13px; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* layout */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { font-weight: 700; font-size: 17px; padding: 4px 10px 14px; }
.nav a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; margin-bottom: 2px; }
.nav a:hover { background: var(--panel2); }
.nav a.on { background: var(--accent); color: #fff; }
.nav .group { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 14px 10px 4px; }
.main { padding: 22px 28px 60px; min-width: 0; }
.top { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; }
.top .who { display: flex; gap: 10px; align-items: center; color: var(--muted); }
@media (max-width: 800px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .main { padding: 16px; } }

/* widgets */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 28px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
button, .btn { background: var(--accent); color: #fff; border: 0; padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; }
button:hover { background: var(--accent2); }
button.ghost { background: var(--panel2); border: 1px solid var(--line); color: var(--text); }
button.ghost:hover { background: #2a2f3a; }
button.ok { background: var(--ok); } button.bad { background: var(--bad); } button.warn { background: #b87b0b; }
button.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; max-width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; padding: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
textarea { width: 100%; min-height: 90px; resize: vertical; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.help { color: var(--muted); font-size: 13px; margin-top: 3px; }
.field { margin-bottom: 14px; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field.inline label { margin: 0; }
.field input[type=text], .field input[type=number], .field input[type=password], .field select { width: 100%; max-width: 460px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel2); }
.tablewrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel2); border: 1px solid var(--line); }
.badge.pending, .badge.warn { background: #4a3a10; border-color: #6b5316; color: #ffd37a; }
.badge.interview, .badge.info { background: #10304a; border-color: #1b4d77; color: #8fcfff; }
.badge.approved, .badge.active, .badge.open, .badge.ok { background: #123a24; border-color: #1d5a39; color: #8ee6ae; }
.badge.denied, .badge.removed, .badge.closed, .badge.bad { background: #4a1618; border-color: #772226; color: #ff9a9c; }
.badge.expired { color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 6px 12px; border-radius: 8px; background: var(--panel2); color: var(--text); text-decoration: none; border: 1px solid var(--line); }
.tabs a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.answer { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; margin-bottom: 12px; }
.answer b { display: block; color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.permgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px 18px; }
.permgrid label { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.permgrid .g { grid-column: 1 / -1; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-top: 8px; }
.qrow { display: grid; grid-template-columns: 1.4fr 1.6fr 120px 80px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 900px) { .qrow { grid-template-columns: 1fr 1fr; } }
.picker { position: relative; max-width: 460px; }
.picker .results { position: absolute; z-index: 5; left: 0; right: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; max-height: 240px; overflow: auto; }
.picker .results div { padding: 8px 10px; cursor: pointer; } .picker .results div:hover { background: #2a2f3a; }
.picked { display: inline-flex; gap: 8px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; margin-top: 6px; }

/* login */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 400px; }
.login h1 { text-align: center; }
.err { color: #ff9a9c; margin: 8px 0; min-height: 1.2em; }

/* dialog + toasts */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 20; padding: 16px; }
.dialog { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 440px; }
.dialog .pw { font: 17px/1.3 ui-monospace, Menlo, Consolas, monospace; background: var(--panel2); padding: 10px 12px; border-radius: 8px; word-break: break-all; margin: 10px 0; user-select: all; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 8px; max-width: 380px; white-space: pre-wrap; }
.toast.bad { border-left-color: var(--bad); }
a.stat { color: inherit; text-decoration: none; display: block; }
a.stat:hover { border-color: var(--accent); }
