/* Fonts are stored in this app (Inter and Poppins, SIL Open Font License) so they also work offline. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/poppins-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/poppins-latin-600-normal.woff2") format("woff2");
}

:root {
  --navy: #0A1547;
  --navy-2: #12206B;
  --blue: #1A3399;
  --blue-dark: #0F1F66;
  --sky: #00B050;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --line: #E4E8F0;
  --field: #C5CCE0;
  --text: #0A1547;
  --muted: #5B6475;
  --ok-bg: #DDF3E8;
  --ok: #0E5A3A;
  --warn-bg: #FDEFCF;
  --warn: #6F4300;
  --bad-bg: #FBE0E0;
  --bad: #8A1C1C;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: "Poppins", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; font-family: var(--font-head); font-weight: 600; }

a { color: var(--blue); }

/* ---------- shared form pieces ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }

form { display: flex; flex-direction: column; gap: 14px; }

input[type="text"], input[type="tel"], input[type="password"], input[type="date"], input[type="search"] {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--field);
  border-radius: 10px;
}

input::placeholder { color: #55657F; opacity: 1; }

input:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(0, 176, 80, 0.55);
  outline-offset: 2px;
}

.pinwrap { position: relative; }
.pinwrap input { padding-right: 76px; }
.pinwrap .toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
}

.btn {
  min-height: 48px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--field); }
.btn.secondary:hover { background: #F4F6FB; }
.btn[disabled] { opacity: 0.6; cursor: default; }

.message {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  background: var(--bad-bg);
  color: var(--bad);
}
.message:empty { display: none; }
.message.info { background: #E8EDFB; color: #1A3399; }
.message.warn { background: var(--warn-bg); color: var(--warn); }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chip { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #E8ECF4; color: #3E4D68; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 20px; }
.card.pad { padding: 20px; }
.card h2 { font-size: 17px; }
.card .sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .k { color: var(--muted); }

/* ---------- sign-in and setup screens ---------- */

.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px 16px;
}

