/* ═══════════════════════════════════════════════════════════════════
   hav/mod — admin panel design system
   Dark command deck · cool graphite base · electric indigo accent
   ═══════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* base surfaces — deep cool graphite, never pure #000 */
  --bg: #222226;
  --surface: #2a2a30;
  --surface-2: #32323a;
  --surface-3: #3a3a44;
  --surface-hover: #2e2e36;
  --surface-active: #36363f;

  /* hairlines */
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --line-accent: rgba(135, 222, 255, 0.42);

  /* text */
  --text: #eaedf4;
  --text-muted: #9ba3b3;
  --text-faint: #6b7384;

  /* cyan accent — high chroma, reads clearly on dark surfaces */
  --accent: #87deff;
  --accent-hi: #a9e6ff;
  --accent-deep: #4aa9d6;
  --accent-soft: rgba(135, 222, 255, 0.15);
  --accent-line: rgba(135, 222, 255, 0.42);

  /* semantic */
  --ok: #5fb985;
  --ok-soft: rgba(95, 185, 133, 0.14);
  --warn: #87deff;
  --warn-soft: rgba(135, 222, 255, 0.15);
  --danger: #e06a6a;
  --danger-soft: rgba(224, 106, 106, 0.13);
  --info: #6ea8d8;

  /* type */
  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-base: 14px;
  --fs-lg: 16px;
  --fs-xl: 22px;
  --fs-2xl: clamp(22px, 2.6vw, 28px);

  --lh-tight: 1.15;
  --lh-snug: 1.4;
  --lh-normal: 1.55;

  /* spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 48px;
  --s-10: 64px;

  --radius-xs: 6px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  /* elevation ladder + tactile inset highlights */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 16px 40px -16px rgba(0, 0, 0, 0.65), 0 4px 12px -6px rgba(0, 0, 0, 0.35);
  --shadow-3: 0 28px 72px -24px rgba(0, 0, 0, 0.72), 0 10px 28px -14px rgba(0, 0, 0, 0.45);
  --lift: 0 6px 16px -8px rgba(0, 0, 0, 0.5);
  --inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --inset-hi-soft: inset 0 1px 0 rgba(255, 255, 255, 0.03);

  /* accent glow / focus ring presets */
  --glow-accent: 0 8px 24px -10px rgba(135, 222, 255, 0.55);
  --ring-accent: 0 0 0 3px var(--accent-soft);

  /* surface treatments */
  --grad-panel: linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0) 110px);
  --scrim: rgba(4, 6, 10, 0.55);

  /* motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 140ms;
  --t-med: 220ms;
  --t-slow: 320ms;
}

/* ───────────────────────── Reset ───────────────────────── */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background:
    radial-gradient(1000px 520px at 12% -12%, rgba(135, 222, 255, 0.075), transparent 62%),
    radial-gradient(900px 520px at 105% 115%, rgba(135, 222, 255, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
  color: inherit;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

svg {
  display: block;
}

.is-hidden {
  display: none !important;
}

/* native [hidden] must beat component display rules — author .login-error
   {display:flex} was overriding the UA sheet, so empty error pills rendered */
[hidden] {
  display: none !important;
}

/* ──────────────── Foundations: focus · selection · scrollbars ──────────────── */

/* one consistent keyboard ring for every interactive element */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: rgba(135, 222, 255, 0.38);
  color: #ffffff;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.24);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

/* screen-reader-only helper (templates rely on .sr-only) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* skip-link — base geometry lives in shell-extras; add depth + ring here */
.skip-link {
  box-shadow: var(--shadow-2), var(--inset-hi);
}

.skip-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
}

/* numerals align in columns: metrics, tables, counters */
.tnum,
.metric-value,
.rule-count,
.nav-badge,
table.violations,
.cell-mono,
.cell-date,
.uid {
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────── Brand ─────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-1), var(--inset-hi);
  transition:
    border-color var(--t-fast) ease,
    box-shadow var(--t-fast) ease,
    color var(--t-fast) ease;
}

.brand:hover .brand-mark {
  border-color: var(--accent-line);
  color: var(--accent-hi);
  box-shadow: var(--shadow-1), var(--glow-accent);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-mark .brand-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 6px;
}

.brand-type {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-name em {
  font-style: normal;
  color: var(--accent);
}

.brand-sub {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ──────────────────── Buttons ──────────────────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease),
    background var(--t-fast) ease,
    border-color var(--t-fast) ease,
    color var(--t-fast) ease,
    box-shadow var(--t-fast) ease,
    opacity var(--t-fast) ease,
    filter var(--t-fast) ease;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* disabled / aria-disabled — uniform, clearly inert */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-accent {
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 42%, var(--accent-deep) 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px -6px rgba(135, 222, 255, 0.6), var(--inset-hi);
}

.btn-accent:hover:not(:active):not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.07) saturate(1.05);
  box-shadow: 0 10px 26px -8px rgba(135, 222, 255, 0.7), var(--inset-hi);
}

.btn-accent:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--text-muted);
  box-shadow: var(--inset-hi-soft);
}

.btn-ghost:hover:not(:active) {
  transform: translateY(-1px);
  background: var(--surface-hover);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: var(--lift), var(--inset-hi-soft);
}

.btn-danger {
  background: transparent;
  border-color: transparent;
  color: var(--text-faint);
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
}

.btn-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(224, 106, 106, 0.25);
}

.btn-danger svg {
  width: 15px;
  height: 15px;
}

.btn-block {
  width: 100%;
}

