/* ==========================================================================
   Dashboard shell — the coach's admin backend and the customer account area.

   Mobile first, as the brief asks: on a phone the navigation is an off-canvas
   drawer and every table collapses into stacked rows; from 1024px up the
   sidebar is permanent. Hand-written CSS (no build step) and self-contained,
   so the admin renders even if app.css is swapped out.
   ========================================================================== */

:root {
  --d-bg: #F4F5F6;
  --d-surface: #FFFFFF;
  --d-ink: #22262B;
  --d-ink-soft: #5B6269;
  --d-ink-faint: #8A9199;
  --d-line: #E2E5E8;
  --d-line-soft: #EFF1F3;
  --d-maroon: #480F28;
  --d-maroon-800: #3A0C20;
  --d-maroon-700: #6B1A33;
  --d-crimson: #D42725;
  --d-crimson-deep: #901A1D;
  --d-sidebar-w: 16.5rem;
  --d-radius: 14px;
  --d-shadow: 0 1px 2px rgba(24, 6, 14, .05), 0 10px 28px -16px rgba(24, 6, 14, .22);
  /* Metric-matched stand-ins (assets/css/fonts.css) keep text the same size
     before and after the webfonts swap in. */
  --d-display: "Barlow Condensed", "Barlow Condensed Fallback", "Arial Narrow", Arial, sans-serif;
  --d-sans: Inter, "Inter Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* --------------------------------------------------------------------------
   Page frame
   -------------------------------------------------------------------------- */

body.dash {
  margin: 0;
  background: var(--d-bg);
  color: var(--d-ink);
  font-family: var(--d-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.dash * { box-sizing: border-box; }

/* Base link styling, wrapped in :where() so it carries no specificity.
   A plain <a> inherits its colour and turns crimson on hover, but any
   component class — .d-btn-primary, .jc-btn-solid, .d-nav a — sets its own
   colour without having to out-specify a `body.dash a` selector. */
:where(body.dash a) { color: inherit; text-decoration: none; }
:where(body.dash a:hover) { color: var(--d-crimson); }

/* Inline icons.
   The dashboard is a self-contained shell and deliberately does NOT load
   app.css, but icon() emits Tailwind sizing classes. An <svg> with no width
   stretches to fill its container — which is how a 16px bell becomes 900px
   tall.

   :where() is deliberate: it contributes no specificity, so this is a true
   fallback. A .h-10 utility, or a component rule like .d-empty svg, wins
   over it without needing !important or a specificity arms race. */
:where(body.dash svg) {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

/* Headings, also specificity-free so a panel can recolour its own heading —
   the greeting banner needs white text on maroon, for instance. */
:where(body.dash h1, body.dash h2, body.dash h3, body.dash h4) {
  margin: 0;
  font-family: var(--d-display);
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--d-maroon);
}
:where(body.dash h1) { font-size: 1.65rem; }
:where(body.dash h2) { font-size: 1.25rem; }
:where(body.dash h3) { font-size: 1.05rem; }

body.dash :focus-visible {
  outline: 3px solid var(--d-crimson);
  outline-offset: 2px;
  border-radius: 3px;
}

.d-skip {
  position: absolute;
  left: -9999px;
}
.d-skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 300;
  padding: .6rem 1rem;
  background: var(--d-maroon);
  color: #fff;
  border-radius: 8px;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.d-sidebar {
  position: fixed;
  z-index: 90;
  inset: 0 auto 0 0;
  width: var(--d-sidebar-w);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--d-maroon) 0%, var(--d-maroon-800) 100%);
  color: #fff;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.22, 1, .36, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.d-sidebar.is-open { transform: none; }

.d-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.d-sidebar-head img { height: 2.4rem; width: auto; }
.d-sidebar-close {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
}

/* The identity card. It is an <a> in the admin shell (the way in to your own
   details and password) and a plain <div> in the coach shell, so the styling
   has to read the same either way — hence the explicit display and colour. */
.d-sidebar-who {
  display: block;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  font-size: .85rem;
  color: rgba(255, 255, 255, .72);
  overflow-wrap: anywhere;
}
.d-sidebar-who strong { display: block; color: #fff; font-size: .95rem; }
a.d-sidebar-who { transition: background .15s ease; }
a.d-sidebar-who:hover,
a.d-sidebar-who[aria-current="page"] { background: rgba(255, 255, 255, .07); color: rgba(255, 255, 255, .85); }
a.d-sidebar-who:hover strong { color: #fff; }

.d-nav { padding: .75rem .6rem 1.5rem; }
.d-nav-label {
  padding: .9rem .55rem .35rem;
  font-family: var(--d-display);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .42);
}
.d-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .55rem;
  border-radius: 9px;
  color: rgba(255, 255, 255, .82);
  font-size: .925rem;
  transition: background .18s, color .18s;
}
.d-nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.d-nav a[aria-current="page"] {
  background: linear-gradient(135deg, var(--d-crimson), var(--d-crimson-deep));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(144, 26, 29, .9);
}
.d-nav a svg { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; }
.d-nav-count {
  margin-left: auto;
  padding: 0 .4rem;
  min-width: 1.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
}
.d-nav a[aria-current="page"] .d-nav-count { background: rgba(0, 0, 0, .25); }

.d-scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(24, 6, 14, .55);
  backdrop-filter: blur(2px);
}

/* --------------------------------------------------------------------------
   Topbar + main column
   -------------------------------------------------------------------------- */

/* min-width:0 stops a wide child (a long table, a pre) from pushing the whole
   column past the viewport and giving the page a horizontal scrollbar. Wide
   content scrolls inside .d-table-wrap instead. */
.d-main {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.d-topbar {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem .9rem;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--d-line);
}
.d-burger {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border: 0;
  border-radius: 9px;
  background: var(--d-maroon);
  color: #fff;
  cursor: pointer;
}
.d-topbar-title {
  flex: 1 1 auto;
  min-width: 0;
}
.d-topbar-title strong {
  display: block;
  font-family: var(--d-display);
  font-size: 1.15rem;
  text-transform: uppercase;
  color: var(--d-maroon);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.d-topbar-title span { font-size: .78rem; color: var(--d-ink-faint); }

.d-topbar-actions { display: flex; align-items: center; gap: .4rem; }
.d-icon-btn {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--d-line);
  border-radius: 9px;
  background: #fff;
  color: var(--d-maroon);
  cursor: pointer;
  position: relative;
}
.d-icon-btn:hover { border-color: var(--d-crimson); color: var(--d-crimson); }
.d-icon-btn .d-dot {
  position: absolute;
  top: -.25rem;
  right: -.25rem;
  min-width: 1.05rem;
  padding: 0 .25rem;
  border-radius: 999px;
  background: var(--d-crimson);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.05rem;
}

.d-content { flex: 1 1 auto; padding: 1rem .9rem 3rem; }

.d-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1.1rem;
}
.d-page-head p { margin: .25rem 0 0; font-size: .9rem; color: var(--d-ink-soft); }

