/*
 * Vendored typefaces. Every file is served from this origin under /brand/fonts/ — nothing is
 * ever fetched from a font CDN, which the Content Security Policy (`font-src 'self'`) also
 * forbids outright.
 *
 * IBM Plex Sans Arabic carries the interface. IBM Plex Sans covers Latin fragments such as a
 * host name, and IBM Plex Mono is reserved for reference codes and identifiers.
 *
 * `font-display: swap` keeps text readable while a face loads; the fallback stack is a
 * system one so the first paint is never blank.
 */

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/brand/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/brand/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/brand/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/brand/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/brand/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/brand/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/brand/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/brand/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/brand/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

/*
 * §511: the two display faces of «واجهة سند» (Alexandria for headings and figures, Reem Kufi for the
 * mark only), vendored beside the others — Open Font License 1.1, files from the Fontsource
 * packages `@fontsource/alexandria` and `@fontsource/reem-kufi`. Each family is one face in two
 * files (Arabic and Latin), joined by `unicode-range`, so a figure in Latin digits and an Arabic
 * word in one heading come from the same family.
 */

@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/brand/fonts/alexandria-arabic-600-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FEFF;
}

@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/brand/fonts/alexandria-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/brand/fonts/alexandria-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FEFF;
}

@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/brand/fonts/alexandria-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/brand/fonts/alexandria-arabic-800-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FEFF;
}

@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/brand/fonts/alexandria-latin-800-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: "Reem Kufi";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/brand/fonts/reem-kufi-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FEFF;
}

@font-face {
  font-family: "Reem Kufi";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/brand/fonts/reem-kufi-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/*
 * Interface styles.
 *
 * Two rules govern this file and both are tested:
 *
 * 1. LOGICAL PROPERTIES ONLY. No physical direction appears anywhere — no margin or padding
 *    with a side, no inset with a side, no text alignment by side, no float. The interface
 *    is Arabic and right-to-left by default, and an English scaffold must be a direction
 *    switch rather than a second stylesheet. `margin-inline-start` follows the writing
 *    direction; its physical cousin does not.
 *
 * 2. NO INLINE STYLE ANYWHERE. The policy is `style-src 'self'`, so every visual difference
 *    is a class in this file and never a style attribute in a component.
 *
 * Palette: stone ground, ink text, one olive accent, hairline rules. Status colours are
 * distinguishable, but status is always written in words too, so meaning never depends on
 * colour alone.
 *
 * iPhone rules, all of them tested:
 *
 * 3. SAFE AREAS. The document is `viewport-fit=cover`, so the shell adds the notch and
 *    home-indicator insets to its own padding with `max()`. The insets are physical
 *    (`left`/`right`) and the layout is logical, so both sides take the larger of the two —
 *    symmetric, direction-agnostic, and correct in landscape either way up.
 * 4. TOUCH TARGETS. Every control a finger lands on is at least 44px on its block axis: the
 *    Apple minimum, and roughly the width of an adult fingertip.
 * 5. 16px ON INPUTS. Safari zooms the page when a focused field's text is smaller than 16px,
 *    and the zoom does not undo itself. `max(1rem, 16px)` pins it whatever the root size.
 * 6. NO HOVER DEPENDENCE. Hover is decoration; the hover rule is behind `@media (hover:
 *    hover)` so a touch device does not keep a stuck hover state after a tap, and nothing is
 *    revealed by hovering in the first place.
 */

:root {
  --ground: #f2f0ea;
  --surface: #ffffff;
  --ink: #26231f;
  --ink-muted: #5f5a52;
  --accent: #5e6845;
  --accent-contrast: #ffffff;
  --rule: #d6d1c4;

  --status-neutral: #5f5a52;
  --status-progress: #3f5d78;
  --status-positive: #3f6b4a;
  --status-warning: #8a6114;
  --status-danger: #8c3a30;

  /*
   * The state labels' tones — one pill system for «تم», «ينتظرك», «تنبيه قطع», «يحتاج قرارك» and
   * a count. Each is a quiet tint with its own deep ink, every pair above 4.5:1, and the label
   * always says its state in words, so the tint is never the only signal.
   */
  --tone-neutral-bg: #f0eee8;
  --tone-neutral-ink: #4a463f;
  --tone-ok-bg: #e9ede1;
  --tone-ok-ink: #3a4329;
  --tone-wait-bg: #f6ebd9;
  --tone-wait-ink: #7a4a0e;
  --tone-danger-bg: #f6e5e1;
  --tone-danger-ink: #8c3a30;
  --pill-pad-block: 0.125rem;
  --pill-size: 0.8125rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  /*
   * One radius scale, the one his home was approved in (§144): a surface (card, column, form,
   * notice) at 16px, a control a finger presses (button, field, choice) at 12px, a label that
   * only names a state (pill, badge, count) fully round. Nothing else is rounded any other way.
   */
  --radius: 12px;
  --radius-surface: 16px;
  --radius-pill: 999px;
  --font-sans: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  /*
   * A title is whatever somebody typed, and people paste links and reference numbers. One
   * unbroken 110-character token in a board title measured the page at 955px on a 390px
   * screen — a phone then either scrolls sideways or shrinks the whole page to fit, which is
   * exactly "the screen looks miniaturised". `anywhere` breaks such a token only when it
   * would otherwise overflow, and, unlike `break-word`, lets a flex item shrink past it.
   */
  overflow-wrap: anywhere;
}

/* ── Accessibility ───────────────────────────────────────────────────────── */

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  inset-block-start: -4rem;
  inset-inline-start: var(--space-3);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding: var(--space-2) var(--space-3);
  background-color: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius);
}

.skip-link:focus {
  inset-block-start: var(--space-3);
}

/* ── Shell ───────────────────────────────────────────────────────────────── */

.app {
  min-block-size: 100vh;
  /* The side gutter never falls below 16px, and grows to clear a notch in landscape. */
  padding-inline: max(
    var(--space-4),
    env(safe-area-inset-left, 0px),
    env(safe-area-inset-right, 0px)
  );
  padding-block: max(var(--space-4), env(safe-area-inset-top, 0px))
    max(var(--space-6), env(safe-area-inset-bottom, 0px));
  margin-inline: auto;
  max-inline-size: 60rem;
}

/* The name alone: the session facts moved to «المزيد ← الحساب», one tap away on every screen. */
.app__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-block-end: var(--space-2);
  border-block-end: 1px solid var(--rule);
}

/* The bare mark: no tile, no border, no background — the geometry is the whole identity. */
.app__mark {
  display: block;
  flex-shrink: 0;
}

.app__name {
  font-weight: 600;
  font-size: 1.05rem;
}

/*
 * The account, the role, the host and the time zone, one per line, above the sign-out button.
 * They are one tap away on every screen rather than above every screen.
 */
.app__session {
  display: grid;
  gap: var(--space-1);
  margin: 0 0 var(--space-3);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.app__session-item {
  display: flex;
  gap: var(--space-1);
}

.app__session-item dt::after {
  content: ":";
}

.app__session-item dd {
  margin: 0;
  color: var(--ink);
}

/*
 * The bar: three links and a «المزيد» toggle in one row, and one panel drawn beneath it.
 *
 * The panel follows its button in the document (so Tab and a screen reader meet them in
 * that order) and `order` moves it below the row visually. It is a flex item with a
 * full-width basis, so it takes its own line whatever its siblings are doing. On a phone
 * (below the `min-width: 48rem` breakpoint) the whole bar is additionally pinned to the
 * bottom of the viewport — see the phone-only block near the end of this file.
 */
/* Phone first: every pixel above the screen's own content is one it does not get. */
.app__nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-block: var(--space-2);
  border-block-end: 1px solid var(--rule);
}

.app__nav-primary {
  flex: 1 1 auto;
  justify-content: center;
}

.app__nav-link {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid transparent;
}

/* A button that looks like its neighbours, with a hairline that says it opens something. */
.app__nav-toggle {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  background-color: transparent;
  border: 1px solid var(--rule);
  cursor: pointer;
}

/* An open panel's button reads as pressed into the panel beneath it. */
.app__nav-toggle[aria-expanded="true"] {
  background-color: var(--surface);
  border-color: var(--ink-muted);
  font-weight: 600;
}

@media (hover: hover) {
  .app__nav-link:hover,
  .app__nav-toggle:hover {
    border-color: var(--rule);
  }

  .segmented__option:hover {
    border-color: var(--ink-muted);
  }
}

