/* =========================================================================
   Expense Tracker design system
   One file, three layers:
     1. Tokens      (--et-*) — the only place colours, radii, spacing, motion live
     2. Bootstrap   — Bootstrap 5.3 variables re-pointed at the tokens
     3. Components  — .et-* classes used by every page (see docs/DESIGN_SYSTEM.md)
   Style: minimal / Swiss — calm surfaces, one trust-blue accent, sharp-ish radii.
   CSP: no inline styles anywhere — every visual state is a class here.
   ========================================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  /* Surfaces & ink */
  --et-bg: #f5f6f8;
  --et-surface: #ffffff;
  --et-surface-2: #f0f2f5;
  --et-ink: #0f172a;
  --et-ink-2: #334155;
  --et-muted: #5b6475;            /* 5.9:1 on white */
  --et-border: #e2e6ec;
  --et-border-strong: #cbd2dc;

  /* Brand & semantic */
  --et-primary: #1e40af;          /* white text 8.6:1 */
  --et-primary-hover: #1e3a8a;
  --et-primary-soft: #e8eefb;
  --et-primary-ink: #1e3a8a;
  --et-positive: #047857;
  --et-positive-soft: #e3f4ee;
  --et-warning-ink: #8a4b08;
  --et-warning-soft: #fdf1dc;
  --et-danger: #b91c1c;
  --et-danger-hover: #991b1b;
  --et-danger-soft: #fbe9e9;
  --et-info-soft: #e8eefb;
  --et-focus: #2563eb;

  /* Avatar tints (bg / ink) */
  --et-tint-0-bg: #e8eefb; --et-tint-0-ink: #1e3a8a;
  --et-tint-1-bg: #e3f4ee; --et-tint-1-ink: #065f46;
  --et-tint-2-bg: #fdf1dc; --et-tint-2-ink: #7c3f06;
  --et-tint-3-bg: #fbe9ef; --et-tint-3-ink: #9d174d;
  --et-tint-4-bg: #e6f4f8; --et-tint-4-ink: #155e75;
  --et-tint-5-bg: #eef0f3; --et-tint-5-ink: #334155;

  /* Type */
  --et-font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --et-text-xs: 0.75rem;
  --et-text-sm: 0.875rem;
  --et-text-base: 1rem;
  --et-text-lg: 1.125rem;
  --et-text-xl: 1.375rem;
  --et-text-2xl: 1.75rem;

  /* Shape, space, depth */
  --et-radius-sm: 4px;
  --et-radius: 6px;
  --et-radius-lg: 10px;
  --et-space-1: 0.25rem;
  --et-space-2: 0.5rem;
  --et-space-3: 0.75rem;
  --et-space-4: 1rem;
  --et-space-5: 1.5rem;
  --et-space-6: 2rem;
  --et-space-7: 3rem;
  --et-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --et-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.06);
  --et-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);
  --et-tap: 44px;                 /* minimum height of any control outside running text */

  /* Motion */
  --et-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --et-fast: 120ms;
  --et-base: 180ms;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --et-bg: #0b1120;
    --et-surface: #111827;
    --et-surface-2: #182132;
    --et-ink: #e6eaf0;
    --et-ink-2: #c3cad5;
    --et-muted: #9aa4b2;          /* 6.6:1 on surface */
    --et-border: #243044;
    --et-border-strong: #33415a;

    --et-primary: #3b63e0;        /* white text 4.9:1 */
    --et-primary-hover: #5079f0;
    --et-primary-soft: #1a2747;
    --et-primary-ink: #a9bcff;
    --et-positive: #34d399;
    --et-positive-soft: #10302a;
    --et-warning-ink: #f6c56b;
    --et-warning-soft: #3a2a10;
    --et-danger: #dc4a4a;
    --et-danger-hover: #e86464;
    --et-danger-soft: #3a1618;
    --et-info-soft: #1a2747;
    --et-focus: #7da2ff;

    --et-tint-0-bg: #1a2747; --et-tint-0-ink: #a9bcff;
    --et-tint-1-bg: #10302a; --et-tint-1-ink: #6ee7b7;
    --et-tint-2-bg: #3a2a10; --et-tint-2-ink: #f6c56b;
    --et-tint-3-bg: #3a1628; --et-tint-3-ink: #f9a8d4;
    --et-tint-4-bg: #0f2e38; --et-tint-4-ink: #67e8f9;
    --et-tint-5-bg: #222b3a; --et-tint-5-ink: #c3cad5;

    --et-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --et-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    --et-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

    color-scheme: dark;
  }
}

/* ---------- 2. Bootstrap, re-pointed at the tokens ---------- */
:root {
  --bs-body-font-family: var(--et-font);
  --bs-body-font-size: var(--et-text-base);
  --bs-body-line-height: 1.5;
  --bs-body-bg: var(--et-surface);
  --bs-body-color: var(--et-ink);
  --bs-emphasis-color: var(--et-ink);
  --bs-secondary-color: var(--et-muted);
  --bs-secondary-bg: var(--et-surface-2);
  --bs-tertiary-bg: var(--et-surface-2);
  --bs-border-color: var(--et-border);
  --bs-border-radius: var(--et-radius);
  --bs-border-radius-sm: var(--et-radius-sm);
  --bs-border-radius-lg: var(--et-radius-lg);
  --bs-link-color: var(--et-primary);
  --bs-link-color-rgb: 30, 64, 175;
  --bs-link-hover-color: var(--et-primary-hover);
  --bs-link-hover-color-rgb: 30, 58, 138;
  --bs-primary: var(--et-primary);
  --bs-danger: var(--et-danger);
  --bs-form-invalid-color: var(--et-danger);
  --bs-form-invalid-border-color: var(--et-danger);
  --bs-focus-ring-color: color-mix(in srgb, var(--et-focus) 35%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bs-link-color-rgb: 169, 188, 255;
    --bs-link-hover-color-rgb: 199, 211, 255;
    --bs-link-color: var(--et-primary-ink);
  }
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--et-bg);
  color: var(--et-ink);
  font-feature-settings: "cv11", "ss01";
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, .h1, .h2, .h3, .h4, .h5 { color: var(--et-ink); letter-spacing: -0.01em; font-weight: 650; }

a { text-underline-offset: 0.2em; }

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

/* Buttons: one primary, one secondary, one destructive. All ≥ 44px tall. */
.btn {
  --bs-btn-font-weight: 600;
  --bs-btn-padding-x: 1rem;
  --bs-btn-border-radius: var(--et-radius);
  --bs-btn-focus-box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
  min-height: var(--et-tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--et-space-2);
  transition: background-color var(--et-fast) var(--et-ease), border-color var(--et-fast) var(--et-ease),
              color var(--et-fast) var(--et-ease), transform var(--et-fast) var(--et-ease), box-shadow var(--et-fast) var(--et-ease);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  --bs-btn-bg: var(--et-primary);
  --bs-btn-border-color: var(--et-primary);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--et-primary-hover);
  --bs-btn-hover-border-color: var(--et-primary-hover);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--et-primary-hover);
  --bs-btn-active-border-color: var(--et-primary-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--et-primary);
  --bs-btn-disabled-border-color: var(--et-primary);
  box-shadow: var(--et-shadow-sm);
}

.btn-secondary,
.btn-outline-secondary {
  --bs-btn-bg: var(--et-surface);
  --bs-btn-color: var(--et-ink);
  --bs-btn-border-color: var(--et-border-strong);
  --bs-btn-hover-bg: var(--et-surface-2);
  --bs-btn-hover-color: var(--et-ink);
  --bs-btn-hover-border-color: var(--et-border-strong);
  --bs-btn-active-bg: var(--et-surface-2);
  --bs-btn-active-color: var(--et-ink);
  --bs-btn-active-border-color: var(--et-border-strong);
}

.btn-danger {
  --bs-btn-bg: var(--et-danger);
  --bs-btn-border-color: var(--et-danger);
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--et-danger-hover);
  --bs-btn-hover-border-color: var(--et-danger-hover);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--et-danger-hover);
  --bs-btn-active-border-color: var(--et-danger-hover);
}

/* Quiet destructive: text button that turns red, for "Archive" next to other actions. */
.btn-quiet-danger {
  --bs-btn-bg: transparent;
  --bs-btn-color: var(--et-danger);
  --bs-btn-border-color: var(--et-border-strong);
  --bs-btn-hover-bg: var(--et-danger-soft);
  --bs-btn-hover-color: var(--et-danger);
  --bs-btn-hover-border-color: var(--et-danger);
  --bs-btn-active-bg: var(--et-danger-soft);
  --bs-btn-active-color: var(--et-danger);
}

