@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-2: #f6f9f7;
  --surface-3: #e9efeb;
  --surface-sunken: #eef3f0;

  --ink: #0b1a12;
  --ink-2: #2c4136;
  --ink-3: #5b7366;
  --ink-4: #8ea397;

  --line: #dde6e0;
  --line-2: #c7d4cc;

  --accent: #0d8a4a;
  --accent-2: #0a6f3b;
  --accent-soft: #e6f5ec;
  --accent-line: #b5e2c8;
  --on-accent: #ffffff;
  --ring: rgba(13, 138, 74, 0.22);
  --glow: none;

  --info: #0e7490;
  --info-soft: #e3f4f8;

  --success: #067647;
  --success-soft: #ecfdf3;
  --danger: #c4320a;
  --danger-2: #a62a08;
  --danger-soft: #fef3f2;
  --danger-line: #fecdca;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --neutral-soft: #edf2ef;
  --row-selected: #e6f5ec;

  --scrim: rgba(4, 10, 7, 0.55);
  --grid-line: color-mix(in srgb, var(--accent) 9%, transparent);
  --glass: color-mix(in srgb, var(--surface) 78%, transparent);

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

  --shadow-xs: 0 1px 2px rgba(11, 26, 18, 0.05);
  --shadow-sm: 0 1px 3px rgba(11, 26, 18, 0.08), 0 1px 2px rgba(11, 26, 18, 0.04);
  --shadow: 0 8px 24px -6px rgba(11, 26, 18, 0.12), 0 2px 6px -2px rgba(11, 26, 18, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(11, 26, 18, 0.22);

  --sidebar-w: 248px;
  --topbar-h: 60px;

  --font-sans: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code", monospace;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #050807;
  --surface: #0a0f0c;
  --surface-2: #0d1410;
  --surface-3: #142019;
  --surface-sunken: #060a08;

  --ink: #d6f5e2;
  --ink-2: #a3c9b2;
  --ink-3: #6b9079;
  --ink-4: #47634f;

  --line: #15221a;
  --line-2: #213528;

  --accent: #3ddc84;
  --accent-2: #74efa8;
  --accent-soft: rgba(61, 220, 132, 0.09);
  --accent-line: rgba(61, 220, 132, 0.32);
  --on-accent: #03120a;
  --ring: rgba(61, 220, 132, 0.28);
  --glow: 0 0 12px rgba(61, 220, 132, 0.35);

  --info: #4fd1e8;
  --info-soft: rgba(79, 209, 232, 0.1);

  --success: #3ddc84;
  --success-soft: rgba(61, 220, 132, 0.1);
  --danger: #ff6b6b;
  --danger-2: #ff9b9b;
  --danger-soft: rgba(255, 107, 107, 0.1);
  --danger-line: rgba(255, 107, 107, 0.35);
  --warning: #f5c542;
  --warning-soft: rgba(245, 197, 66, 0.1);
  --neutral-soft: #142019;
  --row-selected: rgba(61, 220, 132, 0.08);

  --scrim: rgba(0, 0, 0, 0.65);
  --grid-line: rgba(61, 220, 132, 0.07);
  --glass: rgba(8, 14, 10, 0.72);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.55);
  --shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.8);
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 430;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open,
body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

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

::selection { background: var(--accent); color: var(--on-accent); }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

