/* ═══════════════════════════════════════════════════════════
   LOXTU app shell + auth — layout semantics only.
   Paint tokens come from tokens.css (loxtu.com).
   ═══════════════════════════════════════════════════════════ */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

html {
  background: var(--bg-body);
  overflow-x: hidden;
}

body.app-shell {
  margin: 0;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: transparent; /* aurora shows through; html has bg */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: color var(--duration-slow), background-color var(--duration-slow);
}

/* ── Header (loxtu.com: sticky 64px, transparent + blur) ── */
.site-header {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  height: var(--header-height);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background-color var(--duration-slow);
}

.nav-inner {
  height: 100%;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 var(--header-pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.logo {
  height: 28px;
  width: auto;
  display: block;
  user-select: none;
}

/* Theme toggle — icon button like landing (p-2) */
.theme-btn {
  appearance: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: color var(--duration-normal) var(--ease-landing);
}

.theme-btn:hover { color: var(--text-primary); }

.theme-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.theme-icon {
  display: none;
  line-height: 0;
}

.theme-icon.is-active {
  display: grid;
  place-items: center;
}

.theme-icon svg,
.theme-icon img {
  width: 16px;
  height: 16px;
}

/* Invert all icon SVGs (currentColor black → white) on dark background.
   Exclude .logo (brand logo has explicit gradient colors, would look wrong inverted). */
[data-theme="dark"] img:not(.logo) {
  filter: invert(1);
}

/* ── App header (authenticated pages — fixed top bar) ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--header-pad-x);
  height: var(--header-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.app-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-main {
  padding-top: var(--header-height);
}

.logout-form {
  display: inline;
}

/* ── Main ── */
.content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem var(--header-pad-x);
  position: relative;
  z-index: 1;
}
.content:has(.admin-page) {
  align-items: flex-start;
  justify-content: flex-start;
}

/* ════════════════════════════════════════
   Auth card — auto-sized stack, one control rhythm
   Copy comes from data-* + CSS (hot-reload), not Rust strings.
   ════════════════════════════════════════ */

:root {
  --control-h: 3.25rem;
  --control-px: 1rem;
  --stack-gap: 0.75rem;
  --card-pad: 2rem;
}

@media (max-width: 640px) {
  :root {
    --control-h: 3rem;
    --control-px: 0.875rem;
    --card-pad: 1.25rem;
    --stack-gap: 0.625rem;
  }
}

.auth {
  width: 100%;
  max-width: var(--auth-card-max);
  position: relative;
  z-index: 1;
  animation: auth-enter 0.5s var(--ease-out) both;
}

@keyframes auth-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-card {
  width: 100%;
  height: auto; /* grows with components */
  padding: var(--card-pad);
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.04);
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
}

[data-theme="dark"] .auth-card {
  box-shadow: none;
}

/* Title — centered; copy from data-title */
.auth-title {
  margin: 0;
  min-height: 1.4em;
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text-primary);
  text-align: center;
  width: 100%;
}

.auth-title:empty::before {
  content: attr(data-title);
  display: block;
}

/*
 * Standard gap between title and email field.
 */
.auth-card > .auth-title {
  margin-bottom: var(--stack-gap);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
  width: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Single control size standard: input / feedback / button share width + rhythm */
.field-input,
.btn,
.auth-feedback .popup {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--control-h);
  border-radius: var(--radius-md);
}

.field-input {
  height: var(--control-h);
  padding: 0 var(--control-px);
  border: 1px solid var(--border);
  background: var(--bg-paper);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.5;
  outline: none;
  text-align: left;
  transition:
    border-color var(--duration-normal) var(--ease-landing),
    box-shadow var(--duration-normal) var(--ease-landing);
}

.field-input::placeholder { color: var(--text-light); }

.field-input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Feedback strip — same width as controls; height collapses when empty? keep min for stability */
.auth-feedback {
  width: 100%;
  min-height: var(--control-h);
  display: flex;
  align-items: stretch;
}

.auth-feedback:empty {
  min-height: var(--control-h);
  /* invisible spacer so card doesn't jump */
  visibility: hidden;
}

.auth-feedback:not(:empty) {
  visibility: visible;
}

/* Logo theme switch — show light logo by default, dark logo in dark mode */
.logo-light { display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* Consent checkbox — full width like email input, inline with label text */
.consent-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  cursor: pointer;
  width: 100%;
}

