/* Coast design system — flat, professional, light mode.
   Brand colors are CSS variables (PLACEHOLDER palette) so the whole product
   can be re-themed from this one block. */

:root {
  /* Brand */
  --brand:        #1D9E75;   /* teal accent */
  --brand-ink:    #15795a;   /* darker teal for hover/active text */
  --brand-soft:   #e7f5ef;   /* tinted surface for active nav / chips */

  /* Neutrals (slate / navy) */
  --ink:          #1c2430;   /* primary text */
  --ink-2:        #44505f;   /* secondary text */
  --muted:        #76828f;   /* tertiary / labels */
  --line:         #e6e9ee;   /* borders / dividers */
  --line-strong:  #d4d9e0;

  /* Surfaces */
  --bg:           #f5f7f9;   /* app canvas */
  --surface:      #ffffff;   /* cards, sidebar, topbar */
  --surface-2:    #fafbfc;   /* subtle inset */

  /* Status */
  --success:      #1d9e75;
  --success-soft: #e7f5ef;
  --info:         #2563eb;
  --info-soft:    #e8effe;
  --danger:       #d64545;
  --danger-soft:  #fbeaea;
  --warn:         #b7791f;
  --warn-soft:    #fbf2e2;

  /* Spacing scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* Radius */
  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-pill: 999px;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
          sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --fs-xs: 12px; --fs-sm: 13px; --fs: 14px; --fs-md: 16px;
  --fs-lg: 20px; --fs-xl: 26px; --fs-2xl: 32px;

  /* Layered elevation — soft, Apple-like. --shadow stays the resting default. */
  --shadow: 0 1px 2px rgba(28, 36, 48, .05), 0 1px 1px rgba(28, 36, 48, .03);
  --shadow-md: 0 2px 4px rgba(28, 36, 48, .05), 0 8px 24px rgba(28, 36, 48, .08);
  --shadow-lg: 0 4px 12px rgba(28, 36, 48, .08), 0 24px 64px rgba(28, 36, 48, .16);
  --sidebar-w: 248px;

  /* Motion + focus (one voice everywhere). */
  --dur: .18s;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --ring: 0 0 0 3px var(--brand-soft), 0 0 0 1.5px var(--brand);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 650; color: var(--ink); }

/* ----------------------------------------------------------------- layout */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  padding: var(--s-5);
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

/* ----------------------------------------------------------------- brand */
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-4);
  border-bottom: 1px solid var(--line);
}
.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: var(--r);
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  flex: 0 0 auto;
}
.brand__word {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
}

/* ----------------------------------------------------------------- nav */
.nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--s-3) var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 9px var(--s-3);
  border-radius: var(--r);
  color: var(--ink-2);
  font-weight: 550;
  font-size: var(--fs);
  cursor: pointer;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 650;
}
.nav-item .ti {
  font-size: 19px;
  flex: 0 0 auto;
  opacity: .9;
}

/* user footer */
.nav-user {
  border-top: 1px solid var(--line);
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.nav-user__avatar {
  width: 30px; height: 30px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-ink);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: var(--fs-sm);
  flex: 0 0 auto;
}
.nav-user__email {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}
.nav-user__logout {
  flex: 0 0 auto;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-md, 8px);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}
.nav-user__logout:hover {
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-color: var(--brand-soft);
}
.nav-user__logout:disabled { opacity: .6; cursor: default; }
.sidebar--admin .nav-user__logout {
  border-color: rgba(255, 255, 255, .18);
  color: rgba(255, 255, 255, .72);
}

/* ------------------------------------------------- impersonation banner */
/* Persistent, unmissable strip shown while an operator views as a customer.
   Read-only is enforced server-side; this just makes the state obvious + gives an
   exit. High-contrast amber so it can't be mistaken for the normal chrome. */