@media (min-width: 1024px) {
  .d-sidebar { transform: none; }
  .d-sidebar-close, .d-burger, .d-scrim { display: none; }
  .d-main { margin-left: var(--d-sidebar-w); }
  .d-topbar { padding: .85rem 1.5rem; }
  .d-content { padding: 1.5rem 1.5rem 4rem; }
}

/* --------------------------------------------------------------------------
   Greeting banner (account home — "Welcome Coach Jerry" + live clock)
   -------------------------------------------------------------------------- */

.d-greet {
  position: relative;
  overflow: hidden;
  padding: 1.25rem;
  border-radius: var(--d-radius);
  background: linear-gradient(135deg, var(--d-maroon) 0%, var(--d-crimson-deep) 100%);
  color: #fff;
}
.d-greet::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 42px);
  pointer-events: none;
}
.d-greet h1 { color: #fff; font-size: 1.7rem; }
.d-greet-when {
  position: relative;
  margin-top: .4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .9rem;
  font-size: .9rem;
  color: rgba(255, 255, 255, .85);
}
.d-greet-clock {
  font-family: var(--d-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
@media (min-width: 640px) {
  .d-greet { padding: 1.6rem 1.75rem; }
  .d-greet h1 { font-size: 2rem; }
}

/* --------------------------------------------------------------------------
   Stat tiles
   -------------------------------------------------------------------------- */

.d-stats {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
}
.d-stat {
  padding: .9rem 1rem;
  background: var(--d-surface);
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  box-shadow: var(--d-shadow);
}
.d-stat-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--d-display);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--d-ink-faint);
}
.d-stat-value {
  margin-top: .3rem;
  font-family: var(--d-display);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--d-maroon);
  font-variant-numeric: tabular-nums;
}
.d-stat-note { font-size: .8rem; color: var(--d-ink-soft); }
.d-stat-note.is-up { color: #047857; }
.d-stat-note.is-down { color: #B01B1A; }

/* --------------------------------------------------------------------------
   Cards / panels
   -------------------------------------------------------------------------- */

.d-card {
  background: var(--d-surface);
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  box-shadow: var(--d-shadow);
}
.d-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--d-line);
}
.d-card-body { padding: 1.1rem; }
.d-card-foot {
  padding: .8rem 1.1rem;
  border-top: 1px solid var(--d-line);
  background: #FBFBFC;
  border-radius: 0 0 var(--d-radius) var(--d-radius);
}

