/* codehub, direction D "Keycap": the design system.
   One file for tokens, primitives, components and the three shells.
   Screen-specific rules belong in pages-a.css / pages-b.css, never here.

   The rules of the console:
   - Dark first in its design: a near-black canvas and three quiet steps of
     surface. A light theme is derived from the same roles. Pages open in light
     (data-theme="light"); without data-theme they follow the device.
   - Depth is the keycap stack: an inset top highlight, a 1px ring and an
     inset bottom shade. No outer drop shadows except the filled action's lift.
   - One filled action per view (Mist on dark, ink on light). Everything else
     is an edged key or words. Buttons and inputs are 8px; cards are 16px.
   - Coral is the brand mark: the store's tile and the code card's warm ground.
     Never a button, link, icon or status.
   - Inter for everything; Geist Mono only for codes, addresses, keys and links.
   - Spacing sits on an 8px grid (4px only between an icon and its label).
   - The signature: a code's digits are keys, and desktop shows key hints. */

/* ------------------------------------------------------------------ tokens */

/* The dark tokens also apply to any element with data-theme="dark" (and the light ones to
   data-theme="light"), so a preview can wear one theme inside a page of the other. */
:root, [data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces, back to front. */
  --canvas: #040506;      /* Void Black: the page */
  --surface: #07080a;     /* Ink: cards and panels */
  --recessed: #111214;    /* Obsidian: inputs, wells, segmented tracks */
  --raised: #1b1c1e;      /* Graphite: badges, tiles, hover on wells */
  --line: #363739;        /* 1px edges */
  --line-soft: #1f2022;   /* dividers inside a card */

  /* Text. */
  --text: #ffffff;
  --text-2: #9c9c9d;      /* Ash: secondary text, 7.4:1 on the canvas */
  --mark: #6a6b6c;        /* Smoke: icons and ticks only, never body text */
  --field: #636466;       /* a field's edge: 3:1 on surface and recessed */

  /* The one filled action. */
  --action: #e6e6e6;      /* Mist */
  --action-hover: #ffffff;
  --on-action: #232425;   /* Iron, deepened for 12:1 on Mist */
  --action-lift: inset 0 1px 0 rgb(255 255 255 / 0.7), inset 0 -2px 0 rgb(0 0 0 / 0.18);

  /* Brand and states. */
  --brand: #ff6363;       /* Coral: the store tile and the brand mark only */
  --on-brand: #040506;
  --warm: #452324;        /* Ember Hush: the code card's ground */
  --warm-line: #6a3335;
  --ok: #59d499;          /* a small dot beside "Working" / "Active", nothing else */

  /* A store's tile colours (Customer page settings, S13): coral is --brand; these are
     light enough for near-black initials at 6:1 or better in each theme. */
  --tile-blue: #5e9cf2;
  --tile-teal: #2fb5a6;
  --tile-green: #55bf6e;
  --tile-purple: #a68cf0;
  --tile-orange: #e5a03a;

  /* The keycap stack. */
  --key:
    inset 0 1px 0 rgb(255 255 255 / 0.06),
    0 0 0 1px rgb(255 255 255 / 0.12),
    inset 0 -1px 0 rgb(0 0 0 / 0.4);
  --key-strong:
    inset 0 1px 0 rgb(255 255 255 / 0.08),
    0 0 0 1px rgb(255 255 255 / 0.22),
    inset 0 -1px 0 rgb(0 0 0 / 0.4);
  --key-pressed: inset 0 1px 2px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.08);

  --scrim: rgb(0 0 0 / 0.6);
  --glass: rgb(4 5 6 / 0.72);
  --select: rgb(255 99 99 / 0.28);
  --focus: #ffffff;

  /* Shape. */
  --r: 8px;
  --r-badge: 6px;
  --r-card: 16px;
  --r-pill: 9999px;

  /* Space: an 8px grid. --s1 is only for an icon beside its label. */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 40px; --s8: 48px; --s9: 64px; --s10: 80px;

  /* Type: fixed rem steps. */
  --sans: "Inter", "Rubik Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --t-xs: 0.75rem;    /* 12 */
  --t-s: 0.8125rem;   /* 13 labels, controls */
  --t-m: 0.9375rem;   /* 15 body */
  --t-l: 1.125rem;    /* 18 */
  --t-xl: 1.375rem;   /* 22 */
  --t-2xl: 1.75rem;   /* 28 */
  --t-3xl: 2rem;      /* 32 page titles */
  --t-code: 2.25rem;  /* 36 a code digit */

  /* Motion: short, eased out; the code arriving is the one authored moment. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 120ms;
  --t-med: 200ms;
}

/* Light: the same roles by daylight, derived (the source style is dark only). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --canvas: #f4f4f5;
    --surface: #ffffff;
    --recessed: #ececee;
    --raised: #e4e4e7;
    --line: #d4d4d8;
    --line-soft: #ececee;
    --text: #0b0c0e;
    --text-2: #5c5d61;
    --mark: #85858b;
    --field: #85858b;
    --action: #111214;
    --action-hover: #2a2b2e;
    --on-action: #ffffff;
    --action-lift: inset 0 1px 0 rgb(255 255 255 / 0.14), inset 0 -2px 0 rgb(0 0 0 / 0.4);
    --brand: #ff6363;
    --on-brand: #040506;
    --warm: #fdeceb;
    --warm-line: #f6c9c7;
    --ok: #1f9d63;
    --tile-blue: #4a8de8;
    --tile-teal: #22a596;
    --tile-green: #46b062;
    --tile-purple: #9a7deb;
    --tile-orange: #dc9530;
    --key:
      inset 0 1px 0 rgb(255 255 255 / 0.9),
      0 0 0 1px #dcdce0,
      inset 0 -1px 0 rgb(0 0 0 / 0.06);
    --key-strong:
      inset 0 1px 0 rgb(255 255 255 / 0.9),
      0 0 0 1px #b8b8bf,
      inset 0 -1px 0 rgb(0 0 0 / 0.08);
    --key-pressed: inset 0 1px 2px rgb(0 0 0 / 0.12), 0 0 0 1px #d4d4d8;
    --scrim: rgb(9 9 11 / 0.36);
    --glass: rgb(244 244 245 / 0.78);
    --select: rgb(255 99 99 / 0.22);
    --focus: #0b0c0e;
  }
}
[data-theme="light"] {
  color-scheme: light;
  --canvas: #f4f4f5;
  --surface: #ffffff;
  --recessed: #ececee;
  --raised: #e4e4e7;
  --line: #d4d4d8;
  --line-soft: #ececee;
  --text: #0b0c0e;
  --text-2: #5c5d61;
  --mark: #85858b;
  --field: #85858b;
  --action: #111214;
  --action-hover: #2a2b2e;
  --on-action: #ffffff;
  --action-lift: inset 0 1px 0 rgb(255 255 255 / 0.14), inset 0 -2px 0 rgb(0 0 0 / 0.4);
  --brand: #ff6363;
  --on-brand: #040506;
  --warm: #fdeceb;
  --warm-line: #f6c9c7;
  --ok: #1f9d63;
  --tile-blue: #4a8de8;
  --tile-teal: #22a596;
  --tile-green: #46b062;
  --tile-purple: #9a7deb;
  --tile-orange: #dc9530;
  --key:
    inset 0 1px 0 rgb(255 255 255 / 0.9),
    0 0 0 1px #dcdce0,
    inset 0 -1px 0 rgb(0 0 0 / 0.06);
  --key-strong:
    inset 0 1px 0 rgb(255 255 255 / 0.9),
    0 0 0 1px #b8b8bf,
    inset 0 -1px 0 rgb(0 0 0 / 0.08);
  --key-pressed: inset 0 1px 2px rgb(0 0 0 / 0.12), 0 0 0 1px #d4d4d8;
  --scrim: rgb(9 9 11 / 0.36);
  --glass: rgb(244 244 245 / 0.78);
  --select: rgb(255 99 99 / 0.22);
  --focus: #0b0c0e;
}

/* -------------------------------------------------------------------- base */

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

