/* App layout, on top of Folii (tokens.css, folii.css). Colours, sizes and fonts come from tokens. */
body { margin: 0; }
a { color: var(--brand); }
h1 { font: var(--type-title); letter-spacing: var(--tracking-title); margin: 0; }
h2 { font: var(--type-heading); letter-spacing: var(--tracking-heading); margin: 0; }
p { margin: 0; }
small { font: var(--type-body-sm); color: var(--ink-muted); }
code { font-family: ui-monospace, monospace; font-size: .9em; background: var(--surface-sunken); padding: 0 var(--space-1); border-radius: var(--radius-sm); overflow-wrap: anywhere; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-8);
          background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar nav { flex: 1; display: flex; gap: var(--space-1); min-width: 0; }
.topbar nav a { display: inline-flex; align-items: center; height: var(--control-md); padding: 0 var(--space-3); font: var(--type-label);
                color: var(--ink-muted); text-decoration: none; border-radius: var(--radius-md); }
.topbar nav a:hover { background: var(--brand-tint); }
.topbar nav a[aria-current="page"] { color: var(--brand); background: var(--brand-tint); }
.who-role { color: var(--ink-muted); }

main { display: flex; flex-direction: column; gap: var(--space-12); max-width: var(--page-max); margin: 0 auto;
       padding: var(--space-12) var(--space-16) var(--space-24); }
main > * { min-width: 0; }
.section { display: flex; flex-direction: column; gap: var(--space-4); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4) var(--space-6); flex-wrap: wrap; }
.page-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.lede { max-width: var(--measure); margin-top: var(--space-2); color: var(--ink-muted); }
.actions, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.row-actions { display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: var(--space-1); }
.row-actions-stacked { flex-direction: column; align-items: flex-end; }
.locked { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--ink-muted); }
form.inline { display: inline-flex; }
.muted { color: var(--ink-muted); }
.block-note { display: block; }
.cell-action { margin-top: var(--space-2); }
.ds-table-wide { min-width: 1000px; }
td.wrap { min-width: 240px; }
td.nowrap { white-space: nowrap; }
.ds-table-wide .block-note { white-space: nowrap; }
.ds-table-wide td.wrap .block-note { white-space: normal; }
.size-cell { display: inline-flex; align-items: center; gap: var(--space-3); }
.size-frame { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; }
.size-preview { display: block; box-sizing: border-box; background: var(--brand-tint); border: 1px solid var(--brand); border-radius: 1px; }
.size-preview-open { width: 22px; height: 22px; background: none; border-style: dashed; }
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
/* Room for "1/2 page, vertical," and a confirmation note on two lines each, so booking rows stay short. */
td.placement { min-width: 11rem; }
td.status-col { min-width: 14rem; }

/* Dropdowns: the same padding everywhere, a Folii chevron, and a Folii menu where the browser
   allows styling it (base-select); elsewhere the open list stays the browser's own. */
:root { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%230f4c5c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%237fcbda' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E"); }
}
:root[data-theme="dark"] { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%237fcbda' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E"); }
select.ds-input { appearance: none; padding: 0 calc(var(--space-3) + 16px) 0 var(--space-3); text-overflow: ellipsis; cursor: pointer;
                  background-image: var(--chevron); background-repeat: no-repeat; background-position: right var(--space-3) center; background-size: 12px; }
select.ds-input:hover { border-color: var(--brand); }
@supports (appearance: base-select) {
  select.ds-input, select.ds-input::picker(select) { appearance: base-select; }
  select.ds-input::picker-icon { display: none; }
  select.ds-input { display: inline-flex; align-items: center; }
  select.ds-input:open { border-color: var(--brand); }
  select.ds-input::picker(select) { min-width: anchor-size(width); max-height: 320px; margin-block: var(--space-1); padding: var(--space-1); overflow-y: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); }
  select.ds-input option { padding: var(--space-2) var(--space-3); font: var(--type-body-sm); color: var(--ink); border-radius: var(--radius-sm); cursor: pointer; }
  select.ds-input option::checkmark { display: none; }
  select.ds-input option:hover, select.ds-input option:focus { background: var(--brand-tint); color: var(--brand); outline: none; }
  select.ds-input option:checked { color: var(--brand); font-weight: 500; }
  select.ds-input optgroup { font: var(--type-caption); color: var(--ink-muted); }
  select.ds-input optgroup::before { padding: var(--space-2) var(--space-3) var(--space-1); }
}

.filters { display: flex; flex-direction: column; gap: var(--space-2); }
.filter-row { display: flex; align-items: center; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; }
.filter-row[hidden] { display: none; }
.filter-row-wrap { flex-wrap: wrap; }
.filter-row .ds-input { flex: 0 0 auto; width: auto; max-width: 200px; min-height: 32px; height: 32px; font: var(--type-body-sm); }
.filter-row input.ds-input { padding: 0 var(--space-3); }
.filter-row .ds-btn { flex: none; white-space: nowrap; }
.filter-date { flex: 0 0 auto; display: flex; align-items: center; gap: var(--space-2); font: var(--type-body-sm); color: var(--ink-muted); }

