/* GAZISIBER Signal Bot — panel design system.
   Dark, Ötüken-aligned tokens, no external fonts, CSP-safe (no inline styles). */
:root {
  --bg: #0e0e11;
  --bg-elevated: #131317;
  --surface: #1f1f25;
  --surface-2: #26262d;
  --surface-3: #2f2f38;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-1: #f1f1f4;
  --text-2: #a7a7b3;
  --text-3: #9a9aa5;
  --blue: #2f80ed;
  --blue-soft: #61a3ff;
  --blue-dim: rgba(47, 128, 237, 0.14);
  --red: #e5484d;
  --red-soft: #ff9a9d;
  --yellow: #eab308;
  --yellow-soft: #f4cf70;
  --green: #3ecf8e;
  --green-soft: #86e9bd;
  --ok: var(--green);
  --warn: var(--yellow);
  --danger: var(--red);
  --focus: #7ab7ff;
  --radius-sm: 8px;
  --radius: 11px;
  --radius-lg: 16px;
  --shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.8);
  --sidebar-w: 238px;
  --topbar-h: 62px;
  --content-w: 1240px;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text-1);
  background:
    radial-gradient(1100px 520px at 8% -10%, rgba(255, 255, 255, 0.045), transparent 62%),
    radial-gradient(1000px 620px at 54% 4%, rgba(62, 132, 244, 0.06), transparent 65%),
    radial-gradient(900px 480px at 96% 108%, rgba(255, 255, 255, 0.025), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: rgba(47, 128, 237, 0.38); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--blue); color: #fff; padding: 10px 14px; border-radius: 10px;
  text-decoration: none; transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px 14px;
  background: rgba(19, 19, 23, 0.86);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 8px; text-decoration: none; color: var(--text-1); }
.brand-logo { border-radius: 9px; }
.brand-word { display: flex; flex-direction: column; font-weight: 800; letter-spacing: 0.14em; font-size: 0.84rem; line-height: 1.15; }
.brand-word span { color: var(--text-3); font-size: 0.66rem; letter-spacing: 0.12em; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; flex: 1; padding-right: 2px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-heading { margin: 0 0 4px; padding: 0 10px; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-3); font-weight: 700; }
.nav-link {
  display: flex; align-items: center; gap: 9px; min-height: 38px;
  padding: 8px 10px; border-radius: 9px; color: var(--text-2);
  text-decoration: none; font-size: 0.89rem; font-weight: 500;
  border: 1px solid transparent; transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.nav-link .icon { width: 17px; height: 17px; color: var(--text-3); }
.nav-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-1); }
.nav-link.active { background: var(--blue-dim); color: var(--text-1); border-color: rgba(94, 156, 255, 0.2); }
.nav-link.active .icon { color: var(--blue-soft); }
.nav-link.is-disabled { cursor: default; color: var(--text-3); opacity: 0.72; }
.nav-link.is-disabled:hover { background: none; color: var(--text-3); }
.nav-link.is-disabled .pill { margin-left: auto; }
.pill {
  display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); color: var(--text-3);
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
}
.sidebar-footer { display: flex; flex-direction: column; gap: 9px; padding-top: 12px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 9px; padding: 2px 4px; min-width: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  display: grid; place-items: center; background: #e2e2e6; color: #1c1c20;
  font-size: 0.76rem; font-weight: 800; letter-spacing: 0.02em;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-meta strong { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--text-3); font-size: 0.68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-form { margin: 0; }
.build-version { color: var(--text-3); font-size: 0.66rem; padding: 0 4px; letter-spacing: 0.05em; }
.nav-overlay { display: none; }
body.nav-lock { overflow: hidden; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  min-height: var(--topbar-h); position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 26px; border-bottom: 1px solid var(--border);
  background: rgba(14, 14, 17, 0.82); backdrop-filter: blur(10px);
}
.icon-btn.menu-toggle { display: none; }
.topbar-head { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.topbar-eyebrow { color: var(--text-3); font-size: 0.64rem; letter-spacing: 0.13em; text-transform: uppercase; font-weight: 700; }
.topbar-title { margin: 0; font-size: 1.08rem; font-weight: 700; letter-spacing: 0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.status-group { display: flex; align-items: center; gap: 12px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255, 255, 255, 0.025); }
.status-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.status-dot .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04); }
.status-dot.ok .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.12); }
.status-dot.warn .dot { background: var(--yellow); box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.12); }
.status-dot.bad .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.12); }
.topbar-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 0.7rem; font-weight: 800; }
.content { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 24px 26px 38px; flex: 1; }
.content:focus { outline: none; }
.footer { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-3); font-size: 0.72rem; padding: 14px 20px 22px; border-top: 1px solid var(--border); }
.footer-sep { opacity: 0.5; }