html {
  font-family: var(--sans);
  font-size: 100%;
  line-height: 1.7;
  font-feature-settings: "calt", "kern", "liga", "ss03";
  color: var(--text);
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--raised) transparent;
  scrollbar-width: thin;
  caret-color: var(--brand);
  accent-color: var(--text);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  font-size: var(--t-m);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.5; letter-spacing: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
b, strong { font-weight: 600; }

a { color: var(--text); text-decoration-line: underline; text-decoration-color: var(--line); text-decoration-thickness: 1px; text-underline-offset: 0.25em; transition: text-decoration-color var(--t-fast) var(--ease-out); }
@media (hover: hover) { a:hover { text-decoration-color: currentColor; } }

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

.lucide { width: 1.25em; height: 1.25em; flex-shrink: 0; stroke-width: 1.75; }

/* Skip to the page's main region: hidden until focused from the keyboard. */
.skip-link { position: absolute; inset-inline-start: var(--s4); inset-block-start: var(--s4); z-index: 50; padding: var(--s2) var(--s3); border-radius: var(--r); background: var(--surface); box-shadow: var(--key-strong); color: var(--text); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

.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;
}

/* Numbers that must not jitter: counts, times. */
.num { font-variant-numeric: tabular-nums; }
/* Codes, hosts and Latin names keep left-to-right when Arabic arrives. */
.ltr { direction: ltr; unicode-bidi: isolate; }
/* Content that is code or data: addresses, keys, links. */
.is-code { font-family: var(--mono); font-feature-settings: "calt", "liga", "ss03", "ss09"; }

.muted { color: var(--text-2); }
.small { font-size: var(--t-s); }

/* A key hint (desktop only): "N", "/", "⌘C". */
.kbd {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 5px;
  background: var(--recessed);
  box-shadow: var(--key);
  color: var(--text-2);
  font: 500 11px/1 var(--mono);
}
@media (hover: none), (max-width: 767.98px) { .kbd { display: none; } }

@media (max-width: 767.98px) { .only-wide { display: none !important; } }
@media (min-width: 768px) { .only-narrow { display: none !important; } }

/* ------------------------------------------------------------------ layout */

.stack { display: flex; flex-direction: column; gap: var(--gap, var(--s4)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--s2)); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }

/* ----------------------------------------------------------------- buttons */

/* Every button is a key: 8px corners. */
.btn {
  --btn-h: 40px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--btn-h);
  padding: 0 var(--s4);
  border: 0;
  border-radius: var(--r);
  font-size: var(--t-s);
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}
/* Every button keeps a 44px touch target. */
.btn::after { content: ""; position: absolute; inset: calc((44px - var(--btn-h)) / -2) 0; }
.btn .lucide { width: 16px; height: 16px; }
.btn .kbd { margin-inline-start: var(--s1); }
.btn:active:not(:disabled):not([aria-disabled="true"]) { transform: translateY(1px); }

/* The one filled action: Mist on dark, ink on light; a struck key, no drop shadow. */
.btn--press { background: var(--action); color: var(--on-action); box-shadow: var(--action-lift); }
.btn--press .kbd { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on-action) 30%, transparent); color: var(--on-action); }
@media (hover: hover) { .btn--press:hover { background: var(--action-hover); color: var(--on-action); } }

/* Second voice: an edged key. */
.btn--tonal { background: var(--surface); color: var(--text); box-shadow: var(--key-strong); }
@media (hover: hover) { .btn--tonal:hover { background: var(--recessed); color: var(--text); } }
.btn--tonal:active { box-shadow: var(--key-pressed); }

/* Third voice: words only. */
.btn--plain { background: transparent; color: var(--text-2); padding-inline: var(--s3); }
@media (hover: hover) { .btn--plain:hover { color: var(--text); background: var(--recessed); } }

/* Quiet: stopping actions (Stop waiting, Turn off link, Pause). */
.btn--quiet { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
@media (hover: hover) { .btn--quiet:hover { color: var(--text); background: var(--recessed); } }

.btn--block { display: flex; width: 100%; --btn-h: 48px; font-size: var(--t-m); }
.btn--small { --btn-h: 32px; padding: 0 var(--s3); font-size: var(--t-s); }
.btn--small .lucide { width: 15px; height: 15px; }

/* Can't press: a flat well with muted words. */
.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--recessed);
  color: var(--text-2);
  box-shadow: none;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border: 0; border-radius: var(--r);
  background: transparent; color: var(--text-2);
  cursor: pointer; text-decoration: none;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
@media (hover: hover) { .icon-btn:hover { background: var(--recessed); color: var(--text); } }

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--key);
  padding: var(--s5);
}
/* The card that leads: a brighter ring. */
.card--lead { box-shadow: var(--key-strong); }
/* A secondary region set into the canvas. */
.card--soft { background: var(--recessed); box-shadow: none; }
.card--flush { padding: 0; }

.card__title { font-size: var(--t-l); font-weight: 500; }

/* ------------------------------------------------------- monogram, avatar */

.mono {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--raised);
  box-shadow: var(--key);
  color: var(--text);
  font: 500 12px/1 var(--sans); letter-spacing: 0;
}
.mono--small { width: 30px; height: 30px; font-size: 11px; }

/* The store's tile: coral, the brand mark. Near-black initials for 7:1. On the store's
   customer page (data-tile on its column) it takes the store's colour; the dashboard's
   sidebar and top-bar tiles carry no data-tile and stay coral. */