.app__nav-link[aria-current="page"] {
  background-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

/* The page on screen lives behind «المزيد»: the button carries the marker while it is shut. */
.app__nav-toggle[aria-current="true"] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.app__nav-panel {
  order: 1;
  flex-basis: 100%;
  display: grid;
  gap: var(--space-4);
  padding: var(--space-3);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
}

/* `display: grid` above would otherwise override the attribute and show a closed panel. */
.app__nav-panel[hidden] {
  display: none;
}

.app__nav-panel--more {
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}

.app__nav-group-title {
  margin: 0 0 var(--space-1);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.app__nav-panel-list {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.app__nav-panel .app__nav-link {
  inline-size: 100%;
}

.quick-capture .field__hint,
.quick-reminder > .field__hint {
  margin: 0;
}

/*
 * `TodayQuickActions`' own capture and «ذكّرني»: the disclosure they sit in is already their
 * box, so a rule — not a frame — separates the two, the same treatment the removed nav panel
 * gave them.
 */
.today-quick-actions .quick-capture,
.today-quick-actions .quick-reminder {
  display: grid;
  gap: var(--space-2);
  margin-block-start: var(--space-3);
}

.today-quick-actions .quick-reminder {
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--rule);
}

.today-quick-actions .quick-reminder .section__title {
  margin: 0;
}

.today-quick-actions .quick-capture .form,
.today-quick-actions .quick-reminder .form {
  margin-block-start: 0;
  padding: 0;
  background-color: transparent;
  border: none;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */

.screen {
  padding-block-start: var(--space-4);
}

.screen__header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: baseline;
  justify-content: space-between;
  margin-block-end: var(--space-3);
}

.screen__title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.screen__lede {
  margin-block: var(--space-1) 0;
  color: var(--ink-muted);
}

.screen__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.section {
  margin-block-start: var(--space-6);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  justify-content: space-between;
}

.section__title {
  margin: 0 0 var(--space-3);
  font-size: 1.1rem;
  font-weight: 600;
}

/* ── Disclosures ─────────────────────────────────────────────────────────── */

/*
 * A native `<details>`: keyboard, screen reader and "find in page" support come with the
 * element, and a folded section is still in the document rather than fetched on demand.
 */
.disclosure {
  margin-block-start: var(--space-5);
  padding-inline: var(--space-3);
  padding-block: var(--space-1);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
}

/*
 * `list-item` is the summary's own display, and it is what draws the disclosure triangle:
 * `flex` would erase the one mark that says this box opens. The padding brings the line to
 * the 44px a finger needs without changing what it is.
 */
.disclosure__summary {
  display: list-item;
  min-block-size: 44px;
  padding-block: 0.6rem;
  font-weight: 600;
  cursor: pointer;
}

.disclosure[open] > .disclosure__summary {
  border-block-end: 1px solid var(--rule);
  margin-block-end: var(--space-2);
}

/* A disclosure inside something that is already a box: the summary line and nothing around it. */
.disclosure--quiet {
  margin-block-start: 0;
  padding-inline: 0;
  padding-block: 0;
  background-color: transparent;
  border: none;
}

.disclosure--quiet > .disclosure__summary {
  font-weight: 500;
  color: var(--ink-muted);
}

/* ── Today: the answer first ─────────────────────────────────────────────── */

.today-greeting {
  margin: 0;
  font-size: 1.05rem;
}

/* A quiet text line, not chips: numbers separated by a middle dot, nothing tinted or boxed. */
.today-indicators {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.today-indicators__sep {
  margin-inline: var(--space-2);
}

/*
 * A plain hairline and a surface a shade lighter than the page carry the emphasis — not a
 * coloured bar down one edge, which is decoration standing in for hierarchy. The heading's own
 * weight and size say "read this first" instead.
 */
.today-focus {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
}

/* Everything about today's focus that is not the lead item: the other priorities, the
 * ordering rule, the plan and «أضف مهمة» — after the two actions, on the surface itself
 * rather than the card, since it is folds and a plain action row, not a second card. */
.today-focus-details {
  display: grid;
  gap: var(--space-2);
  margin-block-start: var(--space-4);
}

.today-focus__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.today-focus__list {
  padding: 0;
}

.today-focus__list > .board__item:last-child {
  border-block-end: none;
}

/* The lead entry carries its next step; a hairline, not a card, keeps it part of the list. */
.today-focus__lead {
  display: grid;
  gap: var(--space-2);
}

.today-focus__next {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  background-color: var(--ground);
  border-radius: var(--radius);
}

.today-focus__next-text,
.today-focus__plan-text,
.today-focus__none {
  margin: 0;
}

.today-focus__next-label {
  font-weight: 600;
}

.today-focus__plan {
  display: grid;
  gap: var(--space-2);
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--rule);
}

/* A plain bar in the accent colour: progress read at a glance, stated in words beside it. */
.today-focus__meter {
  inline-size: 100%;
  block-size: 0.5rem;
  accent-color: var(--accent);
}

/* «أنجز» and, when it was refused, the reason under it (decisions §27). */
.complete-task {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
}

/* The board's one money sentence: late money only, under the answer (decisions §26). */
.today-money {
  margin-block: var(--space-4) 0;
}

.today-money__label {
  font-weight: 600;
}

.today-money a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  min-inline-size: 44px;
}

/* The refresh control, at the foot of the board rather than above the answer. */
.board__foot {
  margin-block-start: var(--space-5);
}

/* ── Money ───────────────────────────────────────────────────────────────── */

/*
 * Every figure is one row of two columns — the label, and the amount with its count beneath —
 * whatever the width of the amount. The shared `.definition` wraps when its value is wide, so
 * a long amount dropped under its label while a short one sat beside it: rows that should read
 * as one table did not line up.
 */
.money-figures .definition {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-3);
  align-items: baseline;
}

.money-figures .definition__label {
  min-inline-size: 0;
}

.money-figures .definition__value {
  text-align: end;
}

/* The count sits under the amount it explains, quieter than it. */
.money-figure__count {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* The basis sentence under a group, clear of the box above it. */
.money-figures + .field__hint {
  margin-block-start: var(--space-2);
}

/* Late money reads as late in weight and in the danger tone; the label says it in words too. */
.money-figure--late .definition__label,
.money-figure--late .money {
  color: var(--status-danger);
  font-weight: 600;
}

/* ── Daily board ─────────────────────────────────────────────────────────── */

.board__section {
  margin-block-start: var(--space-5);
}

.board__heading {
  margin: 0 0 var(--space-2);
  font-size: 1rem;
  font-weight: 600;
  padding-block-end: var(--space-1);
  border-block-end: 1px solid var(--rule);
}

.board__count {
  color: var(--ink-muted);
  font-weight: 400;
}

.board__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.board__item {
  padding-block: var(--space-3);
  border-block-end: 1px solid var(--rule);
}

.board__main {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
}

.board__title {
  font-weight: 500;
  color: var(--ink);
}

/*
 * A title that is a link is how a finger opens the record — on most board rows the only way.
 * It was one line tall (25.6px) and as wide as its words. Inline-flex keeps its first-line
 * baseline, so it still lines up with the type beside it.
 */
a.board__title {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  /* A one-word link («مهمة») is still wide enough to hit. */
  min-inline-size: 44px;
}

.board__type,
.board__due,
.board__waiting {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.board__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-block-start: var(--space-2);
}

.board__subtitle {
  margin-block: var(--space-2) 0;
  color: var(--ink-muted);
}

.counts__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: var(--space-3);
  margin: 0;
}

.counts__item {
  padding: var(--space-3);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
}

.counts__item dt {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.counts__item dd {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* ── Cards and lists ─────────────────────────────────────────────────────── */

.cards {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-3);
}

.card {
  padding: var(--space-4);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
}

.card__title {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  font-weight: 600;
  color: var(--ink);
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-block-start: var(--space-2);
}

.card__facts {
  margin-block: var(--space-3) 0;
  display: grid;
  gap: var(--space-1);
}

.card__subtitle {
  margin-block: var(--space-2) 0;
  color: var(--ink-muted);
}

.plain-list,
.comments,
.decisions {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-3);
}

.comment,
.decision {
  padding: var(--space-3);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
}

.comment__head,
.decision {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.comment__body,
.decision__note,
.draft__body {
  margin-block: var(--space-2) 0;
  inline-size: 100%;
  white-space: pre-wrap;
}

/*
 * A WhatsApp message as its sender wrote it (§39): line breaks kept, a long word or link broken
 * rather than pushing the page sideways on a phone.
 */
.whatsapp__body {
  margin-block: var(--space-3) 0;
  inline-size: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.whatsapp__suggestions {
  margin-block: var(--space-3) 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-3);
}

.whatsapp__suggestion {
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--rule);
}

.whatsapp__quote {
  margin-block: var(--space-2);
  margin-inline: 0;
  padding-inline-start: var(--space-3);
  border-inline-start: 3px solid var(--accent);
  overflow-wrap: anywhere;
}

.comment__author,
.decision__by,
.decision__reason,
.draft__stamp {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.decision__invalidated {
  font-size: 0.85rem;
  color: var(--status-danger);
}

/* ── Definitions ─────────────────────────────────────────────────────────── */

.definitions {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-4);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
}

.definition {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
}

