/* =========================================================================
   App design system
   -------------------------------------------------------------------------
   Single source of truth for visual style. Everything is built from CSS
   custom properties so a future dark mode is one block of overrides.
   ========================================================================= */

:root {
  /* Color — warm cream surfaces, one hopeful green, a soft amber spark.
     Warmth + craft = trust; green = "go / growth"; amber = friendly highlight. */
  --bg:             #fbf7f0;   /* warm cream */
  --surface:        #ffffff;
  --surface-2:      #f4eee3;   /* warm sand */
  --surface-hover:  #f8f3ea;

  --border:         #e9e1d4;
  --border-strong:  #d9cebb;

  --text:           #2b2620;   /* warm near-black */
  --text-muted:     #7c7263;
  --text-subtle:    #a99e8c;
  --text-inverse:   #ffffff;

  --accent:         #17935a;   /* hopeful green */
  --accent-hover:   #137a4a;
  --accent-soft:    #e5f4ec;
  --accent-text:    #0c5e3a;

  /* amber spark — highlights, "in progress", friendly attention */
  --amber:          #e29a34;
  --amber-soft:     #fbecd2;
  --amber-text:     #8f5d15;

  --danger:         #d24b3e;   /* warm terracotta red */
  --danger-hover:   #b53a2e;
  --danger-soft:    #fae7e2;
  --danger-text:    #9c342a;

  --success:        #17935a;
  --success-soft:   #e5f4ec;
  --success-text:   #0c5e3a;

  --warning:        #e29a34;
  --warning-soft:   #fbecd2;
  --warning-text:   #8f5d15;

  /* Effects — warm-tinted, soft, generous (friendly depth) */
  --shadow-sm:  0 1px 2px rgb(74 53 28 / 0.05);
  --shadow:     0 2px 6px rgb(74 53 28 / 0.07), 0 1px 2px rgb(74 53 28 / 0.05);
  --shadow-md:  0 6px 16px rgb(74 53 28 / 0.08), 0 2px 5px rgb(74 53 28 / 0.05);
  --shadow-lg:  0 16px 36px rgb(74 53 28 / 0.10), 0 5px 12px rgb(74 53 28 / 0.06);

  /* Rounder = friendlier, more tactile */
  --radius-sm:  8px;
  --radius:     12px;
  --radius-md:  14px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  /* Friendly rounded display for headings/brand/buttons — free on Apple
     systems via ui-rounded, graceful fallback to the sans elsewhere. */
  --font-rounded: ui-rounded, "SF Pro Rounded", var(--font-sans);
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  /* Larger, friendlier scale — legible for every kind of person */
  --text-xs:   13px;
  --text-sm:   14px;
  --text-base: 16px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --text-3xl:  38px;
  --text-4xl:  48px;

  --leading-tight:  1.25;
  --leading-snug:   1.4;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;

  /* Transitions */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-med:  200ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --nav-h:        60px;
  --container-w:  1200px;
  --container-px: var(--space-6);
}

/* =========================================================================
   Reset / base
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; display: flex; flex-direction: column; }

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  color: var(--text);
}

h1 { font-size: var(--text-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p  { margin: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--accent-hover); }

button { font-family: inherit; }

::selection {
  background: var(--accent-soft);
  color: var(--accent-text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* =========================================================================
   App shell — top navbar + main container
   ========================================================================= */

.app-nav {
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(180%) blur(8px);
}

.app-nav__inner {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 var(--container-px);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.app-nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--text);
  letter-spacing: -0.01em;
}

.app-nav__brand-logo {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-sm);
}

.app-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
}

.app-nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--text-base);
  transition: background var(--t-fast), color var(--t-fast);
}

.app-nav__link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.app-nav__link.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.app-nav__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

/* Secondary nav — workspace admin sections, sits directly under the top
   navbar. Markup lives in base_workspace.html (.app-subnav). */
.app-subnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-h);
  z-index: 30;
}

.app-subnav__inner {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 var(--container-px);
  height: 46px;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  overflow-x: auto;
}

.app-subnav__link {
  display: inline-flex;
  align-items: center;
  padding: 6px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--text-base);
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}

