/* Ablagepilot portal – own palette (brand/README.md): deep blue #0E3354, sky blue #2E9BE0, buttons #1767A8. */
:root {
  --navy: #0E3354;      /* Ablagepilot deep blue: headings, sidebar */
  --amber: #2E9BE0;     /* legacy name from the shared foundation: Ablagepilot's accent is sky blue, never amber */
  --primary: #1767A8;   /* buttons and links: sky blue dark enough for white text */
  --text: #1a2a3c;
  --muted: #566578;
  --line: #d6e1ec;
  --bg: #edf3f9;
  --card: #ffffff;
  --error-bg: #fdecec;
  --error: #8a1c1c;
  --ok-bg: #e8f5ec;
  --ok: #1d5e33;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px;
  background: var(--card); border-bottom: 3px solid var(--amber); }
.logo { height: 36px; }
.whoami { display: flex; align-items: center; gap: 12px; color: var(--muted); }
main { max-width: 1280px; margin: 24px auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 24px; max-width: 440px; margin: 0 auto 24px; }
.card.wide { max-width: none; }
h1 { font-size: 1.4rem; margin: 0 0 16px; color: var(--navy); }
h2 { font-size: 1.15rem; margin: 24px 0 12px; color: var(--navy); }
h2:first-child { margin-top: 0; }
h3 { font-size: 1rem; margin: 20px 0 8px; }
label { display: block; margin: 0 0 12px; font-weight: 500; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; margin: 0; }
button, .button { display: inline-block; padding: 9px 18px; font: inherit; font-weight: 600; color: #fff; background: var(--navy);
  border: 1px solid var(--navy); border-radius: 6px; cursor: pointer; text-decoration: none; text-align: center; }
