/* Shared CRM styles: theme vars, shell/sidebar/nav, and the common list-page
   layout (page header, stat line, table, filter bar, pagination). Templates
   keep their own <style> block for page-specific rules (charts, forms,
   add-panel, stripe panel, etc). */

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

/* ── Dark theme (default) ───────────────────────────────── */
:root {
  --c-bg:        #323232;
  --c-panel:     #292929;
  --c-surface:   #3c3c3c;
  --c-border:    #4d4d4d;
  --c-row-alt:   #404040;
  --c-row-hover: #484848;

  --c-ink:    #e8e8e8;
  --c-muted:  #c2c2c2;
  --c-subtle: #b0b0b0;

  --c-teal:       #2bc4b0;
  --c-teal-light: #5eead4;
  /* Darker, button-only teal — #2bc4b0 only reaches 3.9:1 with white
     text, so filled buttons/pills use this instead of --c-teal.
     Icons, active nav, and other non-fill accents keep --c-teal. */
  --c-teal-btn:   #0e7d70;

  --c-sold:    #28a745;
  --c-pending: #0d6efd;
  --c-unsold:  #c0392b;

  --c-sidebar-text:        #c8c8c8;
  --c-sidebar-text-active: #ffffff;
  --c-sidebar-hover:       #363636;
  --c-sidebar-active:      #3a3a3a;

  --c-focus: #2bc4b0;

  --font-ui:   system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-data: ui-monospace, "SF Mono", "Cascadia Code", monospace;
}

/* ── Light theme ────────────────────────────────────────── */
:root[data-theme="light"] {
  --c-bg:        #f0f0f0;
  --c-panel:     #e4e4e4;
  --c-surface:   #ffffff;
  --c-border:    #cccccc;
  --c-row-alt:   #f8f8f8;
  --c-row-hover: #eef4ff;

  --c-ink:    #1a1a1a;
  --c-muted:  #555555;
  --c-subtle: #636363;

  --c-teal:       #0f766e;
  --c-teal-light: #14b8a6;
  --c-teal-btn:   #0a5f58;

  --c-sold:    #198754;
  --c-pending: #0d6efd;
  --c-unsold:  #c0392b;

  --c-sidebar-text:        #444444;
  --c-sidebar-text-active: #111111;
  --c-sidebar-hover:       #d8d8d8;
  --c-sidebar-active:      #d0d0d0;

  --c-focus: #0f766e;
}

/* ── Base ───────────────────────────────────────────────── */
html, body {
  height: 100%;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

/* Plain inline links (e.g. prose in a <p>, a bare <a> in a table cell)
   with no wrapping class fall back to the browser default — blue/purple,
   visited-purple — without this. Wrapped in :where() to keep specificity
   at zero: a bare `a:visited` selector is (0,1,1), which would otherwise
   outrank single-class component rules like .nav__link's (0,1,0) — every
   visited sidebar link (i.e. anything you've clicked) would silently
   re-color itself teal instead of respecting the component's own color.
   :where() keeps this purely a low-priority fallback, so .breadcrumb a,
   .nav__link, .btn, .stripe-dash-link, etc. always win regardless of
   visited state. */
:where(a) {
  color: var(--c-teal);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--c-teal) 40%, transparent);
  text-underline-offset: 2px;
}
:where(a:visited) { color: var(--c-teal); }
:where(a:hover) { text-decoration-color: currentColor; }