.badge {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--store, var(--brand));
  color: var(--on-brand);
  font-size: var(--t-s); font-weight: 600; letter-spacing: 0;
}
[data-tile="coral"]  { --store: var(--brand); }
[data-tile="blue"]   { --store: var(--tile-blue); }
[data-tile="teal"]   { --store: var(--tile-teal); }
[data-tile="green"]  { --store: var(--tile-green); }
[data-tile="purple"] { --store: var(--tile-purple); }
[data-tile="orange"] { --store: var(--tile-orange); }
/* The platform's own mark is neutral, never a store's colour. */
.badge--platform { background: var(--raised); box-shadow: var(--key-strong); color: var(--text); }

.avatar {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--raised);
  color: var(--text);
  font-size: var(--t-xs); font-weight: 500;
}

/* ------------------------------------------------------------------ status */

/* Status badges: 6px corners. Words first.
   good: a green dot. wait / alert: inverted with an icon (it needs someone).
   quiet: muted words, no fill (finished). Neutral: a graphite badge. */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: var(--r-badge);
  background: var(--raised);
  color: var(--text);
  font-size: var(--t-xs); font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: var(--mark); }
.status .lucide { width: 12px; height: 12px; stroke-width: 2; }
.status--good::before { background: var(--ok); }
.status--wait, .status--alert { background: var(--raised); box-shadow: var(--key-strong); color: var(--text); font-weight: 600; }
.status--wait::before, .status--alert::before { display: none; }
.status--quiet { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
.status--quiet::before { display: none; }

/* ---------------------------------------------------------- meter (dots) */

/* The balance as keys: lit for codes left, dark for used. */
.dots { display: inline-flex; align-items: center; gap: 4px; }
.dots i { width: var(--seg, 14px); height: var(--seg-h, 6px); border-radius: 2px; background: var(--text); }
.dots i.is-used { background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.dots--small { --seg: 8px; --seg-h: 4px; gap: 3px; }
.dots.is-dim i { background: var(--mark); }
.dots.is-dim i.is-used { background: var(--raised); }

/* ------------------------------------------------------------------ track */

/* Time drawn to scale: the next 30 days, one continuous fill up to the end
   date (only the codes meter uses keys). --days is whole days from today. */
.track {
  --span: 30;
  position: relative;
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--raised);
}
.track__fill {
  position: absolute; inset-block: 0; inset-inline-start: 0;
  width: calc(clamp(0, var(--days), var(--span)) * 100% / var(--span));
  border-radius: inherit;
  background: var(--text-2);
}
.track.is-soon .track__fill { background: var(--text); }
.track.is-over .track__fill { display: none; }

.timeline { display: grid; gap: var(--s2); }
.timeline__labels { position: relative; height: 1.4em; font-size: var(--t-xs); color: var(--text-2); }
.timeline__labels span { position: absolute; top: 0; white-space: nowrap; }
.timeline__labels .timeline__end {
  inset-inline-start: calc(clamp(0, var(--days), 30) * 100% / 30);
  transform: translateX(-100%);
  color: var(--text); font-weight: 500;
}

/* ------------------------------------------------------- digits: keycaps */

/* The signature: every digit of a code is a key. */
.digits {
  display: flex; align-items: center; flex-wrap: nowrap; gap: 6px;
  direction: ltr; unicode-bidi: isolate;
  font-family: var(--mono);
  font-size: min(var(--t-code), 8.4vw);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.digits__cell {
  display: inline-grid; place-items: center;
  inline-size: 1.25em; block-size: 1.5em;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--key-strong);
  color: var(--text);
}
.digits__gap { inline-size: 6px; }

/* ------------------------------------------------------------------ fields */

.field { display: grid; gap: var(--s2); }
.field__label { font-size: var(--t-s); font-weight: 500; color: var(--text); }
.field__hint { font-size: var(--t-s); color: var(--text-2); }

.input, .select {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--s3);
  border: 0;
  border-radius: var(--r);
  background: var(--recessed);
  box-shadow: inset 0 0 0 1px var(--field);
  color: var(--text);
  font-size: var(--t-m);
  transition: box-shadow var(--t-fast) var(--ease-out);
}
.input::placeholder { color: var(--text-2); opacity: 1; }
@media (hover: hover) { .input:hover, .select:hover { box-shadow: inset 0 0 0 1px var(--text-2); } }
.input:focus, .select:focus { outline: none; box-shadow: inset 0 0 0 1px var(--text), 0 0 0 3px var(--select); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--text); }
/* A field's problem, apart from its hint: an icon and ink words under the 2px ring.
   Coral stays the brand mark, so errors speak through weight and the icon. */
.field__error { display: flex; align-items: flex-start; gap: var(--s2); font-size: var(--t-s); font-weight: 500; color: var(--text); }
.field__error .lucide { width: 16px; height: 16px; margin-block-start: 3px; flex-shrink: 0; }
.field__error ul { display: grid; gap: var(--s1); min-width: 0; overflow-wrap: break-word; }
/* A multi-line field (a note): the same well, with room to write. */
textarea.input { display: block; min-height: calc(3 * 1.7em + 2 * var(--s3)); padding-block: var(--s3); line-height: 1.7; resize: vertical; }

.input-wrap { position: relative; display: block; }
.input-wrap > .lucide {
  position: absolute; inset-inline-start: 12px; top: 50%;
  width: 16px; height: 16px; margin-top: -8px;
  color: var(--text-2); pointer-events: none;
}
.input-wrap > .lucide + .input { padding-inline-start: 36px; }
.input-wrap > .kbd { position: absolute; inset-inline-end: 12px; top: 50%; margin-top: -10px; pointer-events: none; }
/* A field with a key hint keeps its words clear of the hint; long placeholders ellipsize. */
.input-wrap:has(> .kbd) > .input { padding-inline-end: 44px; }
.input { text-overflow: ellipsis; }

.select-wrap { position: relative; display: block; }
.select { appearance: none; padding-inline-end: 40px; cursor: pointer; }
.select-wrap > .lucide {
  position: absolute; inset-inline-end: 12px; top: 50%;
  width: 16px; height: 16px; margin-top: -8px;
  color: var(--text-2); pointer-events: none;
}

/* ------------------------------------------------------------------- chips */

