/* Feather shared interface: consistent controls, spacing and responsive layouts. */
/* Colours: the DollyXLIFF palette (plum accent on warm neutrals), light and dark. Every rule below uses these names;
   nothing else in this file names a colour, so a theme is one block of values. */
:root {
  color-scheme: light;
  --bg: #f7f2f5;
  --surface: #fffdfe;
  --surface-alt: #f3e9f0;
  --surface-muted: #faf6f9;
  --surface-soft: #f2e8f0;
  --nav: #f3e9f0;
  --line: #dfd6de;
  --line-dark: #cebeca;
  --text: #302931;
  --muted: #685866;
  --faint: #968a94;
  --accent: #b66d92;
  --accent-hover: #c882a5;
  --accent-strong: #96496f;
  --accent-soft: #f4e3ec;
  --accent-soft-hover: #e9c9d9;
  --accent-line: #dcb7cb;
  --on-accent: #fcf4f9;
  --btn-bg: #9c4f79;
  --btn-bg-hover: #b66d92;
  --btn-line: #9c4f79;
  --btn-text: #fcf4f9;
  --good: #188056;
  --good-soft: #e3f2eb;
  --good-line: #a5d2bd;
  --bad: #b22e2e;
  --bad-soft: #f9e3e3;
  --bad-line: #dca9a9;
  --warn: #8a6212;
  --warn-soft: #fbf0d4;
  --warn-line: #dcc27e;
  --info: #3f6e96;
  --info-soft: #e6eef5;
  --chart-a: #b66d92;
  --chart-b: #d9b56c;
  --field-bg: #fffdfe;
  --field-bg-hover: #faf5f8;
  --memo-bg: #fff8d6;          /* internal memo: soft note-paper yellow */
  --memo-bg-hover: #fff3c2;
  --memo-line: #e6cf6e;
  --memo-text: #5c4a12;
  --field-border: #cebeca;
  --field-text: #302931;
  --focus: rgba(182, 109, 146, .35);
  --shadow: rgba(48, 41, 49, .14);
  --overlay: rgba(255, 253, 254, .86);
  /* earlier names, still used by some rules */
  --blue: var(--accent);
  --blue-dark: var(--accent-strong);
  --green: var(--accent);
  --green-dark: var(--accent);
  --amber: var(--warn);
  --red: var(--bad);
  --control-height: 38px;
  --radius: 3px;
  --space: 24px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1a22;
  --surface: #26202b;
  --surface-alt: #352c3c;
  --surface-muted: #2b2430;
  --surface-soft: #392f40;
  --nav: #2a2330;
  --line: #463d4e;
  --line-dark: #54485c;
  --text: #ece2ea;
  --muted: #ceb6c6;
  --faint: #9d8f9e;
  --accent: #b07c9b;
  --accent-hover: #c492af;
  --accent-strong: #e6bcd2;
  --accent-soft: #45343f;
  --accent-soft-hover: #574150;
  --accent-line: #76566a;
  --on-accent: #fcf4f9;
  --btn-bg: #8f5a7a;
  --btn-bg-hover: #a46285;
  --btn-line: #a46285;
  --btn-text: #fcf4f9;
  --good: #60d0a0;
  --good-soft: #20382f;
  --good-line: #2f6a55;
  --bad: #ee7a7a;
  --bad-soft: #43262b;
  --bad-line: #8a4a50;
  --warn: #e6c078;
  --warn-soft: #3d3423;
  --warn-line: #7d6a3a;
  --info: #9dbfdf;
  --info-soft: #273646;
  --chart-a: #c492af;
  --chart-b: #d9b56c;
  --field-bg: #2c2531;
  --field-bg-hover: #352c3c;
  --memo-bg: #3a3320;          /* internal memo: dimmed amber that sits with the plum dark theme */
  --memo-bg-hover: #433b25;
  --memo-line: #7d6a2c;
  --memo-text: #f0e2b0;
  --field-border: #5f5268;
  --field-text: #ece2ea;
  --focus: rgba(196, 146, 175, .45);
  --shadow: rgba(0, 0, 0, .5);
  --overlay: rgba(31, 26, 34, .88);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; font: 14px/1.45 "Segoe UI", Tahoma, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
h1, h2, h3 { font-weight: bold; }
code { background: var(--surface-alt); border: 1px solid var(--line); padding: 0 3px; font-size: 12px; }
.muted { color: var(--muted); }
.qr { display: block; border: 1px solid var(--line-dark); max-width: 100%; height: auto; }
.recovery-codes { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 10px; }
.recovery-codes code { font-size: 14px; padding: 2px 6px; user-select: all; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.nowrap { white-space: nowrap; }
.pad { padding: 10px 12px; margin: 0; }
[hidden] { display: none !important; }
.show-when { display: contents; } /* its fields stay in the form grid; hidden until the checkbox is ticked */

/* ---------- shell ---------- */
/* Full-width navigation follows the reference workspace. */
.shell-main { min-height: 100vh; display: flex; flex-direction: column; }
.top-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0 12px; padding: 0 24px; min-height: 58px; background: var(--nav); border-bottom: 1px solid var(--line-dark); }
.app-brand { display: inline-flex; align-items: center; gap: 9px; padding-right: 20px; color: var(--text); font-size: 19px; font-weight: 650; text-decoration: none; }
.app-brand img { width: 32px; height: 32px; }
/* An uploaded logo keeps its transparency. Only the dark theme puts a white plate behind it: most logos have dark lettering. */
.app-brand--custom img { width: auto; height: 52px; max-width: 150px; object-fit: contain; }
.brand-preview { max-width: 260px; max-height: 130px; object-fit: contain; }
:root[data-theme="dark"] .app-brand--custom img, :root[data-theme="dark"] .login-brand--custom img, :root[data-theme="dark"] .brand-preview { background: #fff; padding: 4px; border-radius: 4px; }
.primary-nav { display: flex; flex-wrap: wrap; align-self: stretch; }
.top-nav__link { display: inline-flex; align-items: center; gap: 7px; min-height: 58px; padding: 0 12px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; }
.top-nav__link:hover { color: var(--text); background: var(--surface-soft); text-decoration: none; }
.top-nav__link.is-active { color: var(--text); background: var(--surface); border-bottom-color: var(--green-dark); }
.top-nav__icon { width: 16px; height: 16px; flex: none; opacity: .75; }
.top-search { position: relative; margin-left: auto; padding: 8px 0; }
.top-search input[type=search] { width: 220px; background: var(--field-bg); }
.top-search__list { position: absolute; top: calc(100% - 5px); right: 0; z-index: 80; width: min(360px, calc(100vw - 24px)); max-height: 340px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px var(--shadow); }
.top-search__list[hidden] { display: none; }
.top-search__option { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.top-search__option + .top-search__option { border-top: 1px solid var(--line); }
.top-search__option:hover, .top-search__option[aria-selected=true] { background: var(--surface-soft); text-decoration: none; }
.top-search__option small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.section-bar { display: flex; justify-content: center; gap: 16px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.section-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 6px; }
.section-nav__link { display: inline-flex; align-items: center; min-height: 46px; padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.section-nav__link:hover { background: var(--surface-soft); text-decoration: none; color: var(--text); }
.section-nav__link.is-active { color: var(--accent-strong); border-bottom-color: var(--accent); font-weight: 600; }
.account-menu, .recent-menu { position: relative; flex-shrink: 0; }
.account-menu summary, .recent-menu summary { cursor: pointer; min-height: 38px; display: flex; align-items: center; gap: 10px; padding: 8px; color: var(--muted); }
.account-menu summary::after, .recent-menu summary::after { content: "\25be"; font-size: 11px; }
.account-menu summary::-webkit-details-marker, .recent-menu summary::-webkit-details-marker { display: none; }
.account-menu__body, .recent-menu__body { position: absolute; top: 100%; right: 0; z-index: 60; width: 270px; max-width: calc(100vw - 24px); padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px var(--shadow); }
.account-menu__body { display: grid; gap: 8px; }
.account-menu__body span { color: var(--muted); font-size: 12px; }
.recent-menu { align-self: center; }
.recent-menu:not(:has(.has-items)) { display: none; }
.recent-menu__body a { display: block; padding: 9px 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent-strong); text-decoration: underline; cursor: pointer; width: auto; font-weight: normal; }
.link-button:hover { background: none; color: var(--accent); }
.page { padding: 28px 32px 40px; flex: 1; min-width: 0; }
.page--bare { padding: 0; }
.page-footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 32px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.footer-break { display: inline-flex; align-items: center; color: var(--muted); opacity: .28; transition: opacity .15s ease, color .15s ease, transform .15s ease; }
.footer-break:hover, .footer-break:focus-visible { opacity: 1; color: var(--accent); transform: scale(1.1); }

.arcade-panel { max-width: 720px; margin: 0 auto; }
.arcade-hud { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.arcade-stat { display: flex; flex-direction: column; min-width: 58px; }
.arcade-stat span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.arcade-stat strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.arcade-controls { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.arcade-stage { padding: 18px 20px; display: flex; justify-content: center; background: var(--surface-alt, var(--bg)); }
.arcade-stage canvas { width: 100%; max-width: 640px; height: auto; aspect-ratio: 640 / 440; image-rendering: pixelated; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .24); outline: none; cursor: none; }
.arcade-legend { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 12px 20px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- Feather-branded role permission checkboxes ---------- */
.perms-table .perms-col { text-align: center; width: 110px; }
.feather-check { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; vertical-align: middle; }
.feather-check input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; cursor: pointer; }
.feather-check__box { width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid var(--field-border); background: var(--field-bg); display: inline-flex; align-items: center; justify-content: center; transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .1s ease; }
.feather-check__box::after { content: ""; width: 10px; height: 6px; border-left: 2.2px solid #fff; border-bottom: 2.2px solid #fff; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .12s ease; }
.feather-check:hover .feather-check__box { border-color: var(--accent); }
.feather-check input:focus-visible + .feather-check__box { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.feather-check input:checked + .feather-check__box { background: var(--accent); border-color: var(--accent); }
.feather-check input:checked + .feather-check__box::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.feather-check--locked { cursor: default; opacity: .55; }
.feather-check--locked input { cursor: default; }

.section-header { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; margin: -28px -32px 28px; padding: 24px 32px; border-bottom: 1px solid var(--line); background: var(--surface); }
.section-header h1 { margin: 0; font-size: 25px; line-height: 1.3; font-weight: 500; color: var(--text); }
.eyebrow { margin: 0 0 2px; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.message { padding: 8px 10px; border: 1px solid var(--good-line); background: var(--good-soft); color: var(--text); margin-bottom: 10px; }
.message a { color: var(--accent-strong); }
.message-error { background: var(--bad-soft); border-color: var(--bad-line); color: var(--text); }
.message-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--text); }
.message code { background: var(--surface); color: var(--text); border-color: var(--line-dark); }
/* Waiting for background work: a turning ring and the seconds so far */
.wait-clock { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wait-clock::before { content: ""; width: 12px; height: 12px; border: 2px solid var(--line-dark); border-top-color: var(--accent-strong); border-radius: 50%; animation: wait-turn .8s linear infinite; }
@keyframes wait-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wait-clock::before { animation-duration: 3s; } }
[data-wait-step] { display: inline; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--space); min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--surface); border-left: 0; }
.panel-heading h2 { margin: 0; font-size: 20px; font-weight: 400; color: var(--muted); }
.panel-heading__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; }
.panel--alert .panel-heading { border-top: 2px solid var(--bad-line); }
.page-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(300px, 1fr); gap: var(--space); align-items: start; }
/* Nested detail columns must shrink around horizontally scrolling tables. */
.page-grid > *, .two-col > *, .three-col > *, .dash-grid > * { min-width: 0; }
/* Plunet-style status overview on the dashboard */
.status-board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.board { border-right: 1px solid var(--line); min-width: 0; }
.board:last-child { border-right: 0; }
.board h3 { margin: 0; padding: 5px 10px; font-size: 12px; background: var(--surface-alt); border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
.board h3 a { color: inherit; text-decoration: none; }
.board table { width: 100%; border-collapse: collapse; font-size: 12px; }
.board td { padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board td:first-child { white-space: normal; }
.board tr:last-child td { border-bottom: 0; }
.board tr[data-href] { cursor: pointer; }
.board tr[data-href]:hover td { background: var(--surface-alt); }
.board tr.is-zero td, .board tr.is-zero a { color: var(--muted); font-weight: normal; }
.board tr.is-alert td, .board tr.is-alert a { color: var(--red, var(--bad)); font-weight: bold; }
.status-board-panel { margin-bottom: 12px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space); align-items: start; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 10px; border-bottom: 2px solid var(--line); }
.tabs a { display: inline-flex; align-items: center; min-height: var(--control-height); padding: 7px 14px; border: 1px solid var(--line); border-bottom: 0; background: var(--surface-alt); text-decoration: none; font-size: 12px; }
.tabs a.is-active { background: var(--surface); font-weight: bold; position: relative; top: 2px; border-bottom: 2px solid var(--surface); }
.copy-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.message--inpanel { margin: 8px 12px; }
.help-table td { vertical-align: top; }
.help-table td:first-child { width: 34%; font-weight: bold; }
.period-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.period-form select { width: auto; max-width: 100%; }
@media (max-width: 1250px) { .status-board { grid-template-columns: repeat(3, minmax(0, 1fr)); } .board { border-bottom: 1px solid var(--line); } }
@media (max-width: 800px) { .status-board, .three-col { grid-template-columns: 1fr; } .board { border-right: 0; } }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space); align-items: start; }
.subheading { margin: 4px 12px 6px; font-size: 12px; color: var(--blue-dark); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--surface-alt); color: var(--muted); font-size: 12px; text-transform: none; white-space: nowrap; font-weight: 600; }
thead th a { color: var(--muted); text-decoration: underline; }
tbody tr:nth-child(even) { background: var(--surface-muted); }
tbody tr:hover { background: var(--surface-soft); }
tfoot td { background: var(--surface-alt); font-weight: bold; border-top: 1px solid var(--line-dark); }
tr[data-href] { cursor: pointer; }
tr.is-late td:first-child { box-shadow: inset 3px 0 0 var(--red); }
tr.is-late .cell-primary { color: var(--bad); }
tr.empty td { color: var(--muted); padding: 12px 8px; }
.is-numeric { text-align: right; white-space: nowrap; }
.cell-primary { font-weight: 600; color: var(--accent-strong); white-space: nowrap; }
.table-subline { color: var(--muted); font-size: 11px; margin-top: 1px; }
.share-col { width: 22%; }
.report-table td, .report-table th { padding: 10px 12px; }
.log-table td { font-size: 12px; }