/* ── Shell ──────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 100%;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-panel);
  border-right: 1px solid var(--c-border);
}

.sidebar__brand {
  padding: 1.25rem 1rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-teal);
  border-bottom: 1px solid var(--c-border);
}

.nav {
  list-style: none;
  padding: 0.5rem 0;
  flex: 1;
  overflow-y: auto;
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--c-sidebar-text);
  text-decoration: none;
  transition: background 100ms, color 100ms;
}

.nav__link i {
  width: 1rem;
  text-align: center;
  font-size: 0.875em;
  opacity: 0.8;
}

.nav__link:hover {
  background: var(--c-sidebar-hover);
  color: var(--c-sidebar-text-active);
}

.nav__link--active {
  background: var(--c-sidebar-active);
  color: var(--c-sidebar-text-active);
  font-weight: 500;
  border-left: 3px solid var(--c-teal);
  padding-left: calc(1rem - 3px);
}

.nav__link--active i {
  opacity: 1;
  color: var(--c-teal);
}

.nav__link--button {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  text-align: left;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.nav__group-label {
  padding: 0.875rem 1rem 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-subtle);
}

.nav__group:first-child .nav__group-label {
  padding-top: 0.25rem;
}

.sidebar__footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--c-border);
}

/* Mobile nav toggle (hamburger) — hidden on desktop, shown in the
   680px breakpoint below where it opens .nav as a dropdown. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--c-border);
  border-radius: 5px;
  color: var(--c-muted);
  cursor: pointer;
  transition: color 100ms, background 100ms, border-color 100ms;
}

.nav-toggle:hover {
  color: var(--c-ink);
  background: var(--c-sidebar-hover);
  border-color: var(--c-muted);
}

.nav-toggle i { font-size: 1rem; }

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-family: var(--font-ui);
  color: var(--c-muted);
  background: transparent;
  border: 1px solid var(--c-border);
  border-radius: 5px;
  cursor: pointer;
  transition: color 100ms, background 100ms, border-color 100ms;
}

.theme-toggle:hover {
  color: var(--c-ink);
  background: var(--c-sidebar-hover);
  border-color: var(--c-muted);
}

.theme-toggle i { font-size: 0.8125rem; }

/* ── Main ───────────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Page header (list pages) ──────────────────────────────
   Form pages (company_form/user_form) override this locally
   with a bordered variant — cascade order gives them priority. */
.page-header {
  padding: 1.5rem 2rem 0;
}

.page-header__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--c-ink);
  line-height: 1;
}

.page-date {
  font-family: var(--font-data);
  font-size: 0.8125rem;
  color: var(--c-subtle);
}

/* ── Stat line ──────────────────────────────────────────── */
.stat-line {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
}

.stat-item__num {
  font-family: var(--font-data);
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--c-ink);
  font-variant-numeric: tabular-nums lining-nums;
}

.stat-item__label {
  font-size: 0.8125rem;
  color: var(--c-muted);
  white-space: nowrap;
}

.stat-sep {
  color: var(--c-border);
  font-size: 1.25rem;
  line-height: 1;
  user-select: none;
  align-self: center;
}

/* ── Table area ─────────────────────────────────────────── */
.table-area {
  padding: 1.5rem 2rem 2rem;
  flex: 1;
}

.table-wrap {
  border: 1px solid var(--c-border);
  border-radius: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.875rem;
}

.table thead th {
  padding: 0.6rem 0.9rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--c-muted);
  background: var(--c-panel);
  border-bottom: 2px solid var(--c-border);
  border-right: 1px solid var(--c-border);
  white-space: nowrap;
}

.table thead th.num { text-align: right; }
.table thead th:last-child { border-right: none; }

.table tbody td {
  padding: 0.6rem 0.9rem;
  color: var(--c-ink);
  border-bottom: 1px solid var(--c-border);
  border-right: 1px solid var(--c-border);
  vertical-align: middle;
}

