/* PageDesigner Hosted Admin — product register */

:root {
  --bg: oklch(0.995 0.002 350);
  --surface: oklch(0.975 0.005 350);
  --surface-2: oklch(0.955 0.007 350);
  --border: oklch(0.91 0.008 350);
  --border-strong: oklch(0.84 0.012 350);
  --ink: oklch(0.24 0.02 350);
  --muted: oklch(0.46 0.018 350);
  --faint: oklch(0.60 0.012 350);
  --primary: oklch(0.44 0.155 350);
  --primary-hover: oklch(0.38 0.15 350);
  --primary-soft: oklch(0.94 0.035 350);
  --primary-ink: oklch(0.99 0.005 350);
  --success: oklch(0.50 0.12 150);
  --success-soft: oklch(0.94 0.03 150);
  --warning: oklch(0.56 0.11 75);
  --warning-soft: oklch(0.95 0.035 85);
  --danger: oklch(0.52 0.17 25);
  --danger-soft: oklch(0.95 0.03 25);
  --info: oklch(0.50 0.09 250);
  --info-soft: oklch(0.94 0.025 250);
  --sidebar-w: 280px;
  --radius: 8px;
  --radius-lg: 12px;
  --text-base: 16px;
  --text-sm: 14px;
  --text-xs: 13px;
  --icon: 20px;
  --shadow-sm: 0 1px 2px oklch(0.24 0.02 350 / 0.05);
  --shadow: 0 2px 8px oklch(0.24 0.02 350 / 0.06), 0 12px 32px oklch(0.24 0.02 350 / 0.04);
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --z-sticky: 20;
  --z-overlay: 30;
  --z-modal-bg: 40;
  --z-modal: 50;
  --z-toast: 60;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.18 0.014 350);
    --surface: oklch(0.21 0.016 350);
    --surface-2: oklch(0.25 0.018 350);
    --border: oklch(0.30 0.018 350);
    --border-strong: oklch(0.38 0.022 350);
    --ink: oklch(0.94 0.008 350);
    --muted: oklch(0.70 0.018 350);
    --faint: oklch(0.56 0.014 350);
    --primary: oklch(0.70 0.13 350);
    --primary-hover: oklch(0.76 0.12 350);
    --primary-soft: oklch(0.28 0.045 350);
    --primary-ink: oklch(0.16 0.018 350);
    --success: oklch(0.72 0.11 150);
    --success-soft: oklch(0.27 0.04 150);
    --warning: oklch(0.76 0.11 85);
    --warning-soft: oklch(0.29 0.04 85);
    --danger: oklch(0.68 0.13 25);
    --danger-soft: oklch(0.27 0.04 25);
    --info: oklch(0.70 0.08 250);
    --info-soft: oklch(0.27 0.035 250);
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.25);
    --shadow: 0 4px 16px oklch(0 0 0 / 0.28), 0 16px 40px oklch(0 0 0 / 0.18);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.app { min-height: 100%; }

/* ─── Boot ─────────────────────────────────────────────────────────────── */

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.boot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.boot-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  position: relative;
}
.boot-mark::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 2px solid var(--primary);
  opacity: 0.25;
  animation: boot-ring 1.4s var(--ease) infinite;
}
.boot-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
@keyframes boot-ring {
  0%, 100% { transform: scale(1); opacity: 0.25; }
  50% { transform: scale(1.08); opacity: 0.08; }
}

/* ─── Login ────────────────────────────────────────────────────────────── */

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .login-shell { grid-template-columns: 1fr 1fr; }
}
.login-aside {
  display: none;
  background: var(--primary);
  color: var(--primary-ink);
  padding: 48px 40px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 20px;
}
@media (min-width: 720px) {
  .login-aside { display: flex; }
}
.login-aside h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.25;
  text-wrap: balance;
  max-width: 28ch;
}
.login-aside p {
  margin: 0;
  font-size: 14px;
  opacity: 0.82;
  max-width: 36ch;
  line-height: 1.55;
}
.login-aside .login-mark-lg {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: oklch(from var(--primary-ink) l c h / 0.15);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  margin-bottom: auto;
}
.login-main {
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background: var(--bg);
}
.login-card {
  width: min(380px, 100%);
}
.login-brand {
  margin-bottom: 28px;
}
.login-brand h1 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.login-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.login-form { display: grid; gap: 16px; }
.login-error {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  border: 1px solid oklch(from var(--danger) l c h / 0.2);
}