/* ---------- primitives ---------- */
.eyebrow { margin: 0 0 2px; color: var(--blue-soft); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 1.55rem; letter-spacing: -0.01em; }
.page-sub { margin: 5px 0 0; color: var(--text-2); font-size: 0.88rem; max-width: 76ch; }
.page-sub .badge { margin-right: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--text-2); }
.small { font-size: 0.8rem; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.wrap, .mono.wrap { overflow-wrap: anywhere; word-break: break-word; }
.mono, code, pre { font-family: var(--font-mono); font-size: 0.84rem; }
code { background: rgba(255, 255, 255, 0.045); border: 1px solid var(--border); border-radius: 5px; padding: 0.05em 0.32em; overflow-wrap: anywhere; }
pre { margin: 0; }
.min0 { min-width: 0; }
.text-danger { color: var(--red-soft); }
.link { color: var(--blue-soft); text-decoration: none; }
.link:hover { text-decoration: underline; }
.link-inline { text-decoration: underline; text-underline-offset: 2px; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
}
.panel h3 { margin: 0; font-size: 1rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .icon { color: var(--text-3); }
.section-head h3 { display: inline-flex; align-items: center; gap: 8px; }
.calm { display: flex; align-items: flex-start; gap: 12px; border-color: rgba(62, 207, 142, 0.22); background: linear-gradient(180deg, rgba(62, 207, 142, 0.06), transparent), var(--surface); }
.calm .icon { color: var(--green); width: 22px; height: 22px; margin-top: 1px; }
.calm p { margin: 3px 0 0; }
.note-panel { border-style: dashed; background: rgba(255, 255, 255, 0.015); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 8px 13px; border-radius: 9px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.035);
  color: var(--text-1); font-size: 0.84rem; font-weight: 550; text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.065); border-color: rgba(94, 156, 255, 0.24); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #3d8bff, #2f80ed);
  border-color: rgba(94, 156, 255, 0.5); color: #fff;
  box-shadow: 0 14px 32px -18px rgba(47, 128, 237, 0.9);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #559bff, #3d8bff); }
.btn-danger { color: var(--red-soft); border-color: rgba(229, 72, 77, 0.28); background: rgba(229, 72, 77, 0.07); }
.btn-danger:hover:not(:disabled) { background: rgba(229, 72, 77, 0.13); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 30px; padding: 5px 9px; font-size: 0.78rem; border-radius: 7px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-3); }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-1); border-color: var(--border); }
.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.inline-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.row-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.codeblock { background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 11px 13px; overflow-x: auto; white-space: pre-wrap; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .field > label { color: var(--text-2); font-size: 0.78rem; font-weight: 600; }
.field-grow { flex: 1; min-width: 180px; }
.field-sm { width: 92px; flex: 0 0 92px; }
.field-actions { display: flex; justify-content: flex-end; margin-top: 2px; }
.field-help { margin: 0; color: var(--text-3); font-size: 0.73rem; line-height: 1.45; }
input[type='text'], input[type='password'], input[type='search'], input[type='url'], input[type='date'],
input[type='tel'], input[type='email'], input[type='file'], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text-1);
  border-radius: 8px; padding: 8px 10px; font-size: 0.87rem; font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.16); }