/* Forms */
.form-label { font-weight: 600; font-size: var(--et-text-sm); color: var(--et-ink-2); margin-bottom: var(--et-space-1); }

.form-control,
.form-select {
  min-height: var(--et-tap);
  border-color: var(--et-border-strong);
  background-color: var(--et-surface);
  color: var(--et-ink);
  transition: border-color var(--et-fast) var(--et-ease), box-shadow var(--et-fast) var(--et-ease);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--et-focus);
  box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
}

.form-control[readonly] { background-color: var(--et-surface-2); color: var(--et-muted); }

.form-text { color: var(--et-muted); font-size: var(--et-text-sm); }

.field-validation-error { display: block; color: var(--et-danger); font-size: var(--et-text-sm); margin-top: var(--et-space-1); font-weight: 500; }
.field-validation-valid { display: none; }
.input-validation-error { border-color: var(--et-danger) !important; }
.input-validation-error:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--et-danger) 25%, transparent) !important; }

.validation-summary-errors { display: block; }
.validation-summary-valid { display: none; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }

/* Dropdowns & modals pick up the tokens */
.dropdown-menu {
  --bs-dropdown-bg: var(--et-surface);
  --bs-dropdown-color: var(--et-ink);
  --bs-dropdown-border-color: var(--et-border);
  --bs-dropdown-border-radius: var(--et-radius-lg);
  --bs-dropdown-link-color: var(--et-ink);
  --bs-dropdown-link-hover-bg: var(--et-surface-2);
  --bs-dropdown-link-hover-color: var(--et-ink);
  --bs-dropdown-link-active-bg: var(--et-primary-soft);
  --bs-dropdown-link-active-color: var(--et-primary-ink);
  --bs-dropdown-header-color: var(--et-muted);
  --bs-dropdown-divider-bg: var(--et-border);
  box-shadow: var(--et-shadow-lg);
  padding: var(--et-space-2);
}

.dropdown-item {
  border-radius: var(--et-radius);
  min-height: var(--et-tap);
  display: flex;
  align-items: center;
  gap: var(--et-space-3);
  padding: var(--et-space-2) var(--et-space-3);
  font-weight: 500;
}

.dropdown-header { font-size: var(--et-text-xs); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

.modal {
  --bs-modal-bg: var(--et-surface);
  --bs-modal-color: var(--et-ink);
  --bs-modal-border-color: var(--et-border);
  --bs-modal-border-radius: var(--et-radius-lg);
  --bs-modal-header-border-color: var(--et-border);
  --bs-modal-footer-border-color: var(--et-border);
}

.btn-close { min-width: var(--et-tap); min-height: var(--et-tap); }

@media (prefers-color-scheme: dark) {
  .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
}

/* ---------- 3. Components ---------- */

/* Icon */
.et-icon { width: 1.125rem; height: 1.125rem; flex: none; vertical-align: -0.2em; }
.et-icon--sm { width: 1rem; height: 1rem; }
.et-icon--lg { width: 1.5rem; height: 1.5rem; }
.et-icon--xl { width: 2rem; height: 2rem; }

/* Skip link */
.et-skip {
  position: absolute;
  left: var(--et-space-4);
  top: -100px;
  z-index: 2000;
  background: var(--et-primary);
  color: #fff;
  padding: var(--et-space-2) var(--et-space-4);
  border-radius: var(--et-radius);
  font-weight: 600;
  min-height: var(--et-tap);
  display: inline-flex;
  align-items: center;
}
.et-skip:focus { top: var(--et-space-3); color: #fff; }

/* App shell: top bar */
.et-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: color-mix(in srgb, var(--et-surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--et-border);
}

.et-topbar__inner {
  display: flex;
  align-items: center;
  gap: var(--et-space-4);
  min-height: 64px;
}

.et-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--et-space-2);
  font-weight: 700;
  font-size: var(--et-text-lg);
  color: var(--et-ink);
  text-decoration: none;
  letter-spacing: -0.02em;
  min-height: var(--et-tap);
}
.et-brand:hover { color: var(--et-ink); }

.et-brand__mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--et-radius);
  background: var(--et-primary);
  color: #fff;
}

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

.et-nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--et-space-2);
  min-height: var(--et-tap);
  padding: 0 var(--et-space-3);
  border-radius: var(--et-radius);
  color: var(--et-ink-2);
  font-weight: 550;
  text-decoration: none;
  transition: background-color var(--et-fast) var(--et-ease), color var(--et-fast) var(--et-ease);
}
.et-nav__link:hover { background: var(--et-surface-2); color: var(--et-ink); }
.et-nav__link[aria-current="page"] { color: var(--et-primary-ink); background: var(--et-primary-soft); }

.et-topbar__end { margin-left: auto; display: flex; align-items: center; gap: var(--et-space-2); }

/* Group picker in the page title (vc:workspace-switcher) */
.et-titlepick { position: relative; }
.et-hero--fill, .et-hero--fill > div { flex: 1 1 auto; min-width: 0; }   /* a hero whose title can shrink (title picker): take the row, ellipsize inside */
.et-titlepick__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--et-space-2);
  max-width: 100%;
  min-height: var(--et-tap);
  margin-left: calc(var(--et-space-2) * -1);
  padding: 0 var(--et-space-2);
  border: 1px solid transparent;
  border-radius: var(--et-radius);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  transition: border-color var(--et-fast) var(--et-ease), background-color var(--et-fast) var(--et-ease);
}
.et-titlepick__toggle:hover, .et-titlepick__toggle[aria-expanded="true"] { background: var(--et-surface-2); border-color: var(--et-border); }
.et-titlepick__toggle::after { display: none; }
.et-titlepick__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.et-titlepick__chevron { flex: none; color: var(--et-muted); transition: transform var(--et-fast) var(--et-ease); }
.et-titlepick__toggle[aria-expanded="true"] .et-titlepick__chevron { transform: rotate(180deg); }
.et-titlepick .dropdown-menu { font-size: var(--et-text-base); font-weight: 400; line-height: 1.5; }
.et-switcher__menu { min-width: 17rem; max-height: min(70vh, 32rem); overflow-y: auto; }
.et-switcher__check { margin-left: auto; color: var(--et-primary-ink); }
.et-switcher__item-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Icon tile — square chip holding an icon (workspace, group type) */
.et-tile {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--et-radius);
  background: var(--et-primary-soft);
  color: var(--et-primary-ink);
}
.et-tile--lg { width: 48px; height: 48px; border-radius: var(--et-radius-lg); }
.et-tile--neutral { background: var(--et-surface-2); color: var(--et-ink-2); }

/* User menu button */
.et-usermenu__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--et-space-2);
  min-height: var(--et-tap);
  padding: 0 var(--et-space-2);
  border: 0;
  border-radius: var(--et-radius);
  background: transparent;
  color: var(--et-ink);
  font-weight: 550;
}
.et-usermenu__toggle:hover { background: var(--et-surface-2); }
.et-usermenu__toggle::after { display: none; }

/* Page */
.et-main { flex: 1 0 auto; padding-top: var(--et-space-6); padding-bottom: var(--et-space-7); }

.et-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--et-space-4);
  margin-bottom: var(--et-space-5);
}
.et-page-header__title { font-size: var(--et-text-2xl); margin: 0; }
.et-page-header__subtitle { color: var(--et-muted); margin: var(--et-space-1) 0 0; }
.et-page-header__actions { display: flex; flex-wrap: wrap; gap: var(--et-space-2); }
.et-eyebrow { font-size: var(--et-text-xs); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; color: var(--et-muted); margin: 0 0 var(--et-space-1); }

.et-back {
  display: inline-flex;
  align-items: center;
  gap: var(--et-space-1);
  min-height: var(--et-tap);
  color: var(--et-muted);
  font-weight: 550;
  text-decoration: none;
  margin-bottom: var(--et-space-2);
}
.et-back:hover { color: var(--et-ink); }

/* Card — the one surface style */
.et-card {
  background: var(--et-surface);
  border: 1px solid var(--et-border);
  border-radius: var(--et-radius-lg);
  box-shadow: var(--et-shadow-sm);
}
.et-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--et-space-3);
  padding: var(--et-space-4) var(--et-space-5);
  border-bottom: 1px solid var(--et-border);
}
.et-card__title { font-size: var(--et-text-lg); margin: 0; }
.et-card__header > .btn { flex: none; white-space: nowrap; }
.et-card__subtitle { color: var(--et-muted); font-size: var(--et-text-sm); margin: 2px 0 0; }
.et-card__body { padding: var(--et-space-5); }
.et-card__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--et-space-2);
  padding: var(--et-space-4) var(--et-space-5);
  border-top: 1px solid var(--et-border);
  background: var(--et-surface-2);
  border-radius: 0 0 var(--et-radius-lg) var(--et-radius-lg);
}