.table tbody td.num {
  text-align: right;
  font-family: var(--font-data);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.table tbody td:last-child { border-right: none; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:nth-child(even) td { background: var(--c-row-alt); }

.table tbody tr:hover td {
  background: var(--c-row-hover) !important;
  cursor: default;
}

.table tbody tr.row-link:hover td { cursor: pointer; }

/* De-prioritize a column on the narrowest screens instead of relying
   solely on horizontal scroll (e.g. the "Joined" column in users.html). */
.col-hide-sm { }

.col-id {
  font-family: var(--font-data);
  font-size: 0.8125rem;
  color: var(--c-subtle);
  font-variant-numeric: tabular-nums;
  width: 3.5rem;
}

.col-form { color: var(--c-muted); }

.col-ts {
  font-family: var(--font-data);
  font-size: 0.8125rem;
  color: var(--c-muted);
  white-space: nowrap;
}

.col-ts-time { color: var(--c-subtle); margin-left: 0.25em; }

/* ── Status pills (base — variant colors stay page-local) ── */
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1.8;
}

.pill--sold    { background: var(--c-sold);    color: #fff; }
.pill--pending { background: var(--c-pending); color: #fff; }
.pill--unsold  { background: var(--c-unsold);  color: #fff; }
.pill--expired {
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-subtle);
}

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
}

.filter-group input,
.filter-group select {
  height: 2rem;
  padding: 0 0.6rem;
  font-size: 0.8125rem;
  font-family: var(--font-ui);
  color: var(--c-ink);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  outline: none;
  transition: border-color 100ms;
}

.filter-group input:focus,
.filter-group select:focus { border-color: var(--c-teal); }

.filter-group input[type="date"]   { width: 9rem; }
.filter-group input[type="search"] { min-width: 16rem; }
.filter-group select                { min-width: 8rem; }

.filter-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 1px;
}

.btn-filter {
  height: 2rem;
  padding: 0 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-ui);
  color: #fff;
  background: var(--c-teal-btn);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 100ms;
}

.btn-filter:hover { opacity: 0.88; }

.btn-clear {
  font-size: 0.8125rem;
  color: var(--c-muted);
  text-decoration: none;
  white-space: nowrap;
}

.btn-clear:hover { color: var(--c-ink); }

.btn-new {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2rem;
  padding: 0 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-ui);
  color: #fff;
  background: var(--c-teal-btn);
  border: none;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 100ms;
}

.btn-new:hover { opacity: 0.88; }

.table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.table-meta__count {
  font-size: 0.8125rem;
  color: var(--c-muted);
}

.filter-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--c-teal-btn);
  color: #fff;
  border-radius: 3px;
  margin-left: 0.4rem;
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0 0;
  flex-wrap: wrap;
}

.pagination__page,
.pagination__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-family: var(--font-data);
  color: var(--c-muted);
  text-decoration: none;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: var(--c-surface);
  transition: background 100ms, color 100ms, border-color 100ms;
}

.pagination__page:hover,
.pagination__arrow:hover {
  background: var(--c-row-hover);
  color: var(--c-ink);
  border-color: var(--c-muted);
}

.pagination__page--active {
  background: var(--c-teal-btn);
  color: #fff;
  border-color: var(--c-teal-btn);
  font-weight: 600;
  cursor: default;
}

.pagination__page--active:hover {
  background: var(--c-teal-btn);
  color: #fff;
  border-color: var(--c-teal-btn);
}

.pagination__ellipsis {
  padding: 0 0.25rem;
  color: var(--c-subtle);
  font-size: 0.875rem;
  user-select: none;
}

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--c-subtle);
  font-size: 0.875rem;
}

/* ── Focus ──────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .nav__link, .theme-toggle { transition: none; }
}

/* ── Responsive: sidebar collapse (shared by every page) ─── */
@media (max-width: 680px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
  }
  /* Order: brand (left) — theme toggle (middle) — nav toggle (right),
     spaced evenly by .sidebar's justify-content: space-between. */
  .sidebar__brand {
    order: 1;
    padding: 0.75rem 1rem;
    border-bottom: none;
  }
  .nav-toggle { display: inline-flex; order: 3; margin: 0 0.75rem; }
  /* Hidden by default; toggled open via JS (.nav--open) as a dropdown
     panel anchored below the top bar, instead of a horizontal scroller. */
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 0.5rem 0;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--c-panel);
    border-bottom: 1px solid var(--c-border);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    z-index: 30;
  }
  .nav.nav--open { display: flex; }
  .sidebar__footer {
    order: 2;
    padding: 0.5rem;
    border-top: none;
  }
  .page-header { padding: 1rem 1rem 0; }
  .table-area  { padding: 1rem; }
  .stat-item__num { font-size: 1.5rem; }
}

