@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/management/inter-latin.woff2") format("woff2");
}

/* ---- Tokens ------------------------------------------------------------- */
:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Ground and surfaces, layered for depth. Light product theme: an off-white
     ground with white cards that lift off it, mirroring the PolpoHire app. */
  --bg: #eef0f7;
  --bg-2: #e7eaf4;
  --surface: #ffffff;
  --surface-2: #f4f6fc;
  --surface-3: #eaeef7;
  --text: #171b2b;
  --text-2: #545d73;
  --text-3: #6a748c;

  --border: #e3e7f1;
  --border-strong: #ccd3e3;
  --line: rgba(23, 27, 43, 0.08);
  --hairline: rgba(23, 27, 43, 0.12);

  /* Brand indigo. `--brand` carries fills/rings; accent TEXT uses the darker
     `--brand-text` (neutral surfaces) or `--brand-strong` (on `--brand-soft`),
     so accent copy stays AA on white. */
  --brand: #5661e8;
  --brand-2: #8b5cf6;
  --brand-text: #4750d8;
  --brand-strong: #363dbe;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, var(--surface));
  --brand-ring: color-mix(in srgb, var(--brand) 38%, transparent);
  --primary-fill: #5661e8;
  --primary-ink: #fff;

  /* Semantic states. Deep inks so a coloured chip's own text passes AA on its
     soft tint. */
  --good: #12855f;
  --good-soft: color-mix(in srgb, #12855f 12%, var(--surface));
  --good-line: color-mix(in srgb, #12855f 30%, transparent);
  --warn: #a8650a;
  --warn-soft: color-mix(in srgb, #a8650a 12%, var(--surface));
  --warn-line: color-mix(in srgb, #a8650a 28%, transparent);
  --alert: #cf3a3a;
  --alert-soft: color-mix(in srgb, #cf3a3a 11%, var(--surface));
  --alert-line: color-mix(in srgb, #cf3a3a 28%, transparent);

  /* Shell chrome: a light menu with dark text on the light theme. */
  --shell-bg: #f8f9fd;
  --shell-text: #3d4459;
  --shell-active: color-mix(in srgb, var(--brand) 13%, var(--surface));
  --shell-border: rgba(23, 27, 43, 0.08);
  --shell-accent: #5661e8;

  --muted: var(--text-2);
  --purple: var(--brand);

  /* iOS-radius scale. */
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-2xl: 28px;
  --r-pill: 999px;

  /* Elevation, tuned for a light ground (soft, cool shadows). */
  --e1: 0 1px 2px rgba(23, 27, 60, 0.06);
  --e2: 0 12px 30px -14px rgba(23, 27, 60, 0.16);
  --e3: 0 30px 80px -30px rgba(23, 27, 60, 0.26);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 78% -8%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%),
    radial-gradient(900px 520px at 6% 108%, color-mix(in srgb, var(--brand-2) 12%, transparent), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }

/* ---- Buttons ----------------------------------------------------------- */
button {
  cursor: pointer;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--r-sm);
  min-height: 34px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: var(--e1);
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease), transform 0.08s var(--ease);
}
button:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); }
button:active:not(:disabled) { transform: scale(0.965); }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

button.primary {
  background: var(--primary-fill);
  color: var(--primary-ink);
  border-color: transparent;
  box-shadow: var(--e1);
}
button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary-fill) 88%, black); }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

a { color: var(--brand-text); text-decoration: none; }
[hidden] { display: none !important; }

/* ---- Sidebar ----------------------------------------------------------- */
.sidebar {
  width: 236px;
  position: fixed;
  inset: 0 auto 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--shell-bg) 92%, var(--brand) 8%), var(--shell-bg));
  border-right: 1px solid var(--shell-border);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  z-index: 2;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px; min-height: 40px; }
.brand__glyph { width: 30px; height: 34px; object-fit: contain; }
.brand__word { color: var(--text); font-size: 20px; font-weight: 780; letter-spacing: -0.7px; }
.brand__word > span { color: var(--shell-accent); }
.brand img { width: 30px; height: 34px; object-fit: contain; }

