/* Helpdesk (simulated system), in Ledger's look with its own accent. One stylesheet, no build step. Inter is
   self-hosted (static/fonts, SIL OFL 1.1). */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Inter", "Segoe UI", "Noto Sans", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Noto Sans Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --hover: #f2f4f7;
  --border: #e4e7ec;
  --border-2: #eef0f3;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --text-3: #667085;
  --text-4: #98a2b3;

  --accent: #0d7a6f;
  --accent-hover: #0b6a60;
  --accent-soft: #e7f5f2;
  --accent-text: #0b6359;
  --focus: 0 0 0 3px rgba(13, 122, 111, .2);

  /* status tones */
  --ok-bg: #ecfdf3;   --ok-fg: #067647;   --ok-bd: #abefc6;
  --warn-bg: #fffaeb; --warn-fg: #b54708; --warn-bd: #fedf89;
  --bad-bg: #fef3f2;  --bad-fg: #b42318;  --bad-bd: #fecdca;
  --info-bg: #eff8ff; --info-fg: #175cd3; --info-bd: #b2ddff;
  --cyan-bg: #ecfdff; --cyan-fg: #0e7090; --cyan-bd: #a5f0fc;
  --wait-bg: #f4f3ff; --wait-fg: #5925dc; --wait-bd: #d9d6fe;
  --off-bg: #f2f4f7;  --off-fg: #475467;  --off-bd: #e4e7ec;
  --done-bg: #344054; --done-fg: #ffffff;

  /* the "simulated system" marking: its own color, never a status color */
  --sim-fg: #344054; --sim-bg: #f8f9fc; --sim-bd: #cbd2dc; --sim-mark: #5d6b82;

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);

  --topbar: 56px;
  --sidebar: 212px;
  --gap: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--font); font-feature-settings: "cv11";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; color: var(--text); }
p { margin: 0 0 12px; }
pre { margin: 0; font: inherit; white-space: pre-wrap; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
        stroke-linecap: round; stroke-linejoin: round; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.date { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.neg { color: var(--text-2); }

/* ---- top bar ---------------------------------------------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 16px;
         letter-spacing: -.01em; flex: none; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; flex: none; }
.topbar .sep { width: 1px; height: 22px; background: var(--border); flex: none; }
.org { color: var(--text-2); font-weight: 500; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sim-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 8px; border-radius: 999px; flex: none;
  background: var(--sim-bg); color: var(--sim-fg); border: 1px solid var(--sim-bd);
  font-size: 11px; font-weight: 650; letter-spacing: .06em; white-space: nowrap;
}
.sim-badge svg { width: 14px; height: 14px; color: var(--sim-mark); stroke-width: 2; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: none; }
.jump { position: relative; display: flex; align-items: center; }
.jump > svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--text-4); pointer-events: none; }
.jump input { width: 236px; height: 34px; padding: 0 36px 0 32px; font-size: 13px; text-transform: uppercase;
              background: var(--surface-2); box-shadow: none; }
.jump input::placeholder { text-transform: none; color: var(--text-4); }
.jump input:focus { background: var(--surface); }
.jump button { position: absolute; right: 4px; width: 26px; height: 26px; padding: 0; border-radius: var(--r-sm);
               border: 0; box-shadow: none; background: transparent; color: var(--text-3); }
.jump button:hover { background: var(--hover); color: var(--text); }
.jump button svg { width: 16px; height: 16px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
          background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 650; }
.who .name { font-size: 13px; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.who .role { font-size: 12px; color: var(--text-3); line-height: 1.25; white-space: nowrap; }

/* ---- shell and sidebar ------------------------------------------------------------------------------------------ */

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - var(--topbar));
         background: linear-gradient(90deg, var(--surface) calc(var(--sidebar) - 1px), var(--border) calc(var(--sidebar) - 1px),
                     var(--border) var(--sidebar), transparent var(--sidebar)); }
.sidebar {
  position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border); padding: 12px 10px 16px;
  display: flex; flex-direction: column;
}
.nav-group { margin: 16px 10px 4px; font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: .06em;
             text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; margin-bottom: 2px;
  border-radius: var(--r-sm); color: var(--text-2); font-weight: 500;
}
.nav a svg { color: var(--text-4); }
.nav a:hover { background: var(--hover); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent-text); }
.nav a.on svg { color: var(--accent); }
.sidebar .bottom { margin-top: auto; padding-top: 16px; }