/* Chips are real checkboxes or radios: edged keys that invert when picked. */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { position: relative; display: inline-flex; max-inline-size: 100%; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip__face {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 40px;
  white-space: nowrap;
  padding: 0 var(--s3);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--key);
  color: var(--text);
  font-size: var(--t-s); font-weight: 500;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
  user-select: none;
}
.chip__face .lucide { width: 15px; height: 15px; flex-shrink: 0; }
/* A long name wraps inside its chip; its mark stays beside the first line. */
.chip__face > span:last-child { min-width: 0; overflow-wrap: break-word; }
.chip__face:has(> span:last-child:not(:only-child)) { align-items: flex-start; padding-block: var(--s2); }
.chip__face > .is-off, .chip__face > .is-on { margin-block-start: 3px; }
.chip__face .is-on { display: none; }
.chip__note { color: var(--text-2); font-weight: 400; }
@media (hover: hover) { .chip:hover .chip__face { box-shadow: var(--key-strong); } }
.chip input:checked + .chip__face { background: var(--raised); color: var(--text); box-shadow: var(--key-strong), inset 0 0 0 1px var(--text); }
.chip input:checked + .chip__face .chip__note, .chip input:checked + .chip__face .chip__count { color: var(--text-2); opacity: 1; }
.chip input:checked + .chip__face .is-on { display: block; }
.chip input:checked + .chip__face .is-off { display: none; }
.chip input:focus-visible + .chip__face { outline: 2px solid var(--focus); outline-offset: 2px; }
/* A chip that is a link (a filter that works without scripts): aria-current is "checked". */
a.chip { color: inherit; text-decoration: none; }
a.chip:focus-visible { outline: none; }
a.chip:focus-visible .chip__face { outline: 2px solid var(--focus); outline-offset: 2px; }
.chip[aria-current] .chip__face { background: var(--raised); color: var(--text); box-shadow: var(--key-strong), inset 0 0 0 1px var(--text); }
.chip--plain .chip__face { padding-inline: var(--s3); }
.chip__count { color: var(--text-2); font-weight: 400; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- notices */

.notice {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s3) var(--s4);
  border-radius: var(--r);
  background: var(--recessed);
  color: var(--text);
  font-size: var(--t-s);
}
.notice > .lucide { width: 16px; height: 16px; margin-top: 2px; color: var(--text-2); }
/* A long unbroken name (an account called "ElevenLabsCreatorProfessionalTeamWorkspace")
   breaks inside the notice instead of pushing it past the screen. */
.notice__body { flex: 1; display: grid; gap: var(--s1); min-inline-size: 0; overflow-wrap: anywhere; }
.notice__title { font-size: var(--t-m); font-weight: 500; }
/* Needs someone: an edged key with a bright ring. */
.notice--wait { background: var(--surface); box-shadow: var(--key-strong); }
.notice--wait > .lucide { color: var(--text); }
.notice--good { background: var(--surface); box-shadow: var(--key); }
.notice--good > .lucide { color: var(--text); }
.notice--soft { background: var(--recessed); }
.notice--on-ground { background: var(--surface); box-shadow: var(--key); }

/* ------------------------------------------------------------ empty state */

.empty { display: grid; justify-items: start; gap: var(--s3); }
.empty__icon {
  display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--raised); box-shadow: var(--key); color: var(--text);
}
.empty__icon .lucide { width: 20px; height: 20px; }
.empty__title { font-size: var(--t-xl); font-weight: 500; }
.empty__text { color: var(--text-2); max-width: 40ch; }
.empty__actions { margin-top: var(--s2); }

/* ------------------------------------------------------- sheets, dialogs */

.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); }
.sheet {
  position: fixed; z-index: 41;
  inset-inline: 0; bottom: 0;
  max-height: 92dvh; overflow: auto;
  padding: var(--s3) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  border-radius: var(--r-card) var(--r-card) 0 0;
  background: var(--surface);
  box-shadow: var(--key-strong);
  animation: sheet-up var(--t-med) var(--ease-out) both;
}
.sheet::before {
  content: ""; display: block; width: 36px; height: 4px; margin: 0 auto var(--s4);
  border-radius: var(--r-pill); background: var(--raised);
}
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.sheet__title { font-size: var(--t-xl); font-weight: 500; }
.sheet__close { margin: -8px -8px 0 0; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 768px) {
  .sheet {
    inset: 50% auto auto 50%;
    width: min(520px, calc(100vw - 48px));
    transform: translate(-50%, -50%);
    padding: var(--s6);
    border-radius: var(--r-card);
    animation-name: fade;
  }
  .sheet::before { display: none; }
}

/* -------------------------------------------------------------- list rows */

/* A table on one keycap card. Rows are split by soft dividers; actions stay
   hidden until the row is hovered or focused. On touch screens the whole row
   opens the item instead. */
.list { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--key); overflow: hidden; }
.list__head {
  display: grid; align-items: end;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-xs); font-weight: 500; color: var(--text-2);
}
.row {
  position: relative;
  display: grid; align-items: center;
  gap: var(--s4);
  min-height: 64px;
  padding: var(--s3) var(--s4);
  transition: background-color var(--t-fast) var(--ease-out);
}
.row + .row { border-top: 1px solid var(--line-soft); }
.row:hover, .row:focus-within { background: var(--recessed); }

/* The row's main link stretches over the whole row. */
.row__link { color: var(--text); text-decoration: none; font-weight: 500; }
.row__link::after { content: ""; position: absolute; inset: 0; }
@media (hover: hover) { .row__link:hover { color: var(--text); } }
.row__link:focus-visible { outline: none; }
.row__link:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; }

.row__tail { display: flex; align-items: center; justify-content: flex-end; gap: var(--s4); min-width: 0; }
/* Actions slide over the end of the row on hover or keyboard focus. */
.row__actions {
  position: absolute; z-index: 2;
  inset-block: 0; inset-inline-end: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s2);
  padding-inline: var(--s4);
  background: var(--recessed);
  border-inline-start: 1px solid var(--line);
  opacity: 0; transform: translateX(6px); pointer-events: none;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-med) var(--ease-out);
}
[dir="rtl"] .row__actions { transform: translateX(-6px); }
.row:hover .row__actions, .row:focus-within .row__actions { opacity: 1; transform: none; pointer-events: auto; }
.row__chev { display: none; color: var(--mark); }
.row__chev .lucide { width: 18px; height: 18px; }
@media (hover: none), (max-width: 767.98px) {
  .row__actions { display: none; }
  .row__chev { display: block; }
}
/* Touch screens wide enough for the table layout: the arrow floats at the row's
   end instead of taking a grid cell. */
@media (hover: none) and (min-width: 768px) {
  .row:has(> .row__chev) { padding-inline-end: var(--s7); }
  .row > .row__chev { position: absolute; inset-inline-end: var(--s3); top: 50%; transform: translateY(-50%); }
}

/* ------------------------------------------------------------- page head */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s4); }
.page-head h1, .page-title { font-size: var(--t-3xl); font-weight: 500; line-height: 1.5; letter-spacing: 0; }
.page-head > .btn { margin-top: 2px; }
.page-head__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); }
.page-head__count { font-size: var(--t-m); color: var(--text-2); font-variant-numeric: tabular-nums; }
.section-title { font-size: var(--t-s); font-weight: 500; color: var(--text-2); margin-bottom: var(--s3); }
.back {
  display: inline-flex; align-items: center; gap: var(--s1);
  margin-bottom: var(--s3);
  font-size: var(--t-s); color: var(--text-2); text-decoration: none;
}
@media (hover: hover) { .back:hover { color: var(--text); } }
.back .lucide { width: 16px; height: 16px; }

