/* ==========================================================================
   Components — the intranet's primitives, as plain CSS.

   Each block names the intranet component it follows (CaplaIntranet
   src/components/…). The class names are Connect's own, so the existing
   pages and scripts keep their markup; the look is the intranet's.

   The rule from the intranet holds here: use the token or the component that
   exists. Never invent a colour, a surface, a status look or a button in a
   page stylesheet.
   ========================================================================== */

/* ---------- Wordmark (capla-logo.tsx) ----------
   The supplied lockups: white on ink (the rail, the bar), ink on paper. */
.capla-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: hsl(var(--foreground));
  line-height: 1;
}
.capla-wordmark:hover { text-decoration: none; }
.capla-wordmark__logo {
  display: block;
  height: 1.75rem;
  width: auto;
  object-fit: contain;
}
.capla-wordmark--lg .capla-wordmark__logo { height: 2.5rem; }
.capla-wordmark--xl .capla-wordmark__logo { height: 3.25rem; }
/* Auto: ink on paper, white on ink. */
.capla-wordmark__logo--white { display: none; }
.dark .capla-wordmark__logo--ink { display: none; }
.dark .capla-wordmark__logo--white { display: block; }
.capla-wordmark__sub {
  font-size: 10px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.capla-wordmark__hex { width: 1.5rem; height: 1.5rem; flex: none; }

/* Brand-gradient text (text-brand-gradient). */
.brand-gradient-text {
  background-image: linear-gradient(100deg, hsl(var(--brand-from)), hsl(var(--brand-mid)) 60%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons (ui/button.tsx) ----------
   Capsules that dip under the finger. 44 px by default (a fingertip), 36 px
   in headers and toolbars.

     .btn--primary      default: the one main action of a card or form
     .btn--ghost        outline: a tinted capsule, the secondary action
     .btn--secondary    secondary: a quieter one
     .btn--quiet        ghost: a toolbar or icon button
     .btn--danger       destructive: cannot be undone
     .btn--link         an action that reads as text                     */
.btn {
  --btn-bg: hsl(var(--secondary));
  --btn-fg: hsl(var(--secondary-foreground));
  --btn-bg-hover: hsl(var(--secondary) / 0.8);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.34s var(--ease-spring),
    background-color 0.2s ease,
    box-shadow 0.3s var(--ease-capla),
    color 0.2s ease;
}
.btn:hover { background: var(--btn-bg-hover); text-decoration: none; }
.btn:active { transform: scale(0.972); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.btn svg { width: 1rem; height: 1rem; flex-shrink: 0; }

.btn--primary {
  --btn-bg: hsl(var(--primary));
  --btn-fg: hsl(var(--primary-foreground));
  --btn-bg-hover: hsl(var(--primary) / 0.92);
  box-shadow: var(--shadow-sm);
}
.btn--ghost,
.btn--outline {
  --btn-bg: hsl(var(--primary) / 0.1);
  --btn-fg: hsl(var(--primary));
  --btn-bg-hover: hsl(var(--primary) / 0.16);
}
.dark .btn--ghost,
.dark .btn--outline {
  --btn-bg: rgba(255, 255, 255, 0.1);
  --btn-fg: hsl(var(--foreground));
  --btn-bg-hover: rgba(255, 255, 255, 0.16);
}
.btn--secondary {
  --btn-bg: hsl(var(--secondary));
  --btn-fg: hsl(var(--secondary-foreground));
  --btn-bg-hover: hsl(var(--secondary) / 0.8);
}
.btn--quiet {
  --btn-bg: transparent;
  --btn-fg: hsl(var(--foreground));
  --btn-bg-hover: hsl(var(--accent));
}
.btn--danger,
.btn--destructive {
  --btn-bg: hsl(var(--destructive));
  --btn-fg: hsl(var(--destructive-foreground));
  --btn-bg-hover: hsl(var(--destructive) / 0.92);
  box-shadow: var(--shadow-sm);
}
.btn--link {
  --btn-bg: transparent;
  --btn-fg: hsl(var(--primary));
  --btn-bg-hover: transparent;
  height: auto;
  padding: 0;
}
.btn--link:hover { text-decoration: underline; text-underline-offset: 4px; }

.btn--sm { height: 2.25rem; padding: 0 1rem; font-size: var(--text-sm); }
.btn--lg { height: 3rem; padding: 0 1.75rem; font-size: var(--text-base); }
.btn--icon { width: 2.75rem; padding: 0; }
.btn--sm.btn--icon { width: 2.25rem; }
.btn--block { width: 100%; }

/* ---------- Badge (ui/badge.tsx) — a tag: a kind, a flag, a count ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.625rem;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.33;
  white-space: nowrap;
}
.badge--secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge--success { background: hsl(var(--success) / 0.12); color: hsl(var(--success)); }
.badge--warning { background: hsl(var(--warning) / 0.15); color: hsl(var(--warning)); }
.badge--destructive { background: hsl(var(--destructive) / 0.1); color: hsl(var(--destructive)); }
.badge--outline { background: transparent; border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.badge__dot {
  width: 0.375rem; height: 0.375rem;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* ---------- Status pill (five-pillars/status-pill.tsx) ----------
   A record's status: five tones, and always the word as well as the colour. */
.pill {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-full);
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 0.375rem; height: 0.375rem;
  border-radius: var(--radius-full);
  background: currentColor;
  opacity: 0.5;
}
.pill--sm { padding: 0.125rem 0.625rem; font-size: 11px; }
.pill--info     { background: hsl(var(--signal) / 0.12);  color: hsl(var(--signal));  border-color: hsl(var(--signal) / 0.3); }
.pill--positive { background: hsl(var(--success) / 0.12); color: hsl(var(--success)); border-color: hsl(var(--success) / 0.3); }
.pill--warning  { background: hsl(var(--warning) / 0.12); color: hsl(var(--warning)); border-color: hsl(var(--warning) / 0.3); }
.pill--critical { background: hsl(var(--destructive) / 0.1); color: hsl(var(--destructive)); border-color: hsl(var(--destructive) / 0.3); }
.pill--info::before, .pill--positive::before, .pill--warning::before, .pill--critical::before { opacity: 1; }

/* ---------- Card (ui/card.tsx) — every surface is a panel ---------- */
.card {
  min-width: 0;
  padding: var(--space-5);
  color: hsl(var(--card-foreground));
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border) / 0.75);
  background-color: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-light-card);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
}
.dark .card {
  border-color: rgba(255, 255, 255, 0.1);
  background-color: rgba(14, 42, 73, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow-light-card);
}
@media (prefers-reduced-transparency: reduce) {
  .card, .dark .card { background-color: hsl(var(--card)); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.card__title {
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-2);
}
.card__body,
.card__description { color: hsl(var(--muted-foreground)); font-size: var(--text-sm); line-height: var(--leading-relaxed); }
/* Something measured: a cyan edge under the brand hairline. */
.card--accent,
.card--instrument {
  position: relative;
  overflow: hidden;
  border-color: hsl(var(--signal) / 0.3);
}
.card--accent::before,
.card--instrument::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background-image: linear-gradient(90deg, hsl(var(--brand-from)), hsl(var(--brand-mid)) 55%, hsl(var(--brand-to)));
}
/* Supporting matter that must not compete. */
.card--quiet {
  background: transparent;
  border: 1px dashed hsl(var(--border));
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ---------- Page header (page-header.tsx) ----------
   Eyebrow after a brand hairline, the title in Manrope, one or two sentences
   under it, the actions to the right. One soft glow where the page announces
   itself. */
.page-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}
.page-header::before {
  content: "";
  position: absolute;
  left: -6rem;
  top: -7rem;
  z-index: -1;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.7;
  background-image: radial-gradient(closest-side, rgba(33, 173, 242, 0.2), transparent 100%);
}
.eyebrow,
.page-header__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.eyebrow::before,
.page-header__eyebrow::before {
  content: "";
  flex: none;
  width: 3px;
  height: 0.875rem;
  border-radius: var(--radius-full);
  background-image: linear-gradient(90deg, hsl(var(--brand-from)), hsl(var(--brand-mid)) 55%, hsl(var(--brand-to)));
}
.page-header__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.125rem);
  font-weight: var(--weight-extrabold);
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin: 0;
}
.page-header__description {
  margin-top: 0.375rem;
  max-width: 42rem;
  font-size: var(--text-body);
  line-height: var(--leading-relaxed);
  color: hsl(var(--muted-foreground));
}
.page-header__actions { display: flex; align-items: center; gap: var(--space-2); }

