/* Makroskop's palette, the same tokens the apps use
   (documents/04-design-system.md). Petrol/teal on cream, no gradients. */
:root {
  --ink: #123c43;
  --accent: #2fa7a0;
  --background: #f5f3ee;
  --surface: #ffffff;
  --surface-alt: #edeae1;
  --text: #172326;
  --text-soft: #5c6b6c;
  --border: #e4e1d8;
  --warn: #9a3b2f;
  --ok: #2fa76b;

  /* Chart slices. Drawn from the product's own palette rather than a generic
     ramp, and --chart-6 is the grey that "unknown" always lands on. */
  --chart-1: #2fa7a0;
  --chart-2: #123c43;
  --chart-3: #d79a34;
  --chart-4: #7a9e5b;
  --chart-5: #b8663f;
  --chart-6: #b9b4a6;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ddedea;
    --accent: #4fc2b8;
    --background: #0e1a1c;
    --surface: #16292c;
    --surface-alt: #1e3438;
    --text: #eaf2f1;
    --text-soft: #8fa3a3;
    --border: #23393c;
    --warn: #e08b7c;
    --ok: #49c98a;

    --chart-1: #4fc2b8;
    --chart-2: #9fd3cd;
    --chart-3: #e8b65e;
    --chart-4: #9cc07c;
    --chart-5: #d98a63;
    --chart-6: #55696b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--sans);
}

/* ---------------------------------------------------------------- public

   The landing page and the dictionary are read, not worked in, so they keep
   comfortable reading sizes at every width. */

body.public {
  font-size: 16px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 40px 16px; }
.brand { font-size: 44px; letter-spacing: -0.02em; margin: 0 0 8px; color: var(--ink); }
.hero { padding: 48px 0; }
.lede { font-size: 19px; margin: 0 0 8px; }
.foot { color: var(--text-soft); font-size: 13px; text-align: center; padding: 20px 16px; }

/* ---------------------------------------------------------------- console

   The opposite trade: this is a working surface with a great deal to fit, so
   the type gets SMALLER as the viewport grows. A wider screen here is room
   for more rows, not for bigger letters. Everything below is sized off --fs,
   through explicit multiples rather than nested em, so a change to one number
   moves the whole panel and nothing compounds. */

body.console {
  --fs: 14px;            /* phones: still has to be legible in the hand */
  --gap: 12px;
  --side: 200px;

  font-size: var(--fs);
  line-height: 1.45;
  margin: 0;
}

@media (min-width: 768px)  { body.console { --fs: 13px;   --gap: 13px; --side: 208px; } }
@media (min-width: 1024px) { body.console { --fs: 12.5px; --gap: 14px; --side: 216px; } }
@media (min-width: 1440px) { body.console { --fs: 12px;   --gap: 15px; --side: 228px; } }

body.console {
  --fs-xs: calc(var(--fs) * 0.85);
  --fs-sm: calc(var(--fs) * 0.92);
  --fs-lg: calc(var(--fs) * 1.15);
  --fs-xl: calc(var(--fs) * 1.35);
}

.shell { display: flex; min-height: 100vh; }

/* --- sidebar --- */

.side {
  width: var(--side);
  flex: 0 0 var(--side);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 0.5);
  position: sticky;
  top: 0;
  /* dvh so a browser with a retracting toolbar does not put the last item
     under it; vh first for anything that does not know dvh. */
  height: 100vh;
  height: 100dvh;
  padding-bottom: calc(var(--gap) * 1.6);
}

.side .mark {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: calc(var(--gap) * 0.4) calc(var(--gap) * 0.4) var(--gap);
}

.side nav { display: flex; flex-direction: column; gap: 1px; }

.side .group {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin: var(--gap) 0 calc(var(--gap) * 0.3);
  padding: 0 calc(var(--gap) * 0.4);
}

.side nav a {
  display: block;
  padding: calc(var(--gap) * 0.42) calc(var(--gap) * 0.55);
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
}
.side nav a:hover { background: var(--surface-alt); }

