/* ============ ОГАС — общегосударственная автоматизированная система ============ */
/* Тема по умолчанию — тёмная. Светлая включается через data-theme="light" */

:root {
  --accent: #ab68ff;
  --star: #e5322d;
  --radius-pill: 28px;
  --font: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar-w: 260px;
}

:root, :root[data-theme="dark"] {
  --bg: #212121;
  --sidebar: #171717;
  --panel: #2a2a2a;
  --panel-2: #212121;
  --elev: #303030;
  --elev-2: #3a3a3a;
  --hover: rgba(255, 255, 255, .07);
  --hover-strong: rgba(255, 255, 255, .12);
  --text: #ececec;
  --text-dim: #b9b9b9;
  --text-mute: #8b8b8b;
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --code-bg: #0d0d0d;
  --code-text: #e6e6e6;
  --shadow: 0 24px 60px rgba(0, 0, 0, .55);
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --sidebar: #f9f9f9;
  --panel: #ffffff;
  --panel-2: #f9f9f9;
  --elev: #f4f4f4;
  --elev-2: #ececec;
  --hover: rgba(0, 0, 0, .05);
  --hover-strong: rgba(0, 0, 0, .09);
  --text: #0d0d0d;
  --text-dim: #3f3f3f;
  --text-mute: #6e6e6e;
  --border: rgba(0, 0, 0, .1);
  --border-strong: rgba(0, 0, 0, .18);
  --code-bg: #f4f4f4;
  --code-text: #1a1a1a;
  --shadow: 0 24px 60px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: color-mix(in oklch, var(--accent), #fff 25%); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--hover-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.star { color: var(--star); }
.hidden { display: none !important; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; color: var(--text-dim); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* ============================== APP SHELL ============================== */
.app { display: flex; height: 100dvh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--sidebar); display: flex; flex-direction: column;
  border-right: 1px solid transparent; transition: margin-left .25s ease;
}
.app.collapsed .sidebar { margin-left: calc(var(--sidebar-w) * -1); }

.sb-top { padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 4px; }
.brand {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px;
  font-weight: 650; letter-spacing: .16em; font-size: 13px;
}
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: color-mix(in oklch, var(--star) 22%, transparent);
  color: var(--star); font-size: 15px; line-height: 1;
}
.brand small { display: block; letter-spacing: .04em; font-weight: 400; font-size: 10px; color: var(--text-mute); }

.new-chat {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 10px; font-size: 14px; color: var(--text);
  transition: background .15s;
}
.new-chat:hover { background: var(--hover); }
.new-chat .plus { font-size: 17px; color: var(--text-dim); }

.sb-search { position: relative; margin: 2px 0 6px; }
.sb-search input {
  width: 100%; background: var(--hover); border: 1px solid transparent; border-radius: 10px;
  padding: 8px 10px 8px 30px; font-size: 13px; outline: none;
}
.sb-search input:focus { border-color: var(--border-strong); }
.sb-search span { position: absolute; left: 9px; top: 7px; color: var(--text-mute); font-size: 13px; }

.chat-list { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.chat-list h4 {
  margin: 10px 6px 6px; font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-mute);
}
.chat-item {
  display: flex; align-items: center; gap: 6px; padding: 8px 6px 8px 10px;
  border-radius: 10px; font-size: 14px; color: var(--text-dim); cursor: pointer;
  transition: background .12s, color .12s;
}
.chat-item:hover { background: var(--hover); color: var(--text); }
.chat-item.active { background: var(--hover-strong); color: var(--text); }
.chat-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .dots {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  opacity: 0; color: var(--text-mute); flex: 0 0 auto;
}
.chat-item:hover .dots, .chat-item.active .dots { opacity: 1; }
.chat-item .dots:hover { background: var(--hover-strong); color: var(--text); }
.sb-empty { padding: 18px 10px; font-size: 13px; color: var(--text-mute); line-height: 1.5; }

/* profile */
.sb-bottom { padding: 8px; border-top: 1px solid var(--border); position: relative; }
.profile {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: 10px; transition: background .15s; text-align: left;
}
.profile:hover { background: var(--hover); }
.avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
}
.profile .who { min-width: 0; flex: 1; }
.profile .who b { display: block; font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile .who span { font-size: 11px; color: var(--text-mute); }

.menu {
  position: absolute; left: 8px; right: 8px; bottom: 62px; z-index: 60;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 6px; box-shadow: var(--shadow);
  transform-origin: bottom center;
  animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border-radius: 9px; font-size: 14px; color: var(--text); transition: background .12s;
}
.menu button:hover, .menu a:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }
.menu .ic { width: 18px; text-align: center; color: var(--text-dim); }