.btn .btn-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: none;
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn-spinner {
  display: block;
}

.btn.is-loading .btn-label {
  opacity: 0.7;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ──────────────────── Inputs ──────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: var(--s-4);
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.field-hint {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-faint);
}

.field-hint code {
  color: var(--text-muted);
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.input-wrap:focus-within {
  border-color: var(--accent-line);
  box-shadow: var(--ring-accent);
  background: var(--surface-2);
  color: var(--text);
}

.input-wrap .input-icon {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  flex: 0 0 auto;
  transition: color var(--t-fast) ease;
}

.input-wrap:focus-within .input-icon {
  color: var(--accent-hi);
}

.input-wrap input {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 11px 0;
  font-size: var(--fs-base);
  outline: none;
  color: var(--text);
}

.input-wrap input::placeholder {
  color: var(--text-faint);
}

/* mini inline input for rule rows */
.input-mini {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  font-size: var(--fs-md);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

/* recolor the native search clear ✕ to match the palette (inline SVG, no asset) */
.input-mini[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a0b3' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") no-repeat center / contain;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity var(--t-fast) ease;
}

.input-mini[type="search"]:hover::-webkit-search-cancel-button {
  opacity: 1;
}

.input-mini:hover {
  background: var(--surface-2);
}

.input-mini:focus {
  border-color: var(--accent-line);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-mini::placeholder {
  color: var(--text-faint);
}

/* mono inputs (IDs, durations, domains) — steady rhythm */
.input-mini.mono {
  letter-spacing: 0.01em;
}

/* file input — turn the native button into a quiet ghost chip */
.input-mini[type="file"] {
  padding: 5px 8px;
  cursor: pointer;
}

.input-mini[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--t-fast) ease,
    border-color var(--t-fast) ease,
    color var(--t-fast) ease;
}

.input-mini[type="file"]::file-selector-button:hover {
  background: var(--surface-hover);
  border-color: var(--accent-line);
  color: var(--text);
}

/* invalid state — pairs with the validators' shake on the login page */
.field.is-invalid label {
  color: var(--danger);
}

.field.is-invalid .input-wrap,
.field.is-invalid .input-mini {
  border-color: rgba(224, 106, 106, 0.55);
}

.field.is-invalid .input-wrap:focus-within,
.field.is-invalid .input-mini:focus {
  border-color: rgba(224, 106, 106, 0.75);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.field.is-invalid .input-icon {
  color: var(--danger);
}

/* ─────────────────── Login page ─────────────────── */
.login-body {
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(135, 222, 255, 0.1), transparent 60%),
    var(--bg);
}

.login-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  min-height: 100dvh;
  position: relative;
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 56px 36px;
  gap: 24px;
  border-right: 1px solid var(--line);
  position: relative;
  opacity: 0;
  animation: rise 0.6s var(--ease) 0.05s forwards;
}

/* faint blueprint grid, masked to the top-left glow — pure CSS, static */
.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(640px 420px at 18% -4%, #000 30%, transparent 74%);
  mask-image: radial-gradient(640px 420px at 18% -4%, #000 30%, transparent 74%);
  opacity: 0.55;
}

.login-brand > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 32px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  flex: 0 0 22px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.login-hero h1 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 42px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.login-hero-text {
  margin: 18px 0 0;
  max-width: 44ch;
  color: var(--text-muted);
  font-size: 14.5px;
}

.login-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise 0.6s var(--ease) 0.18s backwards;
}

.login-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.point-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid rgba(95, 185, 133, 0.22);
}

.point-icon svg {
  width: 15px;
  height: 15px;
}

.login-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text-faint);
  animation: rise 0.6s var(--ease) 0.3s backwards;
}

.login-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  opacity: 0;
  animation: rise 0.6s var(--ease) 0.14s forwards;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-card-head {
  margin-bottom: 26px;
}

.login-card-head h2 {
  margin: 0;
  font-size: var(--fs-xl);
  letter-spacing: -0.02em;
  font-weight: 700;
}

.login-card-head p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: var(--fs-md);
}

.login-error {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(224, 106, 106, 0.3);
  color: #f0c1c1;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.22s var(--ease);
}

.login-error::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--danger);
}

.login-card-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* status dot */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: 0 0 auto;
}

.dot-on {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

/* ───────────────────── App shell ─────────────────────── */
.app-body {
  min-height: 100dvh;
}

.app-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100dvh;
}

/* sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 16px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.sidebar .brand {
  padding: 0 6px;
  margin-bottom: 20px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
  position: relative;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-weight: 600;
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  box-shadow: 0 0 12px rgba(135, 222, 255, 0.55);
}

.nav-item-quiet {
  color: var(--text-faint);
  font-size: 12.5px;
}

.nav-item-quiet:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.nav-item-quiet svg {
  width: 15px;
  height: 15px;
}

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hi);
  border: 1px solid var(--accent-line);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.bot-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.bot-pill .dot {
  animation: pulse 2.4s ease-in-out infinite;
}

.bot-pill[data-ready="online"] .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

.bot-pill[data-ready="offline"] .dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
  animation: none;
}

.bot-pill[data-ready="loading"] .dot {
  background: var(--warn);
}

/* main */
.main {
  min-width: 0;
  padding: 30px 38px 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.topbar-title h1 {
  margin: 0 0 4px;
  font-size: var(--fs-2xl);
  letter-spacing: -0.03em;
  line-height: var(--lh-tight);
  font-weight: 800;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-md);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ──────────────────── Panel / sections ─────────────────────── */
.panel {
  background: var(--surface);
  background-image: var(--grad-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1), var(--inset-hi-soft);
  overflow: hidden;
  /* clip (not hidden) keeps rounded corners without creating a scroll
     container — lets sticky table headers resolve against the viewport */
  overflow: clip;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-desc {
  margin: 3px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* body region of a panel when there is no panel-head above it */
.panel-body {
  padding: 18px 22px;
}

/* segmented control */
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.seg-item {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background var(--t-fast) ease,
    color var(--t-fast) ease,
    box-shadow var(--t-fast) ease;
}

.seg-item:hover:not(.is-active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.seg-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.seg-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-hi);
  box-shadow:
    inset 0 0 0 1px var(--accent-line),
    0 1px 3px rgba(0, 0, 0, 0.25);
}

/* metric row */
.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
  margin-bottom: 18px;
}

/* metrics pop in as the stats payload lands */
.metric {
  animation: rise 0.32s var(--ease) backwards;
}

.metric {
  background: var(--surface);
  background-image: var(--grad-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-1), var(--inset-hi-soft);
  transition:
    border-color var(--t-med) ease,
    box-shadow var(--t-med) ease,
    transform var(--t-med) var(--ease);
}

.metric:hover {
  border-color: var(--line-strong);
  box-shadow: var(--lift), var(--inset-hi-soft);
  transform: translateY(-1px);
}

.metric:nth-child(2) {
  animation-delay: 0.04s;
}

.metric:nth-child(3) {
  animation-delay: 0.08s;
}

.metric:nth-child(4) {
  animation-delay: 0.12s;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
}

.metric-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.metric .metric-value.accent {
  color: var(--accent-hi);
}

.metric .metric-value.ok {
  color: var(--ok);
}

.metric .metric-value.warn {
  color: var(--warn);
}

/* ═══════════════ Rule lists ═══════════════ */
.rule-grid {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.rule-card {
  background: var(--surface);
  background-image: var(--grad-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1), var(--inset-hi-soft);
  transition:
    border-color var(--t-med) ease,
    box-shadow var(--t-med) ease;
}

.rule-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2), var(--inset-hi-soft);
}

.rule-card-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
}

.rule-card-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--accent-line);
  background: linear-gradient(180deg, var(--accent-soft), rgba(135, 222, 255, 0.05));
  color: var(--accent-hi);
  box-shadow: var(--inset-hi-soft);
}

.rule-card-icon svg {
  width: 17px;
  height: 17px;
}

.rule-card-body {
  padding: 6px var(--s-5) var(--s-4);
}

.rule-heading {
  flex: 1;
  min-width: 0;
}

.rule-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
}

.rule-desc {
  margin: 2px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.rule-count {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ───────── Collapsible rule cards (rules view, collapsed by default) ───────── */
.rule-card-head[data-collapsible] {
  cursor: pointer;
  user-select: none;
}

.rule-card-head[data-collapsible]:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: -2px;
  border-radius: var(--radius-lg);
}

.rule-card-chev {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text-muted);
  transition:
    transform var(--t-med) ease,
    color var(--t-med) ease,
    border-color var(--t-med) ease,
    background var(--t-med) ease;
}

.rule-card-chev svg {
  width: 15px;
  height: 15px;
}

.rule-card-head[data-collapsible]:hover .rule-card-chev {
  color: var(--accent-hi);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.rule-card[data-collapsed="true"] .rule-card-chev {
  transform: rotate(-90deg);
}

.rule-card[data-collapsed="true"] .rule-card-head {
  border-bottom-color: transparent;
}

.rule-card[data-collapsed="true"] .rule-card-body {
  display: none;
}

/* row list */
.rows {
  display: flex;
  flex-direction: column;
}

.rule-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.rule-row:last-child {
  border-bottom: 0;
}

.rule-row-grid-3 {
  grid-template-columns: 1.4fr 1fr 2fr auto;
}

.rule-row-grid-link {
  grid-template-columns: 1fr 2fr auto;
}

.rule-row-grid-1 {
  grid-template-columns: 1fr auto;
}

.rule-row-footer {
  padding: 12px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.add-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}

.add-btn svg {
  width: 14px;
  height: 14px;
}

.add-btn:hover {
  border-color: var(--accent-line);
  color: var(--accent-hi);
  background: var(--accent-soft);
}

/* link-violation two-column inline form */
.link-form {
  display: grid;
  grid-template-columns: 1fr 2.2fr;
  gap: 12px;
  padding-top: 12px;
}

.link-form .field {
  margin-bottom: 0;
}

/* ─────────────────── Save bar ─────────────────── */
.savebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  position: sticky;
  bottom: 18px;
  box-shadow: var(--shadow-2), var(--inset-hi-soft);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition:
    border-color var(--t-med) ease,
    box-shadow var(--t-med) ease;
  flex-wrap: wrap;
}

.savebar-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.savebar-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  flex: 0 0 auto;
}

.savebar[data-dirty="true"] {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-2), var(--glow-accent);
}

.savebar[data-dirty="true"] .savebar-icon {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
  animation: pulse 1.8s ease-in-out infinite;
}

.savebar[data-dirty="true"] .savebar-status {
  color: var(--text);
}

/* forward-compatible explicit statuses — JS may set data-state later */
.savebar[data-state="saving"] .savebar-icon {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
  animation: pulse 1.2s ease-in-out infinite;
}

.savebar[data-state="error"] {
  border-color: rgba(224, 106, 106, 0.45);
}

.savebar[data-state="error"] .savebar-icon {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
  animation: none;
}

