/* Binary Technologies admin — app UI. Brand: deep indigo, white, cyan (from the website). */

:root {
  --ink: #15163a;
  --ink-2: #3a3c66;
  --muted: #6e7196;
  --line: #e3e5f1;
  --line-2: #d3d6e8;
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --indigo: #24255e;
  --indigo-deep: #121335;
  --indigo-ink: #2f3178;
  --violet: #8f7dff;
  --cyan: #4cc9e6;
  --cyan-ink: #0b7f9c;
  --cyan-soft: #e3f7fc;
  --green: #12805c; --green-soft: #e2f5ee;
  --amber: #a35c00; --amber-soft: #fdf1df;
  --red: #c2283f; --red-soft: #fde8eb;
  --blue: #2f55c9; --blue-soft: #e7edff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(21, 22, 58, .05), 0 4px 18px rgba(21, 22, 58, .05);
  --shadow-lg: 0 20px 60px rgba(18, 19, 53, .28);
  --display: "Inter Tight", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --arabic: "IBM Plex Sans Arabic", "Geeza Pro", sans-serif;
  --sidebar: 252px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--display); -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: var(--indigo-ink); text-decoration: none; }
a:hover { color: var(--cyan-ink); }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pre { white-space: pre-line; }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 14px; }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-text, .btn.danger-text { color: var(--red); }
.icon { flex: none; }
[hidden] { display: none !important; }