nav { margin-top: 30px; display: grid; gap: 4px; }
nav a {
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--shell-text);
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 38px;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}
nav a:hover { background: color-mix(in srgb, var(--shell-accent) 10%, transparent); color: var(--text); }
nav svg { width: 17px; height: 17px; stroke: var(--shell-accent); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.selected {
  background: var(--shell-active);
  color: var(--brand-strong);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 28%, transparent);
}
.selected svg { stroke: var(--brand-strong); }
.sidebar-bottom { margin-top: auto; padding: 18px 12px 4px; border-top: 1px solid var(--line); }
.sidebar-bottom .eyebrow { display: block; }
.sidebar-bottom p { font-size: 12px; color: var(--muted); margin: 6px 0 12px; }
.sidebar-bottom button { font-size: 12px; padding: 8px 12px; width: 100%; justify-content: center; }

/* ---- Layout ------------------------------------------------------------ */
main { margin-left: 236px; }
.topbar {
  height: 62px;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--shell-bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 26px;
  color: var(--muted);
  font-size: 12px;
}
.topbar > span:first-child { letter-spacing: 0.2px; }
#connection {
  color: var(--text);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
}
.page { max-width: 1520px; margin: auto; padding: 30px 26px 48px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { font-size: 11px; font-weight: 650; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-3); }

h1 { font-size: 27px; letter-spacing: -0.9px; font-weight: 800; color: var(--text); line-height: 1.12; margin: 0; }
h2 { font-size: 24px; color: var(--text); font-weight: 700; letter-spacing: -0.6px; margin: 6px 0 0; }
h3 { font-size: 16px; color: var(--text); margin: 0 0 20px; font-weight: 650; letter-spacing: -0.2px; }

.surface { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--e2); }

/* ---- KPI tiles: the product StatTile (frontend-v4 primitives/StatTile.vue).
   Sober by design: solid surface, one border, uppercase label, big tabular
   value. No accent bars, gradients, hover-lift or coloured numbers. --------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 22px;
  gap: 16px;
}
.stats > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.stats span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--text-3);
}
.stats strong {
  display: block;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 0;
  color: var(--text);
}
/* Each tile filters the list. Tone-shift on hover, no lift. */
.stats > div {
  cursor: pointer;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.stats > div:hover { background: var(--surface-2); }
.stats > div:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.stats > div.is-active { border-color: var(--brand); background: var(--surface-2); }
.stats > div.is-active span { color: var(--brand-text); }

/* ---- Toolbar and search ------------------------------------------------ */
.toolbar { padding: 20px 22px; display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.search { max-width: 380px; width: 100%; position: relative; }
/* Inline SVG icon, not a CSS mask: the page CSP is img-src 'self', which blocks
   data: URIs in mask/background. An inline element keeps it crisp and compliant. */
.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-3);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

input, select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  color: inherit;
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input:disabled { background: var(--bg); color: #8991a6; }
input::placeholder { color: var(--text-3); }
.search input { background: var(--bg-2); border-color: var(--hairline); padding-left: 38px; border-radius: var(--r-pill); }

/* ---- Table ------------------------------------------------------------- */
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; }
th {
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  padding: 12px 22px;
  border-block: 1px solid var(--line);
  position: sticky;
  top: 0;
}
td { padding: 15px 22px; border-bottom: 1px solid var(--line); font-size: 13px; }
td:first-child { min-width: 220px; }
td strong { font-weight: 650; color: var(--text); }
td small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 0.14s var(--ease); cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.tenant-label { display: flex; align-items: center; gap: 13px; }
.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--brand-soft), color-mix(in srgb, var(--brand-2) 18%, var(--surface)));
  color: var(--brand-strong);
  font-weight: 700;
  font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
  flex: none;
}

/* ---- Pills and badges -------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-pill);
  padding: 4px 11px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--hairline);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; flex: none; }
.badge.measured, .badge.sales-healthy { background: var(--good-soft); color: var(--good); border-color: var(--good-line); }
.badge.capacity, .badge.sales-call { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge.stale { background: var(--alert-soft); color: var(--alert); border-color: var(--alert-line); }
.badge.sales-unknown { background: var(--surface-3); color: var(--text-3); border-color: var(--hairline); }
.badge.sales-unknown::before { opacity: 0.5; }

/* Registration/status chip (self-contained). */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--hairline);
}
.pill.on { background: var(--good-soft); color: var(--good); border-color: var(--good-line); }

