/* RevelX Workbench UI. Structure and component anatomy follow shadcn/ui
   (sidebar + inset layout, card / table / badge / alert patterns), ported to
   plain CSS: no build step, CSP-safe. Brand colours from the RevelX guide.
   Tokens are prefixed --rx-: /static/canvas/canvas.css also sets --ink,
   --teal and --lime on :root (older values) and loads after this file. */

/* ---- Fonts (self-hosted Mulish) ---- */
@font-face { font-family: 'Mulish'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/mulish/mulish-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Mulish'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/mulish/mulish-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Mulish'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/mulish/mulish-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Mulish'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/mulish/mulish-latin-ext-500-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Mulish'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/mulish/mulish-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Mulish'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/mulish/mulish-latin-ext-700-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Mulish'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/mulish/mulish-latin-800-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Mulish'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/mulish/mulish-latin-ext-800-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Mulish'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/mulish/mulish-latin-400-italic.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Mulish'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/mulish/mulish-latin-ext-400-italic.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Mulish'; font-style: italic; font-weight: 700; font-display: swap; src: url('../fonts/mulish/mulish-latin-700-italic.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Mulish'; font-style: italic; font-weight: 700; font-display: swap; src: url('../fonts/mulish/mulish-latin-ext-700-italic.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ---- Tokens ---- */
:root {
  /* Brand */
  --rx-teal: #014751;
  --rx-teal-hover: #1A5A63;      /* teal at 90 % */
  --rx-teal-20: #CCDADC;
  --rx-teal-10: #E6EDEE;
  --rx-purple: #18003A;
  --rx-lime: #E5F127;
  --rx-lime-20: #FAFCD4;
  --rx-lime-40: #F5F9A9;
  --rx-red: #C72A27;
  --rx-red-20: #F4D4D4;
  --rx-red-5: #FDF4F4;
  --rx-dark: #121F29;

  /* Roles (shadcn naming) */
  --rx-background: #FFFFFF;
  --rx-foreground: var(--rx-purple);
  --rx-muted: #F3F4F4;            /* backdrop neutral at 5 % */
  --rx-muted-foreground: #59626A; /* backdrop neutral at 70 %, 6.2:1 */
  --rx-border: #E3E4E5;           /* backdrop neutral at 12 % */
  --rx-input: #D0D2D4;            /* backdrop neutral at 20 % */
  --rx-ring: var(--rx-teal);
  --rx-primary: var(--rx-teal);
  --rx-primary-foreground: #FFFFFF;
  --rx-sidebar: var(--rx-teal);
  --rx-sidebar-foreground: #FFFFFF;
  --rx-sidebar-muted: #B8CBCE;    /* white at 72 % on teal, 6.2:1 */
  --rx-sidebar-accent: rgba(255, 255, 255, 0.1);

  /* Type */
  --rx-font: 'Mulish', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --rx-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --rx-text-xs: 0.75rem;
  --rx-text-sm: 0.875rem;
  --rx-text-base: 1rem;
  --rx-text-lg: 1.125rem;
  --rx-text-xl: 1.5rem;
  --rx-text-2xl: 2rem;
  --rx-text-display: 3rem;

  /* Spacing (4 px grid) */
  --rx-space-1: 4px;
  --rx-space-2: 8px;
  --rx-space-3: 12px;
  --rx-space-4: 16px;
  --rx-space-5: 24px;
  --rx-space-6: 32px;
  --rx-space-7: 48px;

  /* Shape and depth */
  --rx-radius-sm: 6px;
  --rx-radius-md: 8px;
  --rx-radius-lg: 10px;
  --rx-radius-xl: 14px;
  --rx-shadow-xs: 0 1px 2px rgba(18, 31, 41, 0.05);
  --rx-shadow-sm: 0 1px 3px rgba(18, 31, 41, 0.08), 0 1px 2px rgba(18, 31, 41, 0.04);
  --rx-shadow-lg: 0 10px 30px rgba(18, 31, 41, 0.12), 0 2px 6px rgba(18, 31, 41, 0.06);

  /* Layout */
  --rx-sidebar-w: 256px;
  --rx-header-h: 56px;
  --rx-content-w: 1120px;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--rx-font); font-size: var(--rx-text-sm); line-height: 1.5; color: var(--rx-foreground); background: var(--rx-background); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; color: var(--rx-foreground); line-height: 1.25; }
h1 { font-size: var(--rx-text-xl); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: var(--rx-text-base); font-weight: 700; }
h3 { font-size: var(--rx-text-sm); font-weight: 700; }
p { margin: 0; }
strong, b { font-weight: 800; }
a { color: var(--rx-teal); text-underline-offset: 3px; }
a:hover { color: var(--rx-purple); }
code { font-family: var(--rx-mono); font-size: 0.85em; }
ul, ol { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--rx-ring); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: var(--rx-space-2) var(--rx-space-3); font-weight: 700; color: var(--rx-purple); background: var(--rx-lime); border-radius: var(--rx-radius-md); }
.skip:focus { left: 8px; }
.muted { color: var(--rx-muted-foreground); }
.hint { margin-top: var(--rx-space-1); font-size: var(--rx-text-xs); color: var(--rx-muted-foreground); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Icons (Lucide, ISC; see icons/LICENSE) as masks so they take currentColor ---- */
.icon { display: inline-block; flex: none; width: 16px; height: 16px; background-color: currentColor; -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
.icon-canvases { -webkit-mask-image: url('icons/layout-grid.svg'); mask-image: url('icons/layout-grid.svg'); }
.icon-plus { -webkit-mask-image: url('icons/plus.svg'); mask-image: url('icons/plus.svg'); }
.icon-users { -webkit-mask-image: url('icons/users.svg'); mask-image: url('icons/users.svg'); }
.icon-settings { -webkit-mask-image: url('icons/settings.svg'); mask-image: url('icons/settings.svg'); }
.icon-usage { -webkit-mask-image: url('icons/chart-column.svg'); mask-image: url('icons/chart-column.svg'); }
.icon-audit { -webkit-mask-image: url('icons/scroll-text.svg'); mask-image: url('icons/scroll-text.svg'); }
.icon-key { -webkit-mask-image: url('icons/key-round.svg'); mask-image: url('icons/key-round.svg'); }
.icon-logout { -webkit-mask-image: url('icons/log-out.svg'); mask-image: url('icons/log-out.svg'); }
.icon-sidebar { -webkit-mask-image: url('icons/panel-left.svg'); mask-image: url('icons/panel-left.svg'); }
.icon-close { -webkit-mask-image: url('icons/x.svg'); mask-image: url('icons/x.svg'); }
.icon-success { -webkit-mask-image: url('icons/circle-check.svg'); mask-image: url('icons/circle-check.svg'); }
.icon-warn { -webkit-mask-image: url('icons/triangle-alert.svg'); mask-image: url('icons/triangle-alert.svg'); }
.icon-error { -webkit-mask-image: url('icons/circle-alert.svg'); mask-image: url('icons/circle-alert.svg'); }
.icon-info { -webkit-mask-image: url('icons/info.svg'); mask-image: url('icons/info.svg'); }
.icon-print { -webkit-mask-image: url('icons/printer.svg'); mask-image: url('icons/printer.svg'); }
.icon-refresh { -webkit-mask-image: url('icons/refresh-cw.svg'); mask-image: url('icons/refresh-cw.svg'); }
.icon-trash { -webkit-mask-image: url('icons/trash-2.svg'); mask-image: url('icons/trash-2.svg'); }
.icon-chevron { -webkit-mask-image: url('icons/chevron-down.svg'); mask-image: url('icons/chevron-down.svg'); }
.icon-spinner { -webkit-mask-image: url('icons/loader-circle.svg'); mask-image: url('icons/loader-circle.svg'); }
.icon-check { -webkit-mask-image: url('icons/check.svg'); mask-image: url('icons/check.svg'); }

/* ---- Button ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--rx-space-2); height: 36px; padding: 0 var(--rx-space-4); font: inherit; font-size: var(--rx-text-sm); font-weight: 700; line-height: 1; white-space: nowrap; text-decoration: none; color: var(--rx-primary-foreground); background: var(--rx-primary); border: 1px solid transparent; border-radius: var(--rx-radius-md); box-shadow: var(--rx-shadow-xs); cursor: pointer; }
.btn:hover { color: var(--rx-primary-foreground); background: var(--rx-teal-hover); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-secondary { color: var(--rx-foreground); background: var(--rx-muted); }
.btn-secondary:hover { color: var(--rx-foreground); background: var(--rx-border); }
.btn-outline { color: var(--rx-foreground); background: var(--rx-background); border-color: var(--rx-input); }
.btn-outline:hover { color: var(--rx-foreground); background: var(--rx-muted); }
.btn-ghost { color: var(--rx-foreground); background: transparent; box-shadow: none; }
.btn-ghost:hover { color: var(--rx-foreground); background: var(--rx-muted); }
.btn-destructive { color: var(--rx-red); background: var(--rx-background); border-color: var(--rx-input); }
.btn-destructive:hover { color: #FFFFFF; background: var(--rx-red); border-color: var(--rx-red); }
.btn-link { height: auto; padding: 0; color: var(--rx-teal); background: none; box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { color: var(--rx-purple); background: none; }
.btn-sm { height: 32px; padding: 0 var(--rx-space-3); gap: 6px; font-size: var(--rx-text-xs); }
.btn-lg { height: 40px; padding: 0 var(--rx-space-5); }
.btn-icon { width: 36px; padding: 0; }
.btn-block { width: 100%; }
form.inline { display: inline-flex; margin: 0; }

/* ---- Form controls ---- */
.field { display: grid; gap: var(--rx-space-2); margin-bottom: var(--rx-space-5); }
.field > label { font-weight: 700; line-height: 1.2; }
.field .hint { margin: 0; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], select, textarea {
  display: block; width: 100%; height: 36px; padding: 0 var(--rx-space-3); font: inherit; color: var(--rx-foreground);
  background: var(--rx-background); border: 1px solid var(--rx-input); border-radius: var(--rx-radius-md); box-shadow: var(--rx-shadow-xs);
}
input::placeholder, textarea::placeholder { color: var(--rx-muted-foreground); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--rx-ring); outline: 2px solid var(--rx-ring); outline-offset: 0; }
select { appearance: none; padding-right: 36px; background: var(--rx-background) url('icons/chevron-down.svg') right 10px center / 16px no-repeat; }
textarea { height: auto; padding: var(--rx-space-2) var(--rx-space-3); font-family: var(--rx-mono); font-size: var(--rx-text-xs); line-height: 1.6; resize: vertical; }
input[type=checkbox] { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--rx-teal); cursor: pointer; }
.input-code { height: 44px; font-family: var(--rx-mono); font-size: var(--rx-text-lg); letter-spacing: 0.3em; text-align: center; }
.field-check { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--rx-space-3); align-items: start; margin-bottom: var(--rx-space-5); }
.field-check > label { font-weight: 700; cursor: pointer; }
.field-check .hint { grid-column: 2; margin: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--rx-space-4); }
fieldset { margin: 0 0 var(--rx-space-5); padding: var(--rx-space-3) var(--rx-space-4); border: 1px dashed var(--rx-input); border-radius: var(--rx-radius-md); color: var(--rx-muted-foreground); }
fieldset legend { padding: 0 var(--rx-space-1); font-weight: 700; color: var(--rx-muted-foreground); }