/* A chapter label inside a page: the eyebrow on its own (Band label). */
.section-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.section-label::before {
  content: "";
  flex: none;
  width: 3px;
  height: 0.875rem;
  border-radius: var(--radius-full);
  background-image: linear-gradient(90deg, hsl(var(--brand-from)), hsl(var(--brand-mid)) 55%, hsl(var(--brand-to)));
}

/* ---------- Readout (readout.tsx) — a headline figure and what it is ---------- */
.readout { display: flex; flex-direction: column; gap: 0.375rem; }
.readout__value {
  font-family: var(--font-display);
  font-weight: var(--weight-extrabold);
  font-size: 2.25rem;
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--foreground));
}
.readout__label { font-size: var(--text-body); font-weight: var(--weight-semibold); line-height: 1.25; }
.readout__sub { font-size: 13px; color: hsl(var(--muted-foreground)); }

/* ---------- Icon tile (ios/tile.tsx) — a glyph at app-icon strength ---------- */
.icon-tile {
  --tile-a: #4aa3ff;
  --tile-b: #0b59bf;
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 30%;
  background-image: linear-gradient(160deg, var(--tile-a), var(--tile-b));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 14px -6px var(--tile-b);
  color: #fff;
}
.icon-tile svg { width: 22px; height: 22px; stroke-width: 2.2; }
.icon-tile--sm { width: 1.75rem; height: 1.75rem; }
.icon-tile--sm svg { width: 1rem; height: 1rem; }
.icon-tile--red    { --tile-a: #ff7a6b; --tile-b: #d5342b; }
.icon-tile--green  { --tile-a: #5fe3c0; --tile-b: #0f9d76; }
.icon-tile--amber  { --tile-a: #ffc35c; --tile-b: #f08a1d; }
.icon-tile--cyan   { --tile-a: #79e2ff; --tile-b: #0f9bd7; }
.icon-tile--violet { --tile-a: #b79bff; --tile-b: #6d4bd6; }
/* The quiet register (empty-state.tsx): a tinted squircle, not a lit one. */
.icon-tile--quiet {
  background: hsl(var(--primary) / 0.1);
  box-shadow: inset 0 0 0 1px hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
}

/* ---------- Empty state (empty-state.tsx) — real data or no data ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1.5rem;
  border-radius: var(--radius);
  background: hsl(var(--muted) / 0.45);
  text-align: center;
}
.empty-state__title,
.empty-state strong {
  display: block;
  font-size: 17px;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  color: hsl(var(--foreground));
}
.empty-state__description,
.empty-state p {
  margin-top: 0.375rem;
  max-width: 28rem;
  font-size: var(--text-body);
  line-height: var(--leading-snug);
  color: hsl(var(--muted-foreground));
}

/* ---------- Fields (ui/input.tsx, select-native.tsx, textarea.tsx, label.tsx) ----------
   Filled, iOS style: the fill is the affordance, so there is no border until
   the field has focus. 44 px high, 12 px corners. */
.input, .select, .textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.5rem 0.875rem;
  font: inherit;
  font-size: var(--text-body);
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / 0.7);
  border: 1px solid transparent;
  border-radius: var(--radius-field);
  transition: background-color var(--duration) var(--ease), border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.textarea { min-height: 5.5rem; line-height: var(--leading-normal); }
.input::placeholder, .textarea::placeholder { color: hsl(var(--muted-foreground) / 0.7); }
.input:hover, .select:hover, .textarea:hover { background: hsl(var(--muted)); }
.input:focus, .select:focus, .textarea:focus,
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none;
  border-color: hsl(var(--primary) / 0.4);
  background: hsl(var(--background));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.4);
}
.input:disabled, .select:disabled, .textarea:disabled { cursor: not-allowed; opacity: 0.5; }

.label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  color: hsl(var(--foreground));
}
.hint { font-size: var(--text-xs); color: hsl(var(--muted-foreground)); }

/* ---------- Table (ui/table.tsx) ----------
   A grouped list rather than a spreadsheet: no vertical rules, a quiet caps
   head, generous rows, a hairline only between rows. */
.table-wrap { position: relative; width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-body); }
.table thead { border-bottom: 1px solid hsl(var(--border) / 0.6); }
.table th {
  height: 2.5rem;
  padding: 0 1rem;
  text-align: left;
  vertical-align: middle;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.table td { padding: 0.75rem 1rem; vertical-align: middle; font-size: 14px; }
.table tbody tr { border-bottom: 1px solid hsl(var(--border) / 0.55); transition: background-color var(--duration) var(--ease); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: hsl(var(--accent) / 0.35); }

/* A record's facts (the intranet's <dl> recipe). */
.facts { display: grid; gap: 0.75rem 1.5rem; font-size: var(--text-sm); margin: 0; }
@media (min-width: 40rem) { .facts { grid-template-columns: 10rem 1fr; } }
.facts dt { color: hsl(var(--muted-foreground)); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Notice inside a card (the tint recipe) ---------- */
/* A notice reads as text: a bold first sentence runs on into the rest.
   (Laid out as a row, the bold part became a column of its own.) */
.alert {
  display: block;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: var(--radius-field);
  background: hsl(var(--muted) / 0.7);
  color: hsl(var(--foreground));
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}
.alert--error   { background: hsl(var(--destructive) / 0.1); color: hsl(var(--destructive)); }
.alert--warning { background: hsl(var(--warning) / 0.1); color: hsl(var(--foreground)); }
.alert--success { background: hsl(var(--success) / 0.1); color: hsl(var(--success)); }
.alert--info    { background: hsl(var(--signal) / 0.1); color: hsl(var(--foreground)); }
.alert[hidden] { display: none; }
.alert strong { font-weight: var(--weight-semibold); }

/* ---------- Stat readout (older name for a mono figure) ---------- */
.stat { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: hsl(var(--foreground)); }
.stat__label { font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.stat__value { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-extrabold); letter-spacing: -0.045em; }

/* ---------- Tile: a way in (ios/widget.tsx) ---------- */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-5);
  color: hsl(var(--card-foreground));
  text-align: left;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border) / 0.75);
  background-color: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-light-card);
  transition: transform 0.25s var(--ease-capla), box-shadow 0.25s var(--ease-capla), border-color 0.25s var(--ease-capla);
}
.dark .tile { border-color: rgba(255, 255, 255, 0.1); background-color: rgba(14, 42, 73, 0.58); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow-light-card); }
.tile:hover { transform: translateY(-4px); border-color: hsl(var(--signal) / 0.4); box-shadow: var(--shadow-light-card-hover); text-decoration: none; }
.tile__icon {
  display: grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: 30%;
  background-image: linear-gradient(160deg, #4aa3ff, #0b59bf);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 14px -6px #0b59bf;
  color: #fff;
}
.tile__icon svg { width: 22px; height: 22px; }
.tile__title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-bold); letter-spacing: -0.02em; }
.tile__desc { flex: 1; font-size: var(--text-sm); line-height: var(--leading-relaxed); color: hsl(var(--muted-foreground)); }
.tile__cta { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: hsl(var(--primary)); }
.tile__cta svg { width: 1rem; height: 1rem; transition: transform var(--duration) var(--ease); }
.tile:hover .tile__cta svg { transform: translateX(3px); }