.savebar-actions {
  display: flex;
  gap: 10px;
}

.save-hint {
  margin: 12px 4px 0;
  font-size: 11.5px;
  color: var(--text-faint);
}

.save-hint code {
  color: var(--text-muted);
}

/* ────────────────── Violations table ────────────────── */
.violations-body {
  min-height: 120px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.violations {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
  min-width: 640px;
}

table.violations thead th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-2);
  white-space: nowrap;
}

table.violations tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text-muted);
}

table.violations tbody tr:last-child td {
  border-bottom: 0;
}

table.violations tbody tr {
  transition: background var(--t-fast) ease;
}

table.violations tbody tr:hover {
  background: var(--surface-hover);
}

table.violations tbody tr {
  opacity: 0;
  animation: fade-in 0.3s var(--ease) forwards;
}

/* capped stagger — rows ripple in, the tail arrives together */
table.violations tbody tr:nth-child(2) {
  animation-delay: 0.02s;
}

table.violations tbody tr:nth-child(3) {
  animation-delay: 0.04s;
}

table.violations tbody tr:nth-child(4) {
  animation-delay: 0.06s;
}

table.violations tbody tr:nth-child(5) {
  animation-delay: 0.08s;
}

table.violations tbody tr:nth-child(6) {
  animation-delay: 0.1s;
}

table.violations tbody tr:nth-child(7) {
  animation-delay: 0.12s;
}

table.violations tbody tr:nth-child(n + 8) {
  animation-delay: 0.14s;
}

/* sticky header on wide screens: wrap must not be a scroll container,
   so this only unlocks where the table fits without horizontal scroll */
@media (min-width: 1200px) {
  .table-wrap {
    overflow-x: visible;
  }

  table.violations thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 6px 16px -12px rgba(0, 0, 0, 0.5);
  }
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}

.avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-hi);
  overflow: hidden;
  object-fit: cover;
}