/* ============================== MAIN ============================== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

.topbar {
  height: 52px; flex: 0 0 52px; display: flex; align-items: center; gap: 6px;
  padding: 0 12px; background: color-mix(in oklch, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.topbar .title {
  font-size: 14px; font-weight: 550; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw;
}
.topbar .grow { flex: 1; }
.topbar .badge {
  font-size: 11px; color: var(--text-mute); border: 1px solid var(--border);
  padding: 4px 9px; border-radius: 999px; letter-spacing: .04em;
}

.thread { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.thread-inner { max-width: 760px; margin: 0 auto; padding: 18px 20px 12px; }

/* empty state */
.hero { height: 100%; display: grid; place-content: center; text-align: center; padding: 40px 20px 90px; }
.hero .big-mark {
  font-size: 40px; color: var(--star); margin-bottom: 14px;
  filter: drop-shadow(0 0 22px color-mix(in oklch, var(--star) 45%, transparent));
}
.hero h1 { margin: 0 0 8px; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.hero p { margin: 0 auto; max-width: 460px; color: var(--text-mute); font-size: 14px; }
.suggests { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 26px; }
.suggests button {
  border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px;
  font-size: 13px; color: var(--text-dim); transition: background .15s, border-color .15s, color .15s;
}
.suggests button:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }

/* messages */
.msg { margin-bottom: 26px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  background: var(--elev); border-radius: 20px; padding: 10px 16px;
  max-width: 78%; white-space: pre-wrap; word-break: break-word;
}
.msg.assistant .body { max-width: 100%; }
.msg .files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }

.think {
  border: 1px solid var(--border); border-radius: 14px; margin-bottom: 14px;
  background: color-mix(in oklch, var(--panel) 55%, transparent); overflow: hidden;
}
.think summary {
  cursor: pointer; list-style: none; padding: 9px 14px; font-size: 13px; color: var(--text-mute);
  display: flex; align-items: center; gap: 8px; user-select: none;
}
.think summary::-webkit-details-marker { display: none; }
.think summary .chev { transition: transform .18s; display: inline-block; font-size: 10px; }
.think[open] summary .chev { transform: rotate(90deg); }
.think .think-body {
  padding: 2px 14px 12px; font-size: 14px; color: var(--text-mute);
  white-space: pre-wrap; border-top: 1px solid var(--border);
  max-height: 420px; overflow: auto;
}
.think.streaming summary { color: var(--accent); }

.actions { display: flex; gap: 2px; margin-top: 8px; }
.actions button {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-mute); font-size: 13px; transition: background .12s, color .12s;
}
.actions button:hover { background: var(--hover); color: var(--text); }

.cursor {
  display: inline-block; width: 8px; height: 17px; vertical-align: -3px;
  background: var(--text); margin-left: 2px; animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* markdown */
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 14px; word-break: break-word; }
.md h1, .md h2, .md h3, .md h4 { margin: 22px 0 10px; line-height: 1.3; font-weight: 600; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3 { font-size: 17px; } .md h4 { font-size: 15px; }
.md ul, .md ol { margin: 0 0 14px; padding-left: 24px; }
.md li { margin: 4px 0; }
.md blockquote {
  margin: 0 0 14px; padding: 2px 0 2px 14px;
  border-left: 3px solid var(--border-strong); color: var(--text-dim);
}
.md hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.md code {
  font-family: var(--mono); font-size: .88em; background: var(--hover);
  padding: 2px 5px; border-radius: 5px;
}
.md pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px;
  margin: 0 0 16px; overflow: hidden;
}
.md pre .pre-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; font-size: 11px; color: var(--text-mute);
  border-bottom: 1px solid var(--border); font-family: var(--mono); letter-spacing: .04em;
}
.md pre .pre-head button { font-size: 11px; color: var(--text-mute); font-family: var(--font); }
.md pre .pre-head button:hover { color: var(--text); }
.md pre code {
  display: block; padding: 14px; background: none; color: var(--code-text);
  font-size: 13.5px; line-height: 1.6; overflow-x: auto; white-space: pre;
}
.md table {
  border-collapse: collapse; margin: 0 0 16px; font-size: 14px; display: block; overflow-x: auto;
}
.md th, .md td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.md th { background: var(--hover); font-weight: 600; }

/* ============================== COMPOSER ============================== */
.composer-wrap {
  padding: 8px 20px 16px;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}