/* ---------- Sign-in (app/login/page.tsx) ----------
   The wordmark over one card on paper, a faint reticle bleeding from the top. */
.auth-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-12) var(--space-4);
}
.auth-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 16rem;
  pointer-events: none;
  background-image:
    linear-gradient(hsl(var(--border) / 0.6) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--border) / 0.6) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 78%);
}
.auth-brand { position: relative; margin-bottom: var(--space-8); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.auth-brand .capla-wordmark__logo { height: 2.5rem; }
.auth-card {
  position: relative;
  width: 100%;
  max-width: 26rem;
  padding: var(--space-5);
  color: hsl(var(--card-foreground));
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border) / 0.75);
  background-color: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-light-card);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
}
.dark .auth-card { border-color: rgba(255, 255, 255, 0.1); background-color: rgba(14, 42, 73, 0.58); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow-light-card); }
.auth-card__head { margin-bottom: var(--space-5); }
.auth-card__icon { display: none; }
.auth-card__title {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  letter-spacing: var(--tracking-tight);
}
.auth-card__sub { margin-top: 0.375rem; font-size: var(--text-sm); color: hsl(var(--muted-foreground)); line-height: var(--leading-snug); }
.auth-foot { position: relative; margin-top: var(--space-6); font-size: var(--text-sm); color: hsl(var(--muted-foreground)); text-align: center; }