textarea { resize: vertical; min-height: 90px; }
.input-with-icon { position: relative; display: flex; align-items: center; }
.input-with-icon .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.input-with-icon input { padding-left: 34px; }
.check-label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 0.8rem; white-space: nowrap; }
input[type='checkbox'] { accent-color: var(--blue); width: 15px; height: 15px; }
.filter-bar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.stacked-form { display: flex; flex-direction: column; gap: 10px; max-width: 560px; margin: 12px 0; }
.stacked-form > .btn { align-self: flex-start; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; max-width: 220px;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2);
  font-size: 0.7rem; font-weight: 650; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid transparent;
}
.badge.ok { background: rgba(62, 207, 142, 0.12); color: var(--green-soft); border-color: rgba(62, 207, 142, 0.2); }
.badge.bad { background: rgba(229, 72, 77, 0.12); color: var(--red-soft); border-color: rgba(229, 72, 77, 0.22); }
.badge.warn { background: rgba(234, 179, 8, 0.12); color: var(--yellow-soft); border-color: rgba(234, 179, 8, 0.22); }
.badge.info { background: rgba(47, 128, 237, 0.13); color: var(--blue-soft); border-color: rgba(47, 128, 237, 0.24); }
.live-pill { display: inline-flex; align-items: center; gap: 5px; color: var(--green-soft); font-size: 0.7rem; font-weight: 700; }
.live-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); text-decoration: none; font-size: 0.78rem; }
.chip span { color: var(--text-3); font-size: 0.72rem; }
.chip:hover { border-color: rgba(94, 156, 255, 0.3); color: var(--text-1); }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border-radius: 10px; margin-bottom: 14px; font-size: 0.84rem; border: 1px solid; }
.alert .icon { width: 17px; height: 17px; margin-top: 1px; }
.alert-ok { background: rgba(62, 207, 142, 0.08); border-color: rgba(62, 207, 142, 0.25); color: var(--green-soft); }
.alert-warn { background: rgba(234, 179, 8, 0.08); border-color: rgba(234, 179, 8, 0.25); color: var(--yellow-soft); }
.alert-error { background: rgba(229, 72, 77, 0.09); border-color: rgba(229, 72, 77, 0.28); color: var(--red-soft); }
.noscript-notice { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; padding: 11px 13px; border: 1px solid rgba(234, 179, 8, 0.28); border-radius: 10px; background: rgba(234, 179, 8, 0.08); color: var(--yellow-soft); font-size: 0.84rem; }

.toast-stack {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  max-width: min(440px, calc(100vw - 32px));
}
.toast {
  max-width: 100%; width: max-content;
  display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow); font-size: 0.84rem; animation: toast-in 0.18s ease-out;
}
.toast .icon { width: 17px; height: 17px; margin-top: 1px; }
.toast-ok { border-color: rgba(62, 207, 142, 0.35); }
.toast-ok .icon { color: var(--green); }
.toast-error { border-color: rgba(229, 72, 77, 0.4); }
.toast-error .icon { color: var(--red-soft); }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { background: none; border: 0; color: var(--text-3); padding: 0; display: grid; place-items: center; min-width: 24px; min-height: 24px; border-radius: 6px; }
.toast-close:hover { color: var(--text-1); background: rgba(255, 255, 255, 0.06); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 34px 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-2); }
.empty-state p { margin: 0; max-width: 60ch; font-size: 0.85rem; }
.empty-icon { width: 26px; height: 26px; color: var(--text-3); }

/* ---------- data display ---------- */
.health-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 18px; }
.health-item { display: flex; align-items: center; gap: 10px; padding: 11px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.health-item small { display: block; color: var(--text-3); font-size: 0.7rem; }
.health-item strong { display: block; font-size: 0.86rem; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; background: var(--text-3); }
.health-item.ok .health-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(62, 207, 142, 0.1); }
.health-item.warn .health-dot { background: var(--yellow); box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.1); }
.health-item.bad .health-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.1); }