/* align-content:start keeps each card at its natural height. Without it the
   rows of the shorter column stretch to match the taller one, which leaves a
   half-empty chart card several hundred pixels tall. */
.d-grid {
  display: grid;
  gap: 1rem;
  align-content: start;
}
.d-grid-2 { grid-template-columns: 1fr; }
.d-grid-3 { grid-template-columns: 1fr; }
.d-grid-sidebar { grid-template-columns: 1fr; }
@media (min-width: 768px)  { .d-grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) {
  .d-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .d-grid-sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

/* --------------------------------------------------------------------------
   Tables — real table on desktop, stacked cards on a phone
   -------------------------------------------------------------------------- */

.d-table-wrap { width: 100%; overflow-x: auto; }

.d-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.d-table th {
  padding: .6rem .75rem;
  text-align: left;
  font-family: var(--d-display);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--d-ink-faint);
  border-bottom: 1px solid var(--d-line);
  white-space: nowrap;
}
.d-table td {
  padding: .7rem .75rem;
  border-bottom: 1px solid var(--d-line-soft);
  vertical-align: middle;
}
.d-table tbody tr:last-child td { border-bottom: 0; }
.d-table tbody tr:hover { background: #FBFAFB; }
.d-table .d-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 719px) {
  .d-table.d-stack thead { display: none; }
  .d-table.d-stack tbody tr {
    display: block;
    padding: .75rem 0;
    border-bottom: 1px solid var(--d-line);
  }
  .d-table.d-stack tbody tr:hover { background: transparent; }
  .d-table.d-stack td {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    justify-content: space-between;
    padding: .2rem 0;
    border: 0;
    text-align: left;
  }
  .d-table.d-stack td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-family: var(--d-display);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--d-ink-faint);
  }
  .d-table.d-stack td.d-num { text-align: right; }
  .d-table.d-stack td[data-label=""]::before { content: none; }
}