/* Active filters, each removable, above the bookings list. */
.filter-chips:empty { display: none; }
.filter-chip-list { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.filter-chip { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 32px; padding: 0 var(--space-1) 0 var(--space-3); font: var(--type-body-sm); color: var(--ink); background: var(--brand-tint); border: 1px solid var(--line); border-radius: var(--radius-full); }
.filter-chip-remove { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; color: var(--ink-muted); background: transparent; border: 0; border-radius: var(--radius-full); cursor: pointer; }
.filter-chip-remove:hover { color: var(--ink); background: var(--surface); }

/* Sortable column headings: the whole heading is the control; the arrow shows the current sort. */
.sort-link { display: inline-flex; align-items: center; gap: var(--space-1); color: inherit; font: inherit; text-decoration: none; border-radius: var(--radius-sm); }
.sort-link:hover, .sort-link.is-sorted { color: var(--ink); }
.sort-link .ds-icon { opacity: 0.45; }
.sort-link:hover .ds-icon, .sort-link.is-sorted .ds-icon { opacity: 1; }
.sort-sep { margin: 0 var(--space-2); color: var(--ink-muted); }

.filtered-table { display: flex; flex-direction: column; gap: var(--space-3); }
.filtered-table .stats { padding: var(--space-4) 0 var(--space-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-8); }

.narrow { width: 100%; max-width: 440px; margin: var(--space-12) auto 0; display: flex; flex-direction: column; gap: var(--space-6); }
.form-card { max-width: var(--measure); }
.form-stack { display: flex; flex-direction: column; gap: var(--space-6); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-6); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.group { display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-6); background: var(--surface-sunken); border-radius: var(--radius-md); }
.group[hidden] { display: none; }
.group legend { float: left; padding: 0; font: var(--type-subheading); }
.choice { display: flex; flex-direction: column; gap: var(--space-2); }
.choice legend { padding: 0 0 var(--space-2); font: var(--type-label); }
.radio { display: flex; gap: var(--space-2); align-items: baseline; min-height: var(--control-sm); }
.radio input { accent-color: var(--brand); }
.danger-zone { margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px solid var(--line); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-6) var(--space-8); margin: 0; }
.facts dt { font: var(--type-label); color: var(--ink-muted); margin-bottom: var(--space-1); }
.facts dd { margin: 0; }
.totals { align-self: flex-end; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: var(--space-2); }
.totals-table { border-collapse: collapse; width: 100%; }
.totals-table th, .totals-table td { padding: var(--space-2) 0; font: var(--type-body-sm); text-align: left; }
.totals-table td { text-align: right; font-variant-numeric: tabular-nums; }
.totals-table .grand th, .totals-table .grand td { font: var(--type-subheading); border-top: 1px solid var(--line-strong); padding-top: var(--space-3); }

.dash-note { color: var(--ink-muted); font: var(--type-body-sm); }
.delta { font: var(--type-body-sm); color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta strong { font-weight: 500; color: var(--ink); }

.chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font: var(--type-body-sm); color: var(--ink-muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: var(--space-2); }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; }
.series-now { background: var(--brand); }
.series-then { background: var(--line-strong); }
.trend { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2); margin-top: var(--space-4); }
.trend-axis { position: relative; height: 240px; min-width: 56px; font: var(--type-caption); color: var(--ink-muted); text-align: right; font-variant-numeric: tabular-nums; }
.trend-axis span { position: absolute; right: 0; transform: translateY(-50%); }
.trend-plot { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); height: 240px;
              border-bottom: 1px solid var(--line-strong); }
.trend-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.trend-month { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 2px; min-width: 0; height: 100%; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.trend-month:hover, .trend-month:focus { outline: none; background: var(--brand-tint); }
.trend-bar { width: min(14px, 34%); min-height: 0; border-radius: 4px 4px 0 0; }
.trend-tip { display: none; position: absolute; z-index: 2; bottom: calc(100% - 48px); left: 50%; transform: translateX(-50%); min-width: 170px; padding: var(--space-2) var(--space-3);
             background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay);
             font: var(--type-caption); color: var(--ink); white-space: nowrap; }
.trend-month:nth-child(-n+4) .trend-tip { left: 0; transform: none; }
.trend-month:nth-last-child(-n+3) .trend-tip { left: auto; right: 0; transform: none; }
.trend-month:hover .trend-tip, .trend-month:focus .trend-tip { display: block; }
.trend-tip b { display: block; font-weight: 500; }
.trend-labels { grid-column: 2; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); font: var(--type-caption); color: var(--ink-muted); text-align: center; }
/* Booked vs invoiced: the validated series pair, apart from the teal and grey of sales. */
.series-booked { background: var(--series-1); }
.series-invoiced { background: var(--series-2); }
.table-view { margin-top: var(--space-4); }
.table-view summary { cursor: pointer; font: var(--type-label); color: var(--brand); }
.table-view .ds-table-wrap { margin-top: var(--space-3); }

.breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: var(--space-8); }
.break-table { width: 100%; border-collapse: collapse; font: var(--type-body-sm); }
.break-table th { font: var(--type-caption); color: var(--ink-muted); text-align: left; padding: var(--space-2) var(--space-2) var(--space-2) 0; }
.break-table td { padding: var(--space-2) var(--space-2) var(--space-2) 0; border-top: 1px solid var(--line); vertical-align: top; }
.break-table th:last-child, .break-table td:last-child { padding-right: 0; }
.break-table .ds-end { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pie-card { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-6); }
.pie-card .break-table { flex: 1 1 280px; width: auto; min-width: 0; }
.pie-wrap { position: relative; flex: none; width: 170px; height: 170px; margin: 0 auto; }
.pie { display: block; width: 100%; height: 100%; overflow: visible; }
.pie-tip { position: absolute; z-index: 2; transform: translate(-50%, calc(-100% - 10px)); width: max-content; max-width: 240px; padding: var(--space-2) var(--space-3); pointer-events: none;
  font: var(--type-caption); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 2px 8px rgb(0 0 0 / .15); }