/* =============================================================== shells */

/* ----------------------------------------------------- customer's page */

.cust { padding: 0 var(--s4) var(--s9); }
.cust__col { width: 100%; max-width: 440px; margin: 0 auto; }
.cust-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s4) 0 var(--s5);
}
.cust-head__store { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
/* The store's Contact key keeps its words on one line; a long store name wraps instead. */
.cust-head > .btn { flex: none; white-space: nowrap; }
.cust-head__name { font-weight: 500; font-size: var(--t-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-main { display: grid; gap: var(--s3); }
/* A page with no store header (a whole-page state, an unknown link) keeps its top space. */
.cust__col > .cust-main:first-child { padding-top: var(--s5); }
.cust-hello { font-size: var(--t-3xl); font-weight: 500; letter-spacing: 0; padding-bottom: var(--s2); }
/* The store's welcome line under the greeting: plain text in the store's words. */
.cust-welcome { margin-top: calc(var(--s3) * -1); padding-bottom: var(--s2); color: var(--text-2); overflow-wrap: anywhere; }
.cust-foot { margin-top: var(--s6); text-align: center; font-size: var(--t-s); color: var(--text-2); }
@media (min-width: 768px) { .cust { padding-top: var(--s6); } }

/* An account on the customer's page. */
.acct { display: grid; gap: var(--s4); }
.acct__head { display: flex; align-items: center; gap: var(--s3); }
.acct__name { font-size: var(--t-l); font-weight: 500; line-height: 1.25; }
.acct__hint { font-size: var(--t-s); color: var(--text-2); }
/* Show login details belongs to the account name: indented under it. */
.acct__toggle { --btn-h: 32px; justify-content: flex-start; margin: calc(var(--s4) * -1 + 2px) 0 var(--s2); margin-inline-start: 40px; align-self: start; }
.acct__body { display: grid; gap: var(--s3); }
.acct__title { flex: 1; min-width: 0; }
.acct--compact { padding-block: var(--s4); }
.acct__quick { flex-shrink: 0; }
.inline-msg { display: flex; align-items: flex-start; gap: var(--s2); font-size: var(--t-s); color: var(--text); }
.inline-msg .lucide { width: 16px; height: 16px; margin-top: 2px; color: var(--text-2); }
.inline-msg b { display: block; }

/* Login details, shown after one tap: a recessed well. */
.details { display: grid; border-radius: var(--r); background: var(--recessed); padding: var(--s1) var(--s4); }
.details__row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label actions" "value value";
  align-items: center; gap: 0 var(--s2);
  padding: var(--s3) 0;
}
.details__row > .details__label { grid-area: label; }
.details__actions { grid-area: actions; display: flex; gap: var(--s1); }
.details__row > .details__value { grid-area: value; margin-top: 2px; font-size: var(--t-m); }
.details__row.details__note { display: flex; }
.details__row + .details__row { border-top: 1px solid var(--line-soft); }
.details__text { flex: 1; min-width: 0; display: grid; }
.details__label { font-size: var(--t-xs); color: var(--text-2); }
.details__value { font-family: var(--mono); font-weight: 400; overflow-wrap: anywhere; }
.details__value.is-masked { letter-spacing: 0.16em; }
.details__note { display: flex; gap: var(--s2); padding: var(--s3) 0; font-size: var(--t-s); color: var(--text); }
.details__note .lucide { width: 16px; height: 16px; color: var(--text-2); margin-top: 2px; }
/* The password stays hidden until one tap, with no script: a disclosure whose summary
   is the masked value and its Show key. */
.details__row--secret { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
.details__row--secret > .details__label { grid-area: auto; }
.details__reveal > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); cursor: pointer; }
.details__reveal > summary::-webkit-details-marker { display: none; }
.details__reveal > summary:focus-visible { outline: none; }
.details__reveal > summary:focus-visible .details__show { outline: 2px solid var(--focus); outline-offset: 2px; }
.details__reveal[open] .details__mask, .details__reveal[open] .details__when-closed, .details__reveal:not([open]) .details__when-open { display: none; }
.details__reveal[open] > summary { justify-content: flex-end; }
/* Values a buyer copies by hand: one tap selects all of it. */
.select-all { -webkit-user-select: all; user-select: all; }
/* A form that only wraps one control lets the control take its place in the card. */
.acct__form { display: contents; }

/* The code card: the hero, on Ember Hush. Its digits are keys. */
.code-card { display: grid; gap: var(--s4); background: var(--warm); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 0 0 1px var(--warm-line); }
.code-card__label { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); font-size: var(--t-s); color: var(--text-2); }
.code-card__digits { padding: var(--s2) 0 var(--s3); }
.code-card__code { display: grid; }
/* The working app's live code and its run-out state share the card's rhythm. */
.code-card__live, .code-card__over { display: grid; gap: var(--s4); }
.code-card .digits__cell { animation: key-in 360ms var(--ease-out) both; animation-delay: calc(60ms + var(--i, 0) * 50ms); }
.code-card__meta { display: grid; gap: var(--s2); font-size: var(--t-s); color: var(--text-2); }
.code-card__actions { display: grid; gap: var(--s2); }
.code-card__intro { display: grid; gap: var(--s1); }
.code-card__heading { font-size: var(--t-xl); font-weight: 500; }
.used { display: flex; align-items: center; gap: 6px; color: var(--text); }
.used .lucide { width: 16px; height: 16px; color: var(--text); }
.code-card__meta .lucide { width: 16px; height: 16px; }

/* The 30-second window, draining under the keys. */
.countdown { display: block; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text) 14%, transparent); overflow: hidden; }
.countdown i {
  display: block; height: 100%; width: 100%;
  background: var(--text);
  transform-origin: left center;
  animation: drain 30s linear both;
  animation-delay: calc(var(--elapsed, 0) * -1s);
}
[dir="rtl"] .countdown i { transform-origin: right center; }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@keyframes fade { from { opacity: 0; } }
/* A key being struck: it drops in from slightly above and settles. */
@keyframes key-in { from { opacity: 0; transform: translateY(-6px); } 60% { opacity: 1; } }

/* Waiting for an emailed code: the page checks for 10 minutes, so a bar along
   the foot of the well fills over those 10 minutes (honest, not a loop).
   --elapsed (seconds) lets the server start it part-way. */
