/*
 * Tang Accounting – Client Portal.
 * Layout: a menu on the left, a bar with title and user on top, content in rounded cards.
 * Colours: the Tang orange as the accent, near-black for text, soft warm greys around it.
 */
:root {
  --primary: #eb6037;        /* Tang orange */
  --primary-dark: #c94a25;
  --primary-soft: #fdeee8;
  --primary-line: #f6cdbf;
  --blue: #2a64a8;           /* a lighter step of the Tang blue (#1e4b8c), used for "processed" in charts */
  --blue-soft: #e8f0f9;
  --ink: #1f1f23;
  --text: #33343a;
  --muted: #7b7c84;
  --line: #ebe9e4;
  --line-strong: #d9d6cf;
  --bg: #f6f5f2;
  --card: #ffffff;
  --ok: #17794c;
  --ok-bg: #e5f5ec;
  --ok-line: #bfe3cf;
  --err: #b3261e;
  --err-bg: #fdecea;
  --info-bg: #eef3fb;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(24, 24, 28, .04);
  --side: 264px;
  --sans: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
}

h1, h2, h3, legend { font-family: var(--sans); color: var(--ink); line-height: 1.25; margin: 0 0 .6rem; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.05rem; margin-top: 1.75rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; }
a { color: var(--primary-dark); }
a:hover { color: var(--primary); }
svg.ic { flex: none; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { color: var(--muted); max-width: 46rem; }
.nowrap { white-space: nowrap; }
.count {
  display: inline-block;
  font: 600 .75rem/1 var(--sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: .28rem .55rem;
  vertical-align: middle;
}

/* ------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }

.side {
  position: sticky;
  top: 0;
  flex: none;
  width: var(--side);
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: 1.1rem .9rem 1rem;
  background: var(--card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: .2rem .4rem .9rem; color: var(--ink); text-decoration: none; font-weight: 650; }
.brand img { height: 40px; width: auto; max-width: 120px; object-fit: contain; font-size: .75rem; }
.brand span { font-size: 1rem; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { color: var(--ink); }

.side-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .4rem;
  padding: 0 .75rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.side-search:focus-within { border-color: var(--primary); background: #fff; }
.side-search input[type=search] { flex: 1; min-width: 0; margin: 0; padding: .6rem 0; font: inherit; color: var(--ink); background: none; border: 0; outline: 0; }
/* Search box above a table (clients) */
.tablefilter { display: flex; align-items: center; gap: .5rem; flex: 1 1 16rem; max-width: 24rem; margin: 0 auto 0 1rem; padding: 0 .75rem; color: var(--muted); background: var(--bg); border: 1px solid var(--line, #e5e2dc); border-radius: var(--radius-sm); }
.tablefilter:focus-within { border-color: var(--primary); background: #fff; }
.tablefilter input[type=search] { flex: 1; min-width: 0; margin: 0; padding: .5rem 0; font: inherit; color: var(--ink); background: none; border: 0; outline: 0; box-shadow: none; }
.filter-none { padding: 1rem 1.5rem; margin: 0; }
@media (max-width: 1279px) { .tablefilter { margin: 0; max-width: none; order: 3; flex-basis: 100%; } }

.side-label { margin: .9rem .55rem .35rem; font-size: .7rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav form { margin: 0; }
.nav a, .nav button {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .58rem .7rem;
  font: inherit;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav a > span:first-of-type, .nav button > span { flex: 1; min-width: 0; }
.nav a svg, .nav button svg { color: var(--muted); }
.nav a:hover, .nav button:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--bg); color: var(--ink); font-weight: 650; }
.nav a.on svg { color: var(--primary); }
.pill {
  min-width: 1.5rem;
  padding: .1rem .45rem;
  font-size: .72rem;
  font-weight: 650;
  line-height: 1.5;
  text-align: center;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.nav a.on .pill { color: #fff; background: var(--primary); border-color: var(--primary); }

.side-card { margin-top: auto; padding: .95rem; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; }
.side-card strong { display: block; color: var(--ink); }
.side-card p { margin: .2rem 0 .7rem; font-size: .82rem; line-height: 1.4; color: var(--muted); }
.side-card .btn { display: inline-flex; align-items: center; gap: .4rem; }
.side-card .btn svg { width: 16px; height: 16px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.75rem .4rem;
}
.titles { flex: 1; min-width: 0; }
.titles h1 { margin: 0; overflow-wrap: anywhere; }
.titles p { margin: .15rem 0 0; font-size: .88rem; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: .7rem; }
.menu-btn { display: none; padding: .55rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }

.langs { display: inline-flex; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; }
.langs a { padding: .3rem .6rem; font-size: .75rem; font-weight: 650; color: var(--muted); text-decoration: none; border-radius: 99px; }
.langs a.on { color: #fff; background: var(--ink); }
.langs a:not(.on):hover { color: var(--ink); }

.userchip {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .35rem .9rem .35rem .4rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 99px;
}
.userchip:hover { border-color: var(--line-strong); color: var(--ink); }
.avatar { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; font-size: .78rem; font-weight: 700; color: #fff; background: var(--primary); border-radius: 50%; }
.avatar.role-admin { background: var(--ink); }
.avatar.role-staff { background: var(--blue); }
.who { display: grid; line-height: 1.2; }
.who strong { font-size: .88rem; font-weight: 650; }
.who small { font-size: .74rem; color: var(--muted); }

.wrap { width: 100%; max-width: 1280px; padding: 1rem 1.75rem 2.5rem; flex: 1; }
.wrap:has(.chat) { padding-bottom: 5.5rem; }
.foot { padding: 0 1.75rem 1.25rem; color: var(--muted); font-size: .8rem; }

/* Pages without a menu: log-in, first setup, choosing a password */
body.bare { display: flex; flex-direction: column; }
.bare-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; }
.bare-top .brand { padding: 0; }
body.bare .wrap { max-width: none; margin: 0 auto; padding-top: .5rem; }
body.bare .foot { text-align: center; }
body.bare h1 { font-size: 1.6rem; }

.crumb { font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
.headrow { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.wrap > .headrow:first-child { margin-top: 0; }
.headrow h1, .headrow h2 { margin: 0; }

/* ------------------------------------------------------------ cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
  margin: 1rem 0 1.25rem;
}
.card > :last-child { margin-bottom: 0; }
.card.narrow { max-width: 30rem; }
/* Privacy statement and terms of use: a readable column of text. */
.card.legal { max-width: 46rem; line-height: 1.6; }
body.bare .card.legal { margin: 1.5rem auto; padding: 2rem; }
.card.legal h2 { font-size: 1.1rem; margin: 1.6rem 0 .4rem; }
.card.legal ul { padding-left: 1.25rem; }
.card.legal li { margin: .25rem 0; }
.foot-links { margin-left: .75rem; }
.foot-links a { color: inherit; }
/* "My account": wide enough for a label with a long value next to it (sender address, status texts). */
.card.mid { max-width: 46rem; }
body.bare .card.narrow { max-width: 26rem; margin: 1.5rem auto; padding: 1.75rem; }
.card.invite { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.card.invite h2 { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem .75rem; margin-bottom: 1rem; }
.card-head h2 { margin: 0; font-size: 1rem; }
.card-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }

/* Dashboard grid */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.dash > .card { margin: 0; }
.span-4 { grid-column: span 4; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.dash + h2 { margin-top: 2rem; }

.stat { display: flex; flex-direction: column; }
.stat-label { margin: 0 0 .1rem; font-size: .82rem; color: var(--muted); }
.stat-note { font-size: .88rem; color: var(--muted); }
/* The one headline figure of a page; the other figures are a size smaller. Same sans as everything else. */
.hero { margin: 0 0 .9rem; font-size: 3.4rem; font-weight: 600; line-height: 1.05; letter-spacing: -.03em; color: var(--ink); }
.big { margin: 0 0 .8rem; font-size: 2.1rem; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; color: var(--ink); }
.big small { font-size: 1.1rem; font-weight: 500; color: var(--muted); margin-left: .1rem; }
.taskcard { display: flex; align-items: center; justify-content: space-between; gap: .6rem 1.2rem; flex-wrap: wrap; border-left: 4px solid var(--primary); }
.taskcard p { margin: .25rem 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: auto; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .7rem;
  font-size: .8rem;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 99px;
}
.chip svg { width: 15px; height: 15px; color: var(--muted); }
.chip b { font-weight: 650; color: var(--ink); }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-top: auto; padding-top: .9rem; border-top: 1px solid var(--line); }
.cols3 > * { display: grid; gap: .1rem; padding-left: .7rem; border-left: 3px solid var(--line-strong); color: var(--text); text-decoration: none; }
.cols3 > :first-child { border-left-color: var(--primary); }
.cols3 span { font-size: .76rem; color: var(--muted); line-height: 1.3; }
.cols3 strong { font-size: 1.1rem; font-weight: 650; color: var(--ink); }
.cols3 a:hover strong { color: var(--primary-dark); }

/* Meters: the unfilled part is a lighter step of the same colour */
.ticks { display: block; width: 100%; height: 40px; margin-top: auto; }
.ticks .on { fill: var(--primary); }
.ticks .off { fill: var(--primary-line); }
.meters { display: grid; gap: .85rem; margin-top: 1rem; }
.meter-top { display: flex; justify-content: space-between; gap: .75rem; margin-bottom: .3rem; font-size: .85rem; }
.meter-top a { color: var(--text); text-decoration: none; font-weight: 500; }
.meter-top a:hover { color: var(--primary-dark); }
.meter progress, .progress progress {
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 99px;
  background: var(--blue-soft);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.meter progress::-webkit-progress-bar { background: var(--blue-soft); border-radius: 99px; }
.meter progress::-webkit-progress-value { background: var(--blue); border-radius: 99px; }
.meter progress::-moz-progress-bar { background: var(--blue); border-radius: 99px; }

/* Column chart */
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin: -.4rem 0 .5rem; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.done { background: var(--blue); }
.sw.new { background: var(--primary); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 500 11px var(--sans); }
.chart .axis.year { font-size: 10px; }
.chart .seg.done { fill: var(--blue); }
.chart .seg.new { fill: var(--primary); }
.chart .hit { fill: transparent; }
.chart .col { outline: none; cursor: default; }
.chart .col:hover .hit, .chart .col:focus .hit { fill: rgba(31, 31, 35, .05); }
.chart-tip {
  position: absolute;
  z-index: 5;
  min-width: 9rem;
  padding: .55rem .75rem;
  font-size: .8rem;
  line-height: 1.5;
  color: #fff;
  white-space: pre-line;
  background: var(--ink);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .2);
  pointer-events: none;
  transform: translate(-50%, -100%);
}
.chart-tip::first-line { font-weight: 650; }
.chart-empty { margin: 1.5rem 0; }
.chart-table { margin-top: .6rem; font-size: .85rem; }
.chart-table summary { color: var(--muted); cursor: pointer; }
.chart-table summary:hover { color: var(--ink); }
.chart-table .tablewrap { margin-top: .6rem; }

/* ------------------------------------------------------------ forms */
form label { display: block; font-weight: 600; font-size: .86rem; color: var(--ink); margin-bottom: 1rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=month], select, textarea {
  display: block;
  width: 100%;
  margin-top: .35rem;
  padding: .62rem .8rem;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, .nav button:focus-visible, .menu-btn:focus-visible {
  outline: 3px solid rgba(235, 96, 55, .3);
  outline-offset: 1px;
  border-color: var(--primary);
}
.side-search input:focus { outline: 0; }
textarea { resize: vertical; }
label.bad input, label.bad textarea { border-color: var(--err); }
.hint, .fielderr { display: block; font-weight: 400; font-size: .78rem; margin-top: .25rem; color: var(--muted); }
.fielderr { color: var(--err); font-weight: 600; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
fieldset + fieldset { padding-top: 1.25rem; border-top: 1px solid var(--line); }
legend { font-size: 1rem; padding: 0; margin-bottom: .9rem; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
/* Fields with explanations of different lengths under them: line up the fields, not the last line of text. */
.grid.three.top { align-items: start; }
.grid .wide { grid-column: 1 / -1; }
.checks { display: grid; gap: .2rem; margin-bottom: 1rem; }
.checks.columns { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.listtools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; max-width: 40rem; margin-bottom: .75rem; }
.listtools .listfilter { flex: 1 1 14rem; width: auto; margin: 0; padding: .55rem .8rem; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
/* One below the other, in alphabetical order, with a thin line between the rows. */
.checks.list { gap: 0; max-width: 40rem; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.checks.list label.check { border-radius: 0; padding: .6rem .8rem; }
.checks.list label.check + label.check { border-top: 1px solid var(--line); }
form label.check {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: 0;
  padding: .45rem .6rem;
  font-weight: 400;
  font-size: .93rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
form label.check:hover { background: var(--bg); }
label.check input { width: 1.05rem; height: 1.05rem; margin: .2rem 0 0; flex: none; accent-color: var(--primary); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1rem; }
.actions.inline { margin-bottom: 1rem; }
.field { margin-bottom: 1rem; }
.fieldlabel { display: block; font-weight: 600; font-size: .86rem; color: var(--ink); }
.pair { display: grid; grid-template-columns: 3fr 2fr; gap: .5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .62rem 1.15rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--bg); border-color: var(--ink); color: var(--ink); }
.btn.danger { background: #fff; color: var(--err); border-color: #ecc5c1; }
.btn.danger:hover { background: var(--err-bg); border-color: var(--err); color: var(--err); }
/* A button keeps its label on one line; only on a phone may a long label of a big button wrap. */
.btn { white-space: nowrap; }
@media (max-width: 600px) {
  .btn:not(.small) { white-space: normal; text-align: center; }
}
/* Dates, amounts and invoice numbers stay in one piece (no break at the "-" of 30-11-2026). */
.date, .nobreak { white-space: nowrap; }
.btn.small { padding: .38rem .75rem; font-size: .8rem; border-radius: 10px; }
.btn.small svg { width: 15px; height: 15px; }
.btn[disabled], .btn.busy { opacity: .6; cursor: progress; }

/* Upload box */
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: 1.75rem 1rem;
  margin-bottom: 1rem;
  text-align: center;
  background: var(--bg);
  border: 2px dashed var(--line-strong);
  border-radius: 16px;
}
.drop strong { font-size: 1rem; color: var(--ink); }
.drop small { color: var(--muted); margin-top: .5rem; }
.drop .or { color: var(--muted); font-size: .85rem; }
.drop.over { border-color: var(--primary); background: var(--primary-soft); }
.pickers { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: .35rem; }
form label.filebtn { margin: 0; font-size: .9rem; position: relative; color: var(--ink); }
.filebtn input { display: block; margin-top: .4rem; max-width: 100%; font: inherit; font-size: .85rem; }
/* With the upload script active the buttons open the picker and the raw inputs are hidden. */
.upload.js .filebtn input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; overflow: hidden; }
.upload.js .filebtn:focus-within { outline: 3px solid rgba(235, 96, 55, .3); outline-offset: 1px; border-color: var(--primary); }
.upload:not(.js) .or { display: none; }

.picked { margin: 0 0 1rem; padding: .8rem 1rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .88rem; }
.picked-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.picked-list { margin: .5rem 0 0; padding-left: 1.25rem; overflow-wrap: anywhere; }
.picked-list .more { list-style: none; margin-left: -1.25rem; color: var(--muted); }

.progress { margin: 0 0 1rem; }
.progress progress { height: 10px; background: var(--primary-line); }
.progress progress::-webkit-progress-bar { background: var(--primary-line); border-radius: 99px; }
.progress progress::-webkit-progress-value { background: var(--primary); border-radius: 99px; }
.progress progress::-moz-progress-bar { background: var(--primary); border-radius: 99px; }
.progress-text { display: block; margin-top: .35rem; font-size: .88rem; color: var(--muted); }

/* Submitted files: a tab per year, then one tile per month */
.years { display: flex; flex-wrap: wrap; gap: .35rem; margin: 1rem 0 0; }
.yeartab {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: .45rem .9rem;
  color: var(--muted);
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 99px;
}
.yeartab strong { font-size: .95rem; font-weight: 650; color: var(--ink); }
.yeartab span { font-size: .78rem; }
.yeartab:hover { border-color: var(--line-strong); color: var(--muted); }
.yeartab.on { background: var(--ink); border-color: var(--ink); color: #d5d5da; }
.yeartab.on strong { color: #fff; }
.yeartab .dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--primary); align-self: center; }
.months { margin: .8rem 0 0; }
.monthgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .6rem; }
.month {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .2rem;
  padding: .8rem .9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
}
.month:hover { border-color: var(--primary); color: var(--text); }
.month.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.month strong { font-size: .98rem; font-weight: 650; color: var(--ink); }
.month .n { font-size: .82rem; color: var(--muted); }
.month .badge { margin-top: .2rem; }
.month.all { background: var(--bg); }
.month.all.on { background: var(--card); }

.search { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; }
.search input[type=text] { flex: 1 1 16rem; width: auto; margin: 0; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; }
.pager { flex-wrap: wrap; gap: .5rem; }
.pager .pagenums { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.pager .pagenums .btn { min-width: 2.3rem; justify-content: center; }
.listbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin: .75rem 0 .5rem; }
.listbar .perpage { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.listbar .perpage .btn { min-width: 2.6rem; justify-content: center; }
.folder::before { content: "\1F4C1\00A0"; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.search.clientpick { align-items: center; margin-bottom: 1rem; }
.search.clientpick label { margin: 0; font-weight: 600; }
.search.clientpick input[type=text] { flex: 1 1 18rem; max-width: 32rem; }

/* ------------------------------------------------------------ messages, badges */
.flash {
  padding: .8rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid;
  border-radius: var(--radius-sm);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
/* The question before a destructive action (app.js). */
dialog.confirm { width: min(26rem, calc(100% - 2rem)); padding: 1.35rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog.confirm::backdrop { background: rgba(20, 20, 24, .4); }
dialog.confirm p { margin: 0 0 1.2rem; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
dialog.confirm .actions { justify-content: flex-end; }
/* A form in a window of its own (adding a client). Opened by app.js; without script the link to #id shows it in the page. */
dialog.formdialog { width: min(32rem, calc(100% - 2rem)); padding: 1.5rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog.formdialog::backdrop { background: rgba(20, 20, 24, .4); }
dialog.formdialog h2 { margin: 0 0 1.1rem; font-size: 1.15rem; }
dialog.formdialog .actions { justify-content: flex-end; margin-top: 1.1rem; }
dialog.formdialog:target:not([open]) { display: block; position: static; margin: 1.5rem 0; box-shadow: none; }

.flash.ok { background: var(--ok-bg); border-color: var(--ok-line); color: #0f5234; }
.flash.err { background: var(--err-bg); border-color: #f1c6c2; color: #7c1a14; }
.flash.info { background: var(--info-bg); border-color: #cfdcf2; color: #23426f; }

.badge {
  display: inline-block;
  padding: .16rem .65rem;
  font: 600 .76rem/1.5 var(--sans);
  border-radius: 99px;
  text-decoration: none;
  white-space: nowrap;
}
.badge.new { background: var(--primary-soft); color: #a63c1a; border: 1px solid var(--primary-line); }
a.badge.new:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.badge.done { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.badge.off { background: #efeeeb; color: #55565c; border: 1px solid var(--line-strong); }
.badge.bad { background: var(--err-bg); color: var(--err); border: 1px solid #f1c6c2; }
input[type=file] { display: block; width: 100%; margin-top: .35rem; padding: .5rem; font: inherit; font-weight: 400; font-size: .88rem; color: var(--text); background: var(--bg); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.filebtn input[type=file] { width: auto; padding: 0; background: none; border: 0; }
.docform h3 { margin-bottom: .9rem; }
.card > .flash:last-child { margin-bottom: 0; }
.badge.lock { display: inline-flex; align-items: center; gap: .3rem; background: #efeeeb; color: var(--ink); border: 1px solid var(--line-strong); }
.badge.lock svg { width: 12px; height: 12px; }
.badge.late { margin-top: .25rem; background: var(--info-bg); color: #23426f; border: 1px solid #cfdcf2; }
.locked { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.locked svg { width: 14px; height: 14px; }
.lockinfo { display: flex; align-items: flex-start; gap: .6rem; margin-top: 1rem; white-space: normal; }
.lockinfo svg { margin-top: .1rem; }
.filing-form { margin-bottom: .75rem; }
.filing-form .hint { margin-top: 0; margin-bottom: .4rem; font-size: .82rem; }
.hint.warn { color: #8a5a00; font-weight: 600; }
.badge.role-admin { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.badge.role-staff { background: var(--blue-soft); color: #1f4f88; border: 1px solid #c8d9ee; }

/* ------------------------------------------------------------ tables */
.tablewrap {
  position: relative;   /* keeps hidden labels (sr-only) inside, so a wide table never widens the page */
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 1rem 0 1.25rem;
}
.tablewrap.flat { margin: 0 -1.35rem -1.35rem; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .75rem 1rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { font-size: .76rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfbfa; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Words in a table never break in the middle: a column is at least as wide as its longest word
   ("break-word" only breaks a word that is longer than the whole column, unlike "anywhere"). */
td a { overflow-wrap: break-word; font-weight: 500; color: var(--ink); text-decoration: none; }
td a:hover { color: var(--primary-dark); text-decoration: underline; }
.rowactions { text-align: right; }
.rowactions form, .rowactions > a { display: inline-flex; margin: .15rem 0 .15rem .3rem; white-space: nowrap; }
.rowactions a.btn { color: var(--ink); text-decoration: none; }
.rowactions a.btn:not(.ghost):not(.danger), .rowactions a.btn:not(.ghost):not(.danger):hover { color: #fff; }
/* Action buttons in the account tables: a fixed grid of equal buttons, so every row
   has the same button in the same place whatever its label. */
.actiongrid { display: inline-grid; grid-template-columns: repeat(2, minmax(9.75rem, 12rem)); gap: .4rem; vertical-align: middle; text-align: left; }
.rowactions .actiongrid form, .rowactions .actiongrid > a { display: block; margin: 0; }
.actiongrid .btn { width: 100%; white-space: nowrap; }
.actiongrid .slot { display: block; }
/* Name with the e-mail address under it. */
td.person { min-width: 10rem; }
td.person strong { font-weight: 600; color: var(--ink); }
td.person .small { overflow-wrap: break-word; }
table.rights tr.group th { padding-top: 1.1rem; padding-bottom: .5rem; font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); background: var(--bg); text-align: left; width: auto; }
table.rights td:first-child { color: var(--ink); }
.notes { margin: 0 0 1.5rem; padding-left: 1.2rem; font-size: .85rem; color: var(--muted); max-width: 60rem; }
.notes li { margin-bottom: .3rem; }
table.rights th:not(:first-child), table.rights td:not(:first-child) { text-align: center; width: 9.5rem; }

dl.kv { display: grid; grid-template-columns: minmax(9rem, 16rem) 1fr; gap: .5rem 1.25rem; margin: 0 0 1rem; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.mailnote { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; padding: .6rem .8rem; border: 1px solid; border-radius: 10px; font-weight: 600; }
.mailnote svg { width: 16px; height: 16px; flex: none; }
.mailnote.ok { background: var(--ok-bg); border-color: var(--ok-line); color: #0f5234; }
.mailnote.err { background: var(--err-bg); border-color: #f1c6c2; color: #7c1a14; }
.mailnote .small { font-weight: 400; }
.copyrow { display: flex; gap: .5rem; }
.copyrow input { margin: 0; font-family: Consolas, Menlo, monospace; font-size: .82rem; }

/* demo log-in buttons (login screen, only in the local test copy: see dev/demo_logins.php) */
body.bare .card.demo-logins { border: 2px dashed var(--primary-line); }
.demo-logins h2 { margin-top: 0; font-size: 1rem; }
.demo-grid { display: grid; gap: .5rem; }
.demo-grid form { margin: 0; }
.demo-btn {
  display: grid;
  width: 100%;
  gap: .1rem;
  padding: .65rem .85rem;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.demo-btn:hover { background: var(--bg); border-color: var(--primary); }
.demo-btn.role-admin { border-left-color: var(--ink); }
.demo-btn.role-staff { border-left-color: var(--blue); }
.demo-btn span { font-size: .85rem; color: var(--muted); }
.demo-btn small { font-size: .8rem; color: var(--muted); }

/* ------------------------------------------------------------ assistant window (client side) */
.chat { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; }
.chat-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 99px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  cursor: pointer;
}
.chat-toggle svg { color: var(--primary); }
.chat-toggle:hover { background: #000; }
.chat-toggle:focus-visible { outline: 3px solid rgba(235, 96, 55, .45); outline-offset: 2px; }
.chat.open .chat-toggle span { display: none; }
.chat.open .chat-toggle { padding: .7rem; }
.chat-panel {
  order: -1;
  display: flex;
  flex-direction: column;
  width: min(23rem, calc(100vw - 2.5rem));
  height: min(32rem, calc(100vh - 7rem));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .22);
  overflow: hidden;
}
.chat-head { display: flex; align-items: center; gap: .5rem; padding: .75rem .95rem; background: var(--ink); color: #fff; }
.chat-head strong { font-size: 1rem; }
.chat-head .badge { background: var(--primary); color: #fff; border-color: var(--primary); }
.chat-clear { margin-left: auto; padding: .2rem .5rem; font: inherit; font-size: .76rem; color: #ddd; background: none; border: 1px solid #666; border-radius: 8px; cursor: pointer; }
.chat-clear:hover { color: #fff; border-color: #fff; }
.chat-close { padding: 0 .35rem; font-size: 1.5rem; line-height: 1; color: #fff; background: none; border: 0; cursor: pointer; }
.chat-about { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .5rem .95rem; font-size: .8rem; font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--line); }
.chat-about select { flex: 1; min-width: 0; margin: 0; padding: .35rem .5rem; font-size: .85rem; border-radius: 8px; }
.chat-note { margin: 0; padding: .5rem .95rem; font-size: .76rem; line-height: 1.4; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: .5rem; padding: .9rem; overflow-y: auto; }
.chat-msg { max-width: 88%; padding: .55rem .8rem; font-size: .9rem; line-height: 1.45; border-radius: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.chat-msg.bot { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.typing { color: var(--muted); letter-spacing: .2em; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: .35rem; padding: 0 .9rem .7rem; }
.chat-suggest button { padding: .3rem .7rem; font: inherit; font-size: .78rem; color: var(--primary-dark); background: var(--primary-soft); border: 1px solid var(--primary-line); border-radius: 99px; cursor: pointer; text-align: left; }
.chat-suggest button:hover { background: #fbdfd5; }
.chat-form { display: flex; gap: .4rem; padding: .7rem; border-top: 1px solid var(--line); }
.chat-form input[type=text] { flex: 1; margin: 0; }
.chat-form .btn { padding: .55rem .9rem; }

/* On wide screens the menu already has an "Ask a question" button; the floating one appears once the window is open. */
@media (min-width: 901px) {
  .side:has([data-chat-open]) ~ .main .chat:not(.open) .chat-toggle { display: none; }
}

/* ------------------------------------------------------------ smaller screens */
/* Laptop screens: a little less air in table cells, so wide tables still fit without scrolling. */
@media (max-width: 1450px) {
  th, td { padding-left: .7rem; padding-right: .7rem; }
}

/* Narrower windows: the action buttons go under each other instead of two by two. */
@media (max-width: 1250px) {
  .actiongrid { grid-template-columns: minmax(9.75rem, 12rem); }
  .actiongrid .slot { display: none; }
}
@media (max-width: 1100px) {
  th, td { padding-left: .5rem; padding-right: .5rem; }
  th:first-child, td:first-child { padding-left: .8rem; }
  th:last-child, td:last-child { padding-right: .8rem; }
}

@media (max-width: 1180px) {
  .span-4 { grid-column: span 6; }
  .span-8 { grid-column: span 12; }
  .dash > .span-4:nth-of-type(3) { grid-column: span 12; }
}

@media (max-width: 900px) {
  .side {
    position: fixed;
    z-index: 60;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .25);
  }
  body.side-open .side { transform: none; }
  body.side-open::after { content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(20, 20, 24, .35); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: .9rem 1rem .3rem; flex-wrap: wrap; }
  .wrap { padding: .9rem 1rem 2.5rem; }
  .foot { padding: 0 1rem 1.25rem; }
  .who small { display: none; }
}

@media (max-width: 760px) {
  h1 { font-size: 1.25rem; }
  .titles p { display: none; }
  .span-4, .span-8, .span-12, .dash > .span-4:nth-of-type(3) { grid-column: span 12; }
  .grid, .grid.three { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; gap: 0; }
  dl.kv dd { margin-bottom: .6rem; }
  .copyrow { flex-direction: column; }
  .card { padding: 1.1rem; }
  .tablewrap.flat { margin: 0 -1.1rem -1.1rem; }
  /* A company name or file name in the first column keeps a readable width; the table scrolls sideways instead. */
  .tablewrap td:first-child:has(a) { min-width: 11rem; }
  .hero { font-size: 2.8rem; }
  .chat { right: .75rem; bottom: .75rem; }
  .chat-panel { height: min(30rem, calc(100vh - 6rem)); }
}

/* Phones: the page title gets a row of its own under the menu button, the language switch and the name. */
@media (max-width: 600px) {
  .topbar { row-gap: .6rem; }
  .top-right { margin-left: auto; min-width: 0; }
  .titles { order: 3; flex: 0 0 100%; }
  .titles h1 { overflow-wrap: break-word; }
  .userchip { min-width: 0; }
  .who strong { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------------------------------------------------------- billing */
.tablewrap.inform { margin: .35rem 0 .6rem; box-shadow: none; }
.linetable th { white-space: nowrap; }
.linetable td { padding: .4rem .45rem; vertical-align: middle; }
.linetable input, .linetable select { margin-top: 0; padding: .5rem .6rem; }
.linetable td:nth-child(1) input { min-width: 11rem; }
.linetable td:nth-child(2) input { min-width: 10rem; }
.linetable input.short { width: 4.5rem; margin-left: auto; text-align: right; }
.linetable input.amount { width: 7.5rem; margin-left: auto; text-align: right; }
.linetable select { width: 5rem; }
.linetable select[data-activity-pick] { width: 100%; min-width: 14rem; }
.linetable td.pick input { margin-top: .3rem; }
.linetable td.pick input[hidden] { display: none; }
/* Moving a document to another month: a small window with the month and the year. */
.rowactions > button.btn { margin: .15rem 0 .15rem .3rem; }
/* The window sits inside a table cell of buttons: undo the cell's right-aligned, unwrapped layout. */
.rowactions dialog.formdialog { text-align: left; white-space: normal; overflow: visible; }
.rowactions dialog.formdialog form.movepanel { display: block; margin: 0; white-space: normal; }
.movepanel .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.1rem; }
.movepanel .actions .btn { margin: 0; }
.movepanel p { margin: 0 0 .9rem; overflow-wrap: anywhere; }
.movepanel .pair { display: flex; gap: .5rem; }
.movepanel .movecat { display: block; margin: 0 0 .6rem; }
.movepanel .movecat select { margin-top: .3rem; }
.movepanel .pair select { margin: 0; }
/* Internal notes on a document: a button with the number of notes, and a window with the conversation. */
.notebtn { display: inline-flex; align-items: center; gap: .3rem; }
.notebtn svg { width: 14px; height: 14px; }
.notebtn.has { border-color: #cfd6f7; background: #eef2ff; color: #3b4aa8; }
/* A new reaction that this user has not read yet: an orange dot on the button, a tinted row in lists. */
.notebtn.unread { position: relative; border-color: var(--primary); }
.notebtn.unread::after { content: ""; position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; }
.note.new { border-color: #f3c9b6 !important; background: #fff6f1 !important; }
tr.unreadrow td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
tr.openrow td { background: #fff6f1; }
/* The introduction for a new client, once, at the first log-in: a guided tour over the page. */
.tour-shade { position: fixed; inset: 0; z-index: 900; }
.tour-hole { position: fixed; z-index: 901; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(20, 20, 24, .55), 0 0 0 3px var(--primary); pointer-events: none; transition: all .25s ease; }
.tour-hole.off { left: 50% !important; top: 50% !important; width: 0 !important; height: 0 !important; box-shadow: 0 0 0 9999px rgba(20, 20, 24, .55); }
.tour-card { position: fixed; z-index: 902; width: min(23rem, calc(100% - 1rem)); padding: 1.3rem 1.3rem 1rem; background: var(--card); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); transition: left .25s ease, top .25s ease; }
.tour-card.center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(28rem, calc(100% - 2rem)); text-align: center; padding: 1.8rem 1.6rem 1.2rem; }
.tour-card h2 { margin: .7rem 0 .4rem; font-size: 1.1rem; }
.tour-card.center h2 { font-size: 1.25rem; }
.tour-card p { margin: 0; color: var(--muted); line-height: 1.5; font-size: .92rem; }
.tour-card .introicon { width: 2.6rem; height: 2.6rem; }
.tour-card.center .introicon { width: 3.6rem; height: 3.6rem; }
.tour-card .introfoot { margin-top: 1.1rem; }
.tour-hint { margin-top: .6rem !important; font-weight: 600; color: var(--primary) !important; }
.introicon { display: inline-grid; place-items: center; width: 3.6rem; height: 3.6rem; border-radius: 50%; background: #fff1ea; color: var(--primary); }
.introicon svg { width: 26px; height: 26px; }
.introfoot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.8rem; flex-wrap: wrap; }
.introdots { display: inline-flex; gap: .4rem; }
.introdots i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--line-strong); }
.introdots i.on { width: 1.4rem; border-radius: 999px; background: var(--primary); }
.introbtns { display: inline-flex; gap: .5rem; margin-left: auto; }
.introbtns [hidden] { display: none; }

/* Overview of a client: what is still to be uploaded, and the period that is running. */
.uptodate p { margin: 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.uptodate svg { width: 20px; height: 20px; color: #1e8e5a; }
.todo { display: grid; grid-template-columns: repeat(auto-fill, minmax(27rem, 1fr)); gap: 1rem; }
.todocard { margin: 0; }
.todocard h3 { margin: 0 0 .6rem; font-size: 1rem; }
.todorow { display: grid; gap: .4rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.todomonth { font-weight: 600; }
.todobtns { display: flex; gap: .35rem; flex-wrap: wrap; }
.todobtns .btn { text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.todobtns .btn svg { width: 14px; height: 14px; }
.periodtable td.num, .periodtable th.num { text-align: center; }
.periodtable { table-layout: fixed; width: 100%; }
.periodtable th:first-child, .periodtable td:first-child { width: 11rem; }
.uplink.missing { border-style: solid; border-color: #f3b9a1; background: #fff6f1; color: var(--primary); font-weight: 600; min-width: 6.5rem; }
.uplink.missing:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.received { display: inline-flex; color: #1e8e5a; }
.received svg { width: 20px; height: 20px; }
.todotable { padding-top: .4rem; padding-bottom: 1rem; }
.periodtable.folded tbody.more { display: none; }
.moremonths { display: block; width: 100%; text-align: left; margin: .2rem 0 0; padding: .7rem 0 .1rem; border-top: 1px solid var(--line) !important; font: inherit; font-weight: 600; font-size: .88rem; color: var(--primary); background: none; border: 0; cursor: pointer; }
.moremonths:hover { text-decoration: underline; }
.uplink { display: inline-block; padding: .3rem .7rem; font-size: .82rem; border: 1px dashed var(--line-strong); border-radius: 999px; color: var(--muted); text-decoration: none; }
.uplink:hover { border-color: var(--primary); color: var(--primary); }
.uplink.has { border-style: solid; border-color: #bfe3cf; background: #ecf8f1; color: #1e7a4c; }

/* Lists on "My tasks" and "Conversations": on a narrow screen they scroll sideways instead of
   squeezing names into one letter per line. */
table.tasks { min-width: 50rem; }
table.tasks td, table.tasks th { overflow-wrap: normal; word-break: normal; }
table.tasks td:nth-child(2) { min-width: 8rem; }
table.tasks td.small { min-width: 12rem; }   /* the last note, what is missing … */
/* A long label ("Waiting for Demo Personeel") may take two lines, so the button at the end stays in view. */
table.tasks td .badge { white-space: normal; max-width: 10rem; line-height: 1.3; border-radius: 8px; text-align: center; }
.filetable { min-width: 44rem; }
@media (max-width: 760px) {
  /* Every list on a phone: sideways scrolling instead of words broken over several lines. */
  .tablewrap > table { min-width: 36rem; }
  .tablewrap > table th, .tablewrap > table td { overflow-wrap: normal; word-break: normal; }
}

/* The buttons behind a document: always one tidy row, right-aligned, the same in every row. */
.fileactions { display: flex; align-items: center; justify-content: flex-end; gap: .3rem; flex-wrap: nowrap; white-space: nowrap; }
.fileactions > form, .fileactions > a, .fileactions > button, .fileactions > .locked { margin: 0 !important; }
.fileactions .btn { margin: 0; }
/* Fixed widths, so View, notes, status, Move and Remove stand in straight columns from row to row. */
.fileactions .notebtn { min-width: 4.7rem; justify-content: center; }
.fileactions .statusbtn { min-width: 7.6rem; justify-content: center; }
.fileactions > form:has(.statusbtn) { min-width: 7.6rem; }
/* Laptop screens: the buttons behind a document go over two tidy rows instead of pushing the
   last ones (Move, Remove) out of sight. */
@media (max-width: 1500px) {
  .fileactions { flex-wrap: wrap; row-gap: .3rem; width: 21rem; margin-left: auto; }
}
/* File names: break only when they really do not fit. */
.filename { min-width: 11rem; overflow-wrap: break-word; }
/* The list of documents: a little less space between the columns, and labels that may wrap. */
.filetable th, .filetable td { padding-left: .55rem; padding-right: .55rem; }
.filetable td .badge { white-space: normal; line-height: 1.3; border-radius: 8px; }
.filetable td:nth-last-child(2) { max-width: 12rem; }
/* The remark ("Demo Bank – current account"): readable lines, not one word per line. */
.filetable td.remark { min-width: 7rem; max-width: 14rem; }

/* A possible duplicate: the mark, what it looks like, and "Not a duplicate". */
.dupbox { display: grid; gap: .2rem; margin-top: .35rem; max-width: 20rem; white-space: normal; }
.dupbox .badge { justify-self: start; }
.dupbox form { display: inline; margin: 0; }
button.dupopen { cursor: pointer; font: inherit; font-size: .72rem; }
button.dupopen:hover { filter: brightness(.96); text-decoration: underline; }

/* Comparing a possible duplicate with the document it looks like: side by side, with the decision below. */
dialog.comparedialog { width: min(1400px, calc(100% - 2rem)); height: calc(100% - 2rem); max-height: none; padding: 1rem 1.2rem; text-align: left; white-space: normal; }
dialog.comparedialog[open] { display: flex; flex-direction: column; }
.comparehead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.comparehead h2 { margin: 0; font-size: 1.1rem; }
.comparegrid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; min-height: 0; margin: .8rem 0; }
.comparecol { display: flex; flex-direction: column; min-height: 0; }
.comparemeta { margin: 0 0 .5rem; overflow-wrap: anywhere; }
.comparecol iframe, .comparecol .pdfjs { flex: 1; width: 100%; min-height: 20rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #525659; }
.nopreview { flex: 1; display: grid; place-content: center; gap: .6rem; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.comparedecide { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.comparedecide form { display: inline-flex; margin: 0; }
.comparedecide .btn[disabled] { opacity: .45; cursor: default; }
@media (max-width: 800px) { .comparegrid { grid-template-columns: 1fr; } }

/* Several documents at once: a bar above the list of files, tick boxes in the first column. */
/* Hidden until something is ticked (app.js marks it "ready" and, with ticks, "active"); without JavaScript it stays visible. */
.bulkbar.ready:not(.active) { display: none; }
.bulkbar { display: flex; align-items: center; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; margin: 0 0 .6rem; padding: .55rem .8rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.bulkbar.active { border-color: var(--primary); background: #fff6f1; }
.bulkcount { font-size: .85rem; }
.bulkbar:not(.active) .bulkcount { font-weight: 400; color: var(--muted); }
.bulkactions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.bulkmove { display: inline-flex; align-items: center; gap: .3rem; }
.bulkmove select { margin: 0; padding: .32rem .45rem; font-size: .8rem; width: auto; }
.bulkbar .btn[disabled] { opacity: .45; cursor: default; }
.pickcol { width: 1%; padding-right: 0 !important; }
.pickcol input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--primary); }
tr.picked-row td { background: #fff6f1; }

/* Whose turn it is to reply in a conversation: "Your turn" stands out. */
.badge.turn { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Conversations: one conversation open on the page, with Previous / Next. */
.card.reader { margin-bottom: 1.25rem; }
.readerhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.readerhead h2 { margin: 0 0 .25rem; font-size: 1.15rem; overflow-wrap: anywhere; }
.readerhead p { margin: 0; }
.readernav { display: flex; gap: .4rem; flex-wrap: wrap; }
.readernav a.btn { text-decoration: none; }
.btn.disabled { opacity: .45; pointer-events: none; }
.thread { display: grid; gap: .6rem; max-height: 26rem; overflow-y: auto; padding-right: .2rem; }
.thread .note { max-width: 46rem; padding: .7rem .9rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.thread .note.mine { justify-self: end; background: #eef2ff; border-color: #d6dcf7; }
.thread .note.new { border-color: #f3c9b6; background: #fff6f1; }
.thread .notehead { display: flex; justify-content: space-between; gap: .8rem; margin: 0 0 .3rem; }
.thread .notebody { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.replyform { margin-top: 1rem; }
.replyform textarea { width: 100%; }
.replyform .actions { margin-top: .6rem; }
.readerstatus { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.rowactions > .notebtn { margin: .15rem 0 .15rem .3rem; }
.rowactions dialog.notesdialog { width: min(34rem, calc(100% - 2rem)); max-height: calc(100% - 3rem); overflow-y: auto; }
.rowactions dialog.notesdialog form { display: block; margin: 0; white-space: normal; }
dialog.notesdialog .notefile { margin: -.6rem 0 1rem; overflow-wrap: anywhere; }
dialog.notesdialog .note { padding: .7rem .85rem; margin: 0 0 .6rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); }
dialog.notesdialog .notehead { display: flex; justify-content: space-between; gap: .5rem; margin: 0 0 .3rem; }
dialog.notesdialog .notebody { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
dialog.notesdialog .noteactions { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-start; margin-top: .45rem; }
dialog.notesdialog .noteactions details[open] { flex: 1 1 100%; order: 2; }
dialog.notesdialog .noteactions details[open] form { display: grid; gap: .4rem; margin-top: .4rem; }
dialog.notesdialog .noteactions details[open] .btn { justify-self: start; }
dialog.notesdialog textarea { width: 100%; }
dialog.notesdialog .noteform { margin-top: 1rem; }
.linkish { padding: 0; font: inherit; font-size: .82rem; color: var(--muted); background: none; border: 0; text-decoration: underline; cursor: pointer; }
.linkish.danger { color: var(--err); }
summary.linkish { list-style: none; display: inline; }
summary.linkish::-webkit-details-marker { display: none; }
.badge.moved { background: #eef2ff; color: #3b4aa8; border-color: #cfd6f7; }

/* The cross at the end of an invoice line: empties the whole row. */
.linetable td.clear { width: 1%; padding-left: 0; }
.rowclear { width: 2rem; height: 2rem; padding: 0; font: inherit; font-size: 1.25rem; line-height: 1; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.rowclear:hover, .rowclear:focus-visible { color: #b02a37; background: #fdecec; border-color: #f3c4c4; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* An invoice as PDF in a window on the page itself. */
dialog.pdfview { width: min(60rem, calc(100% - 2rem)); height: calc(100% - 2rem); max-height: none; padding: 0; overflow: hidden; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog.pdfview[open] { display: flex; flex-direction: column; }
dialog.pdfview::backdrop { background: rgba(20, 20, 24, .5); }
.pdfview-bar { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.pdfview-bar strong { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdfview-bar a.btn { text-decoration: none; }
dialog.pdfview iframe, dialog.pdfview .pdfjs { flex: 1; width: 100%; border: 0; background: #525659; }
.billing-chips { margin: 0 0 1.1rem; }
.chip.alert { background: var(--err-bg); border-color: #f1c6c2; color: var(--err); }
.chip.alert b { color: var(--err); }
.badge.flag { font-weight: 700; }
a.badge.flag { margin-left: .4rem; text-decoration: none; }
.callflag ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.callflag a { color: inherit; }
.card > .actions form { display: inline-flex; margin: 0; }
.payform { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .75rem 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.payform label { margin-bottom: 0; }
.payform input[type=date] { width: auto; }
.headrow .filters { margin: 0; }
.grid.three .wide2 { grid-column: span 2; align-self: center; margin-bottom: 1rem; }

@media (prefers-reduced-motion: reduce) {
  .side { transition: none; }
}

/* Deadlines (main account): VAT and corporate tax returns per month. */
.monthnav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 1.6rem 0 .8rem; }
.monthnav h2 { margin: 0 .3rem; min-width: 13rem; text-align: center; }
.monthnav .btn { min-width: 2.2rem; justify-content: center; }
.monthnav .chips { margin: 0 0 0 auto; }
.count.bad { background: var(--err-bg); color: var(--err); }
.badge.kind-vat { background: var(--blue-soft); color: #1f4f88; border: 1px solid #c8d9ee; }
.badge.kind-ct { background: #f3ecff; color: #5b3aa0; border: 1px solid #ddd0f5; }
.badge.done svg { width: 12px; height: 12px; vertical-align: -1px; }
table.deadlines tr.islate td:first-child { box-shadow: inset 3px 0 0 var(--err); }
table.deadlines tr.isdone td { color: var(--muted); }
table.deadlines tr.isdone strong { font-weight: 500; }
table.deadlines .btn svg { width: 14px; height: 14px; }
.fyinfo { display: flex; flex-direction: column; gap: .35rem; }
.fyinfo .fylabel { font-weight: 600; font-size: .9rem; }
.fyinfo .fyvalue { display: flex; align-items: baseline; gap: .6rem; padding: .62rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #faf9f7; }
.fyinfo .hint { margin: 0; }

/* ------------------------------------------------------------- scan module (inc/pages/scan.php) */
.scan-progress { margin: .6rem 0 0; }
.scan-progress:empty { display: none; }
.scan-split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.25rem; align-items: start; }
.scan-doc { position: sticky; top: 1rem; }
.scan-doc iframe, .scan-doc .pdfjs { display: block; width: 100%; height: min(78vh, 60rem); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.scan-doc p { margin: .4rem 0 0; }
.scan-form h3 { margin-top: .5rem; }
.scan-form .grid .field { margin-bottom: .75rem; }
.scan-form input.num { text-align: right; font-variant-numeric: tabular-nums; }
.scan-form input.bad { border-color: var(--err); background: var(--err-bg); }
.scan-form .actions { margin-top: .5rem; }
/* one line of a scan: description and category on top, tax code and amounts below */
.scan-line { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .5rem .6rem; align-items: end; padding: .7rem .8rem; margin-bottom: .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #faf9f7; }
.scan-line label { display: block; margin: 0; font-weight: 600; font-size: .76rem; color: var(--ink); }
.scan-line label > span { display: flex; align-items: center; gap: .4rem; min-height: 1.3rem; }
.scan-line label .badge { font-style: normal; font-size: .66rem; }
.scan-line input[type=text], .scan-line select { margin-top: .2rem; padding: .42rem .55rem; font-size: .88rem; }
.scan-line .sl-desc { grid-column: span 6; }
.scan-line .sl-cat { grid-column: span 6; }
.scan-line .sl-tax { grid-column: span 4; }
.scan-line .sl-rate { grid-column: span 2; }
.scan-line .sl-amount { grid-column: span 3; }
.scan-line .sl-vat { grid-column: span 2; }
.scan-line .sl-remove { grid-column: span 1; justify-self: end; margin-bottom: .15rem; }
.scan-sums { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin: 0 0 1rem; }
.scan-sums .fielderr { display: inline; margin: 0; font-size: .85rem; }
.scan-reader .readerstatus form { margin: 0; }
@media (max-width: 1100px) {
  .scan-split { grid-template-columns: minmax(0, 1fr); }
  .scan-doc { position: static; }
  .scan-doc iframe, .scan-doc .pdfjs { height: 60vh; }
}
@media (max-width: 560px) {
  .scan-line .sl-desc, .scan-line .sl-cat, .scan-line .sl-tax { grid-column: span 12; }
  .scan-line .sl-rate { grid-column: span 4; }
  .scan-line .sl-amount, .scan-line .sl-vat { grid-column: span 4; }
  .scan-line .sl-remove { grid-column: span 12; }
}
/* the open scan as a screen of its own: a bar on top, the document on the left, the panel with fields on the right */
.scanbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.scanbar-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.scanbar .readernav { align-items: center; }
.scan-pos { padding: 0 .35rem; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scan-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(24rem, 34rem); gap: 1rem; align-items: stretch; height: calc(100vh - 10.5rem); min-height: 32rem; }
.scan-screen .scan-doc { position: static; display: flex; flex-direction: column; min-height: 0; }
.scan-screen .scan-doc iframe, .scan-screen .scan-doc .pdfjs { flex: 1; height: auto; min-height: 0; }
.scan-nodoc { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--card); }
.scan-panel { min-height: 0; overflow-y: auto; padding: 1rem 1.1rem 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.scan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
.scan-head strong { display: block; overflow-wrap: anywhere; }
.scan-badges { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.scan-issues { margin: 0 0 .8rem; padding: .7rem .9rem; border: 1px solid #f0d48a; border-radius: var(--radius-sm); background: #fff8e6; font-size: .88rem; }
.scan-publish { position: sticky; bottom: -1.2rem; z-index: 2; display: flex; justify-content: flex-end; margin: 1rem -1.1rem -1.2rem; padding: .7rem 1.1rem; background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.scan-panel .flash { margin: 0 0 .8rem; font-size: .88rem; }
.scan-panel h3 { margin: 1.1rem 0 .7rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.scan-panel .hint { margin: 0 0 .6rem; }
.scan-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .25rem .8rem; align-items: center; margin-bottom: .5rem; }
.scan-row > label { margin: 0; font-size: .86rem; font-weight: 500; color: var(--ink); }
.scan-row > input, .scan-row > select { margin: 0; padding: .42rem .55rem; font-size: .9rem; }
.scan-row > .hint { grid-column: 2; margin: 0; }
.scan-panel .scan-line { display: block; padding: .6rem .7rem .3rem; counter-increment: scanline; }
.scan-panel .scan-lines { counter-reset: scanline; }
.scan-panel .sl-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .45rem; font-size: .8rem; }
.scan-panel .sl-head strong::after { content: ' ' counter(scanline); }
.scan-panel .sl-head .badge { font-style: normal; font-size: .66rem; }
.scan-panel .sl-head .sl-remove { margin: 0 0 0 auto; padding: .1rem .5rem; }
.scan-panel .scan-line label { display: grid; grid-template-columns: 8.8rem minmax(0, 1fr); gap: .8rem; align-items: center; margin-bottom: .4rem; font-size: .84rem; font-weight: 500; }
.scan-panel .scan-line label > span { min-height: 0; }
.scan-panel .scan-line input[type=text], .scan-panel .scan-line select { margin-top: 0; }
.scan-panel .scan-sums { margin: .2rem 0 0; }
.scan-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
/* the code by e-mail at log-in (inc/pages/code.php) */
input.codefield { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.card.narrow label.check { display: flex; align-items: flex-start; gap: .55rem; margin: .2rem 0 1rem; font-weight: 600; }
.card.narrow label.check input { width: auto; margin: .25rem 0 0; }
.card.narrow label.check small { display: block; font-weight: 400; font-size: .82rem; line-height: 1.4; }
.codelinks { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: .6rem 0 0; }
/* a field that is still empty or not right: an orange edge and the reason underneath */
.scan-form input.warn, .scan-form select.warn { border-color: #e8920c; background: #fffaf0; box-shadow: 0 0 0 2px rgba(232, 146, 12, .15); }
.scan-form .fieldwarn { color: #b25e00; font-size: .8rem; line-height: 1.35; }
.scan-form .fieldwarn::before { content: '\26A0\00A0'; }
.scan-panel .scan-line > .fieldwarn { margin: -.2rem 0 .45rem calc(8.8rem + .8rem); }
.scan-lineactions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.scan-oneline { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
/* the form of a supplier or customer rule: in a window on the open scan, and on the page with the rules */
dialog.ruledialog { width: min(40rem, calc(100% - 2rem)); }
.ruleform { margin: 0; }
.rulegrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem 1rem; margin: .8rem 0; }
.rulegrid label { margin: 0; font-size: .85rem; font-weight: 600; }
.rulegrid label.wide { grid-column: 1 / -1; }
.rulegrid input, .rulegrid select { margin-top: .25rem; font-weight: 400; }
.ruleform label.check { display: flex; align-items: flex-start; gap: .5rem; margin: 0 0 1rem; font-weight: 400; font-size: .9rem; }
.ruleform label.check input { width: auto; margin: .2rem 0 0; }
.rulecard { max-width: 44rem; margin-bottom: 1.25rem; }
.rulecard h2 { margin-top: 0; }
.scan-row > .hint button.linkish { font-size: inherit; }
@media (max-width: 560px) { .rulegrid { grid-template-columns: minmax(0, 1fr); } }
/* the open scan: the flag, the menu "Actions", the notes */
.scan-flag { color: var(--muted); }
.scan-flag.on { color: #d9480f; }
.scan-flag.on svg { fill: currentColor; fill-opacity: .25; }
span.scan-flag { display: inline-flex; vertical-align: middle; }
span.scan-flag svg { width: 16px; height: 16px; }
.btn.scan-flag { padding-left: .5rem; padding-right: .5rem; }
.btn.scan-flag svg { width: 16px; height: 16px; }
.scan-menu { position: relative; }
.scan-menu > summary { list-style: none; cursor: pointer; }
.scan-menu > summary::-webkit-details-marker { display: none; }
.scan-menu-list { position: absolute; z-index: 20; top: calc(100% + .3rem); left: 0; min-width: 13rem; padding: .3rem; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.scan-menu-list button { display: block; width: 100%; padding: .5rem .7rem; border: 0; border-radius: 6px; background: none; font: inherit; font-size: .9rem; text-align: left; color: var(--ink); cursor: pointer; }
.scan-menu-list button:hover { background: #f3f1ed; }
.scan-menu-list button.danger { color: var(--err); }
.scan-row input[readonly][data-scan-net] { background: #f3f1ed; color: var(--muted); }
.scan-row > .hint a { margin-left: .1rem; }
.scan-row > .hint .fielderr { display: inline; margin: 0 .4rem 0 0; }
.scan-notes .note { padding: .5rem .7rem; margin-bottom: .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #faf9f7; }
.scan-notes .note p { margin: 0; }
.scan-notes .notebody { margin-top: .2rem; font-size: .9rem; overflow-wrap: anywhere; }
.scan-notes .noteform { display: flex; gap: .5rem; align-items: flex-end; margin: 0; }
.scan-notes .noteform textarea { flex: 1; margin: 0; font-size: .9rem; }
table.inbox th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
table.inbox th[data-sort]:hover { color: var(--ink); }
table.inbox th[data-sort]::after { content: ' \2195'; opacity: .35; font-size: .8em; }
table.inbox th[aria-sort="ascending"]::after { content: ' \2191'; opacity: 1; }
table.inbox th[aria-sort="descending"]::after { content: ' \2193'; opacity: 1; }
table.inbox tr[data-inbox-open] { cursor: pointer; }
table.inbox tr[data-inbox-open]:hover td { background: #faf9f7; }
@media (max-width: 1100px) {
  .scan-screen { grid-template-columns: minmax(0, 1fr); height: auto; }
  .scan-screen .scan-doc iframe, .scan-screen .scan-doc .pdfjs { flex: none; height: 60vh; }
  .scan-panel { overflow: visible; }
  .scan-publish { bottom: 0; }
}
.scan-problems { margin: .3rem 0 0; padding-left: 1.2rem; }
.scan-problems li { margin: 0; white-space: normal; }
.flash .scan-problems { white-space: normal; }

/* ------------------------------------------------------------- client workspace: overview, inbox */
.workgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 1rem; }
.workgrid .card { margin: 0; }
.workgrid .card-head h2 { display: flex; align-items: center; gap: .5rem; }
.workrow { display: grid; grid-template-columns: 8.5rem 1fr auto; align-items: center; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.workrow:hover { color: var(--ink); background: #faf9f7; }
.workrow strong { font-variant-numeric: tabular-nums; color: var(--ink); }
.workbig { font-size: 1.5rem; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; margin: 0 0 1rem; }
.workgrid h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem 0 .3rem; }
table.worktable td { padding: .4rem 0; border-top: 1px solid var(--line); }
/* the bar above the list: the tabs with their counts on the left, the tools on the right */
.filters .tabcount { display: inline-block; min-width: 1.4rem; margin-left: .4rem; padding: 0 .4rem; border-radius: 999px; background: rgba(0, 0, 0, .07); font-size: .78em; font-weight: 600; line-height: 1.55; text-align: center; font-variant-numeric: tabular-nums; }
.filters .btn:not(.ghost) .tabcount { background: rgba(255, 255, 255, .28); }
.tabtools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.inbox-bar { display: flex; align-items: center; gap: .6rem; margin: 0; }
table.inbox { width: 100%; }
table.inbox th { white-space: nowrap; }
table.inbox td { padding-top: .7rem; padding-bottom: .7rem; }
table.inbox td .badge { white-space: nowrap; max-width: none; }
table.inbox .inbox-sub { display: block; max-width: 17rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.inbox td a strong { overflow-wrap: anywhere; }
table.inbox th.tick, table.inbox td.tick { width: 2.2rem; padding-right: 0; }
table.inbox td { vertical-align: middle; }
table.inbox input[type=text], table.inbox select { margin: 0; padding: .38rem .5rem; font-size: .85rem; min-width: 9rem; }
table.inbox input[type=text] { width: 100%; min-width: 10rem; }
table.inbox th, table.inbox td { padding-left: .6rem; padding-right: .6rem; }
table.inbox td.rowactions .btn { margin: 0; }
/* a laptop screen: narrower columns, so the button to publish stays in view without scrolling sideways */
@media (max-width: 1500px) {
  table.inbox th, table.inbox td { padding-left: .45rem; padding-right: .45rem; }
  table.inbox .inbox-sub { max-width: 12rem; }
  table.inbox .inbox-why { min-width: 8rem; max-width: 13rem; }
  table.inbox input[type=text] { min-width: 8rem; }
  table.inbox select { min-width: 5rem; }
}
table.inbox select { min-width: 6rem; }
table.inbox input.bad { border-color: var(--err); background: var(--err-bg); }
table.inbox input.saving, table.inbox select.saving { opacity: .6; }
/* why a row is not ready: at most two lines in the list (the whole text on hover and in the open scan) */
table.inbox .inbox-why { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-width: 10rem; max-width: 19rem; margin-top: .3rem; white-space: normal; line-height: 1.35; }
table.inbox .inbox-why:empty { display: none; }
table.inbox .rowactions { white-space: nowrap; }
.cellink { text-decoration: none; }
@media (max-width: 900px) { .workgrid { grid-template-columns: minmax(0, 1fr); } }

/* Modules on and off (My account, main account) */
table.modules th[scope="row"] { white-space: normal; font-size: .9rem; font-weight: 400; color: var(--text); }
table.modules th[scope="row"] strong { display: block; font-weight: 600; color: var(--ink); }
table.modules th[scope="row"] .small { display: block; margin-top: .15rem; }
table.modules .switch-col { width: 7.5rem; text-align: center; }
#modules .btn[type="submit"] { margin-top: 1rem; }
.switch { position: relative; display: inline-block; width: 2.75rem; height: 1.5rem; margin: 0; cursor: pointer; vertical-align: middle; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: .1875rem; left: .1875rem; width: 1.125rem; height: 1.125rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(1.25rem); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 560px) {
  table.modules .switch-col { width: 5rem; padding-left: .5rem; padding-right: .5rem; }
  table.modules th[scope="row"] { padding-right: .5rem; }
}
table.modules tbody tr:last-child > * { border-bottom: 0; }

/* ------------------------------------------------------------ phones and tablets */
/* The logo in the top bar only shows when the menu is folded away (it is in the menu otherwise). */
.top-brand { display: none; }
.stack-sort { display: none; }

@media (max-width: 900px) {
  .top-brand { display: inline-flex; align-items: center; }
  .top-brand img { height: 30px; width: auto; max-width: 96px; object-fit: contain; }
  .menu-btn { min-width: 2.75rem; min-height: 2.75rem; justify-content: center; align-items: center; }
  .side { width: min(20rem, 86vw); overflow-y: auto; }
  .nav a { min-height: 2.75rem; }
  /* iPhone zooms in on a field with text smaller than 16px; this keeps the page as it is when typing. */
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 16px !important; }
}

/* Phones: menu button, logo, language and initials on one row; the page title under it. */
@media (max-width: 600px) {
  .topbar { padding: .7rem 1rem .2rem; gap: .5rem; }
  .topbar .top-right { margin-left: auto; gap: .45rem; }
  .who { display: none; }
  .userchip { padding: .2rem; }
  .avatar { width: 2.3rem; height: 2.3rem; }
  .langs a { padding: .35rem .55rem; }
  .titles { margin-top: .25rem; }
  .wrap { padding: .6rem .85rem 1.5rem; }
  .foot { padding-bottom: 5.5rem; }   /* room at the bottom for the round assistant button */
  .card { padding: 1rem; border-radius: var(--radius-sm); }
  .btn { min-height: 2.6rem; }
  .btn.small { min-height: 2.3rem; }
  /* The assistant button: only the round icon, so it covers less of the page. */
  .chat-toggle { padding: .8rem; }
  .chat-toggle span { display: none; }
  .chat-panel { width: calc(100vw - 1.5rem); max-width: none; }
  dialog.formdialog, dialog.confirm { width: calc(100% - 1.2rem); padding: 1.1rem; }
}

/* Tables on phones and tablets (and a narrow window): each row a card, each value with its column name
   (labels set by app.js). Up to 1279px the tables are wider than the page, with or without the menu beside it. */
@media (max-width: 1279px) {
  .stack-sort { display: block; width: 100%; margin: .6rem 0 .2rem; }
  .tablewrap:has(> table.stack) { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .card .tablewrap.flat:has(> table.stack) { margin: .6rem 0 0; border-top: 0; }
  table.stack, table.stack tbody { display: block; width: 100% !important; min-width: 0 !important; }
  table.stack thead { display: none; }
  table.stack tr { position: relative; display: flex; flex-direction: column; margin: 0 0 .65rem; padding: .6rem .85rem; background: var(--card);
                   border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
  table.stack tr.unreadrow, table.stack tr.on { border-left: 4px solid var(--primary); }
  table.stack td { position: relative; display: block; min-width: 0 !important; width: auto !important; padding: .32rem 0 .32rem 7.4rem;
                   text-align: left; border: 0; white-space: normal; overflow-wrap: break-word; }
  table.stack td .badge { white-space: nowrap; }
  table.stack td::before { content: attr(data-label); position: absolute; left: 0; top: .42rem; width: 6.9rem;
                           font-size: .74rem; font-weight: 600; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
  table.stack td:not([data-label]) { padding-left: 0; }
  table.stack td:not([data-label])::before { display: none; }
  table.stack td.num { text-align: left; }
  table.stack td:empty { display: none; }
  table.stack td.stack-title { padding: .15rem 2.2rem .4rem 0; font-size: .95rem; }
  table.stack td.stack-title::before { display: none; }
  table.stack td.stack-title { order: -1; }
  table.stack td.stack-actions { order: 99; }
  table.stack td.stack-pick { position: absolute; top: .55rem; right: .7rem; display: block; padding: 0; }
  table.stack td.stack-pick input { width: 1.3rem; height: 1.3rem; }
  table.stack td.stack-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; padding-top: .55rem; border-top: 1px solid var(--line); }
  table.stack td.stack-actions > * { margin: 0; }
  table.stack td.stack-wide { display: block; padding-left: 0; }
  table.stack td input:not([type=checkbox]):not([type=radio]), table.stack td select, table.stack td textarea { width: 100% !important; min-width: 0 !important; margin-left: 0; }
  /* A cell that is a field: its name above it, so the field gets the whole width of the card. */
  table.stack td[data-label]:has(> input:not([type=checkbox]):not([type=radio]), > select, > textarea) { padding: 1.45rem 0 .3rem; }
  table.stack td[data-label]:has(> input:not([type=checkbox]):not([type=radio]), > select, > textarea)::before { top: .3rem; width: 100%; }
  table.stack td label:has(input[type=checkbox]) { display: inline-flex; align-items: center; gap: .4rem; }
  table.stack tbody tr:hover td { background: transparent; }
  table.stack td .nowrap, table.stack .nowrap { white-space: normal; }
  /* "Clear this line" in an invoice line: a small text button at the bottom right instead of a label over a cross. */
  table.stack td.clear { padding: .2rem 0 0; text-align: right; }
  table.stack td.clear::before { display: none; }
  table.stack .rowclear { width: auto; height: auto; padding: .3rem .6rem; font-size: .85rem; }
  table.stack .rowclear::after { content: " " attr(title); }
}
/* The scan screen on phones: every label above its field, so the fields get the full width; the document
   a little lower, so the details are reached sooner; "Publish" at the bottom stays clear of the assistant button. */
@media (max-width: 600px) {
  .scan-row { grid-template-columns: minmax(0, 1fr); gap: .25rem; margin-bottom: .7rem; }
  .scan-row > .hint, .scan-panel .scan-row > .fieldwarn { grid-column: 1; margin-left: 0; }
  .scan-panel .scan-line label { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .scan-panel .scan-line > .fieldwarn { margin-left: 0; }
  .scan-screen .scan-doc iframe, .scan-screen .scan-doc .pdfjs { height: 52vh; }
  .scan-panel { padding: .9rem; }
  .scan-publish { margin: 1rem -.9rem -1.2rem; padding: .6rem 4.4rem .6rem .9rem; }
  .scan-publish .btn { flex: 1; justify-content: center; }
  .scan-notes .noteform { flex-direction: column; align-items: stretch; }
  .scanbar { gap: .5rem; }
  .scanbar-actions { gap: .35rem; }
}
/* ------------------------------------------------------------ taking a photo (phones and tablets) */
/* Shown by app.js only on a touch screen: a big button that opens the camera straight away. */
.camera { display: flex; flex-direction: column; align-items: center; gap: .45rem; width: 100%; }
.camera[hidden] { display: none; }
label.camerabtn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
                  width: 100%; max-width: 22rem; min-height: 3.5rem; margin: 0; font-size: 1.05rem; font-weight: 650; color: #fff; }
label.camerabtn svg { width: 24px; height: 24px; color: #fff; }
.camerabtn input { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; overflow: hidden; border: 0; }
.camerabtn:focus-within { outline: 3px solid rgba(235, 96, 55, .35); outline-offset: 2px; }
.camera-tip { max-width: 22rem; margin: 0; font-size: .82rem; line-height: 1.4; color: var(--muted); }
.upload.has-camera .drop-text, .upload.has-camera .drop > .or { display: none; }   /* nothing is dragged on a phone */
.upload.has-camera .drop { padding: 1.2rem .9rem; }
.docform .camera { align-items: stretch; margin: 0 0 .9rem; }
.docform label.camerabtn { max-width: none; }

/* The photos taken, as small pictures in a row; the cross takes one out again. */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.4rem, 1fr)); gap: .5rem; margin: .65rem 0 .2rem; }
.shots[hidden] { display: none; }
.shot { position: relative; margin: 0; aspect-ratio: 3 / 4; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.shot img { display: block; width: 100%; height: 100%; object-fit: contain; background: #f3f1ed; }
.shot figcaption { position: absolute; left: .3rem; bottom: .3rem; padding: .05rem .45rem; font-size: .72rem; font-weight: 650; color: #fff; background: rgba(20, 20, 24, .65); border-radius: 99px; }
.shot-remove { position: absolute; top: .25rem; right: .25rem; display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0;
               font-size: 1.15rem; line-height: 1; color: #fff; background: rgba(20, 20, 24, .7); border: 0; border-radius: 50%; cursor: pointer; }
.picked .merge { margin: .75rem 0 0; }
.picked-list:empty { display: none; }
/* Periodic invoices on the client page: one folding card each */
details.card.plan { padding: 0; }
details.card.plan > summary { cursor: pointer; padding: .9rem 1.1rem; list-style: none; }
details.card.plan > summary::-webkit-details-marker { display: none; }
details.card.plan > summary::before { content: "▸"; display: inline-block; width: 1.1rem; color: var(--muted, #777); }
details.card.plan[open] > summary::before { content: "▾"; }
details.card.plan > form { padding: 0 1.1rem; }
details.card.plan > form.plan-stop { padding: 0 1.1rem 1rem; }
details.card.plan[open] > summary { border-bottom: 1px solid var(--line, #e5e5e5); margin-bottom: .8rem; }

/* Client overview and commission (Billing): a group that folds, with its table edge to edge. */
details.card.plan > p, details.card.plan > .tablewrap.inform { margin-left: 1.1rem; margin-right: 1.1rem; }
details.card.plan > .tablewrap.inform { margin-bottom: 1rem; }
details.card.ovgroup[open] > summary { margin-bottom: 0; }
details.card.ovgroup > .tablewrap.flat { margin: 0; border-top: 0; }
details.card.ovgroup > p { margin: .8rem 1.1rem; }
details.card.ovgroup + .headrow { margin-top: 2.2rem; }
details.sub { margin-top: .6rem; }
details.sub > summary { cursor: pointer; }
details.sub > form { margin-top: .6rem; }
table.pkgtable input[type=text] { width: 100%; min-width: 7rem; }
table.pkgtable input.amount { min-width: 6rem; }
@media (max-width: 1279px) {
  details.card.ovgroup > .tablewrap.flat { margin: .6rem .6rem 0; }
}

ul.broughtlist { list-style: none; margin: 0 1.1rem 1rem; padding: 0; }
ul.broughtlist li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
ul.broughtlist li form { margin: 0; }


/* A file field on a phone: text of 16px, so the phone does not zoom in when it is tapped. */
@media (max-width: 700px) {
  input[type=file] { font-size: 1rem; }
}

/* Small laptop screens (1280-1360px): a narrower menu and less air at the sides, so the wide tables fit without scrolling. */
@media (min-width: 1280px) and (max-width: 1360px) {
  :root { --side: 220px; }
  .side { padding-left: .5rem; padding-right: .5rem; }
  .side .brand { gap: .4rem; }
  .side .brand img { height: 32px; }
  .side .brand span { font-size: .9rem; }
  .side a { padding-left: .6rem; padding-right: .6rem; gap: .55rem; }
  .topbar { padding-left: 1rem; padding-right: 1rem; }
  .wrap { padding-left: 1rem; padding-right: 1rem; }
  .foot { padding-left: 1rem; padding-right: 1rem; }
}

/* The PDF reader of the portal itself (assets/pdfview.js), for browsers that do not show PDFs: it takes
   the place and the size of the frame (see the rules for the frames above). */
.pdfjs { display: flex; flex-direction: column; min-height: 12rem; overflow: hidden; background: #525659; border-radius: var(--radius-sm); }
.scan-doc .pdfjs { display: flex; }
.pdfjs-bar { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; background: var(--card); border-bottom: 1px solid var(--line); }
.pdfjs-tools { display: flex; gap: .25rem; margin-left: auto; }
.pdfjs-tools .btn { min-width: 2.2rem; justify-content: center; font-size: 1rem; line-height: 1; }
.pdfjs-pages { flex: 1; min-height: 0; overflow: auto; padding: 12px; }
.pdfjs-page { margin: 0 auto 12px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.pdfjs-page canvas { display: block; width: 100%; height: 100%; }
