/*
 * Lastslate studio console.
 *
 * This page cannot load the editor's app.css, so it repeats the same
 * system with concrete values: the warm desk, graphite accent, Inter,
 * 7px buttons, a 36x20 switch, disabled = dimmed (never recoloured).
 * When a token moves in src/renderer/css/app.css, move it here too.
 */

@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-latin-opsz-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  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: 'Inter';
  src: url('fonts/inter-latin-ext-opsz-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  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: 'Courier Prime';
  src: url('fonts/CourierPrime-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg-base: #efede6;
  --bg-surface: #f7f6f1;
  --bg-elevated: #fffefb;
  --bg-hover: #e8e5dc;
  --border: #dedbd0;
  --border-soft: #e7e4da;
  --text-primary: #1f1f1e;
  --text-body: #2e2d29;
  --text-secondary: #4d4b46;
  --text-muted: #696660;
  --accent: #1f1f1e;
  --accent-text: #ffffff;
  --btn-primary-hover: #33322f;
  --green: #4a7550;
  --orange: #86602f;
  --red: #8a4646;
  --danger: #c0392b;
  --toggle-off: #cfccc1;
  --toggle-on: #1f1f1e;
  --shadow-1: 0 1px 2px rgba(41, 37, 28, 0.06);
  --shadow-2: 0 1px 2px rgba(41, 37, 28, 0.05), 0 8px 24px rgba(41, 37, 28, 0.09);
  --shadow-3: 0 2px 6px rgba(41, 37, 28, 0.06), 0 24px 60px rgba(41, 37, 28, 0.16);
  --scrim: rgba(31, 31, 30, 0.32);

  --hover-wash: color-mix(in srgb, var(--accent) 6%, transparent);
  --selected-wash: color-mix(in srgb, var(--accent) 12%, transparent);
  --focus-color: var(--accent);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 7px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-pill: 999px;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-strong: 560;
  --dur-1: 90ms;
  --dur-2: 140ms;
  --dur-3: 220ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --locked-opacity: 0.4;

  --font-ui: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-script: 'Courier Prime', 'Courier New', monospace;
  --sidebar-w: 248px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg-base: #191817;
    --bg-surface: #1f1e1c;
    --bg-elevated: #282725;
    --bg-hover: #2e2d2a;
    --border: #353430;
    --border-soft: #2b2a27;
    --text-primary: #ecece7;
    --text-body: #d6d4cd;
    --text-secondary: #bdbbb4;
    --text-muted: #9a978e;
    --accent: #ecece7;
    --accent-text: #141413;
    --btn-primary-hover: #d8d8d2;
    --green: #8fae8f;
    --orange: #c79a6b;
    --red: #c07070;
    --danger: #d9584a;
    --toggle-off: #45433e;
    --toggle-on: #ecece7;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.25), 0 10px 28px rgba(0, 0, 0, 0.36);
    --shadow-3: 0 2px 6px rgba(0, 0, 0, 0.3), 0 28px 64px rgba(0, 0, 0, 0.5);
    --scrim: rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg-base: #191817;
  --bg-surface: #1f1e1c;
  --bg-elevated: #282725;
  --bg-hover: #2e2d2a;
  --border: #353430;
  --border-soft: #2b2a27;
  --text-primary: #ecece7;
  --text-body: #d6d4cd;
  --text-secondary: #bdbbb4;
  --text-muted: #9a978e;
  --accent: #ecece7;
  --accent-text: #141413;
  --btn-primary-hover: #d8d8d2;
  --green: #8fae8f;
  --orange: #c79a6b;
  --red: #c07070;
  --danger: #d9584a;
  --toggle-off: #45433e;
  --toggle-on: #ecece7;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.25), 0 10px 28px rgba(0, 0, 0, 0.36);
  --shadow-3: 0 2px 6px rgba(0, 0, 0, 0.3), 0 28px 64px rgba(0, 0, 0, 0.5);
  --scrim: rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-body);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
p {
  margin: 0;
}
a {
  color: inherit;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: var(--weight-medium);
  line-height: 1.2;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out);
}
.btn:active {
  scale: 0.98;
}
.btn-small {
  font-size: 12px;
  padding: 7px 12px;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
}
.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-hover);
}
.btn-quiet {
  background: transparent;
  color: var(--text-secondary);
}
.btn-quiet:hover {
  background: var(--hover-wash);
  color: var(--text-primary);
}
/* The desktop app's destructive red (.btn-danger in app.css). White on it
   is 4.8:1; the old brick red read as a dull fill on a dark page. */