.app-subnav__link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.app-subnav__link.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* Active-tenant chip in the navbar */
.nav-tenant-form { margin: 0; }
.nav-tenant {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 10px 4px 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
  max-width: 220px;
}
.nav-tenant:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}
.nav-tenant__logo {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.nav-tenant__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-tenant__chev {
  width: 14px;
  height: 14px;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.app-nav__user {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px var(--space-2) 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.app-nav__user:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

/* avatar circle */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  font-weight: 600;
  font-size: var(--text-xs);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.avatar--lg { width: 40px; height: 40px; font-size: var(--text-base); }

/* =========================================================================
   Container + page header
   ========================================================================= */

.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: var(--space-10) var(--container-px) var(--space-16);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.page-header__titles { min-width: 0; }

.page-title {
  font-size: var(--text-3xl);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-2);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: var(--text-md);
  max-width: 64ch;
}

.page-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* =========================================================================
   Card / panel
   ========================================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card__header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card__title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.card__body { padding: var(--space-6); }

.card__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* tight card variant for auth screens */
.card--auth {
  width: 100%;
  max-width: 420px;
  margin: var(--space-12) auto;
  border-radius: var(--radius-lg);
}
.card--auth .card__body { padding: var(--space-8); }

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  height: 36px;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 500;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text-inverse);
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn--secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn--danger {
  background: var(--danger);
  color: var(--text-inverse);
  border-color: var(--danger);
}
.btn--danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: var(--text-inverse);
}

.btn--danger-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--danger);
}
.btn--danger-outline:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger-text);
}

.btn--sm   { height: 30px; padding: 0 var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn--lg   { height: 44px; padding: 0 var(--space-5); font-size: var(--text-md); }
.btn--icon { padding: 0; width: 36px; }
.btn--full { width: 100%; }

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* =========================================================================
   Forms
   ========================================================================= */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field + .field { margin-top: var(--space-4); }

.label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0 var(--space-3);
  height: 38px;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color var(--t-fast), box-shadow var(--t-fast),
              background var(--t-fast);
  appearance: none;
}

.textarea {
  height: auto;
  padding: var(--space-3);
  line-height: var(--leading-normal);
  resize: vertical;
  min-height: 96px;
}

.input::placeholder { color: var(--text-subtle); }

.input:hover,
.select:hover,
.textarea:hover { border-color: var(--text-subtle); }

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: not-allowed;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field-help {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.field-error { color: var(--danger-text); }

/* horizontal form row (label left, input right) — for detail/edit pages */
.form-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  column-gap: var(--space-6);
  row-gap: var(--space-5);
  align-items: center;
}

.form-grid > .label { justify-self: end; text-align: right; }

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
    row-gap: var(--space-2);
  }
  .form-grid > .label { justify-self: start; text-align: left; }
}

/* search-style input with leading icon */
.input-search {
  position: relative;
  display: flex;
  align-items: center;
}
.input-search svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-subtle);
  pointer-events: none;
}
.input-search .input {
  padding-left: 36px;
}

/* =========================================================================
   Tables
   ========================================================================= */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr {
  transition: background var(--t-fast);
}

.table tbody tr:hover { background: var(--surface-hover); }

.table a {
  color: var(--text);
  font-weight: 500;
}
.table a:hover { color: var(--accent); }

.table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

/* =========================================================================
   Badges / status pills
   ========================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  line-height: 1.4;
}

.badge--accent  { background: var(--accent-soft);  color: var(--accent-text);  border-color: transparent; }
.badge--success { background: var(--success-soft); color: var(--success-text); border-color: transparent; }
.badge--warning { background: var(--warning-soft); color: var(--warning-text); border-color: transparent; }
.badge--danger  { background: var(--danger-soft);  color: var(--danger-text);  border-color: transparent; }

.badge::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
  opacity: 0.65;
}

/* =========================================================================
   Alerts (flash messages)
   ========================================================================= */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-base);
  border: 1px solid transparent;
}

.alert + .alert { margin-top: var(--space-2); }

.alert--info    { background: var(--accent-soft);  color: var(--accent-text);  }
.alert--success { background: var(--success-soft); color: var(--success-text); }
.alert--warning { background: var(--warning-soft); color: var(--warning-text); }
.alert--danger  { background: var(--danger-soft);  color: var(--danger-text);  }

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.flash-stack {
  margin-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* =========================================================================
   Stat cards (admin dashboards)
   ========================================================================= */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-card__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-card__value {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-card__sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* =========================================================================
   Empty states + utility
   ========================================================================= */

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}

.empty-state h3 { margin-bottom: var(--space-2); color: var(--text); }

.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: var(--space-6) 0;
}

.muted   { color: var(--text-muted); }
.subtle  { color: var(--text-subtle); }
.mono    { font-family: var(--font-mono); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }

.stack > * + *      { margin-top: var(--space-4); }
.stack-sm > * + *   { margin-top: var(--space-2); }
.stack-lg > * + *   { margin-top: var(--space-6); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.cluster--end { justify-content: flex-end; }

/* =========================================================================
   Hero / landing
   ========================================================================= */

.hero-landing {
  padding: var(--space-16) 0 var(--space-12);
  text-align: center;
}

.hero-landing__eyebrow {
  display: inline-block;
  padding: 4px var(--space-3);
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-6);
}

.hero-landing__title {
  font-size: var(--text-4xl);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
  background: linear-gradient(180deg, var(--text) 0%, #475569 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-landing__lede {
  font-size: var(--text-lg);
  color: var(--text-muted);
  max-width: 56ch;
  margin: 0 auto var(--space-8);
}

/* =========================================================================
   Confirm-destruction screen
   ========================================================================= */

.confirm-card {
  border-color: var(--danger-soft);
  background: linear-gradient(180deg, #fff 0%, var(--danger-soft) 240%);
}

.confirm-card .card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* =========================================================================
   Error pages (403 / 404 / 429 / 500) — self-contained, no app nav
   ========================================================================= */

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
}

.error-card {
  max-width: 420px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-10) var(--space-8);
}

.error-card__code {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.error-card__title {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-xl);
  color: var(--text);
}

.error-card__msg {
  margin: 0 0 var(--space-6);
  color: var(--text-muted);
  line-height: 1.5;
}

/* =========================================================================
   Responsive tweaks
   ========================================================================= */

@media (max-width: 720px) {
  :root { --container-px: var(--space-4); }
  .app-nav__links { gap: 0; }
  .app-nav__link { padding: 6px var(--space-2); }
  .app-subnav__inner { gap: 0; height: 42px; }
  .app-subnav__link { padding: 6px var(--space-2); }
  .page-title { font-size: var(--text-2xl); }
  .hero-landing__title { font-size: var(--text-3xl); }
}

