/* COSMOSES – small hand-written stylesheet (no external dependencies). */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6b7a;
  --border: #d9dfe6;
  --primary: #1f5f9f;
  --primary-dark: #174a7d;
  --danger: #b3261e;
  --success: #1f7a3c;
  --warning: #9a6200;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Page width: the side gutter grows with the window; forms and text pages keep a
     reading width, data pages (body.page--wide) use the whole window up to a large cap. */
  --gutter: clamp(12px, 2vw, 32px);
  --page-max: 1100px;
  /* The header spans the window on every page: the menu keeps its place from page to
     page and has room for one row (a reading-width header put the user menu on a
     second row even at 1920px). */
  --header-max: 2400px;
}
.page--wide { --page-max: 2400px; }

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
/* A path, an ID or a key never runs past its box: it breaks where it must - after a
   "/" (|path_wrap) or between the halves of an ID (|id_wrap) when it has break points. */
code { font-size: .9em; background: var(--bg); padding: 0 .25em; border-radius: 3px; overflow-wrap: break-word; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem; }
.skip-link:focus { left: .5rem; z-index: 100; }

/* Header + navigation ---------------------------------------------------- */

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header__inner {
  max-width: var(--header-max); margin: 0 auto; padding: .5rem var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
}
/* The brand: the owner's logo as one image (static/brand/cosmoses-logo-*.png: the wordmark, the
   blue rule and the tagline with red bars, 4-8x the size shown, so it is sharp), 334 CSS px wide;
   on a phone the <picture> swaps in the wordmark alone (cosmoses-wordmark-*.png). flex: none so a long navigation never
   squeezes it; width + height:auto keep its proportions when a phone header narrows it (below). */
.brand { text-decoration: none; display: block; flex: none; width: 334px; max-width: 100%; min-width: 0; }
.brand picture { display: block; }
.brand__logo { display: block; width: 100%; height: auto; }