.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}
.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}
.btn-block {
  width: 100%;
}
.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:hover,
.icon-btn[aria-expanded='true'] {
  background: var(--hover-wash);
  color: var(--text-primary);
}
.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-primary);
  font-weight: var(--weight-medium);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px;
  cursor: pointer;
}
.link:hover {
  text-decoration-color: currentColor;
}

/* ------------------------------------------------------------ fields */

.field {
  display: grid;
  gap: 6px;
}
.field + .field {
  margin-top: 16px;
}
.label {
  font-size: 12.5px;
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.hint {
  font-size: 12.5px;
  color: var(--text-muted);
}
.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: var(--text-primary);
  transition: border-color var(--dur-2) var(--ease-out);
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
/* A field already has an edge, so focus thickens that edge instead of
   drawing the page-wide ring 2px outside it (two rings with a gap). */
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  border-color: var(--focus-color);
  outline: 2px solid var(--focus-color);
  outline-offset: -1px;
}
.stepper input:focus-visible {
  outline: none;
}
.stepper:has(input:focus-visible) {
  border-color: var(--focus-color);
  outline: 2px solid var(--focus-color);
  outline-offset: -1px;
}
.textarea {
  min-height: 96px;
  resize: vertical;
}
.select {
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.select-inline {
  width: auto;
  min-width: 0;
  max-width: 240px;
  padding: 5px 26px 5px 8px;
  font-size: 13px;
  background-color: transparent;
  border-color: transparent;
  background-position:
    calc(100% - 13px) 50%,
    calc(100% - 8px) 50%;
}
.select-inline:hover {
  background-color: var(--hover-wash);
  border-color: transparent;
}
.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: var(--locked-opacity);
  cursor: not-allowed;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex: none;
}
.toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--toggle-off);
  transition: background-color var(--dur-2) var(--ease-out);
  pointer-events: none;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-1);
  transition: translate var(--dur-2) var(--ease-out);
}
.toggle input:checked + .toggle-track {
  background: var(--toggle-on);
}
.toggle input:checked + .toggle-track::after {
  translate: 16px 0;
  background: var(--accent-text);
}
.toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}
.toggle input:disabled {
  cursor: not-allowed;
}
.toggle:has(input:disabled) {
  opacity: var(--locked-opacity);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.stepper button {
  width: 34px;
  height: 36px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
}
.stepper button:hover {
  background: var(--hover-wash);
}
.stepper button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.stepper input {
  width: 52px;
  height: 36px;
  border: 0;
  background: transparent;
  text-align: center;
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  appearance: none;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--hover-wash);
  border-radius: var(--radius-md);
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
}
.segmented button[aria-pressed='true'] {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-1);
}