.items-table td, .items-table th { padding: 8px 12px; vertical-align: middle; }
/* Editable tables use the same controls as detail forms. */
.items-table select[data-service] { width: 100%; min-width: 150px; }
.items-table input[name$="[description]"] { min-width: 170px; }
.items-table select[name$="_lang]"] { width: 100%; min-width: 120px; }
.items-table select[data-unit] { width: 100%; min-width: 110px; }
.items-table input.num { width: 100%; min-width: 100px; text-align: right; }
.items-table tr.is-locked td { color: var(--muted); }
/* Line number and drag handle of the items editor */
.items-table .items-no { width: 52px; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.items-table .drag-handle { display: inline-block; width: 16px; margin-right: 4px; cursor: grab; color: var(--faint); user-select: none; }
.items-table .drag-handle:hover { color: var(--accent-strong); }
.items-table tr.is-dragging { opacity: .55; background: var(--accent-soft); }
.items-table tr.is-dragging .drag-handle { cursor: grabbing; }
.items-table input.num[readonly] { background: var(--surface-alt); color: var(--muted); }
.items-table tfoot td { background: var(--surface-muted); vertical-align: middle; }
.edit-table td { padding: 6px; }

.edit-table input.num { width: 90px; text-align: right; }
.edit-table .new-row td { background: var(--accent-soft); border-top: 1px dashed var(--green-dark); }
.row-remove { width: var(--control-height); min-height: var(--control-height); padding: 0; background: transparent; border: 1px solid transparent; color: var(--bad); font-size: 16px; line-height: 1; cursor: pointer; }
.row-remove:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }

/* ---------- status ---------- */
.status-pill { color: var(--text); display: inline-block; min-width: 78px; padding: 3px 8px; border: 1px solid var(--line-dark); border-left-width: 4px; background: var(--surface-soft); text-align: center; font-size: 11px; white-space: nowrap; }
.status-draft, .status-preparation, .status-logged { border-left-color: var(--line-dark); }
.status-active, .status-open, .status-sent, .status-requested, .status-accepted, .status-in_progress { border-left-color: var(--blue); }
.status-delivered, .status-approved, .status-prospect { border-left-color: var(--good); }
.status-completed, .status-paid { border-left-color: var(--good); }
.status-cancelled, .status-rejected, .status-expired, .status-inactive { border-left-color: var(--faint); color: var(--muted); }
.status-overdue, .status-failed, .status-blocked { border-left-color: var(--bad); background: var(--bad-soft); }
.tag { display: inline-block; padding: 0 5px; border: 1px solid var(--line-dark); font-size: 11px; color: var(--muted); background: var(--surface-alt); white-space: nowrap; }
.tag--link { color: var(--accent-strong); }
.tag--warn { border-color: var(--warn); color: var(--warn); }
.tag--deadline { border-color: var(--warn); color: var(--warn); }
.tag--interpreting { border-color: var(--accent); color: var(--accent-strong); }
.tag--job { border-color: var(--blue); color: var(--blue-dark); }

