/* Copyright 2026 The Domus Authors
 * Licensed under the Apache License, Version 2.0
 *
 * ── Dossier technique ───────────────────────────────────────────────────
 *
 * The subject is a house's technical file: quotes, a maintenance logbook,
 * incidents, the trades who did the work. The vocabulary comes from that
 * world -- the dimensioned drawing, the workshop card, the ink stamp --
 * rather than from cosy stationery.
 *
 * Colour: a cool tracing-paper ground, graphite ink, and one
 * administrative blue. Red is the corrector's pencil and is spent only on
 * what is wrong or about to be destroyed.
 *
 * Type: two roles, strictly kept. Sans for prose. Monospace for every
 * measured thing -- amounts, dates, counts, column headings, identifiers,
 * keys. It is the instrument face: it makes digits align for real, and it
 * gives a records application a precision that a lone sans cannot.
 *
 * Layout: a navigation rail (the file's contents page), a page heading,
 * and a ruled table -- hairlines and white space rather than boxes inside
 * boxes. Corners are 3px: this is a drawing, not a bubble.
 *
 * Semantic colour (money, urgency) stays separate from the accent and
 * keeps the colourblind-safe hue separation it had.
 */

:root {
  /* Neutrals are biased cool, toward the accent, so they read as chosen
   * rather than as the grey that comes out of the box. */
  --ground: #e8ecf0;
  --sheet: #ffffff;
  --sheet-2: #f4f7f9;
  --sheet-3: #e4e9ee;
  --graphite: #14181f;
  --pencil: #59636f;
  --faint: #8a939e;
  --rule: #dbe2e8;
  --rule-firm: #c2ccd6;

  --encre: #2f4f8f;
  --encre-deep: #223c70;
  --encre-wash: #e6ecf7;
  --on-encre: #ffffff;

  --money: #0f6b52;
  --rouge: #bc372a;
  --rouge-wash: #fbeae8;
  --ambre: #8a5a00;
  --ambre-wash: #fbf2df;

  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --rail-w: 232px;
  --row-h: 44px;
  --r: 3px;
  --lift: 0 1px 2px rgb(20 24 31 / .05);
  --lift-high: 0 12px 40px -8px rgb(20 24 31 / .28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #10141a;
    --sheet: #181d25;
    --sheet-2: #1e242d;
    --sheet-3: #273039;
    --graphite: #e7ecf1;
    --pencil: #a3aeba;
    --faint: #78838f;
    --rule: #262f39;
    --rule-firm: #38434f;

    --encre: #7ba7e8;
    --encre-deep: #9dbef0;
    --encre-wash: #16233a;
    --on-encre: #0d1420;

    --money: #3fbf95;
    --rouge: #f0806e;
    --rouge-wash: #2c1714;
    --ambre: #d9a441;
    --ambre-wash: #2a2110;

    --lift: 0 1px 2px rgb(0 0 0 / .5);
    --lift-high: 0 12px 40px -8px rgb(0 0 0 / .7);
  }
}

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

/* The `hidden` attribute is only `display: none` in the user-agent sheet,
 * so any author rule that sets `display` beats it. Without this the shell,
 * the sign-in screen and the dialog all render at once. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--graphite);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.mono, .count, kbd, td.money, td.date, td.int, td.float,
table.grid thead th, .metric, .tally-n {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

button, input, select, textarea { font: inherit; color: inherit; }

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

.boot {
  display: grid; place-items: center; height: 100dvh;
  color: var(--faint); font-family: var(--mono); font-size: 13px;
  letter-spacing: .08em; text-transform: uppercase;
}

/* ── controls ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .48rem .85rem; border-radius: var(--r);
  border: 1px solid var(--rule-firm); background: var(--sheet);
  color: var(--graphite); font-size: .875rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: var(--encre); color: var(--encre); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--encre); border-color: var(--encre); color: var(--on-encre);
  font-weight: 550;
}
.btn-primary:hover {
  background: var(--encre-deep); border-color: var(--encre-deep); color: var(--on-encre);
}

.btn-danger { color: var(--rouge); border-color: var(--rule-firm); }
.btn-danger:hover { border-color: var(--rouge); background: var(--rouge-wash); color: var(--rouge); }

.btn-ghost { background: none; border-color: transparent; color: var(--pencil); }
.btn-ghost:hover { background: var(--sheet-3); border-color: transparent; color: var(--graphite); }

.btn-sm { padding: .25rem .5rem; font-size: .8125rem; }
.btn-block { width: 100%; padding: .62rem; }

.badge {
  font-family: var(--mono); font-size: .6875rem; letter-spacing: .06em;
  text-transform: uppercase; padding: .18em .5em; border-radius: 2px;
}
.badge-warn { color: var(--ambre); background: var(--ambre-wash); }

/* ── sign-in ─────────────────────────────────────────────────────────── */
.login { display: grid; place-items: center; min-height: 100dvh; padding: 1.5rem; }
.login-card {
  width: min(24rem, 100%);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--encre);
  border-radius: var(--r);
  box-shadow: var(--lift);
  padding: 2.25rem 2rem 2rem;
  display: flex; flex-direction: column; gap: 1.1rem;
}
.login-mark {
  margin: 0; font-family: var(--mono); font-size: .75rem; font-weight: 600;
  letter-spacing: .28em; color: var(--encre);
}
.login-card h1 {
  margin: 0 0 .4rem; font-size: 1.5rem; font-weight: 600;
  letter-spacing: -.018em; text-wrap: balance;
}
.login-card .btn { margin-top: .3rem; }