:root[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 80% -20%, rgba(61, 220, 132, 0.05), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

svg { display: block; }

.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: absolute;
  left: -999px;
  top: 12px;
  z-index: 200;
  background: var(--accent);
  color: var(--on-accent);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { left: 12px; text-decoration: none; }

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

.mono { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: -0.01em; }
.muted { color: var(--ink-4); }

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--shadow-xs);
}
:root[data-theme="dark"] .brand__mark {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  box-shadow: var(--glow);
}
.brand__mark svg { width: 60%; height: 60%; }
.brand__name { font-family: var(--font-mono); font-weight: 650; letter-spacing: -0.03em; font-size: 0.95rem; white-space: nowrap; }
.brand__name::after { content: "_"; color: var(--accent); margin-left: 1px; animation: caret 1.1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.brand--lg .brand__mark { width: 40px; height: 40px; border-radius: 11px; }
.brand--lg .brand__name { font-size: 1.15rem; }

.auth-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow: hidden;
  background:
    radial-gradient(900px 480px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.auth-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, color-mix(in srgb, var(--ink) 3%, transparent) 2px 3px);
}
.auth-bg { position: absolute; inset: 0; pointer-events: none; }
.auth-bg__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 30%, #000, transparent 75%);
  mask-image: radial-gradient(ellipse 60% 50% at 50% 30%, #000, transparent 75%);
}
.auth-card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  background: var(--glass);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: -4px;
  pointer-events: none;
  background:
    linear-gradient(var(--accent), var(--accent)) top left / 14px 2px,
    linear-gradient(var(--accent), var(--accent)) top left / 2px 14px,
    linear-gradient(var(--accent), var(--accent)) bottom right / 14px 2px,
    linear-gradient(var(--accent), var(--accent)) bottom right / 2px 14px;
  background-repeat: no-repeat;
}
.auth-card__head { display: flex; flex-direction: column; gap: 6px; }
.auth-card__eyebrow { font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent); letter-spacing: 0.02em; }
.auth-card__title { font-size: 1.3rem; font-family: var(--font-mono); letter-spacing: -0.04em; }
.auth-card__subtitle { color: var(--ink-3); }
.auth-card__foot { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-4); text-align: center; }

.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  transition: width 0.2s var(--ease), transform 0.25s var(--ease);
  z-index: 50;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}
.sidebar__section {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  color: var(--ink-4);
  font-weight: 500;
  padding: 14px 10px 6px;
  white-space: nowrap;
}
.sidebar__section::before { content: "// "; color: var(--accent); opacity: 0.7; }
.sidebar__section:first-child { padding-top: 4px; }
.sidebar__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.sidebar__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  font-family: var(--font-mono);
  font-weight: 650;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