/* ── Responsive: narrow phones ──────────────────────────────
   Filter bars stack full-width instead of overflowing on fixed
   min-widths; orphaned stat separators are hidden; touch targets
   on shared controls are enlarged; low-priority table columns
   can be hidden via .col-hide-sm. */
@media (max-width: 480px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group,
  .filter-group input,
  .filter-group select {
    width: 100%;
    min-width: 0;
  }
  .filter-actions {
    justify-content: space-between;
  }
  .stat-sep { display: none; }
  .btn-filter,
  .btn-clear,
  .btn-new,
  .pagination__page,
  .pagination__arrow {
    min-height: 2.25rem;
  }
  .col-hide-sm { display: none; }
}

/* ── Login pages (accounts/login.html, partners/login.html) ── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
}
.login-card {
  width: 100%;
  max-width: 22rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 2rem;
}
.login-card__brand {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
  color: var(--c-ink);
}

/* ── Form-page header ───────────────────────────────────────
   Every form/detail page (company_form, user_form, sequence_form,
   sequence_step_form, campaign_form, buyer_set_detail,
   buyer_set_membership_form, campaign_docs_*, company_docs_*) used
   to duplicate this block byte-for-byte in its own <style> tag —
   moved here so it can't drift or get skipped (that omission is what
   left buyer_set_detail/buyer_set_membership_form unstyled). A
   page-local rule still wins by source order if a page needs to
   override something (e.g. sequence_form's wider .form-area). */
.page-header {
  padding: 1.5rem 2rem 1.25rem;
  border-bottom: 1px solid var(--c-border);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--c-subtle);
  margin-bottom: 0.75rem;
}
.breadcrumb a { color: var(--c-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-ink); }
.breadcrumb i { font-size: 0.8125rem; }

.page-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title__sub {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--c-subtle);
  font-family: var(--font-data);
  margin-top: 0.25rem;
}

.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.meta-strip { display: flex; gap: 1.5rem; padding: 0.75rem 0; flex-wrap: wrap; }
.meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--c-subtle);
  font-family: var(--font-data);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.meta-item i { font-size: 0.8125rem; }

/* ── Form area ──────────────────────────────────────────────
   640px is the shared default; pages with wider content
   (sequence_form, sequence_step_form) override locally. */
.form-area {
  padding: 2rem;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Toggle switch ──────────────────────────────────────────── */
.toggle-row { display: grid; grid-template-columns: 9rem 1fr; align-items: center; gap: 0.75rem; min-height: 2.25rem; }
.toggle-row label { font-size: 0.875rem; color: var(--c-muted); line-height: 1.4; }
.toggle-row label span { display: block; font-size: 0.8125rem; color: var(--c-subtle); margin-top: 0.15rem; }
.toggle-control { display: flex; align-items: center; gap: 0.6rem; }
.switch { position: relative; display: inline-block; width: 2.5rem; height: 1.375rem; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track { position: absolute; cursor: pointer; inset: 0; background: var(--c-border); border-radius: 1.375rem; transition: background 180ms; }
.switch__track::before { content: ""; position: absolute; height: 1rem; width: 1rem; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 180ms; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch input:checked + .switch__track { background: var(--c-teal); }
.switch input:checked + .switch__track::before { transform: translateX(1.125rem); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--c-focus); outline-offset: 2px; border-radius: 1.375rem; }
.switch__label { font-size: 0.875rem; color: var(--c-muted); user-select: none; }

@media (prefers-reduced-motion: reduce) { .switch__track, .switch__track::before { transition: none; } }

@media (max-width: 680px) {
  .form-area { padding: 1rem; }
  .form-row, .toggle-row { grid-template-columns: 1fr; }
  .form-row label, .toggle-row label { padding-top: 0; }
}

/* ── Shared form primitives ──────────────────────────────────
   Historically each form page (company_form.html, user_form.html)
   duplicated these in its own <style> block. Kept here too, as the
   canonical shared copy, for any page that doesn't carry its own
   (login, no_access, partner dashboard/payouts) — a page-local block
   still wins by source order where one exists, so nothing above
   changes visually. */
.form-section__title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-subtle);
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--c-border);
}