.notice {
  margin: 0; padding: .6rem .75rem; font-size: .875rem; border-radius: var(--r);
  border-left: 3px solid currentColor;
}
.notice-bad { color: var(--rouge); background: var(--rouge-wash); }

/* ── shell ───────────────────────────────────────────────────────────── */
.app { display: flex; height: 100dvh; }

.rail {
  flex: none; width: var(--rail-w);
  display: flex; flex-direction: column;
  background: var(--sheet); border-right: 1px solid var(--rule);
}

.rail-head { padding: 1.15rem 1.15rem .9rem; }
.brand {
  display: flex; flex-direction: column; gap: .15rem; align-items: flex-start;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left; width: 100%;
}
.brand-mark {
  font-family: var(--mono); font-size: .9375rem; font-weight: 700;
  letter-spacing: .22em; color: var(--graphite);
}
.brand-sub {
  font-size: .8125rem; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.brand:hover .brand-mark { color: var(--encre); }

.rail-nav {
  flex: 1; overflow-y: auto; padding: .25rem .6rem;
  display: flex; flex-direction: column; gap: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .55rem; border: 0; border-radius: var(--r);
  background: none; color: var(--pencil); font-size: .9375rem;
  cursor: pointer; text-align: left; width: 100%;
}
.nav-item:hover { background: var(--sheet-2); color: var(--graphite); }
.nav-item[aria-current="true"] {
  background: var(--encre-wash); color: var(--encre); font-weight: 550;
}
/* A tick in the margin marks the open section -- the mark you would put
 * beside a line in a contents page. */
.nav-item::before {
  content: ""; width: 2px; height: 1.05em; border-radius: 1px;
  background: transparent; flex: none;
}
.nav-item[aria-current="true"]::before { background: var(--encre); }

.rail-foot {
  padding: .7rem .9rem 1rem; border-top: 1px solid var(--rule);
  display: flex; flex-direction: column; align-items: flex-start; gap: .1rem;
}
.rail-foot .badge { margin-bottom: .45rem; }
.rail-link {
  background: none; border: 0; padding: .3rem 0; cursor: pointer;
  color: var(--pencil); font-size: .8125rem; text-align: left;
}
.rail-link:hover { color: var(--encre); text-decoration: underline; text-underline-offset: 2px; }

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

.page {
  flex: none; display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; padding: 1.5rem 1.75rem 1.1rem;
}
.page-id { min-width: 0; }
.page h1 {
  margin: 0; font-size: 1.75rem; font-weight: 600;
  letter-spacing: -.022em; line-height: 1.15; text-wrap: balance;
}
.page-tools { display: flex; align-items: center; gap: 1rem; flex: none; }

.crumbs {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .8125rem; color: var(--faint); margin-bottom: .3rem;
}
.crumbs:empty { display: none; }
.crumbs button {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--encre); font-size: inherit;
}
.crumbs button:hover { text-decoration: underline; text-underline-offset: 2px; }

.check {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--pencil); font-size: .8125rem; cursor: pointer; user-select: none;
}
.count { color: var(--faint); font-size: .8125rem; }

.pins {
  flex: none; display: flex; flex-wrap: wrap; gap: .4rem;
  padding: 0 1.75rem .9rem;
}
.pin {
  font-family: var(--mono); font-size: .75rem; padding: .22em .5em;
  border: 1px dashed var(--encre); color: var(--encre);
  border-radius: 2px; background: var(--encre-wash); cursor: pointer;
}
.pin.negated { border-color: var(--rouge); color: var(--rouge); background: var(--rouge-wash); }
.pin::after { content: " ×"; opacity: .65; }