.sidebar__user { display: flex; flex-direction: column; min-width: 0; }
.sidebar__username { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__role { font-size: 0.75rem; color: var(--ink-3); text-transform: capitalize; }

.navlink {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 520;
  white-space: nowrap;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.navlink:hover { color: var(--ink); background: var(--surface-3); text-decoration: none; }
.navlink[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.navlink[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: var(--glow);
}
:root[data-theme="dark"] .navlink[aria-current="page"] { text-shadow: 0 0 10px rgba(61, 220, 132, 0.35); }
.navlink__icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.navlink__icon svg { width: 19px; height: 19px; }
.navlink__label { overflow: hidden; text-overflow: ellipsis; }

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  animation: fade-in 0.2s var(--ease);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { display: none; font-weight: 650; font-size: 0.98rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar__divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.topbar__user {
  font-size: 0.82rem;
  color: var(--ink-2);
  font-weight: 550;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.content {
  flex: 1;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page { display: flex; flex-direction: column; gap: 20px; animation: page-in 0.25s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page__heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.page__title { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 650; letter-spacing: -0.04em; overflow-wrap: anywhere; }
.page__title::before { content: "> "; color: var(--accent); font-weight: 500; }
.page__subtitle { color: var(--ink-3); max-width: 72ch; }
.page__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.breadcrumb svg { width: 15px; height: 15px; }
.breadcrumb:hover { color: var(--accent); text-decoration: none; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.stat__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat__label { font-size: 0.8rem; color: var(--ink-3); font-weight: 550; }
.stat__icon {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--neutral-soft);
  color: var(--ink-3);
  flex: none;
}
.stat__icon svg { width: 16px; height: 16px; }
.stat__value {
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat--info .stat__icon { background: var(--info-soft); color: var(--info); }
.stat--success .stat__icon { background: var(--success-soft); color: var(--success); }
.stat--danger .stat__icon { background: var(--danger-soft); color: var(--danger); }

.panel {
  container: panel / inline-size;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  min-width: 0;
}
.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.panel__title { font-family: var(--font-mono); font-size: 0.88rem; font-weight: 600; letter-spacing: -0.02em; }
.panel__body { padding: 20px; }
.panel__body--flush { padding: 0; }
.panel__body--scroll { max-height: 520px; overflow-y: auto; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  color: inherit;
  transition: background 0.12s var(--ease);
}
.list__row:hover { background: var(--surface-2); text-decoration: none; }
.list__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.list__title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__meta { font-size: 0.78rem; color: var(--ink-3); }
.list__main .progress { max-width: 260px; margin-top: 2px; }
.list__chevron { color: var(--ink-4); flex: none; }
.list__chevron svg { width: 16px; height: 16px; }
.list-skeleton { padding: 20px; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.summary-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.summary { color: var(--ink-2); font-size: 0.82rem; }

.bulkbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px 8px 20px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-line);
  animation: fade-in 0.15s var(--ease);
}
.bulkbar__count { font-weight: 600; color: var(--accent); font-size: 0.84rem; }
.bulkbar__actions { display: flex; gap: 8px; }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field--inline { flex: 1 1 160px; max-width: 220px; }
.field--grow { flex: 2 1 220px; max-width: 320px; }
.field--search { position: relative; flex: 3 1 240px; }
.field__icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-4);
  pointer-events: none;
}
.field__icon svg { width: 16px; height: 16px; }
.field--search .field__input { padding-left: 34px; width: 100%; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field__label { font-size: 0.82rem; font-weight: 580; color: var(--ink-2); padding: 0; }
.field__optional { font-weight: 450; color: var(--ink-4); margin-left: 4px; }
.field__input {
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink);
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  min-width: 0;
  width: 100%;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
select.field__input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
  text-overflow: ellipsis;
}
.field__input::placeholder { color: var(--ink-4); }
.field__input--area {
  height: auto;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  resize: vertical;
  line-height: 1.55;
}
.field__input:hover { border-color: var(--ink-4); }
.field__input:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}
.field__input--invalid,
.field__input[aria-invalid="true"] { border-color: var(--danger); }
.field__input--invalid:focus-visible,
.field__input[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 4px var(--danger-soft); }
.field__error { font-size: 0.78rem; color: var(--danger); font-weight: 550; }
.field__hint { font-size: 0.78rem; color: var(--ink-3); }
.field__hint code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.form__error {
  padding: 10px 12px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 550;
}

.checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}
.checkbox:disabled { cursor: not-allowed; opacity: 0.4; }

.scope-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.scope-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.scope-option:hover { border-color: var(--line-2); background: var(--surface-2); }
.scope-option:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.scope-option .checkbox { margin-top: 2px; }
.scope-option__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.scope-option__name { font-weight: 600; font-family: var(--font-mono); font-size: 0.76rem; }
.scope-option__desc { color: var(--ink-3); font-size: 0.76rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.button:hover { text-decoration: none; }
.button svg { width: 16px; height: 16px; flex: none; }
.button [data-icon] { display: inline-flex; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.button--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-xs); }
.button--primary:hover:not(:disabled) { background: var(--accent-2); }
:root[data-theme="dark"] .button--primary:hover:not(:disabled) { box-shadow: var(--glow); }
.button--ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink-2); box-shadow: var(--shadow-xs); }
.button--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.button--danger { background: var(--danger); color: #fff; box-shadow: var(--shadow-xs); }
:root[data-theme="dark"] .button--danger { background: #d63c3c; }
.button--danger:hover:not(:disabled) { background: var(--danger-2); }
:root[data-theme="dark"] .button--danger:hover:not(:disabled) { background: #b83030; }
.button--danger:focus-visible { box-shadow: 0 0 0 4px var(--danger-soft); }
.button--danger-ghost { background: var(--surface); border-color: var(--danger-line); color: var(--danger); box-shadow: var(--shadow-xs); }
.button--danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.button--block { width: 100%; }
.button--sm { height: 32px; padding: 0 11px; font-size: 0.8rem; }
.button--sm svg { width: 14px; height: 14px; }
.button--lg { height: 44px; font-size: 0.92rem; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  display: none;
  flex: none;
}
.button--loading .spinner { display: inline-block; animation: spin 0.7s linear infinite; }
.button--loading { cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  flex: none;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-3);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.icon-button:hover:not(:disabled) { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.icon-button:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-button svg { width: 16px; height: 16px; }
.icon-button [data-icon] { display: inline-flex; }
.icon-button--ghost { border-color: transparent; background: transparent; width: 36px; height: 36px; }
.icon-button--ghost:hover:not(:disabled) { background: var(--surface-3); }
.icon-button--ghost svg { width: 18px; height: 18px; }
.icon-button--danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }

.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table thead th {
  height: 42px;
  padding-top: 0;
  padding-bottom: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: lowercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-weight: 500;
}
.table tbody tr { border-bottom: 1px solid var(--line); transition: background 0.12s var(--ease); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-selected { background: var(--row-selected); }
.table .is-actions { position: sticky; right: 0; background: var(--surface); }
.table thead .is-actions { background: var(--surface-2); }
.table tbody tr:hover .is-actions { background: var(--surface-2); }
.table tbody tr.is-selected .is-actions { background: var(--row-selected); }
.table-wrap.is-scrollable .is-actions { box-shadow: -8px 0 12px -10px rgba(16, 24, 40, 0.35); }
.table tbody tr.table__message:hover,
.table tbody tr.table__skeleton:hover { background: transparent; }
.table .is-numeric { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.table .is-select { width: 1%; padding-right: 4px; }
.table .is-actions { text-align: right; width: 1%; white-space: nowrap; }
.table .is-primary { color: var(--ink); white-space: nowrap; }
.table .is-truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.table .is-wide { min-width: 280px; }
.table td { color: var(--ink-2); }
.table strong { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 0.76rem; color: var(--ink-3); margin-top: 2px; }
.link-strong { font-weight: 600; }
.code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--surface-3);
  color: var(--ink-2);
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
}

.row-actions { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 550;
  white-space: nowrap;
  text-transform: lowercase;
  background: var(--neutral-soft);
  color: var(--ink-2);
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge--queued,
.badge--stopping,
.badge--pending { background: var(--warning-soft); color: var(--warning); }
.badge--running { background: var(--info-soft); color: var(--info); }
.badge--running::before { animation: pulse 1.6s ease-in-out infinite; }
.badge--completed,
.badge--active { background: var(--success-soft); color: var(--success); }
.badge--failed,
.badge--revoked,
.badge--blocked,
.badge--blocked-403 { background: var(--danger-soft); color: var(--danger); }
.badge--cancelled,
.badge--expired { background: var(--neutral-soft); color: var(--ink-3); }
.badge-host { display: inline-flex; align-items: center; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-3);
  font-size: 0.72rem;
  color: var(--ink-2);
  font-weight: 550;
  white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; flex: none; }
#apikeys-table .chip { font-family: var(--font-mono); font-size: 0.7rem; }
#questions-table .chip { text-transform: capitalize; }

.progress { display: flex; align-items: center; gap: 10px; }
.progress__bar {
  flex: 1;
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  min-width: 48px;
}
.progress__fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: var(--glow);
  transition: width 0.35s var(--ease);
}
.progress__label { min-width: 4ch; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.8rem; color: var(--ink-2); text-align: right; }
.progress--sm .progress__bar { height: 6px; }
.progress--lg .progress__bar { height: 10px; }
.progress--lg .progress__label { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 680; color: var(--ink); min-width: 6ch; }
.progress--cell { min-width: 140px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 20px 0 0;
}
.metrics div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.metrics dt { font-size: 0.74rem; color: var(--ink-3); font-weight: 550; }
.metrics dd { margin: 0; font-weight: 620; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; color: var(--ink); }
.metrics--inline { margin: 0; }

.eventlog {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}
.eventlog li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  border-radius: var(--radius-xs);
  overflow-wrap: anywhere;
  color: var(--ink-2);
}
.eventlog__seq { color: var(--ink-4); flex: none; }
.eventlog li.eventlog__empty { border: 1px dashed var(--line-2); background: transparent; color: var(--ink-3); font-family: var(--font-sans); justify-content: center; padding: 20px; }
.eventlog__name { font-weight: 650; color: var(--ink); flex: none; }
.eventlog__text { min-width: 0; }
.eventlog li.event--lifecycle,
.eventlog li.event--snapshot { border-left-color: var(--info); }
.eventlog li.event--item_started { border-left-color: var(--accent-line); }
.eventlog li.event--log { border-left-color: var(--warning); }
.eventlog li.event--item_saved { border-left-color: var(--success); }
.eventlog li.event--error,
.eventlog li.event--terminal { border-left-color: var(--danger); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.pagination__info { color: var(--ink-3); font-size: 0.82rem; }
.pagination__info strong { color: var(--ink); font-weight: 600; }
.pagination__controls { display: flex; gap: 8px; align-items: center; }
.pagination__page { font-size: 0.8rem; color: var(--ink-2); font-weight: 550; padding: 0 4px; white-space: nowrap; }

.empty {
  padding: 48px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.empty__icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--ink-3);
  margin-bottom: 6px;
}
.empty__icon svg { width: 22px; height: 22px; }
.empty__title { font-weight: 620; color: var(--ink); }
.empty__text { color: var(--ink-3); font-size: 0.84rem; max-width: 44ch; }
.table__message td { padding: 0 !important; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-xs);
  height: 12px;
  min-width: 24px;
}
.skeleton--block { height: 56px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 520;
}
.alert--error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.alert--warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert--success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }

.callout {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.84rem;
}
.callout--accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); font-weight: 550; }

.hint { color: var(--ink-3); font-size: 0.8rem; }
.hint--inline { margin: 0; }
.hint[data-status="live"] { color: var(--success); }
.hint[data-status="live"]::before { content: "● "; }
.hint[data-status="connecting"],
.hint[data-status="reconnecting"] { color: var(--warning); }

.linklike {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 520;
  text-align: left;
  cursor: pointer;
  line-height: 1.45;
}
.linklike:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.question-text { white-space: pre-wrap; font-weight: 550; line-height: 1.6; color: var(--ink); font-size: 0.92rem; }
.question-image { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); }

.option-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.option-list__item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.option-list__item--selected { border-color: var(--accent-line); background: var(--accent-soft); }
.option-list__marker {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--ink-2);
  flex: none;
}
.option-list__item--selected .option-list__marker { background: var(--accent); color: var(--on-accent); }
.option-list__text { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 1px; }
.option-list__check { color: var(--accent); flex: none; }
.option-list__check svg { width: 16px; height: 16px; }

.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal__backdrop { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); animation: fade-in 0.15s var(--ease); }
.modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(88vh, 880px);
  max-height: min(88dvh, 880px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: modal-in 0.2s var(--ease);
}
.modal__panel > .form { display: flex; flex-direction: column; gap: 0; min-height: 0; flex: 1; }
.modal__panel--sm { width: min(440px, 100%); }
.modal__panel--lg { width: min(720px, 100%); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 16px 24px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.modal__title { font-size: 1.05rem; font-weight: 650; overflow-wrap: anywhere; }
.modal__body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; min-height: 0; flex: 1; }
.modal__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex: none;
  flex-wrap: wrap;
}
.modal__actions--split { justify-content: space-between; }
.modal__actions-group { display: flex; gap: 8px; margin-left: auto; }