.imp-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  background: #b45309;            /* amber-700 */
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.imp-banner__text {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.imp-banner__text strong { font-weight: 700; }
.imp-banner__stop {
  flex: 0 0 auto;
  background: #fff;
  color: #b45309;
  border: 0;
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.imp-banner__stop:hover { background: #fde68a; }
.imp-banner__stop:disabled { opacity: .6; cursor: default; }

/* ----------------------------------------------------------------- topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-height: 64px;
}
.topbar__title {
  flex: 1 1 auto;
  min-width: 0;
}
.topbar__title h1 {
  font-size: var(--fs-lg);
  letter-spacing: -.01em;
}
.topbar__title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: 0 0 auto;
}

/* hamburger — hidden on wide screens */
.hamburger {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  width: 38px; height: 38px;
  font-size: 20px;
  color: var(--ink-2);
  cursor: pointer;
}

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: inherit;
  font-size: var(--fs);
  font-weight: 600;
  line-height: 1;
  padding: 9px 15px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ti { font-size: 17px; }

.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-ink); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { filter: brightness(.94); }

.btn-sm { padding: 6px 11px; font-size: var(--fs-sm); }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow);
}
.card__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.card__head h2 {
  font-size: var(--fs-md);
  font-weight: 650;
  flex: 1 1 auto;
}
.card__head .card__action { flex: 0 0 auto; }

.section-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  color: var(--muted);
}

/* grids */
.grid { display: grid; gap: var(--s-4); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* metric card */
.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  box-shadow: var(--shadow);
}
.metric-card__label {
  font-size: var(--fs-sm);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.metric-card__label .ti { font-size: 17px; }
.metric-card__value {
  margin-top: var(--s-2);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
}
.metric-card__sub {
  margin-top: var(--s-1);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* ----------------------------------------------------------------- badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-xs);
  font-weight: 650;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.badge-success { background: var(--success-soft); color: var(--brand-ink); border-color: transparent; }
.badge-info    { background: var(--info-soft);    color: var(--info);      border-color: transparent; }
.badge-neutral { background: var(--surface-2);    color: var(--muted);     border-color: var(--line); }
.badge-warn    { background: var(--warn-soft);    color: var(--warn);      border-color: transparent; }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);    border-color: transparent; }

/* ----------------------------------------------------------------- forms */
label.field { display: block; margin-bottom: var(--s-4); }
.field__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: var(--s-2);
}
.input, .select, .textarea {
  width: 100%;
  font-family: inherit;
  font-size: var(--fs);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 9px 12px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.textarea { min-height: 110px; resize: vertical; }

/* ----------------------------------------------------------------- misc */
.row { display: flex; align-items: center; gap: var(--s-3); }
.spacer { flex: 1 1 auto; }
.muted { color: var(--muted); }
.list-reset { list-style: none; margin: 0; padding: 0; }

.data-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--line);
}
.data-row:first-child { border-top: none; }
.data-row__name { font-weight: 600; }
.data-row__value { margin-left: auto; font-variant-numeric: tabular-nums; }

/* setup progress */
.progress {
  height: 8px;
  background: var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-pill);
}
.checklist { list-style: none; margin: var(--s-4) 0 0; padding: 0; }
.checklist li {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  font-size: var(--fs);
}
.checklist .ti { font-size: 19px; flex: 0 0 auto; }
.checklist .done { color: var(--brand); }
.checklist .todo { color: var(--muted); }

/* ---- WS12-T3: guided first-run onboarding ---- */
/* welcome panel (brand-new org) */
.setup-welcome {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--s-6);
  align-items: center;
  background: linear-gradient(180deg, var(--brand-soft), var(--surface) 70%);
  border-color: var(--brand-soft);
}
.setup-welcome__intro h2 {
  margin: var(--s-3) 0 var(--s-2);
  font-size: var(--fs-lg);
  letter-spacing: -.01em;
}
.setup-welcome__intro p { margin: 0 0 var(--s-4); font-size: var(--fs); }