.definition__label {
  min-inline-size: 10rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.definition__value {
  margin: 0;
}

/*
 * Links to related records — a list on an organization, a row of the definitions, the line
 * that follows a save — were bare inline text, 19–26px tall and stacked 8–12px apart.
 */
.plain-list a,
.definition__value a,
.form__success a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  /* A one-word link («مهمة») is still wide enough to hit. */
  min-inline-size: 44px;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding-inline: var(--space-2);
  padding-block: var(--pill-pad-block);
  font-size: var(--pill-size);
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule);
  background-color: var(--ground);
  color: var(--ink);
}

.badge--active,
.badge--approved,
.badge--paid,
.badge--done,
.badge--completed,
.badge--ready,
.badge--sent_confirmed,
.badge--flag-on {
  border-color: var(--status-positive);
  color: var(--status-positive);
}

.badge--in_progress,
.badge--submitted,
.badge--invoiced,
.badge--needs_review,
.badge--payment_prepared,
.badge--opened_in_channel {
  border-color: var(--status-progress);
  color: var(--status-progress);
}

.badge--overdue,
.badge--needs_information,
.badge--disputed,
.badge--quarantined,
.badge--waiting,
.badge--on_hold {
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.badge--rejected,
.badge--cancelled,
.badge--priority-urgent {
  border-color: var(--status-danger);
  color: var(--status-danger);
}

.badge--priority-high {
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.badge--flag-off {
  border-color: var(--status-neutral);
  color: var(--status-neutral);
}

/* The WhatsApp intake (§39): where a suggestion stands. */
.badge--suggestion-proposed {
  border-color: var(--status-progress);
  color: var(--status-progress);
}

.badge--suggestion-accepted {
  border-color: var(--status-positive);
  color: var(--status-positive);
}

.badge--suggestion-dismissed {
  border-color: var(--status-neutral);
  color: var(--status-neutral);
}

/* The owner's WhatsApp replies (§41): where a reply stands. The word is always in the badge. */
.badge--reply-draft,
.badge--reply-cancelled {
  border-color: var(--status-neutral);
  color: var(--status-neutral);
}

.badge--reply-approved {
  border-color: var(--status-progress);
  color: var(--status-progress);
}

.badge--reply-claimed {
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.badge--reply-sent {
  border-color: var(--status-positive);
  color: var(--status-positive);
}

.badge--reply-failed {
  border-color: var(--status-danger);
  color: var(--status-danger);
}

/* A report the owner's own machine wrote to him (§56): marked apart from a reply. */
.badge--report {
  border-color: var(--status-progress);
  color: var(--status-progress);
}

/*
 * «ما أهم شيء أفعله الآن؟»: why an entry is there and whose it is. These must follow `.badge`
 * above: the same specificity, so the later rule wins — placed before it, the base border and
 * ink colour quietly erased every one of them.
 */
.badge--focus-overdue {
  border-color: var(--status-danger);
  color: var(--status-danger);
}

.badge--focus-due_today {
  border-color: var(--status-progress);
  color: var(--status-progress);
}

.badge--focus-awaiting_decision {
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.badge--assignment-mine {
  border-color: var(--accent);
  color: var(--accent);
}

/* Nobody's yet: a dashed edge, so it never reads as the same thing as «مسندة إليك». */
.badge--assignment-unassigned {
  border-style: dashed;
  color: var(--ink-muted);
}

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form {
  display: grid;
  gap: var(--space-4);
  margin-block-start: var(--space-4);
  padding: var(--space-4);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
}

.filters__more {
  flex-basis: 100%;
  margin-block-start: 0;
}

.filters__extra {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-block-end: var(--space-3);
}

.field {
  display: grid;
  gap: var(--space-1);
}

.field--inline {
  min-inline-size: 10rem;
}

.field__label {
  font-size: 0.9rem;
  font-weight: 500;
}

.field__required {
  margin-inline-start: var(--space-1);
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.field__hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.field__error,
.form__error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--status-danger);
  font-weight: 500;
}

.form__success {
  margin: 0;
  font-size: 0.9rem;
  color: var(--status-positive);
  font-weight: 500;
}

.form__preview {
  margin: 0;
  color: var(--ink-muted);
}

.control {
  inline-size: 100%;
  min-block-size: 44px;
  padding: var(--space-2);
  font-family: inherit;
  /* Below 16px, Safari zooms the page on focus and never zooms back out. */
  font-size: max(1rem, 16px);
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.control[aria-invalid="true"] {
  border-color: var(--status-danger);
}

.control--textarea {
  resize: vertical;
}

.fieldset {
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.fieldset__legend {
  padding-inline: var(--space-2);
  font-weight: 600;
}

.item-row {
  display: grid;
  gap: var(--space-2);
  padding-block: var(--space-3);
  border-block-end: 1px solid var(--rule);
}

/* Every option on screen at once, each a whole row a finger can land on. */
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.choice {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  min-block-size: 44px;
  padding-inline: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background-color: var(--surface);
  cursor: pointer;
}

.choice input {
  min-block-size: 20px;
  min-inline-size: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.choice:has(input:checked) {
  border-color: var(--accent);
  font-weight: 600;
}

/* Two short fields that belong together (a date and its time) share a row when they fit. */
.form__pair {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  /* A hint under one field must not stretch its neighbour and push that input down. */
  align-items: start;
}

.form__details {
  margin-block-start: 0;
}

.form__fields {
  display: grid;
  gap: var(--space-4);
  padding-block-end: var(--space-3);
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.checkbox {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  min-block-size: 44px;
  padding-inline: var(--space-2);
}

.checkbox input {
  min-block-size: 24px;
  min-inline-size: 24px;
}

/*
 * The label is the other half of the target, so it has to be the same height as the row.
 *
 * `.checkbox` is 44px tall, which reads as a 44px target and is not one: only the box and its
 * label take a tap, and the label was as tall as its own text — measured at 390×844, 26px inside
 * a 44px row. Stretching the label to the row's height makes the thing a finger lands on the
 * thing the row promised, without moving a single pixel of the layout.
 */
.checkbox label {
  display: flex;
  align-items: center;
  min-block-size: 44px;
  cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44px on both axes: the smallest target a fingertip hits reliably. */
  min-block-size: 44px;
  min-inline-size: 44px;
  padding: var(--space-2) var(--space-4);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
}

.button--primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.button--danger {
  border-color: var(--status-danger);
  color: var(--status-danger);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pagination {
  margin-block-start: var(--space-4);
}

/* ── States and notices ──────────────────────────────────────────────────── */

.state {
  margin-block: var(--space-3);
  padding: var(--space-4);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
  color: var(--ink-muted);
}

.state--error {
  border-color: var(--status-danger);
  color: var(--ink);
}

.state--denied {
  border-color: var(--status-warning);
  color: var(--ink);
}

.state--inert {
  font-style: italic;
}

/*
 * A plain hairline on every side, not a coloured bar down one edge: the same tonal treatment
 * `.today-focus` uses, so one accent-bar convention does not sit beside a hairline convention
 * on the same screen. Emphasis is the border's own colour and the weight of the text, not a
 * strip of colour standing apart from the rest of the box.
 */
.notice {
  margin-block: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
  background-color: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
}

/* A notice that folds its technical reason (`LanguageModelNotice`): the sentence and the
 * fold's own summary sit one under the other, not touching the browser's default paragraph
 * margins. */
.notice > p {
  margin: 0;
}

.notice > .disclosure {
  margin-block-start: var(--space-2);
}

.notice--strong {
  border-color: var(--status-warning);
  font-weight: 500;
}

.notice--muted {
  color: var(--ink-muted);
}

.warnings {
  margin-block-start: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--status-warning);
  border-radius: var(--radius-surface);
}

.warnings__title {
  margin: 0 0 var(--space-1);
  font-size: 0.9rem;
  color: var(--status-warning);
}

.warnings__list {
  margin: 0;
  padding-inline-start: var(--space-4);
}

.muted {
  color: var(--ink-muted);
}

.money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  unicode-bidi: isolate;
}

/*
 * Figures. Every line that carries a sum is set in tabular figures, so a column of amounts
 * lines up on its digits and «1,284.50» above «320» reads as a column, not a ragged edge. A sum
 * drawn beside a name or an account is its own bidirectional run (`isolate`): written after
 * «••••4410» it had merged into one number on the screen. A masked account (`Masked`) is one
 * left-to-right run that never breaks across lines.
 */
.num,
.home__amount,
.home__due-amount,
.home__table-num {
  font-variant-numeric: tabular-nums;
}

.home__amount,
.home__due-amount,
.home__out-sum,
.home__card-amount,
.home__scard-metric {
  unicode-bidi: isolate;
}

.masked {
  white-space: nowrap;
}

.results-count {
  color: var(--ink-muted);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-scroll {
  overflow-x: auto;
}

.table {
  inline-size: 100%;
  border-collapse: collapse;
  background-color: var(--surface);
  /* A table scrolls inside `.table-scroll` instead: breaking cells letter by letter is worse. */
  overflow-wrap: normal;
}

.table th,
.table td {
  padding: var(--space-2) var(--space-3);
  text-align: start;
  border-block-end: 1px solid var(--rule);
}

.table th {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-weight: 600;
}

/* ── Dialog ──────────────────────────────────────────────────────────────── */

.dialog__backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background-color: rgb(38 35 31 / 45%);
  z-index: 20;
}

.dialog {
  inline-size: 100%;
  max-inline-size: 28rem;
  padding: var(--space-5);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-surface);
  display: grid;
  gap: var(--space-3);
}

.dialog__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.dialog__body {
  margin: 0;
  color: var(--ink-muted);
}

/* A body of several parts — the WhatsApp reply confirmation (§41) — spaced by the grid. */
div.dialog__body {
  display: grid;
  gap: var(--space-2);
}

div.dialog__body > p {
  margin: 0;
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* ── Reminders, documents and drafts ─────────────────────────────────────── */

.form--inline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: end;
}

/*
 * The draft workflow, as a numbered strip. Steps already passed are filled; the current one
 * carries `aria-current="step"` and a heavier border, so the position is announced as well
 * as drawn — the strip is never the only statement of a draft's status, the badge is.
 */
.workflow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block: var(--space-2);
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.workflow__step {
  padding-inline: var(--space-2);
  padding-block: 0.1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background-color: var(--ground);
}

.workflow__step--done {
  border-color: var(--accent);
  color: var(--ink);
}

.workflow__step[aria-current="step"] {
  border-width: 2px;
  font-weight: 600;
}

/* The inert channel handoff: a disabled control and the sentence that explains it. */
.handoff {
  margin-block-start: var(--space-3);
  padding: var(--space-3);
  border: 1px dashed var(--rule);
  border-radius: var(--radius-surface);
}

.copy-status {
  align-self: center;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* A digest is long and must break anywhere rather than widen the page on a phone. */
.digest {
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

/* ── Segmented control ───────────────────────────────────────────────────── */

/*
 * A few views of one page, one shown at a time: real buttons carrying `aria-pressed` inside a
 * labelled group, so a screen reader says which is chosen. The chosen one is marked the way the
 * current navigation link is — filled, and heavier type — so it is not told apart by colour
 * alone. On a phone the options share the row evenly; a long label wraps onto a second line
 * rather than pushing the row wider than the screen.
 */
.segmented {
  display: flex;
  gap: var(--space-2);
  margin-block: var(--space-3);
}

.segmented__option {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  min-inline-size: 44px;
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
  color: var(--ink);
  background-color: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
}

.segmented__option[aria-pressed="true"] {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

/* ── Phones: the bar as a fixed bottom strip ────────────────────────────── */

/*
 * «شريط تنقل سفلي بأربع وجهات»: on a phone the bar sits at the bottom of the screen on every
 * page, thumb's reach away, rather than scrolling off the top with the rest of the content.
 * The unit mirrors the desk breakpoint below (48rem) rather than a device-specific pixel width.
 */
@media (max-width: 47.99rem) {
  .app {
    /* The bar is fixed below the content now, so the last row of every screen must still
     * clear it — roughly the bar's own block size plus the safe-area inset it also claims. */
    padding-block-end: max(
      calc(3.5rem + var(--space-4)),
      calc(3.5rem + env(safe-area-inset-bottom, 0px))
    );
  }

  /*
   * The same clearance, for the browser's own scroll-into-view rather than for the last row
   * of static content: focusing the quick-capture title the instant its disclosure opens
   * (§ TodayQuickActions) scrolled the field to sit *behind* the fixed bar's own block size —
   * measured, on a real viewport, not a full-page capture. `scroll-padding` is the browser's
   * reserved margin for exactly this, on the root scroller.
   */
  html {
    scroll-padding-block-end: max(
      calc(3.5rem + var(--space-4)),
      calc(3.5rem + env(safe-area-inset-bottom, 0px))
    );
  }

  .app__nav {
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 20;
    background-color: var(--surface);
    border-block-start: 1px solid var(--rule);
    border-block-end: none;
    padding-block-end: max(var(--space-2), env(safe-area-inset-bottom, 0px));
  }

  /* The one remaining panel opens upward, above the fixed bar, rather than beneath it. */
  .app__nav-panel--more {
    order: initial;
    position: fixed;
    inset-inline: max(var(--space-3), env(safe-area-inset-left, 0px))
      max(var(--space-3), env(safe-area-inset-right, 0px));
    inset-block-end: calc(3.5rem + max(var(--space-2), env(safe-area-inset-bottom, 0px)));
    max-block-size: 60vh;
    overflow-y: auto;
  }
}

/* ── Wider viewports ─────────────────────────────────────────────────────── */

@media (min-width: 48rem) {
  .app {
    padding-inline: var(--space-6);
  }

  /* A desk has the height to spare that a phone does not, and the bar is a static top row
   * again — the phone-only fixed positioning above applies only under 48rem. */
  .app__nav {
    position: static;
    padding-block: var(--space-3);
  }

  .app__nav-panel--more {
    position: static;
    max-block-size: none;
    overflow-y: visible;
  }

  .screen {
    padding-block-start: var(--space-5);
  }

  .screen__header {
    margin-block-end: var(--space-4);
  }

  /* On a phone the bar's entries share the row evenly; on a desk they keep their own width. */
  .app__nav-primary {
    flex: 0 1 auto;
  }

  /* The same for a segmented control's options. */
  .segmented__option {
    flex: 0 1 auto;
  }

  .item-row {
    grid-template-columns: 2fr 1fr 1fr auto;
    align-items: end;
    gap: var(--space-3);
  }

  .cards {
    gap: var(--space-4);
  }
}

/* ── «التقارير» (decisions §114) ─────────────────────────────────────────── */

/* A report as it was sent: its line breaks kept, read at a comfortable measure. */
.report__body {
  line-height: 1.7;
}

.screen__subtitle {
  margin-block: var(--space-3) 0;
  font-weight: 600;
}

.section__subtitle {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 1rem;
  font-weight: 600;
}

/* Where a report or a message stands, in words and — beside them — in the status colours. */
.screen--reports .badge--sent {
  border-color: var(--status-positive);
  color: var(--status-positive);
}

.screen--reports .badge--claimed {
  border-color: var(--status-progress);
  color: var(--status-progress);
}

.screen--reports .badge--draft {
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.screen--reports .badge--failed,
.screen--reports .badge--not_sent {
  border-color: var(--status-danger);
  color: var(--status-danger);
}

/* ── The owner's home (decisions §144) ───────────────────────────────────────
 *
 * The design he approved, exactly: a warm grey ground, white columns and cards at 16px with no
 * shadow, one olive button, two pills, hairlines, system-ui only, tabular figures. One page in
 * two layouts — the desk's three columns from 64rem, the phone's cards and one list below it.
 * The app has no dark mode, so the page is light only.
 */
.app:has(> .home) {
  max-inline-size: 90rem;
}

body:has(.home) {
  background-color: #f4f3ef;
}

.home {
  --home-ground: #f4f3ef;
  --home-surface: #ffffff;
  --home-ink: #23211d;
  --home-muted: #77726a;
  --home-rule: #ece9e2;
  --home-primary: #4f5a3a;
  --home-secondary: #f0eee8;
  --home-done-bg: #e9ede1;
  --home-done-ink: #3a4329;
  --home-wait-bg: #f6ebd9;
  --home-wait-ink: #7a4a0e;
  --home-due: #7a4a0e;

  background-color: var(--home-ground);
  color: var(--home-ink);
  font-family: system-ui, sans-serif;
  padding-block: var(--space-4) var(--space-6);
}

.home .num {
  font-variant-numeric: tabular-nums;
}

.home__h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.3;
  font-weight: 700;
}

.home__h2 {
  display: block;
  margin: 0 0 var(--space-3);
  font-size: 1rem;
  font-weight: 700;
}

.home__h3 {
  margin: 0 0 var(--space-2);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--home-muted);
}

.home__count {
  display: inline-block;
  min-inline-size: 1.75rem;
  margin-inline-start: var(--space-2);
  padding-inline: var(--space-2);
  border-radius: var(--radius-pill);
  background-color: var(--tone-wait-bg);
  color: var(--tone-wait-ink);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.home__date {
  margin: 0;
  color: var(--home-muted);
}

.home__muted {
  color: var(--home-muted);
  font-size: 0.875rem;
}

/* §165: a declined charge on «اشتراكاتي». */
.home__warn {
  display: block;
  color: var(--status-warning);
  font-size: 0.875rem;
}

/* §270: «ما يوقف المشروع الآن» — a blocker's tag, in the danger tone and in words. */
.home__stop {
  color: var(--status-danger);
  font-weight: 700;
  font-size: 0.875rem;
}

.home__empty {
  margin: 0;
  color: var(--home-muted);
}

.home__note {
  color: var(--home-due);
  font-size: 0.875rem;
}

.home__unit {
  font-size: 0.875rem;
  color: var(--home-muted);
  font-weight: 400;
}

/* Buttons: one olive, one quiet; never under 44px. */
.home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  min-inline-size: 44px;
  padding-inline: var(--space-4);
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.home-btn--primary {
  background-color: var(--home-primary);
  color: #ffffff;
}

.home-btn--secondary {
  background-color: var(--home-secondary);
  color: var(--home-ink);
}

.home-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.pill {
  display: inline-block;
  padding-block: var(--pill-pad-block);
  padding-inline: var(--space-3);
  border-radius: var(--radius-pill);
  background-color: var(--tone-neutral-bg);
  color: var(--tone-neutral-ink);
  font-size: var(--pill-size);
  font-weight: 600;
  white-space: nowrap;
}

.pill--done {
  background-color: var(--tone-ok-bg);
  color: var(--tone-ok-ink);
}

.pill--waiting {
  background-color: var(--tone-wait-bg);
  color: var(--tone-wait-ink);
}

/* ── The desk ── */
.home__desk {
  display: none;
}

.home__top {
  display: flex;
  gap: var(--space-5);
  align-items: stretch;
  justify-content: space-between;
  margin-block-end: var(--space-5);
}

.home__hello {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
}

.home__ask {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 0 1 26rem;
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.home__ask .home__h2 {
  margin: 0;
}

.home__ask .home-btn {
  align-self: flex-start;
}

.home__textarea,
.home__input {
  inline-size: 100%;
  min-block-size: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--home-rule);
  border-radius: var(--radius);
  background-color: var(--home-ground);
  color: var(--home-ink);
  font: inherit;
  font-size: max(1rem, 16px);
  resize: vertical;
}

.home__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.home__center {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.home__col {
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.home__items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.home__item {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-3);
  border-block-start: 1px solid var(--home-rule);
}

.home__item:first-child {
  border-block-start: 0;
  padding-block-start: 0;
}

.home__item-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  flex: 1 1 12rem;
  min-inline-size: 0;
}

.home__item-title {
  font-weight: 600;
}

.home__amount {
  margin-inline-start: var(--space-2);
  font-weight: 700;
}

.home__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.home__due-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
}

.home__due-amount {
  color: var(--home-due);
  font-weight: 700;
}

/* §157: «تنبيه قطع», a bill's last day, and the sum due. */
.home__cut {
  display: inline-block;
  margin-inline-start: var(--space-2);
  padding-block: var(--pill-pad-block);
  padding-inline: var(--space-3);
  border-radius: var(--radius-pill);
  background-color: var(--tone-danger-bg);
  color: var(--tone-danger-ink);
  font-size: var(--pill-size);
  font-weight: 600;
  white-space: nowrap;
}

.home__deadline {
  color: var(--home-ink);
  font-size: 0.875rem;
}

.home__deadline--warn {
  color: var(--status-warning);
  font-weight: 700;
}

/* §160: «يحتاج قرارك» — a request that waits on his word: its own label says so, in words and
 * in the danger tone, and its title is set heavier; no coloured bar down one edge. */
.home__item--decision .home__item-title {
  font-weight: 700;
}

/* A decision is urgent, not a loss: its label is in the waiting tone, the cut in the danger one. */
.home__item--decision .home__cut {
  background-color: var(--tone-wait-bg);
  color: var(--tone-wait-ink);
}

.home__bills-total {
  margin-block: var(--space-3) 0;
  font-weight: 700;
}

.home__out {
  margin-block-start: var(--space-4);
  padding-block-start: var(--space-4);
  border-block-start: 1px solid var(--home-rule);
}

.home__out-sum {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.home__sanad {
  margin: var(--space-4) 0 0;
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--home-rule);
  color: var(--home-muted);
  font-size: 0.875rem;
}

.home__table {
  inline-size: 100%;
  border-collapse: collapse;
  /* A request breaks between words, never letter by letter («المستود ع» on a phone). */
  overflow-wrap: normal;
}

.home__table th {
  padding-block: var(--space-2);
  border-block-end: 1px solid var(--home-rule);
  color: var(--home-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: start;
}

.home__table td {
  padding-block: var(--space-3);
  padding-inline-end: var(--space-3);
  border-block-end: 1px solid var(--home-rule);
  vertical-align: middle;
}

.home__table .home__table-num {
  text-align: end;
  white-space: nowrap;
  font-weight: 600;
}

/* A state label in a narrow table wraps inside its pill rather than squeezing the request. */
.home__table .pill {
  white-space: normal;
}

.home__totals {
  margin: var(--space-3) 0 0;
  font-weight: 600;
}

.home__tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.home__tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border: 1px solid var(--home-rule);
  border-radius: var(--radius);
}

.home__tile-name {
  color: var(--home-ink);
  font-weight: 700;
  text-decoration: none;
}

.home__tile-news {
  font-size: 0.9375rem;
}

/* ── Sanad's cards (§153): white, rounded, ink and muted, as the rest of the home ── */
.home__sanad-cards .home__h2 {
  margin-block-end: var(--space-2);
}

.home__scards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.home__scard {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
  color: var(--home-ink);
}

.home__scard-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  justify-content: space-between;
}

.home__by {
  font-size: 0.75rem;
  color: var(--home-muted);
}

.home__scard-metric {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.home__scard-body p,
.home__scard-items {
  margin: 0;
}

.home__scard-items {
  padding-inline-start: var(--space-4);
}

.home__scard-foot {
  display: flex;
  justify-content: flex-end;
}

.sanad-diff {
  margin: 0;
  padding-inline-start: var(--space-4);
  font-size: 0.875rem;
}

/* ── The phone ── */
.home__phone {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.home__headline {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.3;
  font-weight: 700;
}

.home__cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.home__card {
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.home__card p {
  margin: 0;
}

.home__card-amount {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.home__card-what {
  margin-block: var(--space-1);
  font-size: 1.0625rem;
}

.home__card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-block-start: var(--space-3);
}

.home__card-actions .home-btn {
  min-block-size: 52px;
}

.home__card-actions .pill,
.home__card-actions .home__note,
.home__card-actions .home__muted {
  grid-column: 1 / -1;
  justify-self: start;
}

.home__list {
  margin: 0;
  padding: 0 var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
  list-style: none;
}

.home__list-line {
  min-block-size: 44px;
  padding-block: var(--space-3);
  border-block-start: 1px solid var(--home-rule);
}

.home__list-line:first-child {
  border-block-start: 0;
}

.home__line-link,
.home__line-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  align-items: baseline;
  justify-content: space-between;
  color: var(--home-ink);
  text-decoration: none;
}

.home__line-row--stack {
  flex-direction: column;
  align-items: flex-start;
}

/* ── The search, on both ── */
.home__search {
  margin-block-start: var(--space-5);
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.home__search-form {
  display: flex;
  gap: var(--space-2);
}

.home__search-form .home__input {
  flex: 1 1 auto;
}

.home__search-form .home-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.home__found {
  display: grid;
  gap: var(--space-4);
  margin-block-start: var(--space-4);
}

.home__found-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.home__link {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  color: var(--home-primary);
  font-weight: 600;
}

.home__foot {
  margin: var(--space-4) 0 0;
  text-align: center;
}

@media (min-width: 64rem) {
  .home__desk {
    display: block;
  }

  .home__phone {
    display: none;
  }

  .home__found {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* §159: «قوائم المستندات المطلوبة» — one paper a line, its status a tap. */
.checklist {
  list-style: none;
  margin: var(--space-2) 0;
  padding: 0;
}

.checklist__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  padding-block: var(--space-1);
}

.checklist__item > button.pill {
  cursor: pointer;
  border: none;
  min-inline-size: 4.5rem;
  /* The paper's status is a tap: a fingertip's 44px, like every other control. */
  min-block-size: 44px;
}

/* ── §200: «اليوم» — one list across the four sections, the rail beside it on the desk ── */
.today {
  display: grid;
  gap: var(--space-4);
  align-items: start;
}

.today__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-inline-size: 0;
}

.today__main .home__search {
  margin-block-start: 0;
}

.today__list,
.today__week {
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.today__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-2);
  font-size: 1.5rem;
  line-height: 1.3;
}

.today__date {
  color: var(--home-muted);
  font-size: 0.9375rem;
  font-weight: 400;
}

.today__rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

/*
 * A row of «اليوم», read in one pass: the line first, at reading size, then one quiet line of
 * where it belongs and when — the section, the day, «حوّلها مهمة» — then the finance manager's
 * two buttons when the row has them. A grid of named areas, so the order on screen does not
 * depend on the order of the markup, and nothing is pushed onto a stray line of its own.
 *
 * The list arrives most urgent first (§229's tiers), so the hierarchy is typographic and needs
 * no box or colour: the first row is set a size and a weight above the rest — the one thing to
 * read if he reads one — and a late row keeps its weight and says «متأخر» in the danger tone.
 */
.today__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "text text text"
    "tag due task"
    "act act act";
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-block-size: 44px;
  padding-block: var(--space-3);
  border-block-start: 1px solid var(--home-rule);
}

.today__row:first-child {
  border-block-start: 0;
  padding-block-start: var(--space-1);
}

/* The section is where the row belongs, said in words: a quiet label, not a tinted chip. */
.today__tag {
  grid-area: tag;
  color: var(--home-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.today__text {
  grid-area: text;
  min-inline-size: 0;
  color: var(--home-ink);
  font-size: 1.0625rem;
  line-height: 1.5;
  text-decoration: none;
}

.today__row:first-child .today__text {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
}

.today__row--late .today__text {
  font-weight: 600;
}

a.today__text:focus-visible {
  outline: 2px solid var(--home-primary);
  outline-offset: 2px;
}

.today__due {
  grid-area: due;
  color: var(--home-muted);
  font-size: 0.875rem;
}

.today__row--late .today__due {
  color: var(--status-danger);
  font-weight: 600;
}

.today__actions {
  grid-area: act;
}

/* §254: «حوّلها مهمة» — quiet, at the end of the row's day line; a fingertip's 44px all the same. */
.today__to-task {
  grid-area: task;
  min-block-size: 44px;
  padding-inline: var(--space-3);
  font-size: 0.8125rem;
}

.today__task-open {
  grid-area: task;
  font-size: 0.8125rem;
}

.today__untasked,
.today__folded {
  margin-block: 0 var(--space-2);
}

/* §522: «N صفاً داخله» — a small count beside a row that folds several; no detail here. */
.today__why {
  display: inline-block;
  margin-inline: 0.4em;
  padding: 0 0.5em;
  border: 1px solid currentColor;
  font-size: 0.78em;
  white-space: nowrap;
}
.today__quiet {
  margin: 0.5em 0;
  padding: 0;
  list-style: none;
}
.today__inside {
  margin-inline-start: var(--space-2);
  color: var(--home-muted);
  font-size: 0.8125rem;
}

.today__more {
  margin-block-start: var(--space-2);
}

.today__week-title {
  min-block-size: 44px;
  font-weight: 600;
  cursor: pointer;
}

/* ── §530: «قائمة الغد» — the widest strip: the day's three, then the week and what was put off ── */
.tomorrow {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
  border-inline-start: 4px solid var(--home-primary);
}

.tomorrow__title {
  margin: 0;
}

.tomorrow__headline {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
}

.tomorrow__lane--small .today__row:first-child .today__text {
  font-size: 1.0625rem;
  font-weight: 400;
}

.tomorrow__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tomorrow__buttons .home-btn {
  min-block-size: 44px;
  padding-inline: var(--space-4);
}

/* ── §489: «مكتب المالك» — «ثلاثة أشياء لا تنتظر», then five boxes over «اليوم»'s own rows ── */
.desk {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.desk__title {
  margin: 0;
}

.desk__urgent,
.desk__box {
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.desk__urgent {
  border-inline-start: 4px solid var(--home-primary);
}

.desk__urgent-title {
  margin: 0 0 var(--space-2);
  font-weight: 700;
}

.desk__urgent-list {
  margin: 0;
  padding-inline-start: var(--space-5);
}

.desk__urgent-item {
  min-block-size: 44px;
  padding-block: var(--space-2);
  line-height: 1.5;
}

.desk__urgent-link {
  color: var(--home-ink);
}

.desk__boxes {
  display: grid;
  gap: var(--space-3);
}

.desk__box-title {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.desk__box--danger .desk__box-title {
  color: var(--status-danger);
}

/* A box's first row is one of several, not the day's one thing to read: set as the others. */
.desk__rows .today__row:first-child .today__text {
  font-size: 1.0625rem;
  font-weight: 400;
}

.desk__gap {
  margin: 0 0 var(--space-2);
}

.desk__rows .desk__person {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "text text text"
    "due due task";
}

.desk__open {
  grid-area: task;
  min-block-size: 44px;
  padding-inline: var(--space-3);
  font-size: 0.8125rem;
}

@media (min-width: 64rem) {
  .desk__boxes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* A box is half the column: its rows keep the phone's three lines, not the desk's one. */
  .desk__rows .today__row:not(.desk__person) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "text text text"
      "tag due task"
      "act act act";
  }
}

.today__aside,
.today__desk-only,
.today__week {
  display: none;
}

.today__row--more {
  display: none;
}

.today__rows--all .today__row--more {
  display: grid;
}

.rail__tile {
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.rail__name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0 0 var(--space-1);
  font-size: 1.125rem;
}

.rail__count {
  min-inline-size: 1.75rem;
  padding-inline: var(--space-2);
  border-radius: var(--radius-pill);
  background-color: var(--home-primary);
  color: #ffffff;
  font-size: 0.875rem;
  text-align: center;
}

.rail__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail__topic {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  color: var(--home-primary);
  font-size: 0.9375rem;
}

@media (min-width: 64rem) {
  .today {
    grid-template-columns: minmax(0, 1fr) 19rem;
  }

  .today__aside {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .today__rail {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .today__desk-only {
    display: block;
  }

  .home__top.today__desk-only {
    display: flex;
  }

  .today__week {
    display: block;
  }

  .today__row--more {
    display: grid;
  }

  /* The desk has the width for one line a row: the section in a column of its own, so the
   * labels line up down the list, then the line, its day, and the two actions. */
  .today__row {
    grid-template-columns: 5.5rem minmax(0, 1fr) auto auto auto;
    grid-template-areas: "tag text due task act";
  }

  .today__more {
    display: none;
  }

  .today__actions {
    justify-self: end;
  }
}

/* ── §201: a section's page, where a page sits, and the phone's bottom bar ── */
.section__cards {
  display: grid;
  gap: var(--space-4);
  align-items: start;
}

.section__topic {
  margin: 0 0 var(--space-2);
  font-size: 1.25rem;
  line-height: 1.3;
}

.section__card .home__out:first-of-type {
  margin-block-start: 0;
}

/*
 * The cards a section adds after its topics («بريد يستحق», «عائلة واحدة», «خط الطلبات الواردة»,
 * «ملفات الناس») are the same object as the topics above them: a white surface at the surface
 * radius, the same gap between them, and a heading at the topic's size. One drew as a bare
 * hairline block, another as a card, each with a smaller heading than the topics beside it.
 */
.home.section > .home__out,
.home.section > .home__col {
  margin-block-start: var(--space-4);
  padding: var(--space-4);
  border-block-start: 0;
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.home.section > .home__out > .home__h2,
.home.section > .home__col > .home__h2 {
  font-size: 1.25rem;
  line-height: 1.3;
}

.section__all {
  margin: var(--space-4) 0 0;
  text-align: center;
}

.secbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-block: var(--space-2);
}

.secbar__tabs {
  display: none;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.secbar__tab {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding-inline: var(--space-3);
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.secbar__tab[aria-current="page"] {
  background-color: var(--accent);
  color: var(--accent-contrast);
}

.crumbs__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.crumbs__item + .crumbs__item::before {
  content: "‹";
  margin-inline-end: var(--space-1);
  color: var(--ink-muted);
}

/* On a phone the crumbs are the way back up a section: each link a fingertip's 44px. */
.crumbs__link {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  color: var(--accent);
}

.crumbs__list {
  align-items: center;
}

.crumbs__item [aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.tabbar {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-block-end: env(safe-area-inset-bottom, 0px);
  border-block-start: 1px solid var(--rule);
  background-color: var(--surface);
}

.tabbar__tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-block-size: 52px;
  padding-inline: var(--space-1);
  color: var(--ink-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.tabbar__tab[aria-current="page"] {
  color: var(--accent);
  box-shadow: inset 0 3px 0 var(--accent);
}

.app--tabs {
  padding-block-end: calc(68px + env(safe-area-inset-bottom, 0px));
}

.rail__link {
  color: inherit;
  text-decoration: none;
}

@media (min-width: 64rem) {
  .section__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .secbar__tabs {
    display: flex;
  }

  .tabbar {
    display: none;
  }

  .app--tabs {
    padding-block-end: var(--space-6);
  }
}

/* §227: «خط زمن المشروع» — a tag an event, a fold a month, a strip of his contractors. */
.timeline__tag {
  font-weight: 600;
}
.timeline__month > summary {
  min-block-size: 44px;
  padding-block: var(--space-2);
  cursor: pointer;
  list-style-position: inside;
}
.timeline__quiet {
  color: var(--status-warning);
}

/* §261: «داخل مقابل خارج» — two halves, side by side on the desk, one under the other on a phone. */
.inout {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}

.inout__half {
  min-inline-size: 0;
  padding-block-start: var(--space-2);
  border-block-start: 1px solid var(--rule);
}

.inout__h4 {
  margin-block-start: var(--space-3);
}

@media (min-width: 48rem) {
  .inout {
    grid-template-columns: 1fr 1fr;
  }
}

/* اقتراح سند ١٠٩: «الخريطة الشهرية» — seven resource slots, side by side where they fit. */
.mmap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-3);
  margin-block-end: var(--space-3);
}

.mmap__slot {
  padding: var(--space-3);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.mmap__name {
  margin: 0 0 var(--space-1);
  font-size: 0.875rem;
  font-weight: 700;
}

/*
 * §309: «داشبورد» atop his home — four tiles on one surface, big → medium → small. The order and
 * the scale of each headline carry the hierarchy, not boxes or colour: no tile has a border, a
 * fill or a shadow of its own, only space between them. A headline is a tabular figure set large;
 * its words and its unit are quiet. The danger tone is only on what stops him, and the words say
 * it too. One column on the phone, two by two on the desk.
 */
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  margin-block-end: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-surface);
  background-color: var(--home-surface);
}

.dash--quiet {
  padding-block: var(--space-3);
}

.dash__tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-inline-size: 0;
}

.dash__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.dash__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: 44px;
  color: var(--home-muted);
  text-decoration: none;
}

.dash__go {
  color: var(--home-primary);
  font-weight: 700;
}

.dash__head {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.dash__tile--big .dash__head {
  font-size: 2rem;
}

.dash__tile--medium .dash__head {
  font-size: 1.5rem;
}

/* A state written in words (what stops him, who waits) reads at the size of a line's lead. */
.dash__tile--small .dash__head--state {
  font-size: 1.125rem;
}

.dash__pair {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  white-space: nowrap;
}

.dash__word {
  color: var(--home-muted);
  font-size: 0.5em;
  font-weight: 600;
}

.dash__fig {
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

.dash__sep {
  margin-inline: 0.4em;
  color: var(--home-muted);
  font-weight: 400;
}

.dash__unit {
  margin-inline-start: 0.4em;
  color: var(--home-muted);
  font-size: 0.45em;
  font-weight: 400;
}

.dash__lines {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.dash__lines--after {
  margin-block-start: var(--space-1);
}

/* §312: «عليك»'s three parts, a quiet line under it; «منه رأس مال مستثمرين» quiet too. */
.dash__breakdown {
  display: block;
  color: var(--home-muted);
  font-size: 0.8125rem;
}

.dash__aside-line {
  color: var(--home-muted);
  font-size: 0.875rem;
}

.dash__aside {
  margin-inline-start: var(--space-2);
  color: var(--home-muted);
  font-size: 0.875rem;
}

.dash__projects {
  gap: var(--space-3);
  margin-block-start: var(--space-2);
}

.dash__project {
  display: grid;
  gap: 0;
}

.dash__name {
  font-weight: 600;
}

.dash__meta {
  color: var(--home-muted);
  font-size: 0.875rem;
}

.dash__danger {
  color: var(--status-danger);
  font-weight: 700;
}

.dash__project .dash__danger {
  font-size: 0.875rem;
}

.dash__quiet,
.dash__empty {
  margin: 0;
  color: var(--home-muted);
}

@media (min-width: 64rem) {
  .dash {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5) var(--space-6);
    padding: var(--space-5) var(--space-6);
  }

  .dash--quiet {
    grid-template-columns: minmax(0, 1fr);
    padding-block: var(--space-3);
  }

  .dash__tile--big .dash__head {
    font-size: 2.25rem;
  }
}

/*
 * «واجهة سند» (decisions §511): the owner's view of Sanad. Everything is scoped under `.sn`, so
 * nothing here can move a pixel of the rest of the application.
 *
 * Colour means one thing each: ink (text and the decision room), paper (the day), lemon (healthy,
 * done, level 1), violet (level 2), orange (leaves the house, level 3), ice (money), amber (a
 * fault). There is no red anywhere: colour never shouts, and every meaning is also said in words.
 * Motion is transform and opacity only, and stops when the device asks for less motion. Typefaces
 * fall back to the vendored IBM Plex Sans Arabic until the display faces are vendored too (the
 * Content Security Policy allows only this origin's fonts).
 */

.sn {
  --sn-ink: #16140f;
  --sn-paper: #f2ecdb;
  --sn-raised: #fbf8ee;
  --sn-sand: #e7e0cb;
  --sn-lemon: #c9e65a;
  --sn-violet: #b7a6f2;
  --sn-orange: #f26b3a;
  --sn-ice: #b9d2ec;
  --sn-amber: #e9b949;
  --sn-text-2: #3e3a2e;
  --sn-text-3: #5b5547;
  --sn-line: rgba(22, 20, 15, 0.12);
  --sn-display: "Alexandria", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --sn-brand: "Reem Kufi", "Alexandria", "IBM Plex Sans Arabic", system-ui, sans-serif;

  min-height: 100dvh;
  box-sizing: border-box;
  background: var(--sn-paper);
  color: var(--sn-ink);
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.75;
}

.sn *,
.sn *::before,
.sn *::after {
  box-sizing: border-box;
}
.sn .num {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}
:where(.sn) a {
  color: inherit;
}
.sn :focus-visible {
  outline: 3px solid var(--sn-ink);
  outline-offset: 2px;
}
.sn-room :focus-visible,
.sn-pulse :focus-visible {
  outline-color: var(--sn-lemon);
}

/* The pulse: always on top, always the same. */
.sn-pulse {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--sn-ink);
  color: var(--sn-paper);
  border-radius: 0 0 22px 22px;
}
.sn-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  height: 2.2rem;
  padding: 0 0.7rem 0.25rem;
  border-radius: 12px;
  background: var(--sn-lemon);
  color: var(--sn-ink);
  font-family: var(--sn-brand);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
}
.sn-pulse__state {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-weight: 600;
  color: var(--sn-lemon);
}
.sn-pulse.is-attention .sn-pulse__state {
  color: var(--sn-amber);
}
.sn-pulse__log {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.9rem;
  border: 1px solid rgba(242, 236, 219, 0.32);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}

.sn-main {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1rem 6.5rem;
}

/* Headings */
.sn-h1 {
  margin: 0;
  font-family: var(--sn-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.5;
}
.sn-h2 {
  margin: 0;
  font-family: var(--sn-display);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.6;
}
.sn-h3 {
  margin: 0;
  font-family: var(--sn-display);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.7;
}
.sn-note {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--sn-text-3);
}
.sn-src {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--sn-text-3);
}
.sn-empty {
  margin: 0;
  color: var(--sn-text-2);
}
.sn-more {
  margin: 0;
  font-weight: 600;
}
.sn-page-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-top: 0.5rem;
}

/* The verdict */
.sn-hero {
  position: relative;
  overflow: hidden;
  padding: 1.4rem 1.3rem 1.2rem;
  border-radius: 30px;
  background:
    radial-gradient(120% 90% at 85% 0%, #eaf79a 0%, rgba(234, 247, 154, 0) 60%),
    radial-gradient(90% 80% at 0% 100%, #80d4b0 0%, rgba(128, 212, 176, 0) 70%),
    linear-gradient(135deg, #c9e65a 0%, #a2de9e 100%);
}
.sn-hero--decisions {
  background:
    radial-gradient(110% 90% at 12% 0%, #d8cdfa 0%, rgba(216, 205, 250, 0) 60%),
    linear-gradient(135deg, #c9e65a 0%, #b7a6f2 100%);
}
.sn-hero--attention {
  background:
    radial-gradient(120% 90% at 85% 0%, #f7e2a4 0%, rgba(247, 226, 164, 0) 60%),
    linear-gradient(135deg, #e9b949 0%, #f3d27e 100%);
}
.sn-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: radial-gradient(circle, var(--sn-ink) 1px, transparent 1.7px);
  background-size: 9px 9px;
  -webkit-mask-image: linear-gradient(200deg, #000 0%, transparent 60%);
  mask-image: linear-gradient(200deg, #000 0%, transparent 60%);
}
.sn-hero > * {
  position: relative;
  z-index: 1;
}
.sn-hero__day {
  margin: 0;
  font-weight: 600;
  color: var(--sn-text-2);
}
.sn-hero__title {
  margin: 0.2rem 0 0;
  font-family: var(--sn-display);
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1.4;
  text-wrap: balance;
}
.sn-hero__detail {
  margin: 0.3rem 0 0;
  color: var(--sn-text-2);
}
.sn-hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}
.sn-hero__facts b {
  font-family: var(--sn-display);
  font-size: 1.15rem;
}
.sn-outbound {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
  border-radius: 20px;
  background: var(--sn-ink);
  color: var(--sn-paper);
}
.sn-outbound__n {
  flex: none;
  font-family: var(--sn-display);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  color: var(--sn-lemon);
}
.sn-outbound span {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #cfc8b4;
}
.sn-outbound b {
  display: block;
  color: var(--sn-paper);
}

/* Sections and cards */
.sn-section {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.sn-section__head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
.sn-count {
  display: inline-flex;
  min-width: 1.9rem;
  height: 1.9rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--sn-orange);
  color: var(--sn-ink);
  font-family: var(--sn-display);
  font-size: 0.95rem;
}
.sn-card {
  padding: 1rem 1.1rem;
  border-radius: 26px;
  background: var(--sn-raised);
  border: 1px solid var(--sn-line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sn-card p {
  margin: 0;
}
.sn-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sn-list--cards {
  gap: 0.8rem;
}
.sn-row {
  padding: 0.7rem 0.9rem;
  border-radius: 18px;
  background: var(--sn-raised);
  border: 1px solid var(--sn-line);
  display: flex;
  flex-direction: column;
}
.sn-card .sn-row {
  background: var(--sn-paper);
}
.sn-row__link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  min-height: 44px;
  justify-content: center;
}
.sn-row__title {
  font-weight: 600;
}
.sn-row__meta {
  font-size: 0.875rem;
  color: var(--sn-text-3);
}
.sn-late {
  color: var(--sn-ink);
  background: var(--sn-amber);
  border-radius: 6px;
  padding: 0 0.35rem;
}
.sn-sums {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
  margin: 0;
  font-size: 0.9375rem;
}
.sn-big {
  margin: 0;
  font-family: var(--sn-display);
  font-weight: 800;
  font-size: 1.7rem;
  line-height: 1.4;
}

/* The deck of decisions */
.sn-deck {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sn-decision {
  padding: 1rem 1.1rem;
  border-radius: 26px;
  background: var(--sn-raised);
  border: 1px solid var(--sn-line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sn-decision.is-primary {
  background: var(--sn-ink);
  color: var(--sn-paper);
  border-color: var(--sn-ink);
}
.sn-decision__kind {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}
.sn-decision__title {
  margin: 0;
  font-family: var(--sn-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.7;
}
.sn-decision__text {
  margin: 0;
  color: #d8d1bd;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}
.sn-worst {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 16px;
  background: rgba(242, 236, 219, 0.1);
  font-size: 0.9375rem;
}
.sn-worst b {
  color: var(--sn-lemon);
}
.sn-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  background: rgba(22, 20, 15, 0.08);
  font-size: 0.8125rem;
  font-weight: 700;
}
.sn-chip--internal {
  background: var(--sn-lemon);
  color: var(--sn-ink);
}
.sn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.3rem;
}
.sn-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.2rem;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.sn-button--primary {
  background: var(--sn-lemon);
  border-color: var(--sn-lemon);
  color: var(--sn-ink);
}
.sn-button--ghost {
  border-color: rgba(242, 236, 219, 0.4);
}
.sn-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* The decision room: dark on purpose, so the body knows this one is different. */
.sn-room {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.3rem 1.2rem;
  border-radius: 30px;
  background: var(--sn-ink);
  color: var(--sn-paper);
}
.sn-room__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-weight: 600;
  color: #cfc8b4;
}
.sn-room__steps {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}
.sn-room__steps li {
  padding: 0.15rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(242, 236, 219, 0.3);
  color: #cfc8b4;
}
.sn-room__steps li.is-on {
  background: var(--sn-lemon);
  border-color: var(--sn-lemon);
  color: var(--sn-ink);
  font-weight: 700;
}
.sn-room__title {
  margin: 0;
  font-family: var(--sn-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.55;
}
.sn-room__block {
  padding: 0.9rem 1rem;
  border-radius: 20px;
  background: #1b1a16;
}
.sn-room__block p {
  margin: 0.2rem 0 0;
}
.sn-room__block .sn-src {
  color: #a39c88;
}
.sn-room__block--worst {
  border: 1px solid rgba(233, 185, 73, 0.5);
}
.sn-room__block--worst .sn-h3 {
  color: var(--sn-amber);
}
.sn-actions--room {
  justify-content: center;
}
.sn-room .sn-note {
  color: #a39c88;
}
.sn-empty-room {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 2rem 1rem;
  text-align: center;
}

/* Approval by holding */
.sn-hold {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.sn-hold__button {
  position: relative;
  overflow: hidden;
  min-height: 64px;
  border: 2px solid var(--sn-lemon);
  border-radius: 999px;
  background: transparent;
  color: var(--sn-paper);
  font: inherit;
  font-family: var(--sn-display);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.sn-hold__fill {
  position: absolute;
  inset: 0;
  background: var(--sn-lemon);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.15s ease-out;
}
.sn-hold__button.is-holding .sn-hold__fill {
  transform: scaleX(1);
  transition: transform var(--hold-ms, 1200ms) linear;
}
.sn-hold__label {
  position: relative;
  z-index: 1;
  mix-blend-mode: normal;
}
.sn-hold__button.is-holding .sn-hold__label {
  color: var(--sn-ink);
}
.sn-hold__button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sn-undo {
  position: sticky;
  bottom: 5.5rem;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 20px;
  background: var(--sn-lemon);
  color: var(--sn-ink);
  font-weight: 600;
}
.sn-undo small {
  display: block;
  font-weight: 400;
  color: var(--sn-text-2);
}
.sn-undo__button {
  min-height: 44px;
  padding: 0 1.1rem;
  border: 1.5px solid var(--sn-ink);
  border-radius: 999px;
  background: transparent;
  color: var(--sn-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.sn-banner {
  margin: 0;
  padding: 0.7rem 1rem;
  border-radius: 18px;
  background: var(--sn-lemon);
  font-weight: 600;
}
.sn-banner--warn {
  background: var(--sn-amber);
}

/* What Sanad did: one dot per event */
.sn-dots {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  max-width: 24rem;
}
.sn-dot {
  display: inline-block;
  width: 100%;
  aspect-ratio: 1;
  max-width: 18px;
  border-radius: 50%;
}
.sn-dot--read {
  background: rgba(22, 20, 15, 0.5);
}
.sn-dot--proposed {
  background: var(--sn-orange);
}
.sn-dot--done {
  background: var(--sn-lemon);
  border: 1.5px solid var(--sn-ink);
}
.sn-dot--waiting {
  background: var(--sn-violet);
}
.sn-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--sn-text-3);
}
.sn-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.sn-legend .sn-dot {
  width: 12px;
}
.sn-sentence {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--sn-text-2);
}

/* The chain of health */
.sn-chain {
  padding: 1rem 1.1rem;
  border-radius: 26px;
  background: var(--sn-raised);
  border: 1px solid var(--sn-line);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.sn-chain__links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sn-chain__link {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.8rem;
  border-radius: 16px;
  background: var(--sn-ink);
  color: var(--sn-paper);
}
.sn-chain__link span {
  font-size: 0.875rem;
  color: var(--sn-lemon);
}
.sn-chain__link small {
  color: #cfc8b4;
}
.sn-chain__link.is-broken {
  background: var(--sn-amber);
  color: var(--sn-ink);
}
.sn-chain__link.is-broken span,
.sn-chain__link.is-broken small {
  color: var(--sn-ink);
}
.sn-chain__link.is-unknown span {
  color: #cfc8b4;
}
.sn-relink .sn-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sn-relink .sn-steps li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.sn-step {
  display: inline-flex;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--sn-lemon);
  font-family: var(--sn-display);
}

.sn-foot {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--sn-text-3);
}
.sn-foot p {
  margin: 0;
}

/* The bottom bar: four destinations, one thumb. */
.sn-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  padding: 0.5rem 0.8rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: var(--sn-ink);
  color: #cfc8b4;
  border-radius: 22px 22px 0 0;
}
.sn .sn-nav__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 56px;
  border-radius: 16px;
  color: #cfc8b4;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
}
.sn-nav__item.is-active {
  background: var(--sn-lemon);
  color: var(--sn-ink);
}
.sn-badge {
  position: absolute;
  top: 4px;
  inset-inline-start: 22%;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--sn-orange);
  color: var(--sn-ink);
  font-size: 0.75rem;
  line-height: 1.2rem;
  text-align: center;
}

@media (min-width: 900px) {
  .sn-main {
    max-width: 46rem;
  }
  .sn-nav {
    max-width: 36rem;
    margin-inline: auto;
  }
}

/* The hold's fill is progress, not decoration, so it keeps its transition under reduced motion. */

.sn-aside {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.sn-trail {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}
.sn-room-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* A wide screen: the four destinations down the right edge, the room beside what it came from. */
@media (min-width: 1100px) {
  .sn {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: start;
  }
  .sn-pulse {
    grid-column: 1 / -1;
    grid-row: 1;
    padding-inline: 2rem;
  }
  .sn-nav {
    position: sticky;
    top: 5rem;
    bottom: auto;
    inset-inline: auto;
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    width: 5.6rem;
    max-width: none;
    margin: 1rem;
    padding: 0.6rem;
    border-radius: 28px;
  }
  .sn-main {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    max-width: 68rem;
    margin: 0 auto;
    padding: 1.2rem 1.5rem 3rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
    align-items: start;
  }
  .sn-hero,
  .sn-page-head,
  .sn-banner,
  .sn-room-layout,
  .sn-foot,
  .sn-undo,
  .sn-empty-room,
  .sn-chain,
  .sn-relink,
  .sn-main > .sn-note {
    grid-column: 1 / -1;
  }
  .sn-room-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22rem;
    align-items: start;
  }
  .sn-undo {
    bottom: 1rem;
  }
}

/* The outgoing-message room (§543): read-only, the text as it was written */
.sn-outbox__body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0.4rem 0;
}
.sn-outbox__to {
  margin: 0;
}