/* ------------------------------------------------------------ sign-in */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}
.auth-story {
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: var(--weight-strong);
  font-size: 15px;
  color: var(--text-primary);
  text-decoration: none;
}
.brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}
.brand-sub {
  color: var(--text-muted);
  font-weight: var(--weight-regular);
}
.slug {
  font-family: var(--font-script);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.auth-story h1 {
  margin-top: 14px;
  font-size: clamp(34px, 4.2vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.028em;
  font-weight: var(--weight-strong);
  color: var(--text-primary);
  max-width: 13ch;
}
.auth-story .lede {
  margin-top: 18px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 44ch;
}
.ticks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  max-width: 560px;
}
.ticks li {
  display: flex;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
}
.ticks svg {
  flex: none;
  margin-top: 3px;
  color: var(--text-primary);
}
.auth-panel {
  background: var(--bg-surface);
  display: grid;
  place-items: center;
  padding: 40px 24px;
}
.auth-card {
  width: min(380px, 100%);
}
.auth-card h2 {
  font-size: 22px;
  letter-spacing: -0.015em;
  font-weight: var(--weight-strong);
  color: var(--text-primary);
}
.auth-card .sub {
  margin-top: 6px;
  color: var(--text-muted);
}
.auth-actions {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.or::before,
.or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.fineprint {
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ------------------------------------------------------------ shell */

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  gap: 4px;
  overflow-y: auto;
}
.org-card {
  padding: 8px 10px 14px;
}
.org-name {
  font-size: 15px;
  font-weight: var(--weight-strong);
  color: var(--text-primary);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.org-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}
.nav {
  display: grid;
  gap: 1px;
}
.nav-label {
  padding: 14px 10px 6px;
  font-size: 11px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: var(--weight-medium);
}
.nav a:hover {
  background: var(--hover-wash);
  color: var(--text-primary);
}
.nav a[aria-current='page'] {
  background: var(--selected-wash);
  color: var(--text-primary);
}
.nav svg {
  flex: none;
  opacity: 0.85;
}
.nav .tag {
  margin-left: auto;
}
.sidebar-foot {
  margin-top: auto;
  padding: 12px 10px 0;
  display: grid;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.sidebar-foot .who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.main {
  background: var(--bg-surface);
  min-height: 100vh;
  border-left: 1px solid var(--border-soft);
}
.main-solo {
  border-left: 0;
}
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 40px 80px;
  animation: pane-in var(--dur-3) var(--ease-out);
}
.page-narrow {
  max-width: 760px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-title {
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: var(--weight-strong);
  color: var(--text-primary);
}
.page-sub {
  margin-top: 6px;
  color: var(--text-muted);
  max-width: 62ch;
}
.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--hover-wash);
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 20px;
}
.banner strong {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}
.banner .grow {
  flex: 1;
}
.banner-warn {
  background: color-mix(in srgb, var(--orange) 14%, transparent);
}
.testbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 7px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--orange) 16%, var(--bg-surface));
}

/* ------------------------------------------------------------ surfaces */

.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  padding: 20px 22px;
}
.page > * + *,
.card + .card {
  margin-top: 16px;
}
.page > .page-head + *,
.page > .toolbar + * {
  margin-top: 0;
}
.card-title {
  font-size: 15px;
  font-weight: var(--weight-strong);
  color: var(--text-primary);
  letter-spacing: -0.005em;
}
.card-sub {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
  max-width: 64ch;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
/* A button beside a title keeps its width, and beside a title with a
   paragraph under it sits level with the middle of the two. */
.card-head > .btn {
  flex: none;
}
.card-head-center {
  align-items: center;
}
.row > .btn {
  flex: none;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid > .card + .card,
.role-grid > .card + .card {
  margin-top: 0;
}
.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
}
.stat-value {
  margin-top: 6px;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: var(--weight-strong);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.stat-note {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.meter {
  margin-top: 12px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--hover-wash);
  overflow: hidden;
}
.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--hover-wash);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.tag-on {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, transparent);
}
.tag-off {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 13%, transparent);
}
.tag-warn {
  color: var(--orange);
  background: color-mix(in srgb, var(--orange) 15%, transparent);
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.rows {
  display: grid;
}
.row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border-soft);
}
.row:first-child {
  border-top: 0;
  padding-top: 0;
}
.row:last-child {
  padding-bottom: 0;
}
.row-main {
  flex: 1;
  min-width: 0;
}
.row-title {
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.row-desc {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-muted);
  max-width: 68ch;
}
.row-locked .row-main {
  opacity: var(--locked-opacity);
}