/* Linked card: lifts 2px on hover, presses on click */
.et-card--link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform var(--et-base) var(--et-ease), box-shadow var(--et-base) var(--et-ease), border-color var(--et-base) var(--et-ease);
}
.et-card--link:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--et-shadow); border-color: var(--et-border-strong); }
.et-card--link:active { transform: translateY(0); }
.et-card--current { border-color: var(--et-primary); box-shadow: 0 0 0 1px var(--et-primary); }

/* Group card */
.et-group-card { padding: var(--et-space-5); height: 100%; display: flex; flex-direction: column; gap: var(--et-space-4); }
.et-group-card__top { display: flex; align-items: flex-start; gap: var(--et-space-3); }
.et-group-card__name { font-size: var(--et-text-lg); font-weight: 650; margin: 0; overflow-wrap: anywhere; }
.et-group-card__meta { color: var(--et-muted); font-size: var(--et-text-sm); margin: 2px 0 0; }
.et-group-card__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--et-space-2); color: var(--et-muted); font-size: var(--et-text-sm); }

/* Badge */
.et-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--et-text-xs);
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid transparent;
}
.et-badge--owner { background: var(--et-primary-soft); color: var(--et-primary-ink); }
.et-badge--admin { background: var(--et-positive-soft); color: var(--et-positive); }
.et-badge--member { background: var(--et-surface-2); color: var(--et-ink-2); border-color: var(--et-border); }
.et-badge--archived { background: var(--et-warning-soft); color: var(--et-warning-ink); }
.et-badge--current { background: var(--et-primary); color: #fff; }

/* Tabs (segmented links) */
.et-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--et-radius);
  background: var(--et-surface-2);
  border: 1px solid var(--et-border);
  margin-bottom: var(--et-space-5);
}
.et-tabs__link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 var(--et-space-4);
  border-radius: var(--et-radius-sm);
  color: var(--et-muted);
  font-weight: 600;
  font-size: var(--et-text-sm);
  text-decoration: none;
  transition: background-color var(--et-fast) var(--et-ease), color var(--et-fast) var(--et-ease);
}
.et-tabs__link:hover { color: var(--et-ink); }
.et-tabs__link[aria-current="page"] { background: var(--et-surface); color: var(--et-ink); box-shadow: var(--et-shadow-sm); }

/* Alert / flash */
.et-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--et-space-3);
  padding: var(--et-space-3) var(--et-space-4);
  border-radius: var(--et-radius);
  border: 1px solid transparent;
  margin-bottom: var(--et-space-5);
  font-weight: 500;
}
.et-alert .et-icon { margin-top: 2px; }
.et-alert--success { background: var(--et-positive-soft); color: var(--et-positive); border-color: color-mix(in srgb, var(--et-positive) 25%, transparent); }
.et-alert--info { background: var(--et-info-soft); color: var(--et-primary-ink); border-color: color-mix(in srgb, var(--et-primary) 20%, transparent); }
.et-alert--error { background: var(--et-danger-soft); color: var(--et-danger); border-color: color-mix(in srgb, var(--et-danger) 25%, transparent); }
.et-alert--warning { background: var(--et-warning-soft); color: var(--et-warning-ink); border-color: color-mix(in srgb, var(--et-warning-ink) 25%, transparent); }
.et-alert__body { flex: 1; }
.et-alert__body p { margin: 0; }

/* Form error summary (inside a form) */
.et-form-errors {
  background: var(--et-danger-soft);
  color: var(--et-danger);
  border: 1px solid color-mix(in srgb, var(--et-danger) 25%, transparent);
  border-radius: var(--et-radius);
  padding: var(--et-space-3) var(--et-space-4);
  margin-bottom: var(--et-space-4);
  font-weight: 500;
}

.et-field { margin-bottom: var(--et-space-4); }
.et-field:last-child { margin-bottom: 0; }

/* Choice cards (radio group rendered as cards) */
.et-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: var(--et-space-2); border: 0; padding: 0; margin: 0; }
.et-choices legend { float: none; }
.et-choice { position: relative; }
.et-choice__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.et-choice__card {
  display: flex;
  flex-direction: column;
  gap: var(--et-space-2);
  height: 100%;
  min-height: var(--et-tap);
  padding: var(--et-space-3);
  border: 1px solid var(--et-border-strong);
  border-radius: var(--et-radius);
  background: var(--et-surface);
  cursor: pointer;
  transition: border-color var(--et-fast) var(--et-ease), background-color var(--et-fast) var(--et-ease), box-shadow var(--et-fast) var(--et-ease);
}
.et-choice__card:hover { border-color: var(--et-primary); }
.et-choice__title { font-weight: 650; display: flex; align-items: center; gap: var(--et-space-2); }
.et-choice__hint { color: var(--et-muted); font-size: var(--et-text-sm); }
.et-choice__input:checked + .et-choice__card { border-color: var(--et-primary); background: var(--et-primary-soft); box-shadow: 0 0 0 1px var(--et-primary); }
.et-choice__input:checked + .et-choice__card .et-choice__title { color: var(--et-primary-ink); }
.et-choice__input:focus-visible + .et-choice__card { outline: 2px solid var(--et-focus); outline-offset: 2px; }

/* Definition list (key facts) */
.et-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--et-space-4); margin: 0; }
.et-facts dt { font-size: var(--et-text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--et-muted); font-weight: 650; }
.et-facts dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* List rows (members) */
.et-list { list-style: none; margin: 0; padding: 0; }
.et-list__row { display: flex; align-items: center; gap: var(--et-space-3); padding: var(--et-space-3) var(--et-space-5); border-top: 1px solid var(--et-border); }
.et-list__row:first-child { border-top: 0; }
.et-list__main { min-width: 0; flex: 1; }
.et-list__title { font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.et-list__sub { color: var(--et-muted); font-size: var(--et-text-sm); margin: 0; overflow-wrap: anywhere; }
.et-list__end { display: flex; align-items: center; gap: var(--et-space-3); color: var(--et-muted); font-size: var(--et-text-sm); text-align: right; }

/* Avatar */
.et-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: 700;
  font-size: var(--et-text-sm);
  letter-spacing: 0.02em;
}
.et-avatar--sm { width: 30px; height: 30px; font-size: var(--et-text-xs); }
.et-avatar--0 { background: var(--et-tint-0-bg); color: var(--et-tint-0-ink); }
.et-avatar--1 { background: var(--et-tint-1-bg); color: var(--et-tint-1-ink); }
.et-avatar--2 { background: var(--et-tint-2-bg); color: var(--et-tint-2-ink); }
.et-avatar--3 { background: var(--et-tint-3-bg); color: var(--et-tint-3-ink); }
.et-avatar--4 { background: var(--et-tint-4-bg); color: var(--et-tint-4-ink); }
.et-avatar--5 { background: var(--et-tint-5-bg); color: var(--et-tint-5-ink); }

/* Empty state */
.et-empty { text-align: center; padding: var(--et-space-7) var(--et-space-5); }
.et-empty__icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--et-surface-2); color: var(--et-muted); margin-bottom: var(--et-space-4); }
.et-empty__title { font-size: var(--et-text-lg); margin: 0 0 var(--et-space-1); }
.et-empty__text { color: var(--et-muted); max-width: 28rem; margin: 0 auto var(--et-space-5); }

/* Workspace hero on the overview */
.et-hero { display: flex; align-items: center; gap: var(--et-space-4); }
.et-hero__name { font-size: var(--et-text-2xl); margin: 0; overflow-wrap: anywhere; }
.et-hero__meta { color: var(--et-muted); margin: 2px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--et-space-2); }

/* Auth (signed-out) pages */
.et-auth { max-width: 26rem; margin: var(--et-space-6) auto; }
.et-auth__card { padding: var(--et-space-6); }
.et-auth__title { font-size: var(--et-text-xl); margin: 0 0 var(--et-space-1); }
.et-auth__lead { color: var(--et-muted); margin: 0 0 var(--et-space-5); }
.et-auth__foot { text-align: center; margin: var(--et-space-5) 0 0; color: var(--et-muted); font-size: var(--et-text-sm); }

.et-landing { max-width: 40rem; margin: var(--et-space-7) auto; text-align: center; }
.et-landing__title { font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1.15; margin: var(--et-space-4) 0 var(--et-space-3); }
.et-landing__lead { color: var(--et-muted); font-size: var(--et-text-lg); margin: 0 auto var(--et-space-5); max-width: 32rem; }
.et-landing__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--et-space-2); }