.consent-label a {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.consent-label a:hover {
  text-decoration: underline;
}

.consent-label span {
  flex: 1;
  text-align: justify;
  text-align-last: justify;
}

.consent-checkbox {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Primary CTA — loxtu.com mono uppercase; label via CSS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--control-h);
  height: var(--control-h);
  padding: 0 var(--control-px);
  border-radius: var(--radius-md);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
  transition: all var(--duration-normal) var(--ease-landing);
}

/* Split CTA row: primary flex + square passkey */
.auth-actions {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: var(--stack-gap);
  width: 100%;
}

.auth-actions .btn-submit {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

/* Button label from data-label or CSS fallback */
.btn-submit:empty::before {
  content: attr(data-label);
}
.btn-submit:empty:not([data-label])::before {
  content: "Receive a verification code";
}

/*
 * Passkey — square, no button chrome.
 * Icon fill = boundary / “border” of the control.
 */
.btn-passkey {
  flex: 0 0 var(--control-h);
  width: var(--control-h);
  height: var(--control-h);
  min-width: var(--control-h);
  min-height: var(--control-h);
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  transition:
    transform var(--duration-fast, 140ms) var(--ease-out),
    opacity var(--duration-normal) var(--ease-landing);
}

.btn-passkey:hover {
  transform: scale(1.04);
  opacity: 0.9;
}

.btn-passkey:active {
  transform: scale(0.96);
}

.btn-passkey:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-passkey-icon {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-primary); /* currentColor for inline SVG strokes */
  line-height: 0;
}

.btn-passkey-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.btn:hover {
  color: var(--ink);
  background: transparent;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* dark: ink is light — invert button to accent paper feel */
[data-theme="dark"] .btn {
  background: var(--text-primary);
  color: var(--bg-body);
  border-color: var(--text-primary);
}

[data-theme="dark"] .btn:hover {
  color: var(--text-primary);
  background: transparent;
}

/* ── Firm popups (validation / tips) ── */
.popup {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: popup-in 0.28s var(--ease-out) both;
}

@keyframes popup-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.popup-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 0.4rem;
  border-radius: 9999px;
  background: var(--accent);
}

.popup-text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.popup-info {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--glass-border));
}
.popup-info .popup-dot { background: var(--accent); }

.popup-error {
  border-color: color-mix(in srgb, var(--color-danger) 45%, var(--glass-border));
  background: color-mix(in srgb, var(--color-danger) 8%, var(--glass-bg));
}
.popup-error .popup-dot { background: var(--color-danger); }
.popup-error .popup-text { color: var(--color-danger); }

.popup-success {
  border-color: color-mix(in srgb, var(--color-success) 40%, var(--glass-border));
  background: color-mix(in srgb, var(--color-success) 8%, var(--glass-bg));
}
.popup-success .popup-dot { background: var(--color-success); }
.popup-success .popup-text { color: var(--color-success); }

.field-input:user-invalid {
  border-color: color-mix(in srgb, var(--color-danger) 55%, var(--border));
}

@media (prefers-reduced-motion: reduce) {
  .auth, .popup { animation: none; }
  .btn, .theme-btn, .field-input { transition: none; }
}


/* OTP 6-box row — same control height as email field */
.otp-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
  border: 0;
  padding: 0;
}

.otp-boxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--stack-gap);
  width: 100%;
}

.otp-cell {
  width: 100%;
  height: var(--control-h);
  min-height: var(--control-h);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-paper);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color var(--duration-normal) var(--ease-landing),
    box-shadow var(--duration-normal) var(--ease-landing);
}

.otp-cell:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* ── OAuth divider + icon row — borderless, uniform size like passkey ── */
.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.oauth-divider span {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.oauth-row {
  display: flex;
  justify-content: center;
  gap: 20px;
}
.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-h);
  height: var(--control-h);
  min-height: var(--control-h);
  aspect-ratio: 1 / 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity var(--duration-normal) var(--ease-landing);
  cursor: pointer;
  box-sizing: border-box;
}
.oauth-btn:hover {
  opacity: 0.7;
}
.oauth-icon {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* ════════════════════════════════════════
   Account panel — stat cards, info rows, action cards
   ════════════════════════════════════════ */
.account-page {
  padding-top: calc(var(--header-height) + 2rem);
  padding-bottom: 3rem;
  overflow-y: auto;
  height: 100%;
}
.account-layout {
  max-width: var(--auth-card-max);
  margin: 0 auto;
  padding: 0 var(--card-pad);
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-light);
  margin: 2rem 0 .75rem;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.stat-card {
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1rem 1.125rem;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-display);
  line-height: 1.2;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-secondary); }