.d-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--d-ink-soft);
}
.d-empty svg { color: var(--d-line); width: 2.5rem; height: 2.5rem; }
.d-empty p { margin: .6rem 0 0; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.d-field { display: block; margin-bottom: 1rem; }
.d-field > label,
.d-label {
  display: block;
  margin-bottom: .3rem;
  font-family: var(--d-display);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--d-maroon-700);
}
.d-input,
.d-field input[type="text"],
.d-field input[type="email"],
.d-field input[type="password"],
.d-field input[type="number"],
.d-field input[type="date"],
.d-field input[type="tel"],
.d-field input[type="url"],
.d-field input[type="search"],
.d-field select,
.d-field textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--d-line);
  border-radius: 9px;
  background: #fff;
  font: inherit;
  color: var(--d-ink);
  transition: border-color .18s, box-shadow .18s;
}
.d-input:focus,
.d-field input:focus,
.d-field select:focus,
.d-field textarea:focus {
  outline: none;
  border-color: var(--d-crimson);
  box-shadow: 0 0 0 4px rgba(212, 39, 37, .15);
}
.d-field textarea { min-height: 7rem; resize: vertical; }
.d-hint { margin: .3rem 0 0; font-size: .8rem; color: var(--d-ink-faint); }
.d-error { margin: .3rem 0 0; font-size: .82rem; font-weight: 600; color: #B01B1A; }
.d-field-row { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .d-field-row-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .d-field-row-3 { grid-template-columns: repeat(3, 1fr); } }

.d-check {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .55rem 0;
  font-size: .92rem;
  cursor: pointer;
}
.d-check input {
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: .15rem;
  accent-color: var(--d-crimson);
}
.d-check span small { display: block; color: var(--d-ink-faint); }

/* Toggle switch for on/off settings */
.d-switch { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; cursor: pointer; }
.d-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.d-switch-track {
  flex: 0 0 auto;
  position: relative;
  width: 2.75rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--d-line);
  transition: background .2s;
}
.d-switch-track::after {
  content: "";
  position: absolute;
  top: .2rem;
  left: .2rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .2s;
}
.d-switch input:checked + .d-switch-track { background: #047857; }
.d-switch input:checked + .d-switch-track::after { transform: translateX(1.15rem); }
.d-switch input:focus-visible + .d-switch-track { outline: 3px solid var(--d-crimson); outline-offset: 2px; }
.d-switch-text { font-size: .92rem; }
.d-switch-text small { display: block; color: var(--d-ink-faint); }

/* --------------------------------------------------------------------------
   Buttons (dashboard variants)
   -------------------------------------------------------------------------- */

.d-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1rem;
  border: 1px solid transparent;
  border-radius: 9px;
  font-family: var(--d-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .18s, background .18s, color .18s, border-color .18s;
}
.d-btn:hover { transform: translateY(-1px); }
.d-btn-primary {
  background: linear-gradient(135deg, var(--d-crimson), var(--d-crimson-deep));
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(144, 26, 29, .8);
}
.d-btn-primary:hover { color: #fff; }
.d-btn-dark { background: var(--d-maroon); color: #fff; }
.d-btn-dark:hover { color: #fff; background: var(--d-maroon-700); }
.d-btn-ghost { background: #fff; border-color: var(--d-line); color: var(--d-maroon); }
.d-btn-ghost:hover { border-color: var(--d-crimson); color: var(--d-crimson); }
.d-btn-danger { background: #fff; border-color: #F2C3C2; color: #B01B1A; }
.d-btn-danger:hover { background: #B01B1A; color: #fff; border-color: #B01B1A; }
.d-btn-sm { padding: .35rem .7rem; font-size: .875rem; border-radius: 7px; }
.d-btn-block { width: 100%; }
.d-btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.d-btn svg { width: 1rem; height: 1rem; }

.d-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Row actions sit in a narrow last column, so they must stay on one line
   rather than wrapping the icon buttons underneath each other. */
.d-table .d-actions { flex-wrap: nowrap; gap: .3rem; }
.d-table .d-actions form { display: contents; }

/* --------------------------------------------------------------------------
   Tabs (settings)
   -------------------------------------------------------------------------- */

.d-tabs {
  display: flex;
  gap: .3rem;
  padding-bottom: .2rem;
  margin-bottom: 1.1rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--d-line);
}
.d-tabs::-webkit-scrollbar { display: none; }
.d-tab {
  flex: 0 0 auto;
  padding: .55rem .9rem;
  border-radius: 9px 9px 0 0;
  font-family: var(--d-display);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--d-ink-soft);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.d-tab:hover { color: var(--d-crimson); }
.d-tab[aria-current="page"] {
  color: var(--d-maroon);
  background: #fff;
  border-bottom-color: var(--d-crimson);
}

/* --------------------------------------------------------------------------
   Gateway connection cards (Stripe / PayPal)
   -------------------------------------------------------------------------- */

.gw-card {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: 1.1rem;
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  background: var(--d-surface);
  box-shadow: var(--d-shadow);
}
.gw-head { display: flex; align-items: center; gap: .75rem; }
.gw-logo {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  flex: 0 0 auto;
  border-radius: 11px;
  background: #F4F5F7;
  color: var(--d-maroon);
}
.gw-head-text { flex: 1 1 auto; min-width: 0; }
.gw-head-text strong { display: block; font-family: var(--d-display); font-size: 1.2rem; text-transform: uppercase; color: var(--d-maroon); }
.gw-head-text span { font-size: .82rem; color: var(--d-ink-faint); }

.gw-state {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  padding: .7rem .85rem;
  border-radius: 11px;
  background: #F8F9FA;
  border: 1px solid var(--d-line-soft);
  font-size: .85rem;
}
.gw-state-ok   { background: #ECFDF5; border-color: #A7F3D0; }
.gw-state-warn { background: #FFFBEB; border-color: #FDE68A; }
.gw-state-off  { background: #F4F5F6; }
.gw-state dl { margin: 0; display: grid; gap: .15rem .6rem; grid-template-columns: auto 1fr; width: 100%; }
.gw-state dt { font-weight: 600; color: var(--d-ink-soft); }
.gw-state dd { margin: 0; color: var(--d-ink); overflow-wrap: anywhere; }

.gw-steps { margin: 0; padding-left: 1.2rem; font-size: .85rem; color: var(--d-ink-soft); }
.gw-steps li { margin-bottom: .3rem; }
.gw-steps code {
  padding: .1rem .3rem;
  border-radius: 5px;
  background: #F1F2F4;
  font-size: .8rem;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Guided set-up — one numbered card per step (the PayPal set-up page)
   -------------------------------------------------------------------------- */

.d-step-n {
  display: inline-grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-right: .45rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--d-maroon);
  color: #fff;
  font-family: var(--d-sans);
  font-size: .8rem;
  font-weight: 700;
  line-height: 1;
}
.d-step-done .d-step-n { background: #047857; }
.d-step-todo .d-step-n { background: var(--d-ink-faint); }

/* A value the coach has to copy somewhere else (a return or webhook URL). */
.d-copy { display: flex; gap: .4rem; margin: .35rem 0 0; }
.d-copy input {
  flex: 1 1 auto;
  min-width: 0;
  padding: .5rem .6rem;
  border: 1px solid var(--d-line);
  border-radius: 9px;
  background: #F8F9FA;
  color: var(--d-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
}
.d-copy button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .5rem .7rem;
  border: 1px solid var(--d-line);
  border-radius: 9px;
  background: #fff;
  color: var(--d-ink-soft);
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}
.d-copy button:hover { border-color: var(--d-crimson); color: var(--d-crimson); }

/* A short "what this area is for" note under a page heading. Used to keep the
   admin's own tools and a user's own records visibly separate. */
.d-scope-note {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  margin: 0 0 1rem;
  padding: .7rem .85rem;
  border: 1px solid var(--d-line);
  border-left: 3px solid var(--d-maroon-700);
  border-radius: 11px;
  background: var(--d-surface);
  font-size: .85rem;
  color: var(--d-ink-soft);
}
.d-scope-note strong { color: var(--d-maroon); }

/* --------------------------------------------------------------------------
   Mini bar chart (revenue) — plain CSS, no chart library
   -------------------------------------------------------------------------- */

.d-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 8rem;
  padding-top: .5rem;
}
.d-chart-bar {
  position: relative;
  flex: 1 1 0;
  min-width: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--d-crimson), var(--d-crimson-deep));
  opacity: .9;
  transition: opacity .15s;
}
.d-chart-bar:hover { opacity: 1; }
.d-chart-bar.is-zero { background: var(--d-line); min-height: 2px; }
.d-chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: .4rem;
  font-size: .72rem;
  color: var(--d-ink-faint);
}

/* --------------------------------------------------------------------------
   Login screens
   -------------------------------------------------------------------------- */

body.dash-auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(212, 39, 37, .25), transparent 60%),
    linear-gradient(160deg, var(--d-maroon) 0%, #2A0714 100%);
}
.d-auth-card {
  width: 100%;
  max-width: 26rem;
  padding: 1.6rem 1.4rem;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .7);
}
.d-auth-card img { height: 3rem; width: auto; margin: 0 auto .9rem; display: block; }
.d-auth-card h1 { text-align: center; font-size: 1.5rem; }
.d-auth-card .d-auth-sub {
  margin: .25rem 0 1.25rem;
  text-align: center;
  font-size: .88rem;
  color: var(--d-ink-soft);
}
.d-auth-foot {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--d-line);
  font-size: .85rem;
  text-align: center;
  color: var(--d-ink-soft);
}
.d-auth-foot a { color: var(--d-crimson); font-weight: 600; }

/* Password visibility toggle */
.d-pass { position: relative; }
.d-pass input { padding-right: 2.9rem; }
.d-pass button {
  position: absolute;
  top: 50%;
  right: .4rem;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--d-ink-faint);
  cursor: pointer;
}
.d-pass button:hover { color: var(--d-crimson); }

/* --------------------------------------------------------------------------
   Library grid (My Library)
   -------------------------------------------------------------------------- */

.lib-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}
.lib-item {
  display: flex;
  flex-direction: column;
  background: var(--d-surface);
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  box-shadow: var(--d-shadow);
  overflow: hidden;
}
.lib-cover {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: var(--d-line-soft);
}
.lib-item-body { padding: .8rem; flex: 1 1 auto; display: flex; flex-direction: column; gap: .45rem; }
.lib-item-title {
  font-family: var(--d-display);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--d-maroon);
}
.lib-item-meta { font-size: .78rem; color: var(--d-ink-faint); }
.lib-item-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: .4rem; }