/* ---- Growth panel: sober StatTile-style cards, no gradients ------------ */
.growth-panel .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.growth-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.growth-metric {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.growth-metric:hover { background: var(--surface-2); border-color: var(--border-strong); }
.growth-metric__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.growth-metric__head > span:first-child {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; color: var(--text-3);
}
.growth-value { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.05; color: var(--text); }
.growth-dir {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--hairline); white-space: nowrap;
}
.growth-dir.rising { background: var(--good-soft); color: var(--good); border-color: var(--good-line); }
.growth-dir.declining { background: var(--alert-soft); color: var(--alert); border-color: var(--alert-line); }
.growth-dir.flat, .growth-dir.unknown { background: var(--surface-3); color: var(--text-3); border-color: var(--hairline); }
.spark { width: 100%; height: 30px; }
.spark polyline { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }

.seat { font-variant-numeric: tabular-nums; }
.table-footer { border-top: 1px solid var(--line); padding: 15px 22px; display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.footnote { font-size: 12px; color: var(--text-3); margin-top: 20px; line-height: 1.6; max-width: 720px; }
.empty { text-align: center; color: var(--muted); padding: 66px 20px; }

.notice {
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--brand-strong);
  padding: 13px 16px;
  border-radius: var(--r-md);
  margin: 0 0 20px;
  line-height: 1.55;
  font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}
.tenant-section .notice { margin: 0 22px 16px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.6; }