.info-value {
  color: var(--text-primary);
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: 13px;
}
.field-row { margin-bottom: .75rem; }
.field-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.field-row input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-paper);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.field-row input:focus { border-color: var(--accent); }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}
.badge-oauth { background: var(--accent-light); color: var(--accent-dark); }
.badge-passkey { background: rgba(52, 211, 153, .12); color: #34d399; }
.text-muted { color: var(--text-secondary); font-size: 13px; }
.action-card {
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 10px;
}
.action-card-info { flex: 1; min-width: 0; }
.action-card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.action-card-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.danger-zone { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(239, 68, 68, .2); }
.danger-zone .section-title { color: #ef4444; }

/* Action buttons (compact, for cards) */
.btn-primary {
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  background: var(--accent);
  color: #0a0a0a;
}
.btn-primary:hover { opacity: .85; }
.btn-danger {
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  background: #ef4444;
  color: #fff;
}
.btn-danger:hover { opacity: .85; }
.btn-outline {
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  background: transparent;
  color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-paper); border-color: var(--text-secondary); }
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-md);
}
.btn-ghost:hover { background: var(--accent-light); }

/* Passkey prompt card */
.passkey-prompt {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-paper);
  border: 1px solid var(--accent-dark);
  border-radius: var(--radius-xl);
  padding: 1.125rem;
  margin: 1rem 0;
}
.passkey-prompt-icon { font-size: 1.5rem; }
.passkey-prompt-info { flex: 1; }
.passkey-prompt-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.passkey-prompt-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
  z-index: 999;
  display: none;
  max-width: 400px;
  text-align: center;
}
.toast.show { display: block; animation: fadeIn .3s; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Admin dashboard ── */
.admin-page {
  padding: 2rem var(--header-pad-x);
  max-width: 100%;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-header h1 { margin: 0; font-size: 1.5rem; }

.admin-nav {
  display: flex;
  gap: 0.5rem;
}

.admin-nav-link {
  font-size: 13px;
  padding: .35rem .75rem;
  border-radius: var(--radius, 6px);
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--bg-tertiary, #1e1e1e);
  transition: background .15s, color .15s;
}

.admin-nav-link:hover {
  background: var(--accent-dim, #2a3a4a);
  color: var(--ink);
}

.admin-nav-link--active {
  background: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.admin-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 120px;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

.admin-section-title {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
}

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }

.admin-table th,
.admin-table td { padding: 0.625rem 0.75rem; text-align: left; white-space: nowrap; }

.admin-table thead th {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.6875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--card-border);
}

.admin-table tbody tr + tr { border-top: 1px solid var(--card-border); }

.admin-table .code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-badge {
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  background: var(--accent-muted);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-badge {
  padding: 0.125rem 0.625rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent);
  color: var(--ink);
}

@media (max-width: 768px) {
  .admin-page { padding: 1rem; }
  .stat-card { min-width: 80px; padding: 0.75rem; }
  .stat-value { font-size: 1.25rem; }
}

/* ── Admin bento grid ─────────────────────────────── */
.admin-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.admin-bento .bento-wide { grid-column: 1 / -1; }
.admin-bento-card.bento-wide {
  margin-top: 1.25rem;
}
.admin-bento-card {
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.125rem;
}
/* Квадратные карточки Stats и Server */
.admin-bento-card.bento-square {
  aspect-ratio: 1 / 1;
  min-height: 220px;
}
/* Одинаковая высота Stats и Server в первом ряду — вертикальный стек */
.admin-bento:first-of-type {
  grid-template-columns: 1fr;
}
.admin-bento:first-of-type .admin-bento-card {
  min-height: 0;
  width: 100%;
}
.admin-bento-card h3 {
  margin: 0 0 .75rem;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-light);
}
.bento-table-wrap {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.bento-search {
  width: 100%;
  margin-bottom: .75rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 13px;
}
.bento-search:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--focus-ring);
}
.user-actions {
  position: relative;
  display: inline-block;
}
.user-actions select {
  padding: 4px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}
.user-actions select:focus { outline: none; border-color: var(--accent); }
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
}

.hidden { display: none !important; }

/* Admin popup overlay */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
}
.popup-overlay .admin-popup-content {
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

/* ── Modal overlay / card (попап юзера) ───────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-card {
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  max-width: 520px;
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

/* Кликабельные строки таблиц (Security Events → попап юзера) */
.clickable-row {
  cursor: pointer;
}
.clickable-row:hover {
  background: var(--accent-muted);
}

/* Чекбокс-пилюли для скиллов/прав */
.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--card-bg);
  user-select: none;
}
.pill input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
  cursor: pointer;
}
.pill:has(input:checked) {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--accent-muted);
}