/* ─── Shell ────────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  z-index: var(--z-sticky);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 16px;
  margin-bottom: 4px;
}
.sidebar-brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--primary);
  color: var(--primary-ink);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.sidebar-brand strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.sidebar-brand span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  overflow: auto;
  padding: 0 2px;
}
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 8px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.nav a.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 550;
}
.nav a svg {
  width: var(--icon);
  height: var(--icon);
  opacity: 0.7;
  flex-shrink: 0;
}
.nav a:hover svg,
.nav a.active svg { opacity: 1; }
.nav .badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-variant-numeric: tabular-nums;
}
.sidebar-foot {
  padding: 12px 8px 2px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-user {
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
  line-height: 1.25;
}
.topbar .sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.content {
  padding: 20px 24px 48px;
  flex: 1;
}

/* ─── Forms ────────────────────────────────────────────────────────────── */

.field { display: grid; gap: 5px; }
.field label {
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
}
.field .hint { font-size: 12px; color: var(--faint); }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 8px 11px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.textarea {
  min-height: 88px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.45;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input.mono, .mono { font-family: var(--mono); font-size: 12.5px; }
.select-narrow { width: auto; min-width: 140px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
  flex-wrap: wrap;
}
.field-checks {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.field-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

/* Search */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: min(260px, 100%);
  max-width: 320px;
}
.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}
.search-wrap .input {
  padding-left: 32px;
}

/* ─── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--ink);
  transition: background 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover { background: var(--border); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}
.btn-ghost:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-danger:hover { background: oklch(from var(--danger) l c h / 0.14); }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn > svg {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

/* ─── Panels ─────────────────────────────────────────────────────────────── */

.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.panel-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.panel-head a {
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}
.panel-head a:hover { text-decoration: underline; }
.panel-body { padding: 16px; }
.stack { display: grid; gap: 16px; }
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar .spacer { flex: 1; min-width: 8px; }

/* ─── Request activity ─────────────────────────────────────────────────── */