main { min-width: 0; padding: 20px 24px 16px; display: flex; flex-direction: column;
       min-height: calc(100vh - var(--topbar)); }
main > * { min-width: 0; }
.solo main { max-width: 1100px; margin: 0 auto; width: 100%; }
.foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; }
main > :nth-last-child(2) { margin-bottom: 24px; }
.foot b { color: var(--sim-fg); font-weight: 650; letter-spacing: .04em; }

/* ---- page header ------------------------------------------------------------------------------------------------ */

.page-head { margin-bottom: 16px; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 34px; }
.crumbs { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text-3); font-weight: 500; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); }
.crumbs .sl { color: var(--text-4); }
h1 { font-size: 21px; line-height: 1.3; font-weight: 650; letter-spacing: -.015em; }
.code-tag { font-size: 11px; font-weight: 500; color: var(--text-3); background: var(--surface); letter-spacing: .03em;
            border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.subtitle { margin: 2px 0 0; color: var(--text-3); }
.title-row .actions { margin-left: auto; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- cards and layout ------------------------------------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow);
        margin-bottom: var(--gap); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 16px;
             border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { font-size: 14.5px; font-weight: 600; }
.card-head .hint { color: var(--text-3); font-size: 12.5px; }
.card-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-head .lock { display: inline-flex; align-items: center; gap: 6px; }
.card-head .lock svg { width: 15px; height: 15px; }
.card-body { padding: 16px; }
.card-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 10px 16px;
             border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-foot.sticky { position: sticky; bottom: 0; z-index: 3; box-shadow: 0 -4px 8px -6px rgba(16, 24, 40, .12); }
.card-foot .start { margin-right: auto; }
.card-foot.rev { flex-direction: row-reverse; justify-content: flex-start; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
         background: var(--off-bg); color: var(--text-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cols { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.cols > * { min-width: 0; }
.stack > .card:last-child, .stack > form.card:last-child { margin-bottom: 0; }
.narrow { max-width: 880px; }
.single { max-width: 960px; }

/* ---- the document beside its work ------------------------------------------------------------------------------- */

.workspace { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.workspace.form-wide { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); }
.workspace > * { min-width: 0; }
/* The viewer is as tall as one letter-size page at its width, and never taller than the window. */
.viewer { position: sticky; top: calc(var(--topbar) + 16px); max-height: calc(100vh - var(--topbar) - 86px);
          min-height: 420px; display: flex; flex-direction: column; overflow: hidden; margin-bottom: 0; }
.viewer-head { display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.viewer-head .meta { flex: 1; min-width: 0; margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr);
                     gap: 1px 12px; font-size: 12.5px; }
.viewer-head .meta dt { color: var(--text-3); }
.viewer-head .meta dd { margin: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-head .meta .ref { font-weight: 550; }
.pages { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }
.pages a { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-sm);
           border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px;
           font-weight: 600; white-space: nowrap; box-shadow: var(--shadow); }
.pages a svg { width: 14px; height: 14px; }
.pages a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.viewer iframe { flex: 0 1 auto; min-height: 0; width: 100%; aspect-ratio: 8.5 / 11.12; border: 0;
                 background: var(--surface-2); }
.viewer .none { flex: 1; min-height: 360px; display: grid; place-items: center; color: var(--text-3); background: var(--surface-2); }

/* ---- tables ----------------------------------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { border-collapse: separate; border-spacing: 0; }
.table { width: 100%; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3); background: var(--surface-2);
            padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfcfd; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table .num { text-align: right; white-space: nowrap; }
.table th.num { text-align: right; }
.table td.sub, .table .sub { color: var(--text-3); font-size: 12.5px; }
.ref { font-weight: 550; white-space: nowrap; }
a.ref { color: var(--accent-text); }
td.ref, span.ref { color: var(--text-2); }
.cell2 { display: inline-flex; flex-direction: column; line-height: 1.35; max-width: 100%; }
.cell2 small { color: var(--text-3); font-size: 12px; }
.cell2 > .pill { align-self: flex-start; margin-bottom: 2px; }
.cell2 small.truncate { max-width: 300px; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.table.compact td { padding-top: 6px; padding-bottom: 6px; }
.table.top td { vertical-align: top; }
.table .late { color: var(--bad-fg); font-weight: 600; }
/* a long list in a card of its own height, so what follows it stays in reach */
.table-wrap.scroll { max-height: 440px; overflow: auto; }
.table-wrap.scroll thead th { position: sticky; top: 0; z-index: 1; }
.table td.wrap { white-space: normal; min-width: 180px; }
.table td.answer { white-space: normal; width: 40%; min-width: 220px; }
.table tr.in td { border-bottom-color: transparent; }
.table tr.cont td.lead { padding-left: 28px; }
.empty { text-align: center; padding: 28px 20px !important; color: var(--text-3); }
.empty b { display: block; color: var(--text-2); font-weight: 600; margin-bottom: 2px; }
.empty svg { width: 26px; height: 26px; color: var(--text-4); margin-bottom: 4px; }
.table tbody tr.empty-row:hover td { background: none; }
/* An empty list shows its sentence, not column headers over nothing. */
table:has(> tbody > tr.empty-row:only-child) > thead { display: none; }
div.empty { display: flex; flex-direction: column; align-items: center; }

/* changes in the audit log: key: value, first two lines, the rest on click */
.table.fixed { table-layout: fixed; }
.table.fixed td { overflow: hidden; text-overflow: ellipsis; }
.table.fixed td.wrapcell { white-space: normal; }
.table .w-id { width: 64px; } .table .w-at { width: 168px; } .table .w-user { width: 200px; }
.table .w-action { width: 150px; } .table .w-entity { width: 176px; } .table .w-by { width: 96px; }
.kv { font-family: var(--mono); font-size: 11.5px; line-height: 1.5; color: var(--text-2); min-width: 0; }
.kv .row { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv .k { color: var(--text-3); }
.kv summary { list-style: none; cursor: pointer; }
.kv summary::-webkit-details-marker { display: none; }
.kv .more { display: inline-block; margin-top: 1px; font-family: var(--font); font-size: 12px; font-weight: 600;
            color: var(--accent-text); }
.kv[open] .more { display: none; }
.kv[open] .row, .kv.all .row { white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; }

/* ---- description lists ------------------------------------------------------------------------------------------ */

.dl { display: grid; gap: 12px 20px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin: 0; }
.dl.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dl.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dl.four { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, .7fr); }
.dl > div { min-width: 0; }
.dl dt { font-size: 12px; font-weight: 500; color: var(--text-3); margin-bottom: 2px; }
.dl dd { margin: 0; color: var(--text); overflow-wrap: break-word; }
.dl .span2 { grid-column: span 2; }
.dl .full { grid-column: 1 / -1; }

/* ---- status pills ----------------------------------------------------------------------------------------------- */

.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
        font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid; line-height: 1; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; flex: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.pill.bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
.pill.info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.pill.cyan { background: var(--cyan-bg); color: var(--cyan-fg); border-color: var(--cyan-bd); }
.pill.wait { background: var(--wait-bg); color: var(--wait-fg); border-color: var(--wait-bd); }
.pill.off { background: var(--off-bg); color: var(--off-fg); border-color: var(--off-bd); }
.pill.void { background: var(--surface); color: var(--text-3); border-color: var(--border); text-decoration: line-through; }
.pill.void::before { opacity: .5; }
.pill.done { background: var(--done-bg); color: var(--done-fg); border-color: var(--done-bg); font-weight: 550; }
.pill.done::before { width: 7px; height: 4px; border-radius: 0; background: none; opacity: 1;
                     border: solid currentColor; border-width: 0 0 1.75px 1.75px; transform: translateY(-1px) rotate(-45deg); }
.tag { display: inline-block; font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--off-bg);
       border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.plain { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); white-space: nowrap; }
.plain svg { width: 15px; height: 15px; color: var(--ok-fg); }

/* ---- buttons ---------------------------------------------------------------------------------------------------- */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font: 600 13.5px/1 var(--font); box-shadow: var(--shadow); cursor: pointer; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.danger, button.danger { color: var(--bad-fg); border-color: var(--bad-bd); }
.btn.danger:hover, button.danger:hover { background: var(--bad-bg); }
.btn.ok, button.ok { background: #079455; border-color: #079455; color: #fff; }
.btn.ok:hover, button.ok:hover { background: #067647; color: #fff; }
.btn.sm, button.sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); }
.btn.ghost, button.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.ghost:hover, button.ghost:hover { background: var(--hover); }
/* a row's action: a quiet link-style button */
.btn.row, button.row { height: 28px; padding: 0 8px; font-size: 13px; border-color: transparent; box-shadow: none;
                       background: transparent; color: var(--accent-text); border-radius: var(--r-sm); }
.btn.row:hover, button.row:hover { background: var(--accent-soft); color: var(--accent-text); }
.btn.row svg, button.row svg { width: 15px; height: 15px; }
button.row.danger { color: var(--bad-fg); }
button.row.danger:hover { background: var(--bad-bg); }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--accent-text); }
.link-arrow svg { width: 15px; height: 15px; }

/* ---- forms ------------------------------------------------------------------------------------------------------ */

input, select, textarea {
  font: 400 14px/1.4 var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow);
}
input, select { height: 34px; padding: 0 11px; }
textarea { padding: 9px 11px; width: 100%; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--text-4); }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; box-shadow: none; accent-color: var(--accent); vertical-align: -3px; }
input[type=file] { height: auto; padding: 6px; font-size: 13px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; grid-column: span 6; }
.field.c3 { grid-column: span 3; } .field.c4 { grid-column: span 4; } .field.c5 { grid-column: span 5; }
.field.c7 { grid-column: span 7; } .field.c8 { grid-column: span 8; } .field.c9 { grid-column: span 9; }
.field.c12 { grid-column: 1 / -1; }
.field > .label, .field > .lc > .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field > .lc { display: contents; }
.field > input, .field > select, .field > textarea, .field > .lc > input, .field > .lc > select { width: 100%; }
.field .help, .help { font-size: 12.5px; color: var(--text-3); line-height: 1.4; }
.field .with-btn { display: flex; gap: 8px; }
.field .with-btn input { flex: 1; min-width: 0; }
.with-btn > .lc { display: contents; }
.field .with-btn button { height: 34px; flex: none; }
.fieldset-title { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase;
                  letter-spacing: .06em; padding-top: 10px; border-top: 1px solid var(--border-2); margin-top: 2px; }