.confirm { flex-direction: row; align-items: flex-start; gap: 16px; padding-top: 24px; }
.confirm__icon {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  flex: none;
}
.confirm__icon svg { width: 20px; height: 20px; }
.confirm__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.confirm__message { color: var(--ink-3); font-size: 0.86rem; line-height: 1.55; }
.confirm__guard { display: flex; flex-direction: column; gap: 6px; padding: 0 24px 20px 80px; }
.confirm__guard strong { font-family: var(--font-mono); color: var(--danger); }

.secret-row { display: flex; gap: 8px; align-items: stretch; }
.secret {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 10px 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  word-break: break-all;
  max-height: 140px;
  overflow-y: auto;
  color: var(--ink);
}
.secret-row .button { height: auto; }

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 520;
  border: 1px solid var(--line);
  pointer-events: auto;
  animation: toast-in 0.22s var(--ease);
}
.toast--leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.18s, transform 0.18s; }
.toast__icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none; background: var(--accent-soft); color: var(--accent); }
.toast__icon svg { width: 13px; height: 13px; stroke-width: 2.4; }
.toast__message { flex: 1; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.toast__close { border: 0; background: transparent; color: var(--ink-4); cursor: pointer; padding: 2px; border-radius: 4px; flex: none; }
.toast__close:hover { color: var(--ink); }
.toast__close svg { width: 14px; height: 14px; }
.toast--success .toast__icon { background: var(--success-soft); color: var(--success); }
.toast--error .toast__icon { background: var(--danger-soft); color: var(--danger); }
.toast--error { border-color: var(--danger-line); }
.toast--warning .toast__icon { background: var(--warning-soft); color: var(--warning); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.info__toggle {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  flex: none;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.info__toggle:hover,
.info__toggle[aria-expanded="true"] { background: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.info__toggle:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.info__pop {
  position: absolute;
  top: calc(100% - 4px);
  right: 12px;
  z-index: 30;
  width: min(340px, calc(100% - 24px));
  padding: 10px 12px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 450;
  line-height: 1.55;
  animation: fade-in 0.15s var(--ease);
}
.info__pop::before { content: "i "; font-family: var(--font-mono); font-style: italic; font-weight: 700; color: var(--accent); }
.info__pop code { font-size: 0.74rem; color: var(--ink); background: color-mix(in srgb, var(--surface-3) 70%, transparent); padding: 0 4px; border-radius: 3px; overflow-wrap: anywhere; }

.guide-card { overflow: visible; container-type: normal; }
.guide-card__head { position: relative; flex-wrap: nowrap; }
.guide-card__head .panel__title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.guide-step {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  flex: none;
}
.guide-card__body { display: flex; flex-direction: column; gap: 14px; color: var(--ink-2); line-height: 1.6; }
.guide-card__body .code { white-space: normal; overflow-wrap: anywhere; }
.guide-note { font-size: 0.8rem; color: var(--ink-3); }

.codeblock {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  min-width: 0;
}
.codeblock__label {
  display: block;
  padding: 8px 48px 8px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-3);
}
.codeblock__label code { color: var(--ink-2); }
.codeblock__copy { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; background: var(--surface); }
.codeblock pre,
.guide-event__frame {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--ink);
  tab-size: 2;
}
.codeblock__copy + pre { padding-right: 44px; }
.js-origin { color: var(--accent); }

.guide-events { gap: 12px; }
.guide-event { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.guide-event__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.guide-event__name {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-xs);
  padding: 1px 7px;
  flex: none;
}
.guide-event__name--end { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.guide-event__name--muted { color: var(--ink-3); background: var(--neutral-soft); border-color: var(--line-2); }
.guide-event__desc { flex: 1; min-width: 0; font-size: 0.8rem; color: var(--ink-2); }
.guide-event__frame { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-sunken); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

@media (max-width: 640px) {
  .guide-event__head { flex-wrap: wrap; }
  .guide-event__desc { order: 3; flex-basis: 100%; }
  .guide-event__head .info__toggle { margin-left: auto; }
}

@media (min-width: 861px) {
  .app-shell--collapsed { --sidebar-w: 68px; }
  .app-shell--collapsed .sidebar__brand { justify-content: center; padding: 0; }
  .app-shell--collapsed .brand__name,
  .app-shell--collapsed .navlink__label,
  .app-shell--collapsed .sidebar__user { display: none; }
  .app-shell--collapsed .sidebar__section { font-size: 0; padding: 8px 0 4px; }
  .app-shell--collapsed .sidebar__section::after { content: ""; display: block; height: 1px; margin: 0 14px; background: var(--line); }
  .app-shell--collapsed .sidebar__section:first-child { display: none; }
  .app-shell--collapsed .navlink { justify-content: center; padding: 0; }
  .app-shell--collapsed .sidebar__foot { justify-content: center; padding: 14px 0; }
}

@media (max-width: 1280px) {
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .progress--cell { min-width: 96px; }
  .table .is-truncate { max-width: 160px; }
}

@container panel (min-width: 721px) and (max-width: 1000px) {
  .table .is-optional { display: none; }
}

@container panel (max-width: 720px) {
  .table--cards thead { display: none; }
  .table--cards,
  .table--cards tbody { display: block; }
  .table--cards tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 12px;
    padding: 14px 16px;
  }
  .table--cards tbody td {
    grid-column: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 5px 0 !important;
    text-align: right;
    min-width: 0;
    max-width: none;
    white-space: normal;
  }
  .table--cards tbody td[data-label]::before {
    content: attr(data-label);
    color: var(--ink-3);
    font-size: 0.76rem;
    font-weight: 550;
    text-align: left;
    flex: none;
  }
  .table--cards tbody td > * { min-width: 0; }
  .table--cards td.is-select { grid-column: 1; grid-row: 1 / span 12; align-items: flex-start; width: auto; padding-top: 4px !important; }
  .table--cards td.is-primary { order: -1; white-space: normal; overflow-wrap: anywhere; justify-content: flex-start; text-align: left; font-size: 0.92rem; padding-bottom: 8px !important; }
  .table--cards td.is-primary::before { display: none; }
  .table--cards td.is-wide { min-width: 0; }
  .table--cards td.is-truncate { overflow: visible; max-width: none; text-overflow: clip; overflow-wrap: anywhere; }
  .table--cards td.is-actions {
    order: 99;
    position: static;
    background: transparent !important;
    box-shadow: none !important;
    width: auto;
    justify-content: flex-end;
    margin-top: 6px;
    padding-top: 10px !important;
    border-top: 1px dashed var(--line);
  }
  .table--cards .row-actions { flex-wrap: wrap; }
  .table--cards .progress--cell { min-width: 0; flex: 0 1 180px; }
  .table--cards .chip-list { justify-content: flex-end; }
  .table--cards tbody tr.table__message,
  .table--cards tbody tr.table__skeleton { display: block; padding: 0; }
  .table--cards tbody tr.table__message td { display: block; }
  .table--cards tbody tr.table__skeleton { padding: 14px 16px; }
  .table--cards tbody tr.table__skeleton td { display: block; padding: 4px 0 !important; }
  .table--cards tbody tr.table__skeleton td:nth-child(n + 4) { display: none; }
  .table-wrap { overflow-x: visible; }
}

@media (max-width: 1080px) {
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    height: 100%;
    width: min(280px, 84vw);
    transform: translateX(-100%);
    border-right: 0;
    box-shadow: var(--shadow-lg);
    visibility: hidden;
    transition: transform 0.25s var(--ease), visibility 0s linear 0.25s;
  }
  .app-shell--drawer-open .sidebar { transform: none; visibility: visible; transition: transform 0.25s var(--ease); }
  .topbar { padding: 0 12px 0 8px; gap: 8px; }
  .topbar__title { display: block; }
  .topbar__user,
  .topbar__divider { display: none; }
  .content { padding: 20px 16px 40px; }
}

@media (max-width: 640px) {
  .page__title { font-size: 1.3rem; }
  .page__header { align-items: stretch; }
  .page__actions { width: 100%; }
  .page__actions .button { flex: 1 1 auto; }
  .page__actions .badge-host { flex: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat__value { font-size: 1.4rem; }
  .toolbar { padding: 12px 16px; gap: 8px; }
  .field--inline,
  .field--grow,
  .field--search { flex: 1 1 100%; max-width: none; }
  .panel__header { padding: 10px 16px; }
  .panel__body { padding: 16px; }
  .list__row { padding: 12px 16px; }
  .pagination { padding: 10px 16px; }
  .pagination__info { flex: 1 1 100%; text-align: center; }
  .pagination__controls { flex: 1 1 100%; justify-content: center; }
  .bulkbar { padding: 8px 12px 8px 16px; }
  .field-row { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .button__text { display: none; }
  .topbar #logout-button { width: 36px; padding: 0; }

  .modal { place-items: end stretch; padding: 0; }
  .modal__panel,
  .modal__panel--sm,
  .modal__panel--lg {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 0;
    animation: sheet-in 0.25s var(--ease);
  }
  .modal__header { padding: 14px 12px 14px 20px; }
  .modal__body { padding: 16px 20px; }
  .modal__actions { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
  .modal__actions > .button,
  .modal__actions-group { flex: 1 1 auto; }
  .modal__actions-group .button { flex: 1; }
  .modal__actions--split { flex-direction: column-reverse; align-items: stretch; }
  .modal__actions--split .modal__actions-group { margin-left: 0; }
  .confirm { padding-top: 20px; }
  .confirm__guard { padding: 0 20px 16px; }
  .secret-row { flex-direction: column; }
  .secret-row .button { height: 38px; }

  .toast-stack { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: auto; }
  .auth-card { padding: 24px 20px; }
}

@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