.waiting { display: grid; gap: var(--s2); padding: var(--s4); border-radius: var(--r); background: var(--recessed); position: relative; overflow: hidden; }
.waiting::before { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2px; background: var(--line); }
.waiting::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2px;
  background: var(--text);
  transform-origin: left center;
  /* --window: the real check window in seconds (the preview's is 10 minutes). */
  animation: fill calc(var(--window, 600) * 1s) linear both;
  animation-delay: calc(var(--elapsed, 20) * -1s);
}
.waiting__title { display: flex; align-items: center; gap: var(--s3); font-size: var(--t-m); font-weight: 500; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
[dir="rtl"] .waiting::after { transform-origin: right center; }

/* The balance for the whole page: one recessed line, right after the greeting. */
.balance { display: grid; gap: var(--s3); }
.balance__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-direction: row-reverse; }
.balance__line { font-size: var(--t-m); font-weight: 500; }
.balance__more { font-size: var(--t-s); color: var(--text-2); }
.cust-main > .balance.card--soft { padding: var(--s4); border-radius: var(--r-card); margin-bottom: var(--s2); }
.balance--lead { gap: var(--s3); }
.balance--lead .balance__top { margin-top: var(--s2); }
.balance__title { font-size: var(--t-xl); font-weight: 500; }
.balance__help { display: grid; gap: var(--s3); margin-top: var(--s3); padding-top: var(--s4); border-top: 1px solid var(--line-soft); }

/* B8 gallery captions. */
.gallery { display: grid; gap: var(--s3); }
.gallery__label { margin-top: var(--s5); font-size: var(--t-s); color: var(--text-2); }
.gallery__label:first-child { margin-top: 0; }

/* A page-level state (link ended, turned off, not found). */
.state { display: grid; gap: var(--s4); }
.state__brand { display: flex; align-items: center; gap: var(--s3); font-weight: 500; }
.state__title { font-size: var(--t-xl); font-weight: 500; }
.state__text { color: var(--text-2); font-size: var(--t-s); }

/* ------------------------------------------------------ store dashboard */

/* Desktop: a sidebar on the canvas. Tablet: a narrower sidebar. Phones: a glass
   top bar and a thumb-reachable tab bar. Content is centred in the space
   beside the sidebar at every width, so nothing leaves an empty band. */
.app { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.app__frame { display: block; }
.app__body { min-width: 0; }

.side { display: none; }
.side__store { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2); color: var(--text); text-decoration: none; font-weight: 500; font-size: var(--t-s); min-width: 0; }
.side__store > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__store .badge { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.side__new { margin: var(--s5) 0 var(--s4); }
.side__new .btn { --btn-h: 40px; font-size: var(--t-s); justify-content: flex-start; padding-inline: var(--s3); }
.side__new .btn .kbd { margin-inline-start: auto; }
.side__nav { display: grid; gap: 2px; }
.side__new:empty { display: none; }
.side__store + .side__nav, .side__new:empty + .side__nav { margin-top: var(--s5); }
.side__nav a {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 36px; padding: 0 var(--s3);
  border-radius: var(--r);
  color: var(--text-2); text-decoration: none;
  font-size: var(--t-s); font-weight: 500;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.side__nav a .lucide { width: 18px; height: 18px; }
@media (hover: hover) { .side__nav a:hover { color: var(--text); background: var(--recessed); } }
/* Where you are: a raised fill with no edge, so it never reads as a button
   (buttons are edged keys; the current page is a lit row). */
.side__nav a[aria-current="page"] { color: var(--text); background: var(--raised); }
.side__nav a[aria-current="page"] .lucide { color: var(--text); }
.side__foot { margin-top: auto; display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s2) 0; border-top: 1px solid var(--line-soft); font-size: var(--t-s); }
.side__me { display: grid; min-width: 0; }
.side__me span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The member's own controls under their name: the appearance choice as a full-width
   segmented track and Sign out as words. */
.side__foot { flex-wrap: wrap; }
.side__session { flex: 1 1 100%; display: grid; gap: var(--s1); padding-block: var(--s2) var(--s1); }
.side__foot > .side__me { flex: 1 1 0; }
/* An address wraps after "@" (<wbr>); its domain stays whole on one line, cut with an
   ellipsis only when even that line is too narrow (the full address is its title). A part
   before "@" too long for the line breaks anywhere; the domain's nowrap keeps it whole. */
.side__me .side__email { white-space: normal; overflow-wrap: anywhere; }
.email-domain { display: inline-block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.side__session .subnav { display: flex; justify-self: stretch; max-width: none; }
.side__session .subnav button { flex: 1 1 auto; justify-content: center; padding-inline: var(--s1); }
.side__session .btn { --btn-h: 40px; justify-content: flex-start; padding-inline: var(--s2); font-size: var(--t-s); }

/* Phones: a glass bar, as in the source's floating nav. */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s3);
  height: 56px;
  padding: 0 var(--s4);
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  backdrop-filter: blur(24px) saturate(1.2);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__store { display: flex; align-items: center; gap: var(--s3); color: var(--text); text-decoration: none; font-weight: 500; min-width: 0; }
.topbar__store > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__store .badge { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.topbar__end { margin-inline-start: auto; display: flex; align-items: center; gap: var(--s2); }
.topbar__me { cursor: pointer; padding: 0; position: relative; text-decoration: none; }
.topbar__me::after { content: ""; position: absolute; inset: -4px; } /* a 44px target */

.app-main { width: 100%; max-width: 1440px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s9); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-content: start; }
.app-main--narrow { max-width: 760px; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr);
  padding: var(--s1) var(--s2) calc(var(--s1) + env(safe-area-inset-bottom));
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  backdrop-filter: blur(24px) saturate(1.2);
  border-top: 1px solid var(--line-soft);
}
.tabbar a {
  display: grid; justify-items: center; gap: 2px;
  padding: 6px 0 4px;
  color: var(--text-2); text-decoration: none;
  font-size: var(--t-xs); font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a > span:first-child {
  display: grid; place-items: center;
  width: 48px; height: 28px; border-radius: var(--r);
  transition: background-color var(--t-fast) var(--ease-out);
}
.tabbar .lucide { width: 20px; height: 20px; }
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar a[aria-current="page"] > span:first-child { background: var(--raised); }

/* The one-tap action on phones, above the tab bar. */
.fab {
  position: fixed; z-index: 31;
  inset-inline-end: var(--s4);
  bottom: calc(72px + env(safe-area-inset-bottom));
  --btn-h: 48px; padding: 0 var(--s4);
  font-size: var(--t-m);
}

/* Bottom action bar for forms on phones. */
.actionbar {
  position: sticky; bottom: 0; z-index: 25;
  margin: 0 calc(var(--s4) * -1);
  padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom));
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border-top: 1px solid var(--line-soft);
}