.pie-tip[hidden] { display: none; }
.pie-tip b { display: block; font-weight: 500; }
.pie-slice:focus { outline: none; }
.pie-slice { stroke: var(--surface); stroke-width: 2; stroke-linejoin: round; }
.pie:hover .pie-slice { opacity: .55; }
.pie .pie-slice:hover { opacity: 1; }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: var(--space-2); border-radius: 3px; }
/* Categorical colours for pies, from the data-viz palette, stepped for each theme. */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; }
}
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; }
svg .series-1 { fill: var(--series-1); } svg .series-2 { fill: var(--series-2); } svg .series-3 { fill: var(--series-3); }
svg .series-4 { fill: var(--series-4); } svg .series-5 { fill: var(--series-5); } svg .series-other { fill: var(--line-strong); }
.swatch.series-1 { background: var(--series-1); } .swatch.series-2 { background: var(--series-2); } .swatch.series-3 { background: var(--series-3); }
.swatch.series-4 { background: var(--series-4); } .swatch.series-5 { background: var(--series-5); } .swatch.series-other { background: var(--line-strong); }

.group-row th { padding: var(--space-3) var(--space-4); text-align: left; font-weight: 600; background: var(--surface-sunken); }
.similar-customers:empty { display: none; }
.booking-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-6); }
.booking-layout > .form-card { flex: 1 1 28rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.panel-head h2 { font: var(--type-subheading); margin: 0; }
.panel-note { margin: 0; font: var(--type-body-sm); color: var(--ink-muted); }
.panel-groups, .panel-ads { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.panel-ads { gap: var(--space-1); margin-top: var(--space-1); }
.panel-group-title { margin: 0; font: var(--type-label); }
.panel-ads li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); font: var(--type-body-sm);
  padding: var(--space-1) var(--space-2); margin: 0 calc(-1 * var(--space-2)); border-radius: var(--radius-sm, 4px); }
.panel-ads li.just-added { background: var(--surface-sunken); }
.just-added-tag { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--ink-muted); white-space: nowrap; }
.panel-next { display: flex; gap: var(--space-2); align-items: flex-start; margin: 0; padding: var(--space-2) var(--space-3);
  font: var(--type-body-sm); color: var(--ink-muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); }
.panel-total { display: flex; justify-content: space-between; gap: var(--space-3); margin: 0; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.panel-total dt { font: var(--type-body-sm); color: var(--ink-muted); } .panel-total dd { margin: 0; font-weight: 600; }
/* The choice of parked invoice, indented under the "Combined invoice" radio it belongs to. */
.combined-choice:not(:has(*)) { display: none; }
.combined-choice { padding-left: calc(13px + var(--space-2)); }
.combined-choices { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-1) 0 0; padding: 0; border: 0; min-width: 0; max-width: 32rem; }
.combined-choices legend { padding: 0; margin-bottom: var(--space-2); font: var(--type-label); }
.combined-option { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); }
.combined-option:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.combined-option.is-fixed { margin-top: var(--space-1); max-width: 32rem; }
.combined-option label { flex: 1; display: flex; gap: var(--space-3); align-items: baseline; min-width: 0; cursor: pointer; }
.combined-option input { accent-color: var(--brand); }
.combined-option-text { flex: 1; min-width: 0; }
.combined-option-text b { display: block; font-weight: 500; }
.combined-option-text small { display: block; font: var(--type-body-sm); color: var(--ink-muted); }
/* A parked invoice's ads, opened from "View" beside it. */
.invoice-dialog { display: none; flex-direction: column; gap: var(--space-4); width: min(560px, calc(100vw - 32px)); }
.invoice-dialog[open] { display: flex; }
.invoice-dialog p.panel-note { margin: 0; }
.invoice-dialog .form-actions { margin-top: 0; }
.similar-list { display: grid; gap: var(--space-2); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.similar-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }

@media (max-width: 900px) {
  .topbar { padding: var(--space-2) var(--space-4); }
  .topbar nav { order: 3; flex: 1 0 100%; flex-wrap: wrap; }
  .topbar-end { margin-left: auto; }
  main { padding: var(--space-8) var(--space-4) var(--space-12); gap: var(--space-8); }
}
@media (max-width: 560px) {
  .ds-card { padding: var(--space-6); }
  .ds-notice { padding: var(--space-4); }
  .nav-menu-list { left: 0; right: auto; }
  .page-head > .actions { width: 100%; }
  .actions .ds-btn-primary, .form-actions .ds-btn-primary { flex: 1 1 100%; }
  /* Every other month: twelve labels don't fit. Latest stays, as the last child is even. */
  .trend-labels span:nth-child(odd) { visibility: hidden; }
}
.topbar nav a { white-space: nowrap; }
.plan-table { min-width: 640px; }
.plan-table td:nth-child(n+3) { white-space: nowrap; }
.plan-table th, .plan-table td { padding-inline: var(--space-3); }
#upload-plan[hidden] { display: none; }
.filter-end { margin-left: auto; }
.file-picker { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.file-picker-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-picker-input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }
.file-picker label { cursor: pointer; }
.file-picker-name { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; font: var(--type-body-sm); color: var(--ink-muted); }
.nav-menu { position: relative; }
.nav-menu-button { display: inline-flex; align-items: center; gap: var(--space-1); height: var(--control-md); padding: 0 var(--space-3); font: var(--type-label);
  color: var(--ink-muted); background: none; border: 0; border-radius: var(--radius-md); cursor: pointer; }