/* ---------- form controls ---------- */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 9px 11px; width: 100%; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(76, 201, 230, .22);
}
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-2); color: var(--ink-2); }
/* the browser's own arrow sits flush against the border: draw one with room around it */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; text-overflow: ellipsis;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236e7196' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
}
select:disabled { cursor: default; opacity: .75; }
select[multiple], select[size] { padding-right: 11px; background-image: none; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input.num { text-align: right; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field__hint { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.field__hint.ok { color: var(--green); }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.inline-field input { width: auto; }
.form-error { color: var(--red); font-size: 13px; font-weight: 500; margin-right: auto; }

.grid-1, .grid-2, .grid-3, .grid-5 { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: 600 14px/1 var(--display); padding: 10px 15px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  color: var(--ink); background: var(--surface);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--indigo); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--indigo-ink); color: #fff; }
.btn--ghost { border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { border-color: var(--indigo-ink); color: var(--indigo-ink); }
.btn--danger-ghost { border-color: transparent; color: var(--red); background: transparent; }
.btn--danger-ghost:hover { background: var(--red-soft); }
.btn--sm { padding: 7px 11px; font-size: 13px; }
.btn--lg { padding: 13px 18px; font-size: 15px; }
.btn--block { width: 100%; justify-content: flex-start; }
.btn--block .icon:last-child:not(:first-child) { margin-left: auto; }
.signin .btn--block { justify-content: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.link-btn {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0;
  font: 600 13px var(--display); color: var(--cyan-ink); cursor: pointer;
}
.link-btn:hover { color: var(--indigo-ink); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 500 13px var(--display); text-transform: capitalize; padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.chip:hover:not(:disabled) { border-color: var(--indigo-ink); }
.chip.is-on { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.chip__n { margin-left: 5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.is-on .chip__n { color: #c9cbef; }
.chip--alert:not(.is-on) { border-color: #f2b8c1; background: #fff5f6; color: #a8172d; }
.chip--alert:not(.is-on) .chip__n { color: #a8172d; }
.due { white-space: nowrap; font-size: 13.5px; color: var(--ink-2); }
.due--late { color: #a8172d; font-weight: 700; }
.due--paid { color: var(--green); font-weight: 600; }
.bal--done { color: var(--muted); }
.bal--late { color: #a8172d; font-weight: 600; }

.badge {
  display: inline-block; font: 600 11px/1 var(--display); text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 8px; border-radius: 6px; vertical-align: middle;
}
.badge--grey { background: #eceef6; color: var(--ink-2); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--red { background: var(--red-soft); color: var(--red); }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  display: flex; flex-direction: column; padding: 20px 14px 14px;
  background: var(--indigo-deep);
  color: #c9cbef; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; color: #fff; }
.brand:hover { color: #fff; }
.brand img { border-radius: 9px; }
.brand__type { display: flex; flex-direction: column; line-height: 1.05; }
.brand__type strong { font-weight: 800; letter-spacing: .14em; font-size: 15px; }
.brand__type span { font-size: 9.5px; letter-spacing: .26em; opacity: .7; margin-top: 3px; }
.brand--dark { color: var(--indigo); }
.brand--dark:hover { color: var(--indigo); }
.brand--sm { padding: 0; }
.brand--sm .brand__type strong { font-size: 13px; }
.brand--sm .brand__type span { font-size: 8px; }

.nav-group { margin-bottom: 14px; }
.nav-group__title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #8487bd; padding: 6px 10px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px;
  color: #c9cbef; font-weight: 500; font-size: 14px;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.is-active { background: #1f2050; color: #fff; box-shadow: inset 2px 0 0 var(--cyan); }
.nav-link.is-active .icon { color: var(--cyan); }
.sidebar__user {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.sidebar__user strong { display: block; color: #fff; font-size: 13.5px; }
.sidebar__user .small { color: #8f92c4; }
.sidebar__user .icon-btn { color: #9a9dd0; }
.sidebar__user .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--cyan); color: var(--indigo-deep); font-weight: 700; font-size: 13px;
}

.main { margin-left: var(--sidebar); min-width: 0; }
.topbar { display: none; }
.scrim { display: none; }

.page { max-width: 1240px; margin: 0 auto; padding: 30px clamp(16px, 3vw, 40px) 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 27px; font-weight: 700; }
.page-head__sub { margin: 4px 0 0; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.section-title { font-size: 16px; margin: 28px 0 12px; }

/* ---------- cards, tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.pad { padding: 18px 20px; }
.card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.stack { display: flex; flex-direction: column; gap: 10px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.table th.num { text-align: right; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot th { border-top: 1px solid var(--line-2); border-bottom: 0; color: var(--ink); font-size: 13px; }
/* files attached to a document, customer or supplier; files can be dropped on the card */
.files.is-over { outline: 2px dashed var(--cyan); outline-offset: -6px; background: var(--cyan-soft); }
.files__empty { margin: 4px 0 0; }
.files__list { list-style: none; margin: 8px 0 0; padding: 0; }
.files__list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.files__thumb { flex: none; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; text-decoration: none; }
.files__thumb img { width: 100%; height: 100%; object-fit: cover; }
.files__ext { font: 700 10px/1 var(--mono); text-transform: uppercase; color: var(--indigo-ink); }
.files__main { flex: 1; min-width: 0; }
.files__name { display: block; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Delivery & invoicing: per item, its name (two lines at most) and a short bar each for delivered and invoiced */
.fulfil__of { margin: -2px 0 6px; }
.fulfil { list-style: none; margin: 0; padding: 0; }
.fulfil li { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 5px; }
.fulfil li:first-child { border-top: 0; padding-top: 4px; }
.fulfil__name { font-weight: 600; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fulfil__bar { display: grid; grid-template-columns: 66px minmax(40px, 1fr) auto; align-items: center; gap: 8px; font-size: 12.5px; }
.fulfil__label { color: var(--muted); }
.fulfil__track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.fulfil__track i { display: block; height: 100%; background: var(--cyan); }
.fulfil__bar.is-done .fulfil__track i { background: var(--green); }
.fulfil__bar.is-over .fulfil__track i { background: var(--amber); }
.fulfil__bar.is-over .fulfil__n { color: var(--amber); }
.fulfil__n { white-space: nowrap; text-align: right; }
.fulfil__note { padding-left: 74px; margin-top: -3px; }
.btn--wrap { white-space: normal; text-align: left; line-height: 1.3; }

/* an on/off switch */
.switch { flex: none; width: 38px; height: 22px; border-radius: 11px; border: 0; padding: 0; background: var(--line-2); position: relative; cursor: pointer;
  transition: background .15s ease; }
.switch span { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(21, 22, 58, .25);
  transition: transform .15s ease; }
.switch.is-on { background: var(--green); }
.switch.is-on span { transform: translateX(16px); }
.switch:disabled { opacity: .55; cursor: default; }
.switch:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Integrations: a catalogue of tiles (search, category filters), each opening its settings panel */
.integ-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.integ-bar .search { flex: 1 1 240px; max-width: 360px; }
.integ-sum { margin: -4px 0 14px; }
.integ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.integ-cat { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
.integ-cat:first-of-type { margin-top: 6px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
  display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile__head { display: flex; align-items: flex-start; gap: 12px; }
.tile__icon { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.meter-bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 12px; }
.meter-bar i { display: block; height: 100%; background: var(--cyan-ink); border-radius: 6px; }
.meter-bar.is-warn i { background: var(--amber); }
.tile__icon--logo { background: var(--surface); border: 1px solid var(--line); }
.tile__icon.is-violet { background: var(--violet); } .tile__icon.is-indigo { background: var(--indigo-ink); }
.tile__icon.is-cyan { background: var(--cyan-ink); } .tile__icon.is-green { background: var(--green); } .tile__icon.is-blue { background: var(--blue); }
.tile__title { flex: 1; min-width: 0; }
.tile__title strong { display: block; font-size: 15px; }
.tile__title span { font-size: 12.5px; color: var(--muted); }
.tile__blurb { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile__foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; }
.tile__state { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tile__state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tile__state.is-active { color: var(--green); } .tile__state.is-off { color: var(--muted); } .tile__state.is-setup { color: var(--amber); }
.tile__detail { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-sec { padding: 14px 0; border-top: 1px solid var(--line); }
.panel-sec:first-child { border-top: 0; padding-top: 0; }
.panel-sec h3 { font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.panel-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.key-chip { font: 600 13px var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; font-family: var(--mono); }

/* reading a scanned invoice; what to check on a draft read by AI; the Integrations page */
/* invoice scans: a panel in the corner while they're read in the background */
.scan-tray { position: fixed; z-index: 42; right: 18px; bottom: 18px; width: min(360px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .2s ease; }
.scan-tray__head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; background: var(--indigo-deep); color: #fff; border: 0; font: inherit; text-align: left; cursor: pointer; }
.scan-tray__head .muted { color: #b9bbe0; }
.scan-tray__list { list-style: none; margin: 0; padding: 4px 0; max-height: min(320px, 50vh); overflow-y: auto; }
.scan-tray__foot { display: flex; justify-content: flex-end; padding: 6px 14px 10px; border-top: 1px solid var(--line); }
.scan-job { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.scan-job + .scan-job { border-top: 1px solid var(--line); }
.scan-job__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.scan-job__main strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-job__mark { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.scan-job.is-failed .scan-job__mark { background: var(--red-soft); color: var(--red); }
.scan-job.is-done { animation: scan-done .5s ease; }
.scan-job__bar { position: relative; height: 3px; margin-top: 5px; border-radius: 3px; background: var(--cyan-soft); overflow: hidden; }
.scan-job__bar i { position: absolute; top: 0; bottom: 0; left: 0; width: 35%; border-radius: 3px; background: var(--cyan); animation: scan-bar 1.6s ease-in-out infinite; }
/* a page with lines of text and a beam passing over it */
.scan-doc { flex: none; position: relative; width: 24px; height: 30px; border: 2px solid var(--indigo-ink); border-radius: 4px; background: var(--surface); overflow: hidden; }
.scan-doc::before { content: ""; position: absolute; left: 4px; top: 5px; width: 12px; height: 2px; border-radius: 1px; background: var(--line-2); box-shadow: 0 5px 0 var(--line-2), 0 10px 0 var(--line-2), 0 15px 0 var(--line-2); }
.scan-doc i { position: absolute; left: -2px; right: -2px; top: 0; height: 2px; background: var(--cyan); box-shadow: 0 0 0 1px var(--cyan-soft); animation: scan-beam 1.4s ease-in-out infinite alternate; }
.scan-doc--sm { width: 16px; height: 20px; border-color: #fff; background: transparent; }
.scan-doc--sm::before { left: 3px; top: 4px; width: 7px; height: 1.5px; background: #8a8cc0; box-shadow: 0 4px 0 #8a8cc0, 0 8px 0 #8a8cc0; }
@keyframes scan-beam { from { transform: translateY(1px); } to { transform: translateY(24px); } }
.scan-doc--sm i { animation-name: scan-beam-sm; }
@keyframes scan-beam-sm { from { transform: translateY(1px); } to { transform: translateY(15px); } }
@keyframes scan-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
@keyframes scan-done { 0% { background: var(--green-soft); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  .scan-doc i { animation: none; top: 45%; }
  .scan-job__bar i { animation: none; width: 100%; opacity: .5; }
  .scan-job.is-done, .scan-tray { animation: none; }
}
@media (max-width: 760px) {
  .scan-tray { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  body:has(.action-bar) .scan-tray { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .scan-tray:not(.is-open) { width: auto; }
  .menu-open .scan-tray { display: none; }
}
.scan-notice { border-left: 3px solid var(--amber); }
.scan-notice__list { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; }
.scan-notice__list li { margin: 3px 0; }
.integ .card-title { gap: 8px; }
.integ__setup { background: var(--amber-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0 12px; }
.integ__setup ol { margin: 6px 0 0; padding-left: 18px; }
.integ__setup li { margin: 3px 0; }
.integ__limit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.integ__limit input { width: 90px; }
.stats--row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
.stats--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* a cheque's state and its next steps, under a payment line */
.cheque-tag { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }

/* a small table inside a side card */
.table--tight th, .table--tight td { padding: 7px 6px; }
.table--tight th:first-child, .table--tight td:first-child { padding-left: 0; }
.table--tight th:last-child, .table--tight td:last-child { padding-right: 0; }
.table--tight th { background: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f6f8ff; }
.row-actions { white-space: nowrap; text-align: right; width: 1%; }
.row-actions .icon-btn { opacity: .55; }
tr:hover .row-actions .icon-btn { opacity: 1; }

.empty { text-align: center; padding: 50px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); }
.empty__bits { font-size: 12px; letter-spacing: .4em; color: var(--cyan); margin-bottom: 10px; }
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0 0 16px; }
.error-box { background: var(--red-soft); color: var(--red); padding: 14px 16px; border-radius: var(--radius-sm); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.spinner {
  width: 28px; height: 28px; margin: 60px auto; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--cyan); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot, .boot-error { min-height: 100vh; display: grid; place-items: center; }
.boot-error { grid-auto-flow: row; align-content: center; gap: 12px; padding: 16px; text-align: center; color: var(--ink-2); }

/* shown while the device has no internet: across the top of the page (beside the sidebar), at the bottom on phones */
.offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 35; padding: 9px 16px; text-align: center; font-size: 13.5px;
  background: var(--amber-soft); color: var(--amber); border-bottom: 1px solid #f3dcb8;
}
.offline-bar strong { font-weight: 700; }
.offline-bar { animation: bar-in .2s ease-out backwards; }
.offline-bar.is-leaving { animation: bar-out .16s ease-in forwards; }
@keyframes bar-in { from { transform: translateY(var(--bar-from, -100%)); } }
@keyframes bar-out { to { transform: translateY(var(--bar-from, -100%)); opacity: 0; } }
.shell + .offline-bar { left: var(--sidebar); }
body.is-offline .main { padding-top: 38px; }

.load-more { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 16px 0 4px; }

/* ---------- dashboard ---------- */
.quick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.quick__btn {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.quick__btn:hover { border-color: var(--cyan); color: var(--ink); transform: translateY(-1px); }
.quick__btn strong { display: block; font-size: 13.5px; line-height: 1.25; }
.quick__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--cyan-soft); color: var(--cyan-ink); flex: none; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats--stack { grid-template-columns: 1fr; margin: 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stat > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat strong { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; }
.stat em { font-style: normal; }
.stat em a { color: inherit; text-decoration: underline; text-decoration-color: transparent; }
.stat em a:hover { text-decoration-color: currentColor; }
.stat__cur { font-family: var(--display); font-size: 12px; font-weight: 700; letter-spacing: .02em; margin-right: 6px; color: var(--muted); }
.stat--accent .stat__cur { color: #b9bbec; }
.stat--accent .stat__late { color: #ffc2cb; font-weight: 700; }
.late-chip { flex: none; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: var(--amber-soft); color: #8a4d00; }
.late-chip--long { background: var(--red-soft); color: #a8172d; }
.stat--accent { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.stat--accent > span, .stat--accent em { color: #b9bbec; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li + li { border-top: 1px solid var(--line); }
.recent a { display: flex; align-items: center; gap: 12px; padding: 10px 2px; color: var(--ink); }
.recent a:hover { color: var(--indigo-ink); }
.recent__icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--bg); color: var(--indigo-ink); flex: none; }
.recent__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.recent__main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent__amt { font-size: 13.5px; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 6px; }
.chart__col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.chart__bar { width: 100%; max-width: 26px; border-radius: 5px 5px 2px 2px; background: var(--cyan); }
.chart__lbl { font-size: 10.5px; color: var(--muted); }

.onboarding h2 { font-size: 18px; margin-bottom: 8px; }
.onboarding ol { margin: 0; padding-left: 20px; line-height: 2; }

/* ---------- detail page ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; font-size: 13px; }
.kv dd { margin: 0; }

/* ---------- document editor ---------- */
.editor-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.editor-bottom { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; margin-top: 16px; align-items: start; }

.lines { --cols: 34px minmax(220px, 1fr) 76px 80px 110px 74px 70px 120px 100px; }

.lines__head, .lines__row { display: grid; grid-template-columns: var(--cols); gap: 8px; align-items: start; padding: 0 14px; }
.lines__head.lines--plain, .lines__row.lines--plain { grid-template-columns: 34px minmax(220px, 1fr) 80px 80px minmax(150px, 220px) 100px; }
.lines__section {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--cyan-soft); color: var(--cyan-ink);
}
.lines__section input { font-weight: 700; color: var(--indigo); background: #fff; }
.lines__heading { flex: 1; min-width: 0; }
.lines__section .icon-btn { color: var(--cyan-ink); }
.page-note { max-width: 760px; margin: -6px 0 16px; line-height: 1.55; }
.page-note .icon { vertical-align: -2px; }
.tpl-tag { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--cyan-soft);
  color: var(--cyan-ink); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.lines__serial textarea { min-height: 38px; field-sizing: content; max-height: 200px; font-size: 13px; }
.lines__head {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding-top: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.lines__row { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.lines__row input, .lines__row textarea { padding: 8px 9px; }
.lines__no { padding-top: 9px; color: var(--muted); font-size: 13px; }
.lines__amt { padding-top: 9px; font-weight: 600; }
.lines__tools { display: flex; gap: 0; justify-content: flex-end; padding-top: 2px; }
.lines__tools .icon-btn { width: 28px; height: 30px; }
.lines__desc textarea { min-height: 38px; field-sizing: content; max-height: 220px; }
.lines__foot { display: flex; align-items: center; gap: 14px; padding: 12px 14px; flex-wrap: wrap; }

.combo { position: relative; }
.combo__list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 5px;
  list-style: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: 0 12px 34px rgba(21, 22, 58, .16); max-height: 300px; overflow-y: auto;
}
.combo__list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.combo__list li.is-active { background: var(--cyan-soft); }
.combo__row { display: flex; justify-content: space-between; gap: 12px; }

.totals-card .tot-input { width: 140px; }
.tot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.tot-disc { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.tot-disc .link-btn { font-size: inherit; }
.tot-row--round { flex-wrap: wrap; background: var(--cyan-soft); margin: 2px -10px; padding: 6px 10px; border-radius: var(--radius-sm); font-size: 13.5px; color: var(--ink-2); }
.tot-row--round label { white-space: nowrap; }
.tot-row--round .tot-target { margin-left: auto; }
.tot-target { display: flex; gap: 6px; align-items: center; }
.tot-target input { width: 108px; }
.tot-row--grand { border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 12px; font-weight: 700; font-size: 17px; }
.sticky-save {
  position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 18px -12px 0; padding: 12px; background: var(--bg); border-top: 1px solid var(--line-2);
}
/* the running total, always in view while editing */
.sticky-save__sum { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-right: auto; font-size: 13px; color: var(--muted); }
.sticky-save__sum .mono { color: var(--ink); }
.sticky-save__total { font-size: 15px; font-weight: 700; color: var(--ink); }

/* ---------- document view ---------- */
.view-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.paper-scroll { overflow-x: auto; padding-bottom: 6px; }
.view-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; }
.pay-list, .rel-list, .user-list { list-style: none; margin: 10px 0 0; padding: 0; }
.pay-list li, .user-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.user-list li { justify-content: flex-start; }
.user-list { margin: 0 0 12px; }
.user-list li:first-child { border-top: 0; }
.user-list li.is-off .avatar { background: var(--line-2); color: var(--muted); }
.users__sum { margin: 0 0 8px; }
.users__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.users__bar .search { flex: 1 1 180px; }
.rel-list li a { display: flex; flex-direction: column; padding: 7px 0; }
.rel-list li + li { border-top: 1px solid var(--line); }

/* ---------- settings ---------- */
.settings { display: flex; flex-direction: column; gap: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.settings-grid form .btn { margin-top: 14px; }
.settings-grid .form-error { margin-top: 10px; }

/* ---------- modal & toasts ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(12, 13, 38, .5); backdrop-filter: blur(3px); animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: 620px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal--wide { max-width: 900px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal__head h2 { font-size: 19px; }
.modal__body { padding: 18px 22px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
.modal__foot-left { display: flex; gap: 8px; margin-right: auto; }
.modal__left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toasts { position: fixed; z-index: 200; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--indigo-deep); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: pop .2s ease; max-width: min(90vw, 480px); }
.toast--err { background: var(--red); }

/* ---------- phone-only / desktop-only pieces ---------- */
.phone-only { display: none !important; }
@media (max-width: 600px) {
  .phone-only { display: revert !important; }
  .desktop-only { display: none !important; }
}

/* ---------- open in: full page or side peek ---------- */
.toolbar .open-in { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button { all: unset; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.is-on { background: var(--indigo); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.table tr.is-peek td { background: var(--cyan-soft); }
.table tr.is-peek td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }

/* the peek: a column on the right of a wide screen (the page makes room), over the page on a tablet,
   a sheet from the bottom on a phone */
.peek {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 45; width: 460px; max-width: 92vw;
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line-2);
  box-shadow: -12px 0 30px rgba(21, 22, 58, .08); animation: peek-in .2s cubic-bezier(.2, .7, .2, 1) backwards;
}
@keyframes peek-in { from { opacity: 0; transform: translateX(16px); } }
.peek-scrim { display: none; }
@media (min-width: 1101px) { body.has-peek .main { margin-right: 460px; } }
.peek__head { display: flex; align-items: center; gap: 4px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.peek__title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.peek__title strong { font-size: 17px; }
.peek__body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.peek__money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.peek__money > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.peek__money span { font-size: 11.5px; color: var(--muted); }
.peek__money strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.peek__status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.peek__body .paper-scroll { border-radius: var(--radius-sm); background: var(--bg); padding: 10px 0; }
.peek__foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); }
.peek__keys { margin-left: auto; }
@media (max-width: 1100px) { .peek__keys { display: none; } }
@media (max-width: 600px) {
  .peek-scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(12, 13, 38, .45); }
  .peek { top: auto; left: 0; width: auto; max-width: none; height: 82vh; border-left: 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 30px rgba(21, 22, 58, .14); animation-name: sheet-in; }
  .peek__head .btn { padding: 6px 10px; font-size: 13px; }
  .peek__foot .btn { flex: 1; min-height: 44px; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(40px); } }

/* ---------- phones ---------- */
@media (max-width: 600px) {
  /* typing never zooms the page on an iPhone (it does below 16 px) */
  input, textarea, select { font-size: 16px !important; }

  /* dashboard: money first, the "New" buttons in one row you swipe, nothing wider than the screen */
  main .dash-grid, main .editor-top, main .editor-bottom, main .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .page--dash { display: flex; flex-direction: column; }
  .page--dash > .stats { order: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page--dash > .quick { order: 2; display: flex; overflow-x: auto; gap: 8px; margin: 0 -16px 18px; padding: 2px 16px 6px; scrollbar-width: none; }
  .page--dash > .quick::-webkit-scrollbar { display: none; }
  .page--dash > .dash-grid, .page--dash > .onboarding { order: 3; }
  .page--dash .quick__btn { flex: none; padding: 10px 14px; border-radius: 99px; }
  .page--dash .quick__icon, .page--dash .quick__btn .muted { display: none; }
  .page--dash .stat--accent { order: -1; grid-column: 1 / -1; }
  .page--dash .stat:not(.stat--accent) strong { font-size: 16px; }
  .page--dash .stat:not(.stat--accent) .stat__cur { display: none; }
  .recent__main { min-width: 0; }

  /* lists: one card per row, what it is on the left, the amount (and when it's due) on the right */
  .table--cards, .table--cards tbody { display: block; }
  .table--cards thead { display: none; }
  .table--cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px; align-items: start;
    padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table--cards tbody tr:last-child { border-bottom: 0; }
  .table--cards td { display: block; padding: 0 !important; border: 0 !important; min-width: 0; background: none !important; box-shadow: none !important; }
  .table--cards td.hide-sm, .table--cards .row-actions { display: none; }
  .table--cards td:first-child { grid-column: 1; grid-row: 1; }
  .table--cards td.num { grid-column: 2; grid-row: 1; text-align: right; }
  .table--cards td.num ~ td.num { grid-row: 2; }
  .table--cards td:not(:first-child):not(.num):not(.c-side) { grid-column: 1; font-size: 13px; color: var(--ink-2); }
  .table--cards td.c-side { grid-column: 2; grid-row: 2; text-align: right; }
  .table--cards td.c-party > div { display: none; }
  .table--cards tr.clickable:hover { background: #f6f8ff; }
  .table--cards tr.is-last, .table--cards tr.is-peek { background: var(--cyan-soft); box-shadow: inset 3px 0 0 var(--cyan); }
  .tel-link { color: var(--indigo-ink); font-weight: 500; }
  .toolbar .open-in { order: 3; }

  /* a document: figures and the page thumbnail first, the main actions in a bar at the bottom */
  .page--view { padding-bottom: 96px; }
  .page--view .view-grid > .paper-scroll { display: none; }
  .doc-summary { display: flex !important; flex-direction: column; gap: 10px; margin-bottom: 14px; }
  .doc-summary__paper { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
  .doc-summary__paper strong { display: block; }
  .doc-summary__thumb { width: 54px; height: 76px; flex: none; background: #fff; box-shadow: 0 1px 4px rgba(21, 22, 58, .2); padding: 6px 5px; display: flex; flex-direction: column; gap: 4px; }
  .doc-summary__thumb i { display: block; height: 3px; background: var(--line-2); border-radius: 2px; }
  .doc-summary__thumb i:first-child { background: var(--indigo); }
  .doc-summary__thumb i:nth-child(2) { height: 6px; margin-top: 6px; background: var(--blue); }
  .action-bar { display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line-2); }
  .action-bar .btn { flex: 1; justify-content: center; min-height: 44px; }
  .action-bar .action-bar__more { flex: none; width: 48px; font-size: 18px; }
  .stepper .btn { min-width: 40px; justify-content: center; }

  /* the line editor: qty × rate = amount on one row, unit / discount / VAT folded away, a ⋯ menu per line */
  .lines__row:not(.lines--plain) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 44px;
    grid-template-areas: "desc desc desc more" "qty rate amt amt" "extra extra extra extra" "unit disc vat vat"; }
  .lines__row:not(.lines--plain) .lines__desc { grid-area: desc; }
  .lines__row:not(.lines--plain) .lines__more { grid-area: more; }
  .lines__row:not(.lines--plain) .c-qty { grid-area: qty; }
  .lines__row:not(.lines--plain) .c-rate { grid-area: rate; }
  .lines__row:not(.lines--plain) .lines__amt { grid-area: amt; text-align: right; align-self: end; padding-bottom: 10px; }
  .lines__row:not(.lines--plain) .lines__extra { grid-area: extra; }
  .lines__row:not(.lines--plain) .c-unit { grid-area: unit; }
  .lines__row:not(.lines--plain) .c-disc { grid-area: disc; }
  .lines__row:not(.lines--plain) .c-vat { grid-area: vat; }
  .lines__row:not(.lines--plain):not(.is-expanded) :is(.c-unit, .c-disc, .c-vat) { display: none; }
  .lines__row .lines__tools { display: none; }
  .lines__more { all: unset; box-sizing: border-box; width: 44px; height: 44px; display: grid !important; place-items: center; align-self: end;
    border: 1px solid var(--line); border-radius: 10px; font-size: 18px; color: var(--ink-2); cursor: pointer; }
  .lines--plain .lines__more { position: absolute; top: 6px; right: 10px; width: 36px; height: 36px; }
  .lines__extra { all: unset; font-size: 13px; color: var(--indigo-ink); cursor: pointer; padding: 4px 0; }
  .lines__menu { position: absolute; right: 12px; top: 64px; z-index: 5; display: flex; flex-direction: column; min-width: 180px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 30px rgba(21, 22, 58, .16); }
  .lines__menu button { all: unset; padding: 12px; border-radius: 8px; font-size: 15px; cursor: pointer; }
  .lines__menu button:disabled { opacity: .4; }
  .lines__menu button:not(:disabled):active { background: var(--surface-2); }
  .lines__section .icon-btn { width: 40px; height: 40px; }
  .sticky-save { flex-wrap: nowrap; }
  .sticky-save__sum { flex-direction: column; gap: 0; }
  .sticky-save__phone { position: relative; }
  .save-menu { position: absolute; right: 0; bottom: calc(100% + 8px); display: flex; flex-direction: column; min-width: 230px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 30px rgba(21, 22, 58, .16); }
  .save-menu button { all: unset; padding: 12px; border-radius: 8px; font-size: 15px; cursor: pointer; }
}

/* ---------- wide peek: menu folded to icons, a slim list, the document page beside it ---------- */
@media (min-width: 1101px) {
  body.has-wide .sidebar { width: 68px; padding: 16px 10px 12px; }
  body.has-wide .main { margin-left: 68px; }
  body.has-wide .sidebar .brand__type, body.has-wide .nav-group__title, body.has-wide .nav-link span,
  body.has-wide .sidebar__user .grow { display: none; }
  body.has-wide .brand { justify-content: center; padding: 0 0 18px; }
  body.has-wide .nav-link { justify-content: center; padding: 10px 0; }
  body.has-wide .sidebar__user { flex-direction: column; gap: 8px; }
}
.wide-layout { display: flex; align-items: flex-start; min-height: 100vh; }
.wide-list { position: sticky; top: 0; width: 300px; height: 100vh; flex: none; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); }
.wide-list__head { display: flex; flex-direction: column; gap: 10px; padding: 18px 14px 12px; }
.wide-list__head strong { font-size: 18px; font-weight: 800; }
.wide-list__head .search { flex: none; }
.wide-list__rows { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
.wide-row { all: unset; box-sizing: border-box; width: 100%; display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px;
  border-top: 1px solid var(--line); cursor: pointer; }
.wide-row:hover { background: #f6f8ff; }
.wide-row.is-on { background: var(--cyan-soft); box-shadow: inset 3px 0 0 var(--cyan); }
.wide-row:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.wide-row__main, .wide-row__side { display: flex; flex-direction: column; min-width: 0; }
.wide-row__main strong { font-size: 13.5px; font-weight: 600; }
.wide-row__main .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide-row__side { flex: none; text-align: right; font-size: 13px; }
.wide-list__foot { padding: 10px 14px; border-top: 1px solid var(--line); }
.wide-doc { flex: 1; min-width: 0; animation: wide-in .22s cubic-bezier(.2, .7, .2, 1) backwards; }
.wide-doc .page { max-width: none; }
@keyframes wide-in { from { opacity: 0; transform: translateX(24px); } }
@media print { .wide-list { display: none !important; } .wide-layout { display: block; } }

/* the A4 page full size on a phone: scroll and pinch to read it */
.paper-full { position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column; background: var(--bg); }
.paper-full__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line-2); }
.paper-full__body { flex: 1; overflow: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.paper-full__body .paper { box-shadow: 0 1px 4px rgba(21, 22, 58, .15); }
@media print { .paper-full, .peek, .peek-scrim, .action-bar { display: none !important; } }

/* ---------- coming back to a list ---------- */
/* the document just come back from: tinted, a cyan bar on its left edge and a "Just viewed" tag */
.table tr.is-last td { background: var(--cyan-soft); animation: last-glow 1.2s ease-out; }
.table tr.is-last td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }
.table tr.is-last:hover td { background: #d6f2fa; }
@keyframes last-glow { from { background-color: #c2ebf6; } }
.just-tag { display: inline-block; margin-left: 8px; font-family: var(--display); font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--cyan-ink); background: var(--surface); border: 1px solid #9fdcec; border-radius: 99px; padding: 2px 8px; vertical-align: 1px; }
/* Newer / Older on a document page */
.stepper { display: flex; align-items: center; gap: 6px; margin-right: 6px; }
.stepper__pos { min-width: 64px; text-align: center; white-space: nowrap; }

/* ---------- activity log ---------- */
.log-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.log-filters .search { flex: 2 1 260px; }
.log-filters select { flex: 1 1 170px; min-height: 40px; padding: 8px 34px 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background-color: var(--surface); font: inherit; font-size: 14px; color: var(--ink); max-width: 100%; }
.log-periods { margin: -4px 0 18px; align-items: center; }
.log-day { margin-bottom: 18px; }
.log-day__title { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--ink-2); margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
.log-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.log-entry + .log-entry { border-top: 1px solid var(--line); }
.log-row { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; cursor: pointer; }
.log-row:hover { background: var(--surface-2); }
.log-row:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.log-entry.is-open > .log-row { background: var(--surface-2); }
.log-time { flex: none; width: 44px; font-size: 12.5px; color: var(--muted); padding-top: 3px; }
.avatar--sm { width: 26px; height: 26px; font-size: 12px; flex: none; }
.log-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.log-line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; }
.log-summary { font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.log-row > .icon { flex: none; color: var(--muted); margin-top: 4px; }
.log-chev-space { width: 16px; flex: none; }
.log-detail { padding: 4px 16px 16px 72px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.log-diff { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.log-diff th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.log-diff td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.log-diff td:first-child { width: 22%; color: var(--ink-2); font-weight: 600; }
.log-detail del, .log-chg del { color: #a8172d; background: var(--red-soft); text-decoration: line-through; padding: 0 3px; border-radius: 3px; }
.log-detail ins, .log-chg ins { color: var(--green); background: var(--green-soft); text-decoration: none; padding: 0 3px; border-radius: 3px; }
.log-lines { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.log-lines > strong { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.log-line { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 5px 9px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
.log-line--add { color: var(--green); border-color: #bfe6d6; background: var(--green-soft); }
.log-line--del { color: #a8172d; border-color: #f2c4cb; background: var(--red-soft); }
.log-chg { color: var(--ink-2); }
.log-snap { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.log-snap dt { color: var(--muted); }
.log-snap dd { margin: 0; overflow-wrap: anywhere; }
.log-meta a { font-weight: 600; }
.log-list--compact .log-row { padding: 10px 2px; }
.log-list--compact .log-detail { padding: 4px 2px 12px; background: transparent; }
.log-list--compact .log-summary { font-size: 13px; }
.history-card .link-btn { margin-top: 8px; }
.party-history { margin-top: 18px; max-width: 720px; }
@media (max-width: 600px) { .log-detail { padding-left: 16px; } .log-time { width: 38px; } .log-diff td:first-child { width: 30%; } }

/* ---------- motion ----------
   Short (120–240 ms), ease-out, moves 8 px at most, plays once (only the loading rows repeat, while waiting),
   flat colours. Switched off for reduced motion and on paper (end of file). */
.route { animation: enter .18s cubic-bezier(.2, .7, .2, 1) backwards; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.table-wrap { animation: fade .16s ease-out backwards; }

.spinner-space { height: 148px; }
.skeleton-space { min-height: 240px; }
.skeleton { overflow: hidden; animation: fade .16s ease-out backwards; }
.skeleton__row { display: flex; align-items: center; gap: 18px; padding: 15px 14px; border-bottom: 1px solid var(--line); }
.skeleton__row:last-child { border-bottom: 0; }
.bone { display: block; height: 12px; border-radius: 6px; background: #e6e8f2; animation: pulse 1.2s ease-in-out infinite; }
.skeleton__end { width: 70px; margin-left: auto; }
@keyframes pulse { 50% { opacity: .5; } }

.chart__bar { transform-origin: bottom; animation: grow .52s cubic-bezier(.2, .7, .2, 1) backwards; }
@keyframes grow { from { transform: scaleY(0); } }

.combo__list { animation: drop .12s ease-out backwards; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }

/* a still copy of a closing dialog (ui.js Modal) */
.modal-backdrop.is-leaving { animation: fade-out .12s ease-in forwards; pointer-events: none; }
.modal-backdrop.is-leaving .modal { animation: sink .12s ease-in forwards; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sink { to { opacity: 0; transform: translateY(6px) scale(.98); } }
.toast.is-leaving { animation: toast-out .2s ease-in forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.lines__row.is-new, .lines__section.is-new { animation: row-in .18s ease-out backwards, flash 1.1s ease-out; }
@keyframes row-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes flash { from { background-color: var(--cyan-soft); } }
.lines__row.is-leaving, .lines__section.is-leaving { animation: row-out .14s ease-in forwards; pointer-events: none; }
@keyframes row-out { to { opacity: 0; transform: translateX(8px); } }

.badge.is-changed { animation: settle .22s cubic-bezier(.2, .7, .2, 1) backwards; }
@keyframes settle { from { opacity: 0; transform: scale(.88); } }

/* ---------- sign in ---------- */
.signin { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.signin__art { position: relative; overflow: hidden; background: var(--indigo-deep); }
.signin__bits {
  position: absolute; inset: -20px; font-size: 22px; line-height: 1.6; letter-spacing: .5em; word-break: break-all;
  color: #262863;
}
.signin__card { align-self: center; justify-self: center; width: 100%; max-width: 400px; padding: 32px 24px; display: flex; flex-direction: column; gap: 14px; }
.signin__card .brand { padding: 0 0 18px; }
.signin__card h1 { font-size: 26px; }
.signin__card > p { margin: -6px 0 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1300px) {
  .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-grid { grid-template-columns: 1fr; }
  .view-side { position: static; }
  .lines { --cols: 30px minmax(180px, 1fr) 64px 70px 96px 64px 60px 104px 92px; }
}
@media (max-width: 900px) {
  .shell + .offline-bar { left: 0; top: auto; bottom: 0; border-bottom: 0; border-top: 1px solid #f3dcb8; --bar-from: 100%; }
  body.is-offline .main { padding-top: 0; padding-bottom: 38px; }
  body.is-offline .toasts { bottom: 56px; }
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
  .menu-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform .25s ease; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(12, 13, 38, .4); }
  .main { margin-left: 0; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    padding: 10px 12px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  }
  .page { padding-top: 20px; }
  .editor-top, .editor-bottom, .dash-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .signin { grid-template-columns: 1fr; }
  .signin__art { display: none; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* line items become stacked cards */
  .lines__head { display: none; }
  .lines__row, .lines__row.lines--plain {
    grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 14px; position: relative;
  }
  .lines__no { position: absolute; top: 6px; left: 14px; padding: 0; font-size: 11px; }
  .lines__desc { grid-column: 1 / -1; margin-top: 12px; }
  .lines__amt { grid-column: span 2; text-align: left; }
  .lines__tools { grid-column: span 2; }
  .lines__row input::placeholder { color: var(--muted); }
}
@media (max-width: 600px) {
  .page-head h1 { font-size: 22px; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .hide-sm { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .table td, .table th { padding: 10px; }
  .clip { max-width: 160px; }
  .lines__row, .lines__row.lines--plain { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.lines__cell { display: block; min-width: 0; }
.lines__mlabel { display: none; }
@media (max-width: 900px) {
  .lines__mlabel { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
  .lines__amt, .lines__tools { align-self: end; }
}
@media (max-width: 600px) {
  .lines__amt, .lines__tools { grid-column: span 1; }
}

@media (max-width: 900px) {
  .lines__serial { grid-column: 1 / -1; }
}
.num-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr) 120px 150px; gap: 8px 14px; align-items: center; margin-top: 12px; }
@media (max-width: 700px) {
  .num-grid { grid-template-columns: 1fr 1fr; }
  .num-grid > .field__label { display: none; }
  .num-grid > strong { grid-column: 1 / -1; margin-top: 8px; }
}

/* ---------- phone with country code ---------- */
.phone { display: flex; min-width: 0; }
.phone__cc { position: relative; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 10px;
  border: 1px solid var(--line-2); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--surface-2); color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.phone__cc::after { content: ""; width: 7px; height: 7px; margin: -4px 0 0 1px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.phone__cc select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; padding: 0; }
.phone__cc:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(76, 201, 230, .22); z-index: 1; }
.phone > input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; flex: 1; }
fieldset:disabled .phone__cc { cursor: default; }

/* ---------- purchasing (quotation → purchase orders) ---------- */
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--cyan); border-radius: inherit; transition: width .3s; }
.meter__label { margin: 6px 0 10px; }
.po-list a { display: flex; flex-direction: column; gap: 2px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; cursor: pointer; font-size: 14px; }
.check-row input, .po-chk input { width: 16px; height: 16px; padding: 0; margin: 2px 0 0; flex: none; accent-color: var(--indigo); }
.po-pick { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; max-height: 46vh; overflow: auto; }
.po-pick .po-chk { width: 34px; }
.po-pick td { vertical-align: top; }
.po-pick tr.is-off td:not(.po-chk) { opacity: .5; }
.po-sec td { background: var(--cyan-soft); color: var(--cyan-ink); font-weight: 700; font-size: 13px; padding-top: 7px; padding-bottom: 7px; }
.po-desc { font-weight: 500; }
.po-warn { color: var(--amber); }
.po-qty { width: 70px; padding: 6px 8px; }
.po-rate { width: 104px; padding: 6px 8px; }
.po-sum { margin-right: auto; }
.po-pick tr.is-loss td { background: var(--red-soft); }
.po-rate.is-bad { border-color: var(--red); }
.margin-pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font: 500 12.5px var(--mono); white-space: nowrap; }
.margin-pill.is-gain { background: var(--green-soft); color: var(--green); }
.margin-pill.is-loss { background: var(--red-soft); color: var(--red); }
.loss-box { border: 1px solid #f2c2ca; background: #fff7f8; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.loss-box p { margin: 0; }
.loss-box .check-row { margin: 0; }
.loss-reason { display: flex; flex-direction: column; gap: 4px; padding-left: 26px; }

/* ---------- quotation → proforma → tax invoice steps ---------- */
.flow { list-style: none; margin: 0; padding: 0; }
.flow__step { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.flow__step:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 28px; bottom: 4px; width: 2px; background: var(--line-2); }
.flow__step.is-done:not(:last-child)::before { background: var(--green); }
.flow__dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; box-sizing: border-box; }
.is-done .flow__dot { background: var(--green); color: #fff; }
.is-next .flow__dot { border: 2px solid var(--indigo); color: var(--indigo); }
.is-locked .flow__dot { background: #eceef6; color: var(--muted); }
.flow__body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; padding-top: 2px; }
.flow__body > strong { font-size: 14.5px; }
.flow__body .btn { margin: 5px 0 2px; }
.is-locked .flow__body > strong { color: var(--ink-2); }
.flow__others { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.flow__label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.flow__btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- quotation revisions (same number, R1, R2 …) ---------- */
.rev-chip { display: inline-block; font: 600 12px var(--mono); padding: 1px 6px; border-radius: 5px; background: var(--cyan-soft); color: var(--cyan-ink); vertical-align: middle; letter-spacing: 0; }
.page-head h1 .rev-chip { font-size: 15px; padding: 2px 8px; border-radius: 6px; }
.lines__cell input.is-changed { border-color: var(--amber); background: var(--amber-soft); }
.lines__was { display: block; margin-top: 3px; font-size: 11px; color: var(--amber); text-align: right; white-space: nowrap; }
.rev-list { list-style: none; margin: 4px 0 0; padding: 0; }
.rev-item { display: flex; flex-direction: column; gap: 3px; padding: 11px 0; border-top: 1px solid var(--line); }
.rev-item:first-child { border-top: 0; }
.rev-item.is-viewing { background: var(--cyan-soft); margin: 0 -12px; padding: 11px 12px; border-radius: var(--radius-sm); border-top-color: transparent; }
.rev-item.is-viewing + .rev-item { border-top-color: transparent; }
.rev-item__head { display: flex; align-items: baseline; gap: 8px; }
.rev-item__tag { font-size: 12px; font-weight: 600; color: var(--cyan-ink); }
.rev-item__total { margin-left: auto; }
.rev-item__changes { margin: 2px 0 0; padding-left: 16px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.rev-item__link { font-weight: 600; margin-top: 2px; }
.notice--old { border-left-color: var(--amber); }
.notice--old > .icon { color: var(--amber); }

/* ---------- advance payments (proforma → tax invoice) ---------- */
.adv-tag { display: inline-block; font: 600 11.5px var(--display); padding: 1px 8px; border-radius: 99px; background: var(--cyan-soft); color: var(--cyan-ink); vertical-align: middle; }
.adv-tag--ok { background: var(--green-soft); color: var(--green); margin-left: 4px; }
.pay-pcts { display: flex; flex-direction: column; gap: 6px; }
.rcpt-link { display: inline-flex; align-items: center; gap: 3px; font: 600 12px var(--mono); vertical-align: middle; margin-left: 4px; }
.notice--inline { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin: 4px 0 12px; padding: 12px; border: 1px solid var(--line);
  border-left: 3px solid var(--cyan); border-radius: var(--radius-sm); font-size: 14px; }
.sched { margin: 4px 0 8px; }
.sched__row { display: flex; justify-content: space-between; gap: 8px; }
.sched__amt { margin-left: auto; font-weight: 500; }
.is-later .flow__dot { border: 2px solid var(--line-2); color: var(--muted); }
.sched-edit { margin-top: 16px; }
.sched-edit__rows { display: grid; grid-template-columns: minmax(0, 1fr) 90px 120px 34px; gap: 8px; align-items: center; max-width: 640px; }
.sched-edit__rows .num { text-align: right; }

/* ---------- customer tabs & statement of account ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); margin: 0 0 18px; overflow-x: auto; }
.tabs__tab { padding: 10px 14px; font-weight: 600; font-size: 14.5px; color: var(--muted); border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs__tab:hover { color: var(--ink); }
.tabs__tab.is-on { color: var(--indigo); border-bottom-color: var(--indigo); }
.stmt { display: flex; flex-direction: column; gap: 16px; }
.stmt__bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.stmt__print { margin-left: auto; }
.stmt__screen { display: flex; flex-direction: column; gap: 16px; }
.stmt__screen .stats { margin: 0; }
.stmt__open td { background: var(--surface-2); }
.stmt__buckets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stmt__bucket { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; color: var(--muted); }
.stmt__bucket strong { color: var(--ink); font-size: 15px; }
.stmt__bucket.is-late { background: var(--amber-soft); color: var(--amber); }
.stmt__bucket.is-late strong { color: var(--amber); }
.stmt__overdue { margin: 10px 0 0; padding-left: 18px; font-size: 13.5px; }
@media (max-width: 760px) { .stmt__buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stmt__print { margin-left: 0; } }

/* ---------- purchase invoices (vendor invoice entered against a PO) ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; border-left: 3px solid var(--cyan); font-size: 14px; line-height: 1.5; }
.notice > .icon { flex: none; margin-top: 2px; color: var(--cyan-ink); }
.mt-xs { margin-top: 6px; }
.ok { color: var(--green); }
.diff-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13.5px; line-height: 1.45; }
.diff { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 2px 10px; align-items: start; padding: 9px 0; }
.diff + .diff { border-top: 1px solid var(--line); }
.diff__tag { justify-self: start; margin-top: 1px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 99px; }
.diff__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.diff__main strong { overflow-wrap: anywhere; }
.diff__what { color: var(--muted); font-size: 13px; }
.diff__what .mono { color: var(--ink-2); font-size: 12.5px; }
.diff__amt { white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 1px; }
.diff__amt.is-up { color: var(--red); }
.diff__amt.is-down { color: var(--green); }
.diff--changed .diff__tag { background: var(--amber-soft); color: var(--amber); }
.diff--added .diff__tag { background: var(--blue-soft); color: var(--blue); }
.diff--missing .diff__tag { background: var(--red-soft); color: var(--red); }

/* ---------- Settings: what each role can do ---------- */
/* Users & roles */
.tabs__n { margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tabs__n.is-alert { color: var(--amber); }
.users__role { width: auto; min-width: 140px; }
.people li { padding: 0; }
.people__row { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 6px; cursor: pointer; border-radius: var(--radius-sm); }
.people__row:hover { background: var(--surface-2); }
.people__row:focus-visible { outline: 2px solid var(--cyan); }
.people__row > .icon { color: var(--muted); flex: none; }
.people__who { display: flex; flex-direction: column; min-width: 0; }
.people__who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people__role { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.people__how { display: flex; align-items: center; gap: 6px; flex: none; width: 190px; justify-content: flex-end; }
.people__via { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 11px; }
.avatar--ghost { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-2); }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.role-card { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.role-card:hover { border-color: var(--indigo-ink); }
.role-card:focus-visible { outline: 2px solid var(--cyan); }
.role-card p { margin: 0; line-height: 1.5; }
.role-card__head { display: flex; align-items: center; gap: 8px; }
.role-card--new { flex-direction: row; align-items: center; gap: 10px; border-style: dashed; color: var(--indigo-ink); }
.role-card--new .small { margin-left: auto; }
.notice-inline { background: var(--amber-soft); color: var(--amber); border-radius: var(--radius-sm); padding: 8px 12px; margin: 10px 0 0; }
.access__title { font-size: 15px; margin: 18px 0 4px; }
.access { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.access__group { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.access__ghead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--surface-2); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.access__all { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 12.5px; }
.access__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); }
.access__row.is-own { background: #fbfaf2; box-shadow: inset 3px 0 0 var(--amber); }
.access__label { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 14px; font-weight: 600; }
.access__label .small { font-weight: 400; }
.access__note { color: var(--blue); font-weight: 500; }
.access__reset { align-self: flex-start; font-weight: 500; }
.seg--access { flex: none; }
.seg--access button { padding: 6px 10px; font-size: 12.5px; min-width: 38px; text-align: center; }
.seg--access button:disabled { cursor: default; }
.seg--access button.is-on.lv-0 { background: var(--line-2); color: var(--ink-2); }
.access.is-locked .seg--access button:not(.is-on) { color: var(--line-2); }
.request__act { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.request__act select { width: auto; }
.dash-grid--one { grid-template-columns: minmax(0, 720px); }
/* signing in with Google */
.steps { margin: 4px 0 0; padding-left: 18px; line-height: 1.6; }
.steps li { margin: 3px 0; }
.copyable { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; cursor: copy; word-break: break-all; }
.copyable:hover { border-color: var(--indigo-ink); }
.btn--google { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); justify-content: center; gap: 10px; }
.btn--google:hover { border-color: var(--indigo-ink); background: var(--surface-2); }
.signin__or { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; color: var(--muted); font-size: 12.5px; }
.signin__or::before, .signin__or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.signin__said { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; margin: 0 0 14px; border-radius: var(--radius-sm); background: var(--red-soft); color: var(--red); font-size: 13.5px; line-height: 1.45; }
.signin__said span { color: var(--ink-2); }
.signin__said.is-wait { background: var(--amber-soft); color: var(--amber); }
@media (max-width: 760px) {
  .people__how { display: none; }
  .access__row { flex-direction: column; align-items: stretch; }
  .seg--access { align-self: flex-start; }
  .request { flex-wrap: wrap; }
  .request__act { width: 100%; justify-content: flex-start; }
}

/* no motion when the device asks for less of it, and none on paper */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
@media print { *, *::before, *::after { animation: none !important; } }

/* ---------- the prospect demo (src/demo.js) ---------- */
.demo-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 9px 20px;
  background: var(--amber-soft); color: var(--ink); border-bottom: 1px solid #f0d9a8; font-size: 13.5px; line-height: 1.45; }
.demo-bar strong { color: var(--amber); }
.demo-bar span { flex: 1; min-width: 0; }
.demo-bar__cta { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--indigo); color: #fff; font-weight: 600; font-size: 13px; }
.demo-bar__cta:hover { background: var(--indigo-deep); }
.demo-tour { margin-bottom: 16px; border-left: 3px solid var(--amber); }
.demo-tour .card-title { display: flex; align-items: center; justify-content: space-between; }
.demo-tour__list { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; }
.demo-tour__list a { color: var(--cyan-ink); text-decoration: underline; text-underline-offset: 2px; }
.signin__art--demo { display: flex; align-items: flex-end; }
.demo-points { position: relative; list-style: none; margin: 0; padding: 40px; display: grid; gap: 18px; max-width: 460px; }
.demo-points li { display: grid; gap: 2px; padding: 16px 18px; border-radius: var(--radius); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.demo-points strong { color: #fff; font-size: 16px; }
.demo-points span { color: #b9bce0; font-size: 14px; line-height: 1.5; }
.tile__icon.is-amber { background: var(--amber); }
.lead-list { list-style: none; margin: 0; padding: 0; }
.lead-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.lead-list li:first-child { border-top: 0; }
.lead-list li > span { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 900px) { .signin__art--demo { display: none; } }
@media (max-width: 760px) {
  .demo-bar { padding: 8px 14px; font-size: 12.5px; }
  .lead-list li { flex-wrap: wrap; }
}
.scan-full { margin-left: 4px; font-size: 10px; }
.scan-about p { margin: 0 0 10px; }
.scan-about ul { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 1.5; }
.demo-tour__more { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13.5px; line-height: 1.5; }
.demo-tour__more > .icon { flex: none; margin-top: 2px; color: var(--violet); }
.demo-tour__more a { color: var(--cyan-ink); text-decoration: underline; text-underline-offset: 2px; }

/* how AI scanning works, in three pictures (scan.js, ScanPicture) */
.sill { display: flex; align-items: flex-start; justify-content: center; gap: 10px; margin: 0 0 18px; padding: 20px 14px 16px;
  border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.sill__step { flex: 1 1 0; max-width: 190px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sill__art { position: relative; width: 100%; height: 156px; display: grid; place-items: center; }
.sill__arrow { align-self: center; margin-top: -26px; color: var(--muted); font-size: 20px; }
.sill figcaption { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); text-align: center; }
.sill figcaption em { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--indigo); color: #fff;
  font: 700 11px var(--display); font-style: normal; flex: none; }
.sill-paper { position: relative; overflow: hidden; width: 116px; height: 150px; padding: 10px; display: flex; flex-direction: column; gap: 6px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 6px 16px rgba(21, 22, 58, .08); transform: rotate(-3deg); }
.sill-paper.is-read { transform: none; }
.sill-paper i { display: block; height: 4px; border-radius: 2px; background: var(--line-2); }
.sill-paper__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.sill-paper__top b { font-size: 6.5px; letter-spacing: .08em; color: var(--ink); white-space: nowrap; }
.sill-paper__rows { display: grid; gap: 5px; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); }
.sill-paper__rows span, .sill-hl { display: flex; gap: 4px; flex-wrap: wrap; }
.sill-hl--who { flex-direction: column; flex: 1; }
.sill-hl--tot { justify-content: flex-end; margin-top: auto; }
/* step 2: what the AI picks out is marked, and a line sweeps down the page */
.is-read .sill-hl { padding: 2px; margin: -2px; border-radius: 3px; background: var(--cyan-soft); outline: 1px solid var(--cyan); }
.is-read .sill-hl i { background: var(--cyan-ink); opacity: .55; }
.sill-beam { position: absolute; left: 0; right: 0; top: 8%; height: 2px; background: var(--cyan); box-shadow: 0 0 0 3px rgba(76, 201, 230, .18);
  animation: sill-sweep 2.6s ease-in-out infinite alternate; }
@keyframes sill-sweep { to { top: 90%; } }
.sill-phone { position: absolute; right: 18px; bottom: 6px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--indigo); color: #fff; box-shadow: 0 4px 10px rgba(21, 22, 58, .2); }
.sill-draft { width: 100%; max-width: 168px; display: flex; flex-direction: column; gap: 7px; padding: 12px; background: #fff;
  border: 1px solid var(--line-2); border-left: 3px solid var(--violet); border-radius: 8px; box-shadow: 0 6px 16px rgba(21, 22, 58, .08); }
.sill-draft strong { font-size: 11.5px; }
.sill-draft__row { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--muted); }
.sill-draft__row b { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.sill-draft__row .icon { color: var(--green); }
.sill-draft__flag { margin-top: 2px; padding: 4px 7px; border-radius: 6px; background: var(--amber-soft); color: var(--amber); font-size: 10.5px; font-weight: 600; }
@media (max-width: 560px) {
  .sill { flex-direction: column; align-items: center; }
  .sill__step { max-width: 220px; }
  .sill__arrow { margin: -4px 0; transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) { .sill-beam { animation: none; top: 46%; } }