/* ---- Card ---- */
.card { display: flex; flex-direction: column; background: var(--rx-background); border: 1px solid var(--rx-border); border-radius: var(--rx-radius-xl); box-shadow: var(--rx-shadow-sm); margin-bottom: var(--rx-space-5); }
.card-header { display: grid; gap: 6px; padding: var(--rx-space-5) var(--rx-space-5) 0; }
.card-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--rx-space-4); }
.card-title { font-size: var(--rx-text-base); font-weight: 700; }
.card-description { color: var(--rx-muted-foreground); }
.card-content { padding: var(--rx-space-5); }
.card-content > :last-child { margin-bottom: 0; }
.card-content + .card-header { padding-top: var(--rx-space-5); border-top: 1px solid var(--rx-border); }
.card-footer { display: flex; align-items: center; gap: var(--rx-space-3); padding: var(--rx-space-4) var(--rx-space-5); border-top: 1px solid var(--rx-border); }
.card-footer.muted-footer { color: var(--rx-muted-foreground); font-size: var(--rx-text-xs); background: var(--rx-muted); border-radius: 0 0 var(--rx-radius-xl) var(--rx-radius-xl); }
.card-narrow { max-width: 640px; }

/* ---- Alert ---- */
.alert { display: grid; align-content: start; grid-template-columns: 16px 1fr; gap: 2px var(--rx-space-3); align-items: start; margin-bottom: var(--rx-space-4); padding: var(--rx-space-3) var(--rx-space-4); color: var(--rx-foreground); background: var(--rx-background); border: 1px solid var(--rx-border); border-radius: var(--rx-radius-lg); }
.alert > .icon { margin-top: 2px; }
.alert-title { font-weight: 700; line-height: 1.4; }
.alert-description { grid-column: 2; color: var(--rx-muted-foreground); }
.alert-description ul { padding-left: 18px; }
.alert-description li + li { margin-top: 2px; }
.alert-description h3 { margin: var(--rx-space-3) 0 var(--rx-space-1); color: var(--rx-foreground); }
.alert-description code { color: var(--rx-foreground); }
.alert-description p + p { margin-top: var(--rx-space-2); }
.alert-success > .icon { color: var(--rx-teal); }
.alert-warn { background: var(--rx-lime-20); border-color: var(--rx-lime-40); }
.alert-warn .alert-description { color: var(--rx-foreground); }
.alert-error { color: var(--rx-red); background: var(--rx-red-5); border-color: var(--rx-red-20); }
.alert-error .alert-title { color: var(--rx-red); }
.alert-error .alert-description { color: var(--rx-foreground); }
.secret { display: inline-block; padding: 2px var(--rx-space-2); font-family: var(--rx-mono); font-size: var(--rx-text-sm); font-weight: 700; letter-spacing: 0.04em; color: var(--rx-foreground); background: var(--rx-muted); border: 1px solid var(--rx-border); border-radius: var(--rx-radius-sm); word-break: break-all; user-select: all; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--rx-space-1) var(--rx-space-4); margin: var(--rx-space-2) 0 var(--rx-space-3); }
.kv dt { color: var(--rx-muted-foreground); }
.kv dd { margin: 0; font-family: var(--rx-mono); font-size: var(--rx-text-xs); line-height: 1.8; }