.nav-menu-button:hover, .nav-menu-button[aria-expanded="true"] { background: var(--brand-tint); }
.nav-menu-button.is-current { color: var(--brand); background: var(--brand-tint); }
/* The padding bridges the gap to the button, so moving the mouse down keeps the menu open. */
.nav-menu-list { display: none; position: absolute; z-index: 10; top: 100%; right: 0; min-width: 180px; padding-top: var(--space-1); }
.nav-menu:hover .nav-menu-list, .nav-menu:focus-within .nav-menu-list, .nav-menu-button[aria-expanded="true"] + .nav-menu-list { display: block; }
.topbar nav .nav-menu-list a { display: flex; background: var(--surface); border: 1px solid var(--line); margin-top: -1px; border-radius: 0; }
.topbar nav .nav-menu-list a:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.topbar nav .nav-menu-list a:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.topbar nav .nav-menu-list a:hover, .topbar nav .nav-menu-list a[aria-current="page"] { background: var(--brand-tint); }
.date-clear { display: flex; align-items: center; gap: var(--space-2); }
.date-clear .ds-input { flex: 1; min-width: 0; }
.email-preview { display: block; width: 100%; height: 640px; margin-top: var(--space-4); background: #f4f4f1; border: 1px solid var(--line); border-radius: var(--radius-md); }
.email-search { min-width: 240px; }
.email-count { margin: var(--space-2) 0; font: var(--type-body-sm); }
.email-summary { margin-bottom: var(--space-4); }
.email-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.email-headers { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-3); }
.email-headers > div { display: contents; }
.email-headers dt { font: var(--type-label); color: var(--ink-muted); }
.email-headers dd { margin: 0; overflow-wrap: anywhere; }
.email-text { white-space: pre-wrap; overflow-wrap: anywhere; font: var(--type-body-sm); }
.wording-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-6); margin-top: var(--space-4); }
.wording-grid .email-preview { margin-top: var(--space-2); height: 720px; }
.wording-preview-h { margin: 0; font: var(--type-label); }
.logo-current { display: block; max-height: 56px; max-width: 220px; margin: var(--space-3) 0; padding: var(--space-2); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
@media (max-width: 900px) { .wording-grid { grid-template-columns: 1fr; } .wording-grid .email-preview { height: 560px; } }
@media (max-width: 640px) {
  .email-search { min-width: 0; flex: 1 1 100%; max-width: none !important; }
  .email-headers { grid-template-columns: 1fr; gap: 0 0; }
  .email-headers dd { margin-bottom: var(--space-2); }
  .email-log thead { display: none; }
  .email-log, .email-log tbody, .email-log tr, .email-log td { display: block; }
  .email-log tr { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
  .email-log td { border: 0; padding: var(--space-1) var(--space-3); }
}

/* Customer form */
.back-link { margin: 0 0 var(--space-2); }
.form-section { display: flex; flex-direction: column; gap: var(--space-4); }
.form-section + .form-section { padding-top: var(--space-6); border-top: 1px solid var(--line); }
.static-value { margin: 0; }
.confirm-dialog { width: min(480px, calc(100vw - 32px)); padding: var(--space-6); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); }
.confirm-dialog::backdrop { background: rgb(0 0 0 / .5); }
.confirm-dialog p { margin: var(--space-3) 0 var(--space-4); }
.confirm-dialog .form-actions { margin-top: var(--space-6); }
.change-list { margin: 0; max-height: 40vh; overflow-y: auto; }
.change-list dt { font-weight: 600; }
.change-list dt + dd { margin: 0 0 var(--space-2); overflow-wrap: anywhere; }

/* A wide table's last column stays in view while the rest scrolls under it. Collapsed borders
   scroll away from a sticky cell, so its lines are drawn as shadows. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ds-table-pinned-end td:first-child { min-width: 200px; }
.ds-table-pinned-end th:last-child, .ds-table-pinned-end td:last-child { position: sticky; right: 0; width: 1%; white-space: nowrap;
  padding-left: var(--space-4); box-shadow: inset 1px 0 0 var(--line); }
.ds-table-pinned-end th:last-child { background: var(--surface-sunken); }
.ds-table-pinned-end td:last-child { background: var(--surface); box-shadow: inset 1px 0 0 var(--line), inset 0 1px 0 var(--line); }
.ds-table-pinned-end td .filter-row { min-width: 200px; overflow: visible; }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.table-tools .filter-row { min-width: 0; }
.table-note { margin: 0; font: var(--type-caption); color: var(--ink-muted); }
.ds-table-pinned-end .ds-table-empty, .ds-table-pinned-end .ds-table-empty:last-child { position: static; box-shadow: none; }

/* Fortnox mode in the top bar, on every page unless live. */
.env-badge { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 26px; padding: 0 var(--space-2); border-radius: var(--radius-sm);
             font: var(--type-caption); background: var(--caution-tint); color: var(--caution); white-space: nowrap; cursor: help; }

/* Invoices: "Needs you" puts everything to act on in one list, oldest first. */
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-full);
         font: var(--type-caption); font-variant-numeric: tabular-nums; background: var(--surface-sunken); color: var(--ink-muted); vertical-align: middle; }
.needs-you { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6) var(--space-8); }
.needs-you > p { margin: 0; }
.queue { margin: 0; padding: 0; list-style: none; }
.queue-item { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; align-items: center; gap: var(--space-2) var(--space-4);
              padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.queue-item:first-child { border-top: 0; padding-top: 0; }
.queue-item:last-child { padding-bottom: 0; }
.queue-state { position: relative; justify-self: start; border-radius: var(--radius-sm); cursor: help; }
.queue-tip { display: none; position: absolute; z-index: 3; top: calc(100% + var(--space-2)); left: 0; width: 18rem; padding: var(--space-2) var(--space-3);
             background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay);
             font: var(--type-caption); color: var(--ink); }
.queue-state:hover .queue-tip, .queue-state:focus .queue-tip { display: block; }
.queue-text { min-width: 0; }
.queue-text b { font-weight: 500; }
.queue-text .block-note { overflow-wrap: anywhere; }
.queue-action { justify-self: end; gap: var(--space-2); }
@media (max-width: 640px) {
  .needs-you { padding: var(--space-6); }
  .queue-item { grid-template-columns: minmax(0, 1fr) auto; }
  .queue-text { grid-column: 1 / -1; grid-row: 2; }
}

/* Status tabs and customer search above the invoice list. */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.tabs a { display: inline-flex; align-items: center; gap: var(--space-2); height: var(--control-md); padding: 0 var(--space-3); border-radius: var(--radius-md);
          font: var(--type-label); color: var(--ink); text-decoration: none; }