/* ── Portugeasy: individual process flow ─────────────────────────────── */
.page-head { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; }
.hero { max-width:48rem; margin:3rem auto; text-align:center; }
.hero__sub { font-size:1.1rem; color:var(--muted,#555); margin:1rem 0 1.5rem; }
.hero__cta { display:flex; gap:.75rem; justify-content:center; flex-wrap:wrap; }
.auth-card { max-width:26rem; margin:2.5rem auto; }
.auth-card .input, .auth-card label { display:block; width:100%; margin:.35rem 0 .75rem; }
.auth-links { margin-top:1rem; font-size:.9rem; }
.field-error { color:#b00020; font-size:.85rem; margin:-.5rem 0 .5rem; }
.stack > * { margin-bottom:1rem; }
.field { border:1px solid #e3e3e3; border-radius:8px; padding:.75rem 1rem; }
.field legend { font-weight:600; padding:0 .4rem; }
.radio, .checkbox { display:block; margin:.3rem 0; font-weight:400; }
.card-list { list-style:none; padding:0; display:grid; gap:.75rem; }
.card { display:flex; justify-content:space-between; align-items:center; gap:1rem;
        border:1px solid #e3e3e3; border-radius:10px; padding:.85rem 1.1rem; }
.badge { font-size:.75rem; background:#eef; color:#334; border-radius:999px; padding:.15rem .6rem; }
.muted { color:#666; }
.disclaimer { background:#fff8e1; border:1px solid #f0e0a0; border-radius:8px;
              padding:.75rem 1rem; font-size:.9rem; }
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));
             gap:1rem; margin:1.5rem 0; }
.stat { border:1px solid #e3e3e3; border-radius:10px; padding:1rem; text-align:center; }
.stat__n { display:block; font-size:1.8rem; font-weight:700; }
.stat__l { color:#666; font-size:.85rem; }
.placeholder { margin-top:2rem; padding:1rem 1.2rem; border:1px dashed #cfcfcf;
               border-radius:10px; background:#fafafa; color:#555; }
.table { width:100%; border-collapse:collapse; font-size:.9rem; }
.table th, .table td { text-align:left; padding:.5rem .6rem; border-bottom:1px solid #eee; }

.checklist { list-style:none; padding:0; display:grid; gap:1rem; }
.checklist__item { border:1px solid #e3e3e3; border-left:4px solid #ccc;
                   border-radius:10px; padding:1rem 1.2rem; }
.checklist__item.is-missing { border-left-color:#bbb; }
.checklist__item.is-no_issues_detected { border-left-color:#2e7d32; }
.checklist__item.is-issues_found, .checklist__item.is-expired { border-left-color:#c62828; }
.checklist__item.is-expiring_soon { border-left-color:#ef6c00; }
.checklist__head { display:flex; justify-content:space-between; align-items:center; gap:1rem; }
.status-pill { font-size:.75rem; border-radius:999px; padding:.15rem .65rem; background:#eee; color:#333; white-space:nowrap; }
.status-pill--no_issues_detected { background:#e8f5e9; color:#2e7d32; }
.status-pill--issues_found, .status-pill--expired { background:#ffebee; color:#c62828; }
.status-pill--expiring_soon { background:#fff3e0; color:#ef6c00; }
.upload-row { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; margin-top:.75rem; }
.upload-row .inline { font-size:.8rem; color:#666; }

/* Guidance page — orientation options laid out as a clear list (renew/regularize) */
.guidance-list { list-style: none; counter-reset: g; padding: 0; margin: 1.25rem 0;
  display: flex; flex-direction: column; gap: .85rem; }
.guidance-option { counter-increment: g; position: relative;
  border: 1px solid var(--border, #e3e3e3); border-radius: var(--radius-lg, 12px);
  padding: .9rem 1.1rem .9rem 3rem; background: var(--bg, #fff); }
.guidance-option::before { content: counter(g); position: absolute; left: 1rem; top: .95rem;
  width: 1.4rem; height: 1.4rem; border-radius: var(--radius-full, 999px);
  background: var(--accent-soft, #eef2ff); color: var(--accent, #3b6ef5);
  font-size: .8rem; font-weight: 700; display: inline-flex; align-items: center;
  justify-content: center; }
.guidance-option__title { margin: 0 0 .25rem; font-size: 1.02rem; }
.guidance-option__body { margin: 0; }

/* "Don't see your situation?" — honest scope panel on the processes page */
.help-panel {
  margin-top: 1.5rem; padding: 1rem 1.25rem;
  border: 1px dashed var(--border, #d8d8de); border-radius: var(--radius-lg, 12px);
  background: var(--surface-hover, #f7f7f9);
}
.help-panel h2 { margin: 0 0 .35rem; font-size: 1.05rem; }
.help-panel p { margin: 0; }

/* Checklist card — collapsible (starts closed), icon-labelled sections.
   Line icons (SVG, currentColor) read more seriously than emoji. */
.icon { width:1.05em; height:1.05em; display:inline-block; vertical-align:-.15em; flex:0 0 auto; }

.checklist__item { padding:0; overflow:hidden; }   /* the <details> fills the card; left border keeps the status colour */
.doc-card { width:100%; }

/* Collapsed row — the at-a-glance list line */
.doc-card__summary {
  display:flex; align-items:center; gap:.6rem; padding:.8rem 1.1rem;
  cursor:pointer; list-style:none; user-select:none;
}
.doc-card__summary::-webkit-details-marker { display:none; }
.doc-card__summary:hover { background:var(--surface-hover, #f7f7f9); }
.doc-card__summary:focus-visible { outline:2px solid var(--accent, #3b6ef5); outline-offset:-2px; }
.doc-card__chevron { color:var(--text-muted, #8a8a92); display:inline-flex; }
.doc-card__chevron .icon { transition:transform .15s ease; }
.doc-card[open] .doc-card__chevron .icon { transform:rotate(90deg); }
.doc-card__lead { color:var(--text-muted, #8a8a92); display:inline-flex; }
.doc-card__name { flex:1 1 auto; min-width:0; }
.doc-card__name strong { font-weight:600; }

/* Expanded body — the icon-labelled sections */
.doc-card__body { padding:0 1.1rem 1.1rem; }
.doc-secs { display:flex; flex-direction:column; gap:.85rem; margin-top:.4rem; }
.doc-sec { display:flex; gap:.6rem; align-items:flex-start; }
.doc-sec__icon { flex:0 0 auto; display:inline-flex; color:var(--text-muted, #6a6a72); margin-top:.05rem; }
.doc-sec__body { flex:1 1 auto; min-width:0; }
.doc-sec__label {
  display:block; font-size:.72rem; font-weight:700; letter-spacing:.04em;
  text-transform:uppercase; color:var(--text-muted, #6a6a72); margin-bottom:.1rem;
}
.doc-sec__text { margin:0; white-space:pre-line; }   /* keep authored paragraph breaks */
.doc-sec--note .doc-sec__text { color:var(--text-muted, #6a6a72); font-size:var(--text-sm, .9rem); }
/* Translation: a quiet but unmissable highlight */
.doc-sec--translation {
  background:var(--warning-soft, #fff3e0); border-radius:var(--radius-lg, 12px);
  padding:.6rem .75rem;
}
.doc-sec--translation .doc-sec__icon,
.doc-sec--translation .doc-sec__label { color:var(--warning-text, #ad6800); }
/* Authentication: a calm, neutral highlight (distinct from translation) */
.doc-sec--auth {
  background:var(--surface-hover, #f1f3f7); border-radius:var(--radius-lg, 12px);
  padding:.6rem .75rem;
}

/* Action zone — set the upload/produce affordances apart as the card footer */
.doc-action-zone { margin-top:1rem; padding-top:.9rem; border-top:1px dashed var(--border, #e3e3e3); }
.doc-action-zone .upload-row { margin-top:.6rem; }
.upload-row .doc-sec__icon { color:var(--text-muted, #8a8a92); }

/* --- Slice 2: grant sharing UI --- */
.share-box {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border, #e2e2e2);
  border-radius: 10px;
  background: var(--surface-2, #fafafa);
}
.share-box h2 { margin-top: 0; font-size: 1.05rem; }
.share-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.share-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-top: 0.75rem; }
.share-form .inline { display: flex; flex-direction: column; font-size: 0.85rem; gap: 0.25rem; }
.share-form input, .share-form select { padding: 0.4rem 0.5rem; }
.share-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.4rem;
  background: var(--surface-2, #f0f0f0);
  border-radius: 6px;
}

/* --- Slice 3: rule-change propagation + notifications --- */
.nav-badge {
  display: inline-block; min-width: 1.2em; padding: 0 0.35em;
  font-size: 0.72rem; line-height: 1.3em; text-align: center;
  color: #fff; background: #c0392b; border-radius: 999px;
}
.rule-update {
  margin: 1rem 0; padding: 1rem 1.25rem;
  border: 1px solid #e6c200; border-left: 4px solid #e6a700;
  border-radius: 10px; background: #fffaf0;
}
.rule-update h2 { margin-top: 0; font-size: 1.05rem; }
.rule-diff { list-style: none; padding: 0; margin: 0.5rem 0; }
.rule-diff li { padding: 0.2rem 0; }
.tag {
  display: inline-block; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 0.05rem 0.4rem; border-radius: 6px;
  margin-right: 0.4rem; color: #fff;
}
.tag--add { background: #2e8b57; }
.tag--remove { background: #b03a2e; }
.tag--change { background: #b9770e; }
.note-list { list-style: none; padding: 0; margin: 0; }
.note {
  padding: 0.9rem 1.1rem; margin-bottom: 0.6rem;
  border: 1px solid var(--border, #e2e2e2); border-radius: 10px;
  background: var(--surface-2, #fafafa);
}
.note--unread { border-left: 4px solid #c0392b; }
.note__head { display: flex; justify-content: space-between; gap: 1rem; }

/* --- Slice 5: white-label + admin polish --- */
.app-nav__brand-img { height: 28px; width: auto; vertical-align: middle; }
.app-footer {
  margin-top: 2rem; padding: 1.25rem 1.5rem; text-align: center;
  border-top: 1px solid var(--border, #e2e2e2); font-size: 0.85rem;
}
.badge--draft { background: #8a8a8a; }
.badge--in_review { background: #b9770e; }
.badge--published { background: #2e8b57; }
.badge--superseded { background: #b03a2e; }
.actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; }

/* --- i18n language switcher --- */
.lang-switch { display: inline-flex; gap: 0.35rem; align-items: center; margin-right: 0.5rem; font-size: 0.8rem; }
.lang-switch a { color: var(--muted, #888); text-decoration: none; padding: 0.1rem 0.3rem; border-radius: 6px; }
.lang-switch a:hover { background: var(--surface-2, #f0f0f0); }
.lang-switch__current { font-weight: 600; padding: 0.1rem 0.3rem; }

/* =========================================================================
   Warm & encouraging theme layer
   A calm helper that holds your hand: friendly, rounded, tactile, alive.
   Overrides ride on top of the base components above (same selectors win).
   ========================================================================= */

body { line-height: 1.6; }

h1, h2, h3, h4, .app-nav__brand, .btn, .hero h1 {
  font-family: var(--font-rounded);
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { letter-spacing: -0.02em; }

a { font-weight: 500; }

/* Brand mark — hopeful green, soft and friendly */
.app-nav { height: auto; min-height: var(--nav-h); padding: 6px 0; background: color-mix(in srgb, var(--surface) 88%, var(--bg)); }
.app-nav__brand { font-size: var(--text-lg); }
.app-nav__brand-logo,
.nav-tenant__logo {
  width: 32px; height: 32px; border-radius: var(--radius);
  background: linear-gradient(150deg, #1fa564 0%, #137a4a 100%);
  font-size: 15px; box-shadow: 0 2px 6px rgb(23 147 90 / 0.35);
}
.app-nav__link { font-size: var(--text-base); font-weight: 600; padding: 8px var(--space-3); border-radius: var(--radius); }

/* Buttons — chunky, rounded, tappable; they lift on hover and press down */
.btn {
  border-radius: var(--radius-lg);
  padding: 11px 20px;
  font-weight: 700;
  font-size: var(--text-md);
  border: 1px solid transparent;
  transition: transform 90ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn--sm { padding: 7px 14px; font-size: var(--text-base); border-radius: var(--radius-md); }

.btn--primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 3px 0 0 color-mix(in srgb, var(--accent) 70%, #000), var(--shadow);
}
.btn--primary:hover { background: var(--accent-hover); color: #fff; box-shadow: 0 4px 0 0 color-mix(in srgb, var(--accent) 70%, #000), var(--shadow-md); }
.btn--primary:active { box-shadow: 0 1px 0 0 color-mix(in srgb, var(--accent) 70%, #000), var(--shadow-sm); }

.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--accent); color: var(--accent-text); }

.btn--secondary { background: var(--amber-soft); color: var(--amber-text); }
.btn--secondary:hover { background: color-mix(in srgb, var(--amber-soft) 80%, var(--amber)); color: var(--amber-text); }

/* Cards — warm, rounded, gently lift toward you */
.card, .stat, .note, .share-box, .rule-update, .auth-card {
  border-radius: var(--radius-lg);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4) var(--space-5);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

/* Inputs — bigger, rounder, calm green focus */
.input, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select, textarea {
  font-family: inherit;
  font-size: var(--text-md);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
label { font-weight: 600; }

/* Hero — big, warm, generous, one clear path forward */
.hero { max-width: 760px; margin: var(--space-12) auto var(--space-10); text-align: center; padding: 0 var(--space-4); }
.hero h1 { font-size: var(--text-4xl); line-height: 1.1; }
.hero__sub { font-size: var(--text-lg); color: var(--text-muted); margin-top: var(--space-5); line-height: 1.6; }
.hero__cta { margin-top: var(--space-8); display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }
.hero__cta .btn { padding: 14px 28px; font-size: var(--text-lg); }

/* Auth cards — warm, centered, roomy */
.auth-card { max-width: 440px; margin: var(--space-12) auto; background: var(--surface); padding: var(--space-8); border: 1px solid var(--border); box-shadow: var(--shadow); }
.auth-card .btn { width: 100%; margin-top: var(--space-4); }
.auth-card label { display: block; margin-top: var(--space-4); }

/* Badges + pills — rounded, warm */
.badge { border-radius: var(--radius-full); font-weight: 600; }
.status-pill { border-radius: var(--radius-full); font-weight: 700; }

/* Progress bar — the satisfying "quest" feel on a case checklist */
.progress { margin: var(--space-4) 0 var(--space-6); }
.progress__track { height: 14px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; box-shadow: inset 0 1px 2px rgb(74 53 28 / 0.08); }
.progress__fill { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, #1fa564, #16a34a); transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1); }
.progress__label { margin-top: var(--space-2); font-size: var(--text-base); color: var(--text-muted); font-weight: 600; }
.progress__label strong { color: var(--accent-text); }
.progress--done .progress__fill { background: linear-gradient(90deg, #16a34a, #15803d); }

/* Page headings a touch larger and warmer */
.page > h1, .page-head h1 { font-size: var(--text-2xl); }
.muted { color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .btn:hover, .card:hover { transform: none; }
}

/* My processes — person on each case row */
.case-link { display: flex; flex-direction: column; gap: 2px; }
.case-person { color: var(--text-muted); font-weight: 600; font-size: var(--text-base); }
.intro { max-width: 640px; }
.small-note { font-size: var(--text-sm); margin-top: var(--space-2); }

/* "Who is this for?" — reveal the add-person block only when "Someone else" is picked */
.new-person { display: none; margin: var(--space-3) 0 0 var(--space-6); padding: var(--space-4); border-left: 3px solid var(--accent-soft); }
.person-form:has(input[name="for_subject"][value="new"]:checked) .new-person { display: block; }
.new-person label { display: block; margin-top: var(--space-3); }
.radio { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-2) 0; }
.checkbox { display: flex; gap: var(--space-2); align-items: flex-start; }

/* Dashboard — Requests group their beneficiary cases */
.request-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.request__head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.case-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.case-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.case-row:first-child { border-top: none; padding-top: 0; }

/* case_detail page-head: submission-pack + change-answers buttons */
.page-head__actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

/* Process doorways — the planned menu; stubs are visibly not-yet-available */
.doorway--roadmap, .doorway--future, .doorway--orientation { opacity: 0.72; }
.badge--muted { background: var(--surface-hover); color: inherit; }

/* ============================================================
   Marketing surface — home, processes, landing, legal, footer
   ============================================================ */
.hero-landing__trust { margin-top: var(--space-4); font-size: var(--text-sm); }

.section-title { text-align: center; margin-bottom: var(--space-2); }
.band { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: var(--space-12) var(--space-4); margin: var(--space-10) 0; }
.band--quiet { background: var(--accent-soft); border-color: transparent; }
.band__inner { max-width: 1040px; margin: 0 auto; }
.band__inner--narrow { max-width: 680px; text-align: center; }
.band__inner--narrow p { margin: var(--space-3) 0; }

/* value props + doorways + pricing: responsive auto grids */
.value-grid, .doorway-grid, .pricing { list-style: none; margin: var(--space-6) 0 0; padding: 0; display: grid; gap: var(--space-4); }
.value-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.doorway-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.pricing { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }

.value { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); }
.value h3 { margin: 0 0 var(--space-2); }

.doorway-tile { display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-3); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.doorway-tile.doorway--roadmap, .doorway-tile.doorway--future, .doorway-tile.doorway--orientation { opacity: 0.78; }
.link-arrow { font-weight: 600; color: var(--accent); text-decoration: none; }
.link-arrow:hover { text-decoration: underline; }

/* how-it-works steps */
.steps { list-style: none; counter-reset: step; margin: var(--space-6) 0 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { display: flex; gap: var(--space-3); align-items: flex-start; }
.steps__n { flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: var(--radius-full); background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; }
.steps h3 { margin: 0 0 var(--space-1); font-size: var(--text-md); }
.steps p { margin: 0; }

/* pricing cards */
.price-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); }
.price-card--feature { border-color: var(--accent); box-shadow: var(--shadow-md); }
.price-card h3 { margin: 0 0 var(--space-2); }
.price-card__amount { font-size: var(--text-3xl); font-weight: 700; margin: 0 0 var(--space-3); }
.price-card__amount span { font-size: var(--text-sm); font-weight: 400; color: var(--text-muted); }
.ticks { list-style: none; margin: var(--space-3) 0; padding: 0; }
.ticks li { padding-left: 1.5rem; position: relative; margin: var(--space-2) 0; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.cta-row { margin-top: var(--space-8); text-align: center; }
.callout { margin-top: var(--space-8); padding: var(--space-6); background: var(--accent-soft); border-radius: var(--radius-lg); }
.page--prose { max-width: 720px; }

/* site footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: var(--space-12); padding: var(--space-10) var(--space-4) var(--space-6); }
.site-footer__inner { max-width: 1040px; margin: 0 auto; display: grid; gap: var(--space-6); grid-template-columns: 2fr 1fr 1fr 1fr; }
.site-footer__brand p { margin-top: var(--space-2); max-width: 30ch; }
.site-footer__col { display: flex; flex-direction: column; gap: var(--space-2); }
.site-footer__col h4 { margin: 0 0 var(--space-1); font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.site-footer__col a { color: inherit; text-decoration: none; }
.site-footer__col a:hover { color: var(--accent); }
.site-footer__legal { max-width: 1040px; margin: var(--space-8) auto 0; padding-top: var(--space-5); border-top: 1px solid var(--border); }
.site-footer__legal p { font-size: var(--text-sm); margin: var(--space-2) 0; }

@media (max-width: 760px) {
  .site-footer__inner { grid-template-columns: 1fr 1fr; }
}

/* "Where we help" — process phases strip */
.phases { list-style: none; margin: var(--space-6) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; align-items: stretch; }
.phase { flex: 1 1 140px; max-width: 200px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-1); padding: var(--space-4) var(--space-3); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); position: relative; }
.phase__n { width: 1.9rem; height: 1.9rem; border-radius: var(--radius-full); background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; margin-bottom: var(--space-1); }
.phase span.muted { font-size: var(--text-sm); }
.phase--theirs { border-style: dashed; opacity: 0.7; }
.phase--theirs .phase__n { background: var(--surface-hover); color: var(--text-muted); }

.price-card__amount--label { font-size: var(--text-lg); color: var(--accent); }

.pricing--two { max-width: 760px; margin-left: auto; margin-right: auto; }

/* User menu dropdown (replaces the instant-logout button) */
.usermenu { position: relative; }
.usermenu > summary { list-style: none; cursor: pointer; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu__caret { font-size: 0.7em; color: var(--text-muted); margin-left: 0.1rem; }
.usermenu__panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: var(--space-2); z-index: 50; display: flex; flex-direction: column; }
.usermenu__head { padding: var(--space-2) var(--space-3) var(--space-3); display: flex; flex-direction: column; border-bottom: 1px solid var(--border); margin-bottom: var(--space-1); }
.usermenu__item { display: block; width: 100%; text-align: left; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); color: inherit; text-decoration: none; background: none; border: none; font: inherit; cursor: pointer; }
.usermenu__item:hover { background: var(--surface-hover); }
.usermenu__logout { color: var(--accent); }

/* simple key/value + data table for the account page */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-5); margin: var(--space-3) 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }
.data-table { width: 100%; border-collapse: collapse; margin: var(--space-3) 0; }
.data-table th, .data-table td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
.data-table th { font-size: var(--text-sm); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.data-table .num { text-align: right; }

/* Case lifecycle bar + decision dropdown + history timeline */
.lifecycle { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-4) 0; padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.lifecycle__state { display: flex; align-items: center; gap: var(--space-2); }
.lifecycle__actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.lifecycle__actions form { margin: 0; }
.decision-menu { position: relative; }
.decision-menu > summary { list-style: none; cursor: pointer; }
.decision-menu > summary::-webkit-details-marker { display: none; }
.decision-menu__form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 260px; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }

.badge--outcome { font-weight: 600; }
.badge--approved { background: var(--accent-soft); color: var(--accent); }
.badge--rejected { background: #fdeaea; color: #b42318; }
.badge--withdrawn { background: var(--surface-hover); color: var(--text-muted); }

.history, .past-processes { margin-top: var(--space-6); }
.history > summary, .past-processes > summary { cursor: pointer; font-weight: 600; padding: var(--space-2) 0; }
.timeline { list-style: none; margin: var(--space-3) 0 0; padding: 0; border-left: 2px solid var(--border); }
.timeline__item { display: flex; gap: var(--space-3); padding: var(--space-2) 0 var(--space-2) var(--space-4); position: relative; }
.timeline__item::before { content: ""; position: absolute; left: -5px; top: 0.85em; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--accent); }
.timeline__when { flex: 0 0 5.5rem; font-size: var(--text-sm); }

/* Reveal dropdowns in the checklist header (pack / share — open on press) */
.reveal { position: relative; }
.reveal > summary { list-style: none; cursor: pointer; }
.reveal > summary::-webkit-details-marker { display: none; }
.reveal__panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 260px; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); text-align: left; }
.reveal__panel--wide { min-width: 320px; }
.reveal__panel .share-form { display: flex; flex-direction: column; gap: var(--space-2); align-items: stretch; }
.reveal__panel .inline { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-sm); }
.reveal__panel .inline input, .reveal__panel .inline select { width: 100%; }
.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.share-list .share-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.share-list .share-row form { margin: 0; }
@media (max-width: 560px) {
  .reveal__panel { right: auto; left: 0; min-width: min(88vw, 320px); }
}

/* Multi-file (bundle) checklist item — the uploaded files */
.file-list { list-style: none; margin: var(--space-2) 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.file-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.file-row form { margin: 0; margin-left: auto; }

/* =========================================================================
   Page content vertical rhythm (beautician pass)
   The reset zeroes every heading/paragraph margin — the layout leans on gap +
   utilities. Bare prose & authenticated pages (a .page that lists h*/p/ul/
   section directly) ended up crunched with no breathing room. Restore a
   sensible top-level flow, scoped to DIRECT children of .page so component
   internals (cards, nav, dropdown panels) are untouched.
   ========================================================================= */
.page > * + * { margin-top: var(--space-5); }                       /* blocks breathe — 20px */
.page > h2, .page > h3, .page > h4 { margin-top: var(--space-10); } /* a new section — 40px above */
.page > :is(h1, h2, h3, h4) + p { margin-top: var(--space-3); }     /* heading hugs its lead-in — 12px */
.page > :first-child { margin-top: 0; }                             /* no gap at the very top */
.page-header + * { margin-top: 0; }                                 /* the bordered header owns its gap */
/* Title block inside the flex page-head (My processes, dashboards): the h1 and
   its intro sit nested in a <div>, so the .page rhythm can't reach them. */
.page-head h1 + p { margin-top: var(--space-2); }

/* Prose pages read better with a little more line height and softer headings. */
.page--prose { line-height: var(--leading-relaxed, 1.7); }
.page--prose > h2, .page--prose > h3 { margin-top: var(--space-8); }