.auth-form { display: flex; flex-direction: column; gap: var(--space-3); }
.auth-form__row { display: flex; flex-direction: column; gap: 0.5rem; }
.auth-form__hint { font-size: var(--text-xs); color: hsl(var(--muted-foreground)); line-height: var(--leading-snug); }
.auth-form__between {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--text-sm);
}
.auth-form__between label { display: inline-flex; align-items: center; gap: 0.5rem; color: hsl(var(--muted-foreground)); }
.auth-form__submit { width: 100%; }
.auth-form__alt {
  margin-top: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: hsl(var(--muted-foreground));
}

/* ---------- Tenant picker (sign-in step) ---------- */
.tenant-list { display: flex; flex-direction: column; gap: var(--space-2); }
.tenant-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.75rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid transparent;
  border-radius: var(--radius-field);
  background: hsl(var(--muted) / 0.7);
  cursor: pointer;
  transition: background-color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.tenant-option:hover { background: hsl(var(--muted)); }
.tenant-option input[type="radio"] {
  appearance: none;
  position: relative;
  flex: none;
  width: 1.1rem; height: 1.1rem;
  border: 2px solid hsl(var(--muted-foreground));
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease);
}
.tenant-option input[type="radio"]:checked { border-color: hsl(var(--primary)); }
.tenant-option input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: var(--radius-full);
  background: hsl(var(--primary));
}
.tenant-option:has(input:checked) { border-color: hsl(var(--primary) / 0.4); background: hsl(var(--accent) / 0.6); }
.tenant-option__name { flex: 1; font-weight: var(--weight-medium); }
.tenant-option__role { font-size: var(--text-xs); color: hsl(var(--muted-foreground)); }