.tabs a:hover { background: var(--brand-tint); }
.tabs a[aria-current="page"] { color: var(--brand); background: var(--brand-tint); }
.tabs a[aria-current="page"] .count { background: var(--surface); color: var(--brand); }
.search .ds-input { width: min(18rem, 100%); min-height: var(--control-sm); height: var(--control-sm); font: var(--type-body-sm); }

/* A row that opens its invoice anywhere you click; the customer name is the real link. */
.row-link { position: relative; }
.row-link:hover td { background: var(--surface-sunken); }
.row-link .row-target { font-weight: 500; }
.row-link .row-target::after { content: ""; position: absolute; inset: 0; }
.row-link .row-target:focus-visible { outline: none; }
.row-link:has(.row-target:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Invoice date: own invoices on the booking form, combined ones when sent. */
.invoice-date { display: grid; gap: var(--space-1); margin-top: var(--space-3); }
.invoice-date input { max-width: 16rem; }
.invoice-date .ds-field-hint { margin: 0; }
.date-warning { color: var(--caution); max-width: 32rem; }
#send-dialog .invoice-date { margin: var(--space-3) 0; }

/* The booking just saved: the list is sorted by issue date, so it is marked where it lands. */
.ds-table tr[id^="booking-"] { scroll-margin-top: 6rem; }
.ds-table tr.just-saved > td { background: var(--brand-tint); }
.ds-table tr.just-saved > td:first-child { box-shadow: inset 3px 0 0 var(--brand); }

/* The online test environment, so it is never mistaken for prod. */
.env-badge-test { background: var(--critical-tint); color: var(--critical); }

/* The organisation being worked in (top bar) and the organisation picker. */
.org-picker { list-style: none; padding: 0; margin: var(--space-4) 0; display: grid; gap: var(--space-2); }
.org-picker form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); }
@media (max-width: 560px) {
  /* The badge, organisation, name and Log out wrap rather than run off a phone screen. */
}

/* Sign-in pages (mock-ups in PR #18): one narrow card. */
.auth-card { gap: var(--space-8); }
.auth-head { display: flex; flex-direction: column; gap: var(--space-3); }
.auth-head p { color: var(--ink-muted); }
.auth-head strong { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.auth-providers { display: flex; flex-direction: column; gap: var(--space-3); }
.auth-provider { width: 100%; }
.auth-provider svg { width: 18px; height: 18px; flex: none; }
.auth-or { display: flex; align-items: center; gap: var(--space-3); font: var(--type-body-sm); color: var(--ink-muted); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.auth-foot { font: var(--type-body-sm); color: var(--ink-muted); }
.auth-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); font: var(--type-body-sm); }
.auth-dev { display: flex; flex-direction: column; gap: var(--space-4); padding-top: var(--space-6); border-top: 1px dashed var(--line-strong); }
.link-button { padding: 0; font: inherit; color: var(--brand); text-decoration: underline; background: none; border: 0; cursor: pointer; }
.link-button:disabled { color: var(--ink-muted); text-decoration: none; cursor: not-allowed; }
/* The one-time code: one field (pasting and the phone's code suggestion both work), spaced digits. */
.code-input { max-width: 13rem; min-height: 56px; padding: 0 var(--space-4); font: 500 24px/1 var(--font-sans);
              letter-spacing: .35em; font-variant-numeric: tabular-nums; }

/* Collapsible help (the code page's "Can't find the email?"). */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.help-details > summary { display: inline-flex; align-items: center; gap: var(--space-1); font: var(--type-body-sm); color: var(--brand); border-radius: var(--radius-sm); }
.help-details > summary .ds-icon { transition: transform 120ms ease; }
.help-details[open] > summary .ds-icon { transform: rotate(180deg); }
.help-details > :not(summary) { margin-top: var(--space-2); font: var(--type-body-sm); color: var(--ink-muted); }
@media (prefers-reduced-motion: reduce) { .help-details > summary .ds-icon { transition: none; } }

/* The phone top bar (mock-ups, decision 11): always exactly one row, the logo, the current
   publisher and a menu button; all navigation lives in the menu sheet. The environment and
   read-only notices become slim strips under the bar. Wider than 720px nothing here shows. */
.topbar-org, .topbar-toggle, .env-strip, .readonly-strip { display: none; }
.nav-sheet { width: min(22rem, calc(100vw - 48px)); max-width: none; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; padding: 0;
             color: var(--ink); background: var(--surface); border: 0; border-left: 1px solid var(--line); box-shadow: var(--shadow-overlay); overflow-y: auto; }
.nav-sheet[open] { display: flex; flex-direction: column; }
.nav-sheet::backdrop { background: rgb(0 0 0 / .5); }
.nav-sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
                  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); background: var(--surface); border-bottom: 1px solid var(--line); }
.nav-sheet-title { font: var(--type-subheading); }
.nav-sheet-close { display: inline-grid; place-items: center; width: var(--control-md); height: var(--control-md); padding: 0; color: var(--ink);
                   background: none; border: 0; border-radius: var(--radius-md); cursor: pointer; }
.nav-sheet-close:hover { background: var(--brand-tint); }
.nav-sheet-body { flex: 1; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2); }
.nav-sheet ul { margin: 0; padding: 0; list-style: none; }
.nav-sheet form { display: block; }
.nav-sheet-link { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 48px; padding: 0 var(--space-3); font: var(--type-label);
                  color: var(--ink); text-align: left; text-decoration: none; background: none; border: 0; border-radius: var(--radius-md); cursor: pointer; }
.nav-sheet-link:hover { background: var(--brand-tint); }
.nav-sheet-link[aria-current] { color: var(--brand); background: var(--brand-tint); }
.nav-sheet-link .org-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sheet-link .org-switch-role { margin-left: auto; padding-left: var(--space-2); font: var(--type-caption); color: var(--ink-muted); white-space: nowrap; }
.nav-sheet-link .ds-icon { color: var(--brand); }
.org-switch-check { width: 16px; flex: none; }
.nav-sheet-label { margin: var(--space-2) 0 0; padding: var(--space-3) var(--space-3) var(--space-1); font: var(--type-caption);
                   color: var(--ink-muted); border-top: 1px solid var(--line); }