/* ---- Auth (login): 1:1 with frontend-v4 LoginScreen.vue ---------------- */
.auth { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; overflow: hidden; background: #05070f; font-family: var(--font); }
.auth[hidden] { display: none; }
.auth__shader { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.auth__haze { position: absolute; inset: 0; backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); background: rgba(5, 7, 15, 0.34); }
.glass {
  position: relative;
  width: 100%;
  max-width: 384px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
}
.glass__head { text-align: center; }
.glass__brand { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.glass__glyph { width: 26px; height: 26px; object-fit: contain; display: block; flex: none; }
.glass__word { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; color: #fff; }
.glass__word-2 { color: #8ea2ff; }
.glass__title { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: #fff; }
.glass__sub { margin: 8px 0 0; font-size: 14px; color: rgba(209, 213, 219, 0.95); }

.glass__form { display: flex; flex-direction: column; gap: 32px; }

.ffield { position: relative; }
.ffield__input {
  display: block; width: 100%; padding: 10px 0; font-family: inherit; font-size: 14px; color: #fff;
  background: transparent; border: 0; border-bottom: 2px solid rgba(209, 213, 219, 0.75); border-radius: 0; outline: none;
  transition: border-color 200ms ease;
}
.ffield__input--pw { padding-right: 34px; }
/* Underline-only focus, exactly like the product login. The global app input
   rules add a boxed outline and a ring; neither belongs on these fields. */
.ffield__input:focus,
.ffield__input:focus-visible { border-color: #3b82f6; outline: none; box-shadow: none; }
.ffield__label {
  position: absolute; top: 12px; left: 0; display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; color: rgba(209, 213, 219, 0.95);
  pointer-events: none; transform-origin: left top; transition: transform 300ms ease, color 300ms ease;
}
.ffield__icon { flex: none; }
.ffield__input:focus ~ .ffield__label,
.ffield__input:not(:placeholder-shown) ~ .ffield__label,
.ffield__input:-webkit-autofill ~ .ffield__label { transform: translateY(-24px) scale(0.75); }
.ffield__input:focus ~ .ffield__label { color: #60a5fa; }
.ffield__input:-webkit-autofill,
.ffield__input:-webkit-autofill:hover,
.ffield__input:-webkit-autofill:focus,
.ffield__input:-webkit-autofill:active,
.ffield__input:autofill {
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: #fff; caret-color: #fff;
  transition: background-color 9999999s step-end;
}
.ffield__toggle {
  position: absolute; right: 0; top: 8px; display: grid; place-items: center;
  width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent;
  color: rgba(209, 213, 219, 0.85); cursor: pointer; box-shadow: none; min-height: 0;
  transition: color 150ms ease, transform 150ms ease;
}
.ffield__toggle:hover { color: #fff; background: transparent; }
.ffield__toggle:active { transform: scale(0.92); }
.ffield__toggle:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.ffield__toggle svg { width: 17px; height: 17px; stroke-width: 1.8; }

.glass__row { display: flex; align-items: center; justify-content: space-between; margin-top: -12px; }
.glass__forgot { font-size: 12px; color: rgba(209, 213, 219, 0.95); text-decoration: none; transition: color 150ms ease; }
.glass__forgot:hover { color: #fff; }

.glass__submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 16px; font-family: inherit; font-size: 15px; font-weight: 600; color: #fff;
  background: #2563eb; border: none; border-radius: 8px; cursor: pointer; min-height: 0;
  box-shadow: none; transition: background 300ms ease, transform 150ms ease;
}
.glass__submit:hover:not(:disabled) { background: #1d4ed8; }
.glass__submit:active:not(:disabled) { transform: scale(0.985); }
.glass__submit:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.glass__submit:disabled { opacity: 0.6; cursor: default; }
.glass__arrow { width: 20px; height: 20px; stroke-width: 2; transition: transform 300ms ease; }
.glass__submit:hover:not(:disabled) .glass__arrow { transform: translateX(4px); }

.glass__err {
  margin: -8px 0 0; font-size: 13px; color: #fecaca;
  background: rgba(153, 27, 27, 0.35); border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 8px; padding: 10px 12px;
}

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  border-radius: 50%; animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ---- Dialog / editor --------------------------------------------------- */
dialog {
  width: min(800px, calc(100% - 32px));
  max-height: 90vh;
  border: 0;
  border-radius: var(--r-2xl);
  padding: 0;
  box-shadow: var(--e3);
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
dialog[open] { animation: dialog-in 0.24s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: rgba(7, 10, 22, 0.66); backdrop-filter: blur(6px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px; border-bottom: 1px solid var(--line); }
.dialog-heading button { border: 1px solid var(--hairline); width: 34px; padding: 0; justify-content: center; }
#onboarding-steps {
  display: flex;
  gap: 4px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  overflow-x: auto;
}
#onboarding-steps button {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--text-3);
  font-size: 12.5px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}
#onboarding-steps button:not(:disabled):not([aria-current="step"]):hover { background: var(--surface-2); color: var(--text-2); }
#onboarding-steps button[aria-current="step"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--hairline); }
#onboarding-steps button:disabled { opacity: 0.4; }

.form-section { padding: 26px 28px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 14px; }
.fields label { display: grid; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.fields label.checkbox { display: flex; align-items: center; align-self: end; min-height: 42px; }
.checkbox { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.checkbox input { width: 16px; min-height: 16px; accent-color: var(--brand); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; }
.form-actions .muted { max-width: 300px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-heading h3 { margin: 0; }

.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.checks li { display: flex; gap: 13px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease); }
.checks li:hover { background: var(--surface-3); border-color: var(--border-strong); }
.check-mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); flex-shrink: 0; font-size: 13px; font-weight: 700; }
.ready .check-mark { background: var(--good-soft); color: var(--good); }
.blocked .check-mark { background: var(--alert-soft); color: var(--alert); }
.demo .check-mark { background: var(--warn-soft); color: var(--warn); }
.checks strong { font-size: 12.5px; }
.checks p { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.deploy-footer { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.deploy-footer p { font-size: 12px; line-height: 1.6; color: var(--muted); }
.deploy { min-width: 148px; background: var(--primary-fill); color: #fff; letter-spacing: 1px; justify-content: center; border-color: transparent; }

fieldset { border: 0; padding: 0; margin: 18px 0; }
legend { font-size: 12px; font-weight: 650; margin-bottom: 12px; color: var(--text-2); }
#features { display: flex; gap: 22px; flex-wrap: wrap; }
#editor-notice { margin: 20px 28px 0; }

.tenant-links { display: grid; gap: 10px; }

.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; }

::selection { background: color-mix(in srgb, var(--brand) 55%, transparent); color: #fff; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-pill); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }

/* ---- Frosted (Liquid Glass), gated on html.app-frosted ----------------- */
html.app-frosted .surface {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.07), transparent 46%),
    color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), var(--e2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* A viewer sees every screen but no write controls. display:none wins over
   any JS that toggles the disabled state, so a viewer can never submit. */
body.role-viewer #new-tenant,
body.role-viewer #save-tenant,
body.role-viewer #save-license,
body.role-viewer #deploy-btn { display: none !important; }

/* ---- Deploy: button busy state, live step ladder, per-step detail, and the
   success result screen with the Polpo hero. All token-driven, so it follows
   the light theme. --------------------------------------------------------- */
.deploy__spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
  animation: auth-spin 0.7s linear infinite;
}

/* Success/progress result screen: the Polpo lands as a hero over a card that
   lists every provisioning step and its detail. */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background: rgba(6, 9, 18, 0.62);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}
.celebrate.is-in { opacity: 1; }
.celebrate.is-out { opacity: 0; }
.celebrate__card {
  position: relative;
  z-index: 1;
  width: min(540px, 94vw);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: var(--e3);
  overflow: visible;
  animation: celebrate-card-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}
@keyframes celebrate-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
/* The Polpo swims in left-to-right, then keeps a gentle idle bob the whole time
   the screen is open, so it always animates. */
.celebrate__polpo-wrap {
  display: block;
  margin-top: -80px;
  animation: polpo-swim 1.05s cubic-bezier(0.3, 0.8, 0.35, 1) 0.1s both;
}
.celebrate__polpo {
  width: min(140px, 34vw);
  display: block;
  filter: drop-shadow(0 16px 40px rgba(86, 97, 232, 0.4));
  will-change: transform;
  animation: polpo-bob 3.4s ease-in-out 1.2s infinite;
}
@keyframes polpo-swim {
  0%   { transform: translateX(-56vw) translateY(8px) rotate(-10deg) scale(0.72); opacity: 0; }
  35%  { opacity: 1; }
  72%  { transform: translateX(3%) translateY(-4px) rotate(5deg) scale(1.04); opacity: 1; }
  100% { transform: translateX(0) translateY(0) rotate(0) scale(1); opacity: 1; }
}
@keyframes polpo-bob {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-9px) rotate(-3deg); }
}
.celebrate__title { margin: 2px 0 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.celebrate__sub { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); text-align: center; }
.celebrate .dpl {
  width: 100%;
  margin-top: 4px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.celebrate__close {
  margin-top: 4px; height: 34px; padding: 0 22px;
  font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
  transition: background-color 0.15s ease;
}
.celebrate__close:hover { background: var(--surface-3); }
/* Speed lines that sweep left-to-right behind the card during the entrance. */
.celebrate__streaks { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.celebrate__streaks span {
  position: absolute; left: -30%; height: 2px; width: 28%; border-radius: 2px; opacity: 0;
  background: linear-gradient(to right, transparent, color-mix(in srgb, var(--brand) 70%, #3fd0ff), transparent);
  animation: polpo-streak 1s linear 3;
}
.celebrate__streaks span:nth-child(1) { top: 14%; animation-delay: 0s; }
.celebrate__streaks span:nth-child(2) { top: 24%; animation-delay: 0.35s; }
.celebrate__streaks span:nth-child(3) { top: 33%; animation-delay: 0.12s; }
.celebrate__streaks span:nth-child(4) { top: 42%; animation-delay: 0.5s; }
.celebrate__streaks span:nth-child(5) { top: 20%; animation-delay: 0.22s; }
.celebrate__streaks span:nth-child(6) { top: 38%; animation-delay: 0.62s; }
.celebrate__streaks span:nth-child(7) { top: 29%; animation-delay: 0.78s; }
@keyframes polpo-streak {
  0%   { transform: translateX(-30vw); opacity: 0; }
  20%  { opacity: 0.7; }
  100% { transform: translateX(150vw); opacity: 0; }
}

/* Provisioning steps: each is a disclosure that expands to its detail + the
   concrete values it produced. */
.dpl { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dpl__step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.dpl__row {
  width: 100%; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; column-gap: 12px;
  background: transparent; border: 0; padding: 9px 11px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
}
.dpl__step.is-empty .dpl__row { cursor: default; }
.dpl__icon { width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.dpl__step.is-done .dpl__icon, .dpl__step.is-running .dpl__icon { color: var(--brand-text); }
.dpl__icon svg { width: 18px; height: 18px; display: block; }
.dpl__body { min-width: 0; display: grid; gap: 1px; }
.dpl__title { font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dpl__step:not(.is-empty) .dpl__row:hover { background: var(--surface-2); }
.dpl__chip { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.dpl__step.is-done .dpl__chip { background: var(--brand); }
.dpl__step.is-failed .dpl__chip { background: var(--alert-soft); }
.dpl__step.is-pending .dpl__chip, .dpl__step.is-running .dpl__chip { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.dpl__chip svg { width: 13px; height: 13px; display: block; overflow: visible; }
.dpl__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.dpl__spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--brand) 30%, transparent); border-top-color: var(--brand); animation: auth-spin 0.7s linear infinite; }
.dpl__check { stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.dpl__x { stroke: var(--alert); stroke-width: 2.6; stroke-linecap: round; fill: none; }

/* Big, readable per-step detail window, opened over the result screen. */
.stepdetail {
  position: fixed; inset: 0; z-index: 320; display: grid; place-items: center; padding: 24px;
  background: rgba(6, 9, 18, 0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.2s ease;
}
.stepdetail.is-in { opacity: 1; }
.stepdetail__win {
  width: min(560px, 94vw); display: grid; gap: 16px; padding: 26px 28px 22px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-2xl);
  box-shadow: var(--e3); transform: translateY(10px) scale(0.98); transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.stepdetail.is-in .stepdetail__win { transform: none; }
.stepdetail__head { display: flex; align-items: center; gap: 14px; }
.stepdetail__icon { width: 46px; height: 46px; border-radius: var(--r-md); flex: none; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.stepdetail__icon svg { width: 24px; height: 24px; display: block; }
.stepdetail__title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.stepdetail__detail { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text); }
.stepdetail__label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: -6px; }
.stepdetail__actuals { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 12px 22px; align-items: baseline; }
.stepdetail__ak { color: var(--text-2); font-size: 14px; white-space: nowrap; }
.stepdetail__av { color: var(--text); font-size: 14px; word-break: break-word; font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace; }
.stepdetail__close {
  justify-self: end; margin-top: 4px; height: 38px; padding: 0 24px; font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; transition: background-color 0.15s ease;
}
.stepdetail__close:hover { background: var(--surface-3); }
@media (prefers-reduced-motion: reduce) {
  .celebrate, .celebrate__card, .celebrate__polpo-wrap, .celebrate__polpo { animation: none; transition: none; }
  .celebrate__polpo-wrap { margin-top: -80px; }
  .celebrate__streaks { display: none; }
  .stepdetail, .stepdetail__win { transition: none; }
  .stepdetail__win { transform: none; }
}

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 1100px) {
  .sidebar { width: 208px; }
  main { margin-left: 208px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar {
    position: static; width: auto; padding: 16px 18px; display: flex; flex-direction: row;
    align-items: center; justify-content: space-between; border-right: 0; flex-wrap: wrap; gap: 12px;
  }
  .brand { padding: 0; }
  nav a:not(.selected) { display: none; }
  .sidebar-bottom { margin: 0; padding: 0; border: 0; width: auto; }
  .sidebar-bottom > .eyebrow, .sidebar-bottom > p { display: none; }
  .sidebar-bottom button { width: auto; }
  nav { margin: 0; }
  main { margin: 0; }
  .topbar { height: 52px; padding: 0 18px; }
  .page { padding: 22px 16px 40px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .page-heading { align-items: start; }
  h1 { font-size: 23px; }
  input, select { font-size: 16px; }
  .fields { grid-template-columns: 1fr; }
  .form-section, .dialog-heading { padding: 22px; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions button { width: 100%; justify-content: center; }
  .toolbar { padding: 16px 18px; flex-direction: column; align-items: stretch; }
  .search { max-width: none; }
  .table-footer { gap: 14px; }
  table { white-space: normal; }
  thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  tbody, tr, td { display: block; }
  tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; padding: 18px; border-top: 1px solid var(--line); }
  td { padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  td:first-child, td:last-child { grid-column: 1 / -1; }
  td:not(:first-child):not(:last-child)::before { content: attr(data-label); display: block; margin-bottom: 6px; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
  td:last-child button { width: 100%; justify-content: center; }
  .growth-metrics { grid-template-columns: 1fr; }
  .deploy-footer { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  *, dialog[open] { transition: none !important; animation: none !important; }
  dialog::backdrop { backdrop-filter: none; }
}