.lib-progress {
  height: .3rem;
  border-radius: 999px;
  background: var(--d-line);
  overflow: hidden;
}
.lib-progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--d-crimson), var(--d-crimson-deep));
}

/* --------------------------------------------------------------------------
   Timeline (activity / order history)
   -------------------------------------------------------------------------- */

.d-timeline { position: relative; margin: 0; padding: 0 0 0 1.4rem; list-style: none; }
.d-timeline::before {
  content: "";
  position: absolute;
  top: .4rem;
  bottom: .4rem;
  left: .35rem;
  width: 2px;
  background: var(--d-line);
}
.d-timeline li { position: relative; padding: 0 0 .95rem; font-size: .9rem; }
.d-timeline li::before {
  content: "";
  position: absolute;
  top: .4rem;
  left: -1.23rem;
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  background: var(--d-crimson);
  box-shadow: 0 0 0 3px #fff;
}
.d-timeline time { display: block; font-size: .76rem; color: var(--d-ink-faint); }

/* --------------------------------------------------------------------------
   Filter bar
   -------------------------------------------------------------------------- */

.d-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  padding: .85rem;
  background: var(--d-surface);
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
}
.d-filters .d-field { flex: 1 1 10rem; margin: 0; }
.d-filters .d-actions { flex: 0 0 auto; }