/* ------------------------------------------------------------ tables */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar .grow {
  flex: 1;
}
.search {
  width: min(280px, 100%);
}
.tabs {
  display: inline-flex;
  gap: 2px;
}
.tabs button {
  border: 0;
  background: transparent;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
}
.tabs button:hover {
  background: var(--hover-wash);
  color: var(--text-primary);
}
.tabs button[aria-selected='true'] {
  background: var(--selected-wash);
  color: var(--text-primary);
}
.table-wrap {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  text-align: left;
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  padding: 12px 10px 10px;
  white-space: nowrap;
}
td {
  padding: 10px 10px;
  border-top: 1px solid var(--border-soft);
  vertical-align: middle;
}
th:first-child,
td:first-child {
  padding-left: 18px;
}
th:last-child,
td:last-child {
  padding-right: 14px;
}
td .nowrap {
  white-space: nowrap;
}
tbody tr:hover td {
  background: var(--hover-wash);
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
td.tight {
  width: 1%;
  white-space: nowrap;
}
.person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--selected-wash);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: var(--weight-strong);
}
.person-name {
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-email {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty {
  padding: 44px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty h3 {
  font-size: 15px;
  font-weight: var(--weight-strong);
  color: var(--text-primary);
  margin-bottom: 6px;
}
.empty .btn {
  margin-top: 16px;
}

/* ------------------------------------------------------------ roles */

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.role-card {
  text-align: left;
  border: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow var(--dur-2) var(--ease-out);
}
.role-card:hover {
  box-shadow: var(--shadow-2);
}
.role-card .card-sub {
  flex: 1;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.role-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
.model-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  padding-left: 2px;
}

/* ------------------------------------------------------------ onboarding */

.wizard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}
.wizard-rail {
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: var(--text-muted);
  font-size: 13.5px;
}
.steps .n {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: var(--weight-medium);
  background: var(--hover-wash);
}
/* A finished step that can be opened again. */
.steps .step-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.steps .step-link:hover {
  color: var(--text-primary);
}
.steps .step-link:hover .n {
  background: var(--selected-wash);
}
.steps .step-link:focus-visible {
  outline-offset: 4px;
}
.steps li[data-state='current'] {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}
.steps li[data-state='current'] .n {
  background: var(--accent);
  color: var(--accent-text);
}
.steps li[data-state='done'] .n {
  background: var(--selected-wash);
  color: var(--text-primary);
}
.wizard-main {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-soft);
  display: grid;
  place-items: start center;
  padding: 72px 32px;
}
.wizard-body {
  width: min(600px, 100%);
  animation: pane-in var(--dur-3) var(--ease-out);
}
.wizard-body h1 {
  margin-top: 10px;
  font-size: 32px;
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: var(--weight-strong);
  color: var(--text-primary);
}
.wizard-body .lede {
  margin-top: 10px;
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 54ch;
}
.wizard-form {
  margin-top: 28px;
}
.wizard-actions {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.choice-list {
  display: grid;
  gap: 10px;
}
.choice {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  border: 1px solid transparent;
}
.choice:hover {
  border-color: var(--border);
}
.choice:has(input:checked) {
  border-color: var(--accent);
}
.choice input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}
.choice-title {
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.choice-desc {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-muted);
}
/* The people just invited, under the form that invited them. */
.invited {
  margin-top: 28px;
}
.invited .rows {
  margin-top: 10px;
}
.seat-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border-soft);
}
.seat-row:first-child {
  border-top: 0;
}
.seat-row .row-main {
  flex: 1;
}
.price {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}
.total .amount {
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: var(--weight-strong);
  font-variant-numeric: tabular-nums;
}
.checklist {
  display: grid;
  gap: 2px;
}
.checklist a,
.checklist .done {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  margin: 0 -8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
}
.checklist a:hover {
  background: var(--hover-wash);
}
.checklist .done {
  color: var(--text-muted);
}
.checklist .mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--text-muted) 55%, transparent);
  display: grid;
  place-items: center;
  flex: none;
}
.checklist .done .mark {
  border-color: transparent;
  background: var(--selected-wash);
  color: var(--text-primary);
}
.checklist .go {
  margin-left: auto;
  color: var(--text-muted);
}