/* Footer */
.et-footer { border-top: 1px solid var(--et-border); color: var(--et-muted); font-size: var(--et-text-sm); padding: var(--et-space-4) 0; }

/* Utilities */
.et-muted { color: var(--et-muted); }
.min-w-0 { min-width: 0; }
.et-num { font-variant-numeric: tabular-nums; }
.et-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--et-space-5); }

/* Count pill (top-bar Invitations) */
.et-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--et-primary);
  color: #fff;
  font-size: var(--et-text-xs);
  font-weight: 700;
  line-height: 1;
}

/* Icon-only button (row menus, cancel). Always give it aria-label. */
.et-icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--et-tap);
  height: var(--et-tap);
  border: 1px solid transparent;
  border-radius: var(--et-radius);
  background: transparent;
  color: var(--et-muted);
  transition: background-color var(--et-fast) var(--et-ease), color var(--et-fast) var(--et-ease), border-color var(--et-fast) var(--et-ease);
}
.et-icon-btn:hover, .et-icon-btn[aria-expanded="true"] { background: var(--et-surface-2); color: var(--et-ink); border-color: var(--et-border); }
.et-icon-btn:focus-visible { outline: 2px solid var(--et-focus); outline-offset: 2px; }
/* Outlined icon button: a page-header action that must read as a button at rest (Expenses filter) */
.et-icon-btn--outline { border-color: var(--et-border-strong); background: var(--et-surface); color: var(--et-ink); }
.et-icon-btn--outline:hover { border-color: var(--et-border-strong); }

/* Destructive item inside a dropdown menu (opens a confirm dialog) */
.dropdown-item.et-dropdown-danger { color: var(--et-danger); }
.dropdown-item.et-dropdown-danger:hover, .dropdown-item.et-dropdown-danger:focus { background: var(--et-danger-soft); color: var(--et-danger); }

/* Placeholder avatar for someone without an account in the group yet (pending invitation) */
.et-avatar--outline { background: transparent; color: var(--et-muted); border: 1px dashed var(--et-border-strong); }

/* Two equal choice cards (e.g. invite role) */
.et-choices--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Card with buttons at the bottom (invitation cards) */
.et-group-card__actions { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: var(--et-space-2); }

/* Alert with a call to action on the right */
.et-alert--action { align-items: center; flex-wrap: wrap; }
.et-alert--action .btn { flex: none; }
.et-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Stage 4: expenses ---------- */
/* Category tiles: the six avatar tints, picked by category id (DisplayText.CategoryTileClass) */
.et-tile--tint-0 { background: var(--et-tint-0-bg); color: var(--et-tint-0-ink); }
.et-tile--tint-1 { background: var(--et-tint-1-bg); color: var(--et-tint-1-ink); }
.et-tile--tint-2 { background: var(--et-tint-2-bg); color: var(--et-tint-2-ink); }
.et-tile--tint-3 { background: var(--et-tint-3-bg); color: var(--et-tint-3-ink); }
.et-tile--tint-4 { background: var(--et-tint-4-bg); color: var(--et-tint-4-ink); }
.et-tile--tint-5 { background: var(--et-tint-5-bg); color: var(--et-tint-5-ink); }
.et-list__row .et-tile--lg { width: 40px; height: 40px; }

/* Month navigation: ‹ November 2026 › [This month] */
.et-monthnav { display: flex; align-items: center; gap: var(--et-space-2); margin-bottom: var(--et-space-5); }
.et-monthnav__label { font-size: var(--et-text-lg); margin: 0; min-width: 9.5rem; text-align: center; }
.et-monthnav__today { margin-left: auto; }

/* Big money figure: currency code small and muted, number large */
.et-total { display: flex; align-items: baseline; gap: var(--et-space-2); margin: var(--et-space-2) 0 var(--et-space-1); font-size: var(--et-text-2xl); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.et-total__currency { font-size: var(--et-text-sm); font-weight: 650; color: var(--et-muted); letter-spacing: 0.04em; }
.et-total--secondary { font-size: var(--et-text-xl); margin-top: 0; }
.et-total--detail { margin: var(--et-space-5) 0; font-size: 2.25rem; }

/* Amount at the end of a list row */
.et-amount { display: inline-flex; align-items: baseline; gap: var(--et-space-1); flex: none; font-weight: 650; color: var(--et-ink); white-space: nowrap; }
.et-amount__currency { font-size: var(--et-text-xs); font-weight: 600; color: var(--et-muted); }

/* Clickable list row */
.et-list__row--link { color: inherit; text-decoration: none; min-height: 64px; transition: background-color var(--et-fast) var(--et-ease); }
.et-list__row--link:hover { color: inherit; background: var(--et-surface-2); }
.et-list__row--link:focus-visible { outline: 2px solid var(--et-focus); outline-offset: -2px; }
.et-list > li:first-child > .et-list__row { border-top: 0; }
.et-list > li:last-child > .et-list__row--link { border-radius: 0 0 var(--et-radius-lg) var(--et-radius-lg); }

/* Day heading inside a day card */
.et-day { display: flex; align-items: baseline; justify-content: space-between; gap: var(--et-space-3); padding: var(--et-space-3) var(--et-space-5); border-bottom: 1px solid var(--et-border); background: var(--et-surface-2); border-radius: var(--et-radius-lg) var(--et-radius-lg) 0 0; }
.et-day__title { font-size: var(--et-text-sm); font-weight: 650; margin: 0; color: var(--et-ink-2); }
.et-day__total { font-size: var(--et-text-sm); color: var(--et-muted); text-align: right; }

/* Category breakdown with a native <progress> bar (no inline widths under the CSP) */
.et-breakdown { list-style: none; margin: 0; padding: var(--et-space-2) 0; }
.et-breakdown__row { display: flex; align-items: center; gap: var(--et-space-3); padding: var(--et-space-2) var(--et-space-5); }
.et-breakdown__main { flex: 1; min-width: 0; }
.et-breakdown__line { display: flex; justify-content: space-between; gap: var(--et-space-2); font-size: var(--et-text-sm); margin-bottom: var(--et-space-1); }
.et-breakdown__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.et-progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 999px; overflow: hidden; background: var(--et-surface-2); color: var(--et-primary); appearance: none; -webkit-appearance: none; }
.et-progress::-webkit-progress-bar { background: var(--et-surface-2); border-radius: 999px; }
.et-progress::-webkit-progress-value { background: var(--et-primary); border-radius: 999px; }
.et-progress::-moz-progress-bar { background: var(--et-primary); border-radius: 999px; }

.et-day--plain { border-radius: 0; border-top: 1px solid var(--et-border); margin: 0; }
.et-summary .et-total:first-child { margin-top: 0; }