/* Ten section links (Annual Accounts and Bookkeeping joined on 21 Oct 2026): the links sit
   .25rem apart with .5rem of side padding, so the row of links and the user menu fits beside
   the 334px logo on one row from 1920px (measured in headless Chrome, EN: 948px of links,
   404px of menu and the gaps = 1392px of 1451px; a long name is cut at 11rem there, below). */
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; flex: 1; }
.nav > a {
  text-decoration: none; padding: .45rem .5rem; border-radius: var(--radius); color: var(--text);
}
.nav > a:hover { background: var(--bg); }
.nav > a[aria-current="page"] { background: var(--primary); color: #fff; }

.user-menu { margin-left: auto; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
/* A long name is cut with "…" rather than pushing the menu onto a second row. */
.user-menu__name { font-size: .85rem; color: var(--muted); max-width: 14rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-toggle, .nav-toggle__label { display: none; }

/* A smaller window (a laptop, the 1000px Safari window): the menu tightens; below 1200px
   the user's name is kept for screen readers only (it is shown again in the phone menu)
   and the links are a little smaller with .3rem of side padding, so the ten links and the
   menu take two rows beside the logo, never three (measured in headless Chrome, EN and RO,
   980-1199px: 86px high; 93px before the two new links). With .4rem of side padding the
   English links pushed the menu to a third row at 980-988px (123px). */
@media (min-width: 720.02px) and (max-width: 1365.98px) {
  .site-header__inner { column-gap: .75rem; }
  .nav { column-gap: .25rem; }
  .nav > a { padding: .45rem .5rem; }
  .user-menu { gap: .5rem; }
  .user-menu__name { max-width: 10rem; }
}
@media (min-width: 980px) and (max-width: 1199.98px) {
  .site-header__inner { column-gap: .5rem; }
  .nav > a { padding: .4rem .3rem; font-size: .85rem; }
  .user-menu__name {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
}
/* A wide window (from 1366px): the name is cut at 11rem rather than 14rem, so the ten links
   and the menu stay on one row beside the logo from 1920px whatever the name's length
   (measured: a name at the 14rem limit made a 476px menu and two rows at 1920px, 91px high;
   with 11rem one row, 76px, EN and RO). */
@media (min-width: 1366px) {
  .user-menu__name { max-width: 11rem; }
}

/* The "To do today" bell (header): the count of items newer than the last visit. */
.bell { position: relative; display: inline-flex; align-items: center; padding: .35rem; border-radius: var(--radius); color: var(--muted); text-decoration: none; }
.bell:hover, .bell:focus-visible { color: var(--primary); background: var(--bg); }
.bell__badge {
  position: absolute; top: -.15rem; right: -.25rem; min-width: 1.1rem; padding: 0 .3rem; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.1rem; text-align: center;
}
.todo-summary { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.todo-summary li { display: flex; align-items: center; gap: .4rem; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-item { padding: .4rem 0; border-top: 1px solid var(--border); }
.todo-item:first-child { border-top: 0; }
.todo-item--danger { border-left: 3px solid var(--danger); padding-left: .5rem; }
.todo-item--warning { border-left: 3px solid var(--warning); padding-left: .5rem; }
.todo-item--info { border-left: 3px solid var(--primary); padding-left: .5rem; }
.data-request { margin-top: .75rem; }
.data-request__texts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .75rem; margin-top: .5rem; }
.data-request__text > summary { cursor: pointer; font-weight: 600; }
.data-request__textarea { width: 100%; font: inherit; font-size: .9rem; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius); box-sizing: border-box; }

.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lang-switch__btn {
  border: 0; background: var(--surface); color: var(--text); padding: .3rem .55rem; cursor: pointer;
  font: inherit; font-size: .8rem; font-weight: 600;
}
.lang-switch__btn + .lang-switch__btn { border-left: 1px solid var(--border); }
.lang-switch__btn.is-active { background: var(--primary); color: #fff; }

/* Layout ------------------------------------------------------------------ */

.container { max-width: var(--page-max); width: 100%; min-width: 0; margin: 0 auto; padding: 1.25rem var(--gutter) 2rem; flex: 1; }
.site-footer { text-align: center; color: var(--muted); padding: 1rem var(--gutter); border-top: 1px solid var(--border); }
.brand--footer { margin: 0 auto; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.card--narrow { max-width: 420px; margin: 2rem auto; }
/* The full logo (wordmark + tagline) above the login and set-password forms: the PNG is
   @2x (960×167), shown as wide as the narrow card allows (380 px), fluid on a phone. */
.login-logo { margin: .25rem 0 1.25rem; text-align: center; }
.login-logo img { width: 100%; max-width: 400px; height: auto; vertical-align: middle; }
/* Collapsible cards (the Leaver and P45 cards of the employee page) */
.card--details > summary { cursor: pointer; list-style: none; }
.card--details > summary::-webkit-details-marker { display: none; }
.card--details > summary h2 { display: inline; margin: 0; }
.card--details > summary::before { content: "▸ "; color: var(--muted); }
.card--details[open] > summary::before { content: "▾ "; }
.card--details[open] > summary { margin-bottom: .75rem; }

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-header h1 { margin: 0; }
.breadcrumb { color: var(--muted); font-size: .9rem; margin: 0 0 .5rem; }
.lead { font-size: 1.05rem; }
.muted { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column;
}
.stat__value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat__label { color: var(--muted); }

/* Messages ---------------------------------------------------------------- */

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.message { padding: .6rem .9rem; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: .5rem; background: var(--surface); }
.message--success { border-color: var(--success); color: var(--success); }
.message--error { border-color: var(--danger); color: var(--danger); }
.message--warning { border-color: var(--warning); color: var(--warning); }

/* Forms ------------------------------------------------------------------- */

.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field--checkbox label { display: inline; font-weight: 600; margin-left: .35rem; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea,
.filters input, .filters select {
  width: 100%; max-width: 480px; padding: .5rem .6rem; border: 1px solid var(--border);
  border-radius: var(--radius); font: inherit; background: var(--surface); color: var(--text);
}
/* A group of radio buttons (the feedback's type, where RTI submissions go): each
   choice at its natural width, side by side and wrapping (includes/form.html renders
   the group as a fieldset). A radio button was 100% wide: the three choices were
   stretched across the page and wider than a phone. */
.field--choices input[type="radio"], .field--choices input[type="checkbox"] { width: auto; margin: 0; flex: none; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.field--error input, .field--error select { border-color: var(--danger); }
.help { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; }
.error { color: var(--danger); font-size: .9rem; margin: .25rem 0 0; }
.errorlist { color: var(--danger); padding-left: 1.2rem; }
.req { color: var(--danger); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.inline-form { display: inline; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters input { flex: 1 1 240px; }
.filters select { width: auto; max-width: 100%; }
/* A label and its field kept together (a date filter): the field never runs past the page. */
.filters__field { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; max-width: 100%; }
.filters .filters__field input { flex: 0 1 auto; width: auto; min-width: 0; }

.btn {
  display: inline-block; padding: .5rem .9rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; font: inherit; cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); color: #fff; }
.btn--link { border: 0; background: none; color: var(--primary); padding: .3rem .4rem; }
.btn--link:hover { text-decoration: underline; background: none; }
.btn--small { padding: .25rem .6rem; font-size: .85rem; }


/* Tables ------------------------------------------------------------------ */

.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
/* Header labels wrap between words, never inside one. */
.table th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; overflow-wrap: normal; word-break: normal; }
/* --row-bg: the row's colour, repeated by the sticky first cell (below). */
.table tbody tr:hover { background: var(--bg); --row-bg: var(--bg); }

/* A wide table scrolls sideways inside its card, never the page; the first column
   (the client or employee name) stays in view while the rest scrolls. */
.table-scroll { position: relative; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* When a table does scroll, it shows: a soft shadow on the right edge while more columns
   wait there (hidden by a white cover once the end is reached), and a thin scroll bar
   that stays visible (macOS hides overlay scroll bars until one scrolls). */
.table-scroll {
  background:
    linear-gradient(to left, var(--surface) 40%, rgba(255, 255, 255, 0)) right center / 2.5rem 100% no-repeat local,
    radial-gradient(farthest-side at 100% 50%, rgba(28, 36, 48, .16), rgba(28, 36, 48, 0)) right center / .9rem 100% no-repeat scroll;
}
.table-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.table-scroll > .table > thead > tr > :first-child:not([colspan]),
.table-scroll > .table > tbody > tr > :first-child:not([colspan]),
.table-scroll > .table > tfoot > tr > :first-child:not([colspan]) {
  position: sticky; left: 0; z-index: 1; background-color: var(--row-bg, var(--surface));
}
/* Compact density on a smaller window (a laptop up to 1440px wide, 1366px included):
   more columns fit before anything scrolls. */
@media (max-width: 1439.98px) {
  .table { font-size: .875rem; }
  .table th, .table td { padding: .4rem .45rem; }
  .table th { font-size: .75rem; letter-spacing: .01em; }
}
/* A 1000-1150px window: a little tighter still (the money tables of ten columns fit). */
@media (min-width: 720.02px) and (max-width: 1151.98px) {
  .table th, .table td { padding: .4rem .375rem; }
}
/* A tablet (720-980px): smaller type and cards with less padding, so more tables fit
   before they scroll (a wide one still scrolls inside its card, its first column kept
   in view). */
@media (min-width: 720.02px) and (max-width: 979.98px) {
  .table { font-size: .8125rem; }
  .table th, .table td { padding: .35rem .3rem; }
  .table th { font-size: .7rem; }
  .card { padding: .85rem; }
}

/* Secondary columns of a very wide table (the migration board, the year-end board, the
   pay history): hidden in a smaller window (.col--hide-lg below 1600px, .col--hide-ml
   below 1280px, .col--hide-md below 1152px) until "Show all columns" is ticked. The
   button shows only at the widths where its table hides something: a tick box marked
   .cols-toggle--ml has only .col--hide-ml columns. The tick box is visually hidden but
   stays focusable. On a phone every row is a card with all its fields, so nothing is
   hidden there. */
.cols-toggle {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.cols-toggle__label { display: none; margin-bottom: .5rem; }
.cols-toggle:focus-visible + .cols-toggle__label { outline: 2px solid var(--primary); outline-offset: 2px; }
.cols-toggle__less, .cols-toggle:checked + .cols-toggle__label .cols-toggle__more { display: none; }
.cols-toggle:checked + .cols-toggle__label .cols-toggle__less { display: inline; }
@media (min-width: 720.02px) and (max-width: 1599.98px) {
  .cols-toggle__label { display: inline-block; }
  .cols-toggle.cols-toggle--ml + .cols-toggle__label { display: none; }
  .cols-toggle:not(:checked) ~ .table-scroll .col--hide-lg { display: none; }
}
@media (min-width: 720.02px) and (max-width: 1279.98px) {
  .cols-toggle.cols-toggle--ml + .cols-toggle__label { display: inline-block; }
  .cols-toggle:not(:checked) ~ .table-scroll .col--hide-ml { display: none; }
}
@media (min-width: 720.02px) and (max-width: 1151.98px) {
  .cols-toggle:not(:checked) ~ .table-scroll .col--hide-md { display: none; }
}
/* The year-end board: a check of a hidden secondary column that needs attention is
   repeated under the client's name while its column is hidden (720-1280px, "Show all
   columns" unticked), so a tinted row always shows why. */
.board-client__flags--ml { display: none; }
@media (min-width: 720.02px) and (max-width: 1279.98px) {
  .cols-toggle:not(:checked) ~ .table-scroll .board-client__flags--ml { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
}

.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; min-width: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* Text in a cell breaks between words; a word longer than its column (a file name,
   an e-mail) breaks only when it does not fit at all. The column is never squeezed
   below its longest word: a wide table scrolls sideways instead (.table-scroll). */
.table td { overflow-wrap: break-word; }
.table td.cell-words { overflow-wrap: break-word; }
/* Long free text (notes, reasons, details) wraps inside a column of a sensible width. */
.table .cell-text { min-width: 10rem; }
.table .cell-text--narrow { min-width: 8rem; }
.table td code, .table .url-wrap { overflow-wrap: anywhere; }
/* An HMRC transaction ID: breaks only between its halves (|id_wrap), never mid-code;
   the whole ID is its tooltip and copies whole. */
.table td code.code-id { overflow-wrap: normal; word-break: normal; }
/* Short values never wrap: dates, month codes, references. */
.table .cell-short { white-space: nowrap; }
/* A secondary detail of a cell (a state, "(salary)", "at least") goes under the main
   value in a smaller muted line, instead of widening the column. */
.cell-sub { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); white-space: normal; }
/* The Clients list: a company whose director is not known yet shows the gap under its
   name (a muted link to the edit form for whoever may fill it in). */
.cell-sub--missing { font-style: italic; }
a.cell-sub--missing { color: var(--muted); text-decoration: underline dotted; }
a.cell-sub--missing:hover { color: var(--primary); }

/* A badge is a short value: it never wraps. .badge--text: a status sentence (the
   year-end checks, a warning) wraps between words inside its column. */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; vertical-align: middle; white-space: nowrap; }
.badge--text { white-space: normal; overflow-wrap: normal; border-radius: .6rem; text-align: left; }
/* On a phone a badge is never wider than its card: a long one wraps between its words
   instead of running out of the card and scrolling the page sideways. */
@media (max-width: 720px) {
  .badge { max-width: 100%; white-space: normal; }
}
.badge--active { background: #e2f3e8; color: var(--success); }
.badge--ceased { background: #eceff2; color: var(--muted); }

/* The Clients section: the services of a client as chips (wrapping as needed), the
   tick boxes of the services card, and the count in each tab's label. */
.badge--service { background: #e6eef8; color: var(--primary); font-weight: 500; }
.service-chips { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
/* A service with a page of its own is a link to that client's page (10 Nov 2026): the same chip, underlined on hover. */
.service-chips a.badge--service { text-decoration: none; }
.service-chips a.badge--service:hover, .service-chips a.badge--service:focus-visible { text-decoration: underline; background: #d6e3f5; }
.services-list { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .35rem 1rem; }
.services-list__item label { display: inline-flex; align-items: center; gap: .4rem; }
.services-list__item input { width: auto; margin: 0; }
.services-list__item .help { display: block; margin: .1rem 0 0 1.6rem; }
.tab-count { color: var(--muted); font-weight: 400; }
.tabs a[aria-current="page"] .tab-count { color: inherit; }

.pagination { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }

/* Phone and tablet: the menu button ------------------------------------------ */

/* Below 980px the seven links and the user menu no longer fit one row (the header was
   two rows, 90px high, from 720 to 965px): the header is the name, the bell and a menu
   button (☰) that opens the links. On a tablet the links open as rows of buttons, on a
   phone as a list. */
@media (max-width: 979.98px) {
  /* The wordmark leaves room for the bell and the menu button (or the language switch
     of a signed-out page) on the same row: it shrinks instead of pushing them under it. */
  .brand { max-width: calc(100% - 7.5rem); }
  .bell { margin-left: auto; }
  .bell ~ .nav-toggle__label { margin-left: 0; }
  .nav-toggle__label { display: block; margin-left: auto; font-size: 1.5rem; cursor: pointer; padding: .2rem .5rem; border-radius: var(--radius); }
  /* Visually hidden but focusable: Space toggles the menu from the keyboard. */
  .nav-toggle {
    display: block; position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .nav-toggle:focus-visible + .nav-toggle__label { outline: 2px solid var(--primary); outline-offset: 2px; }
  /* flex-basis 100%: the open menu always takes a row of its own, under the name. */
  .nav { display: none; flex-direction: column; align-items: stretch; width: 100%; flex: 0 0 100%; }
  .nav-toggle:checked ~ .nav { display: flex; }
  /* (The menu's user part only: a signed-out page keeps its language switch on the right.) */
  .nav > .user-menu { margin-left: 0; padding-top: .5rem; border-top: 1px solid var(--border); }
}
@media (min-width: 720.02px) and (max-width: 979.98px) {
  .nav { flex-direction: row; flex-wrap: wrap; align-items: center; padding-bottom: .25rem; }
  .nav > .user-menu { flex-basis: 100%; }
}

/* Phone ------------------------------------------------------------------- */

@media (max-width: 720px) {
  .details { grid-template-columns: 1fr; gap: 0 0; }
  .details dt { margin-top: .5rem; }
  .card { padding: .85rem; }
}

/* Payroll calculator ------------------------------------------------------- */

.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.calc-layout > .card { margin-bottom: 0; }
.calc-fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .9rem .25rem; margin: 0 0 1rem; min-width: 0; }
.calc-fieldset legend { font-weight: 700; padding: 0 .35rem; }
.calc-subtitle { margin-top: 1.25rem; }
.table td.num, .details dd { font-variant-numeric: tabular-nums; }
.table td.num { text-align: right; white-space: nowrap; }
.calc-line--heading { --row-bg: var(--bg); }
.calc-line--heading th { background: var(--bg); color: var(--text); text-transform: none; font-size: .95rem; letter-spacing: 0; }
.calc-line--total td { font-weight: 700; }
.calc-line--note td { color: var(--muted); font-style: italic; }
.field--choices { border: 0; padding: 0; margin: 0 0 .9rem; min-width: 0; }
.field--choices legend { font-weight: 600; margin-bottom: .25rem; padding: 0; }
.field--choices > div { display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.field--choices label { display: inline-flex; align-items: center; gap: .3rem; font-weight: 400; margin: 0; }
.calc-note { color: var(--muted); font-size: .9rem; margin: .5rem 0 0; }

@media (max-width: 900px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Client tabs, payroll month ------------------------------------------------ */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.table th.num { text-align: right; }
/* CIS money cells (class on the cell): right-aligned, amounts never broken. */
.table td.table--money, .table th.table--money { text-align: right; white-space: nowrap; overflow-wrap: normal; font-variant-numeric: tabular-nums; }
.table td.table--money small { white-space: normal; }
.table th.center, .table td.center { text-align: center; }
.message--info { border-color: var(--primary); color: var(--primary); }

/* A tab strip is never cut off: when the window is too narrow for one row the tabs
   wrap onto a second one (a tab's own words never wrap). Below 980px the client's
   tabs become rounded buttons (below), so a wrapped row still reads as tabs. */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--border); margin: 0 0 1.25rem; }
.tabs a {
  white-space: nowrap; text-decoration: none; color: var(--text); padding: .55rem .85rem; border: 1px solid transparent;
  border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -1px;
}
.tabs a:hover { background: var(--surface); }
.tabs a[aria-current="page"] { background: var(--surface); border-color: var(--border); color: var(--primary); font-weight: 600; }
/* The second row of tabs (the CIS sections inside the client's CIS tab, the statuses of
   the HMRC notices): rounded buttons that wrap onto as many rows as the window needs -
   the ten CIS sections fit one row only from about 1500px. */
.tabs--sub { margin-top: -.5rem; font-size: .92rem; gap: .35rem; border-bottom: 0; }
.tabs--sub a { padding: .3rem .75rem; border: 1px solid var(--border); border-radius: 999px; margin-bottom: 0; background: var(--surface); }
.tabs--sub a:hover { border-color: var(--muted); }
.tabs.tabs--sub a[aria-current="page"] { background: #e6eef8; border-color: var(--primary); color: var(--primary); }
@media (max-width: 979.98px) {
  .tabs:not(.tabs--sub) { border-bottom: 0; gap: .35rem; }
  .tabs:not(.tabs--sub) a { padding: .35rem .8rem; border: 1px solid var(--border); border-radius: 999px; margin-bottom: 0; background: var(--surface); }
  .tabs:not(.tabs--sub) a[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: #fff; }
}
/* A phone: smaller buttons, so the client's tabs and the CIS sections take fewer rows. */
@media (max-width: 720px) {
  .tabs, .tabs.tabs--sub { font-size: .875rem; gap: .3rem; }
  .tabs:not(.tabs--sub) a, .tabs.tabs--sub a { padding: .25rem .6rem; }
}

.toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
.toolbar .filters { margin-bottom: .75rem; }
.actions--tight { margin-top: 0; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.form-grid__full { grid-column: 1 / -1; }
.adj-row {
  display: grid; grid-template-columns: minmax(110px, 1fr) minmax(160px, 2fr) minmax(110px, 1fr) auto auto;
  gap: 0 .75rem; align-items: end; border-bottom: 1px dashed var(--border); margin-bottom: .5rem;
}
.adj-row .field--checkbox { padding-bottom: .6rem; }

.year-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.year-nav a { text-decoration: none; }

.month-bar {
  display: grid; grid-template-columns: repeat(12, minmax(52px, 1fr)); gap: .3rem; margin-bottom: 1.25rem;
  overflow-x: auto; padding-bottom: .25rem;
}
.month-bar__item {
  display: flex; flex-direction: column; align-items: center; padding: .35rem .2rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text);
  border-top-width: 4px; min-width: 52px;
}
.month-bar__label { font-weight: 700; font-size: .9rem; }
.month-bar__date { font-size: .75rem; color: var(--muted); text-transform: capitalize; }
.month-bar__item--closed { border-top-color: var(--success); }
.month-bar__item--open { border-top-color: var(--primary); }
.month-bar__item--imported { border-top-color: var(--muted); background: var(--bg); }
.month-bar__item--none { border-top-color: var(--border); }
.month-bar__item--nil { border-top-color: var(--warning); }
.month-bar__item--overdue { border-top-color: var(--danger); }
.month-bar__item[aria-current="page"] { outline: 2px solid var(--primary); outline-offset: 1px; }
.month-bar__legend { margin: -.75rem 0 1.25rem; font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.month-bar__swatch { display: inline-block; width: 1.4rem; height: .8rem; border: 1px solid var(--border); border-top: 4px solid var(--muted); background: var(--bg); border-radius: 2px; }

.page-header--sub { margin-bottom: .75rem; }
.page-header--sub h2 { margin: 0; }
.export-form { display: flex; gap: .4rem; align-items: center; }
.export-form select {
  padding: .45rem .5rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit;
  background: var(--surface); color: var(--text);
}

.banner { padding: .65rem .9rem; border-radius: var(--radius); border: 1px solid var(--border); margin: 0 0 1rem; background: var(--surface); }
.banner--warning { border-color: var(--warning); background: #fff6e5; color: #6b4500; font-weight: 600; }
.banner--info { border-color: var(--primary); background: #eef4fb; }
.banner--danger { border-color: var(--danger); background: #fbe4e2; color: #7a1f17; font-weight: 600; }
.rates-table td, .rates-table th { vertical-align: top; }
.rates-table code { font-size: .75rem; word-break: break-all; }
.rates-fingerprint code { word-break: break-all; }
/* A disabled button must look disabled (the rates confirmation, among others). */
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
@media (max-width: 720px) {
  /* Phone: the year-end board's clients become small cards (name, then
     "Heading: state" lines), instead of a 10-column table scrolled sideways. */
  .table--year-end { display: block; overflow-x: visible; }
  .table--year-end tbody, .table--year-end tr, .table--year-end td { display: block; width: auto; }
  .table--year-end thead { display: none; }
  .table--year-end tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table--year-end td, .table--year-end td.board-cell { border: 0; padding: .15rem 0; min-width: 0; }
  .table--year-end td.board-client { font-weight: 600; font-size: 1rem; padding-bottom: .25rem; position: static; }
  .table--year-end td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
  /* Phone: every figure becomes a small card (label, then "Heading: value" lines). */
  .rates-table { display: block; overflow-x: visible; }
  .rates-table tbody, .rates-table tr, .rates-table td { display: block; width: auto; }
  .rates-table thead { display: none; }
  .rates-table tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .rates-table td { border: 0; padding: .1rem 0; min-width: 0; text-align: left; }
  .rates-table td.rates-figure { font-weight: 600; padding-bottom: .25rem; }
  .rates-table td.rates-figure .muted { font-weight: normal; }
  .rates-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
}

.run-actions__row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .4rem 0; }
.run-actions__row + .run-actions__row { border-top: 1px solid var(--border); }

.badge--info { background: #e6eef8; color: var(--primary); }
.badge--warning { background: #fff0d6; color: var(--warning); }
.badge--danger { background: #fbe4e2; color: var(--danger); }
.badge--left { background: #eceff2; color: var(--muted); }

.btn--danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: #fbe4e2; }
.btn--warning { background: var(--surface); border-color: var(--warning); color: var(--warning); }
.btn--warning:hover { background: #fff0d6; }
.checklist, .steps { padding-left: 1.4rem; }
.checklist li, .steps li { margin: .35rem 0; }
.checklist li[data-ok="0"] { color: var(--danger); }
pre.code { background: #f4f6f8; border: 1px solid var(--border); border-radius: 6px; padding: .6rem .8rem; overflow-x: auto; font-size: .85rem; }
.card--warning { border-color: var(--warning); border-left-width: 5px; }

.table--money td.num { white-space: nowrap; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--text); }

.pstate {
  display: inline-block; min-width: 1.8rem; padding: .1rem .3rem; border-radius: 4px; text-decoration: none;
  font-weight: 700; text-align: center;
}
.pstate--submitted { background: #e2f3e8; color: var(--success); }
.pstate--not_submitted { background: #fbe4e2; color: var(--danger); }
.pstate--resubmit { background: #fff0d6; color: var(--warning); }
.pstate--no_run { color: var(--muted); }
.pstate--brightpay { background: #e9eef6; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; align-items: center; font-size: .9rem; }
.table--pensions td, .table--pensions th { padding: .4rem .3rem; }
/* Names in the first column wrap only between words, never mid-word (the wide
   tables scroll sideways instead of squeezing that column to a few letters). */
.table--money td:first-child, .table--pensions td:first-child { overflow-wrap: normal; min-width: 8rem; }
@media (min-width: 720.02px) and (max-width: 1151.98px) {
  .table--money td:first-child, .table--pensions td:first-child { min-width: 7rem; }
}
@media (min-width: 720.02px) and (max-width: 979.98px) {
  .table--money td:first-child, .table--pensions td:first-child { min-width: 6.5rem; }
}

@media (max-width: 720px) {
  .adj-row { grid-template-columns: 1fr 1fr; }
  /* Two rows of six: all twelve months (and the current one) visible without scrolling. */
  .month-bar { grid-template-columns: repeat(6, minmax(44px, 1fr)); overflow-x: visible; }
  .month-bar__item { min-width: 0; }
  .page-header--sub { align-items: flex-start; }
}

/* Month documents panel */
.doc-list { list-style: none; padding: 0; margin: .25rem 0 .75rem; }
.doc-list li { padding: .2rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.form-inline { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.form-inline .field { margin: 0; }

/* RTI submission details (FPS card, HMRC settings) */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: .5rem 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Feedback button (header) ------------------------------------------------- */
.feedback-menu { position: relative; }
.feedback-menu > summary { list-style: none; cursor: pointer; font-size: .85rem; color: var(--muted); }
.feedback-menu > summary::-webkit-details-marker { display: none; }
.feedback-menu[open] > summary { color: var(--primary); }
.feedback-menu__panel {
  position: absolute; right: 0; top: calc(100% + .4rem); z-index: 50; width: min(22rem, 90vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(28, 36, 48, .15); padding: .9rem;
}
/* Below 980px the "Feedback" summary is inside the menu (the menu button, above): the
   form opens in place, at the menu's width. */
@media (max-width: 979.98px) {
  .feedback-menu__panel { position: static; width: 100%; margin-top: .4rem; box-shadow: none; }
}
.feedback-menu__panel .field { margin-bottom: .6rem; }
.feedback-menu__panel textarea { width: 100%; }
.feedback-shot { max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); }
.prewrap { white-space: pre-wrap; }
/* An HMRC notice COSMOSES could not read: its XML, wrapped (never wider than the page). */
.notice-xml { white-space: pre-wrap; word-break: break-all; font-size: .8rem; max-height: 20rem; overflow: auto; }

/* Users (Settings) ----------------------------------------------------------- */
.card--form { max-width: 640px; }
.team-actions { white-space: nowrap; }
/* Names, roles and badges wrap only between words, never mid-word. */
.table--team td { overflow-wrap: normal; }
.table--team .badge { white-space: nowrap; }
.btn--link-danger { color: var(--danger); }
.copy-field { display: flex; gap: .5rem; margin: .75rem 0; }
.copy-field input { flex: 1; min-width: 0; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.help-list { color: var(--muted); font-size: .9rem; padding-left: 1.2rem; }
/* Bookkeeping step 2: one decision per block on the Decisions page, the open items as a spaced list. */
.decision { border-top: 1px solid var(--border); padding-top: .75rem; margin-top: 1rem; }
.decision:first-of-type { border-top: 0; margin-top: .5rem; }
.decision .page-header--sub { margin-bottom: .25rem; }
.decision-lines { margin: .35rem 0 .6rem; }
.decision-lines li { margin: .2rem 0; }
.decision-form { margin-top: .5rem; }
.items-list li { margin: .45rem 0; line-height: 1.5; }
.ledger-note--draft { color: var(--muted); }
.ledger-note--document { font-style: italic; }
.receipt-thumb { max-width: 64px; max-height: 96px; border: 1px solid var(--border, #ccc); vertical-align: middle; }
.ledger-receipt { margin-top: .25rem; text-align: left; }
.ledger-note--decision { font-weight: 600; }

@media (max-width: 720px) {
  .team-actions { white-space: normal; }
  /* Phone: every user becomes a small card (name, then "Label: value" lines,
     then the actions), instead of a squeezed table that scrolls sideways. */
  .table--team, .table--team tbody, .table--team tr, .table--team td { display: block; width: auto; }
  .table--team thead { display: none; }
  .table--team tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table--team td { border: 0; padding: .1rem 0; }
  .table--team td.team-name { font-weight: 600; }
  .table--team td.team-email { overflow-wrap: anywhere; }
  .table--team td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
  .table--team .team-actions { padding-top: .35rem; }
}

/* Month board ------------------------------------------------------------------ */
.stats--board { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.stat--success .stat__value { color: var(--success); }
.stat--warning .stat__value { color: var(--warning); }
.stat--danger .stat__value { color: var(--danger); }
.filters--board { align-items: center; }
.filters__check { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.filters__check input { width: auto; }
.table--board td { vertical-align: top; }
/* Client names wrap only between words (the table scrolls sideways on a phone). */
.table--board td.board-client { overflow-wrap: normal; min-width: 9rem; }
.table--board .board-cell { min-width: clamp(9rem, 10vw, 11rem); }
/* The year-end board: up to ten columns of states. Each cell shows a few words under
   its column's heading (the whole sentence is the tooltip: year_end.Check.short) on
   one or two lines: a cell is never narrower than 6rem, wider in a wide window (the
   board squeezed a column to 48px and "Nobody gets a P60" took three lines). The board
   still fits the window: below 1280px its secondary columns wait behind "Show all
   columns", and on a tablet the cells and their type are tighter. */
.table--year-end .board-cell { min-width: clamp(6rem, 7.5vw, 9rem); }
.table--year-end td.board-client { min-width: 7.5rem; }
@media (min-width: 720.02px) and (max-width: 1439.98px) {
  .table--year-end > * > tr > :is(th, td) { padding: .4rem .35rem; }
  .table--year-end .badge--text { padding: .1rem .4rem; }
}
@media (min-width: 720.02px) and (max-width: 979.98px) {
  .table--year-end > * > tr > :is(th, td) { padding: .3rem .25rem; }
  .table--year-end .board-cell { min-width: 5.25rem; }
  .table--year-end td.board-client { min-width: 7rem; }
  .table--year-end .badge--text { padding: .1rem .35rem; font-size: .7rem; }
}
.badge--link { text-decoration: none; }
.badge--link:hover { text-decoration: underline; }
/* Rows that need attention: a warm tint, red when something is overdue. */
.board-row--attention { background: #fff8ee; box-shadow: inset 4px 0 0 var(--warning); --row-bg: #fff8ee; }
.board-row--overdue { background: #fdf1f0; box-shadow: inset 4px 0 0 var(--danger); --row-bg: #fdf1f0; }
.table--board tbody tr.board-row--attention:hover { background: #fff2dc; --row-bg: #fff2dc; }
.table--board tbody tr.board-row--overdue:hover { background: #fbe4e2; --row-bg: #fbe4e2; }
/* The stripe also on the first cell: a sticky first cell paints over the row's own. */
.board-row--attention > td:first-child { box-shadow: inset 4px 0 0 var(--warning); }
.board-row--overdue > td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.board-chips { display: inline-flex; flex-wrap: wrap; gap: .25rem; margin-left: .25rem; }
.board-cell__detail { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.board-deadlines, .board-flags { list-style: none; margin: 0; padding: 0; }
.board-deadlines { font-size: .85rem; white-space: nowrap; }
.board-deadline__label { color: var(--muted); }
.board-deadline__hint { color: var(--muted); }
.board-deadline--soon, .board-deadline--soon .board-deadline__hint { color: var(--warning); font-weight: 600; }
.board-deadline--late, .board-deadline--late .board-deadline__hint { color: var(--danger); font-weight: 600; }
@media (max-width: 1439.98px) {
  /* Compact density: a deadline's hint "(in 3 days)" may go under its date. */
  .board-deadlines { white-space: normal; min-width: 12.5rem; }
  .board-deadline__hint { white-space: nowrap; }
}
.board-flags { display: flex; flex-wrap: wrap; gap: .25rem; }
/* "Needs attention only": the phase tiles still count the whole month. */
.stat--dim { opacity: .55; }
.board-caption { margin: 0 0 .75rem; font-size: .9rem; }
.board-carry { margin-bottom: 1rem; }
/* The flags repeated under the client name: on a phone (each client is a card without
   the Attention line) and on a tablet, where the Attention column is left out so the
   board fits the window (it scrolled 181px at 768px). */
.board-client__flags { display: none; }
@media (max-width: 979.98px) {
  .board-client__flags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
}
@media (min-width: 720.02px) and (max-width: 979.98px) {
  .table--board .board-attention { display: none; }
  .table--board:not(.table--year-end) .board-cell { min-width: 8.5rem; }
  .board-deadlines { min-width: 11.5rem; }
}

/* Changes since last month (the month page) ----------------------------------- */
/* The difference that raised a flag stands out from the ones under the thresholds. */
.table--changes .changes-flagged { font-weight: 600; color: var(--warning); }
.table--changes .changes-flagged .muted { color: inherit; }
@media (max-width: 720px) {
  /* Phone: one block per employee - the name and the flags on top, the
     differences at full width below - instead of three squeezed columns. */
  .table--changes, .table--changes tbody, .table--changes tr, .table--changes td { display: block; width: auto; }
  .table--changes thead { display: none; }
  .table--changes tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table--changes td { border: 0; padding: .1rem 0; min-width: 0; }
  .table--changes td.changes-employee { display: inline-block; font-weight: 600; font-size: 1rem; margin-right: .5rem; }
  .table--changes td.changes-flags { display: inline-block; }
  .table--changes td.changes-diffs .doc-list { margin-bottom: 0; }
}

/* Month data ("Datele lunii"): one row per employee, many small inputs -------- */

.table--month-data { font-size: .92rem; }
.table--month-data th, .table--month-data td { padding: .4rem .3rem; vertical-align: top; }
.table--month-data td:first-child { overflow-wrap: normal; min-width: 9rem; }
.table--month-data .field { margin-bottom: .25rem; }
/* The column header names the input: its label is kept for screen readers only. */
.table--month-data .field label {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.table--month-data .field--checkbox label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; clip-path: none; white-space: normal; display: inline; font-weight: 400; font-size: .85rem; }
/* The inputs take their column's width (fluid): the grid fills the window and fits it
   from 1280px (below that each employee is a card); each kind of input keeps a usable
   smallest width. */
.table--month-data input:not([type="checkbox"]), .table--month-data select { width: 100%; max-width: none; min-width: 4.25rem; padding: .35rem .35rem; }
.table--month-data input[type="date"] { min-width: 8rem; }
.table--month-data input[type="text"] { min-width: 5.5rem; }
.table--month-data .md-note input { min-width: 6rem; }
.table--month-data .error { font-size: .8rem; }
.month-data__wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Compact density: tighter cells, so the twelve columns fit a 1280px window. */
@media (min-width: 720.02px) and (max-width: 1439.98px) {
  .table--month-data > * > tr > :is(th, td) { padding: .4rem .25rem; }
  .table--month-data td:first-child { min-width: 8rem; }
}
/* A smaller window (the 1000px Safari window, a tablet): the twelve inputs no longer fit
   side by side, so each employee becomes a card - the name on top, then the inputs
   under their own labels in as many columns as the width allows - instead of a grid
   that scrolls sideways. */
@media (min-width: 720.02px) and (max-width: 1279.98px) {
  .table--month-data.md-form, .md-form > tbody { display: block; }
  .md-form > thead { display: none; }
  .md-form > tbody > tr {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .1rem 1rem;
    padding: .75rem 0; border-bottom: 1px solid var(--border);
  }
  .table-scroll > .table.md-form > tbody > tr > td:is(*, :first-child:not([colspan])) {
    display: block; border: 0; padding: 0; min-width: 0; position: static; background: none;
  }
  .table-scroll > .table.md-form > tbody > tr > td:first-child:not([colspan]) { grid-column: 1 / -1; font-size: 1rem; padding-bottom: .35rem; }
  /* A salaried employee's hours keep their place (and their heading), so every card
     has its inputs in the same order and position. */
  .md-form td[data-label]::before { content: attr(data-label); display: block; margin: 0 0 .15rem; font-size: .85rem; color: var(--muted); }
  .md-form .field label {
    position: static; width: auto; height: auto; margin: 0 0 .15rem; overflow: visible; clip: auto; clip-path: none;
    white-space: normal; display: block; font-size: .85rem; color: var(--muted);
  }
  .md-form .field--checkbox label { display: inline; margin: 0; }
}
@media (max-width: 720px) {
  /* Phone: every employee becomes a card (name, then each input under its own
     label), instead of a 12-column table that scrolls sideways with no name or
     header in sight (the same pattern as the users table). */
  .month-data__wrap { overflow-x: visible; }
  .table--month-data, .table--month-data tbody, .table--month-data tr, .table--month-data td { display: block; width: auto; }
  .table--month-data thead { display: none; }
  .table--month-data tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table--month-data td { border: 0; padding: .15rem 0; min-width: 0; }
  .table--month-data td:first-child { font-size: 1rem; padding-bottom: .35rem; }
  .table--month-data .md-na { display: none; }
  .table--month-data .field label {
    position: static; width: auto; height: auto; margin: 0 0 .15rem; overflow: visible; clip: auto; clip-path: none;
    white-space: normal; display: block; font-size: .85rem; color: var(--muted);
  }
  .table--month-data .field--checkbox label { display: inline; margin: 0; }
  .table--month-data input:not([type="checkbox"]), .table--month-data select, .table--month-data input[type="date"],
  .table--month-data input[type="text"], .table--month-data .md-note input { width: 100%; }
}

/* Migration from BrightPay (Settings) ------------------------------------------ */
.table--migration td { vertical-align: top; font-size: .9rem; }
.table--migration td:first-child { overflow-wrap: normal; min-width: 9rem; }
/* "Last import": the result and its date, the detail lines under it - wide enough that
   each detail line ("last month from BrightPay: M6 (date)") keeps to one line. */
.table--migration td.cell-text { min-width: 13rem; }
.table--migration td.cell-text .help { font-size: .8rem; }
@media (min-width: 720.02px) and (max-width: 1151.98px) {
  /* The secondary columns are hidden at this width: the room goes to "Last import". */
  .table--migration td.cell-text { min-width: clamp(13rem, 27vw, 18rem); }
}
@media (min-width: 720.02px) and (max-width: 979.98px) {
  /* A tablet: the detail lines may wrap, so the board fits a 900px window. */
  .table--migration td.cell-text { min-width: 13rem; }
}
@media (min-width: 1280px) and (max-width: 1599.98px) {
  .table--migration td.cell-text { min-width: 17rem; }
}
.table--migration-plans td { vertical-align: top; font-size: .88rem; }
.table--migration-plans .doc-list { font-size: .82rem; }
.verify-form { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
/* The client's folders (its Dropbox page): a folder name breaks between words
   where it can; the choice never runs out of its cell. */
.table--folders td { overflow-wrap: break-word; }
.table--folders td code { overflow-wrap: anywhere; }
/* The choice takes its column's width (a long folder path no longer makes the column
   half the table and the "Found" notes six lines high). */
.table--folders select {
  width: 100%; min-width: 12rem; max-width: 100%; padding: .35rem .4rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit;
  background: var(--surface); color: var(--text);
}
.verify-form input[type="text"] { width: 8rem; }

@media (max-width: 720px) {
  /* Phone: every client becomes a small card (name, then "Heading: value" lines,
     then the "Checked by the team" control), instead of a 12-column table that
     scrolls the client name out of view (the same pattern as the users table). */
  .table--migration { display: block; overflow-x: visible; }
  .table--migration tbody, .table--migration tr, .table--migration td { display: block; width: auto; }
  .table--migration thead { display: none; }
  .table--migration tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table--migration td { border: 0; padding: .1rem 0; min-width: 0; }
  .table--migration td.migration-client { font-weight: 600; font-size: 1rem; padding-bottom: .25rem; }
  .table--migration td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
  .table--migration td.migration-verify { padding-top: .35rem; }
  .table--migration .verify-form input[type="text"] { width: 100%; }
  /* The client's folders (its Dropbox page): one small card per folder, the
     choice full width, so the folder chosen is seen before "Confirm". */
  .table--folders { display: block; overflow-x: visible; }
  .table--folders tbody, .table--folders tr, .table--folders td { display: block; width: auto; }
  .table--folders thead { display: none; }
  .table--folders tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table--folders td { border: 0; padding: .15rem 0; min-width: 0; }
  .table--folders td.folders-role { font-weight: 600; overflow-wrap: break-word; padding-bottom: .25rem; }
  .table--folders td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
  .table--folders select { width: 100%; }
  /* The month-X preview and result (card 5): the same cards, the tick box first. */
  .table--month-plans { display: block; overflow-x: visible; }
  .table--month-plans tbody, .table--month-plans tr, .table--month-plans td { display: block; width: auto; }
  .table--month-plans thead { display: none; }
  .table--month-plans tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table--month-plans td { border: 0; padding: .1rem 0; min-width: 0; white-space: normal; }
  .table--month-plans td.migration-client { font-weight: 600; font-size: 1rem; padding-bottom: .25rem; overflow-wrap: anywhere; }
  .table--month-plans td.migration-client .help { font-weight: 400; }
  .table--month-plans td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
}

/* Pay history (employee) and the year-end page. */
.row--included td, .row--draft td, .row--none td, .row--covered td, .row--future td { color: var(--muted); }
.row--opening td { background: #f3f6f7; }
.row--opening { --row-bg: #f3f6f7; }
.row--problem td:first-child { border-left: 3px solid var(--warning); }
/* The problems of an employee's figures sit under the name, one badge a line. */
.row--problem .badge { display: block; white-space: normal; text-align: left; margin-top: .3rem; max-width: 24rem; }
/* Long money headings (year-end, pay history) may wrap: the table stays narrow enough on a phone. */
.table--money.table--wrap-heads th.num { white-space: normal; }

/* Legislation monitor: the difference between two versions of an official page (plain text). */
.diff { font-size: .92rem; }
.diff__heading { margin: .9rem 0 .25rem; font-weight: 600; color: var(--muted); }
.diff__line { margin: 0; padding: .2rem .5rem; border-left: 3px solid var(--border); overflow-wrap: anywhere; }
.diff__line--add { border-left-color: var(--success); background: #eef8f1; }
.diff__line--del { border-left-color: var(--danger); background: #fdf0ef; text-decoration: line-through; text-decoration-thickness: 1px; }
.diff__op { font-weight: 700; display: inline-block; width: 1rem; }
.diff__title { font-weight: 600; }
.diff__sep { color: var(--muted); }
.stack-form { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.stack-form input[type="text"] { flex: 1 1 10rem; min-width: 8rem; }
/* A setting's name in a sentence: may break anywhere (a phone is narrower than the name). */
.code-wrap { overflow-wrap: anywhere; word-break: break-all; }
@media (max-width: 720px) {
  /* Phone: each figure found becomes a small card (label, then "Heading: value" lines, then the buttons). */
  .table--proposals { display: block; overflow-x: visible; }
  .table--proposals tbody, .table--proposals tr, .table--proposals td { display: block; width: auto; }
  .table--proposals thead { display: none; }
  .table--proposals tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table--proposals td, .table--proposals td.num { border: 0; padding: .1rem 0; min-width: 0; text-align: left; }
  .table--proposals td.proposal-figure { padding-bottom: .25rem; }
  .table--proposals td.proposal-actions { padding-top: .35rem; }
  .table--proposals td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
}

/* Local assistant ------------------------------------------------------------ */
.assistant-turn { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.assistant-turn__main > .card { margin-bottom: .5rem; }
.assistant-sources { margin-bottom: 0; font-size: .9rem; }
.assistant-sources__list { margin: 0; padding-left: 1.1rem; }
.assistant-sources__list li { margin-bottom: .4rem; overflow-wrap: anywhere; }
.assistant-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-question { background: var(--bg); }
/* The footer COSMOSES writes under an answer built on the glossary or the official sources. */
.assistant-footer { margin: .75rem 0; padding-top: .6rem; border-top: 1px solid var(--border); font-size: .9rem; overflow-wrap: anywhere; }
.assistant-footer p { margin: 0 0 .25rem; }
.assistant-footer__links { margin: 0 0 .5rem; padding-left: 1.1rem; }
.assistant-footer__links li { margin-bottom: .2rem; }
mark.unverified { background: #fde2a7; color: inherit; padding: 0 .15em; border-radius: 3px; }
.unverified-tag { font-size: .75rem; color: var(--warning); font-weight: 600; margin-left: .2em; }
.amount--verified { border-bottom: 1px dotted var(--success); }
/* An amount taken from the question or the client's message: not checked, said so. */
mark.quoted, .amount--quoted { background: #e6ecf5; color: inherit; padding: 0 .15em; border-radius: 3px; border-bottom: 1px dashed var(--muted); }
.quoted-tag { font-size: .75rem; color: var(--muted); font-weight: 600; margin-left: .2em; }
@media (max-width: 760px) {
  .assistant-turn { grid-template-columns: minmax(0, 1fr); }
}

/* Phone cards (any wide table marked .table--cards) ------------------------------ */
@media (max-width: 720px) {
  /* Phone: every row becomes a small card - the first cell (the name) on top, then
     "Heading: value" lines from each cell's data-label - instead of a wide table
     scrolled sideways (the same pattern as the users and migration tables). */
  .table.table--cards, .table--cards > tbody, .table--cards > tfoot,
  .table--cards > tbody > tr, .table--cards > tfoot > tr,
  .table.table--cards > :is(tbody, tfoot) > tr > :is(td, th) { display: block; width: auto; }
  .table--cards > thead { display: none; }
  .table--cards > tbody > tr, .table--cards > tfoot > tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table.table--cards > :is(tbody, tfoot) > tr > :is(td, th) {
    border: 0; padding: .1rem 0; min-width: 0; text-align: left; white-space: normal;
  }
  .table.table--cards > :is(tbody, tfoot) > tr > th { color: var(--text); font-size: .95rem; text-transform: none; letter-spacing: 0; }
  .table.table--cards > :is(tbody, tfoot) > tr > :is(td, th):empty { display: none; }
  .table.table--cards > :is(tbody, tfoot) > tr > :is(td, th):first-child:not([data-label]) { font-weight: 600; font-size: 1rem; padding-bottom: .25rem; }
  .table.table--cards > :is(tbody, tfoot) > tr > :first-child :is(.muted, .help, small, .board-cell__detail) { font-weight: 400; }
  .table.table--cards :is(td, th)[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; font-weight: 400; }
  /* Cells a card does not need (an empty actions column, a value repeated under the name). */
  .table.table--cards td.card-hide { display: none; }
  /* A tick box and the name it selects share the card's first line. */
  .table.table--cards > tbody > tr > td.card-inline { display: inline-block; vertical-align: middle; margin-right: .35rem; }
  .table.table--cards td.card-title { font-weight: 600; font-size: 1rem; }
  /* Pensions: the twelve months of a client side by side ("M1: ✓"), wrapping as needed. */
  .table.table--cards > tbody > tr > td.pension-month { display: inline-block; margin: .15rem .6rem 0 0; }
  /* A card table does not scroll sideways: its first cell is not sticky. */
  .table-scroll > .table:is(.table--cards, .table--year-end, .rates-table, .table--team, .table--changes, .table--migration,
    .table--folders, .table--month-plans, .table--proposals, .table--month-data) > :is(tbody, tfoot) > tr > :is(td, th):first-child {
    position: static; background: none;
  }
  /* A figure in a card: the line may wrap like text (rates page). */
  .rates-table td.num { white-space: normal; }
  /* In a card the detail follows the value on the same line ("Hours a month: at least 104") -
     except the directors line of the Clients list, which stays under the company name. */
  .table.table--cards .cell-sub { display: inline; }
  .table.table--cards.table--clients .cell-sub { display: block; }
  .table.table--cards td.cell-email { overflow-wrap: anywhere; }
  /* Label above value: a long label no longer squeezes the value into a narrow column. */
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dt { margin-top: .4rem; }
}

/* Self Assessment -------------------------------------------------------------- */
/* The facts under a return's name (client ID, UTR, status), wrapping as needed. */
.sa-facts { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; margin: .35rem 0 0; color: var(--muted); }
.sa-facts strong { color: var(--text); }
/* The boxes of a section form: two columns on a wide window, one on a phone; each box
   is the number printed on HMRC's form ("9", "10.1", "1 / 2" for the due / overpaid pair;
   blank when HMRC prints none) in a narrow column and the field beside it. */
.sa-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 0 1.75rem; }
.sa-box { display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); gap: .5rem; align-items: start; padding: .45rem 0; border-top: 1px solid var(--border); min-width: 0; }
.sa-box__no { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; font-weight: 700; color: var(--muted); padding-top: .15rem; overflow-wrap: anywhere; }
.sa-box .field, .sa-box .field--choices { margin-bottom: 0; min-width: 0; }
.sa-box .field label, .sa-box .field--choices legend { font-weight: 500; }
.sa-box--flagged { box-shadow: inset 3px 0 0 var(--danger); padding-left: .5rem; }
.sa-box__req { color: var(--danger); font-weight: 700; }
.sa-form__required { margin-top: .6rem; }
.sa-box__suggested { color: var(--warning); }
.sa-issue { font-size: .88rem; margin: .25rem 0 0; }
.sa-issue--error { color: var(--danger); }
.sa-issue--warning { color: var(--warning); }
.sa-issue--info { color: var(--muted); }
.sa-group > summary h2 { font-size: 1.05rem; }
.sa-form__actions { position: sticky; bottom: 0; background: var(--bg); padding: .6rem 0; margin-top: 0; z-index: 2; }
.sa-issues { list-style: none; padding: 0; margin: .25rem 0 1rem; }
.sa-issues > .sa-issue { padding: .4rem 0 .4rem .6rem; border-top: 1px solid var(--border); margin: 0; overflow-wrap: anywhere; }
.sa-issues > .sa-issue--error { border-left: 3px solid var(--danger); }
.sa-issues > .sa-issue--warning { border-left: 3px solid var(--warning); }
.sa-issue__boxes { display: block; font-size: .85rem; margin-top: .15rem; }
.sa-hmrc-text { margin: .3rem 0; padding: .4rem .6rem; background: var(--bg); border-radius: var(--radius); color: var(--text); font-size: .88rem; }
.sa-heading--error { color: var(--danger); font-size: 1rem; }
.sa-heading--warning { color: var(--warning); font-size: 1rem; }
.sa-irmark { font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; word-break: break-all; }
.sa-inner { margin: 1rem 0 0; background: var(--bg); }
.sa-filing { border-top: 1px solid var(--border); padding-top: .6rem; margin-top: .6rem; }
.sa-filing:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.sa-filing h3 { font-size: 1rem; }
/* "Add a new section": the catalogue cards. */
.sa-catalogue { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.sa-catalogue__item { margin: 0; }
.sa-catalogue__item h4 { margin: 0 0 .5rem; font-size: 1rem; }
.sa-catalogue__item--taken { opacity: .6; }
.sa-return-table td.num { white-space: normal; text-align: right; }
@media (max-width: 720px) {
  .sa-box { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .sa-return-table td.num { text-align: left; }
}
/* MTD Self Assessment (the tracker): the next deadline's column is tinted, the rules box folds. */
.table--mtd th.is-next, .table--mtd td.is-next { background: #fff6e5; }
.table--mtd th .cell-sub { text-transform: none; letter-spacing: 0; }
.mtd-help > summary { cursor: pointer; font-weight: 600; }
.mtd-help ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.mtd-help li { margin-bottom: .4rem; }
.mtd-help ul ul { margin-top: .25rem; }
.mtd-help ul ul li { margin-bottom: .1rem; }

/* Settings > Email: the sign-in code a manager types at Microsoft's page (selected with one click). */
.mail-code { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.35rem; font-weight: 700; letter-spacing: .12em; padding: .05rem .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); user-select: all; overflow-wrap: anywhere; }

/* Bookkeeping (Faza 1): the Full Ledger table is compact; a line needing a look is tinted orange
   (as the export's orange cells); the running check and the VAT statuses are badges. */
.ledger { font-size: .85rem; }
.ledger th, .ledger td { padding: .25rem .4rem; vertical-align: top; }
.ledger .ledger-details { min-width: 14rem; max-width: 26rem; }
.ledger .ledger-notes { min-width: 12rem; max-width: 24rem; font-size: .8rem; }
.ledger .ledger-category { min-width: 14rem; }
.ledger .ledger-category input[list] { width: 12rem; max-width: 100%; font-size: .85rem; padding: .15rem .35rem; }
.ledger .ledger-form { display: flex; gap: .25rem; align-items: center; flex-wrap: nowrap; }
.ledger .ledger-taxmonth { color: var(--muted); }
.ledger tr.cell-review > td { background: #fff6e5; }
.ledger tr.ledger-row--question > td.ledger-notes { border-left: 3px solid var(--primary); }
.ledger-note { margin: .1rem 0; color: var(--muted); }
.ledger-note--user { color: var(--text); }
.ledger-note--cis[data-cis="DIFFERENT"] { color: var(--danger); font-weight: 600; }
.ledger-note--question { color: var(--primary); }
.ledger-message { margin: .25rem 0 0; font-size: .8rem; color: var(--success); }
.ledger-message--warning { color: var(--warning); }
.ledger-edit { display: grid; gap: .35rem; min-width: 22rem; padding: .35rem 0; }
.ledger-edit .form-inline { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.ledger-edit label { font-size: .8rem; color: var(--muted); display: inline-flex; gap: .25rem; align-items: center; }
.ledger-edit input[type="text"], .ledger-edit input[type="date"] { font-size: .8rem; padding: .15rem .3rem; }
.ledger-more summary { list-style: none; cursor: pointer; }
.ledger-more summary::-webkit-details-marker { display: none; }
.actions--inline { margin-top: .25rem; }
.ledger-filters { margin-bottom: .5rem; }
.ledger-accounts { margin: -.25rem 0 .75rem; }
.ledger-totals th, .ledger-totals td { white-space: nowrap; }
.check-ok { color: var(--success); font-weight: 700; }
.check-bad { color: var(--danger); font-weight: 600; }
.badge--vat-confirmed { background: #e2f3e8; color: var(--success); }
.badge--vat-proposed { background: #fff0d6; color: var(--warning); }
.badge--vat-none { background: #eceff2; color: var(--muted); font-weight: 500; }
.badge--flag { background: #fff0d6; color: var(--warning); font-weight: 500; }
.badge--flag[data-flag="vat_proposal"] { background: #e6eef8; color: var(--primary); }
.badge--flag[data-flag="cis_mismatch"], .badge--flag[data-flag="reversal_unmatched"] { background: #fbe4e2; color: var(--danger); }
@media print { .no-print { display: none !important; } }
@media (max-width: 980px) {
  .ledger .ledger-details, .ledger .ledger-notes, .ledger .ledger-category { min-width: 9rem; }
  .ledger-edit { min-width: 0; }
}