@media (min-width: 768px) {
  .app { padding-bottom: 0; }
  .app__frame { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100dvh; }
  .side {
    position: sticky; top: 0; height: 100dvh;
    display: flex; flex-direction: column;
    padding: var(--s4) var(--s3);
    border-inline-end: 1px solid var(--line-soft);
  }
  .topbar { display: none; }
  .tabbar { display: none; }
  .app-main { padding: var(--s6) var(--s5) var(--s9); gap: var(--s5); }
  .actionbar { position: static; margin: 0; padding: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  /* Sign-in and setup have no sidebar: one column under a plain bar. */
  .app__frame:not(:has(> .side)) { display: block; }
  .app__frame:not(:has(> .side)) .topbar { display: flex; height: 64px; padding: 0 var(--s6); background: transparent; border-bottom: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (min-width: 1100px) {
  .app__frame { grid-template-columns: 232px minmax(0, 1fr); }
  .app-main { padding: var(--s7) var(--s7) var(--s10); }
}

/* Settings live in one place: Customer page, Plans, Team. A recessed segmented control. */
.subnav { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--recessed); overflow-x: auto; scrollbar-width: none; justify-self: start; max-width: 100%; }
.subnav a, .subnav button {
  display: inline-flex; align-items: center; height: 32px; padding: 0 var(--s3);
  border-radius: 7px; white-space: nowrap;
  color: var(--text-2); text-decoration: none;
  font-size: var(--t-s); font-weight: 500;
}
/* A choice made with buttons (such as the appearance): 44px to touch. */
.subnav button { height: auto; min-height: 44px; border: 0; background: transparent; cursor: pointer; }
/* An appearance choice with its label (the dashboard's sidebar and More page). */
.theme-choice { display: grid; gap: var(--s1); }
@media (hover: hover) { .subnav a:hover, .subnav button:hover { color: var(--text); } }
/* The track's 3px inset would clip a ring drawn outside the segment: draw it inside. */
.subnav a:focus-visible, .subnav button:focus-visible { outline-offset: -2px; }
.subnav a[aria-current="page"], .subnav button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--key); color: var(--text); }

/* ------------------------------------------------- dashboard grammar */

/* Needs attention: a strip of notices above the list, never its own page. */
.attention__items { display: grid; gap: var(--s2); }
.attention .notice { align-items: center; padding: var(--s3) var(--s3) var(--s3) var(--s4); }
.attention .notice__body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); }
.attention .notice__body p { flex: 1 1 28ch; }
.attention .notice__body p:last-child { flex: 0 0 auto; }
@media (min-width: 1600px) { .attention__items { grid-template-columns: 1fr 1fr; } }
.page-head + .attention { margin-top: calc(var(--s2) * -1); }

/* Search first, then the filters, over the list they scope. */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); }
.list-tools__search { flex: 1 1 22rem; max-width: 400px; } /* wraps above the filters before it would clip */
.list-tools__filters { flex-wrap: wrap; max-width: 100%; gap: 2px; padding: 3px; border-radius: 10px; background: var(--recessed); } /* tabs wrap whole; a squeezed tab broke its count ("2,9 / 32") */
.list-tools__filters .chip__face { white-space: nowrap; min-height: 32px; background: transparent; box-shadow: none; color: var(--text-2); padding-inline: var(--s3); border-radius: 7px; }
@media (hover: hover) { .list-tools__filters .chip:hover .chip__face { box-shadow: none; color: var(--text); } }
.list-tools__filters .chip input:checked + .chip__face { background: var(--surface); box-shadow: var(--key); color: var(--text); }
.list-tools__filters .chip input:checked + .chip__face .chip__count { color: var(--text-2); opacity: 1; }
.list-tools__filters .chip[aria-current] .chip__face { background: var(--surface); box-shadow: var(--key); color: var(--text); }
.list-tools + .list { margin-top: var(--s2); }
@media (max-width: 767.98px) {
  .list-tools__search { max-width: none; flex-basis: 100%; }
  /* Phones: the tabs stay one tight row that scrolls sideways when it must, rather than
     leaving one tab alone on a second line. */
  .list-tools__filters { flex: 1 1 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .list-tools__filters::-webkit-scrollbar { display: none; }
  .list-tools__filters .chip { flex: 0 0 auto; }
  .list-tools__filters .chip__face { padding-inline: var(--s2); }
  .app:has(.fab) .app-main { padding-bottom: calc(var(--s9) + 56px); }
}

.list ul { display: grid; }
.list__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s2) var(--s4); border-top: 1px solid var(--line-soft); }

/* An account's health as day ticks, labelled: a tall tick for a day with codes,
   a short one for none. Neutral ink; green stays the Working dot. */
.ticks { display: inline-flex; align-items: center; gap: var(--s2); margin-top: 4px; }
.ticks__run { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.ticks__run i { width: 3px; height: 12px; border-radius: 1px; background: var(--text-2); }
.ticks__run i.is-none { height: 4px; background: var(--mark); }
.ticks__label { font-size: var(--t-xs); color: var(--text-2); }

/* A simple row (components/list-row.html). */
.row--simple { grid-template-columns: minmax(0, 1fr) auto; }
.row__main { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.row__text { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }

/* Customer rows: six columns from 1280px, four from 1024px, two lines below (at 768px
   the column beside the sidebar is about 512px, too narrow for a table of names). */
.crow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.3fr) minmax(7.5rem, 0.8fr) 7.5rem 7.5rem minmax(10.5rem, 13rem); /* each row is its own grid: no content-sized tracks, so columns line up; the status fits "used up until" a whole date */
  gap: var(--s4);
  align-items: center;
}
.crow { min-height: 64px; }
.crow__who { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.crow__name { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.crow__name .row__link, .crow__name .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The accounts line wraps: an ellipsis in RTL cut Latin names from their start ("…T Plus"). */
.crow__name .crow__list { display: none; white-space: normal; overflow: visible; overflow-wrap: break-word; }
.crow__name .crow__contact { white-space: normal; overflow-wrap: anywhere; }
.crow__ends-word { display: none; }
/* Dates and times in table cells stay whole. */
.crow__ends, .crow__used { white-space: nowrap; }
.crow__accounts { color: var(--text); }
/* One unbreakable account name (a paused "ElevenLabsCreatorProfessionalTeamWorkspace")
   must not widen its column past the row at any width: names break anywhere. */
.crow__accounts, .crow__status .small { overflow-wrap: anywhere; min-inline-size: 0; }
.crow__left { display: grid; gap: 2px; }
.crow__count { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--t-s); }
.crow__count > .num { white-space: nowrap; } /* «7 من 7» stays whole on a small phone */
.crow__ends { font-size: var(--t-s); }
.crow__status { display: grid; gap: 2px; justify-items: start; min-inline-size: 0; }
.crow.is-stopped .crow__who .avatar { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); }
.crow.is-stopped .row__link { color: var(--text-2); }