.content { flex: 1; overflow: auto; padding: 0 1.75rem 2rem; }

.statusbar {
  flex: none; min-height: 28px; padding: .25rem 1.75rem;
  display: flex; align-items: center;
  border-top: 1px solid var(--rule); background: var(--sheet);
  font-size: .8125rem; color: var(--faint);
}

/* ── the ruled table ─────────────────────────────────────────────────── */
/* Hairlines and white space, not a box inside a box. The sheet reaches
 * the full width of the content column, the way a drawing fills its
 * frame. */
.grid-wrap {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: auto;
}
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; }

table.grid thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--sheet); border-bottom: 1px solid var(--rule-firm);
  padding: 0 .9rem; height: 38px; text-align: left; white-space: nowrap;
  font-size: .6875rem; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--faint);
  cursor: pointer; user-select: none;
}
table.grid thead th:hover { color: var(--encre); }
table.grid thead th .sort { color: var(--encre); margin-left: .35rem; }
table.grid thead th.actions-head { cursor: default; }
table.grid thead th.actions-head:hover { color: var(--faint); }

table.grid td {
  padding: 0 .9rem; height: var(--row-h); text-align: left;
  border-bottom: 1px solid var(--rule); white-space: nowrap;
  max-width: 26rem; overflow: hidden; text-overflow: ellipsis;
  color: var(--pencil); font-size: .875rem;
}
/* The first column names the record; everything after it is supporting
 * detail, and is set quieter so a scan lands on the names. */
table.grid td:first-child {
  color: var(--graphite); font-size: .9375rem; font-weight: 500;
}
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover td { background: var(--sheet-2); }
table.grid tbody tr[aria-selected="true"] td { background: var(--encre-wash); }
table.grid tr.deleted td { color: var(--faint); }
table.grid tr.deleted td:first-child { color: var(--faint); text-decoration: line-through; }

td.money { color: var(--money); text-align: right; font-weight: 500; }
td.int, td.float { text-align: right; }
td.date { font-size: .8125rem; }
td.ref { color: var(--encre); }
td.bool, td.longtext { color: var(--faint); }
/* Supporting prose yields width to the columns that are scanned. */
td.longtext { max-width: 19rem; }

/* The cell cursor is a tick in the margin, the same mark the rail uses
 * for the open section. A drawn frame around a cell reads as an input
 * box, which is the one thing it is not. */
table.grid td.cell-cursor { box-shadow: inset 2px 0 0 var(--encre); }

/* One control per row, pinned to the right edge so it stays reachable
 * however wide the table gets and whatever it is scrolled to. */
td.actions, th.actions-head {
  position: sticky; right: 0; z-index: 2;
  width: 1%; white-space: nowrap; text-align: right; padding-right: .6rem;
  background: var(--sheet);
  /* A cast shadow rather than a rule: it says the columns continue
   * underneath, so a half-visible one reads as scrollable rather than
   * broken. */
  box-shadow: -8px 0 8px -8px rgb(20 24 31 / .25), inset 1px 0 0 var(--rule);
}
tr:hover td.actions { background: var(--sheet-2); }
tr[aria-selected="true"] td.actions { background: var(--encre-wash); }
.btn-row {
  padding: .1rem .35rem; font-size: 1.05rem; line-height: 1.2;
  color: var(--faint); border-radius: var(--r);
}
.btn-row:hover { color: var(--encre); background: var(--sheet-3); }
.row-word { display: none; }

/* Status reads as a filled chip. An outline at this size is a thin ring
 * that the eye has to resolve before it can read the word. */
.chip {
  display: inline-block; font-family: var(--mono);
  font-size: .6875rem; font-weight: 600; letter-spacing: .04em;
  padding: .25em .55em; border-radius: 2px;
  background: var(--sheet-3); color: var(--pencil);
}
.chip-bad { background: var(--rouge-wash); color: var(--rouge); }
.chip-warn { background: var(--ambre-wash); color: var(--ambre); }
.chip-good { background: color-mix(in srgb, var(--money) 12%, transparent); color: var(--money); }
.chip-info { background: var(--encre-wash); color: var(--encre); }