.fieldset-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.toolbar .field { grid-column: auto; }
.toolbar .field input, .toolbar .field select { height: 34px; }
.toolbar .grow { flex: 1; min-width: 220px; }
.toolbar .divider { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.toolbar + .help { margin-top: 8px; }
.card-head .toolbar { align-items: center; gap: 10px; }
.card-head select, .card-head input { height: 30px; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; height: 34px; color: var(--text-2); font-weight: 500; }
.card-head .check { height: 30px; font-size: 13px; }
form.inline { display: inline; }
.readonly-value { min-height: 34px; display: flex; align-items: center; padding: 0 11px; border-radius: var(--r);
                  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.readonly-value.text { padding: 7px 11px; }
/* A form that cannot be changed in this state: values stay readable, inputs look settled. */
.locked input, .locked select, .locked textarea { background: var(--surface-2); border-color: var(--border); box-shadow: none;
                                                  color: var(--text-2); }

/* bill lines */
.lines { width: 100%; font-size: 13px; table-layout: fixed; }
.lines th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 0 3px 5px; white-space: nowrap;
            overflow: hidden; text-overflow: ellipsis; }
.lines td { padding: 2px 3px; }
.lines td:first-child, .lines th:first-child { padding-left: 0; width: 22px; color: var(--text-4); text-align: center;
                                               font-variant-numeric: tabular-nums; }
.lines td:last-child, .lines th:last-child { padding-right: 0; }
.lines input, .lines select { width: 100%; height: 30px; padding: 0 7px; font-size: 13px; border-radius: var(--r-sm); box-shadow: none; }
.lines select { padding-right: 24px; background-position: right 5px center; }
.lines .num input { text-align: right; font-variant-numeric: tabular-nums; }
.lines th.num { text-align: right; }
.lines .w-po { width: 52px; } .lines .w-qty { width: 58px; } .lines .w-price { width: 94px; }
.lines .w-gl { width: 124px; } .lines .w-cc { width: 108px; }

/* ---- alerts and notes ------------------------------------------------------------------------------------------- */

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); border: 1px solid;
         margin-bottom: var(--gap); font-weight: 500; }