/* ---------- forms ---------- */
label { display: block; min-width: 0; }
label > span { display: block; margin-bottom: 6px; color: var(--text); font-size: 12px; font-weight: 600; }
input, select, textarea, button { font: inherit; }
:where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), select, textarea) {
  width: 100%; min-width: 0; height: var(--control-height); border: 1px solid var(--field-border); border-radius: var(--radius); padding: 8px 10px; color: var(--field-text); background: var(--field-bg);
}
textarea { min-height: 100px; height: auto; resize: vertical; }
input:hover, select:hover, textarea:hover { background: var(--field-bg-hover); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: none; border-color: var(--blue-dark); box-shadow: 0 0 0 2px var(--focus); }
input:disabled, input[readonly] { background: var(--surface-alt); color: var(--faint); }
input[type=checkbox] { accent-color: var(--blue); width: 14px; height: 14px; margin: 0; vertical-align: -2px; }
input[type=file] { color: var(--text); max-width: 100%; min-height: var(--control-height); }
button, .small-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-height); padding: 8px 16px; line-height: 20px; background: var(--btn-bg); color: var(--btn-text); font-weight: bold; border: 1px solid var(--btn-line); border-radius: var(--radius); cursor: pointer; }
button:hover { background: var(--btn-bg-hover); }
.small-button { font-size: inherit; }
.small-button--blue { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
/* A small action inside a grey subline of a table row (OCR again) */
.mini-button { display: inline-block; min-height: 0; padding: 0 6px; margin-left: 4px; font-size: 11px; line-height: 16px; font-weight: normal; vertical-align: baseline; background: var(--surface); color: var(--accent-strong); border: 1px solid var(--line-dark); border-radius: var(--radius); }
.mini-button:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.table-subline .inline-form { display: inline; }
.small-button--blue:hover { background: var(--accent-soft-hover); }
.danger-button { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.danger-button:hover { background: var(--bad-line); }
.button-link { display: inline-flex; align-items: center; justify-content: center; min-height: var(--control-height); padding: 8px 16px; line-height: 20px; border-radius: var(--radius); font-weight: 600; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-strong); white-space: nowrap; }
.button-link:hover { background: var(--accent-soft-hover); color: var(--accent-strong); text-decoration: none; }
.button-link--muted { background: var(--surface-alt); border-color: var(--line-dark); color: var(--text); }
.button-link--muted:hover { background: var(--surface-soft); }
.button-link--small { font-size: inherit; }
.button-link--warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.inline-form { display: inline-flex; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px; }
.form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.compact { padding-top: 6px; border-top: 1px dashed var(--line); }
fieldset.form-grid { margin: 0 12px 6px; border: 1px solid var(--line); padding-top: 4px; }
fieldset legend { color: var(--blue-dark); font-size: 11px; font-weight: bold; text-transform: uppercase; padding: 0 4px; }
.full { grid-column: 1 / -1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.check { display: inline-flex; align-items: center; gap: 5px; margin-right: 12px; cursor: pointer; }
.check.intake-add-contact { margin-top: 8px; font-size: 13px; }
.memo-field textarea { background: var(--memo-bg); border-color: var(--memo-line); color: var(--field-text); }
.memo-field textarea:hover, .memo-field textarea:focus { background: var(--memo-bg-hover); }
.memo-field > span { color: var(--memo-text); }
.memo-field > span small { font-weight: normal; opacity: .8; }
.compose-translate { display: inline-flex; align-items: center; gap: 6px; margin-left: 16px; flex: none; }
.compose-translate select, .compose-translate button { width: auto; height: var(--control-height); min-height: 0; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
.two-step-control { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.two-step-control .check { margin: 0; white-space: nowrap; }
.two-step-control input[type=checkbox] { flex: 0 0 auto; margin: 0; width: 14px; height: 14px; }
.client-upload-page { max-width: 680px; margin: 5vh auto; padding: 0 16px; }
.client-upload-page .pad { padding: 24px; }
.client-upload-page progress { width: 100%; }
.request-message, [data-client-upload-link] { overflow-wrap: anywhere; }
.client-upload-page { max-width: 720px; margin: 32px auto; }
.upload-card { border-radius: 8px; box-shadow: 0 6px 24px var(--shadow); }
.upload-card__body { padding: 30px 32px; }
.upload-brand-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.upload-brand-row .eyebrow { margin: 0; }
.upload-tenant-logo { width: 180px; max-width: 48%; height: 48px; object-fit: contain; object-position: left center; }
.upload-language { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.upload-language > span { margin: 0; line-height: 1.25; }
.upload-language select { width: auto; min-height: 32px; padding: 4px 26px 4px 8px; }
.upload-card h1 { margin: 0 0 8px; }
.upload-intro { color: var(--muted); margin: 0 0 26px; }
.upload-request-form { display: grid; gap: 20px; }
.upload-request-form [hidden] { display: none !important; }
.upload-request-form label > span:first-child, .upload-request-form legend { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.upload-request-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.upload-contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.upload-deadline__row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 16px; }
.upload-field-help { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.upload-date, .upload-clock { position: relative; }
.upload-date__field, .upload-time__field { display: flex; height: var(--control-height); margin-bottom: 0; border: 1px solid var(--field-border); background: var(--field-bg); border-radius: var(--radius); overflow: hidden; }
.upload-date__field:focus-within, .upload-time__field:focus-within { box-shadow: 0 0 0 2px var(--focus); border-color: var(--accent-strong); }
.upload-date__field input, .upload-time__field input { height: 100%; border: 0; box-shadow: none; min-width: 0; }
.upload-date__field button, .upload-time__field button { height: 100%; min-height: 0; border: 0; border-radius: 0; min-width: 42px; padding: 6px 10px; background: var(--accent-soft); color: var(--accent-strong); }
.upload-time__field input { font-variant-numeric: tabular-nums; }
.upload-clock-picker { position: absolute; top: calc(100% + 6px); right: 0; z-index: 21; width: 274px; max-width: calc(100vw - 64px); padding: 12px; border: 1px solid var(--accent-line); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 24px var(--shadow); }
.upload-clock-readout { display: flex; justify-content: center; align-items: center; gap: 5px; color: var(--muted); font-size: 24px; font-variant-numeric: tabular-nums; }
.upload-clock-readout button { min-height: 42px; min-width: 48px; padding: 4px 8px; font-size: 26px; font-weight: 500; color: var(--muted); background: transparent; border-color: transparent; }
.upload-clock-readout button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent-strong); }
.upload-clock-hint { text-align: center; margin: 6px 0 10px; font-size: 12px; color: var(--muted); }
.upload-clock-dial { position: relative; width: 248px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--surface-alt); touch-action: none; user-select: none; }
.upload-clock-dial:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 3px; }
.upload-clock-number { position: absolute; z-index: 2; width: 30px; height: 30px; min-height: 0; padding: 0; transform: translate(-50%, -50%); border: 0; border-radius: 50%; background: transparent; color: var(--text); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.upload-clock-number--inner { font-size: 11px; color: var(--muted); }
.upload-clock-number:hover { background: var(--accent-soft); }
.upload-clock-number[aria-pressed=true] { color: var(--btn-text); background: var(--btn-bg); }
.upload-clock-hand { position: absolute; z-index: 1; bottom: 50%; left: calc(50% - 1px); width: 2px; background: var(--accent); transform-origin: 50% 100%; pointer-events: none; }
.upload-clock-center { position: absolute; z-index: 2; top: calc(50% - 4px); left: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent-strong); pointer-events: none; }
.upload-clock-footer { display: flex; justify-content: flex-end; padding-top: 12px; }
.upload-clock-footer button { min-height: 32px; padding: 4px 16px; }
.upload-calendar { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: 296px; max-width: calc(100vw - 80px); padding: 12px; background: var(--surface); border: 1px solid var(--accent-line); border-radius: 6px; box-shadow: 0 8px 24px var(--shadow); }
.upload-calendar__header { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; gap: 8px; text-align: center; margin-bottom: 12px; }
.upload-calendar__header button { padding: 0; min-height: 30px; font-size: 22px; background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.upload-calendar__week, .upload-calendar__days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.upload-calendar__week { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.upload-calendar__days button { min-height: 32px; padding: 4px 0; border-color: transparent; background: transparent; color: var(--text); font-weight: normal; }
.upload-calendar__days button:hover { background: var(--accent-soft); }
.upload-calendar__days button[aria-current=date] { border-color: var(--accent-line); font-weight: bold; }
.upload-calendar__days button[aria-pressed=true] { background: var(--btn-bg); color: var(--btn-text); }
.upload-calendar__days button:disabled { color: var(--faint); opacity: .5; background: transparent; cursor: default; }
.upload-calendar__footer { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.upload-calendar__footer button { min-height: 28px; padding: 2px 8px; color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent-line); font-size: 12px; }
.upload-targets summary { padding: 9px 12px; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--field-bg); cursor: pointer; overflow-wrap: anywhere; }
.upload-targets__panel { padding: 12px; border: 1px solid var(--line); border-top: 0; background: var(--surface-muted); }
.upload-targets__options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 210px; overflow: auto; padding-top: 12px; }
.upload-targets__options .check { margin: 0; align-items: flex-start; }
.upload-targets__options .check span { color: var(--text); font-size: 13px; margin: 0; }
.upload-targets__options input { flex: 0 0 auto; margin-top: 2px; }
.upload-target-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.upload-target-chip { min-height: 26px; padding: 2px 8px; margin-top: 6px; font-size: 12px; font-weight: normal; background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-line); }
.upload-dropbox { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 14px; padding: 24px 16px 18px; border: 1px dashed var(--accent-line); background: var(--surface-muted); border-radius: 5px; }
.upload-dropbox.is-dragging { background: var(--accent-soft); border-color: var(--accent-strong); }
.upload-request-form .upload-file-button { position: relative; display: inline-flex; padding: 10px 18px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); cursor: pointer; }
.upload-request-form .upload-file-button > span:first-child { margin: 0; color: var(--accent-strong); font-size: 13px; font-weight: 600; }
.upload-file-button:focus-within { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.upload-file-button input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-limits { flex-basis: 100%; text-align: center; margin: 0; color: var(--muted); font-size: 11px; }
.upload-selected-files { list-style: none; padding: 0; margin: 10px 0 0; }
.upload-selected-files li { display: grid; grid-template-columns: minmax(0, 1fr) auto 28px; align-items: start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.upload-selected-files li.muted { display: block; font-size: 12px; border: 0; padding: 4px 0; }
.upload-file-name { white-space: normal; overflow-wrap: anywhere; }
.upload-file-size { color: var(--muted); font-size: 11px; padding-top: 3px; white-space: nowrap; }
.upload-file-remove { min-height: 24px; padding: 0 5px; color: var(--muted); border-color: transparent; background: transparent; font-size: 18px; line-height: 20px; }
.upload-formats { font-size: 12px; color: var(--muted); }
.upload-formats summary { cursor: pointer; color: var(--accent-strong); }
.upload-formats p { margin: 8px 0 0; }
.upload-submit { border-top: 1px solid var(--line); padding-top: 16px; }
.upload-submit > .muted { margin: 0 0 12px; font-size: 12px; }
.upload-submit [data-upload-status]:empty { display: none; }
.upload-submit button[type=submit] { width: 100%; min-height: 44px; }
.upload-submit progress { display: block; height: 7px; margin: 12px 0; border: 0; border-radius: 5px; background: var(--surface-alt); accent-color: var(--accent); overflow: hidden; }
.upload-submit progress::-webkit-progress-bar { background: var(--surface-alt); }
.upload-submit progress::-webkit-progress-value { background: var(--accent); }
.upload-submit progress::-moz-progress-bar { background: var(--accent); }
.client-request-files a { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
@media (max-width: 360px) {
  .upload-request-form .upload-deadline__row { grid-template-columns: minmax(0, 1fr); }
  .upload-deadline__row > div:last-child { max-width: 160px; }
  .upload-clock-picker { left: 0; right: auto; }
}
@media (max-width: 520px) {
  .client-upload-page { margin: 16px auto; padding: 0 12px; }
  .upload-card__body { padding: 22px 20px; }
  .upload-contact-row { grid-template-columns: 1fr; }
  .upload-brand-row { gap: 8px; }
  .upload-language > span { display: none; }
  .upload-deadline__row { grid-template-columns: minmax(0, 1fr) 128px; gap: 10px; }
  .upload-targets__options { grid-template-columns: 1fr; }
}
.check-cell { display: flex; align-items: center; align-self: end; min-height: var(--control-height); flex-wrap: wrap; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-actions--panel { padding: 16px; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.attach-list { border: 1px solid var(--line); padding: 6px 10px; display: grid; gap: 4px; }
.attach-list .check { margin: 0; }
.search-toolbar, .filter-grid { display: grid; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line); background: var(--surface-alt); align-items: end; }
.search-toolbar { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.search-toolbar--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.filter-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.search-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-grid > .search-actions { grid-column: 1 / -1; }
.period-form select { min-width: 150px; }
.upload-form { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.kind-block[hidden] { display: none; }
/* Drag and drop of files (feather.js) */
.drop-hint { font-size: 12px; }
.drop-status { color: var(--blue-dark); font-weight: bold; }
.drop-status.drop-error { color: var(--bad); }
.drop-ready { outline: 2px dashed var(--blue); outline-offset: -2px; }
.drop-flash { outline: 2px solid var(--green-dark); outline-offset: -2px; }
body.drag-files::after { content: "Drop to attach to this record"; position: fixed; inset: 10px; z-index: 9999; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: bold; color: var(--blue-dark); background: var(--overlay); border: 3px dashed var(--blue); border-radius: 8px; pointer-events: none; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; border-top: 1px solid var(--line); background: var(--surface-alt); }

/* ---------- detail ---------- */
.detail-list { margin: 0; padding: 4px 12px 8px; }
.detail-list div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--surface-muted); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; word-break: break-word; }
.order-strip { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line); background: var(--surface); padding: 6px 8px; margin-bottom: 12px; }
.status-steps { display: flex; flex-wrap: wrap; gap: 0; }
.step { display: inline-flex; align-items: center; justify-content: center; min-height: var(--control-height); padding: 8px 12px; line-height: 20px; border: 1px solid var(--line); margin-right: -1px; background: var(--surface-alt); color: var(--muted); font-weight: normal; font-size: 12px; }
button.step:hover { background: var(--surface-soft); color: var(--surface); }
.step.is-current { background: var(--btn-bg); color: var(--btn-text); border-color: var(--accent-line); font-weight: bold; }
.profit { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.profit b { color: var(--text); }
.profit .pos b { color: var(--good); }
.profit .neg b { color: var(--bad); }
.contact-list { display: grid; }
.contact { border-bottom: 1px solid var(--line); }
.contact summary { padding: 6px 12px; cursor: pointer; display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.contact summary .muted { font-size: 12px; }
.contact.is-inactive summary strong { color: var(--muted); text-decoration: line-through; }
.contact .inline-form { margin: 0 12px 8px; }
.add-block summary { padding: 7px 12px; cursor: pointer; color: var(--good); font-weight: bold; }
.log-list { list-style: none; margin: 0; padding: 4px 0; max-height: 520px; overflow-y: auto; }
.log-list > li { padding: 6px 12px; border-bottom: 1px solid var(--surface-muted); font-size: 12px; }
.log-list > li.log-email { box-shadow: inset 3px 0 0 var(--blue); }
.log-list > li.log-failed { box-shadow: inset 3px 0 0 var(--red); }
.log-meta span { color: var(--muted); }
.log-list--compact > li { padding: 4px 12px; }
.log-changes { list-style: none; margin: 3px 0 0; padding: 0 0 0 8px; border-left: 2px solid var(--line); }
.log-changes span { color: var(--muted); }
.log-changes del { color: var(--bad); }
.log-changes ins { color: var(--good); text-decoration: none; }
.file-list, .plain-list { list-style: none; margin: 0; padding: 4px 12px 8px; }
.file-list li, .plain-list li { padding: 4px 0; border-bottom: 1px solid var(--surface-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.quick-jobs { padding: 8px 12px; border-top: 1px dashed var(--line); display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.mail-body { margin: 0 12px 12px; padding: 10px; background: var(--surface-muted); color: var(--text); border: 1px solid var(--line-dark); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; overflow-x: auto; font: 13px/1.45 Tahoma, Verdana, sans-serif; }
.agenda-time { width: 90px; white-space: nowrap; font-weight: bold; }

/* ---------- dashboard ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { display: block; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent-line); padding: 16px; color: var(--text); }
a.kpi:hover { background: var(--surface-soft); text-decoration: none; color: var(--text); }
.kpi--warn { border-top-color: var(--warn); }
.kpi--bad { border-top-color: var(--bad); }
.kpi--good { border-top-color: var(--good); }
.kpi__label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.kpi__value { display: block; font-size: 21px; color: var(--blue-dark); margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__sub { display: block; font-size: 11px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space); align-items: start; margin-bottom: 0; }
.dash-wide { grid-column: span 2; }
.dash-full { grid-column: 1 / -1; }
.chart { width: 100%; max-width: 900px; height: auto; display: block; margin: 0 auto; }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__axis { fill: var(--muted); font-size: 10px; font-family: Tahoma, sans-serif; }
.chart__label { fill: var(--text); font-size: 9px; font-family: Tahoma, sans-serif; }
.chart__a { fill: var(--blue); }
.chart__b { fill: var(--amber); }
.chart__a:hover, .chart__b:hover { opacity: .8; }
.chart-legend { display: flex; gap: 14px; font-size: 11px; margin-top: 4px; color: var(--text); }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; }
.swatch--a { background: var(--chart-a); }
.swatch--b { background: var(--chart-b); }
.donut-wrap { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; }
.donut { width: 130px; height: 130px; }
.donut__bg { stroke: var(--surface-alt); }
.donut__value { fill: var(--text); font-size: 6px; font-weight: bold; font-family: Tahoma, sans-serif; }
.donut__label { fill: var(--muted); font-size: 3px; font-family: Tahoma, sans-serif; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.donut-legend li { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 4px; border-bottom: 1px solid var(--surface-muted); padding-bottom: 3px; }
.hbars { padding: 12px; display: grid; grid-template-columns: minmax(90px, 1.2fr) minmax(60px, 1fr) max-content; gap: 8px; }
.hbar { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; font-size: 12px; }
.hbar__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar__track { height: 8px; background: var(--surface-alt); border: 1px solid var(--line); }
.hbar__fill { height: 100%; background: linear-gradient(90deg, var(--chart-a), var(--accent)); }
.hbar__value { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.hbar__value .muted { display: inline-block; min-width: 5ch; }
.gauge { margin: 4px 0 10px; font-size: 12px; }
.gauge__track { height: 12px; background: var(--surface-alt); border: 1px solid var(--line); margin-bottom: 3px; }
.gauge__fill { height: 100%; }
.gauge--good .gauge__fill { background: var(--green-dark); }
.gauge--warn .gauge__fill { background: var(--amber); }
.gauge--bad .gauge__fill { background: var(--red); }
.mini-title { margin: 4px 0; color: var(--blue-dark); font-size: 11px; font-weight: bold; text-transform: uppercase; }

/* ---------- search ---------- */
.search-results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space); align-items: start; }
.search-result-row { display: grid; padding: 6px 12px; border-top: 1px solid var(--line); color: var(--text); }
.search-result-row:hover { background: var(--surface-soft); text-decoration: none; color: var(--text); }
.search-result-row span { color: var(--muted); font-size: 12px; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-panel { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line-dark); border-top: 3px solid var(--green); padding: 18px; }
.login-brand { text-align: center; margin-bottom: 12px; }
.login-brand img { width: 140px; height: auto; }
.stack-form { display: grid; gap: 10px; }

/* Shared interaction and layout rules, including native disclosure controls. */
a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--blue-dark); outline-offset: 3px; }
select:disabled, textarea:disabled, button:disabled { opacity: .6; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input[type=file]::file-selector-button { min-height: var(--control-height); padding: 8px 12px; margin-right: 10px; border: 1px solid var(--line-dark); border-radius: var(--radius); background: var(--surface-alt); color: var(--text); font: inherit; cursor: pointer; }
.link-button { min-height: var(--control-height); padding: 0; border: 0; background: none; font-weight: normal; }
.form-grid > *, .header-actions, .period-form, .section-header > div { min-width: 0; }
.section-header h1 { overflow-wrap: anywhere; }
.advanced-filters { grid-column: 1 / -1; border-top: 1px solid var(--line); }
.advanced-filters > summary { padding: 10px 0; color: var(--blue-dark); cursor: pointer; font-weight: 600; }
.advanced-filters__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; padding: 6px 0; }
.contact summary, .add-block summary { min-height: var(--control-height); padding: 10px 16px; }
@media (max-width: 1300px) {
  .form-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid--4 > .span-3 { grid-column: 1 / -1; }
  .top-search { flex: 1 1 280px; }
  .top-search input[type=search] { width: 100%; }
}

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .kpi-row, .two-col, .dash-grid, .search-results-grid { grid-template-columns: 1fr 1fr; }
  .dash-wide { grid-column: 1 / -1; }
  .form-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-toolbar, .search-toolbar--4 { grid-template-columns: 1fr 1fr; }
  .top-search { width: 100%; padding: 8px 12px; }
  .top-search input[type=search] { width: 100%; }
}
@media (max-width: 720px) {

  .top-nav__link { min-height: 44px; padding: 0 10px; }
  .top-nav__icon { display: none; }
  .kpi-row, .two-col, .dash-grid, .search-results-grid, .form-grid, .form-grid--4 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: 1 / -1; }
  .page { padding: 16px 12px 28px; }
  .section-header { margin: -16px -12px 20px; padding: 20px 12px; }
  .top-nav { padding: 8px 12px 0; gap: 4px 12px; }
  .primary-nav { order: 3; width: 100%; justify-content: center; }
  .top-search { order: 4; flex-basis: 100%; }
  .account-menu { margin-left: auto; }
  .section-bar { padding: 0 12px; flex-wrap: wrap; gap: 0; }
  .section-nav__link { padding: 8px 10px; }
  .donut-wrap { grid-template-columns: 1fr; }
  .search-toolbar, .search-toolbar--4 { grid-template-columns: 1fr; }
  .period-form { justify-content: flex-start; width: 100%; }
  .period-form select { width: 100%; }
  .header-actions { width: 100%; }
  .header-actions .button-link, .header-actions button { max-width: 100%; white-space: normal; }
}
@media print {
  .top-nav, .section-bar, .page-footer, .header-actions, form, .pager { display: none !important; }
  .shell-main { margin: 0; }
  body, .panel { background: #fff; color: #000; }
}
/* Layout corrections shared by lists, editors and creation cards. */
.date-cell { white-space: nowrap; min-width: 108px; font-variant-numeric: tabular-nums; }
.order-start-options { align-items: stretch; }
.order-start-options > .panel { display: flex; flex-direction: column; }
.order-start-options .form-grid { flex: 1; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
.order-start-options .form-actions { grid-row: 3; grid-column: 1 / -1; }
.order-start-options .check-cell { align-self: start; }
.items-table td:has(input[data-qty]), .items-table td:has(input[data-price]) { width: 112px; }
.items-table td:has([data-remove]) { width: 54px; }
.items-table .combobox:has(> select[data-service]) { min-width: 200px; }
.items-table .combobox:has(> select[name$="_lang]"]) { min-width: 120px; }
.items-table .combobox:has(> select[data-unit]) { min-width: 110px; }
.items-table td:has(select[data-service]) { width: 224px; }
.items-table td:has(select[name$="_lang]"]) { width: 150px; }
.items-table td:has(select[data-unit]) { width: 140px; }
/* From tablet width up the items table fits the panel: fixed column percentages (colgroup), no minimum widths,
   so Price and Amount are always visible without a scroll bar. Phones keep the scrollable table. */
@media (min-width: 900px) {
  .items-table { table-layout: fixed; width: 100%; }
  .items-table td, .items-table th { padding: 8px 5px; overflow: hidden; }
  .items-table td:first-child, .items-table th:first-child { padding-left: 12px; }
  .items-table td:has(input[data-qty]), .items-table td:has(input[data-price]), .items-table td:has([data-remove]),
  .items-table td:has(select[data-service]), .items-table td:has(select[name$="_lang]"]), .items-table td:has(select[data-unit]) { width: auto; }
  .items-table select[data-service], .items-table input[name$="[description]"], .items-table select[name$="_lang]"],
  .items-table select[data-unit], .items-table input.num,
  .items-table .combobox:has(> select[data-service]), .items-table .combobox:has(> select[name$="_lang]"]), .items-table .combobox:has(> select[data-unit]) { min-width: 0; width: 100%; }
  .items-table [data-amount], .items-table [data-total] { white-space: nowrap; }
  .items-table tfoot td { overflow: visible; }
  .items-table .combobox__input { padding-right: 30px; text-overflow: ellipsis; }
}
/* The popup lives outside scrolling tables so options never get clipped. */
.combobox { position: relative; min-width: 0; width: 100%; }
.combobox__input { padding-right: 36px; }
.combobox__ghost { position: absolute; inset: 0 36px 0 0; border: 1px solid transparent; padding: 0 10px; font: inherit; line-height: calc(var(--control-height) - 2px); letter-spacing: inherit; color: var(--faint); white-space: pre; overflow: hidden; pointer-events: none; }
.copy-cell { text-align: right; white-space: nowrap; }
.copy-cell .copy-form { justify-content: flex-end; padding: 0; }
.combobox__prefix { color: transparent; }
.combobox__toggle { position: absolute; right: 1px; top: 1px; width: 34px; min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--field-text); }
.combobox__toggle:hover { background: var(--surface-soft); }
/* Language fields: the chosen language is a removable tag, like the target languages of a request; type to search */
.combobox--chip { display: flex; align-items: center; cursor: text; }
.combobox--chip .combobox__input { flex: 1 1 24px; min-width: 24px; width: auto; }
.combobox--chip .combobox__toggle, .combobox--chip .combobox__ghost { display: none; }
.combobox__chip { flex: 0 1 auto; min-width: 0; }
.combobox__chip-text { overflow: hidden; text-overflow: ellipsis; }
.combobox__chip[hidden], .combobox__chip button[hidden] { display: none; }
.combobox--chip.is-disabled { background: var(--surface-alt); cursor: default; }
.items-table .combobox--chip .combobox__input { padding: 0 4px; }
.combobox__list { position: fixed; z-index: 100; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); color: var(--field-text); border: 1px solid var(--field-border); border-radius: var(--radius); padding: 4px; box-shadow: 0 8px 24px var(--shadow); }
.combobox__option { padding: 9px 10px; min-height: 38px; border-radius: 3px; cursor: pointer; overflow-wrap: anywhere; }
.combobox__option:hover, .combobox__option[aria-selected=true] { background: var(--accent-soft); color: var(--text); }
.combobox__empty { padding: 10px; color: var(--faint); }
.period-form .combobox { width: 230px; max-width: 100%; }
@media (max-width: 720px) {
  .period-form .combobox { width: 100%; }
  .hbars { grid-template-columns: minmax(80px, 1fr) minmax(40px, .7fr) max-content; gap: 6px; }
}
/* Form columns follow their panel width, including narrow detail-page columns. */
.panel { container-type: inline-size; }
@container (max-width: 1000px) {
  .form-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid--4 > .span-3 { grid-column: 1 / -1; }
}
@container (max-width: 480px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid > .span-2, .form-grid > .span-3 { grid-column: 1 / -1; }
}

/* Soft status and chart colors retain Feather's blue and green identity. */
.status-draft, .status-preparation, .status-logged { background: var(--surface-alt); }
.status-active, .status-open, .status-sent, .status-requested, .status-accepted, .status-in_progress { background: var(--info-soft); color: var(--info); }
.status-delivered, .status-approved, .status-prospect { background: var(--good-soft); color: var(--good); }
.status-completed, .status-paid { background: var(--good-soft); color: var(--good); }
.status-overdue, .status-failed, .status-blocked { color: var(--bad); }
.chart__a { fill: var(--chart-a); }
.chart__b { fill: var(--chart-b); }
.gauge--good .gauge__fill { background: var(--good); }
.gauge--warn .gauge__fill { background: var(--chart-b); }
.gauge--bad .gauge__fill { background: var(--bad); }
.header-actions { justify-content: center; }
.order-strip { background: var(--surface-muted); padding: 12px 16px; }
.step { border-color: var(--line); }
.step.is-current { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-line); }
button.step:hover { color: var(--btn-text); }
.profit .pos b { color: var(--good); }
.profit .neg b { color: var(--bad); }
.chart-legend { flex-wrap: wrap; }
@media (max-width: 1100px) {
  .top-nav { gap: 0 8px; padding: 0 16px; }
  .top-nav__link { padding: 0 10px; }
  .top-search { flex: 1 1 200px; }
}

/* Reference-style selection workspace: aligned actions in horizontal rows. */
.order-start-options { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 24px; }
.order-start-options > .panel { display: grid; grid-template-columns: 200px minmax(0, 1fr); border: 0; border-radius: 0; border-bottom: 1px solid var(--line); margin: 0; }
.order-start-options > .panel:last-child { border-bottom: 0; }
.order-start-options .panel-heading { padding: 30px 0; align-items: start; border: 0; }
.order-start-options .form-grid { padding: 24px 0 24px 24px; grid-template-columns: minmax(0, 1fr) 240px; grid-template-rows: auto auto; gap: 12px 24px; }
.order-start-options .form-grid > label.full { grid-column: 1; grid-row: 1; }
.order-start-options .form-actions { grid-column: 2; grid-row: 1; align-self: end; }
.order-start-options .form-actions button { width: 100%; }
.order-start-options .check-cell { grid-column: 1; grid-row: 2; min-height: 24px; }
.dashboard-figures { margin-bottom: 24px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.dashboard-figures > summary { padding: 16px 22px; cursor: pointer; color: var(--muted); font-weight: 600; }
.dashboard-figures > summary span { font-size: 12px; font-weight: 400; margin-left: 12px; color: var(--muted); }
.dashboard-figures__body { padding: 0 20px 4px; }
.status-board { gap: 24px; padding: 20px; border: 0; }
.board { border: 0; }
.board h3 { padding: 10px 12px; text-transform: none; font-size: 14px; font-weight: 600; background: var(--surface-alt); }
.board td { padding: 10px 12px; }
.status-board-panel { margin-bottom: 24px; }
@media (max-width: 900px) {
  .order-start-options > .panel { grid-template-columns: 150px minmax(0, 1fr); }
  .order-start-options .form-grid { grid-template-columns: minmax(0, 1fr); }
  .order-start-options .form-actions { grid-column: 1; grid-row: 3; }
  .order-start-options .form-actions button { width: auto; }
}
@media (max-width: 600px) {
  .order-start-options { padding: 0 16px; }
  .order-start-options > .panel { display: block; }
  .order-start-options .panel-heading { padding: 20px 0 0; }
  .order-start-options .form-grid { padding: 16px 0 24px; }
  .dashboard-figures > summary span { display: block; margin: 4px 0 0; }
}

/* Document templates */
.logo-box { display: flex; align-items: center; min-height: 90px; padding: 10px 14px; border: 1px dashed var(--line-dark); background: #fff; }
.logo-box img { max-width: 260px; max-height: 90px; }
.color-field { display: flex; align-items: center; gap: 10px; min-height: var(--control-height); }
.color-field input[type=color] { width: 56px; height: var(--control-height); padding: 2px; flex: none; }
.preview-row { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Assistant */
.assistant { border-left: 3px solid var(--blue); }
.assist-list { list-style: none; margin: 0; padding: 4px 12px 8px; }
.assist-list > li { padding: 6px 0; border-bottom: 1px solid var(--surface-muted); }
.assist-list > li:last-child { border-bottom: 0; }
.assist-list .inline-form { display: inline; }
.assist-files { margin: 2px 0 0; padding-left: 18px; }

/* Request screen: tick list of languages, price typed in the table */
.check-scroll { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 12px; max-height: 172px; overflow-y: auto; padding: 2px 0; }
.check-scroll .check { margin: 0; }
.price-input { width: 90px; text-align: right; }
.field-caption { display: block; margin-bottom: 3px; }
/* Tag boxes (target languages, language fields) are exactly as high as any other field while their tags fit on one line:
   1px border + 3px padding + a 30px row for tags and typing */
.tag-pick, .combobox--chip { --tag-row: calc(var(--control-height) - 8px); min-height: var(--control-height); padding: 3px; gap: 4px; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--field-bg); }
.tag-pick:focus-within, .combobox--chip:focus-within { border-color: var(--blue-dark); box-shadow: 0 0 0 2px var(--focus); }
.tag-pick .tag-chip, .combobox--chip .tag-chip { height: var(--tag-row); }
.tag-pick input[type=text], .combobox--chip .combobox__input { height: var(--tag-row); min-height: 0; border: 0; border-radius: 0; box-shadow: none; padding: 0 6px; background: transparent; }
.tag-pick input[type=text]:focus, .combobox--chip .combobox__input:focus { box-shadow: none; border: 0; }
.tag-pick { position: relative; display: flex; flex-wrap: wrap; align-items: center; }
.tag-pick input[type=text] { flex: 1 1 180px; min-width: 160px; }
.tag-pick__menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 90; width: min(320px, 100%); max-height: 220px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-dark); border-radius: var(--radius); box-shadow: 0 8px 24px var(--shadow); padding: 4px; }
.tag-pick__menu[hidden] { display: none; }
/* Request screen: one row per source language with its targets and volume */
.intake-pairs { padding: 0 16px 8px; } /* same side margins as the fields above */
.intake-pair { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 150px; gap: 6px 12px; align-items: end; padding: 8px 0; border-top: 1px solid var(--line); }
.intake-pair--extra { opacity: .85; }
.intake-pair__caption { grid-column: 1 / -1; }
.intake-pair__caption:empty { display: none; }
@media (max-width: 700px) { .intake-pair { grid-template-columns: 1fr; } }
/* Signature editor (My account). The preview is white like most mail programs, also in dark mode. */
.sig-editor { border: 1px solid var(--line-dark); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.sig-editor__bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-bottom: 1px solid var(--line); background: var(--surface-alt); }
.sig-editor__bar button { min-height: 0; padding: 3px 10px; font-size: 12px; font-weight: 400; background: var(--surface); color: var(--text); border: 1px solid var(--line-dark); }
.sig-editor__bar button:disabled { opacity: .45; }
.sig-editor__bar .sig-editor__code-toggle { margin-left: auto; }
.sig-editor__bar button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.sig-editor__view { min-height: 130px; max-height: 420px; overflow: auto; padding: 10px 12px; background: #fff; color: #222; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.45; outline: none; }
.sig-editor__view img { max-width: 100%; height: auto; }
.sig-editor__view a { color: #1a5fb4; }
.sig-editor__code { display: block; width: 100%; min-height: 200px; border: 0; border-radius: 0; font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.sig-editor__view[hidden], .sig-editor__code[hidden] { display: none; }
.tag-pick__option { display: block; width: 100%; min-height: 34px; padding: 7px 10px; border: 0; border-radius: 3px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.tag-pick__option:hover, .tag-pick__option[aria-selected=true] { background: var(--accent-soft); color: var(--text); }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 7px; border: 1px solid var(--blue); background: var(--accent-soft); white-space: nowrap; }
.tag-chip button { min-height: 0; height: auto; border: 0; background: transparent; padding: 0 3px; cursor: pointer; font-size: 14px; line-height: 1; font-weight: normal; color: inherit; }
.tag-chip button:hover { color: var(--bad); }


/* ---------- theme switch (top right) ---------- */
.theme-toggle { width: var(--control-height); min-height: var(--control-height); padding: 0; margin-left: 4px; background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: var(--radius); flex: none; }
.theme-toggle:hover { background: var(--surface-soft); color: var(--text); border-color: var(--line); }
.theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
.theme-corner { position: fixed; top: 12px; right: 16px; z-index: 10; }
/* The logo is one flat shape: it takes the accent colour of the theme */
.app-brand img, .login-brand img { filter: none; }

/* ---------- buttons on the accent ---------- */
button, .small-button { color: var(--btn-text); }
.tag-chip button:hover { background: transparent; }
.small-button--blue { color: var(--accent-strong); }
.danger-button { color: var(--bad); }
.link-button, .link-button:hover { color: var(--accent-strong); }
.step.is-current { color: var(--btn-text); }
button.step { background: var(--surface-alt); color: var(--muted); }
button.step:hover { background: var(--surface-soft); color: var(--text); }
.combobox__toggle, .combobox__toggle:hover { color: var(--field-text); }
.top-nav__link.is-active { box-shadow: none; }
::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- language tabs ---------- */
.tabs__label { display: inline-flex; align-items: center; padding: 7px 10px 7px 0; color: var(--muted); font-size: 12px; }
.field-note { margin: 0; align-self: center; font-size: 12px; }
.plain-bullets { margin: 4px 0 0; padding-left: 18px; }

/* ---------- interpreting ---------- */
.tag--sworn { border-color: var(--accent-line); color: var(--accent-strong); background: var(--accent-soft); }
.check-pill { display: inline-block; padding: 2px 8px; border: 1px solid var(--line-dark); border-left-width: 4px; font-size: 11px; white-space: nowrap; background: var(--surface-alt); }
.check-pill--ok { border-color: var(--good-line); border-left-color: var(--good); background: var(--good-soft); color: var(--good); }
.check-pill--warn { border-color: var(--warn-line); border-left-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.check-pill--no { border-color: var(--bad-line); border-left-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.check-notes { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; max-width: 460px; }
.check-notes li { padding: 1px 0 1px 12px; position: relative; color: var(--muted); }
.check-notes li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; background: var(--line-dark); }
.check-notes .note-no { color: var(--bad); }
.check-notes .note-no::before { background: var(--bad); }
.check-notes .note-warn { color: var(--warn); }
.check-notes .note-warn::before { background: var(--warn); }
.candidate-table td { vertical-align: top; }
.candidate-table tr.cand-no td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.candidate-table tr.cand-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.candidate-table tr.cand-ok td:first-child { box-shadow: inset 3px 0 0 var(--good); }
.candidate-table tr.cand-no .cell-primary { color: var(--muted); }
.coverage { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.coverage__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.coverage__bars i { display: block; width: 4px; background: var(--line-dark); }
.coverage__bars i:nth-child(1) { height: 5px; } .coverage__bars i:nth-child(2) { height: 8px; } .coverage__bars i:nth-child(3) { height: 11px; } .coverage__bars i:nth-child(4) { height: 14px; }
.coverage--good .on { background: var(--good); } .coverage--mid .on { background: var(--warn); } .coverage--low .on { background: var(--bad); }
.coverage--none { color: var(--bad); font-weight: 600; }
.interp-panel { border-left: 3px solid var(--accent); }
.interp-panel .detail-list div { grid-template-columns: 130px 1fr; }
.panel-details > summary { cursor: pointer; list-style: none; }
.panel-details > summary::-webkit-details-marker { display: none; }
.panel-details > summary h2::before { content: "\25b8"; display: inline-block; width: 18px; font-size: 14px; }
.panel-details[open] > summary h2::before { content: "\25be"; }
.panel-details:not([open]) > summary { border-bottom: 0; }
.planner-table .day-row td { background: var(--surface-alt); font-weight: 600; border-top: 1px solid var(--line-dark); padding: 8px 12px; }
.planner-table tbody tr.day-row:hover { background: none; }
/* Location box on an interpreting order: type, pick from the directory */
.loc-pick { position: relative; }
.loc-pick__list { position: absolute; z-index: 80; left: 0; right: 0; top: 100%; max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--field-border); border-radius: var(--radius); box-shadow: 0 8px 24px var(--shadow); padding: 4px; }
.loc-pick__item { padding: 8px 10px; cursor: pointer; border-radius: var(--radius); }
.loc-pick__item:hover, .loc-pick__item.is-active { background: var(--accent-soft); }
.loc-pick__item span { display: block; color: var(--muted); font-size: 12px; }
.loc-pick__chosen { margin-top: 4px; font-size: 12px; color: var(--muted); }
.loc-pick__chosen .link-button { min-height: 0; font-weight: normal; }
@media (max-width: 720px) { .theme-toggle { margin-left: auto; } .account-menu { margin-left: 0; } }
.detail-list dd div { display: block; padding: 1px 0; border: 0; }