/* ordered step list (welcome + compact share .setup-step) */
.setup-steps { list-style: none; margin: 0; padding: 0; }
.setup-step {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3);
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
}
.setup-step + .setup-step { margin-top: var(--s-2); }
.setup-step__num {
  width: 24px; height: 24px;
  flex: 0 0 auto;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--muted);
  display: grid; place-items: center;
  font-size: var(--fs-xs);
  font-weight: 700;
}
.setup-step__icon { font-size: 19px; flex: 0 0 auto; }
.setup-step__icon.done { color: var(--brand); }
.setup-step__icon.todo { color: var(--muted); }
.setup-step__label { flex: 1 1 auto; font-weight: 550; }
.setup-step .btn { flex: 0 0 auto; }
.setup-step.is-next {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.setup-step.is-next .setup-step__num {
  background: var(--brand); color: #fff;
}
.setup-step.is-done .setup-step__label { color: var(--ink-2); }
.setup-steps--compact .setup-step { border: none; padding: var(--s-2) 0; border-radius: 0; }
.setup-steps--compact { margin-top: var(--s-4); }
.setup-steps--compact .setup-step.is-next {
  box-shadow: none;
  border: 1px solid var(--brand);
  border-radius: var(--r);
  padding: var(--s-2) var(--s-3);
}

/* complete → small confirmation */
.setup-done {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
}
.setup-done .ti { font-size: 24px; color: var(--brand); flex: 0 0 auto; }
.setup-done strong { margin-right: var(--s-2); }

@media (max-width: 860px) {
  .setup-welcome { grid-template-columns: 1fr; gap: var(--s-4); }
  .setup-step { flex-wrap: wrap; }
}

/* empty state */
.empty-state {
  text-align: center;
  padding: var(--s-6) var(--s-4);
  color: var(--muted);
}
.empty-state .ti { font-size: 34px; color: var(--line-strong); }
.empty-state h3 { margin: var(--s-3) 0 var(--s-1); color: var(--ink-2); font-size: var(--fs-md); }
.empty-state p { margin: 0; font-size: var(--fs-sm); }

.stack > * + * { margin-top: var(--s-4); }

/* ----------------------------------------------------------------- responsive */
/* sidebar backdrop (mobile drawer) */
.sidebar__backdrop { display: none; }

@media (max-width: 860px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }

  .hamburger { display: inline-grid; place-items: center; }

  .sidebar {
    position: fixed;
    z-index: 40;
    left: 0; top: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 40px rgba(28, 36, 48, .18);
  }
  .sidebar.is-open { transform: translateX(0); }

  .sidebar__backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(28, 36, 48, .35);
    z-index: 35;
  }
}