.cell-user .who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cell-user .who .name {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.cell-user .who .uid {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

.kind-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.kind-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.kind-mute {
  color: #f0a6a6;
  background: var(--danger-soft);
  border-color: rgba(224, 106, 106, 0.28);
}

.kind-mute::before {
  background: var(--danger);
}

.kind-warn {
  color: var(--accent-hi);
  background: var(--warn-soft);
  border-color: var(--accent-line);
}

.kind-warn::before {
  background: var(--accent);
}

.kind-ban {
  color: #efc98d;
  background: rgba(224, 154, 106, 0.13);
  border-color: rgba(224, 154, 106, 0.3);
}

.kind-ban::before {
  background: #e09a6a;
}

.kind-kick {
  color: var(--text-muted);
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.kind-kick::before {
  background: var(--text-faint);
}

.kind-verbal {
  color: #aec9e5;
  background: rgba(110, 168, 216, 0.12);
  border-color: rgba(110, 168, 216, 0.28);
}

.kind-verbal::before {
  background: var(--info);
}

.kind-unknown {
  color: var(--text-muted);
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.kind-unknown::before {
  background: var(--text-faint);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-complete {
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid rgba(95, 185, 133, 0.26);
}

.status-complete::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.status-pending {
  color: var(--accent-hi);
  background: var(--warn-soft);
  border: 1px solid var(--accent-line);
}

.status-pending::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.cell-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.cell-reason {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-date {
  white-space: nowrap;
  font-size: var(--fs-sm);
}

/* empty / skeleton / error states (.empty-state is a forward-compatible alias) */
.state-box,
.empty-state {
  padding: 42px var(--s-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-2);
  color: var(--text-muted);
}

.state-box .state-icon,
.empty-state .state-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--inset-hi-soft);
  color: var(--text-faint);
  margin-bottom: 4px;
}

.state-box .state-icon svg,
.empty-state .state-icon svg {
  width: 22px;
  height: 22px;
}

.state-box p,
.empty-state p {
  margin: 0;
  font-size: var(--fs-md);
}

.state-box .state-sub,
.empty-state .state-sub {
  font-size: var(--fs-sm);
  color: var(--text-faint);
}

.skeleton {
  background: linear-gradient(100deg, var(--surface-2) 32%, var(--surface-3) 50%, var(--surface-2) 68%);
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: var(--radius-xs);
}

.skel-row {
  margin: 10px 18px;
  height: 40px;
}

/* ─────────────────── Toasts ─────────────────── */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: var(--fs-md);
  font-weight: 500;
  box-shadow: var(--shadow-3), var(--inset-hi);
  min-width: 240px;
  max-width: 360px;
  animation: toast-in 0.28s var(--ease-spring);
}

.toast.is-out {
  animation: toast-out 0.2s var(--ease) forwards;
}

.toast-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.toast-ok {
  border-left-color: var(--ok);
}

.toast-err {
  border-left-color: var(--danger);
}

.toast-info {
  border-left-color: var(--accent);
}

.toast-ok .toast-icon {
  color: var(--ok);
}

.toast-err .toast-icon {
  color: var(--danger);
}

.toast-info .toast-icon {
  color: var(--accent-hi);
}

/* ─────────────────── Motion ─────────────────── */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.55;
    transform: scale(0.82);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }

  60% {
    opacity: 1;
    transform: translateY(-2px) scale(1.005);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translateX(12px);
  }
}

@keyframes view-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* view switch: fade + rise — display:none → block restarts the animation */
.view {
  animation: view-in var(--t-slow) var(--ease);
}

/* dropdown / combo menus pop in from their top edge */
.dd-menu:not(.is-hidden),
.combo-list:not(.is-hidden) {
  animation: menu-in 0.16s var(--ease);
  transform-origin: top center;
}

/* stagger rule cards in every card grid (rules / shop / permissions);
   display swaps and innerHTML rerenders restart it cheaply.
   backwards — NOT forwards: a forwards fill keeps applying animated
   opacity/transform forever → every card becomes a permanent stacking
   context and open .dd-menu/.combo-list (z-index is scoped to their own
   card) render UNDER later sibling cards and the sticky savebar. */
.rule-grid > .rule-card {
  animation: rise var(--t-slow) var(--ease) backwards;
}

/* an open dropdown owns the sky: lift its whole card above sibling cards,
   the matrix table and the sticky savebars. Covers the sub-second window
   while the entrance animation still runs (cards are stacking contexts
   during it) and any future stacking-context styling on cards. */
.rule-card:has(.dd-menu:not(.is-hidden)),
.rule-card:has(.combo-list:not(.is-hidden)) {
  position: relative;
  z-index: 45; /* above cards/savebar, below nav-backdrop(70)/toasts(100) */
}

.rule-grid > .rule-card:nth-child(1) {
  animation-delay: 0.02s;
}

.rule-grid > .rule-card:nth-child(2) {
  animation-delay: 0.06s;
}

.rule-grid > .rule-card:nth-child(3) {
  animation-delay: 0.1s;
}

.rule-grid > .rule-card:nth-child(4) {
  animation-delay: 0.14s;
}

.rule-grid > .rule-card:nth-child(5) {
  animation-delay: 0.18s;
}

.rule-grid > .rule-card:nth-child(n + 6) {
  animation-delay: 0.22s;
}

/* ─────────────────── Responsive ─────────────────── */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar .brand {
    margin-bottom: 0;
  }

  .sidebar .brand-sub,
  .sidebar .brand-name {
    display: none;
  }

  .sidebar .brand {
    padding: 0;
  }

  .nav {
    flex-direction: row;
  }

  .nav-item .nav-badge {
    display: none;
  }

  .sidebar-foot {
    margin: 0 0 0 auto;
    flex-direction: row;
    border-top: 0;
    padding-top: 0;
  }

  .bot-pill {
    display: none;
  }

  .main {
    padding: 22px 18px 40px;
  }

  .metric-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .rule-row-grid-3 {
    grid-template-columns: 1fr;
  }

  .rule-row-grid-link {
    grid-template-columns: 1fr;
  }

  .link-form {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-form {
    min-height: 100dvh;
    padding: 28px 20px;
  }
}

@media (max-width: 560px) {
  .rule-row-grid-1 {
    grid-template-columns: 1fr;
  }

  .savebar {
    flex-direction: column;
    align-items: stretch;
  }

  .savebar-actions {
    justify-content: stretch;
  }

  .savebar-actions .btn {
    flex: 1;
  }

  .topbar {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   Light theme — [data-theme="light"] overrides (toggle in topbar)
   ═══════════════════════════════════════════════════════════════════ */
html[data-theme="light"] {
  color-scheme: light;

  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #ebeef5;

  --line: rgba(18, 24, 46, 0.09);
  --line-strong: rgba(18, 24, 46, 0.17);

  --text: #161c2e;
  --text-muted: #47516b;
  --text-faint: #6f7994;

  /* cyan accent — same hue as the dark theme, deepened for white-bg legibility */
  --accent: #119fcf;
  --accent-hi: #0e86b0;
  --accent-deep: #0b6f93;
  --accent-soft: rgba(17, 159, 207, 0.1);
  --accent-line: rgba(17, 159, 207, 0.38);

  --ok: #21855b;
  --ok-soft: rgba(33, 133, 91, 0.11);
  --warn: #119fcf;
  --warn-soft: rgba(17, 159, 207, 0.1);
  --danger: #bb3a3a;
  --danger-soft: rgba(187, 58, 58, 0.1);
  --info: #2f6da0;

  --shadow-1: 0 1px 2px rgba(18, 24, 46, 0.07);
  --shadow-2: 0 12px 32px -12px rgba(18, 24, 46, 0.22);
  --shadow-3: 0 28px 72px -24px rgba(18, 24, 46, 0.28), 0 10px 28px -14px rgba(18, 24, 46, 0.16);
  --lift: 0 6px 16px -8px rgba(18, 24, 46, 0.18);

  --surface-hover: #eef1f8;
  --surface-active: #e7ebf4;

  --line-accent: rgba(17, 159, 207, 0.38);

  --inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --inset-hi-soft: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --glow-accent: 0 8px 24px -10px rgba(17, 159, 207, 0.4);
  --ring-accent: 0 0 0 3px var(--accent-soft);
  --grad-panel: linear-gradient(180deg, rgba(18, 24, 46, 0.016), rgba(18, 24, 46, 0) 110px);
  --scrim: rgba(18, 24, 46, 0.32);
}

/* faint indigo wash behind the login split — light variant */
html[data-theme="light"] .login-body {
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(17, 159, 207, 0.08), transparent 60%),
    var(--bg);
}

/* pastel-on-dark tints above are unreadable on white — swap to deep tones */
html[data-theme="light"] .login-error {
  color: #8f2c2c;
}

html[data-theme="light"] .kind-mute {
  color: #a83a3a;
  border-color: rgba(187, 58, 58, 0.32);
}

html[data-theme="light"] .kind-ban {
  color: #92571a;
  background: rgba(192, 122, 58, 0.12);
  border-color: rgba(192, 122, 58, 0.35);
}

html[data-theme="light"] .kind-ban::before {
  background: #c07a3a;
}

html[data-theme="light"] .kind-verbal {
  color: #2f6da0;
  background: rgba(47, 109, 160, 0.1);
  border-color: rgba(47, 109, 160, 0.3);
}

/* theme toggle icons (sidebar) — sun visible in dark, moon in light */
.theme-toggle .icon-moon {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

.btn-icon {
  padding: 9px;
}

/* ───────── User chip (topbar) ───────── */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: var(--shadow-1), var(--inset-hi-soft);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-weight: 700;
  font-size: 13px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-name {
  font-weight: 700;
  font-size: 12.5px;
}

.user-tier {
  font-size: 10.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.user-tier[data-tier="owner"] {
  color: var(--accent-hi);
}

.user-tier[data-tier="high_staff"] {
  color: var(--ok);
}

.user-tier[data-tier="moderator"] {
  color: var(--info);
}

/* ───────── Combo dropdown (member search) ───────── */
.combo {
  position: relative;
}

.combo-list {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3), var(--inset-hi);
  padding: 6px;
}

.combo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-size: var(--fs-md);
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}

.combo-item:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.combo-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

.combo-item.is-selected {
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-weight: 600;
}

.combo-item .avatar {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

.combo-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.combo-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ───────── Badges: punishment state / no-proof / source ───────── */
.punish-badge,
.proof-badge,
.src-badge,
.kind-badge,
.status-badge {
  vertical-align: middle;
}

.punish-badge,
.proof-badge,
.src-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.punish-badge+.proof-badge,
.punish-badge+.src-badge {
  margin-left: 6px;
}

.state-active {
  background: var(--ok-soft);
  color: var(--ok);
}

.state-expired {
  background: var(--warn-soft);
  color: var(--warn);
}

.state-revoked {
  background: var(--surface-3);
  color: var(--text-muted);
}

.proof-badge {
  background: var(--danger-soft);
  color: var(--danger);
}

.src-badge {
  background: var(--accent-soft);
  color: var(--accent-hi);
  margin-left: 6px;
}

/* ───────── Moderation form ───────── */
.mod-actions {
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mod-notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.mod-notes li {
  position: relative;
  padding-left: 20px;
}

.mod-notes li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ───────── Member card ───────── */
.avatar-lg {
  width: 44px;
  height: 44px;
  font-size: 18px;
  flex: 0 0 44px;
}

.member-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  box-shadow: var(--inset-hi-soft);
  font-size: 11.5px;
  color: var(--text-muted);
}

.section-label {
  margin: 18px 0 10px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.active-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}

.active-row:last-child {
  border-bottom: 0;
}

.active-row .cell-reason {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

/* ───────── Permissions matrix ───────── */
.matrix-table td,
.matrix-table th {
  vertical-align: middle;
}

/* denser rhythm than the feed table — it is an editor, not a reader */
.matrix-table tbody td {
  padding-top: 9px;
  padding-bottom: 9px;
}

.matrix-table .input-mini {
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, background var(--t-fast) ease;
}

.matrix-check {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* per-tier grouping — each tier gets its own sub-card with header + table */
.matrix-tier {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--surface-2);
}
.matrix-tier:last-child { margin-bottom: 0; }

.matrix-tier-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.matrix-tier-head .matrix-tier-desc {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.matrix-tier-head .matrix-tier-desc i { color: var(--text-faint); font-style: italic; }

.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.tier-badge.tier-owner { color: #ffd479; background: rgba(255, 196, 0, 0.12); border-color: rgba(255, 196, 0, 0.32); }
.tier-badge.tier-high_staff { color: #8fd0ff; background: rgba(80, 160, 255, 0.12); border-color: rgba(80, 160, 255, 0.32); }
.tier-badge.tier-moderator { color: #b6f0c2; background: rgba(60, 200, 120, 0.12); border-color: rgba(60, 200, 120, 0.32); }

/* staff role ladder — ordered rows, index 0 = highest authority */
.ladder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.ladder-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  transition: border-color 0.15s ease;
}

.ladder-row:hover {
  border-color: var(--line-strong);
}

.ladder-pos {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent-hi);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ladder-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.ladder-row > .uid {
  flex: none;
  color: var(--text-faint);
  font-size: 11.5px;
}

.ladder-actions {
  flex: none;
  display: inline-flex;
  gap: 6px;
}

.ladder-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.ladder-btn:hover:not(:disabled) {
  border-color: var(--accent-line);
  color: var(--accent-hi);
}

.ladder-btn.is-danger:hover:not(:disabled) {
  border-color: rgba(255, 106, 106, 0.55);
  color: #ff9d9d;
}

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

.ladder-add {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.ladder-add-dd {
  flex: 1;
  min-width: 0;
}


.matrix-tier .table-wrap {
  background: var(--surface-2);
  border: none;
  border-radius: 0;
  margin: 0;
}
.matrix-tier .matrix-table thead th {
  background: var(--surface-2);
  font-size: 11.5px;
}

/* ───────── Searchable dropdown (roles / channels) ───────── */
.dd {
  position: relative;
}

.dd-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dd-toggle:hover {
  border-color: var(--accent-line);
}

.dd-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dd-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.dd-label.is-placeholder {
  color: var(--text-faint);
  font-weight: 500;
}

.dd-chevron {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: var(--text-faint);
}

.dd-toggle[aria-expanded="true"] {
  border-color: var(--accent-line);
  background: var(--surface-hover);
}

.dd-toggle[aria-expanded="true"] .dd-chevron {
  transform: rotate(180deg);
}

.dd-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3), var(--inset-hi);
  padding: 8px;
}

.dd-search {
  width: 100%;
  margin-bottom: 6px;
}

.dd-list {
  max-height: 240px;
  overflow-y: auto;
  display: grid;
  gap: 2px;
}

.dd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font-size: var(--fs-md);
  cursor: pointer;
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}

.dd-item:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.dd-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

.dd-item.is-selected {
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-weight: 600;
}

.dd-check {
  width: 16px;
  flex: 0 0 16px;
  display: inline-flex;
  color: var(--accent-hi);
}

.dd-check svg {
  width: 14px;
  height: 14px;
}

.dd-item-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ───────── Login: Discord button + local fallback toggle ───────── */
.btn-discord {
  background: #5865f2;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px -6px rgba(88, 101, 242, 0.6);
}

.btn-discord:hover {
  background: #4753e0;
  transform: translateY(-1px);
  box-shadow: 0 10px 26px -8px rgba(88, 101, 242, 0.7);
}

.btn-discord:active {
  transform: translateY(0) scale(0.98);
}

.btn-discord svg {
  width: 18px;
  height: 18px;
}

.btn-discord.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.local-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 2px;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.local-toggle:hover {
  color: var(--text-muted);
}

.local-toggle .chevron {
  font-size: 10px;
}

/* ═══════════════ Details & delight ═══════════════ */

/* «Показать ещё» — comfortable tap target, centered by panel.js .feed-more */
.feed-more .btn {
  min-width: 200px;
}

/* theme toggle: sun spins away on hover — springy, cheap, guarded */
#themeToggle svg {
  transition: transform var(--t-med) var(--ease-spring);
}

#themeToggle:hover .icon-sun {
  transform: rotate(90deg);
}

#themeToggle:hover .icon-moon {
  transform: rotate(-14deg) scale(1.08);
}

/* ═══════════════════════════════════════════════════════════════════
   Light theme — component-level refinements (deliberately last)
   ═══════════════════════════════════════════════════════════════════ */

html[data-theme="light"] body {
  background:
    radial-gradient(1000px 520px at 12% -12%, rgba(17, 159, 207, 0.06), transparent 62%),
    radial-gradient(900px 520px at 105% 115%, rgba(17, 159, 207, 0.04), transparent 60%),
    var(--bg);
}

html[data-theme="light"] ::selection {
  background: rgba(17, 159, 207, 0.2);
  color: var(--text);
}

html[data-theme="light"] * {
  scrollbar-color: rgba(18, 24, 46, 0.22) transparent;
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(18, 24, 46, 0.2);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background-color: rgba(18, 24, 46, 0.34);
}

html[data-theme="light"] .login-brand::before {
  opacity: 0.4;
}

html[data-theme="light"] table.violations thead th {
  box-shadow: 0 6px 16px -12px rgba(18, 24, 46, 0.25);
}

/* ── light-theme component refinements (final pass) ── */

html[data-theme="light"] .seg-item:hover:not(.is-active) {
  background: rgba(18, 24, 46, 0.05);
}

/* the neon edge glow reads dirty on white — soften to a tint */
html[data-theme="light"] .nav-item.is-active::before {
  box-shadow: 0 0 12px rgba(17, 159, 207, 0.3);
}

html[data-theme="light"] .point-icon {
  border-color: rgba(33, 133, 91, 0.28);
}

/* white ring on the accent pill is invisible on a light page — use ink */
html[data-theme="light"] .skip-link:focus-visible {
  outline-color: rgba(18, 24, 46, 0.65);
}

/* ═══════════════════════════════════════════════════════════════════
   Режим невероятной эпилепсии — html[data-epilepsy="on"]
   Rainbow hue-spin + diagonal stripe slide + jitter, deliberately last
   so it beats both themes. Toggle: #epilepsyToggle / palette / Esc.
   ═══════════════════════════════════════════════════════════════════ */

/* sidebar button — zap icon slowly cycles hues even when idle */
.epilepsy-toggle .ep-zap {
  animation: ep-zap-idle 4s linear infinite;
}

@keyframes ep-zap-idle {
  from {
    filter: hue-rotate(0deg) drop-shadow(0 0 5px rgba(255, 0, 128, 0.4));
  }
  to {
    filter: hue-rotate(360deg) drop-shadow(0 0 5px rgba(255, 0, 128, 0.4));
  }
}

#epilepsyToggle[aria-pressed="true"] {
  color: #fff;
  font-weight: 700;
  background: linear-gradient(
    90deg,
    #ff004c,
    #ff9e00,
    #ffee00,
    #00d26a,
    #00c2ff,
    #8a2be2,
    #ff004c
  );
  background-size: 400% 100%;
  animation: ep-btn-slide 0.6s linear infinite;
}

@keyframes ep-btn-slide {
  from {
    background-position: 0% 0;
  }
  to {
    background-position: 400% 0;
  }
}

/* three foot buttons don't fit the 232px rail on one line — let them wrap */
@media (min-width: 901px) {
  .sidebar-foot {
    flex-wrap: wrap;
  }
}

/* ── mode itself ──
   hue-spin goes on .main/.sidebar (NOT html/body): filter on root would
   re-anchor position:fixed overlays (modals, toasts) to the document box */

html[data-epilepsy="on"] body {
  background-image: repeating-linear-gradient(
    45deg,
    #ff004c 0px,
    #ff9e00 60px,
    #ffee00 120px,
    #00d26a 180px,
    #00c2ff 240px,
    #8a2be2 300px,
    #ff004c 360px
  );
  background-size: 1600px 1600px;
  animation: ep-bg-slide 0.5s linear infinite;
}

@keyframes ep-bg-slide {
  /* one full stripe period along both axes (360px / √2) → seamless loop */
  from {
    background-position: 0 0;
  }
  to {
    background-position: 254.56px -254.56px;
  }
}

html[data-epilepsy="on"] .main,
html[data-epilepsy="on"] .sidebar {
  animation: ep-hue-spin 1.1s linear infinite;
}

@keyframes ep-hue-spin {
  from {
    filter: hue-rotate(0deg) saturate(3.2) contrast(1.15);
  }
  to {
    filter: hue-rotate(360deg) saturate(3.2) contrast(1.15);
  }
}

/* translucent surfaces so the stripes shine through everything */
html[data-epilepsy="on"] .sidebar,
html[data-epilepsy="on"] .rule-card,
html[data-epilepsy="on"] .panel,
html[data-epilepsy="on"] .metric,
html[data-epilepsy="on"] .savebar,
html[data-epilepsy="on"] .state-box,
html[data-epilepsy="on"] .toast,
html[data-epilepsy="on"] .combo-list,
html[data-epilepsy="on"] .dd-menu,
html[data-epilepsy="on"] input,
html[data-epilepsy="on"] select {
  background: rgba(10, 6, 24, 0.55) !important;
}

/* cursed typography — non-negotiable part of the experience */
html[data-epilepsy="on"],
html[data-epilepsy="on"] * {
  font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", cursive !important;
}

/* headings wobble, avatars and the brand slash spin */
html[data-epilepsy="on"] h1,
html[data-epilepsy="on"] h2,
html[data-epilepsy="on"] h3 {
  display: inline-block;
  animation: ep-wobble 0.32s ease-in-out infinite alternate;
}

@keyframes ep-wobble {
  from {
    transform: rotate(-2.2deg) scale(1.03);
  }
  to {
    transform: rotate(2.2deg) scale(0.97);
  }
}

html[data-epilepsy="on"] .avatar,
html[data-epilepsy="on"] .user-avatar,
html[data-epilepsy="on"] .brand-name em,
html[data-epilepsy="on"] .bot-pill .dot {
  animation: ep-spin 0.9s linear infinite;
}

@keyframes ep-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── floating random images layer (spawned by panel.js) ── */

#epLayer {
  position: fixed;
  inset: 0;
  z-index: 125; /* above content, below modals (130) and toasts (140) */
  overflow: hidden;
  pointer-events: none;
}