.d-pager { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: 1rem; }
.d-pager a, .d-pager span {
  display: grid;
  place-items: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 .5rem;
  border: 1px solid var(--d-line);
  border-radius: 8px;
  background: #fff;
  font-size: .875rem;
}
.d-pager a:hover { border-color: var(--d-crimson); color: var(--d-crimson); }
.d-pager [aria-current="page"] { background: var(--d-maroon); border-color: var(--d-maroon); color: #fff; font-weight: 700; }
.d-pager .is-disabled { opacity: .45; }

/* Reuse the shared pill vocabulary from extra.css inside the dashboard. */
.d-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-family: var(--d-display);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.d-pill-ok      { background: #ECFDF5; color: #047857; }
.d-pill-warn    { background: #FFFBEB; color: #B45309; }
.d-pill-info    { background: #EFF6FF; color: #1D4ED8; }
.d-pill-danger  { background: #FDF2F2; color: #B01B1A; }
.d-pill-neutral { background: #F1F2F3; color: #5B6269; }

/* --------------------------------------------------------------------------
   Utilities the dashboard markup uses

   A short, closed list — the dashboard does not load app.css, so every
   utility class under admin/ and account/ has to be defined here. Keep it
   small: reach for a semantic .d-* class before adding to this list.

   Last in the file so an explicit size always beats the svg default above
   (except inside .d-btn and .d-nav, which normalise their own icons on
   purpose).
   -------------------------------------------------------------------------- */

.h-4  { height: 1rem; }
.h-5  { height: 1.25rem; }
.h-6  { height: 1.5rem; }
.h-7  { height: 1.75rem; }
.h-10 { height: 2.5rem; }
.h-14 { height: 3.5rem; }
.w-4  { width: 1rem; }
.w-5  { width: 1.25rem; }
.w-6  { width: 1.5rem; }
.w-7  { width: 1.75rem; }
.w-10 { width: 2.5rem; }
.w-14 { width: 3.5rem; }

.grid { display: grid; }
.place-items-center { place-items: center; }
.rounded-full { border-radius: 9999px; }
.flex-1 { flex: 1 1 0%; }
.min-w-0 { min-width: 0; }
.mt-3 { margin-top: .75rem; }
.text-crimson-600 { color: #C42423; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

@media print {
  .d-sidebar, .d-topbar, .d-scrim, .d-no-print { display: none !important; }
  .d-main { margin-left: 0; }
  body.dash { background: #fff; }
}