.alert svg { margin-top: 1px; }
.alert.info { background: var(--info-bg); color: #1849a9; border-color: var(--info-bd); }
.alert.error { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
.alert.notice { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r);
        background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 13px;
        margin-bottom: var(--gap); }
.note svg { color: var(--text-3); margin-top: 1px; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--border-2); }
.checks li:last-child { border-bottom: 0; }
.checks .what { font-weight: 600; }
.checks .bad svg { color: var(--bad-fg); }
.checks .ok svg { color: var(--ok-fg); }

/* ---- home ------------------------------------------------------------------------------------------------------- */

.queues { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 8px; }
.queue { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px 0; color: var(--text); margin: 0;
         transition: border-color .12s, box-shadow .12s; }
.queue:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.queue .top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.queue .ico { width: 32px; height: 32px; border-radius: var(--r); display: grid; place-items: center;
              background: var(--accent-soft); color: var(--accent); }
.queue .name { font-weight: 600; color: var(--text-2); }
.queue .big { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.queue .what { color: var(--text-3); }
.queue .also { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.queue .go { margin: auto -18px 0; margin-top: auto; padding: 10px 18px; border-top: 1px solid var(--border-2); }
.queue .what + .go, .queue .also + .go { margin-top: 14px; }
.queue:hover .go { background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.banner .ico { width: 38px; height: 38px; border-radius: var(--r); display: grid; place-items: center;
               background: var(--accent-soft); color: var(--accent); flex: none; }
.banner .t { font-weight: 600; }
.banner .end { margin-left: auto; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-3); margin: 4px 0 10px; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-bottom: 1px solid var(--border); }
.stats > div { padding: 12px 16px; border-right: 1px solid var(--border-2); }
.stats > div:last-child { border-right: 0; }
.stats .k { font-size: 12px; font-weight: 500; color: var(--text-3); }
.stats .v { font-size: 19px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin-top: 2px;
            white-space: nowrap; }
.stats.flat { border-bottom: 0; }

/* ---- documents: letters, messages, help ------------------------------------------------------------------------- */

.paper { background: var(--surface); width: 100%; max-width: 760px; margin: 0 auto 20px; padding: 44px 52px;
         border: 1px solid var(--border); border-radius: 4px; box-shadow: var(--shadow-md); white-space: pre-wrap;
         line-height: 1.6; color: var(--text); }
.paper .headers { display: grid; grid-template-columns: 70px 1fr; gap: 2px 8px; white-space: normal; padding-bottom: 16px;
                  margin-bottom: 20px; border-bottom: 1px solid var(--border-2); font-size: 13.5px; }
.paper .headers dt { color: var(--text-3); }
.paper .headers dd { margin: 0; }
.paper .sim-foot { margin-top: 32px; padding-top: 12px; border-top: 1px dashed var(--border-strong); white-space: normal;
                   color: var(--sim-fg); font-size: 12px; font-weight: 600; }
.prose { max-width: 860px; padding: 24px 32px; line-height: 1.65; color: var(--text-2); }
.prose h1 { font-size: 22px; margin: 0 0 12px; }
.prose h2 { font-size: 17px; margin: 28px 0 10px; padding-top: 18px; border-top: 1px solid var(--border-2); }
.prose h3 { font-size: 15px; margin: 22px 0 8px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose code { font-family: var(--mono); font-size: 12.5px; background: var(--off-bg); border-radius: 4px; padding: 1px 5px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 12px; }
.prose li { margin: 4px 0; }
.prose table { width: 100%; margin: 8px 0 16px; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
               font-size: 13.5px; }
.prose th { text-align: left; background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 600;
            padding: 8px 12px; border-bottom: 1px solid var(--border); }
.prose td { padding: 8px 12px; border-bottom: 1px solid var(--border-2); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }

/* ---- sign-in and stand-alone messages --------------------------------------------------------------------------- */

.auth { flex: 1; display: grid; place-items: center; padding: 40px 0; }
.solo .foot { text-align: center; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; margin: 0; box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 22px; }
.auth-card .subtitle { margin-bottom: 24px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card input { height: 38px; }
.auth-card button { width: 100%; height: 40px; margin-top: 8px; }
.auth-card .legal { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-2); font-size: 12.5px;
                    color: var(--text-3); text-align: center; }
.code-input { letter-spacing: .3em; font-size: 18px !important; text-align: center; font-variant-numeric: tabular-nums; }
.message-card { max-width: 520px; margin: 48px auto 0; padding: 32px; text-align: center; }
.message-card .big-ico { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
                         background: var(--off-bg); color: var(--text-3); }
.message-card .big-ico.bad { background: var(--bad-bg); color: var(--bad-fg); }
.message-card .big-ico.warn { background: var(--warn-bg); color: var(--warn-fg); }
.message-card h1 { font-size: 19px; margin-bottom: 6px; }
.message-card p { color: var(--text-3); }
.message-card .btn { margin-top: 8px; }

@media (max-width: 1100px) {
  .workspace, .workspace.form-wide, .cols, .cols.wide-left { grid-template-columns: minmax(0, 1fr); }
  .viewer { position: static; height: 75vh; }
  .jump input { width: 150px; }
  .who .role { display: none; }
}
@media (max-width: 820px) {
  .topbar { position: static; height: auto; min-height: var(--topbar); flex-wrap: wrap; padding: 8px 12px; gap: 8px 12px; }
  .topbar .sep { display: none; }
  .org { flex: 1 1 0; }
  .topbar .right { margin-left: 0; width: 100%; gap: 10px; }
  .jump { flex: 1; min-width: 0; }
  .jump input { width: 100%; }
  .who .name { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  main { padding: 16px; min-height: 0; }
  .title-row .actions { margin-left: 0; }
  .field, .field.c3, .field.c4, .field.c5, .field.c7, .field.c8, .field.c9 { grid-column: 1 / -1; }
  .dl.two, .dl.three, .dl.four { grid-template-columns: minmax(0, 1fr); }
  .dl .span2 { grid-column: auto; }
  .table-wrap, .lines-wrap { max-width: 100%; }
  .lines-wrap { overflow-x: auto; }
  .lines { min-width: 640px; }
  .paper { padding: 24px; }
  .prose { padding: 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-head .end { margin-left: 0; }
  .toolbar .grow { min-width: 0; }
}

/* ---- Helpdesk -------------------------------------------------------------------------------------------------- */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: var(--gap); border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-3);
          font-weight: 550; font-size: 13.5px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--accent-text); border-bottom-color: var(--accent); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 12px 16px; border-bottom: 1px solid var(--border-2); }
.timeline li:last-child { border-bottom: 0; }
.timeline .who { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--text-3);
                 margin-bottom: 4px; }
.timeline .who b { color: var(--text-2); font-weight: 600; }
.timeline .body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.timeline li.note { background: #fffdf5; }
.timeline li.requester { background: var(--surface); }
.timeline li.out { background: var(--surface-2); }
.ticket-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.hrform { font-size: 13.5px; }
.hrform .hdr { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 12px 16px;
               border-bottom: 2px solid var(--text-2); background: var(--surface-2); }
.hrform .hdr b { font-size: 15px; letter-spacing: .02em; }
.hrform table { width: 100%; border-collapse: collapse; }
.hrform th { width: 38%; text-align: left; font-weight: 500; color: var(--text-3); padding: 7px 16px;
             border-bottom: 1px solid var(--border-2); vertical-align: top; }
.hrform td { padding: 7px 16px; border-bottom: 1px solid var(--border-2); white-space: pre-wrap; }
.task { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border-2); }
.task:last-child { border-bottom: 0; }
.task .t { flex: 1; }
.task.done .t { color: var(--text-3); text-decoration: line-through; }
.task .by { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form select, .inline-form input { height: 28px; font-size: 13px; padding: 0 8px; }
.inline-form select { padding-right: 26px; background-position: right 6px center; }
.meter { width: 90px; height: 6px; border-radius: 999px; background: var(--off-bg); overflow: hidden;
         display: inline-block; vertical-align: middle; margin-right: 8px; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.meter.full > span { background: var(--warn-fg); }