.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;
}
.request-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.request-summary-card {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.request-summary-card span,
.request-summary-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.request-summary-card small { color: var(--faint); }
.request-summary-card strong {
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.request-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) repeat(4, minmax(132px, auto)) auto;
  align-items: center;
  gap: 9px;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.request-filters .select { min-width: 0; }
.request-search {
  max-width: none;
  min-width: 0;
}
.request-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 8px;
  color: var(--muted);
  font-size: 12px;
}
.request-list-head span:last-child { color: var(--faint); }
.request-panel { box-shadow: var(--shadow-sm); }
.request-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 0;
  color: var(--muted);
  font-size: 12px;
}
.request-pagination > div { display: flex; gap: 8px; }
.request-type {
  display: inline-flex;
  max-width: 150px;
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.request-data tbody tr:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.request-detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-soft), var(--bg) 62%);
}
.request-detail-kicker {
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}
.request-detail-hero h3 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
}
.request-detail-hero p {
  max-width: 72ch;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.request-detail-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.request-detail-panel { margin-bottom: 14px; }
.request-detail-list { margin: 0; }
.request-detail-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.request-detail-row:last-child { border-bottom: 0; }
.request-detail-row dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}
.request-detail-row dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.request-detail-message {
  min-height: 120px;
  color: var(--ink);
  white-space: pre-wrap;
}
.request-json {
  max-height: 420px;
  margin: 0;
  padding: 13px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

/* Summary strip (task-first overview) */
.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
}
.summary-item {
  flex: 1 1 120px;
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.summary-item:last-child { border-right: 0; }
.summary-item .label {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.summary-item .label svg {
  width: 18px;
  height: 18px;
  opacity: 0.75;
  flex-shrink: 0;
}
.summary-item .value {
  margin-top: 2px;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.summary-item .meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--faint);
  line-height: 1.35;
}
.summary-item.is-alert .value { color: var(--warning); }
.summary-item.is-alert .label { color: var(--warning); }

/* ─── AI control ───────────────────────────────────────────────────────── */

.ai-defaults {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.ai-defaults > div {
  display: grid;
  gap: 2px;
  padding: 11px 14px;
  background: var(--surface);
}
.ai-defaults span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.ai-defaults strong {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
}
.ai-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.usage-chart { width: 100%; min-width: 360px; }
.usage-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.usage-chart text {
  fill: var(--faint);
  font-family: var(--font);
  font-size: 10px;
}
.usage-chart .usage-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.quota-progress {
  width: 112px;
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-2);
}
.quota-progress i {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--primary);
}
.ai-policy-status {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.ai-policy-status label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}
.ai-policy-status p {
  margin: 6px 0 0 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.ai-settings-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid oklch(from var(--primary) l c h / 0.20);
  border-radius: var(--radius);
  background: var(--primary-soft);
}
.ai-settings-note strong { font-size: 13px; color: var(--primary); }
.ai-settings-note span { color: var(--muted); font-size: 12px; }
.ai-provider-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.ai-provider-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.ai-provider-card-head strong { font-size: 13px; }
.field-hint { color: var(--faint); font-weight: 400; }
.field-help {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.ai-checkbox-field { display: flex; align-items: end; }
.ai-checkbox-field label {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 42px;
  font-size: 13px;
  cursor: pointer;
}
.ai-empty-providers { padding: 20px; }

/* ─── Tables ─────────────────────────────────────────────────────────────── */

.table-wrap { overflow: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-size: 12px;
  font-weight: 550;
  color: var(--faint);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}
table.data td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr {
  transition: background 120ms var(--ease);
}
table.data tbody tr:hover { background: var(--surface); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:active { background: var(--surface-2); }
.cell-title {
  font-weight: 550;
  line-height: 1.3;
}
.cell-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  line-height: 1.35;
}
.cell-date {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.cell-truncate {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.actions-cell {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
  line-height: 1.4;
  text-transform: lowercase;
}
.badge::first-letter { text-transform: uppercase; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

/* ─── Empty / loading ────────────────────────────────────────────────────── */

.empty {
  padding: 36px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--faint);
}
.empty h4 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.empty p {
  margin: 0 0 14px;
  font-size: 13px;
  max-width: 36ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
  border-radius: var(--radius);
}
.skeleton-h-sm { height: 14px; }
.skeleton-h-md { height: 18px; }
.skeleton-h-lg { height: 180px; }
.skeleton-w-40 { width: 40%; }
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skeleton-stack { display: grid; gap: 10px; }

/* ─── Detail layout ────────────────────────────────────────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  align-items: start;
}
.kv { display: grid; gap: 10px; }
.kv-row {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 8px;
  font-size: 13px;
  align-items: baseline;
}
.kv-row dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.kv-row dd { margin: 0; word-break: break-word; }
.section-label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}
.pre {
  margin: 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  overflow: auto;
  max-height: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─── Modal ──────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.15 0.02 350 / 0.5);
  z-index: var(--z-modal-bg);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fadeIn 150ms var(--ease);
}
.modal {
  width: min(640px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: rise 180ms var(--ease);
}
.modal-lg { width: min(820px, 100%); }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.modal-body { padding: 18px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  bottom: 0;
}
.modal-foot .cell-sub,
.modal-foot-note { margin-right: auto; }
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */

.toast-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-toast);
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}
.toast {
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: rise 180ms var(--ease);
  border: 1px solid oklch(from var(--ink) l c h / 0.1);
}
.toast.ok {
  background: var(--success);
  color: oklch(0.99 0.01 150);
  border-color: transparent;
}
.toast.err {
  background: var(--danger);
  color: oklch(0.99 0.01 25);
  border-color: transparent;
}

/* ─── Key reveal ─────────────────────────────────────────────────────────── */

.key-reveal {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: var(--primary-soft);
  border: 1px solid oklch(from var(--primary) l c h / 0.18);
  border-radius: var(--radius);
}
.key-reveal code {
  flex: 1;
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
  line-height: 1.45;
}

/* ─── Mobile ─────────────────────────────────────────────────────────────── */

.menu-btn { display: none; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0.15 0.02 350 / 0.4);
  z-index: calc(var(--z-sticky) - 1);
}
.sidebar-overlay.visible { display: block; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 200ms var(--ease);
    box-shadow: var(--shadow);
    z-index: var(--z-overlay);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .kv-row { grid-template-columns: 1fr; gap: 2px; }
  .summary-item { border-right: 0; border-bottom: 1px solid var(--border); }
  .summary-item:last-child { border-bottom: 0; }
  .ai-defaults { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-chart-grid { grid-template-columns: 1fr; }
  .usage-chart { min-width: 520px; }
  .search-wrap { max-width: none; flex: 1 1 100%; }
}

/* ─── Component studio ─────────────────────────────────────────────────── */

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.view-toggle button {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 550;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.view-toggle button:hover { background: var(--surface); color: var(--ink); }
.view-toggle button.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.view-toggle button svg { width: 18px; height: 18px; }

.cmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  padding: 18px;
}
.panel > #cmp-table > .empty { margin: 0; }
.cmp-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.cmp-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.cmp-card-preview {
  position: relative;
  height: 168px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.cmp-card-svg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  transition: opacity 200ms var(--ease);
}
.cmp-card-svg svg,
.cmp-card-svg .pd-block-media svg {
  width: 100%;
  max-width: 200px;
  height: auto;
  stroke: var(--faint);
  fill: none;
  stroke-width: 1.5;
}
.cmp-card-svg .pd-block-media {
  width: 100%;
  display: grid;
  place-items: center;
}
.cmp-card-live {
  position: absolute;
  inset: 0;
  width: 200%;
  height: 200%;
  border: 0;
  transform: scale(0.5);
  transform-origin: top left;
  opacity: 0;
  pointer-events: none;
  background: white;
  transition: opacity 200ms var(--ease);
}
.cmp-card.is-live .cmp-card-svg { opacity: 0; }
.cmp-card.is-live .cmp-card-live { opacity: 1; }
.cmp-card-body {
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.cmp-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.cmp-card-uid {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 3px;
}
.cmp-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.cmp-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}
.cmp-card-actions .btn { flex: 1 1 auto; min-width: 0; }

.cmp-studio {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}
.cmp-studio-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}
.cmp-studio-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.cmp-studio-preview-head h3 {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cmp-studio-frame-wrap {
  flex: 1;
  min-height: 420px;
  background: #fff;
  position: relative;
}
.cmp-studio-frame {
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
  display: block;
  background: #fff;
}
.cmp-studio-side {
  display: grid;
  gap: 16px;
  align-content: start;
}
.cmp-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cmp-action-bar .btn svg { width: 18px; height: 18px; }
.cmp-banner-lg {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
}
.cmp-banner-lg svg,
.cmp-banner-lg .pd-block-media svg {
  width: 100%;
  max-width: 240px;
  stroke: var(--primary);
  fill: none;
  stroke-width: 1.5;
  opacity: 0.85;
}
.cmp-banner-lg .pd-block-media { width: 100%; display: grid; place-items: center; }
.cmp-table-preview {
  width: 72px;
  padding: 4px;
}
.cmp-table-preview .cmp-card-svg { height: auto; padding: 0; }

.cmp-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.cmp-editor-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  min-height: 360px;
  display: flex;
  flex-direction: column;
}
.cmp-editor-preview .cmp-studio-frame-wrap { min-height: 300px; }
.cmp-editor-preview .cmp-studio-frame { min-height: 300px; }