.composer { max-width: 760px; margin: 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  display: flex; align-items: center; gap: 9px; max-width: 300px;
  background: var(--elev); border: 1px solid var(--border); border-radius: 12px;
  padding: 7px 9px 7px 10px; font-size: 12.5px;
}
.chip .fi {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 26px;
  background: color-mix(in oklch, var(--accent) 26%, transparent); color: var(--accent); font-size: 12px;
}
.chip .meta { min-width: 0; }
.chip .meta b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .meta span { color: var(--text-mute); font-size: 11px; }
.chip .x { color: var(--text-mute); padding: 0 2px; font-size: 14px; }
.chip .x:hover { color: var(--text); }
.chip.up .fi { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pill {
  background: var(--elev); border: 1px solid var(--border); border-radius: 26px;
  padding: 8px 8px 8px 8px; display: flex; align-items: flex-end; gap: 6px;
  transition: border-color .15s, box-shadow .15s;
}
.pill:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 12%, transparent); }
.pill textarea {
  flex: 1; background: none; border: 0; outline: none; resize: none;
  padding: 8px 4px; max-height: 200px; line-height: 1.5; font-size: 16px;
}
.pill textarea::placeholder { color: var(--text-mute); }
.pill .round {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center;
  color: var(--text-dim); font-size: 18px; transition: background .15s, color .15s;
}
.pill .round:hover { background: var(--hover-strong); color: var(--text); }
.send {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--text); color: var(--bg); font-size: 15px; transition: opacity .15s, transform .15s;
}
.send:hover { opacity: .85; }
.send:disabled { opacity: .28; cursor: default; }
.send.stop { background: var(--star); color: #fff; }

.under { display: flex; align-items: center; gap: 8px; margin-top: 9px; padding: 0 4px; }
.mode {
  display: flex; gap: 2px; background: var(--elev); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px;
}
.mode button {
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; color: var(--text-mute);
  transition: background .15s, color .15s;
}
.mode button.on { background: var(--hover-strong); color: var(--text); }
.under .hint { margin-left: auto; font-size: 11.5px; color: var(--text-mute); }
.under .toggle-mini {
  font-size: 12px; color: var(--text-mute); padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--border);
}
.under .toggle-mini:hover { color: var(--text); background: var(--hover); }
.under .toggle-mini.on { color: var(--accent); border-color: color-mix(in oklch, var(--accent) 45%, transparent); }

/* ============================== MODALS ============================== */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .55);
  display: grid; place-items: center; padding: 20px; animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }
.dialog {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow); width: 100%; max-width: 720px; max-height: 84vh;
  display: flex; flex-direction: column; overflow: hidden; animation: rise .18s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.dialog.sm { max-width: 420px; }
.dlg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.dlg-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.dlg-body { display: flex; min-height: 0; flex: 1; }
.dlg-nav {
  width: 190px; flex: 0 0 190px; padding: 12px 8px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; background: var(--panel-2);
}
.dlg-nav button {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  font-size: 14px; color: var(--text-dim); text-align: left; transition: background .12s, color .12s;
}
.dlg-nav button:hover { background: var(--hover); color: var(--text); }
.dlg-nav button.on { background: var(--hover-strong); color: var(--text); }
.dlg-pane { flex: 1; min-width: 0; overflow-y: auto; padding: 6px 20px 20px; }

.row {
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row .lbl { font-size: 14px; }
.row .lbl small { display: block; color: var(--text-mute); font-size: 12.5px; margin-top: 2px; }
.row .ctl { flex: 0 0 auto; }
.dlg-pane h4 {
  margin: 20px 0 2px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-mute); font-weight: 600;
}

select, .field {
  background: var(--elev); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 11px; font-size: 14px; outline: none; min-width: 150px;
}
select:focus, .field:focus { border-color: var(--border-strong); }
.btn {
  background: var(--elev); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 15px; font-size: 13.5px; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--hover-strong); }
.btn.primary { background: var(--text); color: var(--bg); border-color: transparent; font-weight: 550; }
.btn.primary:hover { opacity: .87; background: var(--text); }
.btn.danger { color: #ff6b66; border-color: color-mix(in oklch, var(--star) 40%, transparent); }
.btn.danger:hover { background: color-mix(in oklch, var(--star) 16%, transparent); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }

.switch { width: 42px; height: 24px; border-radius: 999px; background: var(--elev-2); position: relative; transition: background .18s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .18s;
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

.swatches { display: flex; gap: 8px; }
.swatches button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; transition: transform .12s; }
.swatches button:hover { transform: scale(1.12); }
.swatches button.on { border-color: var(--text); }

/* ============================== TOASTS ============================== */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow);
  animation: rise .18s ease; max-width: 90vw;
}
.toast.err { border-color: color-mix(in oklch, var(--star) 55%, transparent); }
.toast.ok { border-color: color-mix(in oklch, var(--accent) 55%, transparent); }