/* Expense form */
.et-amount-input .form-control { font-size: var(--et-text-xl); font-weight: 650; }
.et-amount-input .input-group-text { min-width: 4.5rem; justify-content: center; font-weight: 650; background: var(--et-surface-2); color: var(--et-ink-2); border-color: var(--et-border-strong); }
.et-amount-input__currency { flex: 0 0 6.5rem; max-width: 6.5rem; font-weight: 650; }
.et-choices--compact { grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
.et-choice__card--row { flex-direction: row; align-items: center; padding: var(--et-space-2) var(--et-space-3); }
.et-choice__card--row .et-choice__title { font-weight: 600; font-size: var(--et-text-sm); line-height: 1.25; }
.et-date-input { max-width: 14rem; }

/* Details page */
.et-remarks { margin-top: var(--et-space-5); }
.et-remarks p { margin: var(--et-space-1) 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.et-meta { margin: var(--et-space-5) 0 0; color: var(--et-muted); font-size: var(--et-text-sm); }
.et-note { margin-top: var(--et-space-3); font-size: var(--et-text-sm); }

/* Locked select (group currency once it has expenses) */
.et-locked-hint { display: flex; align-items: center; gap: var(--et-space-1); }

/* ---------- Stage 5: who paid and how it's split ---------- */
/* Shown/hidden with :has() so the right inputs appear without script; the script only adds the live preview. */
.et-split { margin: var(--et-space-5) 0 var(--et-space-4); padding-top: var(--et-space-5); border-top: 1px solid var(--et-border); }
.et-split__heading { font-size: var(--et-text-base); font-weight: 650; margin: 0 0 var(--et-space-3); }
.et-split__heading:not(:first-child) { margin-top: var(--et-space-5); }
.et-split__status { margin: var(--et-space-2) 0 0; color: var(--et-muted); font-size: var(--et-text-sm); min-height: 1.3em; }
.et-switch { display: flex; align-items: center; gap: var(--et-space-2); min-height: var(--et-tap); margin: var(--et-space-2) 0 0; padding-left: 0; }
.et-switch .form-check-input { margin: 0; flex: none; width: 2.5em; height: 1.4em; float: none; }
.et-paid .et-paid__many { display: none; }
.et-paid:has([data-split-multi]:checked) .et-paid__many { display: block; }
.et-paid:has([data-split-multi]:checked) .et-paid__single { display: none; }
.et-choices--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.et-choices--three .et-choice__card--row { justify-content: center; text-align: center; }

/* People rows: avatar or checkbox, name, input, share */
.et-people { list-style: none; margin: 0; padding: 0; border: 1px solid var(--et-border); border-radius: var(--et-radius); }
.et-people__row { display: flex; align-items: center; gap: var(--et-space-3); min-height: 56px; padding: var(--et-space-2) var(--et-space-3); border-top: 1px solid var(--et-border); }
.et-people__row:first-child { border-top: 0; }
.et-people__check { flex: none; width: 1.25rem; height: 1.25rem; margin: 0; }
.et-people__name { flex: 1; min-width: 0; margin: 0; font-weight: 600; overflow-wrap: anywhere; cursor: pointer; }
.et-people__note { display: block; color: var(--et-muted); font-size: var(--et-text-xs); font-weight: 500; }
.et-people__input { flex: 0 0 9.5rem; max-width: 9.5rem; }
.et-people__input .input-group-text { background: var(--et-surface-2); color: var(--et-muted); font-size: var(--et-text-sm); font-weight: 600; }
.et-people__share { flex: none; min-width: 6.5rem; text-align: right; color: var(--et-ink-2); font-size: var(--et-text-sm); font-weight: 600; }
.et-people__row--out .et-people__name { color: var(--et-muted); font-weight: 500; }
.et-split__percent, .et-split__exact { display: none; }
.et-split:has([data-split-method][value="2"]:checked) .et-people__row:not(.et-people__row--out) .et-split__percent { display: flex; }
.et-split:has([data-split-method][value="3"]:checked) .et-people__row:not(.et-people__row--out) .et-split__exact { display: flex; }
.et-split:has([data-split-method][value="3"]:checked) .et-people__share { display: none; }

/* "Who is it for?": one-tap presets; the split controls (.et-split__custom) show only for Custom split. */
.et-forwho { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
.et-forwho .et-choice__card--row { gap: var(--et-space-2); min-height: var(--et-tap); }
.et-forwho .et-avatar--sm { width: 24px; height: 24px; font-size: 0.625rem; flex: none; }
.et-forwho__icon { display: inline-flex; flex: none; width: 24px; height: 24px; align-items: center; justify-content: center; color: var(--et-muted); }
.et-split__custom { display: none; }
.et-split:has([data-forwho][value="custom"]:checked) .et-split__custom { display: block; }
/* Live line under the presets: whose part the expense becomes (script fills it; empty = hidden). */
.et-forwho-result { display: flex; flex-wrap: wrap; gap: var(--et-space-1) var(--et-space-4); margin: var(--et-space-3) 0 0;
                    padding: var(--et-space-3) var(--et-space-4); border-radius: var(--et-radius); background: var(--et-surface-2);
                    font-size: var(--et-text-sm); color: var(--et-ink-2); }
.et-forwho-result:empty { display: none; }
.et-forwho-result strong { color: var(--et-ink); font-variant-numeric: tabular-nums; }
.et-forwho-result__owe { flex-basis: 100%; color: var(--et-muted); }

/* Group report: shared vs individual (a stacked bar + legend rows) */
.et-breakdown { padding: 0 var(--et-space-5) var(--et-space-5); }
.et-breakdown .et-stackbar { height: 14px; margin: var(--et-space-2) 0 var(--et-space-4); }
.et-breakdown .et-legend__row { min-height: 40px; }
.et-breakdown__sub { display: block; font-size: var(--et-text-xs); color: var(--et-muted); }
.et-breakdown__total { display: flex; justify-content: space-between; align-items: baseline; margin: var(--et-space-2) 0 0;
                       padding-top: var(--et-space-3); border-top: 1px solid var(--et-border); font-weight: 650; }
.et-breakdown__total span:last-child { font-variant-numeric: tabular-nums; }

/* Details: paid vs share table */
.et-shares { width: 100%; border-collapse: collapse; font-size: var(--et-text-sm); }
.et-shares th { font-size: var(--et-text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--et-muted); font-weight: 650; text-align: right; padding: var(--et-space-2) var(--et-space-5); border-bottom: 1px solid var(--et-border); }
.et-shares th:first-child, .et-shares td:first-child { text-align: left; }
.et-shares td { padding: var(--et-space-3) var(--et-space-5); border-top: 1px solid var(--et-border); text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.et-shares tbody tr:first-child td { border-top: 0; }
.et-shares__person { display: flex; align-items: center; gap: var(--et-space-3); white-space: normal; }
.et-shares__name { margin: 0; overflow-wrap: anywhere; }
.et-shares__sub { display: block; color: var(--et-muted); font-size: var(--et-text-xs); font-weight: 500; }
.et-shares__none { color: var(--et-muted); font-weight: 500; }
.et-shares tfoot td { border-top: 1px solid var(--et-border-strong); background: var(--et-surface-2); }
.et-shares tfoot tr:last-child td:first-child { border-radius: 0 0 0 var(--et-radius-lg); }
.et-shares tfoot tr:last-child td:last-child { border-radius: 0 0 var(--et-radius-lg) 0; }

/* "You paid X · Your share Y" */
.et-mine { display: flex; flex-wrap: wrap; gap: var(--et-space-1) var(--et-space-4); margin: var(--et-space-2) 0 0; color: var(--et-muted); font-size: var(--et-text-sm); }
.et-mine strong { color: var(--et-ink); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
  .et-main { padding-top: var(--et-space-5); }
  .et-topbar__inner { gap: var(--et-space-2); min-height: 56px; }
  .et-nav { display: none; }                       /* links move into the bottom tab bar */
  .et-brand__text { display: none; }
  .et-page-header { align-items: stretch; flex-direction: column; }
  .et-page-header__actions .btn { flex: 1 1 auto; }
  .et-page-header--inline { flex-direction: row; align-items: center; }   /* title + one icon action stay on one row */
  .et-card__body, .et-card__header, .et-card__footer { padding-left: var(--et-space-4); padding-right: var(--et-space-4); }
  .et-list__row { padding-left: var(--et-space-4); padding-right: var(--et-space-4); flex-wrap: wrap; }
  .et-list__end { width: 100%; justify-content: space-between; padding-left: 52px; text-align: left; }
  .et-card__footer .btn { flex: 1 1 auto; }
  .et-auth__card { padding: var(--et-space-5); }
  .et-alert--action .btn { width: 100%; }
  .et-day { padding-left: var(--et-space-4); padding-right: var(--et-space-4); }
  .et-breakdown__row { padding-left: var(--et-space-4); padding-right: var(--et-space-4); }
  .et-list__row--link { flex-wrap: nowrap; }
  .et-monthnav__label { min-width: 0; flex: 1; }
  .et-choices--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .et-date-input { max-width: none; }
  .et-total--detail { font-size: 1.875rem; }
  .et-people__row { flex-wrap: wrap; row-gap: var(--et-space-2); }
  .et-people__name { flex: 1 1 calc(100% - 1.25rem - var(--et-space-3)); }
  .et-people__input { flex: 1 1 0; min-width: 0; max-width: none; margin-left: calc(1.25rem + var(--et-space-3)); }
  .et-paid__many .et-people__name { flex-basis: calc(100% - 30px - var(--et-space-3)); }
  .et-paid__many .et-people__input { margin-left: calc(30px + var(--et-space-3)); }
  .et-people__share { min-width: 5.5rem; }
  .et-shares th, .et-shares td { padding-left: var(--et-space-4); padding-right: var(--et-space-4); }
  .et-shares__person .et-avatar { display: none; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .et-card--link:hover, .btn:active { transform: none; }
}

/* ---------- Sharing (Stage 6) ---------- */
/* "Share with another group" form in a card footer: the select grows, the button sits at its foot. */
.et-share-form { align-items: flex-end; justify-content: flex-start; }
.et-share-form .et-field { flex: 1 1 14rem; margin-bottom: 0; }
.et-share-form__hint { flex-basis: 100%; margin: 0; }
.et-note .et-icon { vertical-align: -2px; }

/* ---------- Reports (Stage 7) ---------- */
/* Tabs that may outgrow a phone (one per group): the row scrolls inside itself, never the page. */
.et-tabs--scroll { display: flex; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.et-tabs--scroll .et-tabs__link { white-space: nowrap; flex: 0 0 auto; }
.et-tabs-row { display: flex; flex-wrap: wrap; gap: 0 var(--et-space-3); }

/* Custom range form: two dates and a button on one line; stacks on phones. */
.et-range-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--et-space-3); margin-bottom: var(--et-space-5); }
.et-range-form .et-field { flex: 0 1 11rem; margin-bottom: 0; }

/* Change vs a comparison period. Neutral ink on purpose: more spending isn't "bad", so no status colours. */
.et-changes { list-style: none; margin: var(--et-space-4) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--et-space-2); }
.et-change { display: flex; align-items: flex-start; gap: var(--et-space-2); font-size: var(--et-text-sm); color: var(--et-ink-2); }
.et-change .et-icon { flex: 0 0 auto; margin-top: 2px; color: var(--et-muted); }
.et-change--up .et-icon, .et-change--down .et-icon { color: var(--et-primary-ink); }
.et-change__was { display: block; color: var(--et-muted); font-size: var(--et-text-xs); }

/* Month-by-month bars, drawn on the server. Height comes from a 5% step class (no inline styles under the CSP);
   exact values are in each bar's tooltip and in the table under the chart. */
.et-chart { margin: 0; padding: var(--et-space-4) var(--et-space-5) var(--et-space-3); }
.et-chart__plot { list-style: none; margin: 0; padding: 0; display: flex; align-items: stretch; gap: 2px; }
.et-chart__col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.et-chart__track { position: relative; height: 160px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  border-bottom: 1px solid var(--et-border-strong); border-radius: var(--et-radius-sm) var(--et-radius-sm) 0 0; cursor: default; }
.et-chart__track:hover, .et-chart__track:focus-visible { background: var(--et-surface-2); }
.et-chart__track:focus-visible { outline: 2px solid var(--et-focus); outline-offset: 1px; }
.et-chart__bar { display: block; width: 72%; max-width: 28px; height: 0; background: var(--et-primary); border-radius: 4px 4px 0 0; }
.et-chart__bar--context { background: color-mix(in srgb, var(--et-primary) 55%, var(--et-surface)); }
.et-chart__bar--h0 { height: 0; }
.et-chart__bar--h5 { height: 5%; }
.et-chart__bar--h10 { height: 10%; }
.et-chart__bar--h15 { height: 15%; }
.et-chart__bar--h20 { height: 20%; }
.et-chart__bar--h25 { height: 25%; }
.et-chart__bar--h30 { height: 30%; }
.et-chart__bar--h35 { height: 35%; }
.et-chart__bar--h40 { height: 40%; }
.et-chart__bar--h45 { height: 45%; }
.et-chart__bar--h50 { height: 50%; }
.et-chart__bar--h55 { height: 55%; }
.et-chart__bar--h60 { height: 60%; }
.et-chart__bar--h65 { height: 65%; }
.et-chart__bar--h70 { height: 70%; }
.et-chart__bar--h75 { height: 75%; }
.et-chart__bar--h80 { height: 80%; }
.et-chart__bar--h85 { height: 85%; }
.et-chart__bar--h90 { height: 90%; }
.et-chart__bar--h95 { height: 95%; }
.et-chart__bar--h100 { height: 100%; }
.et-chart__value { font-size: var(--et-text-xs); font-weight: 650; color: var(--et-ink); font-variant-numeric: tabular-nums; white-space: nowrap; margin-bottom: 2px; }
.et-chart__label { display: block; margin-top: var(--et-space-1); font-size: var(--et-text-xs); color: var(--et-muted); text-align: center; white-space: nowrap; overflow: visible; }
.et-chart__label--hidden { visibility: hidden; }
.et-chart__track[data-tip]:hover::after, .et-chart__track[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 2;
  padding: var(--et-space-1) var(--et-space-2); border-radius: var(--et-radius-sm); background: var(--et-ink); color: var(--et-surface);
  font-size: var(--et-text-xs); font-weight: 600; white-space: nowrap; box-shadow: var(--et-shadow); pointer-events: none; }
.et-chart__col:first-child .et-chart__track::after { left: 0; transform: none; }
.et-chart__col:last-child .et-chart__track::after { left: auto; right: 0; transform: none; }
.et-chart__note { margin: var(--et-space-2) 0 0; font-size: var(--et-text-xs); color: var(--et-muted); }

/* "Show as a table" under a chart. */
.et-table-toggle { border-top: 1px solid var(--et-border); }
.et-table-toggle > summary { display: flex; align-items: center; min-height: var(--et-tap); padding: 0 var(--et-space-5); color: var(--et-primary-ink);
  font-size: var(--et-text-sm); font-weight: 600; cursor: pointer; }
.et-table-toggle > summary:focus-visible { outline: 2px solid var(--et-focus); outline-offset: -2px; }
.et-table-toggle .et-shares { border-top: 1px solid var(--et-border); }
.et-breakdown__sub { display: block; margin-top: var(--et-space-1); color: var(--et-muted); font-size: var(--et-text-xs); }

@media (max-width: 767.98px) {
  .et-chart { padding-left: var(--et-space-4); padding-right: var(--et-space-4); }
  .et-chart__track { height: 132px; }
  .et-table-toggle > summary { padding: 0 var(--et-space-4); }
  .et-range-form .et-field { flex: 1 1 9rem; }
  .et-range-form .btn { flex: 1 1 100%; }
}
.et-breakdown__line > .et-num { flex: 0 0 auto; white-space: nowrap; }

/* Five top-bar links don't fit beside the switcher, the Add expense button and your name below 1400px: icons only
   there (the text stays for screen readers, and each link has a title). Phones move the links into the bottom tab bar instead. */
@media (min-width: 768px) and (max-width: 1399.98px) {
  .et-nav .et-nav__text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .et-nav__link { min-width: var(--et-tap); justify-content: center; }
}

/* ---------- Quick entry and search (ahead of Stage 8) ---------- */
/* Quick add: a primary button in the top bar from 768px (icon only up to 1199px, like the nav links). Phones use the
   raised Add tab in the bottom tab bar instead. Hidden on the add/edit form itself. */
.et-quickadd { flex: none; }

/* Bottom tab bar (phones only): the five main destinations, fixed to the bottom edge within thumb reach.
   The top-bar nav is hidden below 768px; this takes its place. Add is the raised primary tab in the middle. */
.et-tabbar { display: none; }
.et-tabbar__link {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: var(--et-space-1) 0;
  color: var(--et-muted);
  font-size: var(--et-text-xs);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: color var(--et-fast) var(--et-ease);
}
.et-tabbar__link:hover { color: var(--et-ink); }
.et-tabbar__link[aria-current="page"] { color: var(--et-primary-ink); }
.et-tabbar__link:focus-visible { outline: 2px solid var(--et-focus); outline-offset: -4px; border-radius: var(--et-radius); }
.et-tabbar__link > .et-icon { margin: 7px 0; }   /* same 32px row as the Add pill, so every label lines up */
.et-tabbar__text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.et-tabbar__add {
  display: grid;
  place-items: center;
  width: 40px;
  height: 32px;
  border-radius: var(--et-radius-lg);
  background: var(--et-primary);
  color: #fff;
  transition: background-color var(--et-fast) var(--et-ease), transform var(--et-fast) var(--et-ease);
}
.et-tabbar__link--add:hover .et-tabbar__add { background: var(--et-primary-hover); }
.et-tabbar__link--add:active .et-tabbar__add { transform: translateY(1px); }
.et-tabbar__link--add { color: var(--et-ink-2); }

/* Phones: Invitations as an icon in the top bar, with its count pinned to the corner. */
.et-invites-btn { position: relative; display: none; color: var(--et-ink-2); text-decoration: none; }
.et-invites-btn[aria-current="page"] { color: var(--et-primary-ink); background: var(--et-primary-soft); }
.et-invites-btn__count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; font-size: 0.6875rem; }

/* "Filled in from last time" line under the description (description suggestions). */
.et-hint-status:empty { display: none; }

/* Search box above the month (Expenses): the field grows, the button sits beside it. */
.et-search { display: flex; gap: var(--et-space-2); margin-bottom: var(--et-space-4); }
.et-search .input-group { flex: 1 1 auto; }
.et-search .input-group-text { background: var(--et-surface); color: var(--et-muted); border-color: var(--et-border-strong); }
.et-search .form-control { border-left: 0; }
.et-search .form-control:focus { border-left: 1px solid var(--et-focus); }

/* Filter form (Search page): fields in a grid that wraps; buttons in the card footer. */
.et-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0 var(--et-space-4); }
.et-filters__wide { grid-column: 1 / -1; }

/* Active filters as removable chips: each is a link back to the search without that filter. */
.et-chips { list-style: none; margin: 0 0 var(--et-space-4); padding: 0; display: flex; flex-wrap: wrap; gap: var(--et-space-2); }
.et-chip {
  display: inline-flex; align-items: center; gap: var(--et-space-2);
  min-height: var(--et-tap); padding: 0 var(--et-space-3);
  border: 1px solid var(--et-border-strong); border-radius: var(--et-radius);
  background: var(--et-surface); color: var(--et-ink-2);
  font-size: var(--et-text-sm); font-weight: 600; text-decoration: none;
  transition: background-color var(--et-fast) var(--et-ease), border-color var(--et-fast) var(--et-ease);
}
.et-chip:hover { background: var(--et-surface-2); color: var(--et-ink); }
.et-chip:focus-visible { outline: 2px solid var(--et-focus); outline-offset: 2px; }
.et-chip .et-icon { color: var(--et-muted); }

/* Previous / next page under a long list. */
.et-pager { display: flex; align-items: center; justify-content: space-between; gap: var(--et-space-3); margin-top: var(--et-space-4); }
.et-pager__label { color: var(--et-muted); font-size: var(--et-text-sm); }
.et-pager__spacer { width: 1px; }

@media (max-width: 767.98px) {
  .et-quickadd { display: none; }
  .et-invites-btn { display: inline-grid; }
  .et-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: color-mix(in srgb, var(--et-surface) 94%, transparent);
    backdrop-filter: saturate(1.4) blur(8px);
    border-top: 1px solid var(--et-border);
  }
  /* The footer (and so the last row of every page) never hides under the tab bar. */
  body:has(.et-tabbar) { padding-bottom: calc(57px + env(safe-area-inset-bottom, 0px)); }
  .et-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .et-filters__wide { grid-column: 1 / -1; }
}
/* The brand's words make way for the icon links and the Add button on small tablets (the mark stays). */
@media (min-width: 768px) and (max-width: 991.98px) {
  .et-brand__text { display: none; }
}
@media (min-width: 768px) and (max-width: 1199.98px) {
  .et-quickadd { min-width: var(--et-tap); padding-left: 0; padding-right: 0; }
  .et-quickadd .et-quickadd__text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .et-tabbar__link--add:active .et-tabbar__add { transform: none; }
}