/* ---------- Divider with a word ---------- */
.divider-label {
  display: flex; align-items: center; gap: 0.75rem;
  margin: var(--space-1) 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: hsl(var(--muted-foreground));
}
.divider-label::before,
.divider-label::after {
  content: "";
  flex: 1;
  border-top: 1px solid hsl(var(--border));
}

/* ---------- Dialog (the #modal-slot host pattern) ----------
   Used by src/sharing/share-dialog.js and the viewer's scene dialogs. A
   thick material over a dimmed page (create-drawer.tsx's sheet). */
.modal-slot { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-slot[data-open="true"] { pointer-events: auto; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(1, 10, 24, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(28rem, 92vw);
  display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-5);
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), var(--shadow-xl);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
  backdrop-filter: blur(40px) saturate(190%);
}
.dark .modal-card { border-color: rgba(255, 255, 255, 0.1); background-color: rgba(12, 30, 54, 0.92); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow-xl); }
.modal-card__title   { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-bold); letter-spacing: -0.02em; }
.modal-card__sub     { font-size: var(--text-sm); color: hsl(var(--muted-foreground)); }
.modal-card__actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* ---------- Loading skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, hsl(var(--muted) / 0.6), hsl(var(--muted)), hsl(var(--muted) / 0.6));
  background-size: 200% 100%;
  animation: capla-skel 1.4s linear infinite;
  border-radius: var(--radius-field);
}
@keyframes capla-skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@keyframes capla-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