.nav-sheet-foot { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
                  padding: var(--space-3) var(--space-4); font: var(--type-body-sm); background: var(--surface); border-top: 1px solid var(--line); }
.env-strip { align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-4); font: var(--type-caption); color: var(--critical);
             background: var(--critical-tint); border-bottom: 1px solid var(--line); }
.env-strip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readonly-strip { align-items: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 var(--space-2) 0 var(--space-4);
                  background: var(--caution-tint); color: var(--ink); border-bottom: 1px solid var(--line); font: var(--type-body-sm); }
.readonly-strip > .ds-icon { color: var(--caution); flex: none; }
.readonly-strip p { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readonly-strip strong { font-weight: 600; }
.readonly-back { height: var(--control-md); color: var(--brand); background: none; border-color: transparent; }
@media (max-width: 720px) {
  .topbar { flex-wrap: nowrap; gap: var(--space-2); padding: var(--space-2) var(--space-4); }
  .topbar > nav, .topbar > .topbar-end, .topbar > .env-badge { display: none; }
  .topbar > .ds-logo { flex: none; }
  .topbar-org { display: inline-flex; align-items: center; gap: var(--space-1); flex: 0 1 auto; min-width: 0; height: var(--control-md);
                padding: 0 var(--space-2); font: var(--type-label); color: var(--ink); text-decoration: none; border-radius: var(--radius-md); }
  a.topbar-org:hover { background: var(--brand-tint); }
  .topbar-org-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-org .ds-icon { flex: none; color: var(--ink-muted); }
  .topbar-toggle { display: inline-grid; place-items: center; flex: none; width: var(--control-md); height: var(--control-md); margin-left: auto; padding: 0;
                   color: var(--ink); background: none; border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; }
  .topbar-toggle:hover, .topbar-toggle[aria-expanded="true"] { color: var(--brand); background: var(--brand-tint); border-color: var(--brand); }
  .env-strip, .readonly-strip { display: flex; }
}

/* Admin → Users (docs/mockups/sign-in/users.html, approved 2026-11-09). */
.you { color: var(--ink-muted); font-weight: 400; }
.role-options { display: flex; flex-direction: column; gap: var(--space-2); }
.role-options legend { padding: 0 0 var(--space-2); font: var(--type-label); }
.role-option { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; }
.role-option:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.role-option:has(input:disabled) { cursor: not-allowed; color: var(--ink-muted); background: var(--surface-sunken); }
.role-option input { margin-top: 5px; accent-color: var(--brand); }
.role-option b { display: block; font-weight: 500; }
.role-option small { display: block; }
.role-help { display: none; }
.help-details dl { display: grid; gap: var(--space-2); margin: var(--space-2) 0 0; }
.help-details dt { font-weight: 500; color: var(--ink); }
.help-details dd { margin: 0; }
.confirm-dialog h2 { font: var(--type-subheading); }
.confirm-dialog .form-stack { gap: var(--space-4); margin-top: var(--space-4); }
.confirm-dialog p.ds-field-hint, .confirm-dialog p.ds-field-error { margin: 0; }
.section-collapse > summary { display: inline-flex; align-items: center; gap: var(--space-2); border-radius: var(--radius-sm); }
.section-collapse > summary .ds-icon { color: var(--ink-muted); transition: transform 120ms ease; }
.section-collapse[open] > summary .ds-icon, .card[open] > summary > .ds-icon { transform: rotate(180deg); }
.section-collapse[open] > summary { margin-bottom: var(--space-4); }
.section-collapse > .section { gap: var(--space-3); }
.cards { display: none; margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.cards > li + li { border-top: 1px solid var(--line); }
.card > summary { display: flex; align-items: center; gap: var(--space-3); min-height: var(--row-height); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); }
.card > summary > .ds-icon { color: var(--ink-muted); transition: transform 120ms ease; }
.card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.card-title { font-weight: 500; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font: var(--type-body-sm); color: var(--ink-muted); }
.card-body { display: flex; flex-direction: column; gap: var(--space-3); padding: 0 var(--space-4) var(--space-4); font: var(--type-body-sm); }
.card-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-1) var(--space-4); margin: 0; }
.card-facts dt { color: var(--ink-muted); }
.card-facts dd { margin: 0; overflow-wrap: anywhere; }
.card-body .row-actions { flex-wrap: wrap; justify-content: flex-start; margin-left: calc(-1 * var(--space-3)); }
.card-body .card-note { display: flex; gap: var(--space-2); align-items: flex-start; color: var(--ink-muted); }
.card-body .card-note .ds-icon { margin-top: 3px; }
@media (prefers-reduced-motion: reduce) { .section-collapse > summary .ds-icon, .card > summary > .ds-icon { transition: none; } }
@media (max-width: 560px) {
  .cards { display: block; }
  .wide-only { display: none; }
  .role-option small { display: none; }
  .role-option { align-items: center; }
  .role-option input { margin-top: 0; }
  .role-help { display: block; }
}

/* Platform → Publishers: the invitations listed in a publisher's invite dialog. */
.plain-list { margin: var(--space-3) 0 var(--space-4); padding: 0; list-style: none; }
.plain-list > li + li { margin-top: var(--space-2); }
.row-actions-start { justify-content: flex-start; margin-left: calc(-1 * var(--space-3)); }
.input-short { max-width: 16rem; }