#epLayer img {
  position: absolute;
  bottom: 0;
  border-radius: 12px;
  border: 3px solid #fff;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  will-change: transform, opacity;
  animation: ep-float var(--dur, 3s) linear forwards;
}

@keyframes ep-float {
  0% {
    transform: translate(0, 15vh) rotate(var(--rot0, 0deg)) scale(0.55);
    opacity: 0;
  }
  7% {
    opacity: 1;
  }
  92% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx, 60px), -135vh) rotate(var(--rot1, 360deg))
      scale(1.08);
    opacity: 0;
  }
}

/* ── scurrying bug emojis (spawned by panel.js) ── */

#epLayer .ep-bug {
  position: absolute;
  font-size: var(--size, 30px);
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
  will-change: transform;
  animation: ep-run var(--dur, 4s) linear forwards;
}

/* travel --dist across the viewport while bobbing and twitching like a beetle */
@keyframes ep-run {
  0% {
    transform: translate(0, 0) scaleX(var(--flip, 1)) rotate(0deg);
  }
  14% {
    transform: translate(calc(var(--dist, 0px) * 0.14), -7px)
      scaleX(var(--flip, 1)) rotate(-9deg);
  }
  28% {
    transform: translate(calc(var(--dist, 0px) * 0.28), 6px)
      scaleX(var(--flip, 1)) rotate(8deg);
  }
  42% {
    transform: translate(calc(var(--dist, 0px) * 0.42), -6px)
      scaleX(var(--flip, 1)) rotate(-7deg);
  }
  56% {
    transform: translate(calc(var(--dist, 0px) * 0.56), 7px)
      scaleX(var(--flip, 1)) rotate(10deg);
  }
  70% {
    transform: translate(calc(var(--dist, 0px) * 0.7), -5px)
      scaleX(var(--flip, 1)) rotate(-8deg);
  }
  84% {
    transform: translate(calc(var(--dist, 0px) * 0.84), 6px)
      scaleX(var(--flip, 1)) rotate(7deg);
  }
  100% {
    transform: translate(var(--dist, 0px), 0) scaleX(var(--flip, 1))
      rotate(0deg);
  }
}

/* ───────── Permissions view — perm role cards ───────── */
.permissions-add-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 2px 0 18px;
}

.permissions-add-row .field-hint {
  flex: 1 1 260px;
  margin: 0;
}

.perm-role-card .rule-card-head {
  align-items: center;
}

.perm-name-input {
  width: 100%;
  max-width: 320px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 15.5px;
  font-weight: 700;
}

.perm-name-input:focus {
  outline: none;
  border-color: var(--accent-line);
}

.perm-limit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.perm-limit-row:last-of-type {
  border-bottom: none;
}

.perm-limit-row .input-mini {
  flex: 0 1 180px;
}

.perm-limit-row select.input-mini {
  flex: 0 1 150px;
}

.perm-role-card .btn-ghost {
  padding: 7px 12px;
  font-size: 13px;
}

/* end of panel.css */