.form-rows { display: flex; flex-direction: column; gap: 0.875rem; }

.form-row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  align-items: start;
  gap: 0.75rem;
}
.form-row label { font-size: 0.875rem; color: var(--c-muted); padding-top: 0.45rem; line-height: 1.4; }
.form-row label span { display: block; font-size: 0.8125rem; color: var(--c-subtle); margin-top: 0.15rem; }

.field-wrap { display: flex; flex-direction: column; }

.form-input, .form-select {
  height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-ui);
  color: var(--c-ink);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 5px;
  outline: none;
  width: 100%;
  transition: border-color 150ms, box-shadow 150ms;
}
.form-input:focus, .form-select:focus {
  border-color: var(--c-teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-teal) 15%, transparent);
}
.form-input--error, .form-select--error { border-color: var(--c-unsold); }
.form-input--error:focus, .form-select--error:focus { border-color: var(--c-unsold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-unsold) 15%, transparent); }
.form-input[type="password"] { font-family: var(--font-data); letter-spacing: 0.1em; }

/* Native <select> chrome (white box, black text, OS arrow) ignores the
   theme otherwise — appearance:none strips it, then a hand-drawn chevron
   (color baked into the SVG per-theme, since data-URIs can't read CSS
   vars) replaces the native one. */
.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.25rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23adadad' d='M4 6l4 4 4-4H4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75rem;
}
:root[data-theme="light"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23555555' d='M4 6l4 4 4-4H4z'/%3E%3C/svg%3E");
}
.form-select option { background: var(--c-surface); color: var(--c-ink); }

.form-textarea {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-ui);
  color: var(--c-ink);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 5px;
  outline: none;
  width: 100%;
  min-height: 5rem;
  resize: vertical;
  line-height: 1.5;
  transition: border-color 150ms, box-shadow 150ms;
}
.form-textarea:focus { border-color: var(--c-teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-teal) 15%, transparent); }
.form-textarea--error { border-color: var(--c-unsold); }

.field-error { font-size: 0.8125rem; color: var(--c-unsold); margin-top: 0.35rem; }

.form-divider { height: 1px; background: var(--c-border); margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.25rem;
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-ui);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 100ms;
  white-space: nowrap;
}
.btn--primary { background: var(--c-teal-btn); color: #fff; }
.btn--primary:hover { opacity: 0.88; }
.btn--ghost { background: transparent; color: var(--c-muted); border: 1px solid var(--c-border); }
.btn--ghost:hover { color: var(--c-ink); border-color: var(--c-muted); background: var(--c-row-hover); }
.btn--danger { background: var(--c-unsold); color: #fff; }
.btn--danger:hover { opacity: 0.88; }

.flash {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  border-radius: 5px;
  font-size: 0.875rem;
  font-weight: 500;
}
.flash--success { background: color-mix(in srgb, var(--c-sold) 15%, transparent); color: var(--c-sold); border: 1px solid color-mix(in srgb, var(--c-sold) 30%, transparent); }
.flash--error   { background: color-mix(in srgb, var(--c-unsold) 12%, transparent); color: var(--c-unsold); border: 1px solid color-mix(in srgb, var(--c-unsold) 30%, transparent); }
.flash code { word-break: break-all; }

.stripe-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.125rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  flex-wrap: wrap;
}
.stripe-panel__info { display: flex; flex-direction: column; gap: 0.25rem; }
.stripe-panel__status { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; font-weight: 600; }
.stripe-panel__status--connected { color: var(--c-sold); }
.stripe-panel__status--unlinked  { color: var(--c-muted); }
.stripe-panel__id { font-family: var(--font-data); font-size: 0.8125rem; color: var(--c-subtle); }
.stripe-panel__actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.stripe-dash-link { font-size: 0.8125rem; color: var(--c-muted); text-decoration: none; }
.stripe-dash-link:hover { color: var(--c-ink); }