.side .out { margin-top: auto; }
.side .out button {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 7px;
  padding: calc(var(--gap) * 0.42) calc(var(--gap) * 0.55);
  cursor: pointer;
  font: inherit;
  text-align: start;
}
.side .out button:hover { color: var(--text); border-color: var(--text-soft); }

/* --- main --- */

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

.topbar {
  display: flex;
  align-items: baseline;
  gap: var(--gap);
  padding: var(--gap) calc(var(--gap) * 1.4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
.topbar h1 { font-size: var(--fs-lg); font-weight: 600; margin: 0; color: var(--ink); }
.topbar .who { margin-inline-start: auto; display: flex; gap: calc(var(--gap) * 0.6); align-items: baseline; }
.topbar .name { font-weight: 600; }
.topbar .role {
  font-size: var(--fs-xs);
  color: var(--text-soft);
  background: var(--surface-alt);
  border-radius: 5px;
  padding: 2px 6px;
}

.content { padding: calc(var(--gap) * 1.4); display: flex; flex-direction: column; gap: var(--gap); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: calc(var(--gap) * 1.1);
  overflow-x: auto;
}
.panel h2 { font-size: var(--fs-lg); font-weight: 600; margin: 0 0 var(--gap); color: var(--ink); }

/* Dense tables: the reason the type is small in the first place. */
.console table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.console th, .console td {
  text-align: start;
  padding: calc(var(--gap) * 0.4) calc(var(--gap) * 0.55);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}
.console th {
  color: var(--text-soft);
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.console tbody tr:last-child td { border-bottom: 0; }
.console tbody tr:hover { background: var(--surface-alt); }
.console code { font-family: var(--mono); font-size: var(--fs-xs); }
/* Times, addresses and counts line up when their digits are the same width. */
.console .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: var(--fs-xs); }

/* Narrow screens: the sidebar stops being a column and rides along the top. */
@media (max-width: 767px) {
  .shell { flex-direction: column; }
  .side {
    width: auto;
    flex: none;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: calc(var(--gap) * 0.4);
  }
  .side .mark { padding: 0; }
  .side nav { flex-direction: row; flex-wrap: wrap; gap: calc(var(--gap) * 0.3); }
  .side .group { display: none; }
  .side .out { margin-inline-start: auto; margin-top: 0; }
  .side .out button { width: auto; }
}

/* ------------------------------------------------- shared odds and ends */

h1 { font-size: 24px; margin: 0 0 12px; color: var(--ink); }
.soft { color: var(--text-soft); margin: 4px 0; }
.ok { color: var(--ok); }
.warn {
  color: var(--warn);
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 16px;
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.narrow { max-width: 460px; margin: 40px auto; }
.center { text-align: center; }

.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-weight: 600;
}

/* The QR is served by GlobalTrustID and stays legible on a dark background,
   so it keeps a white plate of its own rather than inverting with the page. */
.qr { background: #fff; border-radius: 12px; padding: 12px; margin: 18px auto; display: block; }

/* ------------------------------------------------- console: forms and lists */

.done {
  color: var(--ok);
  background: var(--surface-alt);
  border-radius: 8px;
  padding: calc(var(--gap) * 0.5) calc(var(--gap) * 0.7);
  margin: 0 0 var(--gap);
}

.row-form { display: flex; gap: calc(var(--gap) * 0.5); align-items: center; flex-wrap: wrap; margin: 0 0 var(--gap); }
.row-form input {
  font: inherit;
  padding: calc(var(--gap) * 0.4) calc(var(--gap) * 0.6);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--background);
  color: var(--text);
  min-width: 15em;
}
.row-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row-form button, .console button {
  font: inherit;
  padding: calc(var(--gap) * 0.4) calc(var(--gap) * 0.8);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  cursor: pointer;
}
.console button.danger { background: none; color: var(--warn); border-color: var(--border); }
.console button.danger:hover { border-color: var(--warn); }
.console .quiet, .console button.quiet {
  background: none;
  border: 0;
  color: var(--text-soft);
  text-decoration: none;
  cursor: pointer;
  padding: calc(var(--gap) * 0.4);
}
.console td.end { text-align: end; }
.console td.end form { display: inline; }

.tag {
  font-size: var(--fs-xs);
  color: var(--text-soft);
  background: var(--surface-alt);
  border-radius: 5px;
  padding: 1px 5px;
  white-space: nowrap;
}
.tag.gold { color: #8a6417; }
@media (prefers-color-scheme: dark) { .tag.gold { color: #e8b65e; } }

/* --- users --- */

.who-cell { display: flex; align-items: center; gap: calc(var(--gap) * 0.55); }
.who-text { display: flex; flex-direction: column; line-height: 1.25; }
.who-name { font-weight: 600; }
.who-id { color: var(--text-soft); }

.avatar { border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--surface-alt); }
.avatar.blank {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  text-transform: uppercase;
}

.devices { display: flex; gap: calc(var(--gap) * 0.4); flex-wrap: wrap; }
.device {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-alt);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: var(--fs-xs);
}
.mark-glyph { display: block; flex: 0 0 auto; }

/* Presence. Connected-but-backgrounded gets its own colour because it is its
   own answer: the app is there and will take a message, which is not the same
   as somebody looking at it. */
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-inline-end: 6px;
  background: var(--text-soft);
}
.dot.online { background: var(--ok); }
.dot.background { background: #d79a34; }
.dot.offline { background: var(--border); }

.user-row, .group-row { cursor: pointer; }
.user-row:focus-visible, .group-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* --- groups --- */

/* A room is not a person, so its placeholder is not a circle. The square is
   the only thing telling the two lists apart at a glance when neither has a
   picture. */
.avatar.blank.square { border-radius: 5px; }

.staff { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.staff li { display: flex; align-items: baseline; gap: 6px; }

.pager { display: flex; align-items: center; gap: var(--gap); margin-top: var(--gap); }
.pager-links { margin-inline-start: auto; display: flex; gap: var(--gap); }
.pager-links a { color: var(--accent); text-decoration: none; }

/* --- detail dialog --- */

.modal {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: calc(var(--gap) * 1.2);
  min-width: min(420px, 92vw);
  font-size: var(--fs);
}
.modal::backdrop { background: rgba(18, 60, 67, 0.35); }
.modal header { display: flex; align-items: baseline; gap: var(--gap); margin-bottom: calc(var(--gap) * 0.6); }
.modal h2 { font-size: var(--fs-lg); margin: 0; color: var(--ink); }
.modal header form { margin-inline-start: auto; }
.modal h3 { font-size: var(--fs); font-weight: 600; color: var(--ink); margin: var(--gap) 0 calc(var(--gap) * 0.4); }

/* The dialog's contents ride in the row that opens it and are copied across
   on the way in, so the server formats them once for both places. */
.detail-source { display: none; }

/* Label above value on a phone, side by side once there is room. */
.facts { margin: 0; display: grid; gap: calc(var(--gap) * 0.45); }
.facts > div { display: grid; grid-template-columns: 1fr; gap: 1px; }
.facts dt { color: var(--text-soft); font-size: var(--fs-xs); }
.facts dd { margin: 0; }
@media (min-width: 480px) {
  .facts > div { grid-template-columns: 9em 1fr; align-items: baseline; gap: var(--gap); }
  .facts dt { font-size: var(--fs); }
}

/* ------------------------------------------------- console: heading and trail */

.topbar .heading { display: flex; flex-direction: column; gap: 2px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-soft); }
.crumbs a { color: var(--text-soft); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: 0.55; }

/* ------------------------------------------------- console: filters */

.filters {
  display: flex;
  align-items: center;
  gap: calc(var(--gap) * 0.5);
  flex-wrap: wrap;
  margin: 0 0 var(--gap);
}
.filter-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip {
  display: inline-block;
  padding: calc(var(--gap) * 0.25) calc(var(--gap) * 0.6);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.chip:hover { border-color: var(--text-soft); color: var(--text); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* ------------------------------------------------- console: sortable headings */

/* Only two columns sort, so the affordance is on those two and nowhere else:
   a heading that looks clickable and is not is worse than a plain one. */
.sortable {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}
.sortable:hover { color: var(--accent); }
.sortable.on { color: var(--ink); }
.sortable .arrow { font-size: var(--fs-xs); line-height: 1; }

/* ------------------------------------------------- console: striped rows */

/* The stripe sits under the hover, so pointing at a row still tells you which
   one you are on. */
.console table.striped tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-alt) 55%, transparent); }
.console table.striped tbody tr:hover { background: var(--surface-alt); }

/* ------------------------------------------------- console: pager */

.pager {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-top: var(--gap);
  padding-top: var(--gap);
  border-top: 1px solid var(--border);
}
.pager .sizes { display: inline-flex; align-items: center; gap: 4px; }
.pager .size {
  color: var(--text-soft);
  text-decoration: none;
  padding: 1px 6px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}
.pager .size:hover { background: var(--surface-alt); color: var(--text); }
.pager .size.on { background: var(--surface-alt); color: var(--ink); font-weight: 600; }

.pager .pages { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 3px; }
.pager .pages a, .pager .pages .here, .pager .pages .off, .pager .pages .gap {
  min-width: 1.9em;
  text-align: center;
  padding: calc(var(--gap) * 0.25) calc(var(--gap) * 0.35);
  border-radius: 6px;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.pager .pages a { color: var(--accent); }
.pager .pages a:hover { background: var(--surface-alt); }
.pager .pages .here { background: var(--ink); color: var(--surface); font-weight: 600; }
.pager .pages .off, .pager .pages .gap { color: var(--border); }

/* ------------------------------------------------- console: dashboard */

.section {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--ink);
  margin: calc(var(--gap) * 0.5) 0 0;
}

/* Widgets sit side by side while there is room and stack when there is not.
   auto-fit rather than a fixed count: the console is read on everything from
   a laptop to a wide desktop and the row should fill whatever it is given. */
.widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
  align-items: start;
}

.panel h3 {
  font-size: var(--fs);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 var(--gap);
}

.figures { display: flex; flex-direction: column; gap: var(--gap); justify-content: center; }
.figure { display: flex; flex-direction: column; gap: 2px; }
.figure-value {
  font-size: calc(var(--fs) * 2.1);
  font-weight: 700;
  line-height: 1.05;
  color: var(--ink);
  display: flex;
  align-items: center;
}
.figure-value .dot { width: 8px; height: 8px; }
.figure-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

/* --- donut --- */

.donut { display: flex; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.ring { width: 118px; height: 118px; flex: 0 0 auto; transform: rotate(-90deg); }
.ring circle {
  fill: none;
  stroke-width: 5.2;
  /* The slices are laid out as one dash each on a circle whose circumference
     is exactly 100, so a dash length is a percentage. */
}
.ring .hole { stroke: var(--surface-alt); stroke-width: 5.2; }
.ring text {
  /* The ring is rotated so its first slice starts at the top; the text has to
     be turned back or it reads sideways. */
  transform: rotate(90deg);
  transform-origin: 21px 21px;
  text-anchor: middle;
  fill: var(--ink);
}
.ring .ring-total { font-size: 6px; font-weight: 700; }
.ring .ring-cap { font-size: 2.7px; fill: var(--text-soft); letter-spacing: 0.06em; }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.legend li { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.swatch { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { font-weight: 600; }
.legend-share { min-width: 2.6em; text-align: end; }

/* --- model bars --- */

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.bars li { display: flex; align-items: center; gap: var(--gap); font-size: var(--fs-sm); }
.bar-label { flex: 0 0 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { flex: 1; height: 7px; background: var(--surface-alt); border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar-fill { display: block; height: 100%; background: var(--chart-1); border-radius: 4px; }
.bar-count { flex: 0 0 auto; font-weight: 600; }

/* A simulated device is marked, because a console full of emulators reads as
   real usage otherwise. */
.device.sim { border: 1px dashed var(--border); }
.sim-tag {
  font-size: calc(var(--fs) * 0.72);
  letter-spacing: 0.06em;
  color: var(--text-soft);
  border-inline-start: 1px solid var(--border);
  padding-inline-start: 4px;
  margin-inline-start: 2px;
}

/* ------------------------------------------------- console: announcements */

.stack-form { display: flex; flex-direction: column; gap: var(--gap); }
.stack-form textarea {
  font: inherit;
  width: 100%;
  padding: calc(var(--gap) * 0.6);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--background);
  color: var(--text);
  resize: vertical;
}
.stack-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.choices { border: 0; padding: 0; margin: 0 0 calc(var(--gap) * 0.6); display: flex; flex-wrap: wrap; gap: calc(var(--gap) * 0.4) var(--gap); }
.choices legend { color: var(--text-soft); font-size: var(--fs-sm); margin-bottom: calc(var(--gap) * 0.3); width: 100%; }
.choices label, .confirm, .file { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.audience { margin: calc(var(--gap) * 0.4) 0 0; }
.file { margin-top: calc(var(--gap) * 0.6); }
.attached { display: flex; align-items: center; gap: var(--gap); margin-top: calc(var(--gap) * 0.6); }
.confirm { margin-bottom: calc(var(--gap) * 0.6); }
.console button.quiet-outline { background: none; color: var(--accent); }
.console td.message { display: flex; align-items: center; gap: calc(var(--gap) * 0.5); max-width: 32em; }
.console td.message span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.thumb { border-radius: 6px; object-fit: cover; flex: 0 0 auto; background: var(--surface-alt); }
.console progress { display: block; width: 8em; margin-top: 4px; accent-color: var(--accent); }
.secret-value { font-size: var(--fs-sm); word-break: break-all; user-select: all; }
.panel.secret { border-color: var(--accent); }

/* ------------------------------------------------- business panel (mk-panel)

   The panel wears the console's shell — the sidebar, the top bar, the
   panels — because it is the same kind of surface: worked in, not read.
   It is used by customers rather than by us, though, on whatever screen they
   have, so the type does not shrink as far. */

body.panel-site { --fs: 15px; }
@media (min-width: 768px)  { body.panel-site { --fs: 14px; } }
@media (min-width: 1440px) { body.panel-site { --fs: 13.5px; } }

.side nav a.on { background: var(--surface-alt); font-weight: 600; color: var(--ink); }
.side .mark .tag { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; vertical-align: middle; }

.badge {
  display: inline-block;
  font-size: var(--fs-xs, 12px);
  font-weight: 600;
  color: var(--ok);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 7px;
  white-space: nowrap;
}

.small { font-size: var(--fs-xs, 13px); }
.wrap { white-space: normal !important; max-width: 22em; }
.warn-text { color: var(--warn); }
.console td.ok, .ok { color: var(--ok); }
.pending { color: #8a6417; margin: 6px 0; }
@media (prefers-color-scheme: dark) { .pending { color: #e8b65e; } }

.figure-value.small { font-size: var(--fs-xl); }
.panel.figure { display: flex; flex-direction: column; gap: 2px; }

/* --- forms --- */

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16em, 1fr));
  gap: var(--gap);
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-weight: 600; font-size: var(--fs-sm); }
.field small { font-weight: 400; }
.field input, .field select, .field textarea,
.stack-form input[type="text"], .stack-form input[type="number"], .stack-form input[type="date"],
.stack-form input[type="tel"], .stack-form select {
  font: inherit;
  width: 100%;
  padding: calc(var(--gap) * 0.45) calc(var(--gap) * 0.6);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--background);
  color: var(--text);
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.actions { display: flex; gap: var(--gap); align-items: center; }
.console form { margin: 0; }
.console td.actions-cell { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.row-head { display: flex; gap: var(--gap); align-items: flex-start; justify-content: space-between; margin-bottom: var(--gap); }
.row-head p { margin: 0; }
.button.small { padding: 7px 12px; font-size: var(--fs-sm); white-space: nowrap; }

.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14em, 1fr)); gap: var(--gap); }
.choice-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--gap);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.choice-card:hover { border-color: var(--accent); }
.choice-card strong { color: var(--ink); font-size: var(--fs-lg); }

/* --- packages --- */

.packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(15em, 1fr)); gap: var(--gap); align-items: stretch; }
.package { display: flex; flex-direction: column; gap: 6px; }
.package h2 { margin: 0; }
.package.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.package form { margin-top: auto; }
.price { font-size: var(--fs-xl); font-weight: 700; color: var(--ink); margin: 4px 0 0; }
.bullets { margin: 4px 0; padding-inline-start: 1.2em; display: flex; flex-direction: column; gap: 3px; }
.tag.on { background: var(--ink); color: var(--surface); align-self: flex-start; }

/* --- sponsored --- */

.tag.status-live { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.tag.status-review { background: color-mix(in srgb, #d79a34 22%, transparent); color: #8a6417; }
.tag.status-rejected { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
@media (prefers-color-scheme: dark) { .tag.status-review { color: #e8b65e; } }

.sp-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); align-items: start; }
@media (min-width: 1024px) { .sp-layout { grid-template-columns: minmax(0, 1fr) 22em; } .sp-preview-panel { position: sticky; top: 5em; } }

.sp-phone { background: var(--background); border: 1px solid var(--border); border-radius: 14px; padding: 8px; margin-bottom: 8px; }

/* The chat row, as the app draws it: picture, title with its label, one
   line of text. */
.sp-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: var(--surface); }
.sp-pic { flex: 0 0 48px; width: 48px; height: 48px; }
.sp-thumb { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; display: block; }
.sp-blank {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--surface); font-weight: 700;
}
.sp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sp-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sp-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-label {
  flex: 0 0 auto;
  font-size: calc(var(--fs, 14px) * 0.72);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
}
.sp-body, .sp-by { color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm, 14px); }
.sp-by { font-size: var(--fs-xs, 12px); }
.sp-more { color: var(--text-soft); padding: 0 4px; }
[hidden] { display: none !important; }

/* --- sign-in pages (public layout) --- */

.link-card .qr { display: inline-block; line-height: 0; }
.qr-code { display: block; width: 248px; height: 248px; max-width: 70vw; max-height: 70vw; }
.steps { text-align: start; margin: 12px auto; max-width: 26em; padding-inline-start: 1.3em; display: flex; flex-direction: column; gap: 4px; }
button.button { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.dev-login { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 8px; }
.dev-login label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.dev-login input {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--background); color: var(--text);
}
.dev-login .button { align-self: flex-start; }

/* ------------------------------------------------- console: business */

.console .facts dd .badge { vertical-align: baseline; }
.inline-forms { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: flex-end; }
.inline-forms form { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.inline-forms label { display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-sm); color: var(--text-soft); }
.inline-forms input, .inline-forms select {
  font: inherit; padding: calc(var(--gap) * 0.35) calc(var(--gap) * 0.5);
  border: 1px solid var(--border); border-radius: 7px; background: var(--background); color: var(--text);
}
.inline-forms input[type="number"] { width: 7em; }
.review-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
@media (min-width: 900px) { .review-card { grid-template-columns: 20em minmax(0, 1fr); } }
.review-image { max-width: 100%; border-radius: 8px; background: var(--surface-alt); display: block; }
.names-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18em, 1fr)); gap: var(--gap); }
