/* ==========================================================================
   BusinessOS office screen - GST returns and GSTR-2B reconciliation.

   `/pos/pos.css` is loaded first and carries the design system: the colour
   tokens, buttons, fields, panels, tables, toast, and the `[hidden]` rule.
   This file adds only what this screen needs on top of it.

   The counter is built for a shop under a tube light; this one is built for
   somebody reading columns of figures, so it is denser, scrolls, and puts
   every number in the tabular font.
   ========================================================================== */

.signin__hint {
  margin: 18px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.signin__hint code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

/* --- shell --------------------------------------------------------------- */

.office {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.period { display: flex; align-items: center; gap: 8px; }
.period > span {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.period input {
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-family: var(--mono);
}
.period input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.panel--grow { flex: 1; min-height: 0; }

.returns-content { display: flex; flex-direction: column; gap: 12px; }

.panel__head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.panel__head .panel__title { margin: 0; }
.panel__actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.panel__actions .btn { padding: 6px 11px; font-size: 13px; }

/* A control the signed-in role does not hold is removed, not disabled: an
   accountant does not need to look at an export button all day to learn they
   cannot press it. `!important` for the same reason `[hidden]` needs it - the
   layout rules above set `display` and would otherwise win. */
.is-denied { display: none !important; }

.rules { margin: -4px 0 10px; font-size: 12px; }

/* --- the four figures at the top ----------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.stat__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.stat__value {
  margin-top: 6px;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 22px; font-weight: 700;
}
.stat__note { margin-top: 4px; font-size: 12px; color: var(--muted); }
.stat--pay .stat__value { color: var(--warn); }
.stat--credit .stat__value { color: var(--accent); }
.stats--compact { padding: 0; margin-top: 12px; }
.stats--compact .stat { border-radius: 10px; padding: 10px 12px; }
.stats--compact .stat__value { font-size: 17px; }

/* --- warnings ------------------------------------------------------------ */

.notices {
  display: flex; flex-direction: column; gap: 6px;
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border: 1px solid var(--warn);
  border-radius: 12px;
  padding: 12px 14px;
}
.notices h3 { margin: 0 0 2px; font-size: 13px; color: var(--warn); }
.notices p { margin: 0; font-size: 13px; line-height: 1.5; }

/* --- the two returns side by side ---------------------------------------- */

.returns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
/* A grid item defaults to min-width:auto, so the widest table inside GSTR-1
   would push its track open and squeeze GSTR-3B down to a column of wrapped
   words. The wide table scrolls inside .table-wrap instead. */
.returns > .panel { min-width: 0; }

/* --- collapsible return tables ------------------------------------------- */

.tables { display: flex; flex-direction: column; gap: 4px; }

details.rtable {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
}
details.rtable[open] { background: var(--surface); }
details.rtable > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
}
details.rtable > summary::-webkit-details-marker { display: none; }
details.rtable > summary::before {
  content: '';
  width: 7px; height: 7px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .12s ease;
  flex: none;
}
details.rtable[open] > summary::before { transform: rotate(45deg); }
/* The table's name never wraps - "9B - CDNUR" broken across two lines reads
   as two things. The description is what gives way on a narrow panel. */
.rtable__name { white-space: nowrap; }
.rtable__desc {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rtable__count {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 20px; padding: 1px 9px;
  background: var(--bg);
}
.rtable__count.is-empty { opacity: .5; }
.rtable__body { padding: 0 12px 12px; }

/* A wide table scrolls inside its own panel; the page never scrolls sideways. */
.table-wrap { overflow-x: auto; min-height: 0; flex: 1; }

/* --- transaction registers ---------------------------------------------- */

.documents { overflow: hidden; }
.documents__layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.documents__nav {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  padding: 10px;
  gap: 3px;
}
.documents__nav-head { display: grid; gap: 4px; padding: 8px 9px 13px; }
.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.document-kind {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 9px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.document-kind:hover { color: var(--text); background: var(--surface-2); }
.document-kind--on {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
  font-weight: 600;
}
.document-kind__count {
  min-width: 26px;
  padding: 1px 7px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
}
.documents__register {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.documents__titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 13px;
}
.documents__titlebar .panel__title { margin: 3px 0 4px; font-size: 20px; }
.documents__titlebar p { margin: 0; font-size: 12px; }
.documents__filters {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) repeat(3, minmax(132px, auto)) auto auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.documents__filters .field { margin: 0; }
.documents__filters .field > span { font-size: 10px; }
.documents__filters input,
.documents__filters select {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
}
.documents__filters input:focus,
.documents__filters select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.documents__apply, .documents__clear { min-height: 36px; }
.documents__summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 2px 8px;
  font-size: 12px;
}
.documents__table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
}
.documents__table { min-width: 900px; }
.documents__table thead { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.documents__table th { white-space: nowrap; }
.documents__table td { white-space: nowrap; }
.documents__table tbody tr:hover { background: var(--surface-2); }
.documents__number { font-family: var(--mono); font-size: 12px; }
.documents__actions { width: 42px; }
.documents__loading { padding: 26px !important; text-align: center; }
.documents__empty { padding: 20px 4px 8px; text-align: center; }
.documents__error { margin: 10px 2px 0; }
.documents__pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 10px;
}
.documents__pager .btn { padding: 6px 10px; font-size: 12px; }
.documents__pager .btn:disabled { opacity: .45; cursor: not-allowed; }

/* --- people and devices ---------------------------------------------------- */

.invite { width: min(460px, 100%); }
.invite__title { margin: 0 0 16px; font-size: 18px; }
.invite select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}
.invite .overlay__actions { margin-top: 18px; justify-content: flex-end; }

.handover { width: min(460px, 100%); text-align: center; }
.handover__password {
  font-family: var(--mono);
  font-size: 30px;
  letter-spacing: .06em;
  margin: 18px 0;
  padding: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 10px;
  user-select: all;
}

/* --- reports ---------------------------------------------------------------- */

.reports { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.reports__head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; }
.reports__range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; }
.reports__grain { display: flex; gap: 4px; }
.reports__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 1100px) { .reports__pair { grid-template-columns: 1fr; } }

