/* Light colours only. Plain and simple; mobile first for the narrow screens. */
:root {
  --bg: #f4efe4;
  --panel: #ffffff;
  --line: #e3dccb;
  --soft: #efe8da;
  --side: #fbf8f1;
  --radius: 22px;
  --shadow: 0 1px 2px #26226214, 0 8px 24px #2622620f;
  --navy: #262262;
  --ink: #17143f;
  --copper: #cf945f;
  --link: #262262;
  --focus: #0776b4;
  --text: #17143f;
  --muted: #6b6874;
  --accent: #262262;
  --current: #ece5d6;
  --bad: #b3261e;
  --good: #1d6b4a;
  color-scheme: light;
}
/* Public pages (body.brand) keep the old values of the shared names, so nothing on them changes */
body.brand {
  --bg: #f6f7fb;
  --line: #dddddd;
  --current: #e8ecf4;
  --bad: #cc3333;
  --good: #22aa77;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--link); text-underline-offset: 2px; }
/* Titles of records (task titles, client names): underline only when you point at them */
body:not(.brand) :is(strong > a, .needs-you-row .text a) { text-decoration: none; }
body:not(.brand) :is(strong > a, .needs-you-row .text a):hover { text-decoration: underline; }
:where(body:not(.brand)) :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1 { font-size: 1.25rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); font-weight: 400; }
small { font-size: .75em; }