/* Top bar, right zone: publisher switcher and account menu, set apart from the pages by a rule. */
.topbar nav { margin-left: var(--space-4); flex-wrap: wrap; }
.topbar-end { display: flex; align-items: center; gap: var(--space-2); flex: none; max-width: 45%; padding-left: var(--space-4); border-left: 1px solid var(--line); font: var(--type-label); }
.org-switch { display: inline-flex; align-items: center; gap: var(--space-1); min-width: 0; height: var(--control-md); padding: 0 var(--space-3);
  color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md); text-decoration: none; }
a.org-switch:hover { background: var(--brand-tint); }
.org-switch .ds-icon { flex: none; color: var(--ink-muted); }
.org-switch-name { min-width: 0; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .nav-menu-button { max-width: 14em; }
.account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .nav-menu-list { min-width: 220px; }
.account-panel { display: grid; gap: var(--space-1); padding: var(--space-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 4px 16px rgb(0 0 0 / .12); }
.account-who { display: grid; gap: 2px; margin: 0; padding: var(--space-2) var(--space-3); font: var(--type-body-sm); }
.account-who .who-role { color: var(--ink-muted); }
.account-label { margin: var(--space-2) 0 0; padding: var(--space-2) var(--space-3) 0; border-top: 1px solid var(--line); font: var(--type-caption); color: var(--ink-muted); }
.account-panel a, .account-logout { display: flex; align-items: center; width: 100%; height: var(--control-md); padding: 0 var(--space-3); font: var(--type-label);
  color: var(--ink); background: none; border: 0; border-radius: var(--radius-sm); text-align: left; text-decoration: none; cursor: pointer; }
.account-panel a:hover, .account-logout:hover, .account-panel a[aria-current="page"] { background: var(--brand-tint); }
.account-panel a[aria-current="page"] { color: var(--brand); }
.account-panel form { margin: var(--space-1) 0 0; padding-top: var(--space-1); border-top: 1px solid var(--line); }
.account-panel a:focus-visible, .account-logout:focus-visible, .org-switch:focus-visible, .nav-menu-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Below ~1180px the pages don't fit beside the right zone: they take their own row under the bar. */
@media (max-width: 1180px) {
  .topbar nav { order: 3; flex: 1 0 100%; flex-wrap: wrap; margin-left: 0; }
  .topbar-end { margin-left: auto; max-width: 60%; }
}

/* --- Flatplan (SPEC §7b): spreads of pages, each a grid of cells (the media's) ------------------------------- */
.fp { display: flex; flex-direction: column; gap: var(--space-4); }
.fp-crumb { font-size: var(--type-body-sm); margin-bottom: var(--space-1); }
.fp-count { max-width: 8rem; }
.fp-stats { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); margin: 0; }
.fp-stats div { display: flex; flex-direction: column; }
.fp-stats dt { font-size: var(--type-caption); color: var(--ink-muted); }
.fp-stats dd { margin: 0; font-size: var(--type-heading); font-variant-numeric: tabular-nums; }
.fp-over { color: var(--critical); }
.fp-layout { display: grid; grid-template-columns: minmax(15rem, 18rem) 1fr; gap: var(--space-6); align-items: start; }
.fp-side { display: flex; flex-direction: column; gap: var(--space-3); position: sticky; top: var(--space-4); max-height: calc(100vh - var(--space-8)); overflow: auto; }
.fp-side-title { font-size: var(--type-subheading); margin: 0; }
.fp-help { font-size: var(--type-caption); color: var(--ink-muted); margin: 0; }
.fp-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.fp-card { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); background: var(--surface); }
.fp-card[draggable=true] { cursor: grab; }
.fp-card.fp-reserved { border-left-style: dashed; }
.fp-card-title { margin: 0; font-weight: 500; display: flex; gap: var(--space-1); align-items: center; }
.fp-card-meta, .fp-wish { margin: 0; font-size: var(--type-caption); color: var(--ink-muted); }
.fp-wish { font-style: italic; }
.fp-card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); align-items: flex-start; }
.fp-select[aria-pressed=true] { background: var(--brand); color: var(--on-brand); }
.fp-place > form, .fp-panel > form { margin-top: var(--space-2); }
.fp-panel { border-top: 1px solid var(--line); padding-top: var(--space-3); }
.fp-pages-panel { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.fp-colours { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fp-swatch { display: inline-block; width: 1rem; height: 1rem; border-radius: var(--radius-sm); }
.fp-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: var(--type-caption); color: var(--ink-muted); }
.fp-legend span { display: inline-flex; align-items: center; gap: var(--space-1); }
.fp-key { display: inline-block; width: 1rem; height: .75rem; border-radius: 2px; }
.fp-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--line-strong); flex: none; }
.fp-st-received .fp-dot, .fp-dot.fp-st-received { background: var(--caution); }
.fp-st-ready .fp-dot, .fp-dot.fp-st-ready { background: var(--positive); }

.fp-map { display: flex; flex-wrap: wrap; gap: var(--space-6) var(--space-4); }
.fp-spread { display: grid; grid-template-columns: repeat(2, 7.5rem); }
.fp-page { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line-strong); background: var(--surface); aspect-ratio: 210 / 297; }
.fp-page + .fp-page { border-left-width: 0; }
.fp-blank { border: 0; background: none; }
.fp-cover { background: var(--surface-sunken); }
.fp-page-head { display: flex; justify-content: space-between; font-size: var(--type-caption); color: var(--ink-muted); padding: 1px var(--space-1); border-bottom: 3px solid transparent; }
.fp-page-planned .fp-page-head { border-bottom-color: var(--line-strong); }
.fp-page-received .fp-page-head { border-bottom-color: var(--caution); }
.fp-page-ready .fp-page-head { border-bottom-color: var(--positive); }
.fp-grid { flex: 1; display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 12), minmax(0, 1fr));
  gap: 1px; padding: 2px; min-height: 0; position: relative; }