.brand { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.brand img { width: clamp(180px, 60vw, 240px); height: auto; border-radius: 0; }
.brand h1 { font-size: clamp(20px, 5vw, 24px); }

.panel {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 22px;
}
.panel h2 { font-size: 18px; margin-bottom: 4px; }
.panel .lead { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.foot { font-size: 12px; color: var(--muted); text-align: center; margin: 0; }

/* ---------- app shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 12px;
  background: var(--navy);
  color: #D3D9E8;
}

.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.side-brand img { width: 44px; height: 44px; border-radius: 0; object-fit: contain; flex: 0 0 auto; }
.side-brand .t1 { display: block; font-family: var(--font-head); font-weight: 600; font-size: 17px; color: #fff; line-height: 1.2; }
.side-brand .t2 { display: block; font-size: 12px; color: #C5CCE0; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8CA3C9;
}

.navlink {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: #D3D9E8;
  text-decoration: none;
  font-weight: 500;
}
.navlink:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.navlink.active { background: var(--navy-2); color: #fff; font-weight: 600; }
.navlink svg { flex: 0 0 auto; }
.lbl-short { display: none; }

.side-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--navy-2);
}
.side-user .nm { display: block; color: #fff; font-weight: 600; line-height: 1.25; }
.side-user .rl { display: block; font-size: 12px; color: #C5CCE0; }
.side-user .txt { min-width: 0; }
.side-user .nm, .side-user .rl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sky);
  color: var(--navy);
  font-weight: 600;
  font-size: 14px;
}

.main-col { min-width: 0; display: flex; flex-direction: column; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-logo { display: none; width: 34px; height: 34px; border-radius: 0; object-fit: contain; }
.top h1 { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-right { position: relative; display: flex; align-items: center; gap: 12px; }

.net { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--ok-bg); color: var(--ok); white-space: nowrap; }
.net::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.net.off { background: var(--warn-bg); color: var(--warn); }

.userbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 6px 0 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.userbtn:hover { background: #F4F6FB; }

.pop {
  position: absolute;
  top: 54px;
  right: 0;
  width: 270px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(1, 24, 66, 0.16);
}
.pop[hidden] { display: none; }
.pop .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.pop .who strong { display: block; }
.pop .who span { display: block; font-size: 13px; color: var(--muted); }
.pop button, .pop a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.pop button:hover, .pop a:hover { background: #F4F6FB; }

.view { width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; outline: none; }

.empty { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .ic { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #E8EDFB; color: #1A3399; margin-bottom: 8px; }
.empty h2 { font-size: 18px; }
.empty p { margin: 0; max-width: 420px; color: var(--muted); }

.tabs { display: none; }
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(1, 24, 66, 0.55); }
.scrim[hidden] { display: none; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sheet[hidden] { display: none; }
.sheet .grab { align-self: center; width: 44px; height: 5px; border-radius: 3px; background: var(--field); margin-bottom: 8px; }
.sheet .sheet-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 8px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.sheet .sheet-link.active { background: #E8EDFB; color: #1A3399; font-weight: 600; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-weight: 500;
}

.profile-actions { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 0 12px; }
.profile-actions[hidden], .pop button[hidden] { display: none; }

.row > span:last-child { text-align: right; }

.notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  background: #E8EDFB;
  color: #1A3399;
}

.update-bar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 16px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 10px 30px rgba(1, 24, 66, 0.3);
}
.update-bar button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--sky);
  color: var(--navy);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Tablet: slim icon sidebar with short labels */
@media (max-width: 1023px) {
  .shell { grid-template-columns: 84px minmax(0, 1fr); }
  .side { padding: 14px 6px; gap: 18px; align-items: stretch; }
  .side-brand { justify-content: center; padding: 0; }
  .side-brand .txt { display: none; }
  .side-brand img { width: 44px; height: 44px; }
  .nav-label { display: none; }
  .side-nav { gap: 2px; }
  .navlink { flex-direction: column; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 2px; text-align: center; font-size: 11px; line-height: 1.2; }
  .lbl-full { display: none; }
  .lbl-short { display: block; }
  .side-user { justify-content: center; padding: 8px 0; background: transparent; }
  .side-user .txt { display: none; }
  .top { padding: 0 20px; }
  .view { padding: 20px; }
}

/* Phone: bottom tabs */
@media (max-width: 639px) {
  .shell { display: block; }
  .side { display: none; }
  .top { padding: 0 16px; min-height: 60px; }
  .top-logo { display: block; }
  .top h1 { font-size: 18px; }
  .net .net-text { display: none; }
  .net { padding: 0; width: 30px; justify-content: center; }
  .net::before { margin: 0; }
  .userbtn .uname { display: none; }
  .view { padding: 16px 16px calc(92px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: stretch;
    padding: 0 4px env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid var(--line);
  }
  .tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
  }
  .tab.active { color: var(--blue); font-weight: 600; }
  .pop { position: fixed; top: 64px; right: 12px; left: auto; width: min(270px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

/* ---------- users and audit screens ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .vh { font-size: 17px; }
.toolbar .sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.card.tbl { padding: 0; overflow: hidden; }
.trow { display: grid; grid-template-columns: minmax(180px, 1.4fr) auto minmax(150px, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.trow:first-child { border-top: 0; }
.tmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.tmain .sub, .tmeta { color: var(--muted); font-size: 13px; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tacts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.fchip { min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--field); background: #fff; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.fchip.on { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.more { display: flex; justify-content: center; margin: 14px 0; }
.more[hidden], .more button[hidden] { display: none; }
#a-list .trow { grid-template-columns: 1fr auto; }

.modal-scrim { position: fixed; inset: 0; background: rgba(1, 24, 66, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; }
.modal h2 { font-size: 18px; margin-bottom: 12px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.modal-body p { margin: 0; }
.modal .sub { color: var(--muted); font-size: 14px; margin: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.modal .message { margin-top: 4px; }
.pinshow { font-family: var(--font-head); font-size: 32px; letter-spacing: 0.3em; text-align: center; padding: 14px; background: var(--bg); border-radius: 12px; user-select: all; }

@media (max-width: 720px) {
  .trow { grid-template-columns: 1fr; padding: 14px 16px; }
  .tacts { justify-content: flex-start; }
  #a-list .trow { grid-template-columns: 1fr; }
}

/* ---------- cohorts and beneficiaries ---------- */
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input, .filters select { min-height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 10px; font: inherit; background: #fff; color: var(--text); }
.filters input { flex: 1 1 240px; }
.filters select { flex: 0 1 220px; }
.field textarea, .field select, .field input[type="file"] { padding: 10px 12px; border: 1px solid var(--field); border-radius: 10px; font: inherit; background: #fff; color: var(--text); }
.field select { min-height: 48px; }
.brow { cursor: pointer; }
.brow:hover, .brow:focus-visible { background: #F4F6FB; outline: none; }
.crow .lnk { display: inline-flex; align-items: center; text-decoration: none; }
.tacts.left { justify-content: flex-start; margin-top: 4px; }
.dl .row { align-items: flex-start; padding: 10px 0; }
.dl .row > span:last-child { text-align: right; overflow-wrap: anywhere; }
.dl { margin-bottom: 4px; }

/* ---------- evidence ---------- */
.egrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.ecard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.ethumb { display: block; aspect-ratio: 4 / 3; background: var(--bg); }
.ethumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdfbox { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--navy-2); font-size: 22px; letter-spacing: 0.1em; }
.ebody { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.ebody .sub { color: var(--muted); font-size: 13px; }
.ename { overflow-wrap: anywhere; }
#e-pending { margin-top: 14px; }
.meter { margin-bottom: 14px; }
.bar { height: 8px; background: var(--line); border-radius: 999px; margin-top: 12px; overflow: hidden; }
.bar > div { height: 100%; background: var(--blue); border-radius: 999px; }
.lnk { display: inline-flex; align-items: center; text-decoration: none; }
#e-pending:empty { margin: 0; }

/* ---------- check-ins ---------- */
.krow { cursor: pointer; }
.krow:hover, .krow:focus-visible { background: #F4F6FB; outline: none; }
.sec { font-size: 14px; margin: 14px 0 4px; }
.sec .sub { font-weight: 400; }
.pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.seg { display: flex; gap: 16px; flex-wrap: wrap; }
.seg label { display: flex; align-items: center; gap: 8px; font-weight: 500; min-height: 44px; }
#k-sub a { color: var(--blue); }
[hidden] { display: none !important; }

/* ---------- beneficiary home ---------- */
.hello { margin-bottom: 14px; font-size: 20px; }
.status { border-left: 6px solid var(--blue); margin-bottom: 14px; }
.status.late { border-left-color: #C0392B; background: #FFF8F7; }
.status.soon { border-left-color: #D98E04; }
.status h2 { font-size: 15px; color: var(--muted); font-weight: 600; }
.status .big { font-family: var(--font-head); font-size: 26px; font-weight: 600; margin: 6px 0; color: var(--navy); }
.status .btn { margin-top: 10px; }
.two { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
.card.pad + .card.pad { margin-top: 0; }
#view > .card.pad { margin-bottom: 14px; }
.reasons { margin: 8px 0 0; padding-left: 18px; }
.hrow { grid-template-columns: 1fr auto; }
@media (min-width: 900px) { .two { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .hrow { grid-template-columns: 1fr; } }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 420px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); min-height: 108px; }
a.tile:hover { border-color: var(--blue); }
.tile .tl { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .tv { font-family: var(--font-head); font-size: 24px; line-height: 1.2; white-space: nowrap; }
.tile .ts { font-size: 13px; color: var(--muted); }
.tile.late { border-color: #E9B4B4; background: #FFF8F7; }
.tile.late .ts { color: var(--bad); font-weight: 600; }
.rbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); margin: 12px 0; }
.seg-pos { background: #1E8E5A; } .seg-med { background: #D98E04; } .seg-neg { background: #C0392B; } .seg-none { background: #8A97AD; }
.rleg { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; margin-bottom: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.ch { font-size: 16px; padding: 16px 20px 6px; }
.lrow { grid-template-columns: 1fr auto; text-decoration: none; color: inherit; }
.lrow:hover { background: #F4F6FB; }
@media (max-width: 720px) { .lrow { grid-template-columns: 1fr; } }

/* Printable report */
#print-root { display: none; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; color: #111; background: #fff; font: 12px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  @page { margin: 16mm; }
  html, body.printing { background: #fff !important; min-height: 0 !important; height: auto !important; }
  #print-root h1 { font-size: 22px; margin: 10px 0 4px; color: #0A1547; }
  #print-root h2 { font-size: 14px; margin: 18px 0 6px; padding-bottom: 3px; border-bottom: 1.5px solid #1A3399; color: #0A1547; }
  #print-root h3 { font-size: 12px; margin: 12px 0 4px; }
  #print-root .rp-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 3px solid #0A1547; padding-bottom: 8px; }
  #print-root .rp-brand { font-size: 15px; font-weight: 700; color: #0A1547; }
  #print-root .rp-sub { color: #555; font-size: 11px; }
  #print-root .rp-conf { color: #a00; font-weight: 600; }
  #print-root table { width: 100%; border-collapse: collapse; }
  #print-root .rp-kv th { width: 28%; text-align: left; vertical-align: top; padding: 3px 8px 3px 0; color: #444; font-weight: 600; }
  #print-root .rp-kv td { padding: 3px 0; }
  #print-root .rp-t th { background: #F1F4FB; text-align: left; padding: 5px 6px; border: 1px solid #D3D9E8; }
  #print-root .rp-t td { padding: 5px 6px; border: 1px solid #D3D9E8; vertical-align: top; }
  #print-root tr { break-inside: avoid; }
  #print-root h2, #print-root h3 { break-after: avoid; }
}

.cache-note { position: fixed; left: 50%; transform: translateX(-50%); bottom: 76px; max-width: min(560px, calc(100vw - 24px)); z-index: 60;
  background: #fff4e0; color: #7a4a00; border: 1px solid #f0c987; border-radius: 10px; padding: 9px 14px; font-size: 13px; box-shadow: 0 4px 14px rgba(12,30,85,.18); }
@media (min-width: 900px) { .cache-note { bottom: 18px; } }

/* Page controls */
.pager-host { margin: 14px 0 6px; }
.pager { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; font-size: 13px; color: #4a5a72; }
.pager-ctrl { display: flex; align-items: center; gap: 6px; }
.pager-nums { display: flex; align-items: center; gap: 4px; }
.pg { min-width: 36px; height: 36px; padding: 0 12px; border: 1px solid #D3D9E8; background: #fff; color: #0A1547; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.pg:hover:not(:disabled) { background: #F1F4FB; }
.pg:focus-visible { outline: 2px solid #1A3399; outline-offset: 2px; }
.pg.on { background: #0A1547; border-color: #0A1547; color: #fff; }
.pg:disabled { opacity: .45; cursor: default; }
.pg-gap { padding: 0 4px; color: #7a889c; }
.pager-phone { display: none; font-weight: 600; color: #0A1547; padding: 0 6px; }
@media (max-width: 640px) {
  .pager { flex-direction: column; align-items: stretch; text-align: center; }
  .pager-ctrl { justify-content: space-between; }
  .pager-nums { display: none; }
  .pager-phone { display: inline; }
  .pg { flex: 0 0 auto; }
}
@media print { .pager-host { display: none; } }

/* ----- profile photos ----- */
.avatar.has-photo { padding: 0; overflow: hidden; background: #fff; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.ph-card { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.ph-card h2.ph-name { margin: 0 0 2px; font-size: 19px; color: var(--navy); }
.ph-card .ph-biz { margin: 0 0 6px; }
.ph-av { position: relative; flex: 0 0 auto; }
.ph-av .ph-big { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #00B050; }
.ph-av.can { cursor: pointer; }
.ph-badge { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--blue); border: 2px solid #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 8h3l2-3h6l2 3h3v11H4z'/><circle cx='12' cy='13' r='3.5'/></svg>");
  background-repeat: no-repeat; background-position: center; }
.ph-preview { width: 160px; height: 160px; margin: 4px auto 14px; border-radius: 50%; overflow: hidden; background: #F1F4FB; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px #00B050; }
.ph-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-preview .ph-empty { font-family: var(--font-head); font-size: 44px; color: var(--blue); font-weight: 600; }
.ph-preview.busy { opacity: .5; }
.ph-btns { display: flex; gap: 10px; margin-bottom: 12px; }
.ph-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; }

.bwho { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bav { flex: 0 0 auto; display: flex; align-items: center; }
.brow { align-items: center; }
.ph-detail { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ph-detail .ph-big { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #00B050; }
.linkbtn { background: none; border: 0; padding: 0; margin-top: 4px; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #00B050; color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pvrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pv-pics { display: flex; gap: 10px; }
.pv-pics figure { margin: 0; text-align: center; }
.pv-pics img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; display: block; background: #F1F4FB; }
.pv-pics figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
@media print { #print-root .rp-who { display: flex; align-items: center; gap: 14px; } #print-root .rp-photo { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; } }

.privacy h3 { font-size: 15px; margin: 14px 0 4px; color: var(--navy); }
.privacy p { margin: 0 0 6px; color: var(--muted); line-height: 1.5; }
.privacy { max-height: 52vh; overflow-y: auto; padding-right: 4px; }

/* ---------- leads ---------- */
.modal.wide { max-width: 680px; }
.note { border-left: 3px solid var(--line); padding: 6px 0 6px 12px; margin-bottom: 10px; }
.note.note { border-left-color: var(--blue); }
.note.event { border-left-color: var(--line); color: var(--muted); }
.note .nmeta { font-size: 12px; color: var(--muted); }
.note .nbody { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.modal .sec { margin: 6px 0 0; }
.modal textarea { width: 100%; font: inherit; }

/* ---------- clients ---------- */
.field.check label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.field.check input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; }

/* ---------- jobs ---------- */
.filters[hidden], .field[hidden] { display: none; }

/* ---------- money ---------- */
.trow.voided { opacity: 0.6; }
.trow.voided strong { text-decoration: line-through; }

/* ---- calendar (stage 7) ---- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-title { font-family: var(--font-head); font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-h { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.cal-c { position: relative; min-height: 56px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; color: var(--text); cursor: pointer; padding: 6px; text-align: left; }
.cal-c.empty { border: 0; background: transparent; cursor: default; }
.cal-c.today { border-color: var(--blue); }
.cal-c.picked { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.cal-n { font-size: 14px; font-weight: 600; }
.cal-dot { position: absolute; right: 6px; bottom: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.cal-c.picked .cal-dot { background: #fff; color: var(--navy-2); }
@media (max-width: 640px) { .cal-c { min-height: 46px; padding: 4px; } .cal-dot { right: 3px; bottom: 3px; min-width: 18px; height: 18px; font-size: 11px; } }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

/* ---- insights (stage 8) ---- */
.ch-wrap { overflow-x: auto; }
.ch-svg { width: 100%; min-width: 560px; height: auto; display: block; }
.ch-grid { stroke: #E8ECF4; stroke-width: 1; }
.ch-base { stroke: #B8C2D1; stroke-width: 1; }
.ch-ax { font-size: 11px; fill: #5B6475; }
.ch-val { font-size: 11px; font-weight: 600; fill: #1B2A4A; }
.ch-bar { fill: #00963F; }
.ch-bar:hover { fill: #1f63b5; }
.ch-table { margin-top: 8px; font-size: 14px; }
.ch-table summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.ch-table table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.ch-table th, .ch-table td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); }
.ins-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.ins-2 > .card { margin: 0; }
@media (max-width: 800px) { .ins-2 { grid-template-columns: 1fr; } }
.hb { display: flex; flex-direction: column; gap: 14px; }
.hb-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.hb-name { font-weight: 600; }
.hb-val { font-variant-numeric: tabular-nums; }
.hb-track { height: 8px; background: #E8ECF4; border-radius: 4px; margin: 4px 0; }
.hb-fill { display: block; height: 8px; background: #00963F; border-radius: 0 4px 4px 0; }
.sp-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; margin-bottom: 8px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.s1 { background: #00963F; }
.s2 { background: #4A4A4A; }
.sp-bar { display: flex; gap: 2px; height: 28px; }
.sp { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; min-width: 4px; }
.sp:first-child { border-radius: 6px 0 0 6px; }
.sp:last-child { border-radius: 0 6px 6px 0; }
.sp:only-child { border-radius: 6px; }
.sp-nums { display: flex; flex-wrap: wrap; gap: 8px 32px; margin-top: 12px; }
.sp-nums strong { font-size: 22px; font-family: var(--font-head); margin-right: 8px; }
.who { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.who:first-of-type { border-top: 0; }
.trow.lrow { grid-template-columns: 1fr auto; }
.card.inner { box-shadow: none; margin-top: 8px; }
section.card + section.card { margin-top: 14px; }

/* ---- invoices (stage 9) ---- */
.fhead, .fline { display: grid; grid-template-columns: minmax(140px, 1fr) 70px 110px 110px 80px; gap: 8px; align-items: center; }
.fhead { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 2px 4px; }
.fline { margin-bottom: 8px; }
.fline input { min-width: 0; }
.fl-amt { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
#f-cat { margin-left: 8px; min-height: 36px; border-radius: 8px; border: 1px solid var(--field); padding: 0 10px; font: inherit; background: #fff; }
@media (max-width: 640px) {
  .fhead { display: none; }
  .fline { grid-template-columns: 1fr 70px 1fr; }
  .fline [data-d] { grid-column: 1 / -1; }
  .fline .fl-amt { grid-column: 1 / 3; text-align: left; }
}
.dense .row { min-height: 0; padding-top: 8px; padding-bottom: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset.field { border: 0; padding: 0; margin: 12px 0; }
fieldset.field legend { font-weight: 600; font-size: 14px; margin-bottom: 4px; padding: 0; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; } }
.dl { display: block; margin-top: 4px; font-size: 12px; color: var(--muted, #5b6478); }
.dl.up { color: #1a7a3c; }
.dl.down { color: #b3361b; }
.cmp-toggle { margin: 0 0 12px; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
table.cmp th, table.cmp td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line, #E8ECF4); white-space: nowrap; }
table.cmp th:not(:first-child), table.cmp td:not(:first-child) { text-align: right; }
.td-group { margin-top: 14px; }
.td-h { margin: 0 0 6px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.td-n { font-size: 12px; font-weight: 600; background: var(--line, #E8ECF4); border-radius: 10px; padding: 1px 8px; }
.td-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line, #E8ECF4); text-decoration: none; color: inherit; }
.td-row:hover .td-main strong { text-decoration: underline; }
.td-main { display: flex; flex-direction: column; min-width: 0; }
.td-main strong { font-weight: 600; overflow-wrap: anywhere; }
.td-pill { flex: none; min-width: 52px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 3px 8px; border-radius: 6px; margin-top: 1px; background: #E8ECF4; color: #2B3350; }
.td-pill.late { background: #fbe3dd; color: #9a2a12; }
.td-pill.today { background: #E8EDFB; color: #1A3399; }
.td-pill.soon { background: #F1F4FB; color: #1c4a9a; }
.td-more { display: block; padding: 8px 0 0 62px; font-size: 13px; }
.rm-new { color: #1A3399; font-weight: 600; }
.rm-msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.pu-prefs { margin: 10px 0; }
.pu-prefs .check { padding: 6px 0; }

/* ---------- desktop and laptop polish (Stage 16) ---------- */
.view:focus, .view:focus-visible { outline: none; }
.td-grid { display: block; }
.navlink:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

/* Short laptop screens: a tighter sidebar so the signed-in person always shows at the bottom */
@media (min-width: 1024px) and (max-height: 860px) {
  .side { gap: 14px; padding: 14px 12px; }
  .navlink { min-height: 38px; }
  .side-nav { gap: 2px; }
  .side-user { padding: 8px 12px; }
}

/* Laptops and desktops: use the width, keep lines readable */
@media (min-width: 1100px) {
  .view { padding: 28px 32px; gap: 18px; }
  .top { padding: 0 32px; }
  .td-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); column-gap: 32px; }
  .modal { max-width: 480px; }
  .modal.wide { max-width: 760px; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .btn, .chip, .pg, .navlink, .brow, .krow, .td-row { cursor: pointer; }
  .brow:hover, .krow:hover { background: #F4F6FB; }
}
@media (min-width: 1500px) {
  .view { max-width: 1440px; }
}
@media (min-width: 1100px) and (max-width: 1499px) {
  .view { max-width: 1240px; }
}

/* Finance dashboard */
.fc-svg { width: 100%; height: auto; display: block; }
.fc-grid { stroke: #E8ECF4; stroke-width: 1; }
.fc-ax { fill: #5B6475; font-size: 11px; }
.fc-in { fill: #1A3399; background: #1A3399; }
.fc-out { fill: #00B050; background: #00B050; }
.fc-key { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; color: #2B3350; }
.fc-key i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.fc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.fc-ph { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fc-av { display: flex; flex-direction: column; margin-bottom: 8px; }
.fc-av strong { font-size: 24px; font-family: var(--font-head); }
.fc-plus { color: #0B6B3A; }
.fc-minus { color: #9A2A12; }
.fc-p .dl div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }

.net-test { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #E8EDFB; color: #1A3399; }
.net-test[hidden] { display: none; }
@media (max-width: 480px) { .net-test { padding: 0 8px; font-size: 11px; } }
.ex-box { background: #F1F4FB; }
.ex-box .sub { margin: 0 0 8px; }
.net-out { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; border: 0; font: inherit; font-size: 12px; font-weight: 600; background: #E8EDFB; color: #1A3399; cursor: pointer; }
.net-out[hidden] { display: none; }
.net-out.bad { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 480px) { .net-out { padding: 0 8px; font-size: 11px; } }

/* ---------- phone and tablet (under 1024 px): navy top bar with a back arrow, home tiles, no sidebar or bottom tabs ---------- */
.backbtn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #0A1547; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.backbtn:hover { background: #F4F6FB; }
body.at-home .backbtn { display: none; }
.launch { display: none; }
@media (max-width: 1023px) {
  .shell { display: block; }
  .side, .tabs, .sheet, .scrim { display: none !important; }
  .top { background: var(--navy); color: #fff; border-bottom: 0; padding: 0 12px; min-height: 60px; }
  .top h1 { color: #fff; font-size: 18px; }
  .top-logo { display: none; }
  body.at-home .top-logo { display: block; }
  .backbtn { justify-content: center; gap: 0; width: 44px; height: 44px; padding: 0; margin-left: -6px; border: 0; border-radius: 50%; background: transparent; color: #fff; }
  .back-l { display: none; }
  .backbtn:hover { background: rgba(255, 255, 255, 0.14); }
  body.at-home .backbtn { display: none; }
  .userbtn { color: #fff; }
  .userbtn:hover { background: rgba(255, 255, 255, 0.14); }
  .userbtn .uname { display: none; }
  .view { padding: 16px 16px 28px; }
  .toast { bottom: 20px; }
  .pop { position: fixed; top: 64px; right: 12px; left: auto; width: min(270px, calc(100vw - 24px)); }
  .launch { display: block; }
}
.launch .sec { margin: 6px 2px 8px; }
.launch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
@media (min-width: 640px) { .launch-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .launch-grid { grid-template-columns: repeat(4, 1fr); } }
.lt { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; min-height: 92px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); text-decoration: none; }
.lt:active, .lt:hover { border-color: var(--blue); }
.lt-ic { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 10px; background: #E8EDFB; color: var(--blue); }
.lt-l { font-weight: 600; font-size: 15px; line-height: 1.2; }
.lt-b { position: absolute; top: 10px; right: 10px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.lt-b.late { background: var(--bad); }
.lt-b[hidden] { display: none; }

.attn { display: none; }
@media (max-width: 1023px) {
  .attn { display: flex; align-items: center; gap: 14px; width: 100%; margin-bottom: 14px; padding: 12px 14px; border: 1px solid #F0D79A; border-radius: 14px; background: #FFF6E0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
  .attn[hidden] { display: none; }
  .attn.late { background: #FDECEC; border-color: #F0B8B8; }
  .attn-n { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; border-radius: 50%; background: #D98E04; color: #fff; font-weight: 700; font-size: 17px; }
  .attn.late .attn-n { background: var(--bad); }
  .attn-t { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
  .attn-t strong { font-size: 15px; color: var(--text); }
}

/* Stage 3: lead rows (name and contact, stage and follow-up chips, Open button) */
.trow.lrow { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; text-decoration: none; }
.msg { align-items: flex-start; gap: 12px; }
@media (max-width: 720px) { .trow.lrow { grid-template-columns: 1fr; } }

/* Stage 5: agents (small round photo, click to enlarge) */
.ag-main { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; text-align: left; }
.ag-main strong { display: block; }
.trow.lrow .tchips { justify-content: flex-start; }
.trow.lrow .tacts { justify-self: end; }
.ag-av { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ag-photo { padding: 0; border: 2px solid var(--line); border-radius: 50%; overflow: hidden; background: #fff; cursor: zoom-in; flex: none; }
.ag-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ag-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.ag-big { text-align: center; }
.ag-big img { max-width: 100%; max-height: 70vh; border-radius: 12px; }

/* Stage 7: search picker */
.pk-q { width: 100%; }
.pk-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 240px; overflow: auto; }
.pk-item { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.pk-item:hover { background: #F4F6FB; }

/* Stage 9: insights bars */
.ibar { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.ibl { width: 104px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ibt { flex: 1; background: #ECEAE6; border-radius: 6px; height: 10px; overflow: hidden; }
.ibf { display: block; height: 100%; background: #1A3399; border-radius: 6px; }
.ibf.alt { background: #0A1547; }
.ibf.bad { background: #8A8A8A; }
.ibv { width: 82px; flex: none; text-align: right; color: #555; }

/* Stage 10: phone tidy-up */
.pager.single .pager-ctrl { display: none; }
@media (max-width: 640px) {
  .pager.single { display: none; }
  .pager-info { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 2px 16px 6px; scroll-snap-type: x proximity; }
  .chips::-webkit-scrollbar { display: none; }
  .chips .fchip { flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap; }
  .btn.small { min-height: 40px; padding: 0 14px; }
  .profile-actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; text-align: center; }
  .modal-scrim { align-items: flex-end; padding: 0; }
  .modal { max-width: none !important; border-radius: 18px 18px 0 0; max-height: 92vh; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; justify-content: center; }
  .row { gap: 12px; }
  .row > span:last-child, .row > strong:last-child { text-align: right; overflow-wrap: anywhere; }
}

/* Insights charts */
.chart { display: block; width: 100%; height: auto; }
.lg { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; }
.lg.stack { flex-direction: column; margin-top: 0; gap: 6px; }
.lgi { display: inline-flex; align-items: flex-start; gap: 6px; }
.lgs { width: 10px; height: 10px; border-radius: 3px; flex: none; margin-top: 4px; }
.lgi strong { display: inline; }
.donut { display: flex; align-items: center; gap: 16px; }
.donut svg { width: 120px; height: 120px; flex: none; }
.gap10 { height: 10px; }

/* Dashboard at a glance */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; color: inherit; text-decoration: none; min-width: 0; }
.stat:hover { background: #F8F9FD; }
.stat-l { font-size: 13px; color: #555; }
.stat-n { font-size: 26px; font-weight: 700; line-height: 1.15; font-family: var(--font-head); color: #0A1547; overflow-wrap: anywhere; }
@media (max-width: 480px) { .stat-n { font-size: 20px; } .stat { padding: 12px 14px; } }
.stat-s { font-size: 12px; color: #666; }
.stat.late .stat-n { color: #B3261E; }

/* Dashboard performance panels */
.perf { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; align-items: start; }
@media (min-width: 1100px) { .perf { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.perf .card { margin: 0; }
.mini { display: flex; gap: 8px; margin: 8px 0; }
.mini > div { flex: 1; background: #F4F6FB; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.mini strong { font-size: 18px; font-family: var(--font-head); }
.pace-msg { margin: 0 0 6px; font-size: 13px; color: #1E6B3A; font-weight: 600; }
.pace-msg.down { color: #B3261E; }
.perf-row { margin: 12px 0; }
.perf-row .ibt { margin: 4px 0; display: block; }
.perf-warn { font-size: 12px; color: #B3261E; }
.hbar { display: flex; height: 22px; gap: 2px; margin: 8px 0 0; }
.hbar span { display: block; min-width: 6px; }
.hbar span:first-child { border-radius: 4px 0 0 4px; }
.hbar span:last-child { border-radius: 0 4px 4px 0; }
.hbar span:only-child { border-radius: 4px; }

/* Lead notes tab (the nub on the left of each lead) */
.lw + .lw { border-top: 1px solid var(--line); }
.lw-main { display: flex; align-items: stretch; }
.lw-main .trow { flex: 1; min-width: 0; border-top: 0; }
.nub { width: 36px; flex: none; border: 0; border-right: 1px solid var(--line); background: #F4F6FB; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; cursor: pointer; font: inherit; }
.nub:hover, .nub.on { background: #FDEFCF; color: var(--blue); }
.nub-ar { display: inline-block; font-size: 14px; line-height: 1; transition: transform 0.15s; }
.nub.on .nub-ar { transform: rotate(90deg); }
.nub-n { font-size: 11px; font-weight: 600; }
.nub.none { opacity: 0.5; }
.lnotes { background: #FAF9F7; border-top: 1px solid var(--line); padding: 8px 20px 10px 56px; }
.lnote { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lnote:last-of-type { border-bottom: 0; }
.lnote p { margin: 0; white-space: pre-wrap; }
.lnote .by { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.lmore { margin: 6px 0 0; font-size: 13px; }
@media (max-width: 760px) { .lnotes { padding-left: 48px; padding-right: 14px; } }

/* Plot picker in the sale form */
.plotpick { max-height: 180px; overflow: auto; border: 1px solid var(--field); border-radius: 10px; padding: 6px 10px; background: #fff; }
.plotpick .pp { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 15px; border-bottom: 1px solid var(--line); }
.plotpick .pp:last-of-type { border-bottom: 0; }
.plotpick .pp input { width: 18px; height: 18px; }

/* Beta Search */
.bs-split { display: block; }
.bs-detail { margin-top: 14px; }
.trow.sel { background: #FDEFCF; }
.trow[data-i], .trow[data-recent] { cursor: pointer; }
@media (min-width: 1024px) { .bs-split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; align-items: start; } .bs-detail { margin-top: 0; position: sticky; top: 16px; } }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.chip.flag { background: #FFF1E0; color: #8A3F00; font-weight: 600; }

/* ---- Help guide ---- */
.tone-dark { background: #0A1547; color: #fff; }
.tone-orange { background: #1A3399; color: #fff; }
.tone-green { background: #0E5A3A; color: #fff; }
.tone-amber { background: #8A5A00; color: #fff; }
.tone-brown { background: #0F1F66; color: #fff; }
.hp-hero { display: grid; grid-template-columns: auto 1fr; gap: 14px 18px; align-items: center; padding: 20px; margin-bottom: 18px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #0A1547 0%, #12206B 100%); border-bottom: 4px solid #00B050; }
.hp-logo { height: 66px; width: auto; max-width: 180px; object-fit: contain; }
.hp-hero-t h2 { margin: 0 0 4px; font-size: 22px; color: #fff; }
.hp-hero-t p { margin: 0; color: #D9D5CE; font-size: 14px; }
.hp-hero input { grid-column: 1 / -1; min-height: 48px; padding: 0 14px; border: 0; border-radius: 12px; font: inherit; background: #fff; color: var(--text); }
.hp-hero input:focus-visible { outline: 3px solid #00B050; }
@media (max-width: 520px) { .hp-hero { grid-template-columns: 1fr; } .hp-logo { height: 46px; } }
.hp-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 700px) { .hp-tiles { grid-template-columns: repeat(3, 1fr); } }
.hp-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; text-align: left; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; min-height: 132px; }
.hp-tile:hover { border-color: #1A3399; box-shadow: 0 2px 10px rgba(10,21,71,.08); }
.hp-tile:focus-visible { outline: 3px solid #00B050; outline-offset: 2px; }
.hp-ic { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; }
.hp-tn { font-weight: 700; font-size: 15px; }
.hp-tb { color: var(--muted); font-size: 13px; }
.hp-tc { margin-top: auto; font-size: 12px; font-weight: 600; color: #1A3399; }
.hp-crumb { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.hp-area { padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.hp-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.hp-card.on { border-left: 5px solid #1A3399; box-shadow: 0 2px 10px rgba(10,21,71,.06); }
.hp-card.tone-b-dark { border-left-color: #0A1547; } .hp-card.tone-b-green { border-left-color: #0E5A3A; } .hp-card.tone-b-amber { border-left-color: #8A5A00; } .hp-card.tone-b-brown { border-left-color: #0F1F66; }
.hp-q { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 10px 14px; background: none; border: 0; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.hp-q:focus-visible { outline: 3px solid #00B050; outline-offset: -3px; }
.hp-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.hp-qt { flex: 1; font-weight: 600; }
.hp-chev { flex: none; width: 26px; height: 26px; line-height: 24px; text-align: center; border-radius: 50%; background: #F4F6FB; font-weight: 700; color: #1A3399; }
.hp-ans { padding: 2px 16px 16px 16px; }
.hp-steps { list-style: none; counter-reset: s; margin: 6px 0 14px; padding: 0; }
.hp-steps li { counter-increment: s; position: relative; padding: 6px 0 10px 40px; line-height: 1.45; }
.hp-steps li::before { content: counter(s); position: absolute; left: 0; top: 4px; width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 50%; background: #1A3399; color: #fff; font-weight: 700; font-size: 14px; }
.hp-btns { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 520px) { .hp-q { flex-wrap: wrap; } .hp-q .chip { order: 3; margin-left: 22px; } .hp-qt { flex: 1 1 60%; } }
.hp-print { margin-top: 10px; background: transparent; color: #fff; border: 1px solid #77726a; }
.hp-print:hover { border-color: #00B050; color: #00B050; }

/* Documents list: one status tag with progress */
.dstat { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.dstat .chip { align-self: flex-start; }
.dstat .sub { font-size: 12px; color: var(--muted); }
.dbar { width: 100%; max-width: 180px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.dbar .pg { height: 4px; background: #C9C4BC; }
.pg-ok { background: var(--ok) !important; }
.pg-warn { background: var(--warn) !important; }
.pg-info { background: #1F5FA8 !important; }
.chip.info { background: #E3EEFA; color: #123F73; }

/* T1: menu in sections (Sales, Money, Agents, Office) */
.side { gap: 14px; }
.side-nav + .side-nav { padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.nav-label { color: #8A93A6; padding-top: 2px; }
@media (min-width: 1024px) { .navlink { min-height: 38px; } }
@media (min-width: 1024px) and (max-height: 860px) { .side { gap: 8px; } .side-nav + .side-nav { padding-top: 6px; } .navlink { min-height: 34px; } }

/* T1: one page title (the top bar already shows it); kept for screen readers */
.toolbar .vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.toolbar .sub { font-size: 14px; }

/* T1: whole row opens; the lone Open button is now an arrow */
.trow:has(.chev) { cursor: pointer; transition: background-color 0.15s ease; }
.trow:has(.chev):hover { background: #F8F9FD; }
.chev { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: #8A93A6; cursor: pointer; }
.chev:hover, .trow:hover .chev { background: #F1EEE9; color: #0A1547; }
.chev:focus-visible { outline: 2px solid var(--accent, #1A3399); outline-offset: 2px; }
@media (max-width: 720px) { .trow .tacts:has(.chev:only-child) { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); } .trow:has(.chev) { position: relative; padding-right: 52px; } }

/* T1: clients list (initials, paid bar, one money figure) */
.trow.lrow.crow { grid-template-columns: 40px minmax(0, 1.5fr) minmax(0, 1fr) 150px 40px; }
.ini { width: 38px; height: 38px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; letter-spacing: 0.02em; flex: none; }
.cmoney { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pbar { height: 5px; border-radius: 3px; background: #E8ECF4; overflow: hidden; max-width: 220px; }
.pbar > div { height: 5px; background: #0E5A3A; border-radius: 3px; }
.cmoney .okt { color: #0E5A3A; }
.crow .tchips { justify-content: flex-end; }
@media (max-width: 720px) {
  .trow.lrow.crow { grid-template-columns: 40px minmax(0, 1fr); grid-template-areas: "i m" "i p" "i c"; column-gap: 12px; row-gap: 6px; }
  .crow .ini { grid-area: i; align-self: start; }
  .crow .tmain { grid-area: m; }
  .crow .cmoney { grid-area: p; }
  .crow .tchips { grid-area: c; justify-content: flex-start; }
  .crow .tchips:empty { display: none; }
}

/* T1: skeleton loading (grey shapes that shimmer gently) instead of the word Loading */
@keyframes sk-shine { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sk { display: inline-block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #E8ECF4 25%, #F4F6FB 50%, #E8ECF4 75%); background-size: 300% 100%; animation: sk-shine 1.3s ease-in-out infinite; vertical-align: middle; }
.sk-t { width: 90px; }
.sk-n { width: 70px; height: 24px; margin: 4px 0; }
.sk-block { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.sk-l { display: block; width: 70%; height: 12px; }
.sk-l.s2 { width: 45%; }
/* An empty list shows three placeholder rows until its data arrives */
.view [id$="-list"]:empty { min-height: 210px; border-radius: 16px; border: 1px solid var(--line); background:
  linear-gradient(90deg, #E8ECF4 25%, #F4F6FB 50%, #E8ECF4 75%) 22px 26px / 38% 12px no-repeat,
  linear-gradient(90deg, #E8ECF4 25%, #F4F6FB 50%, #E8ECF4 75%) 22px 48px / 24% 10px no-repeat,
  linear-gradient(90deg, #E8ECF4 25%, #F4F6FB 50%, #E8ECF4 75%) 22px 96px / 34% 12px no-repeat,
  linear-gradient(90deg, #E8ECF4 25%, #F4F6FB 50%, #E8ECF4 75%) 22px 118px / 20% 10px no-repeat,
  linear-gradient(90deg, #E8ECF4 25%, #F4F6FB 50%, #E8ECF4 75%) 22px 166px / 40% 12px no-repeat,
  linear-gradient(90deg, #E8ECF4 25%, #F4F6FB 50%, #E8ECF4 75%) 22px 188px / 26% 10px no-repeat,
  #fff; animation: sk-fade 1.3s ease-in-out infinite alternate; }
@keyframes sk-fade { from { opacity: 1; } to { opacity: 0.6; } }

/* T1: gentle movement. Pages fade in; windows rise into place. Off for people who ask for less motion. */
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.view > * { animation: page-in 0.22s ease-out both; }
.modal-scrim { animation: fade-in 0.18s ease-out both; }
.modal { animation: pop-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.stat, .lt, .btn, .fchip, .navlink { transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease; }
.stat:hover { box-shadow: 0 2px 10px rgba(10, 21, 71, 0.06); }
.btn:active, .lt:active, .stat:active { transform: scale(0.98); }
@media (prefers-reduced-motion: reduce) { .view > *, .modal, .modal-scrim, .sk, .view [id$="-list"]:empty { animation: none !important; } }
.stat[hidden] { display: none !important; }

/* T1: friendlier empty lists: centred message with a soft icon */
.card.tbl > .trow:only-child:not(.lrow) { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 34px 20px; }
.card.tbl > .trow:only-child:not(.lrow)::before { content: ""; width: 44px; height: 44px; border-radius: 50%; background: #F4F6FB url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%238F8A82' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 13l3-8h10l3 8v6H4z'/%3E%3Cpath d='M4 13h5l1 2h4l1-2h5'/%3E%3C/svg%3E") center / 22px no-repeat; }
.card.tbl > .trow:only-child:not(.lrow) > .sub { max-width: 380px; font-size: 14px; }

/* T2: Dashboard. Greeting, headline figures, what needs attention, top agents, then the detail panels. */
.dash { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "hello" "hero" "att" "launch" "ag" "perf" "status"; }
.dash > * { margin: 0 !important; min-width: 0; }
.dash.solo { grid-template-areas: "hello" "att" "launch"; }
@media (min-width: 1024px) {
  .dash { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "hello hello" "hero hero" "att ag" "perf perf" "status status"; }
  .dash.solo { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hello" "att"; }
  .dash .launch { display: none; }
}
.hello h2 { font-size: 22px; margin-bottom: 2px; }
.hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hcard { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 16px; background: #fff; border: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 0; transition: box-shadow 0.15s ease, transform 0.1s ease; }
.hcard:hover { box-shadow: 0 4px 16px rgba(10, 21, 71, 0.07); }
.hcard:active { transform: scale(0.985); }
.hcard .hl { font-size: 13px; color: #5B6475; }
.hcard .hn { font-family: var(--font-head); font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; color: #0A1547; overflow-wrap: anywhere; }
.hcard .hn.owe { color: #1A3399; }
.hcard .hs { font-size: 13px; color: #5B6475; }
.hcard.dark { background: #0A1547; border-color: #0A1547; }
.hcard.dark .hl { color: #BDB9B1; }
.hcard.dark .hn { color: #fff; }
.hcard.dark .hs.up { color: #7FD3A6; }
.hcard.dark .hs.down { color: #F2A28F; }
.hcard.dark .sk { background: linear-gradient(90deg, #2A2A2A 25%, #3A3A3A 50%, #2A2A2A 75%); background-size: 300% 100%; }
@media (max-width: 1023px) {
  .hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero .hcard.dark { grid-column: 1 / -1; }
  .hcard { padding: 14px 16px; }
  .hcard .hn { font-size: 26px; }
  .hero .hcard:not(.dark) .hn { font-size: 21px; }
}
.att h3 { margin-bottom: 6px; }
.arow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; font-size: 15px; }
.arow:first-child { border-top: 0; }
.arow:hover { background: #F8F9FD; }
.apill { flex: none; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #EFEDE8; color: #2B3350; }
.apill.bad { background: var(--bad-bg); color: var(--bad); }
.apill.warn { background: var(--warn-bg); color: var(--warn); }
.allclear { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; color: #0E5A3A; font-size: 15px; }
.allclear::before { content: ""; width: 28px; height: 28px; flex: none; border-radius: 50%; background: #DDF3E8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230E5A3A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 16px no-repeat; }
#topag .card { margin: 0; height: 100%; }
@media (min-width: 1100px) { .dash .perf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dash .perf { margin: 0; }

/* T2: phone bottom tab bar (Home, Clients, Leads, Search, More) on phones and tablets */
@media (max-width: 1023px) {
  .tabs { display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; align-items: stretch; padding: 0 4px env(safe-area-inset-bottom); background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  .tab { flex: 1 1 0; min-width: 0; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0 2px; border: 0; background: transparent; color: #8A93A6; font: inherit; font-size: 11px; font-weight: 500; text-decoration: none; cursor: pointer; }
  .tab.active { color: #1A3399; font-weight: 600; }
  .tab svg { width: 22px; height: 22px; }
  .sheet:not([hidden]) { display: flex !important; max-height: 80vh; overflow-y: auto; animation: sheet-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  .scrim:not([hidden]) { display: block !important; animation: fade-in 0.18s ease-out both; }
  .view { padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .sheet .sheet-sec { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #8A93A6; padding: 10px 12px 2px; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim { animation: none !important; } }

/* T3: client page (header, figures, tabs) */
.cpage { display: flex; flex-direction: column; gap: 14px; }
.cpage > .card { margin: 0; }
.cp-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; }
.ini.big { width: 56px; height: 56px; font-size: 18px; }
.cp-who { flex: 1 1 240px; min-width: 0; }
.cp-who h2 { font-size: 21px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.cp-who h2 .chip { font-size: 12px; }
.cp-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-acts .btn { text-decoration: none; }
.cp-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cp-fig { display: flex; flex-direction: column; gap: 5px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.cp-fig .hl { font-size: 13px; color: #5B6475; }
.cp-fig .fn { font-family: var(--font-head); font-size: 24px; font-weight: 700; line-height: 1.15; color: #0A1547; }
.cp-fig .fn.okt { color: #0E5A3A; }
.cp-fig .fn.owe { color: #1A3399; }
.cp-fig .fn.late { color: #B3261E; }
.cp-fig .pbar { max-width: none; margin-top: 4px; }
.cp-flag { display: flex; align-items: center; gap: 10px; }
.cp-flag select { max-width: 240px; }
.cp-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.cp-tabs::-webkit-scrollbar { display: none; }
.cp-tab { flex: none; padding: 10px 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; font: inherit; font-size: 15px; color: #5B6475; cursor: pointer; }
.cp-tab.on { color: #0A1547; font-weight: 600; border-bottom-color: #1A3399; }
#cp-body { display: flex; flex-direction: column; gap: 12px; }
#cp-body > .card { margin: 0; }
.trow.lrow.sale-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 120px 40px; }
.struck { text-decoration: line-through; color: #8A93A6; }
@media (max-width: 1023px) {
  .cp-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-head { padding: 16px; }
  .cp-acts { width: 100%; }
  .cp-acts .btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 720px) {
  .trow.lrow.sale-row { grid-template-columns: 1fr; }
  .cp-fig .fn { font-size: 20px; }
}
.cp-acts a.btn { display: inline-flex; align-items: center; justify-content: center; }
.cp-flag select { height: 42px; padding: 0 12px; border: 1px solid var(--field); border-radius: 10px; background-color: #fff; font: inherit; font-size: 14px; color: #0A1547; min-width: 200px; }

/* T3b: estate and agent pages */
.est-ic { width: 56px; height: 56px; flex: none; border-radius: 14px; background: #E8EDFB; color: #1A3399; display: inline-flex; align-items: center; justify-content: center; }
.cp-acts label.btn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cp-head .ag-photo, .cp-head .ag-av { flex: none; }

/* T3c: lead page */
.cp-fig .fn.small { font-size: 19px; }
.tline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; padding: 10px 0 14px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 22px; bottom: -4px; width: 2px; background: #E8ECF4; }
.tl-item:last-child::before { display: none; }
.tl-dot { flex: none; width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; background: #D3CEC6; position: relative; z-index: 1; }
.tl-item.note .tl-dot { background: #1A3399; }
.tl-item p { margin: 0 0 2px; color: #5B6475; }
.tl-item.note p { color: #0A1547; font-weight: 600; }

/* Calendar (month grid with a colour per kind) */
.cal-card { margin: 0 0 14px; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-title { flex: 1 1 auto; text-align: center; font-family: var(--font-head); font-size: 18px; order: 0; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px; }
.cal-key-b { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-size: 13px; color: #2B3350; cursor: pointer; }
.cal-key-b:hover { background: #F4F6FB; }
.cal-key-b.off { color: #A3ABBF; text-decoration: line-through; }
.cal-key-b.off .cal-key { opacity: 0.3; }
.cal-key { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.k-appt.cal-key, .cal-dot.k-appt { background: #1A3399; }
.k-insp.cal-key, .cal-dot.k-insp { background: #2F6B5A; }
.k-follow.cal-key, .cal-dot.k-follow { background: #5A4A8A; }
.k-inst.cal-key, .cal-dot.k-inst { background: #B3261E; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { text-align: center; font-size: 12px; font-weight: 600; color: #8A93A6; padding: 4px 0; }
.cal-c { min-height: 78px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; cursor: pointer; text-align: left; transition: background-color 0.15s ease, border-color 0.15s ease; }
.cal-c:hover { background: #F8F9FD; }
.cal-c.empty { border: 0; background: transparent; cursor: default; }
.cal-c.past { background: #F8F9FD; }
.cal-c.past .cal-n { color: #A3ABBF; }
.cal-c.today { border-color: #1A3399; }
.cal-c.today .cal-n { background: #1A3399; color: #fff; }
.cal-c.picked { box-shadow: 0 0 0 2px #0A1547 inset; }
.cal-n { align-self: flex-start; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #0A1547; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-dot { min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.cal-day { margin: 0; padding: 0; overflow: hidden; }
.cal-day-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.cal-row { border-left: 4px solid transparent; }
.cal-row.k-appt { border-left-color: #1A3399; }
.cal-row.k-insp { border-left-color: #2F6B5A; }
.cal-row.k-follow { border-left-color: #5A4A8A; }
.cal-row.k-inst { border-left-color: #B3261E; }
.cal-empty { padding: 18px 20px; margin: 0; }
@media (max-width: 720px) {
  .cal-c { min-height: 54px; padding: 4px; border-radius: 8px; }
  .cal-n { min-width: 20px; height: 20px; font-size: 12px; padding: 0 4px; }
  .cal-dot { min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; border-radius: 50%; }
  .cal-nav .cal-title { order: -1; flex-basis: 100%; }
  .cal-day-h { padding: 12px 16px; }
}
.cal-card .cal-dot { position: static; }
.cal-card .cal-c.picked { background: #FDF6EF; border-color: #0A1547; color: #0A1547; box-shadow: 0 0 0 1px #0A1547 inset; }
.cal-card .cal-c.today:not(.picked) { border-color: #1A3399; }
.cal-card .cal-c.today .cal-dot, .cal-card .cal-c.picked .cal-dot { color: #fff; }
.cal-card .cal-c .cal-dot.k-appt { background: #1A3399; }
.cal-card .cal-c .cal-dot.k-insp { background: #2F6B5A; }
.cal-card .cal-c .cal-dot.k-follow { background: #5A4A8A; }
.cal-card .cal-c .cal-dot.k-inst { background: #B3261E; }
#a-list .trow.cal-row { grid-template-columns: minmax(0, 1fr) auto 40px; }
@media (max-width: 720px) { #a-list .trow.cal-row { grid-template-columns: 1fr; } }

/* T4: estate cover photos */
.est-th { position: relative; width: 64px; height: 48px; flex: none; border-radius: 10px; overflow: hidden; background: #E8EDFB; color: #1A3399; display: inline-flex; align-items: center; justify-content: center; }
.est-th img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.trow.prow { grid-template-columns: 64px minmax(0, 1.4fr) auto minmax(150px, 1fr) 40px; column-gap: 16px; }
@media (max-width: 720px) { .trow.prow { grid-template-columns: 64px minmax(0, 1fr); } .trow.prow > .tchips, .trow.prow > .tmeta { grid-column: 2; } }
.est-cover { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 6; background: #E8ECF4; }
.est-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 720px) { .est-cover { aspect-ratio: 16 / 9; border-radius: 14px; } }

/* T4: final polish. One radius for cards, a soft lift, warm neutrals, steady numbers, calmer focus rings. */
.card { border-radius: 16px; box-shadow: 0 1px 2px rgba(10, 21, 71, 0.04); }
.cp-fig, .hcard, .stat { box-shadow: 0 1px 2px rgba(10, 21, 71, 0.04); }
.chip { color: #4A463F; background: #EFECE7; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: #E3EEFA; color: #123F73; }
.btn { transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease; }
.btn.primary { box-shadow: 0 1px 2px rgba(26, 51, 153, 0.25); }
.btn.primary:hover { box-shadow: 0 3px 10px rgba(26, 51, 153, 0.25); }
.btn.secondary:hover { border-color: #B3BBD0; }
input:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid #1A3399; outline-offset: 2px; }
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus { border-color: #1A3399; box-shadow: 0 0 0 3px rgba(26, 51, 153, 0.12); outline: none; }
.fchip { transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.fchip:not(.on):hover { border-color: #B3BBD0; background: #F8F9FD; }
.modal { border-radius: 18px; box-shadow: 0 20px 50px rgba(10, 21, 71, 0.18); }
.hn, .fn, .stat-n, .cmoney .sub, .tchips strong, .cal-dot { font-variant-numeric: tabular-nums; }
.sec { font-family: var(--font-head); font-weight: 600; letter-spacing: 0.005em; }
.toolbar { margin-bottom: 14px; }
.trow { transition: background-color 0.15s ease; }
.toast { border-radius: 12px; box-shadow: 0 10px 30px rgba(10, 21, 71, 0.2); }
@media (min-width: 721px) { .est-cover { aspect-ratio: auto; height: 240px; } }

/* ---- demo site ---- */
.demo-pill { background: var(--sky); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; margin-right: 8px; }
.demo-box { margin-top: 20px; padding: 14px; border: 1px dashed var(--field); border-radius: 12px; background: #F4F6FB; }
.demo-box strong { display: block; margin-bottom: 4px; }
.demo-box p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.demo-fill { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin-top: 8px; height: auto; padding: 10px 14px; text-align: left; }
.demo-fill small { color: var(--muted); font-weight: 500; }