/* ============================== LOGIN ============================== */
.login { display: grid; grid-template-columns: 1.15fr 1fr; height: 100dvh; }
.login-left {
  padding: 44px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(700px 480px at 12% 18%, color-mix(in oklch, var(--accent) 20%, transparent), transparent 70%),
    radial-gradient(600px 420px at 78% 82%, color-mix(in oklch, var(--star) 14%, transparent), transparent 70%),
    var(--sidebar);
  border-right: 1px solid var(--border); position: relative; overflow: hidden;
}
.login-left .brand { font-size: 15px; padding: 0; }
.login-left .brand .mark { width: 34px; height: 34px; font-size: 19px; border-radius: 10px; }
.tagline { max-width: 620px; }
.tagline .kicker { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 18px; }
.tagline h2 {
  margin: 0; font-size: clamp(30px, 4.2vw, 52px); line-height: 1.12; font-weight: 600;
  letter-spacing: -.02em; min-height: 2.3em;
}
.tagline h2 .typed { color: var(--text); }
.tagline .dot {
  display: inline-block; width: .5em; height: .5em; border-radius: 50%;
  background: var(--star); vertical-align: .06em; margin-left: .12em;
  animation: pulse 1.15s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in oklch, var(--star) 60%, transparent); }
  50% { transform: scale(1.28); box-shadow: 0 0 22px 4px color-mix(in oklch, var(--star) 40%, transparent); }
}
.login-left footer { font-size: 12px; color: var(--text-mute); line-height: 1.7; }

.login-right { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.login-card { width: 100%; max-width: 340px; }
.login-card h1 { margin: 0 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.login-card > p { margin: 0 0 26px; color: var(--text-mute); font-size: 14px; }
.login-card label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
.login-card input {
  width: 100%; background: var(--elev); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 14%, transparent); }
.login-card .btn.primary { width: 100%; margin-top: 22px; padding: 12px; border-radius: 999px; font-size: 15px; }
.login-card .note { margin-top: 16px; font-size: 12.5px; color: var(--text-mute); text-align: center; }
.login-err { margin-top: 14px; font-size: 13px; color: #ff6b66; min-height: 18px; }

/* ============================== ADMIN ============================== */
.admin { max-width: 1120px; margin: 0 auto; padding: 22px 24px 80px; }
.admin-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-head .brand { padding: 0; }
.admin-head .grow { flex: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tabs button {
  padding: 10px 14px; font-size: 14px; color: var(--text-mute); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-color: var(--accent); }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; margin-bottom: 20px;
}
.card > h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.card > h3 + p { margin: 0 0 16px; font-size: 13px; color: var(--text-mute); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { display: block; font-size: 12px; color: var(--text-mute); margin-bottom: 6px; }
.form-grid .field, .form-grid select { width: 100%; min-width: 0; }
.ig { display: flex; gap: 6px; }
.ig .field { flex: 1; }
.ig .btn { flex: 0 0 auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-mute); font-weight: 600; padding: 0 12px 10px; white-space: nowrap;
}
table.data td { padding: 12px; border-top: 1px solid var(--border); vertical-align: middle; }
table.data tr:hover td { background: var(--hover); }
table.data .num { font-variant-numeric: tabular-nums; }
.tag {
  display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-dim); letter-spacing: .03em;
}
.tag.admin { color: var(--accent); border-color: color-mix(in oklch, var(--accent) 45%, transparent); }
.tag.on { color: #3fd68c; border-color: rgba(63, 214, 140, .45); }
.tag.off { color: #ff8b86; border-color: color-mix(in oklch, var(--star) 45%, transparent); }
.rowacts { display: flex; gap: 6px; flex-wrap: wrap; }
.tasks { display: flex; flex-direction: column; gap: 4px; max-width: 340px; }
.tasks span { font-size: 12px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 30px 8px; text-align: center; color: var(--text-mute); font-size: 13.5px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat span { font-size: 12px; color: var(--text-mute); }
.tbl-scroll { overflow-x: auto; }

/* ============================== RESPONSIVE ============================== */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 40; }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { align-content: center; }
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; box-shadow: var(--shadow);
    border-right: 1px solid var(--border);
  }
  .app:not(.open) .sidebar { margin-left: calc(var(--sidebar-w) * -1); }
  .app.collapsed .sidebar { margin-left: calc(var(--sidebar-w) * -1); }
  .thread-inner, .composer { max-width: 100%; }
  .msg.user .bubble { max-width: 88%; }
  .dlg-body { flex-direction: column; }
  .dlg-nav { width: auto; flex: 0 0 auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .dlg-nav button { white-space: nowrap; }
  .dialog { max-height: 92vh; }
  .admin { padding: 16px 14px 60px; }
  .under { flex-wrap: wrap; }
  .under .hint { display: none; }
}