/* ---- WS12-T2: two-factor enrollment (scannable QR + recovery codes) ---- */
.mfa-enroll {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-4);
  align-items: start;
  margin-top: var(--s-3);
}
.qr {
  display: grid;
  place-items: center;
  width: 188px;
  height: 188px;
  padding: var(--s-3);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.qr svg, .qr img { display: block; width: 160px; height: 160px; }
.mfa-manual { min-width: 0; }
.mfa-key {
  display: inline-block;
  margin-top: var(--s-1);
  padding: 6px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
  letter-spacing: .04em;
  word-break: break-all;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px var(--s-4);
  margin: var(--s-3) 0;
  padding: var(--s-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.recovery-codes li { list-style: none; letter-spacing: .04em; }
@media (max-width: 860px) {
  .mfa-enroll { grid-template-columns: 1fr; }
}

/* ---- WS13-T1: operator console shell (visibly distinct from the tenant app) ---- */
.sidebar--admin { background: var(--brand-ink, #1c2430); }
.sidebar--admin .brand { border-bottom-color: rgba(255, 255, 255, .12); }
.sidebar--admin .brand__word { color: #fff; }
.sidebar--admin .nav-item { color: rgba(255, 255, 255, .72); }
.sidebar--admin .nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar--admin .nav-item.active { background: rgba(255, 255, 255, .14); color: #fff; }
.sidebar--admin .nav-user { border-top-color: rgba(255, 255, 255, .12); }
.sidebar--admin .nav-user__email { color: rgba(255, 255, 255, .72); }
.brand__mark--admin { background: var(--danger, #c2410c); }
.brand__badge { margin-left: auto; text-transform: uppercase; letter-spacing: .06em; }

/* ---- WS13-T2: admin organizations list (search / filter / sortable table) ---- */
.org-controls {
  display: flex;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.org-controls__search {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}
.org-controls__search .ti {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 17px;
  pointer-events: none;
}
.org-controls__search .input { padding-left: 34px; }
.org-controls .select { flex: 0 0 auto; width: auto; min-width: 150px; }

.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.table th, .table td {
  text-align: left;
  padding: var(--s-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th {
  font-weight: 600;
  color: var(--muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.table th.num, .table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table th .ti { font-size: 14px; opacity: .5; vertical-align: middle; }
.table th.is-sortable { cursor: pointer; user-select: none; }
.table th.is-sortable:hover { color: var(--ink-2); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.org-row__name { font-weight: 600; color: var(--ink); }
.org-row__name:hover { color: var(--brand-ink); }

/* ----------------------------------------------------- org detail page */
.detail-head__main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-head__main h2 { margin: 0; }
.detail-head__badges { display: flex; gap: 8px; }
.detail-head__meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.detail-head__meta .ti { vertical-align: middle; margin-right: 4px; }

/* tabs — CSS/JS toggled, eval-free */
.tabs__nav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 10px 14px; font: inherit; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--brand-ink); border-bottom-color: var(--brand-ink); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* key/value list (billing) */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* =================================================================== */
/* Refinement layer — Apple-caliber polish. Appended last so it wins   */
/* the cascade at equal specificity. Motion respects reduced-motion.   */
/* =================================================================== */

/* -- global voice ---------------------------------------------------- */
body { text-rendering: optimizeLegibility; }
h1, h2 { letter-spacing: -.02em; font-weight: 700; }
h3 { letter-spacing: -.01em; }
::selection { background: var(--brand-soft); color: var(--brand-ink); }

/* Focus is visible, calm, and identical everywhere. */
.btn:focus-visible, .input:focus-visible, .nav-item:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* Slim, unobtrusive scrollbars. */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

/* -- buttons: lift on hover, settle on press ------------------------- */
.btn {
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active:not(:disabled) { transform: translateY(0); box-shadow: var(--shadow); transition-duration: .06s; }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), var(--shadow);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--brand), var(--brand-ink)); }

/* -- cards: quiet at rest, alive when interactive --------------------- */
.card, .metric-card { transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
a.card:hover, a.metric-card:hover, .msg-row:hover { box-shadow: var(--shadow-md); }
.metric-card__value { font-variant-numeric: tabular-nums; }

/* -- sidebar: an indicator that glides ------------------------------- */
.nav-item {
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  height: 0; width: 3px;
  border-radius: 999px;
  background: var(--brand);
  transform: translateY(-50%);
  transition: height var(--dur) var(--ease);
}
.nav-item.active::before { height: 60%; }
.nav-item .ti { transition: transform var(--dur) var(--ease); }
.nav-item:hover .ti { transform: translateX(1px); }

/* -- topbar: translucent, stays with you ------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
}

/* -- inputs: soft settle into focus ----------------------------------- */
.input, input[type="text"], input[type="email"], input[type="number"],
select, textarea {
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease);
}

/* -- delivery toggles become real switches ---------------------------- */
input.dtoggle {
  appearance: none;
  -webkit-appearance: none;
  width: 40px; height: 24px;
  border-radius: 999px;
  background: var(--line-strong);
  border: none;
  position: relative;
  cursor: pointer;
  vertical-align: middle;
  transition: background var(--dur) var(--ease);
  flex: 0 0 auto;
}
input.dtoggle::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(28, 36, 48, .25);
  transition: transform var(--dur) var(--ease);
}
input.dtoggle:checked { background: var(--brand); }
input.dtoggle:checked::after { transform: translateX(16px); }
input.dtoggle:focus-visible { box-shadow: var(--ring); outline: none; }

/* -- modals: scrim blur + gentle entrance ------------------------------ */
.modal-back {
  background: rgba(16, 24, 40, .40);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.modal-back:not([hidden]) .modal { animation: coast-modal-in .22s var(--ease) both; }
.modal { box-shadow: var(--shadow-lg); }
@keyframes coast-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* -- page entrance: barely-there, feels instant ------------------------ */
.content > * { animation: coast-rise .28s var(--ease) both; }
@keyframes coast-rise {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -- data rows / lists -------------------------------------------------- */
.data-row { transition: background var(--dur) var(--ease); border-radius: var(--r-sm); }
.data-row:hover { background: var(--surface-2); }

/* -- one switch to turn all motion off --------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