.button.secondary { color: var(--navy); background: #fff; width: 100%; }
button.link { padding: 0; color: var(--navy); background: none; border: none; font-weight: 500; text-decoration: underline; }
.restart { margin-top: 12px; }
/* passwordless sign-in (ADR 0009) */
.wide-button { width: 100%; padding: 12px 18px; font-size: 1.05rem; }
.notice-box { margin: 12px 0; padding: 10px 12px; border-radius: 6px; background: #e8f3fc; border: 1px solid var(--amber); color: var(--text); font-size: 0.92rem; }
.hint-card { max-width: 720px; background: #f3f9fe; border-color: #b9dcf4; }
.hint-card h2 { margin-top: 0; }
.hint-card .actions { align-items: center; gap: 16px; }
.or { text-align: center; color: var(--muted); margin: 16px 0 8px; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 12px 0 0; }
.small { display: block; font-size: 0.9rem; margin-top: 4px; color: var(--navy); }
.secret { display: block; margin: 8px 0 4px; padding: 10px; font-size: 1.05rem; letter-spacing: 0.06em; background: var(--bg);
  border: 1px dashed var(--line); border-radius: 6px; overflow-wrap: anywhere; }
ol { padding-left: 20px; }
ol li { margin-bottom: 10px; }
.message { max-width: 720px; margin: 0 auto 16px; padding: 12px 14px; border-radius: 6px; background: var(--error-bg); color: var(--error); }
.message.ok { background: var(--ok-bg); color: var(--ok); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td:last-child { white-space: nowrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; align-items: end; }
.grid button { margin-bottom: 12px; }
@media (max-width: 640px) {
  .top { padding: 10px 16px; }
  .card { padding: 18px; }
  table { display: block; overflow-x: auto; }
}

/* ── navigation and layout ── */
.nav { display: flex; gap: 0; flex: 1; margin-left: 12px; flex-wrap: wrap; }
.nav a { padding: 8px 9px; border-radius: 6px; color: var(--navy); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--navy); color: #fff; }
.wide-view { max-width: none; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar h1 { margin: 0 12px 0 0; }
.spacer { flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
label.inline { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; }
label.inline input { width: auto; margin: 0; }
.small-button { padding: 6px 12px; }
button.secondary { color: var(--navy); background: #fff; }
button:disabled { opacity: 0.5; cursor: default; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 0 24px; align-items: start; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
fieldset.info { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px 0; margin: 0 0 12px; }
fieldset.info legend { font-weight: 600; color: var(--navy); padding: 0 6px; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
body:not(.planner) .plan-only { display: none; }
body:not(.lead) .lead-only { display: none !important; }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.clickable:focus { background: var(--bg); outline: none; }

/* ── status ── */
.status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.85rem; font-weight: 600; background: var(--bg); color: var(--navy);
  border: 1px solid var(--line); white-space: nowrap; }


@media (max-width: 900px) {
  .nav { margin-left: 0; order: 3; width: 100%; }
  .top { flex-wrap: wrap; }
  .grid2 { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
}
.toolbar input { width: auto; margin: 0; }
.status-quarantined, .status-rejected, .status-failed { background: var(--error-bg); color: var(--error); border-color: #f2c4c4; }
.status-processed, .status-released, .status-sent { background: var(--ok-bg); color: var(--ok); border-color: #b7dfc3; }
.status-incomplete { background: #fff5d6; color: #6b4b00; border-color: #f0d68a; }
.row-actions { display: flex; gap: 10px; }
a { color: var(--navy); }
td a { white-space: nowrap; }
.upload { padding: 12px 14px; border: 1px dashed var(--line); border-radius: 6px; background: var(--bg); }
.upload label { margin: 0; }

/* notice banner */
.alarm-banner { display: block; max-width: 1200px; margin: 0 auto 16px; padding: 12px 16px; border-radius: 6px; background: var(--error); color: #fff;
  font-weight: 600; text-decoration: none; }
.alarm-banner:hover, .alarm-banner:focus { text-decoration: underline; }
.status-blocked { background: var(--error-bg); color: var(--error); border-color: #f2c4c4; }
.status-active { background: var(--ok-bg); color: var(--ok); border-color: #b7dfc3; }
.enrol-box { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line, #d0d7de); border-radius: 6px; }
.enrol-code { font: 600 1.6rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; margin: 8px 0; }

/* lists and inline forms */
.plain-list { list-style: none; padding: 0; margin: 0 0 12px; }
.plain-list li { padding: 4px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; }
.inline-form label { flex: 1; }
.span2 { grid-column: 1 / -1; }
textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
td input[type=date] { width: auto; }
.grid2 > .card { margin-left: 0; margin-right: 0; }

/* step-up dialog, account */
#who { color: inherit; display: inline-block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
dialog#stepup, dialog#pwreset { border: 1px solid var(--line); border-radius: 8px; padding: 24px; max-width: 420px; width: calc(100% - 32px); }
dialog#stepup::backdrop, dialog#pwreset::backdrop { background: rgba(20, 33, 61, 0.45); }
dialog#stepup h2, dialog#pwreset h2 { margin-top: 0; }
dialog#stepup .message { margin: 8px 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--line); color: var(--navy); }
.badge.danger { background: var(--error-bg); color: var(--error); }
.qr { width: 220px; max-width: 100%; margin: 12px 0; }
.qr svg { display: block; width: 100%; height: auto; }
details.small { margin: 8px 0; }
details.small summary { cursor: pointer; color: var(--muted); }
button.btn-s { padding: 4px 10px; font-size: 0.9em; margin: 2px 4px 2px 0; }
@media print {
  .top, #nav, .no-print, .toolbar button, .period, #message { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}
table.kv th { width: 180px; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
h2.inline { display: inline; }

/* ── documents (0.2.0): lists, inbox, records, upload; phone first ── */
:root { --sky: #2E9BE0; }
.doclist { list-style: none; padding: 0; margin: 0; }
.docitem { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.docitem:hover, .docitem:focus { background: var(--bg); outline: none; }
.docitem .meta { color: var(--muted); font-size: 0.88rem; }
.docitem.confidential { border-left: 4px solid var(--error); }
.docitem .badge { align-self: flex-start; }
.snippet { font-size: 0.88rem; color: var(--text); background: #fff8e6; padding: 4px 6px; border-radius: 4px; }
.meta { color: var(--muted); font-size: 0.9rem; }
.inbox-layout { display: grid; grid-template-columns: minmax(280px, 2fr) 3fr; gap: 0 20px; align-items: start; }
.inbox-layout > .card { margin: 0 0 20px; }
.detail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.detail-head h2 { margin: 0; overflow-wrap: anywhere; }
.reasons { margin: 8px 0 16px; padding-left: 18px; color: var(--muted); font-size: 0.9rem; }
.stack label { margin-bottom: 10px; }
.fieldgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 12px; }
.textbox pre { white-space: pre-wrap; max-height: 320px; overflow: auto; font-size: 0.82rem; background: var(--bg); padding: 10px; border-radius: 6px; }
.boxed { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin: 0 0 12px; }
details.boxed summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 8px; }
.tab { padding: 6px 12px; background: #fff; color: var(--navy); border: 1px solid var(--line); font-weight: 500; }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tablewrap { overflow-x: auto; }
.tablewrap select, .tablewrap input, .tablewrap textarea { min-width: 120px; margin-top: 0; }
button.danger, .link.danger { color: var(--error); }
.inline-form input { width: auto; flex: 1; margin: 0; }
.upload-card { max-width: 560px; text-align: center; }
.upload-buttons { display: grid; gap: 14px; margin: 20px 0; }
.bigbutton { display: block; margin: 0; padding: 22px 16px; font-size: 1.2rem; font-weight: 700; color: #fff; background: var(--navy);
  border-radius: 12px; cursor: pointer; user-select: none; }
.bigbutton.secondary { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.bigbutton:active { transform: scale(0.98); }
.upload-list { list-style: none; padding: 0; text-align: left; }
.upload-list li { padding: 10px 12px; margin: 6px 0; border-radius: 6px; background: var(--bg); overflow-wrap: anywhere; }
.upload-list li.ok { background: var(--ok-bg); color: var(--ok); }
.upload-list li.err { background: var(--error-bg); color: var(--error); }
@media (max-width: 900px) {
  .inbox-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { margin: 12px auto; padding: 0 10px calc(16px + env(safe-area-inset-bottom)); }
  .top { padding: 8px 12px calc(8px) 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .logo { height: 28px; }
  .nav a { padding: 10px 10px; font-size: 1rem; }
  .whoami { font-size: 0.85rem; }
  #who { max-width: 120px; }
  input, select, textarea, button { font-size: 16px; }        /* no zoom on focus (iOS) */
  button, .button { padding: 12px 18px; }
  .toolbar input, .toolbar select { width: 100%; }
  .fieldgrid { grid-template-columns: 1fr; }
  .actions button { flex: 1; }
  .card { border-radius: 10px; }
  .docitem { padding: 14px 8px; }
}
@media (max-width: 360px) {
  .bigbutton { padding: 18px 10px; font-size: 1.05rem; }
}
.alarm-banner.info { background: #e8f3fc; color: var(--text); border: 1px solid var(--amber); font-weight: 500; }

/* incoming invoices */
fieldset.invs-datev, fieldset.invs-lexware, fieldset.tasks { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px 4px; margin: 0 0 12px; }
fieldset.invs-datev legend, fieldset.invs-lexware legend, fieldset.tasks legend { font-weight: 600; color: var(--navy); padding: 0 6px; }
fieldset.tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 12px; }
.problems { color: var(--error); }
.uncertain-note { margin: -8px 0 16px; padding: 8px 12px; border-left: 3px solid #d08a00; background: #fff7e6; font-size: 0.9rem; }
input.uncertain { border-color: #d08a00; background: #fff7e6; }
.pair { display: flex; gap: 8px; }
.pair input { flex: 1; }
.docitem .amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.docitem input[type=checkbox] { width: auto; margin: 0 8px 0 0; }


/* ── Ablagepilot shell (0.4.1): sidebar instead of the top bar of the shared foundation ── */
button, .button { background: var(--primary); border-color: var(--primary); border-radius: 8px; }
button.secondary, .button.secondary { color: var(--primary); background: #fff; border-color: #b9cfe4; }
button.link, a { color: var(--primary); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.card { border-radius: 12px; border-color: #dce6f0; box-shadow: 0 1px 2px rgba(14, 51, 84, .06); }
.tab.active { background: var(--primary); border-color: var(--primary); }
.notice-box { background: #e8f3fc; border-color: #9fcdef; }
.logo-neg { display: none; }

body.signed { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
body.signed .top { position: sticky; top: 0; height: 100vh; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 18px;
  padding: 20px 14px; background: var(--navy); border-bottom: 0; color: #dbe7f3; overflow-y: auto; }
body.signed .logo { display: none; }
body.signed .logo-neg { display: block; height: 34px; margin: 0 6px 6px; }
body.signed main { margin: 0; padding: 28px 32px 48px; max-width: 1360px; width: 100%; }
.nav-group { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #8fb3d6; margin: 14px 10px 4px; }
body.signed .nav { flex-direction: column; flex-wrap: nowrap; margin: 0; gap: 2px; flex: 1; }
body.signed .nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #dbe7f3; font-weight: 500; }
body.signed .nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
body.signed .nav a:hover { background: rgba(255, 255, 255, .08); }
body.signed .nav a.active { background: rgba(46, 155, 224, .22); color: #fff; box-shadow: inset 3px 0 0 var(--sky); }
body.signed .nav a.sub { padding: 5px 10px 5px 38px; font-size: .9rem; color: #b8cde2; }
body.signed .nav a.sub.active { box-shadow: none; background: none; color: #fff; font-weight: 600; }
body.signed .whoami { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, .12); color: #b8cde2; }
body.signed .whoami a, body.signed .whoami button.link { color: #fff; text-align: left; }
body.signed #who { max-width: none; }
@media (max-width: 900px) {
  body.signed { display: block; }
  body.signed .top { position: sticky; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; z-index: 5; }
  body.signed .logo-neg { height: 28px; margin: 0; }
  body.signed .nav { flex-direction: row; order: 3; flex: 1 0 100%; overflow-x: auto; gap: 4px; }
  body.signed .whoami { font-size: .85rem; }
  body.signed .nav a { white-space: nowrap; padding: 6px 10px; }
  .nav-group { display: none; }
  body.signed .nav a.sub { padding: 6px 10px; font-size: .85rem; }
  body.signed .whoami { flex-direction: row; border: 0; padding: 0; margin-left: auto; }
  body.signed main { padding: 18px 16px 40px; }
}
.off-page { display: none !important; }

/* ── start page (0.4.2) ── */
.dash-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.dash-head h1 { margin: 0; font-size: 1.6rem; }
.dash-title { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.dash-tile { display: grid; gap: 2px; align-content: start; padding: 16px 18px; background: var(--card); border: 1px solid #dce6f0; border-radius: 12px;
  text-decoration: none; color: var(--text); box-shadow: 0 1px 2px rgba(14, 51, 84, .06); }
.dash-tile:hover { border-color: var(--sky); }
.dash-tile.open { box-shadow: inset 0 3px 0 var(--sky), 0 1px 2px rgba(14, 51, 84, .06); }
.dash-count { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-tile.open .dash-count { color: var(--navy); }
.dash-label { font-weight: 600; }
.dash-sum { font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }
.dash-hint { font-size: .82rem; color: var(--muted); }
.dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; margin-top: 24px; align-items: start; }
.dash-cols .card { margin: 0; }
@media (max-width: 640px) { .dash-cols { grid-template-columns: 1fr; } }
/* the cover-sheet button in a record is a normal button, not a full-width bar */
#record-cover.button.secondary { width: auto; }
.inbox-layout.single { grid-template-columns: minmax(0, 1fr); max-width: 980px; }

/* irreversible actions (deletion after the retention period) */
button.danger-fill { background: var(--error); border-color: var(--error); color: #fff; }
button.danger-fill:hover { filter: brightness(0.92); }
.secondary.danger { color: var(--error); border-color: var(--error); }

/* 0.7.0: further records, bulk changes, folders (ADR 0019) */
fieldset.links-box { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 12px; margin: 4px 0 8px; }
fieldset.links-box legend { font-weight: 600; padding: 0 4px; }
.linklist { list-style: none; margin: 8px 0; padding: 0; }
.linklist li { display: flex; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.linklist li span { flex: 1 1 200px; }
.linklist li select { width: auto; flex: 0 1 180px; margin: 0; }
div.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
div.inline input, div.inline select { width: auto; flex: 1 1 160px; margin: 0; }
.bulkbar { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; padding: 10px 12px;
  background: #e8f3fc; border: 1px solid var(--line); border-radius: 6px; }
.bulkbar select, .bulkbar input[type=search] { width: auto; flex: 1 1 150px; margin: 0; }
.doclist.selectable li.docitem { position: relative; padding-left: 40px; }
.doclist.selectable li.docitem input.pick { position: absolute; left: 12px; top: 14px; width: 18px; height: 18px; margin: 0; }
.doclist li.docitem.picked { background: #eef6fd; }
tfoot td { font-weight: 600; }

/* 0.8.0: deadlines, notes, tasks (ADR 0020) */
.desk { margin: 16px 0 8px; display: flex; flex-direction: column; gap: 8px; }
details.desk-part { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
details.desk-part > summary { cursor: pointer; font-weight: 600; }
details.desk-part[open] > summary { margin-bottom: 8px; }
.desk .plain-list li { flex-wrap: wrap; }
.desk .plain-list li > span:first-child { flex: 1 1 260px; }
ul.notes li { flex-direction: column; align-items: flex-start; gap: 2px; }
td.danger, span.danger, .meta.danger { color: var(--error); }
.small { font-size: 0.85rem; }
.detail-head a.button { flex: 0 0 auto; width: auto; }
ul.notes li > span:first-child { flex: none; }
.link + .link { margin-left: 12px; }
div.inline label.check { flex: 1 1 auto; margin: 0; }
.actions label.button { display: inline-block; width: auto; cursor: pointer; }
.badge:empty { display: none; }
.detail-head label.button { flex: 0 0 auto; width: auto; display: inline-block; cursor: pointer; }