/* Below 1280px the accounts show under the name instead of the contact. */
@media (max-width: 1279.98px) {
  .crow__name .crow__list { display: block; }
  .crow__name .crow__contact { display: none; }
}
/* Tablets: the accounts and last-used columns fold away. */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  .crow-grid { grid-template-columns: minmax(0, 1fr) 9rem 7.5rem minmax(9.5rem, 12rem); }
  .crow-grid > :nth-child(2), .crow-grid > :nth-child(5) { display: none; }
}

@media (max-width: 767.98px) {
  .list > .list__head { display: none; }
}
@media (max-width: 1023.98px) {
  .list > .list__head.crow-grid { display: none; }
  .crow__ends-word { display: inline; }
  .crow {
    /* The status side takes what it needs up to 45% of the row, then wraps (the chip,
       a paused account, the end date), so a long "Used up until …" never squeezes the
       name. 45% keeps «استُخدمت جميع الرموز» (131px) on one line from 360px up. */
    grid-template-columns: minmax(0, 1fr) fit-content(45%);
    grid-template-areas: "who status" "left ends";
    gap: var(--s1) var(--s3);
    padding-block: var(--s3);
  }
  .crow__who { grid-area: who; }
  .crow__status { grid-area: status; justify-items: end; text-align: end; min-inline-size: 0; }
  /* fit-content(45%) cannot shrink below the longest unbreakable word, so one paused
     account named "ElevenLabsCreatorProfessionalTeamWorkspace" would take the row from
     the customer's name. Breaking anywhere keeps the 45% promise for any name. */
  .crow__status .small, .crow__status .status { overflow-wrap: anywhere; min-inline-size: 0; max-inline-size: 100%; }
  .crow__left { grid-area: left; padding-inline-start: 48px; }
  .crow__left .small { display: none; }
  .crow__ends { grid-area: ends; white-space: normal; color: var(--text-2); text-align: end; }
  .crow__ends-date { white-space: nowrap; }
  .crow__accounts, .crow__used { display: none; }
}

/* One form on one card. On desktop its actions stay in reach at the bottom of
   the viewport, so Create link never falls below the fold. */
.form-card { display: grid; gap: var(--s5); }
.form-card.card { box-shadow: var(--key-strong); }
.form-card fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.form-card legend { padding: 0; margin-bottom: var(--s1); }
.form-card .chips { margin-top: var(--s1); }
.input-wrap--small .input { min-height: 40px; font-size: var(--t-m); }
.form-warning { display: none; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--surface); box-shadow: var(--key-strong); font-size: var(--t-s); }
.form-warning .lucide { width: 16px; height: 16px; margin-top: 2px; color: var(--text); }
.form-card:has(input[data-paused]:checked) .form-warning[data-when-paused] { display: flex; }
.plan-line { display: none; }
.plan-line__rule { display: block; font-weight: 500; }
.plans__custom { margin-inline-start: calc(var(--s3) * -1); }
.form-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: var(--s2);
  margin: 0 calc(var(--s5) * -1) calc(var(--s5) * -1);
  padding: var(--s3) var(--s5);
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 var(--r-card) var(--r-card);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
@media (max-width: 767.98px) {
  .page-head h1, .page-title { font-size: var(--t-2xl); }
  .form-card { padding: var(--s4); }
  .form-actions {
    display: grid; grid-template-columns: auto 1fr;
    margin: 0 calc(var(--s4) * -1) calc(var(--s4) * -1);
    padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom));
  }
}

/* ---------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; }
  .btn:active:not(:disabled) { transform: none; }
  .code-card .digits__cell { animation: fade 150ms ease-out both; }
  .sheet { animation: none; }
  .row__actions { transform: none; }
}

/* Arabic adaptation: preserve code geometry, allow prose and names to grow. */
.preview-note { padding: var(--s2) var(--s4); color: var(--text-2); font-size: var(--t-xs); text-align: center; }
bdi { unicode-bidi: isolate; }
.btn { min-height: 44px; height: auto; padding-block: 6px; white-space: normal; text-align: center; } /* a wrapped label keeps clear of the edges */
.btn > span { min-width: 0; overflow-wrap: anywhere; }
.input, .select { min-height: 44px; font-size: max(1rem, var(--t-m)); }
.field__label, .side__store, .topbar__store, .row__link, .card__title { overflow-wrap: anywhere; }
.ltr, [dir="ltr"] { unicode-bidi: isolate; }
.timeline__labels { min-height: 1.7em; height: auto; display: flex; justify-content: space-between; gap: var(--s2); }
.timeline__labels span { position: static; white-space: normal; }
.timeline__labels .timeline__end { transform: none; text-align: end; }
.icon-directional { display: inline-flex; flex-shrink: 0; }
.icon-directional > svg { transform: scaleX(-1); }
@media (max-width: 767.98px) {
  .page-head, .a-head, .a-head__actions { flex-wrap: wrap; }
  .page-head__title, .a-head__title { flex-wrap: wrap; }
}

.copy-feedback:has(p:empty) { display: none; }
.copy-feedback { position: fixed; inset-inline: var(--s4); bottom: max(var(--s4), env(safe-area-inset-bottom)); z-index: 100; max-width: 36rem; margin-inline: auto; padding: var(--s3); border-radius: var(--r); background: var(--surface); box-shadow: var(--key-strong); }
.copy-feedback input { width: 100%; margin-top: var(--s2); color: var(--text); background: var(--recessed); font: 1rem/1.5 var(--mono); }
/* Scripts add `js` to <html> (the app's app.js, the preview's preview.js): Copy keys and
   other controls that need a script wait for it, and hints that only help without one
   step aside once it runs. */
html:not(.js) [data-copy-target], html:not(.js) [data-js-only], html.js [data-no-js] { display: none !important; }
/* `hidden` always hides, whatever display a component's class gives it. */
[hidden] { display: none !important; }
/* An opened password with its Copy key beside it. */
.details__open { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: var(--s1); }
.details__open > .details__value { flex: 1; min-width: 0; font-size: var(--t-m); }

/* Names, filters and Arabic labels may wrap rather than lose their meaning. */
.status, .chip__face { white-space: normal; line-height: 1.6; }
.chip__face, .list-tools__filters .chip__face, .filter__select, .side__nav a { min-height: 44px; }
.crow__name .row__link, .a-arow__name .row__link, .srow__name .row__link { white-space: normal; overflow: visible; overflow-wrap: break-word; }
.cust-head__name, .side__store > span:last-child, .topbar__store > span:last-child { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.topbar { height: auto; min-height: 56px; padding-block: var(--s2); }
.a-copy__value { overflow-wrap: anywhere; }
