@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #0a0e14;
  --sidebar: #0b1018;
  --card: #121820;
  --line: rgba(148, 163, 184, 0.12);
  --text: #eef3f8;
  --muted: #8b97ab;
  --cyan: #3ec6ff;
  --blue: #5aa8ff;
  --green: #3ee0a0;
  --amber: #f5b942;
  --orange: #ff8a3d;
  --rose: #ff6b8a;
  --red: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; color-scheme: dark; }
body {
  font-family: Inter, system-ui, Segoe UI, sans-serif;
  background: var(--bg); color: var(--text);
  overflow: hidden; font-size: 13.5px;
}
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
.app { display: flex; height: 100%; }

.sidebar {
  width: 248px; background: linear-gradient(180deg, #0b1119, #090d13);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; flex-shrink: 0;
}
.brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4aa7ff, #1a4d8c 42%, #0b2748 100%);
  display: grid; place-items: center;
  box-shadow: 0 0 0 2px rgba(80,170,255,.25);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand h1 { font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.brand h1 span { display: block; color: #7dd8ff; font-size: 11px; letter-spacing: .18em; }
.brand small { color: #6b778c; font-size: 9px; letter-spacing: .16em; font-weight: 600; }
.user-chip {
  margin: 0 14px 12px; padding: 8px 10px; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 999px;
}
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-chip .meta b { display: block; font-size: 12px; }
.user-chip .meta span { color: var(--muted); font-size: 10.5px; }
.nav { flex: 1; overflow: auto; padding: 6px 10px 16px; }
.nav-label { color: #6b778c; font-size: 10px; font-weight: 700; letter-spacing: .12em; padding: 14px 12px 6px; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 0; background: transparent; color: #c5d0de; border-radius: 8px;
  font-size: 13px; font-weight: 500; text-align: left; position: relative;
}
.nav-item svg { width: 16px; height: 16px; }
.nav-item:hover { background: rgba(255,255,255,.04); }
.nav-item.active { background: rgba(62,198,255,.08); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--cyan); box-shadow: 0 0 10px var(--cyan);
}
.badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center;
}
.sidebar-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); color: #6b778c; font-size: 11px; }
.sidebar-foot .ops { font-weight: 800; letter-spacing: .12em; margin-bottom: 8px; color: var(--muted); }
.sidebar-foot .links { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.sidebar-foot button { background: none; border: 0; color: #6b778c; font-size: 11px; padding: 0; }
.sidebar-foot button:hover { color: var(--cyan); }
.ver { margin-top: 8px; font-size: 10px; letter-spacing: .06em; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #0c1118; }
.topbar {
  height: 58px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; border-bottom: 1px solid var(--line);
}
.net { font-weight: 700; }
.net span { color: var(--muted); font-weight: 500; margin-left: 8px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: #d5deea;
  display: grid; place-items: center; position: relative;
}
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--blue); color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center;
}
.demo-pill {
  border: 1px solid rgba(245,185,66,.35); background: rgba(245,185,66,.1); color: var(--amber);
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; padding: 6px 10px; border-radius: 999px;
}
.role-switch { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.role-switch button {
  border: 1px solid rgba(62,198,255,.35); background: rgba(62,198,255,.1); color: var(--cyan);
  border-radius: 999px; padding: 6px 10px; font-weight: 700; font-size: 11px;
}
.role-switch button.off {
  border-color: var(--line); background: transparent; color: var(--muted);
}

.content { flex: 1; overflow: auto; padding: 8px 24px 40px; }

.subtabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.subtab {
  background: none; border: 0; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 12px 0 10px; position: relative;
}
.subtab.on { color: #fff; }
.subtab.on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
}

.stats { display: flex; gap: 28px; margin: 8px 0 16px; }
.stats div { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.stats b { display: block; color: #fff; font-size: 22px; letter-spacing: 0; font-weight: 800; margin-bottom: 2px; }
.stats .ews-stat b { color: var(--amber); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.search {
  flex: 1; background: #101722; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 10px 12px; outline: none;
}
.sort {
  background: #101722; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 10px 12px;
}
.hint {
  font-size: 12.5px; color: var(--muted);
  background: rgba(62,198,255,.06); border: 1px dashed rgba(62,198,255,.25);
  padding: 10px 12px; border-radius: 10px; margin-bottom: 12px;
}

table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11px; letter-spacing: .08em; font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.staff-row { cursor: pointer; }
tr.staff-row:hover td { background: rgba(255,255,255,.02); }

.who { display: flex; align-items: center; gap: 10px; }
.who .nm { font-weight: 600; }
.who .sub { color: var(--muted); font-size: 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag {
  display: inline-flex; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; letter-spacing: .03em;
}
.tag.sworn { background: rgba(90,168,255,.16); color: var(--blue); }
.tag.civ { background: rgba(148,163,184,.16); color: var(--muted); }
.tag.ok { background: rgba(62,224,160,.14); color: var(--green); }
.tag.admin { background: rgba(255,138,61,.16); color: var(--orange); }
.tag.ews { background: rgba(245,185,66,.16); color: var(--amber); }
.tag.risk { background: rgba(255,107,138,.16); color: var(--rose); }
.tag.warn { background: rgba(255,138,61,.16); color: var(--orange); }

.perm { font-weight: 800; font-size: 11px; letter-spacing: .06em; }
.perm.master { color: var(--green); }
.perm.sup { color: var(--blue); }
.perm.off { color: var(--muted); }

.kebab {
  width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted);
  font-size: 18px; border-radius: 8px;
}
.kebab:hover { background: rgba(255,255,255,.05); color: #fff; }

.bar { height: 6px; background: rgba(255,255,255,.06); border-radius: 99px; overflow: hidden; width: 72px; display: inline-block; vertical-align: middle; margin-left: 8px; }
.bar > span { display: block; height: 100%; }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.62); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 24px;
}
.overlay.show { display: flex; }
.modal {
  width: min(760px, 100%); max-height: 90vh; overflow: auto;
  background: #151c26; border: 1px solid rgba(148,163,184,.2); border-radius: 12px; padding: 20px;
}
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h3 { font-size: 20px; }
.mtabs { display: flex; gap: 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.mtab { background: none; border: 0; color: var(--muted); font-weight: 700; padding: 8px 0; }
.mtab.on { color: #fff; box-shadow: inset 0 -2px 0 var(--cyan); }
.form { display: grid; gap: 10px; }
label { font-size: 12px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%; background: #0e141c; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 10px; outline: none;
}
input[type="checkbox"] { width: auto; accent-color: var(--cyan); }
textarea { min-height: 80px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn {
  border: 1px solid var(--line); background: #1a2330; color: var(--text);
  border-radius: 8px; padding: 8px 12px; font-weight: 600; font-size: 12.5px;
}
.btn.primary { background: linear-gradient(180deg, #5ad0ff, #2bb4ee); color: #06202b; border: 0; }
.btn.amber { background: linear-gradient(180deg, #ffd36b, #f5b942); color: #1a1204; border: 0; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.banner {
  border-radius: 10px; padding: 12px; margin-bottom: 12px; border: 1px solid var(--line); background: #1a2230;
}
.banner.legal { border-color: rgba(183,148,246,.3); background: rgba(183,148,246,.08); }
.banner.conf { border-color: rgba(255,138,61,.35); background: rgba(255,138,61,.08); }
.banner.warn { border-color: rgba(245,185,66,.3); background: rgba(245,185,66,.08); }
.banner h4 { font-size: 13px; margin-bottom: 4px; }
.banner p { color: var(--muted); font-size: 12.5px; }

.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.step { flex: 1; min-width: 110px; background: #101722; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 11px; color: var(--muted); }
.step b { display: block; color: #fff; font-size: 12px; }
.step.done { border-color: rgba(62,224,160,.35); }
.step.now { border-color: rgba(245,185,66,.55); }
.timeline { border-left: 2px solid var(--line); margin-left: 10px; padding-left: 14px; }
.tl { padding: 0 0 12px; position: relative; }
.tl::before { content: ""; position: absolute; left: -19px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.tl .d { color: #6b778c; font-size: 11.5px; }
.letter { background: #f7f4ea; color: #1b1b1b; border-radius: 8px; padding: 18px; font-family: Georgia, serif; line-height: 1.5; }
.letter .conf-stamp { float: right; border: 2px solid #b45309; color: #b45309; font-family: Inter, sans-serif; font-weight: 800; letter-spacing: .1em; padding: 4px 8px; transform: rotate(-8deg); font-size: 11px; }

.menu {
  position: fixed; z-index: 60; min-width: 220px; background: #1a2330; border: 1px solid var(--line);
  border-radius: 10px; padding: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.menu button {
  width: 100%; text-align: left; background: none; border: 0; color: var(--text);
  padding: 8px 10px; border-radius: 6px; font-size: 13px;
}
.menu button:hover { background: rgba(255,255,255,.05); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu .dim { color: var(--muted); font-size: 11px; padding: 6px 10px; }

.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 80; background: #1a2433;
  border: 1px solid var(--line); padding: 12px 14px; border-radius: 10px; display: none; min-width: 240px;
}
.toast.show { display: block; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.switch { display: flex; align-items: center; gap: 8px; }

.manual-step { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.manual-n { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(62,198,255,.12); color: var(--cyan); font-weight: 800; }
.cite { color: var(--amber); font-size: 11px; font-weight: 700; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .ews-col { display: none; }
}