/* ---- Badge ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--rx-space-2); font-size: var(--rx-text-xs); font-weight: 700; line-height: 1; white-space: nowrap; color: var(--rx-foreground); background: var(--rx-background); border: 1px solid var(--rx-border); border-radius: 999px; }
.badge::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--rx-muted-foreground); }
.badge-ready::before, .badge-completed::before { background: var(--rx-teal); }
.badge-generating::before, .badge-running::before { background: var(--rx-lime); box-shadow: 0 0 0 1px #A4AD0A; }
.badge-failed::before { background: var(--rx-red); }
.badge-final { color: #FFFFFF; background: var(--rx-teal); border-color: var(--rx-teal); }
.badge-final::before { background: var(--rx-lime); }
.badge-cited { color: var(--rx-teal); background: var(--rx-teal-10); border-color: transparent; }
.badge-cited::before { display: none; }

/* ---- Table ---- */
.table-card { overflow-x: auto; background: var(--rx-background); border: 1px solid var(--rx-border); border-radius: var(--rx-radius-xl); box-shadow: var(--rx-shadow-sm); margin-bottom: var(--rx-space-5); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { height: 48px; padding: var(--rx-space-2) var(--rx-space-4); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--rx-border); }
.table thead th { height: 40px; font-weight: 700; color: var(--rx-muted-foreground); white-space: nowrap; background: var(--rx-muted); }
.table thead th:first-child { border-top-left-radius: var(--rx-radius-xl); }
.table thead th:last-child { border-top-right-radius: var(--rx-radius-xl); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr:hover { background: rgba(243, 244, 244, 0.6); }
.table tbody th { font-weight: 700; }
.table-link { font-weight: 700; color: var(--rx-foreground); text-decoration: none; }
.table-link:hover { color: var(--rx-teal); text-decoration: underline; }
.table-meta { display: block; margin-top: 2px; font-size: var(--rx-text-xs); font-weight: 400; color: var(--rx-muted-foreground); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions-inner { display: inline-flex; gap: var(--rx-space-2); }
code.details { display: block; max-width: 40ch; font-size: var(--rx-text-xs); color: var(--rx-muted-foreground); word-break: break-all; }

/* ---- Empty state ---- */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--rx-space-2); padding: var(--rx-space-7) var(--rx-space-5); text-align: center; border: 1px dashed var(--rx-input); border-radius: var(--rx-radius-xl); }
.empty-media { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: var(--rx-space-2); color: var(--rx-foreground); background: var(--rx-muted); border-radius: var(--rx-radius-lg); }
.empty-media .icon { width: 20px; height: 20px; }
.empty-title { font-size: var(--rx-text-lg); font-weight: 700; }
.empty-description { max-width: 42ch; color: var(--rx-muted-foreground); }
.empty .btn { margin-top: var(--rx-space-3); }