.attention { margin-bottom: 18px; }
.attention-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.attention-card { display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text-1); text-decoration: none; }
.attention-card > .icon:first-child { width: 19px; height: 19px; margin-top: 1px; }
.attention-card span { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.attention-card strong { font-size: 0.86rem; }
.attention-card small { color: var(--text-2); font-size: 0.76rem; line-height: 1.4; }
.attention-card .chevron { color: var(--text-3); align-self: center; }
.attention-card.warn { border-color: rgba(234, 179, 8, 0.22); }
.attention-card.warn > .icon:first-child { color: var(--yellow); }
.attention-card.danger { border-color: rgba(229, 72, 77, 0.28); }
.attention-card.danger > .icon:first-child { color: var(--red-soft); }
a.attention-card:hover { background: var(--surface-2); }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.metric { display: flex; flex-direction: column; gap: 1px; padding: 13px 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.metric-label { color: var(--text-2); font-size: 0.75rem; font-weight: 600; }
.metric-value { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.metric-value.mono { font-size: 0.92rem; font-weight: 600; }
.metric-value.ok { color: var(--green); }
.metric-value.bad { color: var(--red-soft); }
.metric-value.warn { color: var(--yellow-soft); }
.metric-hint { color: var(--text-3); font-size: 0.7rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.9fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.split > .panel, .split > .stack > .panel { margin-bottom: 0; }
.list-stack { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row strong { display: block; font-size: 0.83rem; overflow-wrap: anywhere; }
.list-row small { display: block; font-size: 0.72rem; }

.table-wrap { width: 100%; overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.data-table th { text-align: left; padding: 9px 11px; background: rgba(255, 255, 255, 0.025); color: var(--text-3); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--border); }
.data-table td { padding: 9px 11px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.data-table.compact td { padding: 7px 9px; }
.data-table .num { font-variant-numeric: tabular-nums; }
.cell-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-main small { font-size: 0.72rem; }
.col-check { width: 34px; }
.copy-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pii { display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; }
.pii-value { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.pii-reveal { width: 24px; height: 24px; flex: 0 0 24px; }
.row-details { margin: 0; }
.row-details summary { cursor: pointer; color: var(--text-3); font-size: 0.74rem; }
.row-details p { margin: 5px 0 0; font-size: 0.76rem; }

.tabs { display: flex; align-items: center; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs-inline { margin-bottom: 14px; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; color: var(--text-2); text-decoration: none; font-size: 0.84rem; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text-1); }
.tab.active { color: var(--text-1); border-bottom-color: var(--blue); }
.tab .count { color: var(--text-3); font-size: 0.7rem; }
.breadcrumb { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--text-3); font-size: 0.78rem; }
.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-1); }
.breadcrumb .icon { width: 13px; height: 13px; }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 20px; margin: 0; }
.meta-grid > div { padding: 7px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.meta-grid dt { color: var(--text-3); font-size: 0.7rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; }
.meta-grid dd { margin: 2px 0 0; font-size: 0.84rem; overflow-wrap: anywhere; }
.meta-grid .span-2 { grid-column: 1 / -1; }
.text-block { margin: 0 0 12px; color: var(--text-2); font-size: 0.87rem; white-space: pre-wrap; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.pagination-meta { color: var(--text-3); font-size: 0.74rem; }
.pagination-links { display: flex; align-items: center; gap: 4px; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 7px; border: 1px solid var(--border); border-radius: 7px; color: var(--text-2); text-decoration: none; font-size: 0.78rem; }
.page-btn:hover { border-color: var(--border-strong); color: var(--text-1); }
.page-btn.is-current { background: var(--blue-dim); border-color: rgba(94, 156, 255, 0.35); color: var(--text-1); }
.page-btn.is-disabled { opacity: 0.35; }
.page-gap { color: var(--text-3); padding: 0 2px; }

/* ---------- bulk / dialogs ---------- */
.bulk-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 11px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255, 255, 255, 0.02); }
.bulk-count { color: var(--text-2); font-size: 0.78rem; font-weight: 600; }
.bulk-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-left: auto; }
.bulk-list { list-style: none; margin: 6px 0 12px; padding: 8px 10px; max-height: 190px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 0.8rem; }
.bulk-list li { padding: 2px 0; border-bottom: 1px solid var(--border); }
.bulk-list li:last-child { border-bottom: 0; }

.dialog { border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); color: var(--text-1); padding: 0; width: min(560px, calc(100vw - 28px)); box-shadow: var(--shadow); max-height: calc(100dvh - 32px); overflow-y: auto; }
.dialog-wide { width: min(720px, calc(100vw - 28px)); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(2px); }
.dialog-form { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 16px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-head h3 { margin: 0; font-size: 1.05rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; position: sticky; bottom: -16px; z-index: 1; background: var(--surface); padding: 10px 0 16px; }
.dialog .toolbar { display: flex; gap: 4px; flex-wrap: wrap; }

.command-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.command-card { padding: 12px 13px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); }
.command-card.builtin { border-left: 3px solid var(--blue); }
.command-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.command-head code { background: none; border: 0; padding: 0; color: var(--blue-soft); font-weight: 700; }
.cmd-excerpt { max-width: 460px; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; font-size: 0.8rem; }
.spoiler { background: currentColor; border-radius: 4px; }
.spoiler:hover { background: transparent; }

.qr-wrap { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-top: 12px; }
.qr { display: block; width: 300px; height: 300px; max-width: 100%; background: #fff; padding: 10px; border-radius: 14px; border: 1px solid var(--border); image-rendering: pixelated; }
.qr-side { flex: 1; min-width: 220px; }
.qr-side h4 { margin: 0 0 5px; }
.help-block { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.help-block summary { cursor: pointer; color: var(--text-2); font-size: 0.82rem; font-weight: 600; }
.help-list { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 0.82rem; }
.help-list li { margin: 4px 0; }

/* ---------- profile / auth ---------- */
.profile-grid { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.avatar-preview img, .avatar-placeholder { width: 156px; height: 156px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface-2); object-fit: cover; }
.avatar-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border-style: dashed; color: var(--text-3); font-size: 0.76rem; }
.avatar-placeholder .icon { width: 30px; height: 30px; }
.profile-form { display: flex; flex-direction: column; gap: 10px; min-width: 260px; flex: 1; }
.profile-form > .btn { align-self: flex-start; margin-top: 2px; }
.recovery-box { align-items: flex-start; }
.recovery-codes { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: 6px; }
.recovery-codes code { display: block; text-align: center; padding: 5px 6px; }

.auth-page { display: block; min-height: 100vh; }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); min-height: 100vh; }
.auth-shell-narrow { grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px; }
.auth-brand-panel { display: flex; flex-direction: column; justify-content: space-between; padding: 38px 44px; background: radial-gradient(700px 420px at 20% 10%, rgba(47, 128, 237, 0.16), transparent 65%), var(--bg-elevated); border-right: 1px solid var(--border); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.15em; font-size: 0.9rem; }
.auth-brand img { border-radius: 10px; }
.auth-copy { max-width: 480px; }
.auth-copy h1 { margin: 6px 0 10px; font-size: 2rem; line-height: 1.15; letter-spacing: -0.02em; }
.auth-copy p { color: var(--text-2); font-size: 0.93rem; }
.auth-points { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); font-size: 0.84rem; }
.auth-points li { display: flex; align-items: center; gap: 8px; }
.auth-points .icon { color: var(--blue-soft); }
.auth-foot { color: var(--text-3); font-size: 0.72rem; }
.auth-form-panel { display: grid; place-items: center; padding: 38px 28px; }
.auth-form-wrap { width: 100%; max-width: 390px; }
.auth-form-wrap h2 { margin: 0 0 5px; font-size: 1.45rem; letter-spacing: -0.01em; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.auth-note { margin-top: 18px; color: var(--text-3); font-size: 0.74rem; }
.auth-cancel { display: flex; justify-content: center; margin-top: 8px; }
.auth-mobile-brand { display: none; align-items: center; gap: 8px; margin-bottom: 22px; font-weight: 800; letter-spacing: 0.13em; font-size: 0.8rem; }
.auth-mobile-brand small { color: var(--text-3); font-weight: 600; letter-spacing: 0.08em; }
.code-input { letter-spacing: 0.22em; font-family: var(--font-mono); }
.error-page { max-width: 560px; margin: 8vh auto; text-align: center; }
.error-code { font-size: 3.6rem; font-weight: 800; letter-spacing: -0.04em; color: var(--blue-soft); line-height: 1; }
.error-page h2 { margin: 6px 0; }
.error-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

details.collapsible > summary { list-style: none; cursor: pointer; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary.section-head { margin-bottom: 0; }
details.collapsible[open] > summary.section-head { margin-bottom: 12px; }
.danger-zone { border-color: rgba(229, 72, 77, 0.25); }
.danger-zone > summary { cursor: pointer; color: var(--red-soft); font-weight: 650; list-style: none; }
.danger-zone > summary::-webkit-details-marker { display: none; }
details.collapsible > summary:not(.section-head)::after,
.danger-zone > summary::after { content: '›'; float: right; margin-left: 10px; color: var(--text-3); transition: transform 0.15s ease; }
details.collapsible[open] > summary:not(.section-head)::after,
.danger-zone[open] > summary::after { transform: rotate(90deg); }
.danger-zone[open] > summary { margin-bottom: 10px; }
.page-foot-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 0.82rem; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  :root { --topbar-h: 58px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh; width: min(300px, 86vw);
    transform: translateX(-104%); transition: transform 0.2s ease; box-shadow: var(--shadow);
    background: var(--bg-elevated); visibility: hidden;
  }
  .app.nav-open .sidebar { transform: none; visibility: visible; }
  .nav-overlay { display: block; position: fixed; inset: 0; z-index: 25; border: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
  .app.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }
  .icon-btn.menu-toggle { display: inline-flex; }
  .topbar { padding: 9px 16px; }
  .topbar-eyebrow { display: none; }
  .content { padding: 18px 16px 30px; }
  .status-group { display: none; }
  .topbar-avatar { display: grid; }
}
/* No-JS fallback: app.js adds the "js" class before any interaction. Without
   it the drawer toggle cannot work, so show the navigation as a normal block
   instead of leaving it off-canvas and unreachable. */
@media (max-width: 900px) {
  html:not(.js) .app { display: block; }
  html:not(.js) .sidebar {
    position: static; width: auto; height: auto; inset: auto;
    transform: none; visibility: visible; border-right: 0;
    border-bottom: 1px solid var(--border); box-shadow: none;
  }
  html:not(.js) .nav { overflow: visible; max-height: none; }
  html:not(.js) .icon-btn.menu-toggle,
  html:not(.js) .nav-overlay { display: none; }
  html:not(.js) .sidebar-footer { padding-bottom: 12px; }
}
@media (min-width: 901px) {
  .topbar-avatar { display: none; }
}
/* The People table has six columns and needs the card layout earlier than
   the other tables, otherwise the last two columns are clipped at 768-1024. */
@media (max-width: 1080px) {
  .people-table-wrap { overflow-x: visible; border: 0; }
  .people-table { display: block; border: 0; }
  .people-table thead { display: none; }
  .people-table tbody, .people-table tr { display: block; }
  .people-table tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--bg-elevated); }
  .people-table td { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding: 8px 10px; min-width: 0; }
  .people-table tr td:last-child { border-bottom: 0; }
  .people-table td::before { content: attr(data-label); color: var(--text-3); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; flex: 0 0 38%; }
  .people-table td > * { min-width: 0; }
  .people-table .mono { overflow-wrap: anywhere; word-break: break-word; }
}
@media (max-width: 760px) {
  .btn, .btn-sm { min-height: 40px; padding: 8px 11px; }
  .icon-btn { width: 36px; height: 36px; }
  .pii-reveal { width: 32px; height: 32px; flex-basis: 32px; }
  .page-btn { min-width: 36px; height: 36px; }
  input[type='checkbox'] { width: 18px; height: 18px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { justify-content: flex-start; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-strip { grid-template-columns: 1fr 1fr; }
  .filter-bar { align-items: stretch; }
  .filter-bar .field, .filter-bar .btn { width: 100%; }
  .bulk-actions { margin-left: 0; width: 100%; }
  .bulk-actions .btn { flex: 1; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .data-table.responsive { display: block; border: 0; }
  .data-table.responsive thead { display: none; }
  .data-table.responsive tbody, .data-table.responsive tr { display: block; }
  .data-table.responsive tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--bg-elevated); }
  .data-table.responsive td { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding: 8px 10px; }
  .data-table.responsive tr td:last-child { border-bottom: 0; }
  .data-table.responsive td::before { content: attr(data-label); color: var(--text-3); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; flex: 0 0 38%; }
  .data-table.responsive td.col-check::before { content: 'Seç'; }
  .data-table.responsive td > * { min-width: 0; }
  .data-table.responsive .badge { display: inline-block; white-space: normal; max-width: 100%; text-align: right; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.4; }
  .data-table.responsive .mono { overflow-wrap: anywhere; word-break: break-word; }
  .data-table.responsive .row-actions { justify-content: flex-end; }
  .table-wrap { overflow-x: auto; border: 0; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .auth-form-panel { min-height: 100vh; padding: 24px 18px; }
  .auth-mobile-brand { display: flex; }
  .content { padding: 16px 13px 28px; }
  .panel { padding: 15px 14px; }
  .meta-grid { grid-template-columns: 1fr; }
  .toast-stack { left: 14px; right: 14px; bottom: 14px; max-width: none; align-items: stretch; }
  .toast { width: auto; max-width: none; }
}
@media (max-width: 480px) {
  .metrics, .health-strip { grid-template-columns: 1fr; }
  .page-head h2 { font-size: 1.3rem; }
  .topbar-title { font-size: 0.98rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---- person detail ---- */
.person-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.person-avatar { width: 58px; height: 58px; flex-basis: 58px; font-size: 1.15rem; background: var(--surface-2); color: var(--text-1); border: 1px solid var(--border-strong); }
.person-hero-main { flex: 1; min-width: 220px; }
.person-hero-main h2 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.person-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 0; color: var(--text-2); }
#person-groups { scroll-margin-top: calc(var(--topbar-h) + 14px); }
.pii-value:focus { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

/* ---- events page ---- */
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.usage-card { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 9px; }
.usage-card code { color: var(--blue-soft); background: none; border: 0; padding: 0; font-weight: 650; }
.usage-card span { color: var(--text-3); font-size: 0.75rem; }

/* ---- group permissions ---- */
.member-picker { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 12px 0; }
.member-picker legend { padding: 0 6px; color: var(--text-2); font-size: 0.78rem; font-weight: 650; }
.member-picker-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.member-picker-tools .btn { margin-left: 0; }
.member-picker-tools [data-mention-count] { color: var(--text-1); font-variant-numeric: tabular-nums; }
.member-picker-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 14px; max-height: 240px; overflow-y: auto; }
.member-picker .check-label { white-space: normal; }
.member-picker .check-label input:disabled { opacity: 0.6; }
.member-picker .check-label:has(input:disabled) { opacity: 0.72; }
.member-picker .alert { margin: 10px 0 0; }
.member-picker .alert .icon { width: 16px; height: 16px; }