.fp-over-page { outline: 2px solid var(--focus); outline-offset: 1px; }
.fp-item { all: unset; box-sizing: border-box; position: relative; display: flex; flex-direction: column; gap: 1px; min-width: 0; overflow: hidden;
  padding: 2px 4px; border-radius: 2px; font-size: 11px; line-height: 1.2; cursor: pointer; color: var(--on-brand); background: var(--brand); }
.fp-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.fp-item[draggable=true] { cursor: grab; }
.fp-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-item-meta { opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-item-flags { display: flex; gap: 2px; align-items: center; margin-top: auto; }
.fp-item .ds-icon { width: 12px; height: 12px; }
.fp-reserved, .fp-key.fp-reserved { color: var(--ink); background: repeating-linear-gradient(135deg, var(--brand-tint) 0 6px, var(--surface) 6px 12px); outline: 1px dashed var(--brand); outline-offset: -1px; }
.fp-key.fp-sold, .fp-card.fp-sold { background-color: var(--surface); }
.fp-key.fp-sold { background: var(--brand); }
.fp-editorial, .fp-key.fp-editorial { color: var(--ink); background: var(--surface-sunken); border-left: 4px solid var(--section, var(--line-strong)); }
.fp-late { box-shadow: inset 0 0 0 2px var(--critical); }
.fp-drop { all: unset; box-sizing: border-box; border-radius: 2px; grid-area: 1 / 1 / -1 / -1; display: none; z-index: 2; }
.fp-item.fp-small .fp-item-meta { display: none; }
.fp-cells { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; margin: 0; padding: 0; }
.fp-cells label { display: flex; flex-direction: column; font-size: var(--type-caption); }
.fp-cells .ds-input { width: 4.5rem; }
.fp-placing .fp-drop, .fp-dragging .fp-drop { display: block; border: 1px dashed var(--brand); cursor: pointer;
  background-image: linear-gradient(to right, color-mix(in srgb, var(--brand) 25%, transparent) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in srgb, var(--brand) 25%, transparent) 1px, transparent 1px);
  background-size: calc(100% / var(--cols)) calc(100% / var(--rows)); }
.fp-dragging .fp-drop { pointer-events: none; }
.fp-drop:focus-visible { outline: 2px solid var(--focus); }
.fp-meter { display: inline-block; width: 5rem; height: .5rem; background: var(--surface-sunken); border-radius: var(--radius-full); overflow: hidden; vertical-align: middle; }
.fp-meter span { display: block; height: 100%; background: var(--brand); }
.fp-dialog dl { margin: 0 0 var(--space-3); }
@media (max-width: 900px) {
  .fp-layout { grid-template-columns: 1fr; }
  .fp-side { position: static; max-height: none; }
}
@media (max-width: 560px) { .fp-spread { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; } }
@media print {
  .topbar, .env-strip, .readonly-strip, .no-print, .fp-drop, dialog { display: none !important; }
  .fp-layout { display: block; }
  .fp-map { gap: 8mm 6mm; }
  .fp-spread { grid-template-columns: repeat(2, 36mm); break-inside: avoid; }
  .fp-item { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .fp-stats dd { font-size: 12pt; }
}
/* Sections, page comments, articles (flatplan) */
.fp-section-band { position: absolute; left: -1px; right: -1px; bottom: 100%; margin: 0 0 2px; padding: 0 var(--space-1); line-height: 1.4; font-size: var(--type-caption); font-weight: 600; color: var(--surface); background: var(--section); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.fp-section-more { color: transparent; }
.fp-comment-badge { all: unset; cursor: pointer; min-width: 1.1rem; padding: 0 .25rem; border-radius: var(--radius-full); background: var(--caution); color: var(--ink); font-size: var(--type-caption); font-weight: 600; text-align: center; }
.fp-comment-badge:focus-visible { outline: 2px solid var(--focus); }
.fp-item-status { font-size: .65rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-item.fp-small .fp-item-status, .fp-item.fp-small .fp-item-brief { display: none; }
.fp-sections, .fp-notes, .fp-copy-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.fp-notes p { margin: 0; }
.fp-copy-list { list-style: disc; padding-left: var(--space-5); margin: var(--space-3) 0; }
.fp-person { width: 10rem; }
.fp-auto { font-size: .6rem; font-weight: 600; padding: 0 .2rem; border-radius: 2px; border: 1px solid currentColor; line-height: 1.2; }
.fp-layout-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.fp-form-space { display: flex; flex-direction: column; gap: var(--space-1); }
.fp-form-space:empty { display: none; }

/* Issue list (issues/list.html). Printing leaves only the list. */
.issue-list-table td:nth-child(2) { white-space: nowrap; }
.issue-list-meta { margin: var(--space-1) 0 0; color: var(--ink-muted); }
@media print {
  .nav-sheet { display: none !important; }
  body, main { background: #fff; color: #000; margin: 0; padding: 0; max-width: none; }
  .ds-table-wrap { overflow: visible; border: 0; }
  .issue-list-table { font-size: 10pt; }
  .issue-list-table th, .issue-list-table td { padding: 4pt 6pt; }
  .issue-list-table tr { break-inside: avoid; }
  .issue-list-table thead { display: table-header-group; }
}

/* Menu groups (base.html): Sales and Issues open to the right; an admin's not-included feature. */
.nav-menu-start .nav-menu-list { left: 0; right: auto; }
.topbar nav .nav-menu-off { display: flex; align-items: center; gap: var(--space-2); height: var(--control-md); padding: 0 var(--space-3);
  font: var(--type-label); color: var(--ink-muted); background: var(--surface); border: 1px solid var(--line); margin-top: -1px; cursor: default; }
.nav-sheet-link.nav-menu-off { color: var(--ink-muted); gap: var(--space-2); }
.nav-addon { padding: 0 var(--space-1); border: 1px solid var(--line); border-radius: var(--radius-sm); font: var(--type-caption); color: var(--ink-muted); }