/* Disclosure for optional fields (Search: "More filters"). The native <details>, so it works without script. */
.et-disclosure > summary { display: inline-flex; align-items: center; gap: var(--et-space-2); min-height: var(--et-tap); margin-bottom: var(--et-space-2);
  color: var(--et-primary-ink); font-size: var(--et-text-sm); font-weight: 600; cursor: pointer; }
.et-disclosure > summary:focus-visible { outline: 2px solid var(--et-focus); outline-offset: 2px; border-radius: var(--et-radius-sm); }
/* Keeps a form's default (first-in-markup) submit button at the end of its row on screen. */
.et-order-last { order: 1; }
/* A long name in the account button truncates instead of pushing the top bar wider than the page. */
.et-usermenu__name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

/* ---------- Reports drill-down ---------- */
/* A breakdown row that opens the matching expenses (Search): same hover and focus as a list-row link, plus a chevron. */
.et-breakdown > li { list-style: none; }
.et-breakdown__row--link { color: inherit; text-decoration: none; min-height: var(--et-tap); transition: background-color var(--et-fast) var(--et-ease); }
.et-breakdown__row--link:hover { color: inherit; background: var(--et-surface-2); }
.et-breakdown__row--link:focus-visible { outline: 2px solid var(--et-focus); outline-offset: -2px; }
.et-breakdown__go { flex: none; color: var(--et-muted); }
/* A chart bar that is a link (group reports): pointer, no underline, the same tooltip, a darker bar on hover. */
a.et-chart__track { color: inherit; text-decoration: none; cursor: pointer; }
a.et-chart__track:hover .et-chart__bar { background: var(--et-primary-hover); }