.field--inline { margin: 0; }
.field--inline > span { font-size: 10px; }
.field--inline input {
  padding: 7px 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.range-pick, .grain-pick { padding: 7px 11px; font-size: 13px; }
.range-pick--on, .grain-pick--on { border-color: var(--accent); color: var(--accent); }

/* --- charts ------------------------------------------------------------------ */

.chart-wrap { overflow-x: auto; padding: 6px 0 2px; }
.chart-wrap--short { padding: 2px 0 8px; }
.chart { width: 100%; min-width: 320px; height: 190px; }
.chart__axis { stroke: var(--line); stroke-width: 1; }
.chart__label { fill: var(--muted); font-size: 9px; text-anchor: middle; font-family: var(--sans); }

.bar { rx: 2; }
.bar--revenue { fill: var(--accent); }
.bar--gross  { fill: #6aa9d8; }
.bar--expense { fill: var(--warn); }

.chart__key { display: flex; gap: 14px; padding: 4px 2px 0; font-size: 11px; color: var(--muted); }
.key::before {
  content: ''; display: inline-block; width: 9px; height: 9px;
  border-radius: 2px; margin-right: 5px; vertical-align: -1px;
}
.key--revenue::before { background: var(--accent); }
.key--gross::before { background: #6aa9d8; }
.key--expense::before { background: var(--warn); }

/* A share bar reads better than a pie and needs no geometry. */
.sharebar {
  display: grid; grid-template-columns: 150px 1fr 90px;
  align-items: center; gap: 10px; padding: 3px 0; font-size: 12px;
}
.sharebar--split { grid-template-columns: 150px 1fr; }
.sharebar__name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sharebar__track {
  display: flex; gap: 2px; height: 12px;
  background: var(--surface-2); border-radius: 3px; overflow: hidden;
}
.sharebar__fill { background: var(--accent); height: 100%; }
.sharebar__fill--in { background: var(--accent); }
.sharebar__fill--out { background: var(--warn); }
.sharebar__value { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --- ratios ------------------------------------------------------------------ */

/* `minmax(280px, 1fr)` is a floor, not a preference: on a 275px-wide panel the
   track stays 280px and the grid overflows. Wrapping the floor in `min()` lets
   it give way once the container is narrower than the floor itself. */
.ratios { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 16px; margin-top: 10px; }
.ratio-group h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.ratio {
  display: grid; grid-template-columns: 1fr auto;
  gap: 2px 10px; padding: 7px 0; border-bottom: 1px solid var(--line);
}
.ratio__label { font-size: 13px; }
.ratio__value { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.ratio__basis { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }

/* A second heading inside the register list, for the documents that are not
   money yet. */
.documents__nav-head--split {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.client-switch { margin-left: 6px; }

.clients { width: min(560px, 100%); max-height: 86vh; overflow-y: auto; }
.clients__list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.clients__list li {
  display: grid; gap: 4px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.clients__list li.is-open { border-color: var(--accent); }
.clients__list li .btn { justify-self: start; margin-top: 6px; }
.clients__head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.clients__facts { font-size: 12px; color: var(--muted); }
.clients__expiry { font-size: 12px; color: var(--muted); }
.clients__expiry.is-soon { color: var(--warn); }

#members-body select {
  padding: 5px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th {
  position: sticky; top: 0;
  text-align: left; white-space: nowrap;
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
  padding: 7px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.grid th.num { text-align: right; }
.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr.group td {
  background: var(--surface-2);
  font-weight: 600;
}
.grid .neg { color: var(--danger); }
.grid__empty { padding: 10px 2px; color: var(--muted); font-size: 13px; }

/* --- GSTR-3B ------------------------------------------------------------- */

/* GSTR-3B is the one table on this screen that is written straight into the
   panel rather than into a `.table-wrap`, so it gets the same scroller here.
   Seven columns of tax figures have a floor of about 520px and cannot be made
   narrower without dropping a column that the return actually requires. */
#gstr3b-body { overflow-x: auto; }
.b3 { width: 100%; border-collapse: collapse; font-size: 13px; }
.b3 th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--line);
}
.b3 th.num { text-align: right; }
.b3 td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.b3 td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.b3 .b3__code { font-family: var(--mono); font-size: 12px; color: var(--muted); width: 62px; }
.b3 tr.b3--head td { background: var(--surface-2); font-weight: 600; }
.b3 tr.b3--total td { font-weight: 700; }
.b3 tr.b3--total td.num { color: var(--warn); }

.setoff { margin-top: 14px; }
.setoff h3 { margin: 0 0 6px; font-size: 13px; }
.setoff p { margin: 8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.55; }

/* --- filing -------------------------------------------------------------- */

.filing__note { margin: 0 0 14px; font-size: 13px; line-height: 1.55; max-width: 70ch; }
.filing__form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filing__form .field { margin-bottom: 0; }
.filing__form .field:nth-child(2) { flex: 1; min-width: 220px; }
.filing__form select {
  padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font: inherit;
}

/* --- reconciliation ------------------------------------------------------ */

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 2px 9px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.status--MATCHED { color: var(--accent); border-color: var(--accent); }
.status--VALUE_MISMATCH { color: var(--danger); border-color: var(--danger); }
.status--PROBABLE { color: var(--warn); border-color: var(--warn); }
.status--MISSING_IN_BOOKS { color: var(--warn); border-color: var(--warn); }
.status--MISSING_IN_PORTAL { color: var(--muted); }

.decision { display: flex; gap: 5px; }
.decision .btn { padding: 4px 9px; font-size: 12px; }
.decision__made { font-size: 12px; color: var(--muted); }
.decision__made.is-accepted { color: var(--accent); }
.decision__made.is-rejected { color: var(--danger); }

.reason { font-size: 12px; color: var(--muted); white-space: normal; max-width: 42ch; }

/* --- narrow screens ------------------------------------------------------ */

@media (max-width: 1100px) {
  .returns { grid-template-columns: 1fr; }
  .documents__filters { grid-template-columns: minmax(180px, 1fr) repeat(2, 135px) auto auto; }
  .documents__filters .field:nth-child(4) { grid-column: 1 / 2; }
}
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; }
  .period { order: 3; width: 100%; }
  /* The name only. A bare `span` here also hid the theme control - the same
     mistake as in pos.css, in a second file. */
  .topbar__user > span:not([data-theme-toggle]) { display: none; }
  .documents { overflow-y: auto; }
  .documents__layout { grid-template-columns: 1fr; }
  .documents__nav { flex-direction: row; overflow-x: auto; align-self: auto; }
  .documents__nav-head { display: none; }
  .document-kind { flex: 0 0 auto; width: auto; }
  .documents__register { overflow: visible; }
  .documents__filters { grid-template-columns: 1fr 1fr; }
  .documents__search { grid-column: 1 / -1; }
  .documents__filters .field:nth-child(4) { grid-column: auto; }
  .documents__apply, .documents__clear { width: 100%; }
}

/* --- Ask: the business assistant ----------------------------------------- */

.ask__form { display: flex; gap: 10px; margin: 14px 0 12px; }

.ask__form input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: inherit;
  font: inherit;
}

.ask__form input:focus { outline: none; border-color: var(--accent); }

.ask__chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 6px; }

.chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 13px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }

/* The sentence is the answer. It is sized to be read first. */
.ask__headline {
  font-size: 18px;
  line-height: 1.45;
  margin: 18px 0 10px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.ask__scalar {
  font-size: 32px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}

.ask__breakdown { margin: 10px 0; }

.ask__breakdown-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.ask__breakdown-row:last-child { border-bottom: none; }
.ask__breakdown-row .num { font-family: var(--mono); }
.ask__breakdown-row .muted { font-size: 12px; }

/* Provenance is collapsed but always present: a figure nobody can trace is a
   figure nobody should act on. */
.ask__how { margin-top: 16px; font-size: 13px; color: var(--muted); }
.ask__how summary { cursor: pointer; }
.ask__how ul { margin: 8px 0 0; padding-left: 18px; }
.ask__how li { margin: 3px 0; }
.ask__how > div { margin-top: 8px; }

.ask__followups { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }

.ask__empty {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.ask__empty .ask__chips { margin-top: 12px; }

/* --- settings ------------------------------------------------------------
   The QR preview sits beside the form rather than under it, because the whole
   point of showing it is that the owner scans it *while* looking at the field
   they just typed. Below the fold it would be decoration. */

.settings-form { max-width: 460px; }
.settings-form .field { margin-bottom: 16px; }
.settings-form .field small { display: block; margin-top: 5px; font-size: 11px; }

.check { display: flex; align-items: center; gap: 9px; font-size: 14px; margin-bottom: 18px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.settings-form__actions { display: flex; align-items: center; gap: 14px; }

.upi-check {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* White always, in both themes: a QR inverted for a dark background is not a
   QR any more - scanners expect dark modules on light. */
.upi-check__code {
  flex: 0 0 auto;
  background: #ffffff;
  padding: 10px;
  border-radius: 8px;
  line-height: 0;
}
.upi-check__code svg { display: block; width: 168px; height: 168px; }
.upi-check__title { margin: 0 0 8px; font-size: 15px; }
.upi-check p { margin: 0 0 8px; max-width: 52ch; }

@media (max-width: 640px) {
  .upi-check { flex-direction: column; }
}

.upi-note { margin: 4px 0 0; max-width: 60ch; font-size: 13px; }

/* --- plan and cash ----------------------------------------------------------- */

#view-plan { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }

.bucket-pick { padding: 7px 11px; font-size: 13px; }
.bucket-pick--on { border-color: var(--accent); color: var(--accent); }

/* The forecast checkbox sits in a control row, so it must not carry the
   bottom margin the settings-page version needs. */
.reports__range .check { margin-bottom: 0; font-size: 12px; }

.notes { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.notes li { margin-bottom: 4px; max-width: 92ch; }
.notes li:last-child { margin-bottom: 0; }

.plan__expect {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
  padding: 10px;
  margin-bottom: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.plan__expect select {
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

/* Favourable and adverse are read at a glance, so they are colour *and* word:
   a red minus alone is ambiguous when spending less than budget is the good
   outcome. */
.judge { font-size: 11px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); }
.judge--good { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.judge--bad  { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.judge--flat { color: var(--muted); }
.judge--none { color: var(--muted); border-style: dashed; }

.flow-chip {
  display: inline-block;
  margin: 0 4px 3px 0;
  padding: 1px 7px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.flow-chip--in  { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.flow-chip--out { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

.bar--cash { fill: var(--accent); }
.bar--cash-neg { fill: var(--danger); }
.chart__floor { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 3 3; }

/* The forecast table's last column is prose, so it is the one thing here that
   may wrap rather than push the table sideways. */
#plan-buckets td:last-child { white-space: normal; min-width: 260px; }

/* --- quotation designs -------------------------------------------------------- */

#view-quotes { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }

.quotes {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
/* Everything you change on the left, the result on the right.
   The settings used to run full width *underneath* the gallery, which put
   them a long scroll below the preview: you scrolled down to change a word,
   scrolled back up to see what it did, and repeated. They now sit in the
   left column under the gallery, and the preview is sticky - so the document
   stays on screen while you edit it. That is the whole point of a preview. */
.quotes > .panel:nth-child(n + 3) { grid-column: 1; }
.quotes > .panel { min-width: 0; }

.quotes__side {
  position: sticky;
  /* Clear of the sticky top bar. Two rows of tabs at their tallest. */
  top: 12px;
}

@media (max-width: 1100px) {
  .quotes { grid-template-columns: 1fr; }
  .quotes > .panel { grid-column: 1 / -1; }
  /* Stacked, a sticky preview would cover the form it is previewing. */
  .quotes__side { position: static; }
}

.quotes__filters { display: flex; gap: 8px; align-items: flex-end; }
.quotes__filters select,
.quotes__form select,
.logo-box__form select {
  padding: 7px 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 10px;
  /* Was 560px, which filled the screen and pushed the settings a full page
     below the fold - so choosing a design and adjusting its wording were two
     separate journeys. Shorter, it scrolls within itself and the settings sit
     just underneath, where you can reach them without losing the preview. */
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
  /* A cut-off row should look cut off, so it is obvious there is more. */
  mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent);
}

.swatch {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
  transition: border-color .12s ease, transform .12s ease;
}
.swatch:hover { border-color: var(--accent); transform: translateY(-1px); }
.swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch--on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
/* The thumbnail is drawn in the design's own colours, so the card shows what
   comes out of the printer rather than a generic paper icon. */
.swatch svg { display: block; width: 100%; height: auto; background: #ffffff; }
.swatch__label {
  padding: 6px 8px 7px;
  font-size: 11.5px;
  line-height: 1.3;
}
.swatch__label strong { display: block; font-size: 12px; }
.swatch__label span { color: var(--muted); }

.quotes__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.quotes__hint { margin: 0 0 8px; font-size: 12px; }
.quotes__preview {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}
.quotes__preview iframe {
  display: block;
  width: 100%;
  /* Tall enough to read, short enough that the sticky panel fits a laptop
     screen. A sticky element taller than the viewport stops sticking. */
  height: min(560px, calc(100vh - 220px));
  border: 0;
}

.quotes__form {
  display: grid;
  /* 200px rather than 240px: in the left-hand column this fits two fields
     side by side at ordinary widths and drops cleanly to one when narrow,
     instead of leaving a single stretched field per row. */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 14px;
  align-items: end;
}
.quotes__form .field--wide { grid-column: 1 / -1; }
.quotes__form textarea {
  padding: 7px 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  resize: vertical;
}
.quotes__form .check { grid-column: 1 / -1; margin-bottom: 0; }
.quotes__save { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }

.colour-pick { display: flex; align-items: center; gap: 6px; }
.colour-pick input[type="color"] {
  width: 42px;
  height: 30px;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.logo-box { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
/* Always white behind the logo: most are drawn for paper, and a dark surface
   makes a black wordmark disappear - which would look like a broken upload. */
.logo-box__preview {
  flex: 0 0 auto;
  min-width: 180px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
}
.logo-box__preview img { max-width: 220px; max-height: 110px; display: block; }
.logo-box__preview .muted { color: #666666; margin: 0; font-size: 12px; }
.logo-box__form {
  flex: 1 1 320px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 12px;
  align-items: end;
}
.logo-box__note { grid-column: 1 / -1; margin: 0; font-size: 12px; max-width: 62ch; }
.logo-box__form input[type="file"] { font-size: 12px; color: var(--muted); }

/* ==========================================================================
   Phones and small tablets.
   ==========================================================================
   The breakpoints above stack the columns, but stacking a grid is only half of
   it: a grid or flex item is `min-width: auto` by default, so a track that has
   collapsed to a single column still refuses to be narrower than the widest
   thing inside it. That is how a 473px panel ended up sitting in a 347px
   column and made the whole Reports view scroll sideways - the layout looked
   stacked and behaved as though it had not been.

   Releasing that floor is the whole fix. Nothing is hidden by it: the pieces
   that genuinely need width - the tables, the charts, the tab strip - carry
   their own `overflow-x: auto` and go on scrolling inside their own box, which
   is a scroll the reader can predict.
   ========================================================================== */
@media (max-width: 900px) {
  .reports__pair > *,
  .returns > *,
  .returns-content > *,
  .quotes > *,
  .panel > * { min-width: 0; }

  /* The title and its buttons stop fighting over one line. */
  .panel__head { flex-wrap: wrap; }
  .panel__actions { margin-left: 0; }

  main.office { padding: 10px; gap: 10px; }
  .panel { padding: 12px; }
}

@media (max-width: 560px) {
  /* Four filter fields at 144px each are unusable; two full-width ones are not. */
  .documents__filters { grid-template-columns: 1fr; }
  .documents__filters .field:nth-child(4) { grid-column: auto; }

  /* The share bar keeps its label and its amount, and gives up the bar first -
     the number is the point, the bar is the decoration. */
  .sharebar { grid-template-columns: 1fr auto; row-gap: 2px; }
  .sharebar--split { grid-template-columns: 1fr; }
  .sharebar__track { grid-column: 1 / -1; }
  .sharebar__name { white-space: normal; }

  .settings-form { max-width: none; }
  /* Not `min-width: 0`: releasing the floor let the ARN box collapse to 32px,
     and a 15-character acknowledgement number cannot be typed into that. The
     row stacks instead, so every control gets the full width. */
  .filing__form { flex-direction: column; align-items: stretch; }
  .filing__form .field:nth-child(2) { min-width: 0; }
  .filing__form .btn { width: 100%; }

  /* The date range wraps rather than pushing the panel head wider than itself. */
  .reports__range { min-width: 0; width: 100%; }
  .reports__range .field { flex: 1 1 120px; min-width: 0; }

  /* A `<select>` takes its intrinsic width from its longest option, so one
     budget named "Accountant budget 1786655123417 (2026-27)" made the whole
     panel head 295px wide on a 275px screen. The chosen option is what gets
     truncated, and opening the list still shows every name in full. */
  select { max-width: 100%; text-overflow: ellipsis; }
}

/* --- stock ---------------------------------------------------------------- */

.stock__filters {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

/* A row that wants attention without shouting. Used for an item below its
   reorder level and for a batch expiring within a month - both are "look at
   this soon", not "something is wrong", so the tint is a hint and the text
   colour is left alone. */
.grid tbody tr.row--warn td { background: var(--warn-sf); }
.stat--warn .stat__value { color: var(--warn); }

/* A negative movement - goods leaving. The sign is already there; the colour
   is so a column of them reads at a glance. */
.grid td.num.neg { color: var(--danger); }

/* --- import --------------------------------------------------------------- */

.import__pick {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.import__paste { margin-top: 12px; }
.import__paste summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.import__paste textarea {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  resize: vertical;
}

/* Which column became which field. This is the part somebody actually checks
   before committing, so it is shown as pairs rather than buried in prose. */
.import__mapping { margin: 16px 0; }
.import__mapping h3 { margin: 0 0 8px; font-size: 13px; }
.import__cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px 14px;
}
.import__col {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  padding: 5px 9px;
  background: var(--surface-2);
  border-radius: 7px;
}
.import__col-from { color: var(--text); }
.import__col-arrow { color: var(--muted); font-family: var(--mono); }
.import__col-to { color: var(--accent); font-family: var(--mono); font-size: 12px; }

/* The commit half, set apart from the preview above it. Reading a file and
   writing one are different acts and should not look like one form. */
.import__commit {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.import__commit .field { max-width: 520px; }
.import__commit .btn { margin-top: 12px; }

/* --- payment reminders ---------------------------------------------------- */

.reminders__windows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px 16px;
  margin: 12px 0 4px;
  max-width: 620px;
}

/* --- a PDF in the page ----------------------------------------------------
   Rather than a popup, which browsers block: `window.open('', '_blank')`
   followed by an await returns null in Chrome, so the print button did
   nothing at all. */

/* `.overlay` already centres with grid; only the card needs sizing here. */
.pdf-overlay__card {
  width: min(1000px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pdf-overlay__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pdf-overlay__head h2 { margin: 0; font-size: 17px; margin-right: auto; }
.pdf-overlay__frame {
  flex: 1 1 auto;
  min-height: 60vh;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

/* --- writing a quotation --------------------------------------------------- */

.quote-card { width: min(880px, 96vw); max-height: 92vh; overflow-y: auto; }
.quote-card__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.quote-card__head > div { margin-right: auto; }
.quote-card__foot { margin-top: 16px; }
.quote-card .field { margin-top: 12px; }

.quote-suggest {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 4px;
}
.quote-suggest__item {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; border: 0; background: none;
  color: var(--text); font: inherit; cursor: pointer;
}
.quote-suggest__item:hover { background: var(--surface-3); }

.quote-lines input { width: 100%; }
.quote-lines input.quote-num { max-width: 110px; text-align: right; font-family: var(--mono); }
.quote-lines td { vertical-align: middle; }

.quote-total { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.quote-total__row { display: flex; justify-content: space-between; gap: 20px; padding: 3px 0; color: var(--muted); }
.quote-total__row--big { color: var(--text); font-weight: 640; font-size: 18px; padding-top: 8px; }
.quote-total__row .num { font-family: var(--mono); }

.documents__titlebar-actions { display: flex; gap: 8px; align-items: center; }

/* --------------------------------------------------------------------------
   Bank reconciliation
   -------------------------------------------------------------------------- */

.bank__accounts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.bank-account {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.bank-account:hover { border-color: var(--accent); }

.bank-account.is-current {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.bank-account__name { font-weight: 600; }
.bank-account__type,
.bank-account__count { font-size: 0.8rem; color: var(--muted); }
.bank-account__flag { font-size: 0.8rem; color: var(--warn, #b45309); }
.bank-account__ok { font-size: 0.8rem; color: var(--muted); }

.bank__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.bank__filters { margin: 0.75rem 0 0.25rem; }

.bank-ref,
.bank-reason,
.bank-suggestion { display: block; font-size: 0.8rem; }
.bank-reason { margin-top: 0.2rem; max-width: 32rem; }

.bank-out { color: var(--danger, #b91c1c); }
.bank-in { color: var(--ok, #15803d); }

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* A smaller button for inside a table row. This was used by the quotation
   editor before it was ever defined, so those buttons were full size. */
.btn--tiny {
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
}

.pill--matched { background: color-mix(in srgb, var(--ok, #15803d) 18%, transparent); }
.pill--probable { background: color-mix(in srgb, var(--warn, #b45309) 18%, transparent); }
.pill--unmatched { background: color-mix(in srgb, var(--muted) 18%, transparent); }

/* --------------------------------------------------------------------------
   Price lists
   -------------------------------------------------------------------------- */

.prices__filters {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}

.smallform__result {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Tax deducted at source
   -------------------------------------------------------------------------- */

.stat--bad .stat__value { color: var(--danger, #b91c1c); }

.tds-blocking {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--danger, #b91c1c);
  border-radius: var(--radius);
}

.tds-blocking h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: var(--danger, #b91c1c);
}

.tds-blocking ul { margin: 0; padding-left: 1.1rem; }
.tds-blocking li { margin-bottom: 0.25rem; line-height: 1.5; }

/* --------------------------------------------------------------------------
   Projects and time
   -------------------------------------------------------------------------- */

.projects__subhead {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.projects__bulk {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

/* --------------------------------------------------------------------------
   Customise
   -------------------------------------------------------------------------- */

.customise__toggle { margin: 0.75rem 0 0.25rem; }

.customise-template { position: relative; }

.customise-swatch {
  display: inline-block;
  width: 2.25rem;
  height: 0.3rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
}

ul.customise-enforced {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  line-height: 1.6;
}

ul.customise-enforced li { margin-bottom: 0.2rem; }

/* --------------------------------------------------------------------------
   Customer portal links
   -------------------------------------------------------------------------- */

.portal__search { max-width: 26rem; margin-top: 0.75rem; }

.portal-link-box {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  /* The link is long and must never be clipped - somebody may be reading it
     out loud, and a truncated key is a key that does not work. */
  word-break: break-all;
  user-select: all;
}

/* ==========================================================================
   The shell: a grouped rail on a desk, a drawer on a phone
   ==========================================================================
   Twenty destinations is past what a strip of tabs can carry. Measured on a
   375px screen, the wrapped bar was 502px tall inside a 571px header - 70% of
   the viewport spent on navigation before a single figure appeared.

   So the same buttons become a rail: grouped, scannable, and out of the way.
   Below 960px it slides in over the content instead, because a 232px column
   on a 375px screen is not a rail, it is most of the page.

   Every button keeps its `.tab` class and `data-view`, so the view switching
   and the permission gating in office.js did not change at all.
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}
.topbar { grid-column: 1 / -1; }
.sidenav { grid-row: 2; grid-column: 1; }
.app > main.office { grid-row: 2; grid-column: 2; min-width: 0; }

.sidenav {
  background: var(--surface);
  border-right: 1px solid var(--line);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.sidenav__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 8px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidenav__group {
  margin: 14px 0 4px;
  padding: 0 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidenav__group:first-child { margin-top: 2px; }

/* The tab itself, restyled as a row. Full width, left aligned, and tall
   enough to hit with a thumb - 44px is the size a finger actually is. */
.sidenav .tab {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  text-align: left;
}
.sidenav .tab .icon { flex: 0 0 auto; opacity: .8; }
.sidenav .tab:hover { background: var(--surface-2); color: var(--text); }
.sidenav .tab--on {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: transparent;
  color: var(--text);
  font-weight: 600;
}
.sidenav .tab--on .icon { opacity: 1; color: var(--accent); }
/* A bar down the side rather than a background alone: at a glance it reads as
   "you are here" even for someone who cannot separate the two greens. */
.sidenav .tab--on::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidenav .tab { position: relative; }

.navtoggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.navtoggle:hover { border-color: var(--accent); }

.navscrim { display: none; }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app > main.office { grid-column: 1; }

  .navtoggle { display: inline-flex; }

  /* Off-canvas. `visibility` as well as the transform, so a closed drawer is
     not reachable by tab - an invisible focus stop that scrolls the page
     sideways is worse than no drawer at all. */
  .sidenav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(280px, 84vw);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-2);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  .sidenav.is-open {
    transform: none;
    visibility: visible;
    transition: transform .2s ease, visibility 0s;
  }
  .navscrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, .5);
  }
  .navscrim[hidden] { display: none; }

  /* Room for a thumb once there is space to give it. */
  .sidenav .tab { min-height: 44px; font-size: 14.5px; }
  .sidenav__scroll { padding-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidenav { transition: none; }
}

/* --- the bar itself, once the rail carries the navigation ------------------ */
/* pos.css sets `.topbar__brand { flex: 1 0 100% }` on narrow screens, which was
   right when the tab strip needed a line of its own. It does not now: the
   navigation has left the bar entirely, so the brand shares a row with the
   toggle and the user actions. Three rows become one, and the header drops
   from 571px to about 56. */
@media (max-width: 960px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 10px;
    padding: 8px 12px;
    min-height: 56px;
  }
  .topbar__brand { flex: 1 1 auto; min-width: 0; }
  .topbar__brand > div { min-width: 0; }
  .topbar__user { flex: 0 0 auto; gap: 4px; }
  /* The period picker belongs to the statutory screens and is shown only on
     them; on a phone it gets its own line so the fields stay tappable. */
  .period { flex: 1 0 100%; order: 4; }
}

/* The company name is the one thing that must never be cut to nothing: it is
   how somebody with several clients knows whose books they are looking at. */
@media (max-width: 520px) {
  .topbar__brand span:not([data-theme-toggle]) { display: none; }
  .topbar__brand strong { font-size: 15px; }
}

/* --- first run ------------------------------------------------------------ */
.signin__pair { display: grid; grid-template-columns: 1fr 90px; gap: 10px; }
.signin__rule { border: 0; border-top: 1px solid var(--line); margin: 16px 0 14px; }
.signin__card .field em {
  font-style: normal;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