/* ---- Shell: sidebar + inset ---- */
.shell { min-height: 100vh; background: var(--rx-sidebar); }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--rx-sidebar-w); color: var(--rx-sidebar-foreground); background: var(--rx-sidebar); }
.sidebar :focus-visible { outline-color: var(--rx-lime); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 var(--rx-space-4); }
.sidebar-logo { display: block; padding: var(--rx-space-1); border-radius: var(--rx-radius-sm); }
.sidebar-logo img { display: block; height: 26px; width: auto; }
.sidebar-close { display: none; color: #FFFFFF; }
.sidebar-close:hover { color: #FFFFFF; background: var(--rx-sidebar-accent); }
.sidebar-content { flex: 1; overflow-y: auto; padding: var(--rx-space-2); }
.sidebar-group { padding: var(--rx-space-2) 0; }
.sidebar-group-label { display: flex; align-items: center; height: 32px; padding: 0 var(--rx-space-2); font-size: var(--rx-text-xs); font-weight: 700; color: var(--rx-sidebar-muted); }
.sidebar-menu { display: grid; gap: 2px; padding: 0; list-style: none; }
.sidebar-link { position: relative; display: flex; align-items: center; gap: var(--rx-space-2); width: 100%; height: 36px; padding: 0 var(--rx-space-2) 0 var(--rx-space-3); font: inherit; font-weight: 500; text-align: left; text-decoration: none; color: var(--rx-sidebar-foreground); background: none; border: 0; border-radius: var(--rx-radius-md); cursor: pointer; }
.sidebar-link:hover { color: var(--rx-sidebar-foreground); background: var(--rx-sidebar-accent); }
.sidebar-link[aria-current="page"] { font-weight: 700; background: rgba(255, 255, 255, 0.14); }
.sidebar-link[aria-current="page"]::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--rx-lime); }
.sidebar-footer { padding: var(--rx-space-2); border-top: 1px solid rgba(255, 255, 255, 0.14); }
.sidebar-user { display: flex; align-items: center; gap: var(--rx-space-2); padding: var(--rx-space-2); }
.avatar { display: grid; place-items: center; flex: none; width: 32px; height: 32px; font-weight: 800; color: var(--rx-purple); background: var(--rx-lime); border-radius: var(--rx-radius-md); }
.sidebar-user-name { font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.sidebar-user-role { font-size: var(--rx-text-xs); color: var(--rx-sidebar-muted); }
.sidebar-backdrop { display: none; }

.inset { min-height: 100vh; margin-left: var(--rx-sidebar-w); padding: var(--rx-space-2) var(--rx-space-2) var(--rx-space-2) 0; }
.inset-panel { min-height: calc(100vh - 16px); background: var(--rx-background); border-radius: var(--rx-radius-xl); box-shadow: var(--rx-shadow-sm); }
.site-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--rx-space-2); height: var(--rx-header-h); padding: 0 var(--rx-space-6); background: rgba(255, 255, 255, 0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rx-border); border-radius: var(--rx-radius-xl) var(--rx-radius-xl) 0 0; }
.sidebar-trigger, .site-header-logo { display: none; }
.site-header-logo img { display: block; height: 20px; width: auto; }
.header-actions { display: flex; align-items: center; gap: var(--rx-space-2); margin-left: auto; }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rx-space-2); padding: 0; list-style: none; color: var(--rx-muted-foreground); }
.breadcrumb li { display: inline-flex; align-items: center; gap: var(--rx-space-2); min-width: 0; }
.breadcrumb li + li::before { content: '/'; color: var(--rx-input); }
.breadcrumb a { color: var(--rx-muted-foreground); text-decoration: none; }
.breadcrumb a:hover { color: var(--rx-foreground); }
.breadcrumb [aria-current="page"] { font-weight: 700; color: var(--rx-foreground); }
.page { width: 100%; max-width: var(--rx-content-w); margin: 0 auto; padding: var(--rx-space-6) var(--rx-space-6) var(--rx-space-7); }
.page-wide { max-width: 1520px; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--rx-space-4); margin-bottom: var(--rx-space-5); }
.page-heading { display: grid; gap: var(--rx-space-1); min-width: 0; }
.page-heading h1 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rx-space-3); overflow-wrap: anywhere; }
.page-description { color: var(--rx-muted-foreground); font-size: var(--rx-text-sm); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--rx-space-2); }

