/* TPAGenie Portal v1. One light, calm stylesheet.
   Tokens, cards, KPI tiles, chips and the night sidebar are taken from the hospital demo
   (tpagenie/export/hospital-deck/src/demo/demo.css, kit.css and deck.css), so the portal looks like what the hospital saw. */

@font-face {
  font-family: "Satoshi";
  src: url("img/satoshi.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --night: #16123F;
  --night-2: #1D1950;
  --night-3: #241F5C;
  --indigo-3: #4A45A8;
  --mint: #CAFCDA;
  --aqua: #BBE8E5;
  --sky: #ABD5EF;
  --peri: #96BBFE;
  --grad: linear-gradient(100deg, var(--mint), var(--aqua) 38%, var(--sky) 72%, var(--peri));
  --tint: #F2F5FD;
  --tint-2: #E4EEFD;
  --tint-line: #D6DEF3;
  --ink: #0E1B2A;
  --ink-2: #33475C;
  --ink-3: #5E7189;
  --ok: #0B6B47;
  --ok-bg: #F3FBF7;
  --ok-line: #BFE8D3;
  --warn: #8A5200;
  --warn-bg: #FFFBF3;
  --warn-line: #F2D7A6;
  --bad: #B42828;
  --bad-bg: #FFF7F7;
  --bad-line: #F3B4B2;
  --side-w: 256px;
  --ease-out: cubic-bezier(.2, .75, .25, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--tint);
  color: var(--ink);
  font: 500 16px/1.5 "Satoshi", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--indigo-3); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--peri); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.boot-msg { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px;
  border-radius: 999px; border: 1.5px solid var(--tint-line); background: #fff; color: var(--night);
  font-weight: 700; font-size: 16px; line-height: 1.2; text-decoration: none; text-align: center;
  cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.btn:hover { background: var(--tint); border-color: #B9C3E6; }
.btn.dark { background: var(--night); border-color: var(--night); color: #fff; }
.btn.dark:hover { background: var(--indigo-3); border-color: var(--indigo-3); }
.btn.grad { background: var(--grad); border-color: transparent; color: var(--night); }
.btn.grad:hover { filter: saturate(1.15); }
.btn.go { background: #0B8F5C; border-color: #0B8F5C; color: #fff; }
.btn.go:hover { background: #087A4E; border-color: #087A4E; }
.btn.big { min-height: 54px; padding: 14px 26px; font-size: 17px; }
.btn.sm { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; pointer-events: none; }
.linkb { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 2px; border: 0; background: none; color: var(--indigo-3); font-weight: 700; font-size: 15.5px; text-decoration: none; cursor: pointer; }
.linkb:hover { text-decoration: underline; }
.linkb svg.ic { width: 17px; height: 17px; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 700; line-height: 1.3; background: var(--tint-2); color: var(--ink-2); }
.chip.ok { background: #E3F6EC; color: var(--ok); }
.chip.warn { background: #FFF1D6; color: var(--warn); }
.chip.bad { background: #FDECEC; color: var(--bad); }
.chip.info { background: #E6EDFF; color: #3A3F9E; }
.chip svg.ic { width: 14px; height: 14px; }

/* ---------- forms ---------- */
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > span { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.fld > span em { font-style: normal; font-weight: 500; color: var(--ink-3); }
.inp {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border-radius: 12px; border: 1.5px solid var(--tint-line); background: #fff; color: var(--night);
  font-size: 16px; font-weight: 600; outline: none;
}
.inp::placeholder { color: #9AA6BC; font-weight: 500; }
.inp:focus { border-color: var(--indigo-3); box-shadow: 0 0 0 3px rgba(74, 69, 168, .14); }
.inp[readonly] { background: var(--tint); color: var(--ink-2); }
.inp.bad { border-color: #D43A3A; }
textarea.inp { min-height: 110px; resize: vertical; line-height: 1.45; }
select.inp { appearance: none; -webkit-appearance: none; padding-right: 42px; background: #fff url("img/chev.svg") right 12px center / 20px no-repeat; }
.f-err { font-size: 14.5px; font-weight: 600; color: var(--bad); }
.f-err:empty { display: none; }
.f-hint { font-size: 14px; color: var(--ink-3); }
.tick { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 16px; font-weight: 600; color: var(--night); cursor: pointer; }
.tick input { width: 22px; height: 22px; margin: 0; accent-color: var(--indigo-3); flex: none; }
.code-inp { text-align: center; font-size: 30px; font-weight: 750; letter-spacing: .45em; padding-left: calc(14px + .45em); min-height: 66px; font-variant-numeric: tabular-nums; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap .inp { padding-right: 76px; }
.pw-show { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 42px; padding: 0 12px; border: 0; background: none; color: var(--indigo-3); font-weight: 700; font-size: 14.5px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .wide { grid-column: 1 / -1; }

/* ---------- sign-in pages ---------- */
.pub {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(55% 45% at 15% 5%, rgba(150, 187, 254, .30), transparent 70%),
    radial-gradient(50% 40% at 95% 95%, rgba(202, 252, 218, .45), transparent 70%),
    var(--tint);
}
.pub-shell { width: min(980px, 100%); display: grid; grid-template-columns: 1.05fr 1fr; border-radius: 24px; overflow: hidden; background: #fff; border: 1px solid var(--tint-line); box-shadow: 0 30px 80px -34px rgba(22, 18, 63, .35); }
.pub-side {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 24px; padding: 48px 46px; color: #E7EAF6; overflow: hidden;
  background:
    radial-gradient(80% 70% at 20% 20%, rgba(150, 187, 254, .22), transparent 70%),
    radial-gradient(60% 50% at 90% 100%, rgba(202, 252, 218, .12), transparent 70%),
    linear-gradient(160deg, #241F5C, #16123F 70%);
}
.pub-side img { width: 170px; height: auto; }
.pub-tag { font-size: 38px; line-height: 1.08; font-weight: 700; letter-spacing: -.035em; color: #fff; }
.pub-tag span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pub-points { display: flex; flex-direction: column; gap: 12px; font-size: 16.5px; color: #C9CFEA; }
.pub-points li { display: flex; align-items: center; gap: 10px; }
.pub-points svg.ic { color: var(--mint); }
.pub-card { display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 46px 42px; min-width: 0; }
.pub-logo { display: none; width: 150px; height: auto; }
.pub-card h1 { font-size: 27px; line-height: 1.2; font-weight: 750; letter-spacing: -.02em; color: var(--night); }
.pub-sub { margin-top: 6px; font-size: 16px; color: var(--ink-2); }
.pub-sub b { color: var(--night); overflow-wrap: anywhere; }
.pub-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.pub-form { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.err-logo { display: block; width: 150px; height: auto; }
.pub-foot { display: flex; align-items: flex-start; gap: 8px; padding-top: 14px; border-top: 1px solid var(--tint-line); font-size: 14px; color: var(--ink-3); }
.pub-foot svg.ic { width: 17px; height: 17px; margin-top: 1px; color: var(--indigo-3); }
.pub-foot a { font-weight: 700; }
.pub-ok { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--night); font-size: 15.5px; line-height: 1.45; }
.pub-ok svg.ic { color: #0B8F5C; margin-top: 2px; }

/* ---------- app shell ---------- */
.side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: var(--side-w);
  display: flex; flex-direction: column; padding: 20px 14px 18px;
  background: var(--night); color: #C9CFEA; overflow-y: auto; color-scheme: dark;
}
.side-top { display: flex; align-items: center; justify-content: space-between; margin: 2px 6px 14px 10px; }
.side-logo { width: 140px; height: auto; display: block; }
.side-x { display: none; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .06); color: #fff; cursor: pointer; }
.side-hosp { display: flex; align-items: center; gap: 9px; margin: 0 4px 6px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .07); font-size: 15px; font-weight: 700; color: #fff; }
.side-hosp span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-hosp svg.ic { color: var(--mint); width: 18px; height: 18px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-group { margin: 18px 12px 6px; font-size: 11.5px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; color: #8C94C2; }
.nav-a {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 8px 12px; border: 0; border-radius: 11px;
  background: none; color: #D2D7EE; font-size: 16px; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; width: 100%;
}
.nav-a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-a.on { background: rgba(202, 252, 218, .13); color: #fff; box-shadow: inset 3px 0 0 var(--mint); }
.nav-a svg.ic { color: #A9B1DA; }
.nav-a.on svg.ic { color: var(--mint); }
.nav-a:focus-visible { outline: 2px solid var(--mint); outline-offset: 1px; }
.nav-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.nav-t em { font-style: normal; font-size: 12.5px; font-weight: 600; color: #8C94C2; margin-top: 2px; }
.nav-badge { margin-left: auto; min-width: 26px; padding: 2px 8px; border-radius: 999px; background: var(--mint); color: var(--night); font-size: 13px; font-weight: 750; text-align: center; }
.nav-badge:empty, .nav-badge[hidden] { display: none; }
.nav-lock { margin-left: auto; color: #8C94C2 !important; width: 17px !important; height: 17px !important; }

.topbar { display: none; }
.scrim { display: none; }
.main { margin-left: var(--side-w); min-height: 100vh; min-width: 0; }
.page { max-width: 1120px; margin: 0 auto; padding: 30px 34px 56px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.page.narrow { max-width: 900px; }
.page.enter > * { animation: rise .35s var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fadein { from { opacity: 0; } }

/* page head */
.pg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; }
.pg-head > div { min-width: 0; }
.eyebrow { font-size: 12.5px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; color: var(--indigo-3); }
.pg-head h1 { margin-top: 4px; font-size: 30px; line-height: 1.15; font-weight: 750; letter-spacing: -.025em; color: var(--night); overflow-wrap: anywhere; }
.pg-note { margin-top: 6px; font-size: 16px; color: var(--ink-2); max-width: 62ch; }
.back { align-self: flex-start; margin-bottom: -8px; }
.pg-acts { display: flex; flex-wrap: wrap; gap: 10px; }

/* cards */
.card { background: #fff; border: 1px solid var(--tint-line); border-radius: 16px; padding: 20px 22px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 14px; }
.card.flush > .card-h { padding: 16px 20px 0; margin-bottom: 8px; }
.card h2 { font-size: 19px; line-height: 1.3; font-weight: 750; letter-spacing: -.01em; color: var(--night); }
.card-h p { font-size: 14.5px; color: var(--ink-3); }
.empty { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0; font-size: 16px; color: var(--ink-2); line-height: 1.45; }
.empty svg.ic { color: #0B8F5C; margin-top: 2px; }
.empty.pad { padding: 22px 20px; }
.loading { padding: 30px 0; color: var(--ink-3); }
.err-card { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; border-radius: 16px; background: #fff; border: 1px solid var(--tint-line); color: inherit; text-decoration: none; min-width: 0; }
.kpi svg.ic { color: var(--indigo-3); margin-bottom: 4px; }
.kpi p { font-size: 14.5px; font-weight: 650; color: var(--ink-3); }
.kpi b { font-size: 29px; line-height: 1.15; font-weight: 750; letter-spacing: -.03em; color: var(--night); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi.good { background: var(--ok-bg); border-color: var(--ok-line); }
.kpi.good b { color: var(--ok); }
.kpi.good svg.ic { color: #0B8F5C; }
.kpi.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.kpi.warn svg.ic { color: #B45309; }
a.kpi:hover { border-color: var(--indigo-3); }

/* case rows (used on Overview and All cases) */
.crows { display: flex; flex-direction: column; }
.crow {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.8fr) 150px 20px; gap: 18px; align-items: center;
  padding: 15px 20px; border-top: 1px solid #EEF2F8; color: inherit; text-decoration: none;
}
.crows .crow:first-child, .crow-head + .crow { border-top: 0; }
a.crow:hover { background: #F7F9FE; }
.c-who { min-width: 0; }
.c-who b { display: block; font-size: 16.5px; font-weight: 750; color: var(--night); overflow-wrap: anywhere; }
.c-who em, .c-amt em { display: block; font-style: normal; font-size: 14px; color: var(--ink-3); overflow-wrap: anywhere; }
.c-st { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.c-st p { font-size: 15px; line-height: 1.4; color: var(--ink-2); overflow-wrap: anywhere; }
.c-st .c-need { font-style: normal; font-size: 14px; font-weight: 700; color: var(--warn); }
.c-amt { text-align: right; }
.c-amt b { font-size: 17px; font-weight: 750; color: var(--night); font-variant-numeric: tabular-nums; }
.c-amt em.good { color: var(--ok); font-weight: 700; }
.c-go { color: #A3AECB; }
.crow-head { padding-top: 12px; padding-bottom: 10px; background: #F7F9FE; font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); border-top: 0; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px; }
.f-search { flex: 1 1 320px; position: relative; display: flex; min-width: 0; }
.f-search svg.ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.f-search .inp { padding-left: 44px; }
.f-status { flex: 0 1 260px; width: auto; }
.count-line { font-size: 15px; color: var(--ink-3); margin: -6px 0 -6px 2px; }

/* papers we need */
.needs { display: flex; flex-direction: column; gap: 12px; }
.need { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; align-items: center; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--warn-line); background: var(--warn-bg); }
.need-t { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.need-t > svg.ic { color: #B45309; margin-top: 3px; }
.need-t b { display: block; font-size: 17px; font-weight: 750; color: var(--night); overflow-wrap: anywhere; }
.need-t em { display: block; font-style: normal; font-size: 14.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.need .up-list { grid-column: 1 / -1; }
.need .up-list:empty { display: none; }
.need.done { border-color: var(--ok-line); background: var(--ok-bg); }
.need.done .need-t > svg.ic { color: #0B8F5C; }
.need-done-msg { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ok); }
.need-case .card-h > div { min-width: 0; }
.done-list { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--tint-line); }
.done-list p { font-size: 14px; font-weight: 700; color: var(--ink-3); }
.done-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 15px; color: var(--ink-2); }
.done-list li svg.ic { color: #0B8F5C; width: 18px; height: 18px; margin-top: 2px; }

/* uploads */
.up-list { display: flex; flex-direction: column; gap: 8px; }
.up-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: "ic name meta" ". bar bar" ". msg act";
  gap: 6px 10px; align-items: center; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--tint-line); background: #fff;
}
.up-row > svg.ic { grid-area: ic; color: var(--indigo-3); }
.up-name { grid-area: name; min-width: 0; font-size: 15.5px; font-weight: 650; color: var(--night); overflow-wrap: anywhere; }
.up-meta { grid-area: meta; font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.up-bar { grid-area: bar; height: 7px; border-radius: 5px; background: var(--tint-2); overflow: hidden; }
.up-bar i { display: block; width: 0; height: 100%; background: var(--indigo-3); transition: width .2s; }
.up-msg { grid-area: msg; font-size: 14.5px; color: var(--ink-2); min-width: 0; }
.up-act { grid-area: act; display: flex; gap: 6px; }
.up-act:empty { display: none; }
.up-row.q { grid-template-columns: 22px minmax(0, 1fr) auto auto; grid-template-areas: "ic name meta act" ". msg msg act"; gap: 2px 10px; }
.up-row.ok { border-color: var(--ok-line); background: var(--ok-bg); }
.up-row.ok .up-bar i { background: #0B8F5C; }
.up-row.ok .up-msg { color: var(--ok); font-weight: 700; }
.up-row.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.up-row.bad .up-bar i { background: #D43A3A; }
.up-row.bad .up-msg { color: var(--bad); font-weight: 650; }
.up-row .rm { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--ink-3); cursor: pointer; }
.up-row .rm:hover { background: var(--tint); color: var(--bad); }
.pick-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pick-row .btn { min-height: 64px; border-radius: 16px; font-size: 17px; }
.pick-row .btn svg.ic { width: 24px; height: 24px; }

/* add a case */
.add-done { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.add-done h2 { display: flex; align-items: center; gap: 10px; }
.add-done h2 svg.ic { color: #0B8F5C; width: 26px; height: 26px; }
.row-acts { display: flex; flex-wrap: wrap; gap: 12px; }
form.card, .add-form { display: flex; flex-direction: column; gap: 18px; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }

/* case page */
.case-top { display: flex; flex-direction: column; gap: 12px; }
.case-meta { font-size: 15.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.status-card { display: flex; flex-direction: column; gap: 12px; }
.status-big { font-size: 23px; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; color: var(--night); overflow-wrap: anywhere; }
.status-when { font-size: 14px; color: var(--ink-3); }
.handover { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-top: 4px; padding: 14px 16px; border-radius: 14px; background: var(--tint); }
.handover p { font-size: 15.5px; color: var(--ink-2); max-width: 54ch; }
.handover b { color: var(--night); }
.handed { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--ok); }
.money { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.money div { padding: 12px 14px; border-radius: 12px; background: var(--tint); min-width: 0; }
.money p { font-size: 14px; font-weight: 650; color: var(--ink-3); }
.money b { font-size: 21px; font-weight: 750; color: var(--night); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.money .good b { color: var(--ok); }
.money .zero b { color: var(--night); }
.docs { display: flex; flex-direction: column; }
.docs li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--tint-line); }
.docs li:last-child { border-bottom: 0; }
.docs li > svg.ic { color: var(--indigo-3); }
.doc-n { min-width: 0; }
.doc-n b { display: block; font-size: 15.5px; font-weight: 650; color: var(--night); overflow-wrap: anywhere; }
.doc-n em { display: block; font-style: normal; font-size: 13.5px; color: var(--ink-3); }
.doc-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.docs + .up-list:not(:empty), .add-more { margin-top: 14px; }

/* messages */
.msgs { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: min(580px, 88%); padding: 10px 14px 9px; border-radius: 16px; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.msg b { display: block; font-size: 13.5px; font-weight: 750; }
.msg p { white-space: pre-wrap; color: var(--ink); }
.msg time { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink-3); }
.msg.tg { align-self: flex-start; background: var(--tint); border-top-left-radius: 5px; }
.msg.tg b { color: var(--indigo-3); }
.msg.me { align-self: flex-end; background: #E7F8EE; border-top-right-radius: 5px; }
.msg.me b { color: var(--ok); }
.send { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--tint-line); }
.send-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.send-foot .f-hint { font-variant-numeric: tabular-nums; }

/* payer agreements */
.lockbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; padding: 16px 18px; border-radius: 16px; background: #fff; border: 1px solid var(--tint-line); }
.lockbar > div { display: flex; gap: 12px; align-items: flex-start; min-width: 0; flex: 1 1 320px; }
.lockbar > div > svg.ic { color: var(--indigo-3); margin-top: 2px; width: 22px; height: 22px; }
.lockbar b { display: block; color: var(--night); font-size: 16.5px; }
.lockbar span { display: block; font-size: 15px; color: var(--ink-2); }
.lockbar.open { background: var(--ok-bg); border-color: var(--ok-line); }
.lockbar.open > div > svg.ic { color: #0B8F5C; }
.ags { display: flex; flex-direction: column; gap: 16px; }
.ag { display: flex; flex-direction: column; gap: 14px; }
.ag-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 14px; }
.ag-top > div { min-width: 0; }
.ag-top h2 { overflow-wrap: anywhere; }
.ag-top p { font-size: 15.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.ag-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: #FFF4DC; border: 1px solid var(--warn-line); color: var(--night); font-size: 16px; font-weight: 600; line-height: 1.45; }
.ag-note svg.ic { color: #B45309; margin-top: 2px; }
.ag-note small { display: block; font-size: 13px; font-weight: 700; color: var(--warn); letter-spacing: .02em; }
.ag.ok .ag-note { background: var(--ok-bg); border-color: var(--ok-line); }
.ag.ok .ag-note svg.ic, .ag.ok .ag-note small { color: var(--ok); }
.ag.received .ag-note { background: #EEF2FF; border-color: #C9D3F5; }
.ag.received .ag-note svg.ic, .ag.received .ag-note small { color: #3A3F9E; }
.ag.bad .ag-note { background: #FFF1F0; border-color: var(--bad-line); }
.ag.bad .ag-note svg.ic, .ag.bad .ag-note small { color: var(--bad); }
.ag-files { display: flex; flex-direction: column; }
.ag-files li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--tint-line); }
.ag-files li:last-child { border-bottom: 0; }
.ag-files li > svg.ic { color: var(--indigo-3); }
.ag-files .locked { color: #A3AECB; width: 18px; height: 18px; }
.ag-none { font-size: 15px; color: var(--ink-3); }
.ag-acts { display: flex; flex-wrap: wrap; gap: 12px; }
.ag-acts .up-list { flex-basis: 100%; }
.ag-acts .up-list:empty { display: none; }
.l1-note { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: #fff; border: 1px solid var(--tint-line); font-size: 15.5px; color: var(--ink-2); }
.l1-note svg.ic { color: var(--indigo-3); }

/* file viewer (agreements) */
body.menu-open-lock { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column; background: #121033; animation: fadein .2s ease both; }
.vw-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; color: #fff; padding-top: max(10px, env(safe-area-inset-top)); }
.vw-head div { flex: 1; min-width: 0; }
.vw-head b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-head span { display: block; font-size: 13.5px; color: #A9B1DA; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-x { width: 46px; height: 46px; display: grid; place-items: center; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; flex: none; }
.vw-x:hover { background: rgba(255, 255, 255, .18); }
.vw-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; background: #2A2750; }
.vw-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.vw-body img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.vw-msg { color: #fff; padding: 24px; text-align: center; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.md-scrim { position: absolute; inset: 0; background: rgba(15, 13, 40, .42); animation: fadein .2s ease both; }
.md-card { position: relative; width: min(500px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: 20px; background: #fff; box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .5); animation: rise .25s var(--ease-out) both; }
.md-card h2 { font-size: 21px; line-height: 1.25; font-weight: 750; letter-spacing: -.01em; color: var(--night); padding-right: 40px; }
.md-card > p { font-size: 16px; color: var(--ink-2); line-height: 1.5; }
.md-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink-2); cursor: pointer; }
.md-x:hover { background: var(--tint); }
.md-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

/* toast */
.toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--night); color: #fff; font-size: 15.5px; font-weight: 600; box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .5); animation: rise .3s var(--ease-out) both; transition: opacity .4s; }
.toast svg.ic { color: var(--mint); }
.toast.bad svg.ic { color: #FFB4B4; }
.toast.out { opacity: 0; }

/* TPAGenie Desk (activation pending) */
.desk-wrap { position: relative; min-height: 600px; border-radius: 18px; overflow: hidden; border: 1px solid var(--tint-line); background: #fff; }
.desk-mock { display: grid; grid-template-columns: 170px minmax(0, 1fr); min-height: 600px; filter: blur(5px); opacity: .75; pointer-events: none; user-select: none; }
.dmk-side { background: var(--night); padding: 18px 12px; display: flex; flex-direction: column; gap: 10px; }
.dmk-side i { display: block; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .16); }
.dmk-side i:first-child { height: 20px; width: 70%; background: rgba(202, 252, 218, .5); margin-bottom: 10px; }
.dmk-main { padding: 22px; display: flex; flex-direction: column; gap: 16px; background: var(--tint); }
.dmk-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dmk-kpis div { padding: 14px; border-radius: 14px; background: #fff; border: 1px solid var(--tint-line); }
.dmk-kpis p { font-size: 13px; color: var(--ink-3); }
.dmk-kpis b { font-size: 26px; color: var(--night); }
.dmk-tbl { border-radius: 14px; background: #fff; border: 1px solid var(--tint-line); padding: 8px 16px; }
.dmk-tbl div { display: grid; grid-template-columns: 2fr 1.2fr 1fr 90px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid #EEF2F8; }
.dmk-tbl i { display: block; height: 11px; border-radius: 6px; background: #DCE3F5; }
.dmk-tbl .chip { justify-self: start; }
.desk-over { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(242, 245, 253, .35); }
.desk-card { width: min(480px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 30px 28px; border-radius: 20px; background: #fff; border: 1px solid var(--tint-line); box-shadow: 0 30px 80px -30px rgba(22, 18, 63, .45); text-align: center; }
.desk-lock { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 18px; background: var(--grad); color: var(--night); }
.desk-lock svg.ic { width: 28px; height: 28px; }
.desk-card h2 { font-size: 23px; line-height: 1.25; font-weight: 750; color: var(--night); }
.desk-card p { font-size: 16px; color: var(--ink-2); line-height: 1.5; }
.contact { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; background: var(--tint); width: 100%; font-size: 15.5px; color: var(--ink-2); }
.contact b { color: var(--night); }
.contact a { font-weight: 700; overflow-wrap: anywhere; }

/* help */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.step { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px; border-radius: 16px; background: #fff; border: 1px solid var(--tint-line); }
.step-pic { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 20px; background: var(--grad); color: var(--night); }
.step-pic svg.ic { width: 32px; height: 32px; stroke-width: 1.8; }
.step-n { position: absolute; top: 18px; right: 18px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--night); color: #fff; font-size: 14px; font-weight: 750; }
.step h2 { font-size: 18px; font-weight: 750; color: var(--night); }
.step p { font-size: 15.5px; color: var(--ink-2); line-height: 1.45; }
.help-contact { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; align-items: center; }
.help-contact .row-acts { justify-content: flex-end; }

/* profile */
.prof-who { display: flex; align-items: center; gap: 14px; }
.avatar { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--night); color: #fff; font-size: 19px; font-weight: 750; }
.prof-who b { display: block; font-size: 18px; color: var(--night); overflow-wrap: anywhere; }
.prof-who > div span { display: block; font-size: 15px; color: var(--ink-3); }
.note-line { display: flex; align-items: center; gap: 10px; font-size: 15.5px; color: var(--ink-2); }
.note-line svg.ic { color: #0B8F5C; }

/* ---------- tablets and phones ---------- */
@media (max-width: 1100px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crow { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) 130px 20px; }
}

@media (max-width: 860px) {
  .side { width: min(304px, 86vw); transform: translateX(-102%); visibility: hidden; transition: transform .25s var(--ease-out), visibility 0s linear .25s; box-shadow: 20px 0 60px -20px rgba(0, 0, 0, .5); padding-top: max(16px, env(safe-area-inset-top)); }
  .side-x { display: grid; }
  body.menu-open { overflow: hidden; }
  body.menu-open .side { transform: none; visibility: visible; transition: transform .25s var(--ease-out); }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 13, 40, .42); animation: fadein .2s ease both; }
  .main { margin-left: 0; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 30; align-items: center; gap: 6px;
    min-height: 62px; padding: 8px 12px 8px 6px; padding-top: max(8px, env(safe-area-inset-top));
    background: #fff; border-bottom: 1px solid var(--tint-line);
  }
  .tb-menu { width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 12px; background: none; color: var(--night); cursor: pointer; }
  .tb-menu svg.ic { width: 26px; height: 26px; }
  .tb-menu:hover { background: var(--tint); }
  .tb-logo { display: block; width: 122px; height: auto; }
  .page { padding: 20px 16px 44px; gap: 18px; }
  .pub-shell { grid-template-columns: minmax(0, 1fr); width: min(500px, 100%); }
  .pub-side { display: none; }
  .pub-logo { display: block; }
  .pub-card { padding: 30px 24px; }
  .desk-mock { grid-template-columns: minmax(0, 1fr); }
  .dmk-side { display: none; }
  .dmk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .crow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who amt" "st st"; gap: 10px 14px; padding: 14px 16px; align-items: start; }
  .c-who { grid-area: who; }
  .c-amt { grid-area: amt; }
  .c-st { grid-area: st; }
  .c-go, .crow-head { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .help-contact { grid-template-columns: minmax(0, 1fr); }
  .help-contact .row-acts { justify-content: flex-start; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .pg-head h1 { font-size: 26px; }
  .pg-acts { width: 100%; }
  .pg-head .btn { width: 100%; }
  .card { padding: 18px 16px; border-radius: 16px; }
  .card.flush > .card-h { padding: 16px 16px 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi b { font-size: 22px; }
  .kpi p { font-size: 13.5px; }
  .kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .need { grid-template-columns: minmax(0, 1fr); }
  .need > .btn { width: 100%; }
  .pick-row { grid-template-columns: minmax(0, 1fr); }
  .status-big { font-size: 20px; }
  .handover .btn { width: 100%; }
  .money b { font-size: 19px; }
  .money { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs li { grid-template-columns: 22px minmax(0, 1fr); }
  .up-row:not(.q) { grid-template-areas: "ic name meta" ". bar bar" ". msg msg" ". act act"; }
  .doc-acts { grid-column: 2; justify-content: flex-start; }
  .ag-acts .btn, .row-acts .btn, .form-foot .btn { width: 100%; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { flex-direction: row; align-items: flex-start; gap: 14px; padding: 16px; }
  .step-pic { width: 56px; height: 56px; border-radius: 16px; }
  .step-pic svg.ic { width: 26px; height: 26px; }
  .step-n { top: 12px; right: 12px; width: 26px; height: 26px; font-size: 13px; }
  .step > div { padding-right: 26px; }
  .msg { max-width: 92%; }
  .md-card { padding: 20px 18px; border-radius: 18px; }
  .md-foot .btn { flex: 1 1 auto; }
  .desk-wrap, .desk-mock { min-height: 640px; }
  .lockbar .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