/* ------------------------------------------------------------ overlays */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade-in var(--dur-2) var(--ease-out);
}
.dialog {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  padding: 24px;
  animation: dialog-in var(--dur-3) var(--ease-out);
}
.dialog-wide {
  width: min(640px, 100%);
}
.dialog h2 {
  font-size: 18px;
  letter-spacing: -0.01em;
  font-weight: var(--weight-strong);
  color: var(--text-primary);
}
.dialog .sub {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13.5px;
}
.dialog-body {
  margin-top: 20px;
}
.dialog-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.dialog-actions .left {
  margin-right: auto;
}
.form-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
  font-size: 13px;
}
.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.two .field + .field {
  margin-top: 0;
}
.two + .field,
.field + .two {
  margin-top: 16px;
}

.menu {
  position: fixed;
  z-index: 50;
  min-width: 220px;
  padding: 5px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  animation: popover-in var(--dur-2) var(--ease-out);
}
.menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
}
.menu button:hover,
.menu button:focus-visible {
  background: var(--hover-wash);
  outline: none;
}
.menu button.danger {
  color: var(--danger);
}
.menu button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.menu hr {
  border: 0;
  height: 1px;
  margin: 5px 6px;
  background: var(--border-soft);
}

.toasts {
  position: fixed;
  top: 20px;
  left: 50%;
  translate: -50% 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: min(520px, calc(100vw - 32px));
}
/* The desktop app's toast (.toast in src/renderer/css/app.css): a raised
   card with a 3px rule in the result's colour, an icon, the words and a
   close button. The app's rises from the bottom, over its status bar;
   here it drops from the top, where this page's actions are (owner's
   call, Nov 2026). Keep the two in step. */
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: var(--weight-medium);
  line-height: 1.35;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  opacity: 0;
  translate: 0 -8px;
  transition:
    opacity var(--dur-3) var(--ease-out),
    translate var(--dur-3) var(--ease-out);
}
.toast.toast-visible {
  opacity: 1;
  translate: 0 0;
}
.toast-error {
  border-left-color: var(--orange);
}
.toast-icon {
  flex: 0 0 auto;
  font-weight: var(--weight-strong);
  color: var(--green);
}
.toast-error .toast-icon {
  color: var(--orange);
}
.toast-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.toast-close {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.toast-close:hover {
  background: var(--hover-wash);
  color: var(--text-primary);
}
@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.toast-visible {
    translate: 0 0;
  }
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.copy-row .input {
  flex: 1;
  min-width: 0;
}
.kv {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 16px;
  font-size: 13.5px;
}
.kv dt {
  color: var(--text-muted);
}
.kv dd {
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.kv dd.kv-missing {
  color: var(--text-muted);
}
.loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.center-card {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.center-card .card {
  width: min(460px, 100%);
  padding: 28px;
}

.mt-12 {
  margin-top: 12px;
}
.mt-16 {
  margin-top: 16px;
}
.mt-20 {
  margin-top: 20px;
}
.stack {
  display: grid;
  gap: 16px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes dialog-in {
  from {
    opacity: 0;
    translate: 0 8px;
    scale: 0.985;
  }
}
@keyframes popover-in {
  from {
    opacity: 0;
    translate: 0 -4px;
  }
}
@keyframes pane-in {
  from {
    opacity: 0;
    translate: 0 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
  @keyframes dialog-in {
    from {
      opacity: 0;
    }
  }
  @keyframes popover-in {
    from {
      opacity: 0;
    }
  }
  @keyframes pane-in {
    from {
      opacity: 0;
    }
  }
}

@media (max-width: 900px) {
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-story {
    padding: 32px 24px;
    gap: 28px;
  }
  .ticks {
    grid-template-columns: 1fr;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .sidebar-foot {
    margin-top: 12px;
  }
  .main {
    border-left: 0;
  }
  .page {
    padding: 24px 16px 64px;
  }
  .grid-3,
  .grid-2,
  .two {
    grid-template-columns: 1fr;
  }
  .wizard {
    grid-template-columns: 1fr;
  }
  .wizard-rail {
    padding: 24px;
    gap: 16px;
  }
  .steps {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }
  .steps .t {
    display: none;
  }
  .wizard-main {
    padding: 32px 16px;
    border-left: 0;
  }
}