/* ---- Logged-out split screen (shadcn login-02 layout) ---- */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-form-side { display: flex; flex-direction: column; padding: var(--rx-space-6) var(--rx-space-7); }
.auth-logo-img { display: block; align-self: flex-start; height: 28px; width: auto; }
.auth-body { display: flex; flex: 1; align-items: center; justify-content: center; padding: var(--rx-space-6) 0; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: var(--rx-text-xl); }
.auth-intro { margin: var(--rx-space-2) 0 var(--rx-space-5); color: var(--rx-muted-foreground); }
.auth-foot { font-size: var(--rx-text-xs); color: var(--rx-muted-foreground); }
.auth-brand { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end; padding: var(--rx-space-7); overflow: hidden; color: #FFFFFF; background: var(--rx-teal); }
.auth-brand::before { content: ''; position: absolute; z-index: -1; right: -10%; top: -10%; width: 70%; height: 75%; background: var(--rx-purple); clip-path: polygon(40% 0, 100% 0, 100% 100%, 0 100%); }
.auth-brand::after { content: ''; position: absolute; z-index: -1; right: 12%; top: 0; width: 34%; height: 52%; background: var(--rx-lime); clip-path: polygon(52% 0, 100% 0, 48% 100%, 0 100%); }
.auth-tagline { font-size: clamp(2.25rem, 4vw, var(--rx-text-display)); font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.auth-sub { max-width: 34ch; margin-top: var(--rx-space-3); font-size: var(--rx-text-base); font-weight: 700; color: rgba(255, 255, 255, 0.85); }
.qr { display: block; margin: var(--rx-space-2) 0 var(--rx-space-4); padding: var(--rx-space-2); background: #FFFFFF; border: 1px solid var(--rx-border); border-radius: var(--rx-radius-lg); }
.setup-key { margin-bottom: var(--rx-space-5); color: var(--rx-muted-foreground); }
.setup-key p + p { margin-top: var(--rx-space-1); }

/* ---- Progress ---- */
.status-line { display: flex; align-items: center; gap: var(--rx-space-2); color: var(--rx-muted-foreground); }
.steps { padding: 0; list-style: none; }
.step { display: grid; grid-template-columns: 28px 1fr auto; gap: var(--rx-space-3); align-items: start; padding: var(--rx-space-3) 0; }
.step + .step { border-top: 1px solid var(--rx-border); }
.step-marker { display: grid; place-items: center; width: 28px; height: 28px; color: var(--rx-muted-foreground); border: 1px solid var(--rx-input); border-radius: 50%; }
.step-marker .icon { display: none; width: 14px; height: 14px; }
.step-title { font-weight: 700; }
.step-text { color: var(--rx-muted-foreground); }
.step-state { padding-top: 4px; }
.step[data-state="active"] .step-marker { color: var(--rx-purple); background: var(--rx-lime); border-color: #A4AD0A; }
.step[data-state="active"] .icon-spinner { display: inline-block; }
.step[data-state="done"] .step-marker { color: #FFFFFF; background: var(--rx-teal); border-color: var(--rx-teal); }
.step[data-state="done"] .icon-check { display: inline-block; }
.step[data-state="skipped"] .step-marker { border-style: dashed; }
.step-state.badge-pending::before, .step-state.badge-skipped::before { background: var(--rx-input); }

/* ---- Review ---- */
.preview-stage { padding: var(--rx-space-5); margin-bottom: var(--rx-space-5); background: var(--rx-muted); border: 1px solid var(--rx-border); border-radius: var(--rx-radius-xl); }
.preview-outer { max-width: 100%; margin: 0 auto; overflow-x: auto; background: #FFFFFF; box-shadow: var(--rx-shadow-lg); }
.preview-frame { width: 13.333in; height: 7.5in; transform-origin: top left; }
.preview-outer.fit { overflow: hidden; }
.fit-20 { width: 256px; height: 144px; } .fit-20 .preview-frame { transform: scale(0.2); }
.fit-25 { width: 320px; height: 180px; } .fit-25 .preview-frame { transform: scale(0.25); }
.fit-30 { width: 384px; height: 216px; } .fit-30 .preview-frame { transform: scale(0.3); }
.fit-35 { width: 448px; height: 252px; } .fit-35 .preview-frame { transform: scale(0.35); }
.fit-40 { width: 512px; height: 288px; } .fit-40 .preview-frame { transform: scale(0.4); }
.fit-45 { width: 576px; height: 324px; } .fit-45 .preview-frame { transform: scale(0.45); }
.fit-50 { width: 640px; height: 360px; } .fit-50 .preview-frame { transform: scale(0.5); }
.fit-55 { width: 704px; height: 396px; } .fit-55 .preview-frame { transform: scale(0.55); }
.fit-60 { width: 768px; height: 432px; } .fit-60 .preview-frame { transform: scale(0.6); }
.fit-65 { width: 832px; height: 468px; } .fit-65 .preview-frame { transform: scale(0.65); }
.fit-70 { width: 896px; height: 504px; } .fit-70 .preview-frame { transform: scale(0.7); }
.fit-75 { width: 960px; height: 540px; } .fit-75 .preview-frame { transform: scale(0.75); }
.fit-80 { width: 1024px; height: 576px; } .fit-80 .preview-frame { transform: scale(0.8); }
.fit-85 { width: 1088px; height: 612px; } .fit-85 .preview-frame { transform: scale(0.85); }
.fit-90 { width: 1152px; height: 648px; } .fit-90 .preview-frame { transform: scale(0.9); }
.fit-95 { width: 1216px; height: 684px; } .fit-95 .preview-frame { transform: scale(0.95); }
.fit-100 { width: 1280px; height: 720px; } .fit-100 .preview-frame { transform: scale(1); }
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 var(--rx-space-4); }
.collapsible > summary { display: flex; align-items: center; gap: var(--rx-space-3); padding: var(--rx-space-4) var(--rx-space-5); list-style: none; cursor: pointer; border-radius: var(--rx-radius-xl); }
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary:hover { background: var(--rx-muted); }
.collapsible > summary .icon-chevron { margin-left: auto; color: var(--rx-muted-foreground); }
.collapsible[open] > summary { border-bottom: 1px solid var(--rx-border); border-radius: var(--rx-radius-xl) var(--rx-radius-xl) 0 0; }
.collapsible[open] > summary .icon-chevron { transform: rotate(180deg); }
.source-group + .source-group { margin-top: var(--rx-space-5); }
.source-group h3 { margin-bottom: var(--rx-space-2); color: var(--rx-muted-foreground); font-weight: 700; }
.source-list { padding: 0; list-style: none; border: 1px solid var(--rx-border); border-radius: var(--rx-radius-lg); }
.source-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--rx-space-3); padding: var(--rx-space-2) var(--rx-space-3); }
.source-list li + li { border-top: 1px solid var(--rx-border); }
.source-list a { font-weight: 500; overflow-wrap: anywhere; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .shell { background: var(--rx-background); }
  .inset { margin-left: 0; padding: 0; }
  .inset-panel { min-height: 100vh; border-radius: 0; box-shadow: none; }
  .site-header { padding: 0 var(--rx-space-4); border-radius: 0; }
  .sidebar-trigger, .site-header-logo { display: inline-flex; }
  .breadcrumb { display: none; }
  /* Without JS the sidebar is a plain block above the page. */
  .sidebar { position: static; width: auto; }
  .js .sidebar { position: fixed; z-index: 60; width: min(300px, 85vw); visibility: hidden; transform: translateX(-100%); }
  .js .sidebar.is-open { visibility: visible; transform: none; box-shadow: var(--rx-shadow-lg); }
  .js .sidebar-close { display: inline-flex; }
  .js .sidebar-backdrop.is-open { position: fixed; z-index: 55; inset: 0; display: block; background: rgba(18, 31, 41, 0.5); }
  .page { padding: var(--rx-space-5) var(--rx-space-4) var(--rx-space-7); }
  .preview-stage { padding: var(--rx-space-3); }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-side { padding: var(--rx-space-5) var(--rx-space-4); }
  .auth-body { align-items: flex-start; padding-top: var(--rx-space-7); }
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  h1 { font-size: 1.375rem; }
  .card-header { padding: var(--rx-space-4) var(--rx-space-4) 0; }
  .card-content { padding: var(--rx-space-4); }
  .card-footer { padding: var(--rx-space-3) var(--rx-space-4); }
  .collapsible > summary { padding: var(--rx-space-4); }
  .header-actions .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .header-actions .btn { width: 36px; padding: 0; }
  .table-stack { border: 0; box-shadow: none; background: none; overflow: visible; }
  .table-stack .table, .table-stack tbody, .table-stack tr, .table-stack td, .table-stack th { display: block; height: auto; }
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .table-stack tr { margin-bottom: var(--rx-space-3); padding: var(--rx-space-3) var(--rx-space-4); background: var(--rx-background); border: 1px solid var(--rx-border); border-radius: var(--rx-radius-xl); box-shadow: var(--rx-shadow-xs); }
  .table-stack tbody tr:hover { background: var(--rx-background); }
  .table-stack th, .table-stack td { padding: var(--rx-space-1) 0; border: 0; }
  .table-stack tbody th { padding-bottom: var(--rx-space-2); font-size: var(--rx-text-base); }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: var(--rx-space-4); text-align: right; }
  .table-stack td::before { content: attr(data-label); color: var(--rx-muted-foreground); text-align: left; }
  .table-stack td.row-actions { justify-content: flex-start; padding-top: var(--rx-space-3); }
  .table-stack td.row-actions::before { display: none; }
  .step { grid-template-columns: 28px 1fr; }
  .step-state { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .sidebar-link, input, select, textarea { transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
  .js .sidebar { transition: transform 0.2s ease, visibility 0.2s; }
  .collapsible > summary .icon-chevron { transition: transform 0.15s; }
  .step[data-state="active"] .icon-spinner, .status-line .icon-spinner { animation: rx-spin 1s linear infinite; }
}
@keyframes rx-spin { to { transform: rotate(360deg); } }