/* ---------- Overview dashboard (period bar, donut, legend, stacked bar, workspace cards) ---------- */
/* Period bar: Day / Week / Month / Year tabs on the left, the date navigation on the right; stacked on phones. */
.et-period { display: flex; flex-direction: column; align-items: flex-start; gap: var(--et-space-3); margin-bottom: var(--et-space-5); }
.et-period .et-tabs, .et-period .et-monthnav { margin-bottom: 0; }
.et-period .et-monthnav__label { min-width: 11rem; }
.et-period__today { margin-left: var(--et-space-2); }
.et-icon-btn--placeholder { visibility: hidden; pointer-events: none; }
@media (max-width: 575.98px) {
  .et-period { flex-direction: column; align-items: stretch; }
  .et-period .et-tabs { display: flex; }
  .et-period .et-tabs__link { flex: 1; justify-content: center; }
  .et-period .et-monthnav { flex-wrap: wrap; justify-content: space-between; }
  .et-period .et-monthnav__label { min-width: 0; flex: 1; font-size: var(--et-text-base); }
  .et-period .et-period__today { width: 100%; margin: 0; }
}

/* Series colours for charts: the six tint inks, in rank order (largest first). Every mark also has a text label. */
.et-series-0 { --et-series: var(--et-tint-0-ink); }
.et-series-1 { --et-series: var(--et-tint-1-ink); }
.et-series-2 { --et-series: var(--et-tint-2-ink); }
.et-series-3 { --et-series: var(--et-tint-3-ink); }
.et-series-4 { --et-series: var(--et-tint-4-ink); }
.et-series-5 { --et-series: var(--et-tint-5-ink); }

/* Donut: server-drawn SVG ring (slice lengths are attributes, so the CSP allows them) above its legend. */
.et-donut { display: flex; flex-direction: column; align-items: center; gap: var(--et-space-5); padding: var(--et-space-5); }
.et-donut__wrap { position: relative; width: 148px; height: 148px; flex: none; }
.et-donut__svg { width: 148px; height: 148px; transform: rotate(-90deg); }
.et-donut__ring { fill: none; stroke: var(--et-surface-2); stroke-width: 18; }
.et-donut__slice { fill: none; stroke: var(--et-series); stroke-width: 18; }
.et-donut__centre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 28px; }
.et-donut__centre strong { font-size: var(--et-text-base); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.et-donut__centre span { font-size: var(--et-text-xs); color: var(--et-muted); }

/* Legend rows (also used for the top categories on a workspace card). */
.et-legend, .et-gcard__cats { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--et-space-1); width: 100%; }
.et-legend__row { display: flex; align-items: center; gap: var(--et-space-2); min-height: 28px; font-size: var(--et-text-sm); }
.et-legend__swatch { flex: none; width: 10px; height: 10px; border-radius: 2px; background: var(--et-series); }
.et-legend__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--et-ink-2); }
.et-legend__value { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.et-legend__pct { color: var(--et-muted); font-variant-numeric: tabular-nums; min-width: 2.6rem; text-align: right; }
.et-legend__go { flex: none; color: var(--et-muted); }
/* A legend row that opens its expenses or workspace. Sits above a card's stretched link. */
.et-legend__row--link { position: relative; z-index: 1; min-height: 36px; margin: 0 calc(-1 * var(--et-space-2)); padding: 0 var(--et-space-2);
  border-radius: var(--et-radius-sm); color: inherit; text-decoration: none; transition: background-color var(--et-fast) var(--et-ease); }
.et-legend__row--link:hover { color: inherit; background: var(--et-surface-2); }
.et-legend__row--link:focus-visible { outline: 2px solid var(--et-focus); outline-offset: 0; }
@media (pointer: coarse) { .et-legend__row--link { min-height: var(--et-tap); } }

/* Stacked bar: a card's split by category (SVG rects, widths as attributes). */
.et-stackbar { display: block; width: 100%; height: 10px; border-radius: 999px; overflow: hidden; background: var(--et-surface-2); }
.et-stackbar rect { fill: var(--et-series); stroke: var(--et-surface); stroke-width: 0.6; }

/* Workspace cards: the whole card opens the workspace (stretched link); the + and category rows sit above it. */
.et-section-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--et-space-3); margin: var(--et-space-6) 0 var(--et-space-3); }
.et-section-title h2 { font-size: var(--et-text-lg); margin: 0; }
.et-section-title__link { font-size: var(--et-text-sm); display: inline-flex; align-items: center; min-height: var(--et-tap); }
.et-groupgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--et-space-4); }
.et-gcard { position: relative; display: flex; flex-direction: column;
  transition: transform var(--et-base) var(--et-ease), box-shadow var(--et-base) var(--et-ease), border-color var(--et-base) var(--et-ease); }