/* Scale bumps */
.topbar { padding: 18px 28px; }
.topbar h2 { font-size: 1.35rem; }
.topbar .sub { font-size: var(--text-sm); }
.content { padding: 24px 28px 56px; }
.sidebar-brand .mark { width: 36px; height: 36px; font-size: 13px; }
.sidebar-brand strong { font-size: 15px; }
.nav a { padding: 10px 12px; font-size: var(--text-sm); }
.btn { padding: 9px 14px; font-size: var(--text-sm); }
.btn-sm { padding: 7px 11px; font-size: var(--text-xs); }
.input, .select, .textarea { padding: 10px 13px; font-size: var(--text-sm); }
.field label { font-size: var(--text-xs); }
table.data { font-size: var(--text-sm); }
table.data th { font-size: var(--text-xs); padding: 11px 16px; }
table.data td { padding: 12px 16px; }
.panel-head { padding: 14px 18px; }
.panel-head h3 { font-size: var(--text-sm); }
.summary-item .value { font-size: 1.5rem; }
.stat .value { font-size: 1.75rem; }
.empty h4 { font-size: 1.05rem; }
.modal-head h3 { font-size: 1.1rem; }

@media (max-width: 1100px) {
  .cmp-studio { grid-template-columns: 1fr; }
  .cmp-editor { grid-template-columns: 1fr; }
  .request-filters { grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(132px, 1fr)); }
}
@media (max-width: 900px) {
  .cmp-grid { grid-template-columns: 1fr; }
  .request-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-search { grid-column: 1 / -1; }
  .request-detail-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .request-summary,
  .request-filters { grid-template-columns: 1fr; }
  .request-filters .btn { width: 100%; }
  .request-list-head { align-items: flex-start; flex-direction: column; gap: 2px; }
  .request-pagination { align-items: flex-start; flex-direction: column; }
  .request-detail-hero { padding: 16px; flex-direction: column; }
  .request-detail-row { grid-template-columns: 1fr; gap: 3px; padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