.empty {
  padding: 4rem 1.5rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .7rem;
}
.empty strong { font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
.empty span { color: var(--pencil); max-width: 34rem; }
.empty .btn { margin-top: .6rem; }

/* ── dashboard ───────────────────────────────────────────────────────── */
/* Summary before detail: the tally answers "how much is outstanding" in
 * one line, and the cards below say what. */
.tally {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  border-radius: var(--r); overflow: hidden; margin-bottom: 1.25rem;
}
.tally-cell {
  background: var(--sheet); padding: .95rem 1.1rem;
  display: flex; flex-direction: column; gap: .1rem;
  border: 0; text-align: left; cursor: pointer; font: inherit;
}
.tally-cell:hover { background: var(--sheet-2); }
.tally-n { font-size: 1.875rem; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.tally-cell.is-quiet .tally-n { color: var(--faint); }
.tally-cell.is-open .tally-n { color: var(--graphite); }
.tally-cell.is-bad .tally-n { color: var(--rouge); }
.tally-k {
  font-size: .75rem; color: var(--pencil); letter-spacing: .01em;
}

/* Flowing columns rather than a grid: the cards are wildly different
 * heights, and a grid leaves a column standing empty beside the tallest
 * one. Reading order stays priority order, top of one column to the
 * next. */
.dash { columns: 22rem 3; column-gap: 1.25rem; }
.card {
  background: var(--sheet); border: 1px solid var(--rule);
  border-radius: var(--r); overflow: hidden;
  break-inside: avoid; margin-bottom: 1.25rem;
}
.card h3 {
  margin: 0; padding: .75rem 1rem; display: flex; gap: .75rem;
  justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-size: .6875rem; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--faint);
}
.card h3 .n { color: var(--graphite); font-size: .8125rem; }
.card ul { list-style: none; margin: 0; padding: 0; }
.card li {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem 1rem; border-bottom: 1px solid var(--rule); font-size: .9375rem;
}
.card li:last-child { border-bottom: 0; }
.card li .sub {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: .75rem; color: var(--faint); white-space: nowrap; flex: none;
}
.card li .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-more {
  display: block; width: 100%; padding: .6rem 1rem; border: 0;
  border-top: 1px solid var(--rule); background: var(--sheet-2);
  color: var(--encre); font-size: .8125rem; text-align: left; cursor: pointer;
}
.card-more:hover { background: var(--sheet-3); }

.card-figure { padding: 1.1rem 1rem 1.25rem; }
.card-figure + .card-figure { border-top: 1px solid var(--rule); }
.metric {
  font-size: 2rem; font-weight: 600; letter-spacing: -.025em;
  line-height: 1.1; color: var(--graphite);
}
.metric-note { font-size: .8125rem; color: var(--faint); margin-top: .2rem; }

/* ── dialog ──────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgb(12 16 22 / .5); padding: 1.5rem;
}
.sheet {
  background: var(--sheet); border: 1px solid var(--rule-firm);
  border-radius: var(--r); box-shadow: var(--lift-high);
  width: min(44rem, 100%); max-height: 88dvh;
  display: flex; flex-direction: column;
}
.sheet-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--rule);
}
.sheet-head h2 {
  margin: 0; font-size: 1.1875rem; font-weight: 600; letter-spacing: -.015em;
  text-wrap: balance;
}
.sheet-body { overflow: auto; padding: 1.25rem; }
.sheet-foot {
  display: flex; justify-content: flex-end; gap: .5rem; align-items: center;
  padding: .9rem 1.25rem; border-top: 1px solid var(--rule); background: var(--sheet-2);
}
.sheet-foot .spacer { margin-right: auto; }

.kv { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: .55rem 1.25rem; margin: 0; }
.kv dt { font-size: .75rem; color: var(--faint); padding-top: .12em; }
.kv dd { margin: 0; }
.detail-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.25rem 0 0; }

/* ── forms ───────────────────────────────────────────────────────────── */
.form { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .login-card label {
  font-size: .75rem; font-weight: 600; color: var(--pencil); letter-spacing: .015em;
}
.field input, .field select, .field textarea,
.login-card input {
  width: 100%; padding: .5rem .6rem;
  background: var(--sheet-2); color: var(--graphite);
  border: 1px solid var(--rule-firm); border-radius: var(--r);
}
.field input:focus, .field select:focus, .field textarea:focus,
.login-card input:focus { background: var(--sheet); }
.field textarea { min-height: 5.5rem; resize: vertical; }
.field input[type="date"], .field input[type="number"] { font-family: var(--mono); }
.field .req { color: var(--rouge); margin-left: .15rem; }
.field .unit { color: var(--faint); font-weight: 500; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--rouge); }

.form-error { grid-column: 1 / -1; }
.confirm-text { margin: 0 0 .5rem; font-size: 1.0625rem; font-weight: 550; }
.confirm-detail { margin: 0; color: var(--pencil); font-size: .9375rem; }

kbd {
  font-family: var(--mono); font-size: .75rem; background: var(--sheet-2);
  border: 1px solid var(--rule-firm); border-bottom-width: 2px;
  border-radius: 3px; padding: .15em .45em; color: var(--pencil);
  white-space: nowrap;
}
.help-grid {
  display: grid; grid-template-columns: auto 1fr;
  gap: .55rem 1.1rem; align-items: baseline;
}
.help-grid span { font-size: .9375rem; color: var(--pencil); }

/* The phone's overflow menu: the rail's footer, as a stack of targets big
 * enough for a thumb. */
.more-list { display: flex; flex-direction: column; gap: .5rem; }
.more-list .btn { justify-content: flex-start; padding: .7rem .85rem; }

/* The rail's footer is on screen on a laptop, so the destination that
 * duplicates it is not. */
.nav-more { display: none; }

/* ── phone ───────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .app { flex-direction: column; }

  /* The rail becomes a bottom bar: destinations within thumb reach, with
   * everything account-level behind the last item. */
  .rail {
    order: 2; width: auto; flex: none;
    border-right: 0; border-top: 1px solid var(--rule);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .rail-head, .rail-foot { display: none; }
  .rail-nav {
    flex-direction: row; gap: .15rem; padding: .35rem .5rem;
    overflow-x: auto; scrollbar-width: none;
  }
  .rail-nav::-webkit-scrollbar { display: none; }
  .nav-item { width: auto; padding: .45rem .7rem; white-space: nowrap; font-size: .875rem; }
  .nav-item::before { display: none; }
  .nav-more { display: block; color: var(--encre); }

  .main { order: 1; flex: 1; min-height: 0; }

  .page { padding: 1rem 1rem .8rem; flex-wrap: wrap; gap: .75rem; align-items: flex-start; }
  .page h1 { font-size: 1.375rem; }
  .page-tools { width: 100%; justify-content: flex-start; }
  .page-tools .btn-primary { margin-left: auto; }
  .pins { padding: 0 1rem .75rem; }
  .content { padding: 0 1rem 1.5rem; }
  .statusbar { padding: .25rem 1rem; }

  /* A row becomes a card: the name, then its fields as labelled lines. */
  .grid-wrap { border: 0; background: none; border-radius: 0; overflow: visible; }
  table.grid { display: block; }
  table.grid thead { display: none; }
  table.grid tbody, table.grid tr, table.grid td { display: block; width: auto; }
  table.grid tr {
    background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r);
    margin-bottom: .6rem; padding: .5rem 0 .15rem;
  }
  table.grid tbody tr:hover td,
  table.grid tbody tr[aria-selected="true"] td { background: none; }
  table.grid tbody tr[aria-selected="true"] { border-color: var(--encre); }
  table.grid td {
    height: auto; white-space: normal; max-width: none; border-bottom: 0;
    display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem;
    padding: .22rem .85rem; align-items: baseline;
  }
  table.grid td::before {
    content: attr(data-label);
    font-family: var(--mono); font-size: .625rem; letter-spacing: .06em;
    text-transform: uppercase; color: var(--faint); padding-top: .25em;
  }
  table.grid td:first-child {
    display: block; padding: .1rem .85rem .5rem; font-size: 1.0625rem;
  }
  table.grid td:first-child::before { content: none; }
  table.grid td:empty { display: none; }
  table.grid td > .chip { justify-self: start; }
  table.grid td.money, table.grid td.int, table.grid td.float { text-align: left; }
  table.grid td.cell-cursor { box-shadow: none; }
  table.grid td.actions, table.grid th.actions-head {
    position: static; box-shadow: none; background: none;
  }
  table.grid td.actions {
    display: block; padding: 0; margin-top: .35rem;
    border-top: 1px solid var(--rule);
  }
  .btn-row {
    width: 100%; padding: .65rem; font-size: .875rem;
    color: var(--encre); border-radius: 0 0 var(--r) var(--r);
  }
  .row-glyph { display: none; }
  .row-word { display: inline; }
  table.grid td.actions::before { content: none; }

  .dash { columns: 1; }
  .card { margin-bottom: 1rem; }
  .tally { grid-template-columns: 1fr 1fr; }

  .overlay { padding: 0; place-items: end stretch; }
  .sheet {
    width: 100%; max-height: 94dvh;
    border-radius: var(--r) var(--r) 0 0; border-bottom: 0;
  }
  .form { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: .1rem 0; }
  .kv dd { margin-bottom: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