.et-gcard:hover { transform: translateY(-2px); box-shadow: var(--et-shadow); border-color: var(--et-border-strong); }
.et-gcard:has(.et-gcard__open:active) { transform: translateY(0); }
.et-gcard__head { display: flex; align-items: center; gap: var(--et-space-3); padding: var(--et-space-4) var(--et-space-4) 0 var(--et-space-5); }
.et-gcard__title { min-width: 0; flex: 1; }
.et-gcard__name { margin: 0; font-size: var(--et-text-base); font-weight: 650; overflow-wrap: anywhere; }
.et-gcard__open { color: inherit; text-decoration: none; }
.et-gcard__open:hover { color: inherit; }
.et-gcard__open::after { content: ""; position: absolute; inset: 0; border-radius: var(--et-radius-lg); }
.et-gcard__open:focus-visible { outline: none; }
.et-gcard__open:focus-visible::after { outline: 2px solid var(--et-focus); outline-offset: 2px; }
.et-gcard__type { margin: 0; font-size: var(--et-text-xs); color: var(--et-muted); }
.et-gcard__add { position: relative; z-index: 1; flex: none; }
.et-gcard__body { flex: 1; display: flex; flex-direction: column; gap: var(--et-space-3); padding: var(--et-space-3) var(--et-space-5) var(--et-space-4); }
.et-gcard__body .et-total, .et-gcard__body .et-mine, .et-gcard__body .et-changes { margin: 0; }
.et-gcard__more { margin: calc(-1 * var(--et-space-2)) 0 0; font-size: var(--et-text-sm); font-weight: 600; color: var(--et-ink-2); }
.et-gcard__foot { display: flex; align-items: center; justify-content: space-between; padding: var(--et-space-3) var(--et-space-5);
  border-top: 1px solid var(--et-border); color: var(--et-muted); font-size: var(--et-text-sm); }
.et-gcard__go { display: inline-flex; align-items: center; gap: 2px; color: var(--et-primary-ink); font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .et-gcard, .et-gcard:hover { transition: none; transform: none; }
}

/* Pace line: an .et-change row; neutral like the change line. Rank number in a "biggest" list. */
.et-change--pace .et-icon { color: var(--et-muted); }
.et-rank { flex: none; width: 1.25rem; text-align: center; font-weight: 650; color: var(--et-muted); }

/* Section title with its link right after the heading ("Your groups · Manage groups") */
.et-section-title--inline { justify-content: flex-start; }

/* ---------- Expenses page (one group, one period, filters) ---------- */
/* Summary figures: one row per currency; the lead figure first, then your share / you paid on group pages. */
.et-figures { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: var(--et-space-4) var(--et-space-5); padding: var(--et-space-4) var(--et-space-5); }
.et-figures + .et-figures { border-top: 1px solid var(--et-border); }
.et-figures__item { min-width: 0; }
.et-figures__label { font-size: var(--et-text-xs); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; color: var(--et-muted); margin: 0 0 var(--et-space-1); }
.et-figures__value { display: flex; align-items: baseline; gap: var(--et-space-1); margin: 0; font-size: var(--et-text-xl); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.et-figures__item--lead .et-figures__value { font-size: var(--et-text-2xl); letter-spacing: -0.01em; }
.et-figures__currency { font-size: var(--et-text-sm); font-weight: 650; color: var(--et-muted); }
.et-figures__sub { margin: 2px 0 0; font-size: var(--et-text-sm); color: var(--et-muted); }
.et-figures .et-changes { margin-top: var(--et-space-2); }

/* Header icon actions (group details, filter); the filter shows how many filters are in use. */
.et-page-header__actions--icons { flex-wrap: nowrap; }
.et-filterbtn { position: relative; }
.et-filterbtn__count { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
  background: var(--et-primary); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.et-filterpanel { margin-bottom: var(--et-space-4); }
.et-chip--clear { background: transparent; border-style: dashed; }

/* "By category" on the Expenses page: rows filter the list; the chosen one stays highlighted. */
.et-legend--card { padding: var(--et-space-3) var(--et-space-5) var(--et-space-4); }
.et-legend__row--link[aria-current="true"] { background: var(--et-primary-soft); color: var(--et-primary-ink); }
.et-legend__row--link[aria-current="true"] .et-legend__name { color: inherit; font-weight: 650; }
.et-card__note { margin: 0; padding: 0 var(--et-space-5) var(--et-space-4); font-size: var(--et-text-sm); color: var(--et-muted); }

@media (max-width: 575.98px) {
  .et-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--et-space-4); }
  .et-figures__item--lead { grid-column: 1 / -1; }
  .et-legend--card { padding-left: var(--et-space-4); padding-right: var(--et-space-4); }
  .et-card__note { padding-left: var(--et-space-4); padding-right: var(--et-space-4); }
}

/* ---------- Reports (trend, what changed, who paid / who owes) ---------- */
/* A second header inside a card (the trend under the total): a rule above instead of below. */
.et-card__header--sub { margin-top: var(--et-space-5); border-top: 1px solid var(--et-border); border-bottom: 0; padding-bottom: 0; }
.et-card__header--sub .et-card__title { font-size: var(--et-text-base); }
.et-period .et-range-form { margin-bottom: 0; }

/* A change in a table cell: "+12%", "−8%", "New". Neutral on purpose (more isn't bad, less isn't good), like .et-change. */
.et-delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; white-space: nowrap; color: var(--et-ink-2); }
.et-delta .et-icon { color: var(--et-primary-ink); }
.et-delta--flat, .et-delta--flat .et-icon { color: var(--et-muted); }

/* Tables: a link around a row's name, a tighter variant for the side column, and a column dropped on phones. */
.et-shares__link { color: inherit; text-decoration: none; min-height: var(--et-tap); }
.et-shares__link:hover .et-shares__name { text-decoration: underline; }
.et-shares__link:focus-visible { outline: 2px solid var(--et-focus); outline-offset: 2px; border-radius: var(--et-radius-sm); }
.et-shares--compact th, .et-shares--compact td { padding-left: var(--et-space-2); padding-right: var(--et-space-2); }
.et-shares--compact th:first-child, .et-shares--compact td:first-child { padding-left: var(--et-space-5); }
.et-shares--compact th:last-child, .et-shares--compact td:last-child { padding-right: var(--et-space-5); }
.et-shares--changes tbody td { vertical-align: middle; }
.et-shares tfoot td:first-child { font-weight: 650; }

/* Balance: paid minus share. "Ahead" (paid more) in the primary ink, "behind" plain; never red / green. */
.et-balance-amount { font-weight: 650; }
.et-balance-amount--ahead { color: var(--et-primary-ink); }
.et-balance { padding: var(--et-space-4) var(--et-space-5); border-top: 1px solid var(--et-border); background: var(--et-surface-2);
  border-radius: 0 0 var(--et-radius-lg) var(--et-radius-lg); }
.et-balance__line { margin: 0 0 var(--et-space-1); }
.et-balance__note { margin: 0; font-size: var(--et-text-xs); color: var(--et-muted); }

@media (max-width: 575.98px) {
  .et-shares__wide { display: none; }
  .et-shares--changes th, .et-shares--changes td, .et-table-toggle .et-shares th, .et-table-toggle .et-shares td { padding-left: var(--et-space-2); padding-right: var(--et-space-2); }
  .et-shares--changes th:first-child, .et-shares--changes td:first-child,
  .et-table-toggle .et-shares th:first-child, .et-table-toggle .et-shares td:first-child { padding-left: var(--et-space-4); }
  .et-shares--changes th:last-child, .et-shares--changes td:last-child,
  .et-table-toggle .et-shares th:last-child, .et-table-toggle .et-shares td:last-child { padding-right: var(--et-space-4); }
}

/* ---------- Add expense: Group picker (a form field that opens the switcher menu) ---------- */
.et-grouppick__toggle { display: flex; align-items: center; gap: var(--et-space-2); min-height: var(--et-tap); text-align: left; }
.et-grouppick__menu { width: 100%; }
.et-grouppick__currency { margin-left: auto; font-size: var(--et-text-xs); font-weight: 650; color: var(--et-muted); }
.et-grouppick__currency + .et-switcher__check { margin-left: var(--et-space-2); }