/* Layout with left menu: the daily pages, then "Running QX", then who is logged in at the bottom */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  /* Stays in view on long pages, so the person and Log out are always at the bottom of the screen */
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.sidebar .brand-mark {
  display: inline-flex; width: 36px; height: 36px; border-radius: 10px; flex: none;
  align-items: center; justify-content: center; background: var(--navy); color: #fff; font-size: 14px;
}
.menu-items { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav[aria-label="Running QX"] { padding-top: 14px; border-top: 1px solid #e3dccb; }
.sidebar .nav-heading { margin: 0 0 4px; padding: 0 14px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.sidebar nav a svg { flex: none; }
.sidebar nav a .label { flex: 1; }
.sidebar nav a:hover { background: var(--current); }
.sidebar nav a.current, .sidebar nav a.current:hover { background: var(--navy); color: #fff; font-weight: 700; }
/* Counts next to a menu item: muted, or a red pill when something needs doing */
.count { font-size: 13px; font-weight: 700; color: var(--muted); }
.count.alert { padding: 0 8px; border-radius: 999px; background: var(--bad); color: #fff; }
.sidebar a.current .count:not(.alert) { color: #fff; }
.sidebar .find {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px;
  background: #fff; border: 1px solid #e3dccb; border-radius: 12px; color: var(--muted);
}
.sidebar .find svg { flex: none; }
.sidebar .find input { margin: 0; padding: 10px 0; border: 0; background: none; min-width: 0; }
.sidebar .find input:focus { outline: none; }
.sidebar .find:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid #e3dccb; }
.sidebar .me-name { flex: 1; font-weight: 700; }
.sidebar .me form { margin: 0; }
.sidebar .account { margin-top: auto; padding-top: 14px; border-top: 1px solid #e3dccb; }
.sidebar .account ~ .me { margin-top: 0; }
.sidebar .me .link-button { min-height: 44px; padding: 8px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A person's initials in a coloured circle (the colour comes from their name) */
.avatar {
  --size: 36px;
  display: inline-flex;
  flex: none;
  width: var(--size);
  height: var(--size);
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: calc(var(--size) * .36);
  line-height: 1;
}
main { flex: 1; min-width: 0; padding: 28px 32px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.5rem); line-height: 1.1; font-weight: 800; letter-spacing: -0.035em; color: var(--navy); }
/* The grey part of a title (the month, a client's contact details) stays small next to the big words */
.page-head h1 .muted { font-size: max(15px, .45em); font-weight: 600; letter-spacing: 0; }

/* Plain pages: log in, reset password, partner page */
main.narrow { max-width: 420px; margin: 0 auto; padding-top: 32px; }
main.narrow .brand { font-weight: 700; font-size: 1.4rem; margin-bottom: 16px; }

/* Forms and buttons: every control looks the same */
input[type="email"], input[type="password"], input[type="text"], input[type="number"], input[type="date"],
input[type="tel"], input[type="search"], input[type="url"], select, textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: var(--panel);
  color: var(--text);
}
/* Owner and salesperson screens: rounder, 44px-tall boxes (public pages keep their own) */
:where(body:not(.brand)) :is(input[type="email"], input[type="password"], input[type="text"], input[type="number"], input[type="date"],
input[type="tel"], input[type="search"], input[type="url"], select, textarea) {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
}
select { width: auto; max-width: 100%; }
main.narrow select { width: 100%; }
/* Small boxes for numbers: how many, rands, percent */
input.qty { width: 4.5em; }
input.num { width: 7em; }
input.ref { width: 12em; }
input[type="date"] { width: auto; max-width: 100%; }
main.narrow input[type="date"] { width: 100%; }
td input, td select, .with-unit input, form.add-row input, form.add-row select, form.mark-paid input { margin-bottom: 0; }
td input[type="text"], td input[type="number"] { vertical-align: middle; }
.with-unit { display: inline-flex; align-items: center; gap: 6px; }
form.mark-paid p, form.add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
form.add-row { margin: 12px 0; }
/* Buttons: navy is the main one, .secondary is white with a navy edge, .danger is red.
   Links, button_to forms and submit buttons all look the same. Public pages (body.brand) keep their own. */
:where(body:not(.brand)) :is(button, input[type="submit"], a.button, summary.button, summary.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
:where(body:not(.brand)) :is(button, input[type="submit"], a.button, summary.button, summary.btn):hover { background: var(--ink); border-color: var(--ink); }
:where(body:not(.brand)) :is(button, input[type="submit"], a.button, summary.button, summary.btn).secondary,
:where(body:not(.brand)) summary.btn:not(.warn) {
  background: var(--panel);
  color: var(--accent);
}
:where(body:not(.brand)) :is(button, input[type="submit"], a.button, summary.button, summary.btn).secondary:hover,
:where(body:not(.brand)) summary.btn:not(.warn):hover { background: var(--current); border-color: var(--accent); }
:where(body:not(.brand)) :is(button, input[type="submit"], a.button).danger,
:where(body:not(.brand)) a.button.alert-button { background: var(--bad); border-color: var(--bad); color: #ffffff; }
:where(body:not(.brand)) :is(button, input[type="submit"], a.button).danger:hover,
:where(body:not(.brand)) a.button.alert-button:hover { background: #8f1e18; border-color: #8f1e18; }
:where(body:not(.brand)) :is(button, input[type="submit"]).danger.secondary { background: var(--panel); color: var(--bad); }
:where(body:not(.brand)) summary.btn.warn { background: var(--panel); color: var(--bad); border-color: var(--bad); }
:where(body:not(.brand)) :is(button, input[type="submit"], a.button).small { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
/* A button that looks like a plain text link ("Log out", "Reopen") */
:where(body:not(.brand)) :is(button, input[type="submit"]).link-button {
  min-height: 40px;
  background: none;
  border-color: transparent;
  border-radius: 8px;
  color: var(--link);
  padding: 4px 8px;
  font-weight: 400;
  text-decoration: underline;
}
:where(body:not(.brand)) :is(button, input[type="submit"]).link-button:hover { background: none; border-color: transparent; color: var(--ink); }

.flash { padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.flash.alert { background: #fbeaea; color: var(--bad); }
.flash.notice { background: #e6f6ef; color: #17714d; }
:where(body:not(.brand)) .flash { padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; font-weight: 600; }
:where(body:not(.brand)) .flash.notice { background: #e6f2ec; color: #1d5e44; }

/* Phones: the menu folds away behind a hamburger button */
.menu-toggle, .hamburger { display: none; }
@media (max-width: 700px) {
  .shell { display: block; }
  .sidebar {
    width: auto;
    min-height: 0;
    /* The open menu never runs past the screen: it scrolls on short screens or with the keyboard up */
    max-height: 100dvh;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .sidebar .brand { margin: 0; padding: 0; flex: 1; font-size: 16px; }
  .sidebar .brand-mark { width: 32px; height: 32px; font-size: 13px; }
  .hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0 11px;
    border-radius: 12px;
    cursor: pointer;
  }
  .hamburger span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
  .menu-toggle:focus-visible + .hamburger { outline: 2px solid var(--focus); }
  .menu-toggle:checked + .hamburger { background: var(--current); }
  .menu-items { display: none; flex: 1 1 100%; padding-top: 12px; gap: 12px; }
  .menu-toggle:checked ~ .menu-items { display: flex; }
  .menu-toggle {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }
  .sidebar nav a { font-size: 1.05rem; }
  .sidebar .me { margin-top: 0; padding-bottom: 4px; }
  .sidebar .account { margin-top: 0; }
  main { padding: 16px; }
}

/* Price list */
/* A list table is a white card of its own; inside a card it is just rows split by soft lines */
.prices { width: 100%; border-collapse: collapse; background: var(--panel); }
.prices th, .prices td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
:where(body:not(.brand)) .prices { border-collapse: separate; border-spacing: 0; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
:where(body:not(.brand)) .prices :is(th, td) { padding: 12px 16px; border-bottom-color: var(--soft); }
:where(body:not(.brand)) .prices th { color: var(--muted); font-size: 13px; font-weight: 700; }
:where(body:not(.brand)) .prices tr:last-child > td { border-bottom: 0; }
:where(body:not(.brand)) :is(.card, .panel) .prices { border-radius: 0; box-shadow: none; overflow: visible; }
:where(body:not(.brand)) :is(.card, .panel) .prices :is(th, td):first-child { padding-left: 0; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.public { background: #e6f2ec; color: #1d5e44; }
.badge.sales { background: var(--current); color: var(--text); }
.disabled-button { display: inline-block; margin-left: 8px; padding: 2px 10px; border: 1px dashed var(--line); border-radius: 999px; color: var(--muted); }
@media (max-width: 700px) { .prices:not(.cards) { display: block; overflow-x: auto; } }

/* Lists as cards on phones: each row is a card, each cell shows its column heading. */
@media (max-width: 700px) {
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; }
  table.cards { background: none; border-radius: 0; box-shadow: none; overflow: visible; }
  table.cards thead { display: none; }
  table.cards tr { margin-bottom: 12px; padding: 14px 16px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); }
  table.cards td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 0; text-align: right; }
  table.cards td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: .85rem; text-align: left; }
  table.cards td:first-child { display: block; padding-bottom: 8px; font-weight: 700; text-align: left; }
  table.cards td:first-child::before { content: none; }
  table.cards td[colspan] { display: block; text-align: left; }
  table.cards td[colspan]::before { content: none; }
  table.cards td:has(form), table.cards td:has(a + a) { flex-wrap: wrap; }
  table.cards td.money, table.cards .money { white-space: nowrap; }
  table.cards td:empty { display: none; }
  table.cards .price-cell { text-align: right; }
  table.cards .price-cell small { display: block; }
  table.cards .sep { display: none; }
  table.cards td[data-label="Action"]::before { margin-right: auto; }
  table.cards td[data-label="Action"] { justify-content: flex-end; gap: 12px; }
  table.cards td[data-label="Action"] a, table.cards td:first-child a, table.cards td[data-label="Invoice"] a {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 6px;
  }
  /* The title link: no 40px box (it left a gap above the title); the padding keeps it easy to tap */
  table.cards td:first-child { padding-top: 0; }
  table.cards td:first-child a { min-height: 0; padding: 6px 0; }
  table.cards td[data-label="Mark as paid"] { display: block; }
  table.cards td[data-label="Mark as paid"]::before { display: block; margin-bottom: 4px; }
  table.cards td[data-label="Mark as paid"] input { min-height: 40px; }
}

/* Number tiles (partner, statement and sales link pages) */
.summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.summary .tile { flex: 1; min-width: 120px; padding: 14px 18px; background: var(--panel); border-radius: 18px; box-shadow: 0 1px 2px #26226214; }
/* Tabs and filter bars (Mine | Everyone | Show done): a row of pills; the chosen one is navy */
.tabs, .filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
:is(.tabs, .filters) > a, .filters a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
:is(.tabs, .filters) > a:hover, .filters a:hover { background: var(--current); }
:is(.tabs, .filters) > a:is(.current, [aria-current="page"]), .filters a:is(.current, [aria-current="page"]) {
  background: var(--navy); border-color: var(--navy); color: #ffffff; font-weight: 700;
}

/* Forms: one column, labels above their fields */
.form-stack { max-width: 42rem; }
.form-stack p { margin: 0 0 14px; }
.form-stack label, .form-stack .field-label { display: block; margin-bottom: 4px; font-weight: 600; }
/* A tick box or radio sits on one line with its words (and the price after it) */
.form-stack label:has(> input[type="checkbox"], > input[type="radio"]) { display: inline-flex; align-items: baseline; gap: 8px; font-weight: 400; }
.form-stack label:has(> input[type="checkbox"], > input[type="radio"]) > input { margin: 0; }
.form-stack .terms label { font-weight: 400; }
.form-stack input[type="checkbox"], .form-stack input[type="radio"] { margin-right: 6px; }
.form-stack input, .form-stack textarea, .form-stack select { margin-bottom: 0; }
.form-stack :is(input, select, textarea) + input[type="submit"] { margin-top: 10px; }
.form-stack input:focus, .form-stack textarea:focus, .form-stack select:focus { border-color: var(--focus); }
.form-stack fieldset { padding: 10px 14px 4px; }
.form-stack legend { font-weight: 600; padding: 0 6px; }
.form-stack h2 { font-size: 1.05rem; margin: 22px 0 8px; }
.form-stack > div { margin-top: 14px; }
/* "What happens next": one radio per line, close together */
fieldset.setup-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-bottom: 10px; }
.setup-choice label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.setup-choice input { margin: 0; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 6px 0; background: var(--panel); }
/* Cards: white, round, a soft shadow. .panel is the same thing (older pages use that name). */
:where(body:not(.brand)) :is(.card, .panel) {
  margin: 0 0 16px;
  padding: 22px 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
/* Cards that are one item in a list (a product on the client page): tighter */
:where(body:not(.brand)) .card.product-row { margin-bottom: 10px; padding: 14px 18px; border-radius: 18px; }
.card-row { padding: 14px 0; border-top: 1px solid var(--soft); }
.card-row:first-child { border-top: 0; }
/* A small status pill: soft by default; .good, .bad and .warn colour it */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.pill.good { background: #e6f2ec; color: #1d5e44; }
.pill.bad { background: #fbeaea; color: var(--bad); }
.pill.warn { background: #fbefe2; color: #8a4a12; }
form.inline { display: inline; }
.history { list-style: none; padding: 0; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--soft); }

/* Paying an invoice: a button on phones, a code to scan on computers */
.pay-desktop { display: none; }
@media (min-width: 800px) {
  .pay-phone { display: none; }
  .pay-desktop { display: block; }
}

/* Sales links */
/* Sales links: WhatsApp and Copy link, the same big size (colours from .button / .secondary) */
.link-actions .share-button { padding: 12px 20px; font-size: 1.1rem; }

/* Public sign-up pages: one column, big buttons */
main.narrow h1 { font-size: 1.5rem; }
.package { border: 2px solid var(--accent); border-radius: 10px; padding: 12px 14px; margin: 14px 0; background: var(--panel); }
.package h2 { margin: 4px 0; font-size: 1.2rem; }
.big-price { font-size: 1.5rem; font-weight: 700; margin: 4px 0; }
.big-price small { font-size: .85rem; font-weight: 400; }
.ticks { list-style: none; padding: 0; line-height: 1.8; }
.ticks li::before { content: "\2713\00a0"; color: #1f8f4e; font-weight: 700; }
a.button.big, input[type="submit"].big { display: block; width: 100%; box-sizing: border-box; padding: 14px; font-size: 1.1rem; text-align: center; }
.center { text-align: center; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
.terms { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.terms input { margin-top: 4px; }
.after { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
main.narrow label { display: block; font-size: .9rem; margin-bottom: 2px; }
.terms label { display: inline; }

/* Needs you */
.needs-you { list-style: none; padding: 0; margin: 0; }
.needs-you-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; margin-bottom: 10px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); }
.needs-you-row .text { flex: 1; }
.needs-you-row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.needs-you-row .actions form { margin: 0; }
.needs-you-row .actions a.button, .needs-you-row .actions button { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.needs-you-row .dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.needs-you-row.red .dot { background: var(--bad); }
.needs-you-row.orange .dot { background: #e8833a; }
.needs-you-row.green .dot { background: #2f7d6d; }
.needs-you-row.yellow .dot { background: #e6b800; }
@media (max-width: 700px) { .needs-you-row { flex-wrap: wrap; } .needs-you-row .actions { width: 100%; justify-content: flex-start; } }

/* Home: the greeting and the money line, Needs you, client cards, my plate and coming up */
main:has(> .home-head) { max-width: 1140px; margin-inline: auto; }
.home-head { text-align: center; margin-bottom: 28px; }
.home-date { margin: 0; color: var(--muted); font-weight: 600; }
.home-head h1 { margin: 4px 0 18px; font-size: clamp(1.6rem, 4vw, 2.5rem); line-height: 1.1; letter-spacing: -0.035em; font-weight: 800; color: var(--navy); }
.money-line { display: inline-flex; flex-wrap: wrap; justify-content: center; max-width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.money-line > div { padding: 12px 22px; border-right: 1px solid var(--soft); }
.money-line .label { display: block; font-size: 13px; color: var(--muted); }
.money-line .figure { display: block; font-size: 20px; font-weight: 800; }
.money-line .figure.bad { color: var(--bad); }
.money-line > a { display: flex; align-items: center; min-height: 44px; padding: 12px 22px; font-weight: 700; }
.home-section { margin-bottom: 36px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-head h2, .home-pair h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; color: var(--navy); }
.section-head .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#needs .section-head { margin-bottom: 8px; }
.needs-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.needs-row .text { flex: 1 1 320px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.needs-row .text small { font-weight: 400; }
.needs-row .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.needs-row .actions form { margin: 0; }

/* A copper button: ink text only, never white */
:where(body:not(.brand)) a.button.copper { background: var(--copper); border-color: var(--copper); color: var(--ink); }
:where(body:not(.brand)) a.button.copper:hover { background: #bd8250; border-color: #bd8250; color: var(--ink); }

/* Client cards: name, plan, stage with progress, the people, what they owe */
.client-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.client-card {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 20px;
  background: var(--panel); border-radius: 20px; box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none; overflow-wrap: anywhere; transition: box-shadow .15s;
}
.client-card:hover { box-shadow: 0 10px 30px #26226226; }
.client-card > span { display: block; }
.client-card .name { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); }
.client-card .plan { font-size: 14px; color: var(--muted); }
.client-card .stage { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; font-size: 14px; }
.client-card .card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--soft); }
.client-card .people { display: flex; padding-right: 6px; }
.client-card .people .avatar { margin-right: -6px; border: 2px solid var(--panel); }
.client-card .owes { font-size: 14px; font-weight: 700; white-space: nowrap; }
.owes.bad { color: var(--bad); }
.add-client { display: flex; align-items: center; justify-content: center; min-height: 190px; border: 2px dashed #d6ccb6; border-radius: 20px; color: var(--muted); font-weight: 700; text-decoration: none; }
.add-client:hover { background: var(--side); color: var(--navy); }
.more-clients { margin: 14px 0 0; text-align: right; font-weight: 600; }

/* On your plate and Coming up, side by side */
.home-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 36px; }
.home-pair .card { margin: 0; }
.home-pair h2 { font-size: 20px; margin: 0 0 4px; }
.home-pair .subtitle { margin: 0 0 8px; font-size: 14px; }
.plate-row { display: flex; align-items: flex-start; gap: 12px; }
.plate-row form { margin: 0; flex: none; }
.plate-row .text, .coming-row .text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.plate-row .title { display: block; font-weight: 600; color: var(--ink); text-decoration: none; }
.plate-row .title:hover { text-decoration: underline; }
.plate-row small, .coming-row small { display: block; font-size: 13px; }
.plate-row .due { font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.plate-row .due.bad { color: var(--bad); }
/* The round tick that marks a task done: a 40px tap area around a 24px circle */
:where(body:not(.brand)) button.tick { width: 40px; height: 40px; min-height: 40px; margin: -8px 0 -8px -8px; padding: 0; border: 0; background: none; }
:where(body:not(.brand)) button.tick:hover { background: none; border-color: transparent; }
button.tick > span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 2px solid var(--navy); border-radius: 999px; color: transparent; font-size: 14px; font-weight: 800; }
button.tick:is(:hover, :focus-visible) > span { background: var(--navy); color: #ffffff; }
.coming-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.date-block { flex: none; width: 52px; padding: 6px 0; text-align: center; background: var(--bg); border-radius: 12px; }
.date-block .month { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #8a5426; }
.date-block .day { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.coming-row .title { display: block; font-weight: 600; }

/* "+ New": two buttons on a computer, one "+ New" menu on a phone */
details.new-menu { display: none; position: relative; }
details.new-menu > summary { list-style: none; }
details.new-menu > summary::-webkit-details-marker { display: none; }
.new-menu-list { position: absolute; right: 0; z-index: 5; margin-top: 6px; min-width: 11rem; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; }
.new-menu-list a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.new-menu-list a:hover { background: var(--current); }
@media (max-width: 700px) {
  .section-head .button.new-desktop { display: none; }
  details.new-menu { display: block; }
  .money-line > div, .money-line > a { padding: 10px 14px; }
  .money-line > div:nth-of-type(3) { border-right: 0; } /* "See the money" wraps to its own line on a phone */
  .needs-row .text { flex-basis: 200px; }
}

/* Billing's "The money" tab: the numbers that used to be on Home */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 16px 20px; border-radius: 18px; background: var(--panel); box-shadow: 0 1px 2px #26226214; }
.kpi .label, .kpi .note { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.kpi .value.bad { color: var(--bad); }
.kpi .note.up { color: var(--good); font-weight: 600; }
.kpi .note.down { color: var(--bad); }
:where(body:not(.brand)) :is(.panel h2, .card > h2:first-child) { font-size: 18px; letter-spacing: -0.02em; color: var(--navy); margin: 0 0 10px; }
.two-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.chart { margin: 0; }
.chart-plot { position: relative; height: 280px; }
.chart-area { position: absolute; inset: 14px 14px 30px 62px; }
.chart-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-area .y-label { position: absolute; right: 100%; margin-right: 6px; transform: translateY(-50%); font-size: 12px; line-height: 1; color: var(--muted); white-space: nowrap; }
.chart-area .x-label { position: absolute; top: 100%; margin-top: 8px; transform: translateX(-50%); font-size: 12px; line-height: 1; color: var(--muted); }
.chart-area .target-label { position: absolute; right: 0; transform: translateY(-120%); font-size: 12px; line-height: 1; color: #555555; }
.chart-area .dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; }
@media (max-width: 700px) {
  .chart-plot { height: 260px; }
  .chart-area { left: 56px; right: 8px; }
  .chart-area .skip-on-phone { visibility: hidden; }
}
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .85rem; color: var(--muted); margin-top: 4px; }
.chart-legend i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; }
.chart-legend i.dash { background: repeating-linear-gradient(90deg, #555 0 6px, transparent 6px 10px); }
.bar-row { margin: 8px 0; }
.bar-row .amount { float: right; font-weight: 600; }
/* A progress track: soft background, navy fill */
.bar { height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.bar > i { display: block; height: 8px; border-radius: 999px; background: var(--navy); }
table.plain { width: 100%; border-collapse: collapse; }
table.plain th { color: var(--muted); font-weight: 700; text-align: left; font-size: 13px; }
table.plain th, table.plain td { padding: 8px 8px 8px 0; }
table.plain td { border-top: 1px solid var(--soft); }

/* The salesperson's own view: one column, big tap targets, no owner menu */
.viewing-as-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.viewing-as-bar form { margin: 0; }
form.viewing-as-lock :is(button, input, select, textarea):disabled { opacity: 0.5; cursor: not-allowed; }

/* Buttons that open a small panel (details/summary) */
.actions-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin: 14px 0; }
.actions-row form { margin: 0; }
details.action > summary { list-style: none; cursor: pointer; }
details.action > summary::-webkit-details-marker { display: none; }
details.action[open] { flex-basis: 100%; }
details.action[open] > summary.btn { background: var(--current); color: var(--text); border-color: var(--line); }
.action-panel { margin-top: 8px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; max-width: 30em; }
.action-panel.wide { max-width: 44em; }
.action-panel p:first-child { margin-top: 0; }
.warning { color: var(--bad); font-weight: 600; }
summary.link-summary { display: inline; color: var(--muted); text-decoration: underline; font-size: .85rem; }
summary.link-summary.warn { color: var(--bad); }
.product-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.small-action[open] { flex-basis: 100%; }
.product-line .small-action[open] { flex: 1 1 100%; }
.group-title { font-size: .85rem; color: var(--muted); font-weight: 600; margin: 12px 0 2px; text-transform: none; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 12px; background: var(--panel); }
:where(body:not(.brand)) fieldset { border-radius: 16px; }
table.lines-form td, table.lines-form th { padding: 4px 8px 4px 0; vertical-align: middle; }
table.lines-form td input { margin: 0; }
table.lines-form { table-layout: fixed; }
table.lines-form th:nth-child(1), table.lines-form td:nth-child(1) { width: 2em; }
table.lines-form th:nth-child(3), table.lines-form td:nth-child(3) { width: 6em; }
table.lines-form th:nth-child(4), table.lines-form td:nth-child(4) { width: 8.5em; }

/* Tasks: the filters card, then a card per list. Each row: a round tick on the left, the title and where it belongs,
   the date in the top-right corner and who it is for in the bottom-right corner. */
.task-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px 16px; border-radius: 18px; }
.task-filters .filter { display: flex; flex: 1 1 140px; flex-direction: column; gap: 4px; min-width: 0; }
.task-filters label { font-size: 13px; font-weight: 700; color: var(--muted); }
.task-filters select { width: 100%; margin: 0; }
.task-filters button { flex: none; }
.showing { margin: 0 0 18px; font-size: 14px; }
.task-group h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.02em; color: var(--navy); }
.task { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--soft); }
.task-group .task { border-bottom: 0; border-top: 1px solid var(--soft); }
.task form { margin: 0; flex: none; }
.task-main { min-width: 0; overflow-wrap: anywhere; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.task-side { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; align-self: stretch; gap: 6px; text-align: right; }
.task .when { font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.task .assignee { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #3f3b4a; white-space: nowrap; }
.avatar.nobody { background: var(--muted); }
.task.done .task-main strong { text-decoration: line-through; }
.task .overdue-date { color: var(--bad); font-weight: 700; }

/* Phones: every tap target is at least 40px tall */
@media (max-width: 700px) {
  .page-head .button, .needs-you-row .actions a.button, .needs-you-row .actions button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  /* Home: the Needs you buttons and the plate's actions (the round tick is already 40px) */
  .needs-row .actions :is(a.button, button), .home-pair .plate-row :is(a.button, button:not(.tick)) { min-height: 40px; }
  /* Every small button, wherever it is (task rows on Tasks, client and partner pages too) */
  :where(body:not(.brand)) :is(button, input[type="submit"], a.button).small { min-height: 40px; }
  details.more > summary, details.extras > summary { min-height: 40px; }
  .tabs > a { padding: 8px 14px; }
  :where(body:not(.brand)) :is(.card, .panel) { padding: 16px 18px; }
}

/* "More" and "Add extras": link coloured, with an arrow that turns down when open */
:is(details.more, details.extras) > summary { list-style: none; cursor: pointer; color: var(--link); }
:is(details.more, details.extras) > summary::-webkit-details-marker { display: none; }
:is(details.more, details.extras) > summary::before { content: "\25B8"; display: inline-block; width: 1.1em; }
:is(details.more, details.extras)[open] > summary::before { content: "\25BE"; }
.break-anywhere { overflow-wrap: anywhere; }
.link-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Phones: the number tiles hide, and the tabs wrap onto a second row if needed */
@media (max-width: 700px) {
  .summary { display: none; }
  /* The pill tabs wrap, so the current one is always in view */
  .tabs > a { white-space: nowrap; }
}

/* Dashboard target progress */
.target-progress { margin-top: 10px; }
.target-progress p { margin: 0 0 4px; }
.target-progress .bar { height: 8px; }
.target-progress .bar i { height: 8px; background: var(--good); }

/* Product picking: the quantity shows only once the product is ticked (works without JS) */
.product-pick .qty { display: none; }
.product-pick:has(input[type="checkbox"]:checked) .qty { display: inline-block; }
details.extras > summary { display: flex; align-items: center; font-weight: 600; padding: 6px 0; }

/* Job page: the breadcrumb, the hero with the stage bar, then Next up and a to-do list per service, with the client's
   page, what we wait for, who's on it and the products at the side. The two columns stack below 900px. */
main:has(> .job-hero) { max-width: 1120px; margin-inline: auto; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: -10px 0 8px; font-size: 14px; }
.crumbs a { display: inline-flex; align-items: center; min-height: 40px; font-weight: 600; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs > span { color: var(--muted); }
:where(body:not(.brand)) .card.job-hero { margin-bottom: 22px; padding: 32px 32px 26px; border-radius: 26px; box-shadow: 0 1px 2px #26226214, 0 12px 36px #26226214; }
.job-hero h1 { margin: 0; text-align: center; font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.1; letter-spacing: -0.035em; font-weight: 800; color: var(--navy); overflow-wrap: anywhere; }
.job-hero > p.muted { margin: 8px 0 24px; text-align: center; }
/* The stage bar: done stages navy, the one we're in copper, later ones soft */
.stage-bar { display: grid; grid-template-columns: repeat(var(--stages, 5), minmax(0, 1fr)); gap: 6px; }
.stage-track { display: block; height: 10px; border-radius: 999px; background: var(--soft); }
.stage.done .stage-track { background: var(--navy); }
.stage.now .stage-track { background: var(--copper); }
.stage-name { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.stage.later .stage-name { color: var(--muted); }
.stage.now .stage-name { font-weight: 800; }
.job-notice { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--soft); text-align: center; }
.job-notice p { margin: 0 0 10px; }
.job-notice form { margin: 0; }

.job-columns { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 22px; }
.job-main { display: flex; flex: 999 1 560px; flex-direction: column; gap: 18px; min-width: 0; }
.job-aside { display: flex; flex: 1 1 300px; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 900px) { .job-main, .job-aside { flex-basis: 100%; } }
/* On phones the two columns dissolve into one list so the client's page and "Waiting on" come straight after Next up. */
@media (max-width: 900px) {
  .job-columns { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 18px; }
  .job-main, .job-aside { display: contents; }
  .job-main > .next-up { order: 1; }
  .job-aside > .client-page-card { order: 2; }
  .job-aside > .waiting-card { order: 3; }
  .job-main > .todo-list { order: 4; }
  .job-main > #from-client { order: 5; }
  .job-aside > :not(.client-page-card, .waiting-card) { order: 6; }
}
:where(body:not(.brand)) .job-columns .card { margin: 0; }
.job-columns .card h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -0.02em; color: var(--navy); }
.job-columns .card .card-head h2 { margin: 0; font-size: 22px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.card-head .muted, .job-aside .card > p.muted { font-size: 14px; }
.job-aside .card > p.muted { margin: 0 0 8px; }

/* Next up: a round tick (or the step's own button), the title, who and when, then the other actions */
.todo-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-top: 1px solid var(--soft); }
.todo-mark { flex: none; width: 32px; }
.todo-mark form { margin: 0; }
.todo-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo-title { display: block; font-size: 16px; font-weight: 600; }
.todo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; font-size: 13px; }
.todo-group { color: var(--muted); font-weight: 600; }
.todo-meta .who { display: inline-flex; align-items: center; gap: 6px; }
.row-link { font-weight: 600; }
.row-link.strong { font-weight: 700; }
.todo-row .warning { margin: 6px 0 0; }
.step-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.step-actions form { margin: 0; }
.step-actions:not(:has(*)) { display: none; }
.step-submission { margin-top: 8px; padding: 10px 14px; background: var(--side); border: 1px solid var(--soft); border-radius: 14px; }
details.more { margin-top: 6px; }
details.more > summary { display: inline-flex; align-items: center; font-size: .9rem; padding: 4px 0; }
details.more form + form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
details.add-step { margin-top: 6px; }
details.add-step > summary { display: inline-flex; align-items: center; min-height: 40px; font-weight: 700; color: var(--link); }

/* A to-do list per service: a ring, the name and the count, then later steps and finished ones (struck through) */
.todo-list-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.job-columns .card .todo-list-head h2 { flex: 1; min-width: 0; margin: 0; }
.todo-list-head .muted { font-size: 14px; white-space: nowrap; }
.ring { display: block; flex: none; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 0 10px 40px; border-top: 1px solid var(--soft); font-size: 14px; }
.list-title { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.list-row.finished .list-title { color: var(--muted); }
.list-note { font-size: 12px; color: var(--muted); }
.list-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.list-actions:not(:has(*)) { display: none; }
.list-actions form { margin: 0; }
.list-row .warning { flex-basis: 100%; margin: 0; }
/* More sits beside Edit, so a row is one line like the mockup; open, it takes the whole width */
.list-row details.more { margin-top: 0; }
.list-row details.more[open] { flex-basis: 100%; }

/* The side column: the client's page on navy, then plain lists */
:where(body:not(.brand)) .card.client-page-card { background: var(--navy); color: #ffffff; box-shadow: none; }
.job-columns .client-page-card h2 { color: #ffffff; }
.client-page-card .intro { margin: 0 0 12px; font-size: 14px; color: #d9d6ea; }
.client-page-card code { display: block; margin-bottom: 14px; padding: 10px 12px; border-radius: 12px; background: #ffffff1a; font: 13px/1.4 ui-monospace, monospace; }
.client-page-card .link-actions { margin: 0 0 14px; }
.client-page-card :is(button, input[type="submit"]).secondary { background: transparent; border-color: #ffffff99; color: #ffffff; }
.client-page-card :is(button, input[type="submit"]).secondary:hover { background: #ffffff1a; border-color: #ffffff; }
.client-page-card label { display: block; flex-basis: 100%; margin-bottom: 4px; font-size: 14px; font-weight: 600; }
.client-page-card .preview-form p { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; }
.client-page-card .preview-form input[type="url"] { flex: 1 1 160px; width: auto; min-width: 0; margin: 0; }
.client-page-card form { margin: 0; }
.client-page-card button.link-button, .client-page-card button.link-button:hover { padding-left: 0; color: #ffffff; }
.client-page-card :focus-visible { outline-color: #ffffff; }
.aside-list { margin: 0; padding: 0; list-style: none; }
.aside-list li { padding: 10px 0; border-top: 1px solid var(--soft); font-size: 14px; overflow-wrap: anywhere; }
.job-aside .product-line { align-items: center; }
.people-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.person { display: flex; align-items: center; gap: 10px; }
.cancel-job { text-align: center; }
.cancel-job form { display: inline; margin: 0; }
.job-aside button.link-button.danger-link { color: var(--bad); }
.job-aside button.link-button.danger-link:hover { color: #8f1e18; }

/* Phones: 40px tap targets, and the stage names a little smaller so five fit side by side */
@media (max-width: 700px) {
  :where(body:not(.brand)) .card.job-hero { padding: 22px 18px 18px; }
  .row-link { display: inline-flex; align-items: center; min-height: 40px; }
  .stage-bar { gap: 4px; }
  .stage-name { font-size: 12px; }
}

/* Client page as a project: the breadcrumb, a centred header with the people, the numbers as pills, then a card per
   tool (onboarding, billing, products, history, tasks, commission). A card's link opens its tool page: the old tab's
   content in one card under the same header. The cards stack in one column on phones. */
main:has(> .client-hero) { max-width: 1100px; margin-inline: auto; }
:where(body:not(.brand)) .card.client-hero { margin-bottom: 0; padding: 36px 32px 28px; border-radius: 26px; text-align: center; box-shadow: 0 1px 2px #26226214, 0 12px 36px #26226214; }
.client-hero h1 { margin: 0; font-size: clamp(1.8rem, 6vw, 2.75rem); line-height: 1.05; letter-spacing: -0.04em; font-weight: 800; color: var(--navy); overflow-wrap: anywhere; }
.client-hero > p.muted { margin: 8px 0 0; overflow-wrap: anywhere; }
.contact-part { display: inline-block; max-width: 100%; }
.client-hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.client-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 22px; margin: 26px 0 0; padding: 22px 0 0; border-top: 1px solid var(--soft); list-style: none; }
.client-people .person { text-align: left; }
.client-people .person-name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.client-people .person-role { display: block; font-size: 13px; color: var(--muted); }

.client-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px 0 26px; }
.client-pills .pill { padding: 8px 16px; border: 1px solid var(--line); background: var(--panel); font-size: 15px; font-weight: 400; }
.client-pills .pill.bad { color: var(--bad); }
.client-pills .pill.good { border-color: #b9dccb; background: #e6f2ec; color: #1d5e44; font-weight: 700; }
.client-pills .pill.warn { border-color: #f0d3b4; background: #fbefe2; color: #8a4a12; font-weight: 700; }

.tool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 18px; }
:where(body:not(.brand)) .card.tool-card { display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 22px 24px; }
/* Wider screens: the cards keep the mockup's height even with little in them, so the grid stays even */
@media (min-width: 701px) { :where(body:not(.brand)) .card.tool-card { min-height: 280px; } }
.tool-card h2 { margin: 0 0 4px; font-size: 20px; line-height: 30px; letter-spacing: -0.02em; color: var(--navy); }
/* The title link is 40px tall to tap, but takes only its 30px line, so the line under it sits close like the mockup */
.tool-card h2 a { display: inline-flex; align-items: center; min-height: 40px; margin-block: -5px; color: inherit; text-decoration: none; }
.tool-card h2 a:hover { text-decoration: underline; }
.tool-card > p.muted { margin: 0 0 10px; font-size: 14px; }
.tool-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.tool-card-head h2 { margin: 0; }
.tool-card .tool-empty { margin: 0; padding: 9px 0; border-top: 1px solid var(--soft); }
.tool-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 0; border-top: 1px solid var(--soft); font-size: 14px; }
.tool-row.top { align-items: flex-start; padding: 9px 0; }
.tool-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tool-row .grow.strong { font-weight: 600; }
.tool-row .grow a { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; }
.tool-row .grow a:hover { text-decoration: underline; }
.tool-row .meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tool-mark { flex: none; width: 18px; height: 18px; border: 2px solid #9c96a6; border-radius: 999px; }
.tool-mark.square { border-radius: 6px; }
.tool-sentence p { margin: 0; font-size: 14px; }
.tool-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 16px; margin-top: auto; padding-top: 8px; }
.tool-foot a { display: inline-flex; align-items: center; min-height: 40px; font-weight: 700; text-decoration: none; }
.tool-foot a:hover { text-decoration: underline; }

/* From the client card (squares of what they sent) and the add-a-note form in the history card */
.sent-squares { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.sent-square { aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: var(--soft); display: flex; align-items: center; justify-content: center; }
.sent-square img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sent-square.type { font-size: 13px; font-weight: 700; color: var(--muted); background: #efe8da; }
.tool-card p.sent-line { margin: 0; font-size: 14px; }
.tool-card p.waiting-for { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: #8a4a12; }
.tool-row .avatar { margin-top: 1px; }
details.add-note summary { display: inline-flex; align-items: center; min-height: 40px; font-weight: 700; color: var(--navy); cursor: pointer; }
details.add-note[open] { flex: 1 1 100%; }
details.add-note form { display: grid; gap: 6px; padding-bottom: 8px; }
details.add-note textarea { width: 100%; box-sizing: border-box; font: inherit; }
details.add-note input[type=submit] { min-height: 40px; justify-self: start; }

/* Cancel this client: a red link in the middle at the bottom, its form opening underneath */
details.cancel-client { margin: 36px 0 0; text-align: center; font-size: 14px; }
details.cancel-client > summary.link-summary { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 6px; min-height: 40px; font-size: 14px; text-decoration: none; }
details.cancel-client .cancel-link { text-decoration: underline; }
details.cancel-client .action-panel { margin: 8px auto 0; text-align: left; }

/* A tool page: the old tab in one card. Lists inside it are rows split by soft lines, not cards on a card. */
:where(body:not(.brand)) .card.tool-page { margin: 0; }
.tool-page > h2 { margin: 0 0 10px; font-size: 22px; letter-spacing: -0.02em; color: var(--navy); }
:where(body:not(.brand)) .card.tool-page .card { margin: 0; padding: 14px 0; border-top: 1px solid var(--soft); border-radius: 0; box-shadow: none; }
details.add-product { margin-top: 12px; }
details.add-product > summary.link-summary { display: inline-flex; align-items: center; min-height: 40px; color: var(--link); font-size: 15px; font-weight: 700; text-decoration: none; }
details.add-product .add-row { margin-top: 4px; }

@media (max-width: 700px) {
  :where(body:not(.brand)) .card.client-hero { padding: 24px 18px 20px; }
  :where(body:not(.brand)) .card.tool-card { padding: 18px; }
  .client-people { justify-content: flex-start; }
  /* The old tabs' links and small folds, 40px tall on a tool page */
  .tool-page :is(a:not(.button), summary.link-summary) { display: inline-flex; align-items: center; min-height: 40px; }
  /* A list table on a tool page: rows split by soft lines, not cards on a card, and the invoice link 40px tall */
  .tool-page table.cards tr { margin: 0; padding: 10px 0; border-top: 1px solid var(--soft); border-radius: 0; box-shadow: none; }
  .tool-page table.cards td:first-child a { min-height: 40px; padding: 0; }
}

/* Activity */
main:has(> .activity-head) { max-width: 820px; margin-inline: auto; }
.activity-head { text-align: center; margin-bottom: 22px; }
.activity-head h1 { font-size: 2.5rem; line-height: 1.1; letter-spacing: -0.035em; font-weight: 800; color: var(--navy); margin: 0; }
.activity-head .muted { margin: 8px 0 18px; }
.activity-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.activity-filters a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--panel); color: var(--ink); font-weight: 600; text-decoration: none;
}
.activity-filters a:hover { background: var(--current); }
.activity-filters a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #ffffff; font-weight: 700; }
.activity-empty { text-align: center; margin-top: 26px; }
.activity-day { margin-top: 26px; }
.activity-day h2 {
  display: flex; align-items: center; gap: 14px; margin: 0 0 12px; font-size: 14px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; color: #8a5426;
}
.activity-day h2::before, .activity-day h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
:where(body:not(.brand)) .activity-day .card { padding: 6px 24px; margin: 0; }
.activity-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--soft); }
.activity-row:first-child { border-top: 0; }
.activity-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.activity-client { font-weight: 700; }
.activity-detail { margin-top: 6px; padding: 10px 14px; background: #f8f4ec; border-radius: 12px; font-size: 14px; color: #3f3b4a; }
.activity-row time { font-size: 13px; color: var(--muted); white-space: nowrap; }
.activity-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; margin-top: 28px; font-weight: 600; }
.activity-more a { display: inline-flex; align-items: center; min-height: 40px; }
@media (max-width: 700px) {
  .activity-head h1 { font-size: 1.9rem; }
  :where(body:not(.brand)) .activity-day .card { padding: 4px 16px; }
  .activity-client { padding-block: 12px; }
}

/* Partner Home and Earnings */
.earned .label { margin: 0 0 4px; color: var(--muted); }
.earned .figure { display: block; font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 800; letter-spacing: -0.03em; color: var(--navy); }
.earned .earlier .figure { display: inline; font-size: inherit; }
.earned p { margin: 8px 0 0; }
.card-row.row { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; }

/* Partner sales link page and phone tap targets */
.my-view .link-actions { gap: 10px; margin-bottom: 8px; }
.back-link { margin-left: auto; }
@media (max-width: 700px) {
  .my-view .link-actions .share-button { width: 100%; box-sizing: border-box; justify-content: center; }
  .my-view :is(a.button.small, .section-head a:not(.button), .back-link, .card-row a:not(.button), .form-stack input[type="submit"] + a) { display: inline-flex; align-items: center; min-height: 44px; }
  .my-view :is(a.button.small) { padding-inline: 16px; }
}
.my-view .home-head { text-align: left; margin-bottom: 18px; }
.my-view .page-head .button { margin-left: auto; }
.my-view .card > .card-row:first-child { padding-top: 0; }
.my-view .card > .card-row:last-child { padding-bottom: 0; }
.my-view .form-stack input[type="submit"] + a { margin-left: 14px; }
.my-view .home-head .page-head h1 { margin: 0; }
/* Viewing as a partner on a desktop: the bar stays put and the menu fits under it, so Log out and the avatar stay in view */
@media (min-width: 701px) {
  .viewing-as-bar { position: sticky; top: 0; z-index: 5; }
  body:has(.viewing-as-bar) .sidebar { top: 61px; min-height: calc(100vh - 61px); max-height: calc(100vh - 61px); }
  body:has(.viewing-as-bar) .shell { min-height: calc(100vh - 61px); }
}

/* Prospects: the title with its line underneath, the filters (with a wider search box), and a row per prospect.
   A row is the name, stage and next step, then whose it is, WhatsApp and Log; on a phone the buttons drop under the name. */
.page-sub { margin: 4px 0 0; }
.prospects-head .button { margin-left: auto; }
.prospect-filters .filter.find { flex: 2 1 220px; }
.prospect-filters input[type="search"] { width: 100%; margin: 0; }
.prospect-filters .clear-filters { display: inline-flex; align-items: center; min-height: 44px; }
.prospect-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 0; border-top: 1px solid var(--soft); }
.prospect-main { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.prospect-main > .muted { margin-left: 6px; }
.prospect-next { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: 14px; }
.prospect-next .when { font-size: 13px; font-weight: 700; color: var(--muted); }
.prospect-next .when.overdue-date { color: var(--bad); }
.prospect-row summary.button { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.prospect-row details.action[open] > summary.button { background: var(--current); color: var(--text); border-color: var(--line); }
.closed-group > details > summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.closed-group > details > summary::-webkit-details-marker { display: none; }
.closed-group > details > summary h2 { margin: 0; }
.closed-group > details > summary h2::before { content: "\25B8"; display: inline-block; width: 1.1em; }
.closed-group > details[open] > summary h2::before { content: "\25BE"; }

/* Chips: a row of choices that look like pills (radio buttons underneath); the chosen one is navy */
fieldset.chip-set { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; background: none; min-width: 0; }
fieldset.chip-set legend { width: 100%; margin-bottom: 6px; padding: 0; font-weight: 600; }
.chip-set label.chip:has(> input) { position: relative; display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 8px 16px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font-weight: 600; cursor: pointer; }
.chip-set label.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip-set label.chip:has(input:checked) { background: var(--navy); border-color: var(--navy); color: #ffffff; }
.chip-set label.chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
/* "Pick a date" shows the date box */
.chip-set .pick-date { display: none; width: 100%; margin: 4px 0 0; }
.chip-set:has(input[value="pick"]:checked) .pick-date { display: block; }
.log-form p { margin: 0 0 14px; }
.log-form input[type="text"] { width: 100%; }
.duplicate-warning p { margin: 0 0 8px; }
.prospect-form input[type="submit"] + a { display: inline-flex; align-items: center; min-height: 44px; margin-left: 14px; }
/* Phones: the row's buttons are full-size tap targets */
@media (max-width: 700px) {
  .prospect-row :is(a.button, summary.button) { min-height: 44px; padding-inline: 16px; }
}

/* Prospect page: the header with the stage pill, the quick actions, then a main column (next step, sales links, log) and a
   side column (details, source, belongs to, do not contact). The columns stack below 900px, main column first. */
.prospect-head { align-items: flex-start; }
.prospect-head h1 { overflow-wrap: anywhere; }
.prospect-head > .pill { margin-left: auto; margin-top: 8px; }
.prospect-actions details.action .action-panel form p { margin: 0 0 12px; }
.prospect-columns { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; }
.prospect-main-col { display: flex; flex: 999 1 520px; flex-direction: column; gap: 18px; min-width: 0; }
.prospect-side { display: flex; flex: 1 1 280px; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 900px) { .prospect-main-col, .prospect-side { flex-basis: 100%; } }
:where(body:not(.brand)) .prospect-columns .card { margin: 0; }
.prospect-columns .card h2 { margin: 0 0 10px; font-size: 19px; letter-spacing: -0.02em; color: var(--navy); }
.prospect-columns .card-head h2 { margin: 0; }
.prospect-columns .card > p:last-child { margin-bottom: 0; }
.prospect-next-step { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 12px; }
.prospect-next-step .overdue-date { color: var(--bad); }
.prospect-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.prospect-link-main { flex: 1 1 240px; min-width: 0; }
.prospect-link-main > * { margin-right: 6px; }
.prospect-link .link-actions { flex: none; }
.prospect-note { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0 0 8px; }
.prospect-note textarea { flex: 1 1 220px; min-height: 44px; margin: 0; }
.prospect-log { list-style: none; margin: 0; padding: 0; }
.prospect-log li { padding: 10px 0; border-top: 1px solid var(--soft); overflow-wrap: anywhere; }
.prospect-log .log-who { font-weight: 700; }
.prospect-log li.muted .log-who { font-weight: 600; }
.prospect-log .log-when { margin: 0 6px; font-size: 13px; color: var(--muted); }
.prospect-details { margin: 0; }
.prospect-details > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 6px 0; border-top: 1px solid var(--soft); }
.prospect-details > div:first-child { border-top: 0; padding-top: 0; }
.prospect-details dt { color: var(--muted); font-size: 14px; }
.prospect-details dd { margin: 0; overflow-wrap: anywhere; text-align: right; }
.prospect-assign { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.prospect-assign select { flex: 1 1 160px; margin: 0; }
.prospect-columns .button_to { margin: 0; }
@media (max-width: 700px) {
  .prospect-actions > :is(a.button, form, details.action:not([open])) { flex: 1 1 calc(50% - 4px); }
  .prospect-actions > form .secondary, .prospect-actions > details.action > summary { width: 100%; box-sizing: border-box; }
  :is(.prospect-columns, .prospect-actions) :is(a.button.small, button.small, summary.button.small) { min-height: 44px; padding-inline: 16px; }
  .crumbs.breadcrumb a { min-height: 44px; }
}

/* Keep prospect entry points and expanded details comfortable to tap on phones. */
@media (max-width: 700px) {
  :where(body:not(.brand)) main :is(a.button, button, input[type="submit"]) { min-height: 44px; }
  .needs-you-row .actions :is(a.button, button), .prospect-form details.more > summary { min-height: 44px; }
  :is(.page-head, .home-head) a.button { min-height: 44px; }
}

/* How to sell (partner screens): a decision tree drawn with nested lists and connector lines.
   Wide screens: a top-down tree. Phones: the same lists as an indented outline, so nothing scrolls sideways. */
.sell-tree-wrap { margin: 8px 0 20px; }
.sell-tree, .sell-tree ul { list-style: none; margin: 0; padding: 0; }
.sell-tree ul { display: flex; justify-content: center; position: relative; padding-top: 22px; }
.sell-tree li { position: relative; text-align: center; padding: 22px 6px 0; flex: 1 1 auto; }
.sell-tree > li { padding-top: 0; }
.sell-tree li::before, .sell-tree li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 2px solid var(--line-strong, #c9c2b4); }
.sell-tree li::after { right: auto; left: 50%; border-left: 2px solid var(--line-strong, #c9c2b4); }
.sell-tree > li::before, .sell-tree > li::after, .sell-tree li:only-child::before, .sell-tree li:only-child::after { display: none; }
.sell-tree li:only-child { padding-top: 0; }
.sell-tree li:first-child::before, .sell-tree li:last-child::after { border: 0 none; }
.sell-tree li:last-child::before { border-right: 2px solid var(--line-strong, #c9c2b4); border-radius: 0 8px 0 0; }
.sell-tree li:first-child::after { border-radius: 8px 0 0 0; }
.sell-tree ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--line-strong, #c9c2b4); }
.sell-node { display: inline-block; max-width: 220px; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 14px; background: var(--panel); color: var(--ink); font-weight: 700; font-size: 14px; line-height: 1.3; }
.sell-node small { display: block; margin-top: 3px; font-weight: 400; font-size: 12px; color: var(--muted); }
.sell-root { background: var(--ink); color: #fff; border-radius: 999px; }
.sell-root small, .sell-root small a { color: #d8d4f2; }
.sell-q { border-style: dashed; background: var(--soft); }
.sell-branch { border-color: #1d5e44; }
.sell-no { border-color: #e0b98f; background: #fdf6ee; }
.sell-end { border-color: #1d5e44; background: #1d5e44; color: #fff; border-radius: 999px; }
.sell-end small { color: #d9f0e4; }
.sell-label { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.sell-label-yes { color: #1d5e44; }
.sell-label-no { color: #a14f12; }
.sell-close-title { margin: 28px 0 0; font-size: 18px; }
.flow-link { margin: 10px 0 0; }
@media (max-width: 900px) {
  .sell-tree ul { display: block; padding: 0 0 0 18px; margin-left: 10px; border-left: 2px solid var(--line-strong, #c9c2b4); }
  .sell-tree ul::before, .sell-tree li::before, .sell-tree li::after { display: none; }
  .sell-tree li { text-align: left; padding: 10px 0 0; }
  .sell-tree li:only-child { padding-top: 10px; }
  .sell-tree > li { padding-top: 0; }
  .sell-node { max-width: none; }
}

/* Chat messages: our team on the right in navy, the client or visitor on the left on white,
   app lines centred in small grey text. Pages can flip sides with their own rules. */
.msg { display: flex; flex-direction: column; align-items: flex-start; margin: 10px 0; }
.msg[data-side="team"] { align-items: flex-end; }
.msg-meta { display: flex; gap: 8px; margin: 0 6px 4px; font-size: 13px; color: var(--muted); }
.msg-name { font-weight: 700; color: var(--text); }
.msg-bubble { max-width: min(560px, 85%); padding: 10px 14px; border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.msg-bubble p { margin: 0 0 6px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg[data-side="team"] .msg-bubble { background: #262262; color: #fff; }
.msg[data-side="team"] .msg-bubble a { color: #fff; }
.msg-removed-note { font-style: italic; color: var(--muted); }
.msg[data-side="team"] .msg-removed-note { color: #d6d4ea; }
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.msg-files a { display: inline-flex; align-items: center; min-height: 44px; }
.msg-files img { display: block; max-width: 220px; max-height: 220px; border-radius: 12px; }
.msg-remove { margin: 2px 6px 0; }
.msg-system { align-self: center; margin: 4px 0; font-size: 13px; color: var(--muted); text-align: center; }

/* Chat keeps the conversation list beside a calm, scrollable thread. */
.chat-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow: hidden; height: calc(100dvh - 100px); min-height: 480px; }
/* The index has the usual page heading (44px + 18px gap), above the chat panel. */
.chat-index { height: calc(100dvh - 138px); }
/* Viewing as a partner on a desktop: the bar above takes 61px, so the chat still fits the screen */
@media (min-width: 720px) { body:has(.viewing-as-bar) .chat-layout { height: calc(100dvh - 161px); } body:has(.viewing-as-bar) .chat-index { height: calc(100dvh - 199px); } }
.chat-list { overflow-y: auto; border-right: 1px solid var(--line); }
.chat-list h2 { font-size: 13px; margin: 20px 16px 8px; color: var(--muted); }
.chat-search { display: flex; gap: 6px; padding: 12px; }
.chat-search input[type="search"] { min-width: 0; width: 100%; }
.chat-row { display: flex; align-items: center; gap: 10px; padding: 13px 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.chat-row:hover, .chat-row.selected { background: #f4f2ec; }
.chat-row-text { flex: 1; min-width: 0; }
.chat-row-text strong, .chat-row-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-text small { margin-top: 4px; color: var(--muted); }
.chat-row-meta { display: grid; justify-items: end; gap: 6px; font-size: 11px; color: var(--muted); }
.chat-row-meta .count { background: #a83338; color: white; border-radius: 20px; padding: 2px 7px; }
.chat-team-row { padding-left: 36px; }
.chat-team-row .avatar { display: none; }
.chat-empty { display: grid; place-content: center; padding: 32px; color: var(--muted); }
.chat-thread-frame { display: block; min-width: 0; min-height: 0; }
.chat-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-thread.team-only { background: #f7ede3; }
.chat-header { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.chat-header h1 { font-size: 21px; margin: 0 0 12px; }
.chat-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 14px; }
.chat-members { display: flex; gap: 4px; }
.chat-back { display: none; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px 22px; min-height: 0; }
.chat-day { text-align: center; color: var(--muted); font-size: 12px; margin: 8px 0 20px; }
.msg { margin-bottom: 16px; }
.msg[data-side="team"] { display: flex; flex-direction: column; align-items: flex-end; }
.chat-composer { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--panel); }
.chat-composer textarea { width: 100%; resize: vertical; min-height: 70px; box-sizing: border-box; }
.chat-compose-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.chat-compose-actions input[type="submit"] { margin-left: auto; }
.chat-attach { padding: 8px 12px; min-height: 44px; display: inline-flex; align-items: center; position: relative; overflow: hidden; cursor: pointer; }
.chat-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.chat-chosen-files { margin: 0; padding-left: 16px; font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .chat-layout { grid-template-columns: 250px minmax(0, 1fr); } }
@media (max-width: 719px) {
  .chat-layout { display: block; height: calc(100dvh - 105px); min-height: 400px; }
  .chat-index { height: calc(100dvh - 115px - clamp(1.6rem, 4vw, 2.5rem) * 1.1); }
  .chat-index .chat-empty, .chat-show > .chat-list { display: none; }
  .chat-index .chat-list, .chat-thread-frame { height: 100%; }
  .chat-header { padding: 12px 14px; }
  .chat-header h1 { font-size: 18px; }
  .chat-back { display: inline-flex; align-items: center; min-height: 44px; }
  .chat-header-actions { gap: 8px; }
  .chat-messages { padding: 12px; }
  .chat-composer { padding: 10px 12px; }
  .chat-thread .pill, .chat-attach, .msg-remove button { min-height: 44px; }
  .chat-row { min-height: 60px; }
}

/* Site watch: the "last check" line, group headings in the list, the site page's 90-day strip and small lists. */
.last-check { margin: -6px 0 18px; font-size: 13px; color: var(--muted); }
.last-check.bad { color: var(--bad); font-weight: 700; }
.site-filters { justify-content: flex-start; margin-bottom: 12px; }
.sites-table .group-row td { padding-top: 16px; background: var(--side); color: var(--navy); font-weight: 800; }
.site-hero .page-head { margin-bottom: 4px; }
.site-hero .page-head h1 { font-size: clamp(1.4rem, 3.5vw, 2rem); overflow-wrap: anywhere; }
.site-hero .actions-row { margin-bottom: 0; }
.day-strip { display: flex; gap: 2px; align-items: stretch; height: 34px; margin: 8px 0; }
.day-strip .day-bar { flex: 1 1 0; min-width: 0; border-radius: 2px; }
.day-bar { display: inline-block; background: var(--good); }
.day-bar.good { background: #2f9e6f; }
.day-bar.warn { background: #e8833a; }
.day-bar.bad { background: var(--bad); }
.day-bar.none { background: #d8d3c4; }
.day-strip-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 0 12px; font-size: 13px; }
.day-strip-key .day-bar { width: 12px; height: 12px; margin-right: 4px; vertical-align: -1px; }
.site-months { margin: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 9px 0; border-top: 1px solid var(--soft); overflow-wrap: anywhere; }
.plain-list li:first-child { border-top: 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.inline-form input[type="date"] { margin: 0; }
.site-problem .actions form { margin: 0; }
.kpi .value { white-space: nowrap; }
.tool-cards.site-cards { grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
.form-stack p a { margin-left: 12px; }
@media (max-width: 700px) {
  .day-strip { height: 28px; gap: 1px; }
  .tool-cards.site-cards { grid-template-columns: 1fr; }
  table.cards .group-row { margin: 8px 0 0; padding: 0; background: none; border-radius: 0; box-shadow: none; }
  table.cards .group-row td { padding: 4px 0; background: none; font-size: 1.05rem; }
}
/* A client's Website card while the site is down */
.card.tool-card.bad { border-color: var(--bad); box-shadow: inset 0 4px 0 var(--bad); }
.tool-row .site-detail { display: block; font-size: 14px; }

/* The client overview keeps both chats together, with a private copper pane. */
.client-chat-card { min-width: 0; }
.chat-tab-radio { position: absolute; opacity: 0; width: 1px; height: 1px; }
.client-chat-tabs { display: flex; border-bottom: 1px solid var(--line); margin-top: 12px; }
.client-chat-tabs label { flex: 1; cursor: pointer; padding: 12px 8px; text-align: center; min-height: 44px; }
#chat-tab-client:checked ~ .client-chat-tabs label[for="chat-tab-client"],
#chat-tab-team:checked ~ .client-chat-tabs label[for="chat-tab-team"] { font-weight: 700; box-shadow: inset 0 -3px #262262; }
.chat-tab-radio:focus-visible ~ .client-chat-tabs { outline: 2px solid #262262; }
.client-chat-pane { display: none; }
#chat-tab-client:checked ~ .client-pane, #chat-tab-team:checked ~ .team-pane { display: block; }
.client-chat-pane.team-only { background: #f7ede3; }
.client-chat-note { padding: 12px; margin: 0; font-size: 13px; }
.client-chat-pane .chat-messages { height: 280px; padding: 12px; }
.client-chat-pane .chat-composer { padding: 12px; }
.client-chat-pane .chat-compose-actions { flex-wrap: wrap; }
.client-chat-actions { flex-wrap: wrap; }
.client-chat-actions button { min-height: 44px; }

/* The Chat link's unread number is always in the menu (so a live update can fill it in); hide it at 0 */
.sidebar .count:empty { display: none; }

/* A website visitor's chat: where they started, and what the owners can do */
.chat-website-head p { margin: 12px 0 8px; font-size: 14px; }
.chat-website-head a.pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; font-size: 14px; text-decoration: none; }
.chat-nudge { margin-top: 10px; } .chat-nudge a.pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; font-size: 14px; text-decoration: none; }

/* Site watch: the visit counter card (monthly client report) */
.counter-line.warn { color: #8a4a12; font-weight: 600; }
.counter-script-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.counter-script { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; font-size: 13px; background: var(--soft); border-radius: 8px; padding: 8px 10px; }

/* Task form: "Tell the client" only while the task is linked to a client */
form:has(select[name="task[client_id]"] option[value=""]:checked) .tell-client { display: none; }

/* Monthly client reports: the report card (owners' preview and the client's page) */
.report-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 26px; box-shadow: var(--shadow); }
.report-card h1 { margin: 0 0 10px; font-size: 28px; line-height: 1.15; }
.report-card h2 { margin: 26px 0 8px; font-size: 18px; }
.report-card h3 { margin: 0 0 6px; font-size: 15px; }
.report-card .eyebrow { margin: 0 0 6px; color: #9a5f2b; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.report-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 8px; }
.report-number { background: var(--side); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.report-number .big { font-size: 40px; font-weight: 800; line-height: 1; color: var(--navy); }
.report-number .what { color: var(--muted); font-size: 14px; margin-top: 4px; }
.report-number .change { font-size: 14px; margin-top: 2px; font-weight: 600; }
.report-note { background: #fbefe2; border-radius: 12px; padding: 10px 12px; }
.report-list { margin: 0; padding-left: 20px; }
.report-list li { margin: 0 0 6px; }
.report-list.plain { list-style: none; padding: 0; }
.report-list.plain li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--soft); padding: 4px 0; }
.report-list.plain li span { overflow-wrap: anywhere; }
.report-chart { display: flex; align-items: flex-end; gap: 2px; height: 120px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.report-chart .bar { flex: 1 1 0; min-width: 0; height: var(--h); min-height: 2px; background: var(--copper); border-radius: 3px 3px 0 0; }
.report-chart-axis { display: flex; justify-content: space-between; margin: 4px 0 16px; }
.report-tops { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 12px; }
/* The owners' screens around it */
.report-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.report-panel h2 { font-size: 16px; margin: 14px 0 6px; }
.report-panel form.inline-form { display: inline-block; }
.report-lines-edit li { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.report-lines-edit li.hidden-line span { text-decoration: line-through; color: var(--muted); }
.report-send { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.email-off { margin: 0; }
td.lines-count.warn { color: #8a4a12; font-weight: 800; }
table.reports .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 900px) {
  .report-layout { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .report-card { padding: 20px 16px; }
  .report-number .big { font-size: 32px; }
  .report-numbers { gap: 8px; }
}
.client-report { padding: 16px 16px 0; }
.client-report .client-page-links { margin-bottom: 12px; }
.client-report-chat { margin: 16px 4px; }
.report-stop { padding: 16px; }
@media (max-width: 700px) {
  table.cards.reports td.row-actions { justify-content: flex-end; padding-top: 8px; }
  table.cards.reports td.row-actions::before { content: none; }
}
.report-lines-edit li form { flex: none; }
.report-lines-edit li .link-button { white-space: nowrap; }
