/* Anchor console. Tokens first; dark is the default, light follows the system or the toggle. */
:root {
  --bg: #0b0e14;
  --bg-elev: #11151d;
  --bg-elev-2: #161b25;
  --bg-hover: #1b2130;
  --border: #232a38;
  --border-strong: #2f3849;
  --text: #e6e9ef;
  --text-dim: #9aa3b5;
  --text-faint: #6b7489;
  --accent: #4f8cff;
  --accent-strong: #3a74e6;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --ok: #2fbf71;
  --ok-soft: rgba(47, 191, 113, 0.14);
  --warn: #f0a33a;
  --warn-soft: rgba(240, 163, 58, 0.14);
  --bad: #f05252;
  --bad-soft: rgba(240, 82, 82, 0.14);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 10px;
  --radius-sm: 7px;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --chart-1: #4f8cff;
  --chart-2: #2fbf71;
  --chart-3: #f0a33a;
  --chart-4: #a78bfa;
  --chart-5: #f05252;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-elev: #ffffff;
  --bg-elev-2: #f9fafc;
  --bg-hover: #eef2f8;
  --border: #e3e7ef;
  --border-strong: #d2d8e3;
  --text: #121826;
  --text-dim: #4d5669;
  --text-faint: #8590a6;
  --accent: #2563eb;
  --accent-strong: #1d4fd0;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --ok: #16a05a;
  --ok-soft: rgba(22, 160, 90, 0.1);
  --warn: #c77a0c;
  --warn-soft: rgba(199, 122, 12, 0.12);
  --bad: #dc3545;
  --bad-soft: rgba(220, 53, 69, 0.1);
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, 0.1);
  --shadow: 0 10px 30px rgba(18, 24, 38, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h1.mono { font-size: 19px; }
h3 { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
::selection { background: var(--accent-soft); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg-elev); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; font-weight: 800;
}
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--text-faint); }
.nav-group { margin: 10px 0 4px; padding: 0 10px; font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 500; text-decoration: none;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 17px; height: 17px; flex: none; }
.nav .count { margin-left: auto; font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.me:hover { background: var(--bg-hover); }
.me-name { font-weight: 600; font-size: 13px; }
.me-role { font-size: 11px; color: var(--text-faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--text-dim); min-width: 0; }
.crumbs a { color: var(--text-dim); }
.crumbs .sep { color: var(--text-faint); }
.crumbs .here { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.global-search { position: relative; width: min(380px, 40vw); }
.global-search input[type=search] { width: 100%; padding-left: 32px; padding-right: 30px; }
.global-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--text-faint); }
.global-search .kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }

.page { padding: 24px 28px 60px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head .sub { color: var(--text-dim); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- building blocks ---------- */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { flex: 1; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sep-v { width: 1px; align-self: stretch; background: var(--border); }

.stat { padding: 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.stat .label { color: var(--text-dim); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .label svg { width: 14px; height: 14px; color: var(--text-faint); }
.stat .value { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .delta { font-size: 12px; color: var(--text-faint); }
.stat .spark { position: absolute; right: 0; bottom: 0; width: 55%; height: 44px; opacity: 0.9; }
.stat.link { cursor: pointer; }
.stat.link:hover { border-color: var(--border-strong); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-elev-2);
  font-weight: 550; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text);
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }

input[type=text], input[type=password], input[type=number], input[type=search], input[type=email], select, textarea {
  height: 34px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--bg); outline: none; min-width: 0;
}
textarea { height: auto; padding: 9px 10px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
select { padding-right: 26px; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); font-weight: 550; }
label.field input, label.field select, label.field textarea { font-size: 14px; color: var(--text); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.hint { font-size: 12px; color: var(--text-faint); font-weight: 400; }
.error-text { color: var(--bad); font-size: 12.5px; }

.code-editor {
  font-family: var(--mono); font-size: 12.5px; width: 100%; min-height: 220px; tab-size: 2;
  background: var(--bg); white-space: pre; overflow: auto;
}
.code-editor.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--bg-hover); color: var(--text-dim); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.live { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.chips { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--bg-elev-2); border: 1px solid var(--border); }
.chips button { border: 0; background: transparent; padding: 4px 11px; border-radius: 6px; cursor: pointer; color: var(--text-dim); font-weight: 550; font-size: 12.5px; }
.chips button.on { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 13px; color: var(--text-dim); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { color: var(--text-faint); font-weight: 500; margin-left: 4px; font-size: 12px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th {
  text-align: left; font-size: 11.5px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--bg-elev); position: sticky; top: 0; white-space: nowrap;
}
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--bg-hover); }
table.t td.actions-cell { width: 1%; white-space: nowrap; text-align: right; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 12px; color: #fff; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 52px; height: 52px; font-size: 19px; }
.who .names { min-width: 0; }
.who .primary { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .secondary { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.idchip {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; cursor: pointer; max-width: 100%;
}
.idchip:hover { color: var(--text); border-color: var(--border-strong); }
.idchip svg { width: 12px; height: 12px; flex: none; }
.idchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pager { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--text-dim); font-size: 12.5px; }
.pager .grow { flex: 1; }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 0; }
.kv > div { padding: 9px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.kv .k { color: var(--text-dim); font-size: 13px; }
.kv .v { overflow-wrap: anywhere; }

.empty { padding: 44px 20px; text-align: center; color: var(--text-dim); }
.empty .icon { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--text-faint); }
.empty .title { font-weight: 600; color: var(--text); margin-bottom: 4px; }

.skeleton { background: linear-gradient(90deg, var(--bg-elev-2), var(--bg-hover), var(--bg-elev-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.loading-block { padding: 18px; display: flex; flex-direction: column; gap: 12px; }

.json { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; margin: 0; padding: 12px 14px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); max-height: 520px; overflow: auto; }
.json .k { color: var(--accent); }
.json .s { color: var(--ok); }
.json .n { color: var(--warn); }
.json .b { color: var(--violet); }
.json .z { color: var(--text-faint); }

.bar { height: 6px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }

/* charts */
.chart { width: 100%; height: 190px; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-faint); font-size: 10.5px; font-family: var(--sans); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: 0.13; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }

/* fleet */
.matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.match { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--bg-elev-2); display: flex; flex-direction: column; gap: 8px; }
.match.busy { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.match.private { border-color: color-mix(in srgb, var(--violet) 45%, var(--border)); }
.match .head { display: flex; align-items: center; gap: 8px; }
.match .head .title { font-weight: 650; flex: 1; }
.players { display: flex; flex-wrap: wrap; gap: 4px; }
.player-pill { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--bg-hover); color: var(--text-dim); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-pill.link { cursor: pointer; color: var(--text); }
.player-pill.link:hover { background: var(--accent-soft); color: var(--accent); }
.player-pill.pending { border: 1px dashed var(--border-strong); background: transparent; }
.player-pill.left { opacity: .55; text-decoration: line-through; }

/* overlays */
.overlay { position: fixed; inset: 0; background: rgba(5, 8, 14, 0.62); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); animation: rise .16s; }
.modal.wide { width: min(860px, 100%); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.modal-head { padding: 18px 20px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 11px 14px; border-radius: 10px; background: var(--bg-elev); border: 1px solid var(--border-strong); box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; animation: rise .16s; }
.toast .ico { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok .ico { color: var(--ok); }
.toast.bad .ico { color: var(--bad); }
.toast .msg { flex: 1; }

.menu { position: absolute; z-index: 120; min-width: 200px; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border: 0; background: transparent; border-radius: 7px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--bg-hover); }
.menu button.danger { color: var(--bad); }
.menu svg { width: 15px; height: 15px; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* sign in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 20% -10%, var(--accent-soft), transparent 60%), radial-gradient(700px 400px at 110% 110%, var(--violet-soft), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); padding: 30px; border-radius: 16px; background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.auth-card .brand { padding: 0 0 6px; }
.auth-card .btn { height: 40px; }
.otp { font-family: var(--mono); font-size: 24px !important; letter-spacing: 0.4em; text-align: center; height: 52px !important; }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 220px; height: 220px; margin: 0 auto; }
.qr svg { width: 100%; height: 100%; display: block; }

.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

.list-side { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
.side-list { max-height: calc(100vh - 220px); overflow: auto; }
.side-list button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 9px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; cursor: pointer; text-align: left; }
.side-list button:last-child { border-bottom: 0; }
.side-list button:hover { background: var(--bg-hover); }
.side-list button.on { background: var(--accent-soft); color: var(--accent); }
.side-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.side-list .n { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.detail-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.detail-head .titles { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 5px; }
.detail-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.message { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.message:last-child { border-bottom: 0; }
.message .body { flex: 1; min-width: 0; }
.message .meta { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--text-faint); }
.message .meta b { color: var(--text); font-size: 13px; }
.message .text { margin-top: 2px; overflow-wrap: anywhere; }

.menu-toggle { display: none !important; }

@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .18s; box-shadow: var(--shadow); }
  .shell.nav-open .sidebar { transform: none; }
  .menu-toggle { display: inline-flex !important; }
  .page { padding: 18px 16px 50px; }
  .topbar { padding: 10px 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid, .list-side { grid-template-columns: 1fr; }
  .global-search { width: auto; flex: 1; }
  .kv { grid-template-columns: 120px 1fr; }
}
