/*
 * TSS Central design tokens + shared/global styles.
 *
 * The brand colours below are not a guess: --color-brand-green (#015601)
 * and --color-brand-grey (#595959) were sampled directly from the pixels
 * of the actual TSS logo, not picked by eye. Everything else in this file
 * is a small palette and type/spacing scale built outward from those two
 * exact values - see CLAUDE.md for the full reasoning.
 */

:root {
    /* Brand colours - sampled from the logo, do not adjust by eye */
    --color-brand-green: #015601;
    --color-brand-grey: #595959;
    /* The green in the TSS logo file itself (decision 202): tab icon and login verse only */
    --color-logo-green: #13723b;

    /* Green scale, anchored on the brand green at 700 */
    --green-50: #eaf3ea;
    --green-100: #cde3cd;
    --green-200: #9ecb9e;
    --green-300: #6cb06c;
    --green-400: #3e8f3e;
    --green-500: #1f701f;
    --green-600: #0f5e0f;
    --green-700: #015601; /* brand */
    --green-800: #014201;
    --green-900: #013001;

    /* Neutral grey scale, anchored on the brand grey at 600 */
    --grey-50: #f7f7f6;
    --grey-100: #eeeeed;
    --grey-200: #dddddb;
    --grey-300: #c4c4c2;
    --grey-400: #a3a3a1;
    --grey-500: #7d7d7b;
    --grey-600: #595959; /* brand */
    --grey-700: #434342;
    --grey-800: #2b2b2a;
    --grey-900: #1a1a1a;

    /* Semantic tokens - everything in templates should reference these,
       not the raw scales above, so the palette can be retuned in one place */
    --color-primary: var(--green-700);
    --color-primary-hover: var(--green-800);
    --color-primary-soft: var(--green-50);
    --color-primary-soft-text: var(--green-800);

    --color-text: var(--grey-900);
    --color-text-muted: var(--grey-600);
    --color-border: var(--grey-200);
    --color-bg: var(--grey-50);
    --color-surface: #ffffff;

    --color-danger: #b3261e;
    --color-danger-soft: #fdecea;
    --color-success: var(--green-700);
    --color-success-soft: var(--green-50);
    --color-warning: #8a5a00;
    --color-warning-soft: #fdf1dc;
    --color-info: #0C447C;
    --color-info-soft: #EAF3FC;
    --color-neutral-soft: var(--grey-100);
    --color-neutral-soft-text: var(--grey-700);
    /* Table row striping (decision 129): odd rows mint, even rows the table's white. */
    --row-stripe: #EAF6EF;
    --row-hover: #d3ebdd;
    /* Price list tier columns (decision 134): a soft cell tint, a stronger header, a dark header text. */
    --tier-distributor: #FDF5E2;
    --tier-distributor-head: #FAE6BC;
    --tier-distributor-text: #633806;
    --tier-reseller: #EDF6E6;
    --tier-reseller-head: #D6EBC2;
    --tier-reseller-text: #27500A;
    --tier-end-user: #EAF3FC;
    --tier-end-user-head: #CFE3F7;
    --tier-end-user-text: #0C447C;
    --tier-list: #FCEFEF;
    --tier-list-head: #F7D3D3;
    --tier-list-text: #791F1F;
    /* Prospect tiers (decision 149): Michelle's Excel colours, softened so the text reads. */
    --prospect-top: #C9DAF8;
    --prospect-top-text: #133F87;
    --prospect-first: #FCF1B8;
    --prospect-first-text: #5E4B00;
    --prospect-second: #F5DE9C;
    --prospect-second-text: #6B4700;
    --prospect-third: #FAD7B5;
    --prospect-third-text: #7A3A06;
    --prospect-fourth: #E3E3E3;
    --prospect-fourth-text: #444444;
    --prospect-africa: #D7F1F8;
    --prospect-africa-text: #0B5C70;
    /* A hovered row's tier cells (decision 137): one step deeper, still lighter than the header. */
    --tier-distributor-hover: #F9EAC6;
    --tier-reseller-hover: #DDEDD0;
    --tier-end-user-hover: #D8E8F8;
    --tier-list-hover: #F7DCDC;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.375rem;
    --font-size-2xl: 1.75rem;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-8: 3rem;

    --radius-sm: 4px;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.06);
    --shadow-md: 0 4px 16px rgba(26, 26, 26, 0.08);

    /* 1200px of content plus the 1.5rem side padding (decision 106). */
    /* Decision 208: wide pages use more of a wide screen. Reading pages keep --reading-width. */
    --content-width: 100rem;
    --reading-width: 78rem;
}

/* --- Reset & base ------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    /* Belt-and-braces: nothing on the page should be able to force a
       horizontal scrollbar on the whole document - anything that
       genuinely needs to scroll sideways (a wide table) does so inside
       its own container instead, see .table-wrap below. */
    overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0 0 var(--space-4); font-weight: 600; line-height: 1.25; }
h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
p { line-height: 1.55; }
small { color: var(--color-text-muted); }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

form small { display: block; margin-top: var(--space-1); font-size: var(--font-size-xs); }

/* --- Site chrome: header + nav ----------------------------------------- */

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Full width on every page (decision 208), so the bar never jumps between pages: logo hard left, icons hard right. */
.site-header__inner {
    max-width: none;
    margin: 0 auto;
    padding: 0 var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-6);
    min-height: 3.75rem;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
    font-weight: 700;
    font-size: var(--font-size-lg);
    color: var(--color-text);
    white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand__mark { color: var(--color-primary); }
/* The wide logo, trimmed, as tall as the bar allows (decision 202). */
.brand__logo { display: block; height: 2.75rem; width: auto; }
/* CENTRAL beside the logo, centred on its height (decision 205). */
.brand:has(.brand__logo) { align-items: center; gap: var(--space-2); }
.brand__word { color: var(--color-brand-green); font-weight: 700; font-size: var(--font-size-base); letter-spacing: 0.04em; line-height: 1; }

/* Holds .main-nav + .user-menu together so both can be shown/hidden as
   one unit by the mobile menu toggle below - on desktop this is just a
   plain flex row, replicating the single-level layout .site-header__inner
   used before the toggle existed. */
.nav-panel {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    flex: 1;
    min-width: 0;
}

.nav-toggle-checkbox { display: none; }
.nav-toggle-label { display: none; }
.phone-nav { display: none; }
.phone-nav__list,
.phone-nav__menu { list-style: none; margin: 0; padding: 0; }

/* Grouped top bar (decision 102): plain links and dropdown buttons share
   one look, with the same green underline marking the active group. */
.main-nav { flex: 1; min-width: 0; }
.main-nav__list,
.nav-group__menu { list-style: none; margin: 0; padding: 0; }
.main-nav__list { display: flex; gap: var(--space-1); }
.nav-group { position: relative; }

.nav-group__link,
.nav-group__toggle,
.nav-bell {
    display: inline-flex;
    align-items: center;
    color: var(--color-text-muted);
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}
.nav-group__toggle::after {
    content: "";
    margin-left: var(--space-2);
    border: 4px solid transparent;
    border-top-color: currentColor;
    border-bottom: 0;
}
.nav-group__link:hover,
.nav-group__toggle:hover,
.nav-group.is-open > .nav-group__toggle,
.nav-bell:hover { color: var(--color-text); text-decoration: none; background: var(--grey-100); }
.nav-group__link.is-active,
.nav-group__toggle.is-active,
.nav-bell.is-active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.nav-group__menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    min-width: 11rem;
    margin-top: var(--space-1);
    padding: var(--space-1) 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}
.nav-group.is-open > .nav-group__menu { display: block; }
/* A page's Manage button with a dropdown (decision 206), sharing the top bar's menu look. */
.page-menu { position: relative; display: inline-block; }
.page-menu.is-open > .nav-group__menu { display: block; }
.page-menu__toggle { white-space: nowrap; }
.page-menu__toggle::after { content: ""; display: inline-block; margin-left: var(--space-2); vertical-align: middle; border: 4px solid transparent; border-top-color: currentColor; border-bottom: 0; }
.page-menu .nav-group__menu a { white-space: nowrap; }
.nav-group__menu--right { left: auto; right: 0; }
.nav-group__menu a,
.nav-group__menu .user-menu__logout button {
    display: block;
    width: 100%;
    text-align: left;
    padding: var(--space-2) var(--space-4);
    color: var(--color-text);
    font-size: var(--font-size-sm);
}
.nav-group__menu a:hover,
.nav-group__menu .user-menu__logout button:hover { background: var(--grey-100); text-decoration: none; }
.nav-group__menu a.is-current { color: var(--color-primary); font-weight: 600; }

/* The initials badge that opens the account menu. */
.nav-group__toggle.user-badge { padding: var(--space-1); }
.nav-group__toggle.user-badge::after { display: none; }
.user-badge__initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: var(--color-primary-soft-text);
    font-size: var(--font-size-xs);
    font-weight: 700;
}
.user-badge__name { display: none; }

.page-header--section { scroll-margin-top: 5rem; }

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    white-space: nowrap;
}

/* The header's notification bell (CLAUDE.md decision 76) - a plain
   .main-nav link like every other nav item (same hover/active/mobile
   behaviour for free), just with an SVG icon instead of text and an
   absolutely-positioned unread-count badge riding on top of it. */
.nav-bell { position: relative; }
.nav-bell__icon { display: block; }
.nav-bell__badge {
    position: absolute;
    top: 0.1rem;
    right: 0.1rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.2rem;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1rem;
    border-radius: 999px;
    text-align: center;
}
.user-menu__logout { margin: 0; }
.user-menu__logout button {
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
}

/* Laptops (decision 207): three columns, logo hard left, menu on the true middle of the bar, icons hard
   right. The side columns are equal (1fr each) but never narrower than what they hold, so if the bar is
   tight the menu slides away from the wider side instead of overlapping it. */
@media (min-width: 861px) {
    .site-header__inner { display: grid; grid-template-columns: 1fr auto 1fr; }
    .nav-panel { display: contents; }
    .brand { justify-self: start; }
    .main-nav { grid-column: 2; justify-self: center; }
    .user-menu { grid-column: 3; justify-self: end; }
}

/* Decision 215: from 1254px the menu is one group on the true middle of the bar (decision 207's grid), 16px
   text and a fixed 32px from one item's text or arrow to the next item's text: 12px item padding each side
   plus the list's 8px gap. 1254px is measured: the menu is 646px, the logo 159px and the icons 264px with
   the mail envelope, so from there both sides hold with 16px column gaps and the menu stays centred.
   Narrower widths keep decision 207's 14px centred menu, then the tightening below, then the phone menu. */
@media (min-width: 1254px) {
    .site-header__inner { column-gap: var(--space-4); }
    .main-nav__list { gap: var(--space-2); }
    .main-nav .nav-group__link, .main-nav .nav-group__toggle { font-size: var(--font-size-base); }
}

/* Seven groups since Spotter (decision 143): just above the phone menu
   switch the bar tightens so the bell and initials never get overlapped. */
@media (min-width: 861px) and (max-width: 1100px) {
    .site-header__inner { gap: var(--space-3); padding: 0 var(--space-4); }
    .nav-panel { gap: var(--space-3); }
    .main-nav__list { gap: 0; }
    .nav-group__link, .nav-group__toggle, .nav-bell { padding-left: var(--space-2); padding-right: var(--space-2); }
    .nav-group__toggle::after { margin-left: var(--space-1); }
    .user-menu { gap: var(--space-1); }
    /* The mail envelope (decision 154) takes the refresh button's place here; these widths pull down to refresh. */
    .user-menu:has(.nav-mail) .nav-refresh { display: none; }
}

/* --- Mobile header: a hamburger toggle instead of every nav link stacking
   into one long column above the page content. Checkbox + label only,
   no JavaScript - the same "let the platform do it" choice decision 41
   made for <details>/<summary>, just via the older checkbox-toggle
   pattern since there's no native disclosure element for a menu. --- */
@media (max-width: 860px) {
    /* row-gap 0: the desktop gap otherwise also opens between the bar and the menu. */
    .site-header__inner { flex-wrap: wrap; row-gap: 0; padding: var(--space-3) var(--space-4); min-height: auto; }
    .brand__logo { height: 2.25rem; } /* keeps the phone bar its old height (decision 202) */

    .nav-toggle-label {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        margin-left: auto;
        border-radius: var(--radius-sm);
        cursor: pointer;
        order: 2;
    }
    .nav-toggle-label:hover { background: var(--grey-100); }
    .nav-toggle-icon,
    .nav-toggle-icon::before,
    .nav-toggle-icon::after {
        display: block;
        width: 1.25rem;
        height: 2px;
        background: var(--color-text);
        border-radius: 2px;
    }
    .nav-toggle-icon { position: relative; }
    .nav-toggle-icon::before, .nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
    .nav-toggle-icon::before { top: -6px; }
    .nav-toggle-icon::after { top: 6px; }

    /* Phone (decision 105): the desktop nav is hidden, the bell and
       initials stay in the bar, and .phone-nav is the menu. */
    .nav-panel { display: contents; }
    .main-nav { display: none; }
    /* Phones pull down to refresh (decision 142). */
    .nav-refresh { display: none; }
    /* Help, bell, initials and the menu button share one row down to 360px (decision 152). */
    .site-header__inner { column-gap: var(--space-2); }
    .nav-bell { padding-left: var(--space-2); padding-right: var(--space-2); }
    .user-menu { order: 1; margin-left: auto; gap: var(--space-1); }
    .nav-toggle-label { margin-left: 0; }

    .nav-toggle-checkbox:checked ~ .phone-nav {
        display: block;
        order: 3;
        flex: 0 0 100%;
        margin-top: var(--space-3);
        border-top: 1px solid var(--color-border);
    }
    .phone-nav__link,
    .phone-nav__toggle,
    .phone-nav__menu a {
        display: flex;
        align-items: center;
        width: 100%;
        padding: var(--space-3) var(--space-2);
        background: none;
        border: none;
        border-bottom: 1px solid var(--color-border);
        border-left: 3px solid transparent;
        color: var(--color-text);
        font: inherit;
        text-align: left;
        cursor: pointer;
    }
    .phone-nav__link:hover,
    .phone-nav__toggle:hover,
    .phone-nav__menu a:hover { background: var(--grey-100); text-decoration: none; }
    .phone-nav__toggle.is-active { color: var(--color-primary); }
    /* The chevron points down, and flips up while the group is open. */
    .phone-nav__toggle::after {
        content: "";
        margin-left: auto;
        margin-right: var(--space-2);
        width: 0.45rem;
        height: 0.45rem;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: translateY(-25%) rotate(45deg);
    }
    .phone-nav__toggle[aria-expanded="true"]::after { transform: translateY(25%) rotate(-135deg); }
    .phone-nav__menu a { padding-left: var(--space-6); }
    .phone-nav__link.is-current,
    .phone-nav__menu a.is-current { background: var(--color-primary-soft); border-left-color: var(--color-primary); }

    /* The hamburger's checkbox stays reachable by keyboard. */
    .nav-toggle-checkbox { display: block; position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
    .nav-toggle-checkbox:focus-visible + .nav-toggle-label { outline: 2px solid var(--color-primary); outline-offset: 2px; }
}

/* Decision 214: on a phone CENTRAL always shows. Where room runs short it fits instead of going: first a smaller
   CENTRAL, then the icons a little closer, in steps measured so the bar stays one line with about 8px to spare.
   The mail envelope takes about 40px, so with it each step starts at a wider screen. Only under 320px does
   CENTRAL go. */
@media (max-width: 860px) {
    .site-header__inner { --bar-word: var(--font-size-base); --bar-brand-gap: var(--space-2); --bar-icon-pad: var(--space-2); --bar-icon-gap: var(--space-1); --bar-gap: var(--space-2); --bar-side: var(--space-4); }
    .site-header .site-header__inner { column-gap: var(--bar-gap); padding-left: var(--bar-side); padding-right: var(--bar-side); }
    .brand:has(.brand__logo) { gap: var(--bar-brand-gap); }
    .brand__word { font-size: var(--bar-word); }
    .site-header__inner .user-menu { gap: var(--bar-icon-gap); }
    .site-header__inner .user-menu .nav-bell { padding-left: var(--bar-icon-pad); padding-right: var(--bar-icon-pad); }
}
/* Step 1, a smaller CENTRAL. */
@media (max-width: 405px) { .site-header__inner:has(.nav-mail) { --bar-word: 0.875rem; --bar-brand-gap: 0.375rem; } }
/* Step 2, the icons a little closer. */
@media (max-width: 389px) { .site-header__inner:has(.nav-mail) { --bar-icon-pad: 0.375rem; --bar-icon-gap: 0.125rem; } }
@media (max-width: 361px) { .site-header__inner { --bar-word: 0.875rem; --bar-brand-gap: 0.375rem; --bar-icon-pad: 0.375rem; --bar-icon-gap: 0.125rem; } }
/* Step 3, both again. */
@media (max-width: 371px) { .site-header__inner:has(.nav-mail) { --bar-word: 0.75rem; --bar-icon-pad: var(--space-1); --bar-gap: var(--space-1); } }
@media (max-width: 337px) { .site-header__inner { --bar-word: 0.75rem; --bar-icon-pad: var(--space-1); --bar-gap: var(--space-1); } }
/* Step 4, the tightest: icons closer still, a slimmer edge. */
@media (max-width: 341px) { .site-header__inner:has(.nav-mail) { --bar-brand-gap: var(--space-1); --bar-icon-pad: 3px; --bar-icon-gap: 0; --bar-side: var(--space-3); } }
/* Last resort. */
@media (max-width: 319px) { .brand__word { display: none; } }

/* --- Page layout --------------------------------------------------------- */

.page {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--space-6) var(--space-5) var(--space-8);
}

@media (max-width: 480px) {
    .page { padding: var(--space-4) var(--space-4) var(--space-6); }
}
/* Reading pages keep the old width, so lines of text don't stretch across a wide screen (decision 208). */
.page-reading .page { max-width: var(--reading-width); }

.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.page-header h1, .page-header h2 { margin: 0; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* A second page-header-shaped section further down the same page, e.g.
   the Team page's Agents block below TSS Team - see CLAUDE.md decision
   48. Same heading/actions layout as .page-header, just with room above
   it to separate it from whatever came before. */
.page-header--section { margin-top: var(--space-6); }

/* --- Section tabs: a row of links to a section's own peer pages, shown
   under its .page-header (CLAUDE.md decision 87) - e.g. Products/Stock
   orders/Forecast/Missed enquiries/Families, all one click apart instead
   of a mix of plain links, "back to X" arrows, and buttons that used to
   vary page to page. Deliberately the same bottom-border active style
   .main-nav already uses (decision 18) rather than a filled pill or a
   second, differently-styled nav - this is the same idea (a set of
   places you are one of right now), just scoped to one section instead
   of the whole site. */
.section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-5);
}
.section-tabs a {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.section-tabs a:hover { color: var(--color-text); text-decoration: none; }
.section-tabs a.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* Collapses to a horizontally-scrolling strip rather than wrapping into
   several lines - the same "let the platform do it, no JavaScript"
   instinct decision 41/18 already apply to disclosure widgets and the
   mobile nav toggle, just via native scroll instead of a checkbox. */
@media (max-width: 640px) {
    .section-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .section-tabs a { white-space: nowrap; }
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
}
.card + .card { margin-top: var(--space-5); }
.card h2 { margin-top: 0; }
.form-card { max-width: 28rem; }

/* --- Forms ---------------------------------------------------------------- */

form { display: flex; flex-direction: column; gap: var(--space-3); max-width: 24rem; }

/* Two fields side by side within a form - e.g. a date range's Date/End
   date pair (see CLAUDE.md decision 63). Generic and reusable: any
   future "two short fields together" case can reach for this instead
   of inventing its own row layout. */
.field-row { display: flex; flex-direction: row; gap: var(--space-3); }
.field-row > div { flex: 1; min-width: 0; }

/* A CheckboxSelectMultiple field's plain <ul> of checkboxes - first
   needed for calendar entries' "assigned to" (CLAUDE.md decision 64),
   generic enough for any future multi-person picker to reuse. */
.checkbox-list ul { list-style: none; margin: var(--space-1) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.checkbox-list li label { font-weight: 400; color: var(--color-text); display: flex; align-items: center; gap: var(--space-2); }
.checkbox-list input[type="checkbox"] { width: auto; }

/* Several people on a client, project or task (decision 123): names sit
   side by side and wrap as whole names, so a folded phone never squeezes
   or runs off the screen. */
.people-picker { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin-top: var(--space-1); }
.people-picker label { font-weight: 400; color: var(--color-text); display: flex; align-items: center; gap: var(--space-2); white-space: nowrap; font-size: inherit; }
.people-picker input[type="checkbox"] { width: auto; margin: 0; }

label { font-size: var(--font-size-sm); font-weight: 600; color: var(--color-text-muted); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="search"], input[type="number"], textarea, select {
    font-family: inherit;
    font-size: var(--font-size-base);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    /* Neither a plain text input nor a select fills its own row by
       default - each just gets whatever shrink-to-fit width the
       browser happens to give it (a `size=20`-ish guess for text
       inputs, the widest current option for a select). That's
       normally close enough to unnoticeable, but a select has no
       upper bound: its native `overflow: visible` lets its own
       border/background grow to fit however long its longest option's
       text is, wider than the row/card it sits in if that text is
       long enough - which is exactly what "the dropdown text overflows
       outside its input box" was. `width: 100%` + `border-box` gives
       every field the same, already-established row width (the
       `form`/`.field-row > div` it sits in) instead of a size nobody
       asked for, so a select can never grow past its row again -
       see the rule below for what happens to its own text once it
       can't grow to fit any more. */
    width: 100%;
    box-sizing: border-box;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--green-100);
}

/* A select's own closed-state text no longer has anywhere to grow into
   now that it's capped at its row's width (above) - so, rather than
   silently clipping mid-character, long option text (e.g. "Si-Coat 461
   RC, 5 Gal, White (qty 12) - order PO000106 from CSL Silicones",
   SaleForm's own stock_order_item label - decision 69) truncates with
   an ellipsis instead. This only affects the closed select's own
   display text - the browser's native open dropdown list still renders
   every option's full, untruncated text, so nothing is actually hidden
   from a person who opens it, only from the box before they do. */
select {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* A quantity field (Sales, Products, Stock Order line items) is typed
   into and corrected more often, and more quickly, than most other
   fields in the app - a plain text-sized number input (worse still,
   input[type="number"] was never in the selector above at all until
   this same fix, so every one of these had been rendering with no app
   styling whatsoever, just the bare browser default) made this
   genuinely fiddly to use. `.input-quantity` is a deliberately larger,
   centred variant, set on the widget itself
   (NumberInput(attrs={"class": "input-quantity"})) rather than a new
   input type, so it's opt-in exactly where a field is really a stock
   count, not applied to every number input project-wide. */
input.input-quantity {
    font-size: var(--font-size-2xl);
    padding: var(--space-3) var(--space-4);
    max-width: 8rem;
    text-align: center;
}

/* A short numeric box sitting in its own table column (e.g. a product
   family's three minimum-order fields) - narrow rather than the
   project-wide `width: 100%`, since it sits under its own header, not
   alone in a form row. An unset minimum shows its "none" placeholder in
   the same muted tone as a field's label, not full text colour, so it
   reads as "nothing entered yet" rather than looking like a real value. */
input.input-narrow {
    width: 5rem;
    max-width: 5rem;
}
input.input-narrow::placeholder { color: var(--color-text-muted); }

button, .btn {
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-primary);
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    line-height: 1.4;
}
button:hover, .btn:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); text-decoration: none; }

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--grey-300);
}
.btn-secondary:hover { background: var(--grey-100); border-color: var(--grey-300); }

.btn-danger {
    background: var(--color-surface);
    color: var(--color-danger);
    border-color: var(--color-danger);
}
.btn-danger:hover { background: var(--color-danger-soft); border-color: var(--color-danger); }

.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--font-size-xs); white-space: nowrap; }

button:disabled, .btn:disabled {
    background: var(--grey-200);
    border-color: var(--grey-200);
    color: var(--grey-500);
    cursor: not-allowed;
}

/* --- Shared list-page pattern: search/filter bar + table ------------------ */
/* Reused by every "filter + table" page (Clients, Suppliers, Tasks,
   Documents, Team) so they stay visually consistent without each page
   re-inventing the same layout. */

.filter-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    max-width: none;
    margin-bottom: var(--space-5);
}
.filter-bar input[type="text"], .filter-bar input[type="search"] { min-width: 16rem; flex: 1; }
/* width: auto overrides the new project-wide `select { width: 100% }`
   rule above - a filter-bar select is a compact control sitting next
   to several others in one flex row, not a single full-width field in
   a narrow one-column form, so it should keep shrinking to its own
   content (down to min-width) the way it always has, not claim the
   whole row's width for itself. */
.filter-bar select { width: auto; min-width: 9rem; }
.filter-bar button { flex-shrink: 0; }
.filter-bar .clear-link { font-size: var(--font-size-sm); }

.table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    /* auto, not hidden: a table with several columns (Clients, Tasks,
       Documents, ...) genuinely doesn't fit a phone's width - letting it
       scroll sideways inside this box keeps every column readable,
       instead of squeezing them all into an unreadable width or letting
       the whole page scroll sideways (blocked globally - see body above). */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.table-wrap table { margin: 0; }

tr.row-overdue td:first-child { border-left: 3px solid var(--color-danger); }
/* A row that opens one record when clicked anywhere: the main link stretches
   over the row, other links in it stay clickable on top (decision 106). */
tr.row-link { position: relative; cursor: pointer; }
tr.row-link .row-link__main::after { content: ""; position: absolute; inset: 0; }
tr.row-link a:not(.row-link__main), tr.row-link button, tr.row-link form { position: relative; z-index: 1; }

/* A table cell holding more than one action (e.g. Download + Delete) -
   the delete form has to be a real <form> to POST, but sits inline
   next to the plain link rather than dropping to its own line. */
/* Stays a real table cell, so its row lines up (decision 107). */
.table-actions { white-space: nowrap; }
.table-actions > * + * { margin-left: var(--space-3); }
.table-actions form { display: inline; margin: 0; }
.table-wrap + .card-grid { margin-top: var(--space-5); }

/* TDS blocks on Documents, TDS: a heading and table per block, Move to under it (decision 135). */
.tds-block + .tds-block { margin-top: var(--space-6); }
/* Products page (decision 136): every family table shares the same fixed
   columns, so they line up down the page. Below the minimum width the
   table scrolls in its .table-wrap rather than squeeze. */
.product-table { table-layout: fixed; width: 100%; min-width: 58rem; }
.product-table__product { width: 19%; }
.product-table__pack { width: 14%; }
.product-table__colour { width: 14%; }
.product-table__code { width: 12%; }
.product-table__on-hand { width: 8%; }
.product-table__counted { width: 11%; }
.product-table__status { width: 22%; }
.product-table td { overflow-wrap: break-word; }
.product-table td.centre .badge { white-space: nowrap; }

/* Reorder status (decision 160): a red badge is a button opening its Why
   pop up; the grey line under it never wraps. */
.reorder-badge { border: 0; cursor: pointer; font-family: inherit; line-height: inherit; }
.reorder-badge:hover { text-decoration: underline; }
.reorder-note { display: block; font-size: var(--font-size-xs); color: var(--color-text-muted); white-space: nowrap; margin-top: var(--space-1); }
/* Decision 191: the landing date opens its stock order. Same look as before, underline on hover only. */
a.badge.reorder-link { text-decoration: none; }
a.badge.reorder-link:hover { text-decoration: underline; }
.reorder-note a.reorder-link { color: inherit; }
.reorder-status { margin-bottom: var(--space-3); }
.reorder-status > p { margin: var(--space-2) 0 0; }
.notice-modal.reorder-pop[hidden] { display: none; }
.reorder-pop { text-align: left; white-space: normal; }
/* In the pop up the grey line under Expected use may wrap on a folded phone. */
.reorder-pop .reorder-note { white-space: normal; }
.reorder-pop__box { position: relative; max-width: 30rem; max-height: calc(100vh - 2 * var(--space-4)); overflow-y: auto; }
.reorder-pop__close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    padding: var(--space-1) var(--space-2);
    cursor: pointer;
}
.reorder-pop__close:hover { color: var(--color-text); }
.reorder-pop__title { font-size: var(--font-size-lg); margin: 0; padding-right: var(--space-6); }
.reorder-pop__sub { margin: var(--space-1) 0 var(--space-4); }
.reorder-pop__table { margin: 0; width: 100%; }
.reorder-pop__table td.num { width: 1%; }
.reorder-pop__total td { font-weight: 700; }
@media (max-width: 480px) {
    .product-table td { min-width: 0; }
    .reorder-pop__table td { min-width: 0; padding: var(--space-2); }
}

.tds-block h2 { margin: 0 0 var(--space-3); }
.tds-block .empty-state { margin: 0; }
.tds-block th:first-child, .tds-block td:first-child { width: 1%; }
.move-bar { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); max-width: none; margin: var(--space-3) 0 0; }
.move-bar label { margin: 0; }
.move-bar select { width: auto; min-width: 8rem; flex: 1 1 8rem; max-width: 14rem; }
.move-bar button { flex-shrink: 0; }

/* A folded phone (360px) gets tighter cells, so names aren't squeezed to a word a line (decision 107). */
@media (max-width: 480px) {
    th, td { padding: var(--space-2) var(--space-3); }
    /* The table scrolls inside .table-wrap rather than squeeze a column to a word a line. */
    td { min-width: 7rem; }
    td.table-actions, td:has(> input[type="checkbox"]), td:has(> input[type="radio"]) { min-width: 0; }
    /* Dormant clients' table scrolls anyway, so the client name gets room for a few words a line (decision 110). */
    .dormant-table td:first-child { min-width: 11rem; }
    /* Same for task titles on the client and supplier pages (decision 125). */
    .linked-tasks td:first-child { min-width: 11rem; }
    /* And for TDS names next to the tick box (decision 135). */
    .tds-block td:nth-child(2) { min-width: 11rem; }
}

/* --- Back link + detail key/value list ------------------------------------- */

/* One Back at the top left of every page, above the heading (decision 172;
   replaces decision 107's parent links, same small style). */
.back-link { display: inline-block; font-size: var(--font-size-sm); margin-bottom: var(--space-2); white-space: nowrap; }

.detail-list { display: grid; grid-template-columns: 10rem 1fr; row-gap: var(--space-3); column-gap: var(--space-4); margin: 0; }
.detail-list dt { font-size: var(--font-size-sm); font-weight: 600; color: var(--color-text-muted); }
.detail-list dd { margin: 0; }

@media (max-width: 480px) {
    /* A fixed 10rem label column leaves very little room for the value
       on a narrow phone - stack label above value instead. */
    .detail-list { grid-template-columns: 1fr; row-gap: var(--space-1); }
    .detail-list dd { margin-bottom: var(--space-2); }
}

/* --- Note / activity-style list, reused for client notes -------------------- */

.note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.note-list li { padding-bottom: var(--space-4); border-bottom: 1px solid var(--color-border); }
.note-list li:last-child { border-bottom: none; padding-bottom: 0; }
.note-list .note-meta { font-size: var(--font-size-xs); color: var(--color-text-muted); display: block; margin-bottom: var(--space-1); }
.note-list .note-type { color: var(--color-text); font-weight: 600; }
/* Edit on every comment and the small "edited" mark (decision 187). */
.note-edited { font-style: italic; }
.note-edit { white-space: nowrap; }
.note-fold__text .note-meta { display: inline; margin: 0; }
/* One comment layout for hand notes and logged mails (decision 190). */
.note-list .note-who { color: var(--color-text); font-weight: 600; }
.note-body { overflow-wrap: anywhere; }
.note-body .note-subject { display: block; font-weight: 600; }
.note-body .note-line { display: block; }
.note-body .note-with { color: var(--color-text-muted); font-size: var(--font-size-sm); }
.note-their-words { display: block; margin-top: var(--space-1); padding: var(--space-1) var(--space-3); border-left: 3px solid var(--color-border); background: var(--grey-100); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.note-their-words__label { font-size: var(--font-size-xs); color: var(--color-text-muted); font-weight: 600; margin-right: var(--space-1); }
/* Long comments fold after about six lines; Show all opens them (core/js/comment-clamp.js). Decision 191: the
   script sets --fold-height to the bottom of the last whole line, so no fade and no half line. */
.note-body.is-clamped { max-height: var(--fold-height, 9em); overflow: hidden; }
.note-show-all { display: inline-block; margin-top: var(--space-1); }
.note-list .note-due-moved { display: block; margin-top: var(--space-1); font-size: var(--font-size-xs); }
/* Client comments: quote tag, Link to quote, photo thumbnails and files (decision 122). */
.note-list .note-quote { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-1); }
.note-list .note-quote .badge { white-space: normal; overflow-wrap: anywhere; }
.note-quote__unlink { display: inline; margin: 0; }
.link-button { padding: 0; border: none; background: none; color: var(--color-primary); font-size: var(--font-size-xs); font-weight: 400; text-decoration: underline; }
.link-button:hover { background: none; color: var(--color-primary-hover); }
.note-quote-link { margin-bottom: var(--space-1); font-size: var(--font-size-xs); }
.note-quote-link > summary { cursor: pointer; color: var(--color-primary); text-decoration: underline; list-style: none; display: inline; }
.note-quote-link > summary::-webkit-details-marker { display: none; }
.note-quote-link[open] > summary { display: none; }
.note-quote-link__form { display: flex; flex-direction: row; flex-wrap: wrap; max-width: 28rem; gap: var(--space-2); align-items: center; margin-top: var(--space-1); }
.note-quote-link__form select { flex: 1 1 10rem; width: auto; min-width: 0; }
.note-quote-link__form button { padding: var(--space-1) var(--space-3); font-size: var(--font-size-xs); }
.note-thumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.note-thumbs__item { display: block; width: 80px; height: 80px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--color-border); background: var(--grey-100); }
.note-thumbs__item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.note-list .note-files { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--font-size-sm); }
.note-list .note-files li { padding: 0; border: none; overflow-wrap: anywhere; }

/* --- Chip-style toggle, e.g. Calendar's Shared/Mine switch ------------------ */

.chip-toggle { display: inline-flex; gap: var(--space-2); font-size: var(--font-size-sm); }
.chip-toggle a, .chip-toggle strong {
    padding: var(--space-1) var(--space-3);
    border-radius: 999px;
    border: 1px solid var(--grey-300);
}
.chip-toggle strong { background: var(--color-primary); color: #fff; border-color: var(--color-primary); font-weight: 600; }
.chip-toggle a { color: var(--color-text-muted); }
.chip-toggle a:hover { background: var(--grey-100); text-decoration: none; }

.empty-state { color: var(--color-text-muted); font-size: var(--font-size-sm); }

.text-muted { color: var(--color-text-muted); }
/* A small grey second line in a table cell, e.g. an agent's reference name under the company (decision 206). */
.cell-sub { display: block; color: var(--color-text-muted); font-size: var(--font-size-xs); }

/* --- Card grid of links, e.g. Documents' category index -------------------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--space-4);
}
.card-link {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    color: var(--color-text);
}
.card-link:hover { border-color: var(--color-primary); text-decoration: none; box-shadow: var(--shadow-md); }
.card-link__title { font-weight: 600; font-size: var(--font-size-lg); }
.card-link__count { color: var(--color-text-muted); font-size: var(--font-size-sm); margin-top: var(--space-1); }
.card-link--future { box-shadow: none; border-style: dashed; cursor: default; }
.card-link--future:hover { border-color: var(--color-border); box-shadow: none; }

/* --- Stat tiles, e.g. the Dashboard and Sales overviews --------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4) var(--space-5);
}
.stat-card__value { font-size: var(--font-size-2xl); font-weight: 700; color: var(--color-primary); line-height: 1.1; }
.stat-card__label { font-size: var(--font-size-sm); color: var(--color-text-muted); margin-top: var(--space-1); }
.stat-card__note { font-size: var(--font-size-xs); color: var(--color-text-muted); margin-top: var(--space-1); }

/* A stat card holding two value/label pairs stacked instead of one -
   e.g. Sales' "invoices this month" / "this financial year" count. */
.stat-card--split { display: flex; flex-direction: column; gap: var(--space-3); }
.stat-card--split .stat-card__row + .stat-card__row { padding-top: var(--space-3); border-top: 1px solid var(--color-border); }

/* --- Progress bar, e.g. Sales' progress against target ---------------------- */

.progress {
    background: var(--grey-100);
    border-radius: var(--radius-sm);
    height: 1rem;
    overflow: hidden;
}
.progress__fill {
    background: var(--color-primary);
    height: 100%;
    border-radius: var(--radius-sm);
}

.stat-card__progress { height: 0.5rem; margin-top: var(--space-3); }

/* --- Sales by month chart (decision 107) -------------------------------------
   Plain HTML and CSS, no chart library (decision 4). Bars run across, one
   month per row, until there's room for twelve columns side by side. */

.month-chart { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.month-chart__link {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) 5.5rem;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    color: inherit;
    font-size: var(--font-size-sm);
}
a.month-chart__link:hover { background: var(--grey-100); text-decoration: none; }
.month-chart__label, .month-chart__amount { white-space: nowrap; }
.month-chart__amount { text-align: right; }
/* No grey track behind a bar (decision 206): a R 0 month reads as zero, with only a thin baseline. */
.month-chart__track { display: flex; height: 1rem; border-radius: var(--radius-sm); overflow: hidden; }
li:not(.is-future) > .month-chart__link .month-chart__track { box-shadow: inset 0 -1px 0 var(--color-border); }
.month-chart__bar { display: block; width: var(--bar); background: var(--color-primary); opacity: 0.55; }
.is-future .month-chart__track { background: none; border: 1px dashed var(--color-border); }
.is-future .month-chart__label { color: var(--color-text-muted); }
.is-selected .month-chart__link { background: var(--color-primary-soft); font-weight: 600; }
.is-selected .month-chart__bar { opacity: 1; }

@media (min-width: 1024px) {
    .month-chart { flex-direction: row; gap: var(--space-2); }
    .month-chart__month { flex: 1 1 0; min-width: 0; }
    .month-chart__link { display: flex; flex-direction: column-reverse; align-items: stretch; gap: var(--space-2); padding: var(--space-2) var(--space-1); text-align: center; }
    .month-chart__track { height: 10rem; align-items: flex-end; }
    .month-chart__bar { width: 100%; height: var(--bar); }
    .month-chart__amount { text-align: center; font-size: var(--font-size-xs); min-height: 1.2em; }
}

/* --- Growth report (decision 111) ---------------------------------------------
   Same plain bars as the month chart. A year row is label, bar, amount and
   percent; on a folded phone the bar drops under the figures. The grey
   outline behind this year's bar runs to last year's full total. */

.growth-chart { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.growth-chart__year {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) 7rem 3.5rem;
    grid-template-areas: "label track amount pct" ". note note note";
    align-items: center;
    column-gap: var(--space-3);
    font-size: var(--font-size-sm);
}
.growth-chart__label { grid-area: label; }
.growth-chart__year > .growth-chart__track { grid-area: track; }
.growth-chart__year > .growth-chart__amount { grid-area: amount; }
.growth-chart__pct { grid-area: pct; text-align: right; }
.growth-chart__note { grid-area: note; font-size: var(--font-size-xs); }
.growth-chart__label, .growth-chart__amount, .growth-chart__pct { white-space: nowrap; }
.growth-chart__amount { text-align: right; }
.growth-chart__track { position: relative; display: block; height: 1rem; }
.growth-chart__bar, .growth-chart__target { position: absolute; top: 0; left: 0; bottom: 0; width: var(--bar); border-radius: var(--radius-sm); }
/* --shade is the year's own green, set per year by the view (decision 112). */
.growth-chart__bar { background: var(--shade, var(--color-primary)); }
.growth-chart__target { border: 1px solid var(--grey-400); }

.growth-key { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-4); font-size: var(--font-size-sm); }
.growth-key__item { display: inline-flex; align-items: center; white-space: nowrap; }
.growth-swatch { display: inline-block; width: 0.75rem; height: 0.75rem; margin-right: var(--space-2); border-radius: 2px; background: var(--shade); vertical-align: -0.05em; }

/* Year by month table, then upright columns: each month a group, one column per year on a shared baseline. */
.growth-table-wrap { margin: var(--space-5) 0; }
.growth-columns-wrap { overflow-x: auto; }
.growth-columns { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-2); }
.growth-columns__month { display: flex; flex-direction: column; min-width: 0; }
.growth-columns__plot { display: flex; align-items: flex-end; gap: 1px; height: 12rem; border-bottom: 1px solid var(--grey-400); }
.growth-columns__slot { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.growth-columns__col { width: 100%; height: var(--bar); background: var(--shade); border-radius: 2px 2px 0 0; }
.growth-columns__label { text-align: center; font-size: var(--font-size-xs); color: var(--color-text-muted); padding-top: var(--space-1); white-space: nowrap; }

@media (max-width: 480px) {
    /* On a folded phone the chart keeps a readable width and scrolls in its box, as the table does. */
    .growth-columns { min-width: 36rem; }
    .growth-chart__year { grid-template-columns: auto 1fr auto; grid-template-areas: "label amount pct" "track track track" "note note note"; row-gap: var(--space-1); }
    .growth-chart__pct { min-width: 3.5rem; }
}

/* The month's sales list: on a folded phone each sale takes two lines,
   date, invoice and amount over the client, instead of a squeezed table. */
@media (max-width: 480px) {
    .month-sales thead { display: none; }
    /* Block, not table, so a long client name wraps inside the card rather than widening it (decision 141). */
    .month-sales, .month-sales tbody { display: block; }
    .month-sales tbody tr { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "date invoice amount" "client client client"; column-gap: var(--space-3); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); }
    .month-sales tbody tr:last-child { border-bottom: none; }
    .month-sales td { padding: 0; border: none; }
    /* The card keeps its own layout, not the table alignment rule (decision 141). */
    .month-sales tbody td { text-align: left; min-width: 0; }
    .month-sales td:nth-child(1) { grid-area: date; }
    .month-sales td:nth-child(2) { grid-area: client; color: var(--color-text-muted); }
    .month-sales td:nth-child(3) { grid-area: invoice; }
    .month-sales tbody td:nth-child(4) { grid-area: amount; text-align: right; }
}

/* --- Auth pages (login) ------------------------------------------------------ */

.auth-shell {
    max-width: 22rem;
    margin: var(--space-8) auto 0;
}
.auth-shell h1 { text-align: center; margin-bottom: var(--space-5); }
/* Login page logo, name, tagline and verse of the day (decision 202). */
.auth-logo { display: block; width: 11rem; max-width: 100%; height: auto; margin: 0 auto var(--space-4); }
.auth-shell .auth-title { font-weight: 700; margin-bottom: var(--space-1); }
.auth-tagline { text-align: center; color: var(--color-text-muted); font-size: var(--font-size-sm); margin: 0 0 var(--space-5); }
.daily-verse {
    margin: 0 0 var(--space-5);
    padding: var(--space-3) var(--space-4);
    background: var(--green-50);
    border-left: 3px solid var(--color-logo-green);
    border-radius: var(--radius-sm);
    text-align: center;
}
.daily-verse__text { margin: 0; font-style: italic; }
.daily-verse__ref { margin-top: var(--space-2); color: var(--color-logo-green); font-weight: 700; font-size: var(--font-size-sm); }
.niv-notice { text-align: center; color: var(--grey-500); font-size: 0.6875rem; line-height: 1.4; margin: var(--space-5) 0 0; }
.auth-shell form { max-width: none; }

.errorlist { color: var(--color-danger); font-size: var(--font-size-sm); list-style: none; padding: 0; margin: 0; }

/* --- Tables ---------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: var(--font-size-sm); }
th {
    text-align: left;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    font-weight: 600;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}
td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); vertical-align: middle; }
/* One alignment rule for every table (decision 141, CLAUDE.md standing rule).
   Names and descriptive text stay left, the default above. Figures and dates
   (.num) and statuses, badges and actions (.centre) are centred. Short values
   never wrap; a table that runs out of width scrolls in its .table-wrap. */
th.num, td.num { text-align: center; font-variant-numeric: tabular-nums; }
td.num { white-space: nowrap; }
th.centre, td.centre { text-align: center; }
/* Long text, like a client's name, may wrap, but never to a word a line. */
td.text-col { min-width: 11rem; }
/* Every table stripes, odd rows mint (decision 129). :where() keeps these at
   zero specificity, so any table's own row colours and the hover below win. */
:where(tbody tr:nth-child(odd)) { background: var(--row-stripe); }
/* A lone "No ... yet" row stays plain. */
:where(tbody tr:only-child:has(> td[colspan]:only-child)) { background: none; }
/* Empty tables, app wide (decision 206): a table whose only row is one "No ... yet" cell shows that
   one plain line, with no column headings, no totals and no box around it. */
table:has(> tbody:only-of-type > tr:only-child > td[colspan]:only-child) > :is(thead, tfoot) { display: none; }
.table-wrap:has(> table > tbody:only-of-type > tr:only-child > td[colspan]:only-child) { background: none; border: 0; box-shadow: none; }
tbody:only-of-type > tr:only-child > td[colspan]:only-child { padding: var(--space-2) 0; border: 0; text-align: left; color: var(--color-text-muted); white-space: normal; }
tbody:only-of-type > tr:only-child:has(> td[colspan]:only-child):hover { background: none; }
/* Forecast tables: each product's tbody opens with its subheading row, so
   striping restarts under it with the first variant mint; notes stay plain. */
:where(.forecast-table tbody tr:nth-child(odd)) { background: none; }
:where(.forecast-table tbody tr:nth-child(even):not(.forecast-notes)) { background: var(--row-stripe); }
/* The calendar's month grid is weeks, not a list. */
:where(table.calendar tbody tr) { background: none; }
tbody tr:hover { background: var(--row-hover); }
table.calendar tbody tr:hover { background: var(--grey-50); }
tbody tr:last-child td { border-bottom: none; }

/* CSL forecast (decision 99): forecast cells lightly shaded. Figures centre via .num (decision 141). */
.forecast-table .is-forecast { background: var(--color-neutral-soft); }
.forecast-note { color: var(--color-text-muted); font-size: var(--font-size-sm); margin: var(--space-2) 0 0; }
.forecast-note:last-of-type { margin-bottom: var(--space-4); }
/* One table per family: each product is a subheading row (decision 107). */
.forecast-table .forecast-product th { background: var(--color-surface); font-size: var(--font-size-sm); text-transform: none; letter-spacing: normal; color: var(--color-text); padding-top: var(--space-4); }
.forecast-table tbody:first-of-type .forecast-product th { padding-top: var(--space-3); }
.forecast-table .forecast-notes td { white-space: normal; }
/* The note stays in view while the wide table scrolls on a phone. */
.forecast-table .forecast-notes .forecast-note { position: sticky; left: var(--space-3); max-width: min(48rem, calc(100vw - 7rem)); }
.forecast-table tbody td:first-child { min-width: 9rem; }
.forecast-table .forecast-notes .forecast-note:first-child { margin-top: 0; }
.forecast-table .forecast-notes .forecast-note:last-of-type { margin-bottom: 0; }

/* --- Badges ---------------------------------------------------------------- */

.badge {
    display: inline-block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: 0.15em 0.6em;
    border-radius: 999px;
    white-space: nowrap;
}
.badge-green { background: var(--color-success-soft); color: var(--color-success); }
.badge-amber { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-red { background: var(--color-danger-soft); color: var(--color-danger); }
/* Calm: sold and waiting on us, not a problem (decision 142). */
.badge-blue { background: var(--color-info-soft); color: var(--color-info); }
.text-danger { color: var(--color-danger); }
/* A date in a table stays on one line, even on a folded phone (decision 107). */
.nowrap { white-space: nowrap; }
.centre { text-align: center; }
.badge-grey { background: var(--color-neutral-soft); color: var(--color-neutral-soft-text); }

/* --- Messages --------------------------------------------------------------- */

.messages { list-style: none; padding: 0; margin: 0 0 var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.message {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    background: var(--color-success-soft);
    color: var(--color-primary-soft-text);
}
.message--error { background: var(--color-danger-soft); color: var(--color-danger); }
/* Saving would take stock below zero (decision 137): warn, never block. */
.stock-warning { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--color-warning-soft); color: var(--color-warning); border: 1px solid #f0d9a8; }
.stock-warning p { margin: 0 0 var(--space-2); }
.stock-warning .form-actions { margin-top: var(--space-3); }
.stock-warning .btn-secondary { color: var(--color-text); }

/* Sale and quote lines (decision 91): one row per line, wrapping on a
   phone. `[hidden]` is forced so a flex row the JS removes really goes. */
.line-rows [hidden] { display: none !important; }
.line-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: flex-end;
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--grey-200);
}
.line-row > div { min-width: 0; }
.line-row > div > label { display: block; }
.line-row__product { flex: 1 1 16rem; }
.line-row__description { flex: 1 1 12rem; }
.line-row__remove { white-space: nowrap; }
.line-list { margin: 0; padding-left: 1.2em; }

/* A collapsible group of rows - the Tasks page's Done section and its
   per-month groups (decision 92), styled like the dashboard feed's
   own groups (decision 41). */
.collapse-group { border-bottom: 1px solid var(--color-border); padding: var(--space-3) 0; }
.collapse-group:last-of-type { border-bottom: none; }
.collapse-group > summary { cursor: pointer; font-weight: 600; padding: var(--space-1) 0; list-style: revert; }
.collapse-group[open] > summary { margin-bottom: var(--space-2); }
.collapse-group .collapse-group { margin-left: var(--space-3); }

/* Task merge screen (decision 95): the selected tasks side by side. */
.merge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); }
.merge-grid .card { margin: 0; }
.merge-grid .detail-list { grid-template-columns: 7rem 1fr; }
.merge-card--kept { border-color: var(--color-success); }
.merge-bar { display: flex; flex-direction: row; align-items: center; gap: var(--space-3); max-width: none; margin-bottom: var(--space-3); }

/* "+ Add comment" / "+ Add contact" links that open a small form in place (decision 100). */
.add-toggle { margin-top: var(--space-4); }
/* The "+ Add ..." opener is a small solid green button, like .btn.btn-sm (decision 113). */
.add-toggle > summary { display: inline-flex; align-items: center; cursor: pointer; list-style: none; padding: var(--space-1) var(--space-3); font-size: var(--font-size-xs); font-weight: 600; line-height: 1.4; white-space: nowrap; color: #fff; background: var(--color-primary); border: 1px solid var(--color-primary); border-radius: var(--radius-sm); }
.add-toggle > summary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.add-toggle > summary::-webkit-details-marker { display: none; }
.add-toggle[open] > summary { display: none; }
/* A quieter opener: a small plain link, as for "Add supporting document" (decision 158). */
.add-toggle--link > summary, .add-toggle--link > summary:hover { padding: 0; font-weight: 400; color: var(--color-primary); background: none; border: 0; text-decoration: underline; }
.add-toggle--link { margin-top: var(--space-3); }
/* Follow up and Mark done side by side on a task; the open one takes the full width (decision 190). */
.task-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-start; margin-top: var(--space-4); }
.task-actions .add-toggle { margin-top: 0; }
.task-actions .add-toggle[open] { flex-basis: 100%; }
/* An add button under the page header, above the search (decision 166, the TDS page). */
.page-add { margin-bottom: var(--space-4); }
.page-add .add-toggle { margin-top: 0; }
.page-add .add-toggle__form { max-width: 32rem; }
.supporting-docs { margin-top: var(--space-5); }
/* A product's TDS and Supporting documents tables share one set of column
   widths so Name, Uploaded by, Uploaded and the buttons line up (decision 159).
   Below the minimum the table scrolls in its box; a very long file name wraps
   rather than running into the next column. */
table.doc-table { table-layout: fixed; width: 100%; min-width: 64rem; }
.doc-table col.doc-col-by { width: 11rem; }
.doc-table col.doc-col-date { width: 11rem; }
.doc-table col.doc-col-actions { width: 21rem; }
.doc-table td:first-child { white-space: normal; overflow-wrap: anywhere; }
/* Download and Delete start at the same place on every row; the red mark follows Delete. */
.doc-table td.table-actions { text-align: left; }
.older-version { color: var(--color-danger); font-size: var(--font-size-xs); font-weight: 600; }
/* Every family's TDS table lines up with the next (decision 159). */
table.tds-table { table-layout: fixed; width: 100%; min-width: 42rem; }
.tds-table td:first-child { white-space: normal; overflow-wrap: anywhere; }
.tds-table th:nth-child(2) { width: 9rem; }
.tds-table th:nth-child(3) { width: 13rem; }
.tds-family h2 { margin-top: var(--space-5); }
.tds-table .change-family { margin-left: var(--space-3); font-size: var(--font-size-xs); color: var(--color-text-muted); }
.add-toggle__form { margin-top: var(--space-3); }
.add-toggle__actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.compact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--font-size-sm); }

/* Clients page A to Z bar down the right hand side (decision 100). From
   decision 116 it spreads its letters evenly down the visible height under
   the sticky header, so it uses the screen without running off it; on a
   short screen the letters shrink a little rather than overflow. */
.az-layout { display: flex; gap: var(--space-2); align-items: flex-start; }
.az-layout > .table-wrap { flex: 1; min-width: 0; }
.az-bar {
    --az-top: 4.5rem;
    position: sticky;
    top: var(--az-top);
    height: calc(100vh - var(--az-top) - var(--space-4));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    font-size: min(var(--font-size-base), (100vh - var(--az-top) - var(--space-4)) / 30);
    font-weight: 600;
    line-height: 1.1;
}
.az-bar a, .az-bar__off { display: block; padding: 0 var(--space-1); min-width: 2rem; text-align: center; }
/* Phones and the folded Fold: two even rows across the full width above
   the table (A to N, then O to Z and #), each letter a comfortable tap target. */
@media (max-width: 480px) {
    .az-layout { flex-direction: column; align-items: stretch; }
    .az-bar {
        order: -1; position: static; height: auto;
        display: grid; grid-template-columns: repeat(14, minmax(0, 1fr));
        font-size: var(--font-size-base); line-height: 1.4;
    }
    .az-bar a, .az-bar__off { min-width: 0; padding: var(--space-2) 0; }
}
.az-bar__off { color: var(--grey-300); cursor: default; }
.az-anchor { scroll-margin-top: 5rem; }

/* Type to narrow box above a client dropdown (decision 100). */
.searchable-select__input { margin-bottom: var(--space-1); }
.searchable-select__hint { display: block; color: var(--color-text-muted); font-size: var(--font-size-xs); }
.searchable-select__hint[hidden] { display: none; }
.section-heading { margin-top: var(--space-6); }
/* The Leads page's Upload a file form, under Files (decision 170). */
.leads-upload { margin-top: var(--space-4); }

/* Forecast pages (decision 114): the year picker and the setting boxes share one row. */
.forecast-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-6); margin-bottom: var(--space-5); }
.forecast-controls .filter-bar { margin-bottom: 0; flex-wrap: nowrap; }
input.input-setting { width: 5rem; }
.forecast-section .table-wrap + h2, .forecast-section .table-wrap + h3 { margin-top: var(--space-5); }
.order-lines td:first-child { min-width: 8rem; }

/* --- Passkeys (decision 126) ----------------------------------------------- */

.passkey-login button { width: 100%; }
.auth-divider { text-align: center; color: var(--color-text-muted); font-size: var(--font-size-sm); margin: var(--space-4) 0; }
.auth-note { color: var(--color-text-muted); font-size: var(--font-size-sm); margin-top: var(--space-4); }
.passkey-list { list-style: none; padding: 0; margin: 0 0 var(--space-4); }
.passkey-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}
.passkey-list form { margin: 0; }
.passkey-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.passkey-actions button { white-space: nowrap; }
/* Dark on white whatever the theme, so a phone camera can read it (decision 127). */
.qr-code { display: block; width: min(15rem, 100%); height: auto; background: #fff; color: #000; margin: 0 0 var(--space-4); }
.notice-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: rgba(0, 0, 0, 0.45);
}
.notice-modal__box { max-width: 28rem; width: 100%; margin: 0; }
.notice-modal__actions { display: flex; flex-direction: row; gap: var(--space-3); flex-wrap: wrap; margin: 0; max-width: none; }

/* --- CSL Price List (decision 129) ------------------------------------------ */

.breadcrumb { font-size: var(--font-size-sm); color: var(--color-text-muted); margin-bottom: var(--space-2); }
/* Two groups (decision 130): costs on the left, GPs and Save pushed hard
   right. The right group wraps under the left on a narrower screen, still
   right aligned, and just stacks on a folded phone. */
.price-settings { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-8); margin-bottom: var(--space-5); max-width: none; }
.price-settings__group { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-4); }
.price-settings__group--right { margin-left: auto; justify-content: flex-end; }
.price-settings__field { display: flex; flex-direction: column; gap: var(--space-1); }
.price-settings__field label { font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-muted); margin: 0; white-space: nowrap; }
.price-settings input.input-setting { width: 6.5rem; height: 2.5rem; }
/* A normal primary button, the same height as the boxes beside it. */
.price-settings__save { height: 2.5rem; box-sizing: border-box; white-space: nowrap; }
@media (max-width: 480px) {
    .price-settings__group--right { margin-left: 0; justify-content: flex-start; }
}
/* "+ Add a special price" and Edit side by side (decision 136). Edit hides
   while the add form is open, so it never sits beside the form. */
.price-add { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-4); }
.price-add .add-toggle { margin-top: 0; }
.price-add .add-toggle[open] { flex-basis: 100%; }
.price-add .add-toggle__form { max-width: 32rem; }
.price-add:has(.add-toggle[open]) .price-edit { display: none; }
.price-edit { white-space: nowrap; }
/* Product, Pack and Buy read left; every figure is centred, header and all (decision 136). */
.price-table th.num, .price-table td.num { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-table th.price-tier { white-space: nowrap; }
.price-table td.price-product { min-width: 8rem; }
/* The narrow first column: one round button a row, no header text. */
.price-table th.price-pick, .price-table td.price-pick { width: 1%; min-width: 0; padding-left: var(--space-2); padding-right: var(--space-1); text-align: center; }
.price-table td.price-pick input { width: 1.1rem; height: 1.1rem; margin: 0.15rem 0 0; cursor: pointer; }
/* Stripes go by product and pack, not by row (decision 130): the whole first
   group mint, the next white, a thin line between groups and none inside. */
:where(.price-table tbody tr) { background: none; }
:where(.price-table tbody.price-group:nth-of-type(odd) tr) { background: var(--row-stripe); }
.price-table tbody.price-group td { border-bottom: none; }
.price-table tbody.price-group + tbody.price-group tr:first-child td { border-top: 1px solid var(--color-border); }
/* Decision 134: everything on a row lines up at the top, the GP hangs under its price. */
.price-table th, .price-table td { vertical-align: top; padding-left: var(--space-3); padding-right: var(--space-3); }
.price-table .price-figure { display: inline-flex; flex-direction: column; align-items: center; }
.price-table .price-gp { line-height: 1.2; }
/* Tier columns keep their own tint over the group banding. */
.price-table td.price-tier--distributor { background: var(--tier-distributor); }
.price-table td.price-tier--reseller { background: var(--tier-reseller); }
.price-table td.price-tier--end-user { background: var(--tier-end-user); }
.price-table td.price-tier--list { background: var(--tier-list); }
/* On hover the whole row darkens, the tier cells each a shade of their own colour (decision 137). */
.price-table tbody tr:hover td.price-tier--distributor { background: var(--tier-distributor-hover); }
.price-table tbody tr:hover td.price-tier--reseller { background: var(--tier-reseller-hover); }
.price-table tbody tr:hover td.price-tier--end-user { background: var(--tier-end-user-hover); }
.price-table tbody tr:hover td.price-tier--list { background: var(--tier-list-hover); }
/* The table scrolls in its own box with the header frozen. Solid header cells
   cover the rows under them; the shadow stands in for the bottom border,
   which a sticky cell in a collapsed table leaves behind. */
.price-table-wrap { max-height: calc(100vh - 5.5rem); max-height: calc(100dvh - 5.5rem); overflow-y: auto; }
.price-table thead th { position: sticky; top: 0; z-index: 2; background: var(--color-surface); border-bottom: none; box-shadow: inset 0 -1px 0 var(--color-border); }
.price-table th.price-tier--distributor { background: var(--tier-distributor-head); color: var(--tier-distributor-text); }
.price-table th.price-tier--reseller { background: var(--tier-reseller-head); color: var(--tier-reseller-text); }
.price-table th.price-tier--end-user { background: var(--tier-end-user-head); color: var(--tier-end-user-text); }
.price-table th.price-tier--list { background: var(--tier-list-head); color: var(--tier-list-text); }
/* A CSL line's edit page (decision 136): three blocks, four boxes a row on a
   laptop, fewer as the screen narrows, one a row on a folded phone. */
form.price-edit-form { max-width: 58rem; gap: var(--space-5); }
.price-block__heading { font-size: var(--font-size-base); margin: 0 0 var(--space-3); }
.price-block__note { margin: calc(-1 * var(--space-2)) 0 var(--space-3); font-size: var(--font-size-xs); color: var(--color-text-muted); }
.price-block__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
.price-block__grid + .price-block__grid { margin-top: var(--space-3); }
.price-block__field { display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-1); min-width: 0; }
.price-block__field.price-tier--distributor input { background: var(--tier-distributor); border-color: var(--tier-distributor-head); }
.price-block__field.price-tier--reseller input { background: var(--tier-reseller); border-color: var(--tier-reseller-head); }
.price-block__field.price-tier--end-user input { background: var(--tier-end-user); border-color: var(--tier-end-user-head); }
.price-block__field.price-tier--list input { background: var(--tier-list); border-color: var(--tier-list-head); }
@media (max-width: 700px) {
    .price-block__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .price-block__grid { grid-template-columns: 1fr; }
}
/* Save, Cancel and (on a special) Delete in one row at the bottom of a form. */
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.form-actions__end { margin-left: auto; }
/* TSS Price List (decision 132): the supplier ticks in the settings strip. */
.tss-suppliers { border: 0; padding: 0; margin: 0; min-width: 0; }
.tss-suppliers legend { font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-muted); padding: 0; margin-bottom: var(--space-1); }
.tss-suppliers__list { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.tss-suppliers__tick { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; font-weight: normal; color: var(--color-text); white-space: nowrap; }
.tss-suppliers__tick input { width: auto; margin: 0; }
.tss-suppliers__empty { margin: 0; }

.project-pricing { margin-top: var(--space-5); }
.project-pricing__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-4); }
.project-pricing__head h2 { margin: 0; }
.project-pricing__head .text-muted { font-size: var(--font-size-sm); }
.project-pricing__body { display: flex; flex-wrap: wrap; gap: var(--space-5); align-items: flex-start; }
.project-pricing__inputs { flex: 1 1 26rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: var(--space-3) var(--space-4); }
.project-pricing__field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.project-pricing__field[hidden] { display: none; }
.project-pricing__field--wide { grid-column: 1 / -1; }
.project-pricing__field label, .project-pricing__label { font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-muted); margin: 0; }
.project-pricing__field input { width: 100%; }
.project-pricing__field--wide button { align-self: flex-start; }
.project-pricing__tiers { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.project-pricing__tiers .is-selected, .project-pricing__tiers .is-selected:hover { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.project-pricing__results { flex: 1 1 16rem; display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-4); margin: 0; padding: var(--space-4); background: var(--color-primary-soft); border-radius: var(--radius); }
.project-pricing__results dt { font-size: var(--font-size-sm); color: var(--color-text-muted); }
.project-pricing__results dd { margin: 0; text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.project-pricing__results .project-pricing__warning { grid-column: 1 / -1; text-align: left; }

/* Stock movements report (decision 137). */
.below-zero { margin-bottom: var(--space-5); }
.below-zero__heading { font-size: var(--font-size-base); margin: 0 0 var(--space-2); }
.below-zero__list { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }
.stock-movements__filter { align-items: flex-end; }
.stock-movements__filter label { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; max-width: 100%; }
.stock-movements__filter select.stock-movements__variant { width: 100%; max-width: 30rem; }
/* On a folded phone the table scrolls in its box rather than squeeze the reference to a word a line. */
.stock-movements td.stock-ref { min-width: 12rem; }
.stock-movements td.stock-negative { color: #8b1a1a; font-weight: 600; }
/* On hand figures link to Stock movements but keep the text colour, underlined on hover only (decision 139). */
a.stock-link { color: inherit; }
.stock-mismatch { margin-top: var(--space-3); color: var(--color-warning); }
/* Stock orders list: tighter side padding pays for the Shipped column (decision 140) and for
   Supplier, Size and Mark received staying on one line (decision 141). */
.stock-order-list th, .stock-order-list td { padding-left: var(--space-2); padding-right: var(--space-2); }

/* --- Prospects (decision 149) ------------------------------------------------ */

.prospect-tier--top { background: var(--prospect-top); color: var(--prospect-top-text); }
.prospect-tier--first { background: var(--prospect-first); color: var(--prospect-first-text); }
.prospect-tier--second { background: var(--prospect-second); color: var(--prospect-second-text); }
.prospect-tier--third { background: var(--prospect-third); color: var(--prospect-third-text); }
.prospect-tier--fourth { background: var(--prospect-fourth); color: var(--prospect-fourth-text); }
.prospect-tier--africa { background: var(--prospect-africa); color: var(--prospect-africa-text); }
.prospect-tier--no-tier { background: none; color: var(--color-text-muted); border: 1px solid var(--color-border); }
.prospect-company { font-weight: 400; }
.prospect-company--buying { font-weight: 700; }
.prospect-sub { font-size: var(--font-size-xs); color: var(--color-text-muted); margin-top: 0.15em; }
.product-chip {
    display: inline-block;
    font-size: var(--font-size-xs);
    padding: 0.1em 0.5em;
    margin: 0.1em 0.25em 0.1em 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    white-space: nowrap;
}
.prospect-table td:nth-child(3) { min-width: 8rem; }
.prospect-key { margin-top: var(--space-3); font-size: var(--font-size-sm); }
.prospect-note { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.prospect-flag { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-4); }
.prospect-flag form { margin: 0; }
.prospect-flag .badge { white-space: normal; }
/* The preview is one big form around full width cards and tables. */
form.prospect-preview { max-width: none; display: block; }
form.prospect-preview > * + * { margin-top: var(--space-5); }
.prospect-preview select { max-width: 16rem; }

/* --- Help page (decision 152): a search box, then one card per top bar group
   of closed how to entries. --- */
.help-search { max-width: 40rem; margin-bottom: var(--space-5); }
.help-search input[type="search"] { width: 100%; }
.help-group { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.help-group h2 { margin: var(--space-2) 0 var(--space-1); }
.help-entry { border-bottom: 1px solid var(--color-border); }
.help-entry:last-child { border-bottom: none; }
.help-entry > summary { cursor: pointer; padding: var(--space-3) 0; font-weight: 500; }
.help-entry > summary:hover { color: var(--color-primary); }
.help-entry__body { padding: 0 0 var(--space-4) var(--space-5); }
.help-entry__body ol { margin: 0 0 var(--space-3); padding-left: var(--space-5); }
.help-entry__body li + li { margin-top: var(--space-1); }
.help-entry__watch { margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3); border-left: 3px solid var(--color-warning); background: var(--color-warning-soft); }
.help-entry__go { margin: 0; font-weight: 600; }
.help-results .empty-state { margin: 0 0 var(--space-4); }

/* --- Call brief (decision 153): one narrow column of plain lists, easy to
   read on a phone before a call. --- */
.call-brief { max-width: 46rem; }
.call-brief__next { margin: 0; font-size: var(--font-size-lg); }
.call-brief h2 { margin: 0 0 var(--space-2); font-size: var(--font-size-sm); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.call-brief ul, .call-brief ol { margin: 0; padding-left: var(--space-5); }
.call-brief li { overflow-wrap: anywhere; }
.call-brief li + li { margin-top: var(--space-2); }
.call-brief__careful { border-left: 3px solid var(--color-warning); background: var(--color-warning-soft); }
.call-brief__meta { color: var(--color-text-muted); font-size: var(--font-size-sm); }
/* Decision 164: name and refresh icon on one line, the made line and the latest word under it. */
.call-brief__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.call-brief__head h1 { margin: 0; overflow-wrap: anywhere; }
.call-brief__refresh { margin: 0; flex: none; }
.call-brief__refresh-btn { display: inline-flex; align-items: center; justify-content: center; padding: var(--space-2); line-height: 0; }
.call-brief__made { margin: var(--space-1) 0 var(--space-2); }
.call-brief__last { margin: 0 0 var(--space-4); font-weight: 600; overflow-wrap: anywhere; }
.call-brief__lead { margin: 0 0 var(--space-2); font-weight: 600; }
.call-brief__due > a, .call-brief__due .call-brief__meta { color: var(--color-danger); }
.call-brief__sources { margin-top: var(--space-4); }

/* Forecast tabs (decision 162). */
.forecast-lead { margin: 0 0 var(--space-4); }
input.input-target { width: 9rem; }
tr.is-current td { font-weight: 600; }
.mark-sent { margin-top: var(--space-4); margin-bottom: 0; }
.stock-to-order th { white-space: nowrap; }
.stock-to-order td.text-col { min-width: 13rem; }
/* Decision 206: on a laptop every family table fits its card, no sideways scroll, and all share the same
   column widths. Headings may take two lines; figures, dates and badges still never wrap. */
@media (min-width: 1100px) {
    .stock-to-order { table-layout: fixed; }
    .stock-to-order th { white-space: normal; }
    .stock-to-order td.text-col { min-width: 0; }
    .stock-to-order th:nth-child(1) { width: 20%; }
    .stock-to-order th:nth-child(6) { width: 15%; }
    .stock-to-order th:nth-child(9) { width: 10%; }
    .stock-to-order th:nth-child(10) { width: 10%; }
}
form.table-form { max-width: none; }
form.table-form > button { align-self: flex-start; }
.mark-sent input.input-date { width: auto; }

/* Visit planner (decision 165). */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.address-warning { margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3); border-left: 3px solid var(--color-danger); background: var(--color-danger-soft); color: var(--color-danger); font-size: var(--font-size-sm); }
.address-warning a { color: var(--color-danger); font-weight: 600; }
form.inline-form { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2); max-width: none; }
form.inline-form input[type="text"] { width: 14rem; max-width: 100%; }
.visit-day__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.visit-day__head h2 { margin: 0; white-space: nowrap; min-width: 9.5rem; }
.visit-day__town { margin: 0; font-weight: 600; }
/* Decision 166: an empty day is one line; a removed middle day is a quiet one. */
.visit-day--empty .visit-day__head { margin-bottom: 0; }
.visit-day--off { padding-top: var(--space-3); padding-bottom: var(--space-3); background: var(--color-bg); }
.visit-day--off .visit-day__head { margin-bottom: 0; }
.visit-day--off h2 { color: var(--color-text-muted); }
form.visit-day__remove { margin-left: auto; max-width: none; }
form.visit-town, form.visit-find { position: relative; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); max-width: none; }
form.visit-town input { width: 13rem; max-width: 100%; }
form.visit-find input { width: 15rem; max-width: 100%; }
form.visit-town { flex: 0 1 13rem; }
.visit-town__note { flex-basis: 100%; color: var(--color-danger); }
.visit-town__note[hidden], .visit-find__matches[hidden], form.visit-remove-form[hidden] { display: none; }
.visit-find__matches { position: absolute; top: 100%; left: 0; z-index: 20; width: 18rem; max-width: calc(100vw - 3rem); margin-top: var(--space-1); padding: var(--space-1); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); }
.visit-find__matches button { display: block; width: 100%; padding: var(--space-2); text-align: left; font-weight: 400; color: var(--color-text); background: none; border: 0; border-radius: var(--radius-sm); white-space: normal; }
.visit-find__matches button:hover, .visit-find__matches button:focus { background: var(--color-bg); color: var(--color-text); }
.visit-find__matches .text-muted { font-size: var(--font-size-xs); }
.visit-find__empty { margin: 0; padding: var(--space-2); font-size: var(--font-size-sm); color: var(--color-text-muted); }
.visit-note { margin: 0 0 var(--space-2); font-size: var(--font-size-sm); }
/* One tidy row per visit: time, client, reason, status, then Edit (decision 166). */
.visit-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
.visit-row { display: grid; grid-template-columns: 4rem minmax(0, 1.3fr) minmax(0, 1fr) auto 3rem; align-items: center; gap: var(--space-1) var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--color-border); font-size: var(--font-size-sm); }
.visit-row:first-child { border-top: none; }
.visit-row__time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.visit-row__client a { font-weight: 600; overflow-wrap: anywhere; }
.visit-row__town { margin-left: var(--space-1); white-space: nowrap; }
.visit-row__status .badge { white-space: nowrap; }
.visit-row__edit > summary { cursor: pointer; list-style: none; color: var(--color-primary); text-decoration: underline; text-align: right; }
.visit-row__edit > summary::-webkit-details-marker { display: none; }
.visit-row__edit[open] { grid-column: 1 / -1; grid-row: 2; }
.visit-row__edit[open] > summary { display: none; }
.visit-row__drive, form.visit-swap { grid-column: 2 / -1; }
.visit-row__drive { font-size: var(--font-size-xs); }
form.visit-form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-3); max-width: none; margin-top: var(--space-2); padding: var(--space-3); background: var(--color-bg); border-radius: var(--radius-sm); }
.visit-form > div { display: flex; flex-direction: column; gap: var(--space-1); }
.visit-form__time input { width: 9rem; }
.visit-form__status select { width: 10rem; }
.visit-form__wide { flex: 1 1 14rem; min-width: 0; }
.visit-form > .visit-form__actions { flex: none; flex-direction: row; gap: var(--space-2); }
form.visit-swap { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2); max-width: none; padding: var(--space-2) var(--space-3); background: var(--color-warning-soft); border-radius: var(--radius-sm); font-size: var(--font-size-sm); }
/* Suggestions as tap to add chips, each with its reason. */
form.visit-suggest { max-width: none; gap: var(--space-2); margin-top: var(--space-3); }
.visit-suggest__title { margin: var(--space-2) 0 0; font-size: var(--font-size-sm); color: var(--color-text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
button.chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; max-width: 100%; padding: var(--space-1) var(--space-3); font-weight: 400; line-height: 1.3; text-align: left; white-space: normal; color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px; }
button.chip:hover { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-text); }
.chip__name { font-weight: 600; font-size: var(--font-size-sm); overflow-wrap: anywhere; }
.chip__why { font-size: var(--font-size-xs); color: var(--color-text-muted); }
.visit-more > summary { cursor: pointer; margin-top: var(--space-2); font-size: var(--font-size-sm); color: var(--color-primary); }
.visit-more .chips { margin-top: var(--space-2); }
.visit-plan__line { margin: 0 0 var(--space-2); }
.visit-plan__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-2) var(--space-4); margin-top: var(--space-4); font-size: var(--font-size-sm); }
.visit-plan__foot p { margin: 0; font-size: var(--font-size-xs); }
.danger-link { color: var(--color-danger); }
@media (max-width: 600px) {
    .visit-row { grid-template-columns: 3.5rem minmax(0, 1fr) auto; }
    .visit-row__reason { grid-column: 2 / 3; grid-row: 2; color: var(--color-text-muted); }
    .visit-row__edit { grid-column: 3; grid-row: 2; }
    .visit-row__edit[open] { grid-row: 3; }
    form.visit-day__remove { margin-left: 0; }
}

/* --- Visit planner: Map view, Start from a meeting, phone Today (decision 168) - */

.visit-view-switch { margin-bottom: var(--space-3); }
details.visit-meeting { margin: 0 0 var(--space-2); font-size: var(--font-size-sm); }
details.visit-meeting > summary { cursor: pointer; color: var(--color-primary); }
form.visit-meeting__form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-3); max-width: none; margin-top: var(--space-2); padding: var(--space-3); background: var(--color-bg); border-radius: var(--radius-sm); }
.visit-meeting__form > div { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.visit-meeting__form select { width: 18rem; max-width: 100%; }
.visit-meeting__form button { white-space: nowrap; }

form.visit-map__pickers { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-3); max-width: none; margin-bottom: var(--space-3); }
.visit-map__pickers > div { display: flex; flex-direction: column; gap: var(--space-1); }
.visit-map__pickers select { width: 14rem; max-width: 100%; }
.visit-map__layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: var(--space-4); align-items: start; }
.visit-map__canvas { height: 34rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--grey-100); }
/* Decision 173: z-index 0 keeps Leaflet's own layers (400 and up) under the top bar menus and pop ups. */
.visit-map__canvas.leaflet-container { z-index: 0; }
.visit-map__quiet { margin: var(--space-2) 0 0; font-size: var(--font-size-sm); }
.visit-map__legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); list-style: none; margin: var(--space-2) 0 0; padding: 0; font-size: var(--font-size-xs); color: var(--color-text-muted); }
.visit-map__legend li { display: inline-flex; align-items: center; gap: var(--space-1); white-space: nowrap; }
.visit-map__dot { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 50%; border: 1px solid #fff; box-shadow: 0 0 0 1px var(--grey-300); }
.visit-map__dot--ring { background: var(--color-surface); border: 3px solid var(--color-brand-green); box-shadow: none; }
.visit-map__side { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
form.visit-map__day { flex-direction: column; gap: var(--space-1); max-width: none; }
.visit-map__count { margin: 0; font-size: var(--font-size-sm); }
form.visit-map__suggest { max-width: none; gap: var(--space-1); max-height: 30rem; overflow-y: auto; }
.visit-map__list { list-style: none; margin: 0; padding: 0; }
.visit-map__list li { display: grid; grid-template-columns: 2rem minmax(0, 1fr); column-gap: var(--space-2); align-items: center; padding: var(--space-1) 0; border-top: 1px solid var(--color-border); font-size: var(--font-size-sm); }
.visit-map__list li:first-child { border-top: none; }
button.visit-map__add { grid-row: span 2; width: 2rem; height: 2rem; padding: 0; font-size: 1.1rem; line-height: 1; border-radius: 50%; }
.visit-map__name { font-weight: 600; overflow-wrap: anywhere; }
.visit-map__why { font-size: var(--font-size-xs); }
.visit-map__popup { display: flex; flex-direction: column; gap: var(--space-1); min-width: 10rem; font-size: var(--font-size-sm); }
.visit-map__popup button { margin-top: var(--space-1); white-space: nowrap; }
.visit-map-phone { display: none; }
/* Decision 169: distance chips and Look elsewhere above the map, prospect filters beside it, diamonds on it. */
.visit-map__bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.visit-map__bar form.visit-map__pickers { margin-bottom: 0; }
.visit-map__within { font-size: var(--font-size-sm); white-space: nowrap; }
.visit-map__elsewhere { font-size: var(--font-size-sm); white-space: nowrap; }
form.visit-map__prospects { flex-direction: column; gap: var(--space-1); max-width: none; padding: var(--space-2) 0; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); font-size: var(--font-size-sm); }
.visit-map__check { display: flex; align-items: center; gap: var(--space-2); font-weight: 400; font-size: var(--font-size-sm); color: var(--color-text); }
.visit-map__check input { width: auto; margin: 0; }
.visit-map__shows { display: flex; flex-direction: column; gap: 0.15em; padding-left: var(--space-4); }
.visit-map__tiers { display: flex; flex-wrap: wrap; gap: var(--space-1); padding-left: var(--space-4); }
.tick-chip { display: inline-flex; cursor: pointer; font-weight: 400; }
.tick-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tick-chip span { padding: 0.15em 0.6em; border: 1px solid var(--color-border); border-radius: 999px; font-size: var(--font-size-xs); color: var(--color-text-muted); white-space: nowrap; }
.tick-chip input:checked + span { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.tick-chip input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.visit-map__diamond span { display: block; width: 12px; height: 12px; margin: 2px; transform: rotate(45deg); border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.visit-map__diamond-key { display: inline-block; width: 0.65rem; height: 0.65rem; margin: 0 0.1rem; transform: rotate(45deg); border: 1px solid #fff; box-shadow: 0 0 0 1px var(--grey-300); }
.visit-map__popup-name { font-weight: 700; }
.visit-map__popup .link-button.visit-map__set { align-self: flex-start; padding: 0; font-size: var(--font-size-sm); }
.visit-map__main { position: relative; }
.visit-map__picking { position: absolute; top: var(--space-2); left: 3.5rem; right: var(--space-2); z-index: 1000; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-2) var(--space-3); background: var(--color-warning-soft); border-radius: var(--radius-sm); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); font-size: var(--font-size-sm); }
.visit-map__picking[hidden] { display: none; }
.visit-map__canvas--picking, .visit-map__canvas--picking .leaflet-grab, .visit-map__canvas--picking .leaflet-interactive { cursor: crosshair; }
@media (max-width: 1100px) {
    .visit-map__layout { grid-template-columns: minmax(0, 1fr) 16rem; }
}
@media (max-width: 860px) {
    .visit-view-switch, .visit-map { display: none; }
    .visit-map-phone { display: block; }
}

.visit-today { display: none; }
@media (max-width: 860px) {
    .visit-today { display: block; }
    .visit-plans--today { display: none; }
}
.visit-today h1 { margin-bottom: 0; }
.visit-today__visit { padding: var(--space-3) 0; border-top: 1px solid var(--color-border); }
.visit-today__visit--over .visit-today__name, .visit-today__visit--over .visit-today__time { color: var(--color-text-muted); }
.visit-today__meta { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
h2.visit-today__name { margin: 0; font-size: var(--font-size-lg); overflow-wrap: anywhere; }
.visit-today__time { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.visit-today__why { margin: var(--space-1) 0 0; font-size: var(--font-size-sm); }
.visit-today__buttons { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-top: var(--space-2); }
.visit-today__buttons .btn { display: flex; align-items: center; justify-content: center; min-height: 3rem; font-size: 1rem; white-space: nowrap; }
.visit-today__none { color: var(--color-text-muted); }
.visit-today__links { display: flex; gap: var(--space-4); margin-top: var(--space-2); }
.visit-today__links form { max-width: none; }
.visit-today__links .link-button { font-size: var(--font-size-sm); padding: var(--space-1) 0; }
.visit-today__near { margin-top: var(--space-2); padding: var(--space-2) var(--space-3); background: var(--color-bg); border-radius: var(--radius-sm); }
.visit-today__near h3 { margin: 0 0 var(--space-1); font-size: var(--font-size-sm); }
form.visit-today__go { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-2); max-width: none; padding: var(--space-2) 0; border-top: 1px solid var(--color-border); font-size: var(--font-size-sm); }
form.visit-today__go:first-of-type { border-top: none; }
form.visit-today__go > span { min-width: 0; overflow-wrap: anywhere; }
form.visit-today__go button { flex: none; min-width: 4.5rem; min-height: 2.75rem; }
.visit-today__all { margin-top: var(--space-4); }

/* --- Mails to log: contact detail questions and Change (decision 167) -------- */

.mail-questions { margin-bottom: var(--space-5); }
/* Check mail now (decision 209): the button with the last read time under it, top right. */
.mail-check { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mail-check form { margin: 0; }
.mail-check button { white-space: nowrap; }
.mail-check__when { margin: 0; font-size: var(--font-size-xs); color: var(--color-text-muted); white-space: nowrap; }
.mail-check__result { font-size: var(--font-size-sm); font-weight: 600; }
.mail-questions__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.mail-questions__list li { padding-bottom: var(--space-4); border-bottom: 1px solid var(--color-border); }
.mail-questions__list li:last-child { border-bottom: none; padding-bottom: 0; }
.mail-questions__list form { max-width: none; }
.mail-questions__prompt { margin: 0 0 var(--space-2); overflow-wrap: anywhere; }
.mail-questions__prompt .text-muted { display: block; font-size: var(--font-size-sm); }
.mail-questions__fields { display: flex; flex-direction: column; gap: var(--space-1); max-width: 28rem; margin-bottom: var(--space-2); }
.mail-questions__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.mail-questions__actions button, .mail-questions__actions .btn { white-space: nowrap; }
.mail-change-link { font-size: var(--font-size-xs); margin-left: var(--space-1); white-space: nowrap; }

/* No town yet on a Prospects list (decision 169): one town box a row. */
form.prospect-town { display: flex; flex-direction: column; gap: 0.15em; max-width: none; margin: 0; }
form.prospect-town input { width: 12rem; }
.prospect-town__note { font-size: var(--font-size-xs); color: var(--color-text-muted); white-space: normal; max-width: 12rem; }
.prospect-row--saved .prospect-town__note { color: var(--color-brand-green); }

/* The From Spotter line on a client page (decision 180): the words, then a small Tick or Untick. */
.from-spotter { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.from-spotter form { margin: 0; }
.from-spotter .btn-sm { white-space: nowrap; }

/* Decision 184: auto logged mail. The small "from mail" tag, and an auto entry folded under a hand note. */
.badge-from-mail { font-weight: 500; text-transform: none; }
.note-fold { margin-top: var(--space-2); font-size: var(--font-size-sm); }
.note-fold > summary { cursor: pointer; color: var(--color-text-muted); font-size: var(--font-size-xs); }
.note-fold__text { margin-top: var(--space-1); padding-left: var(--space-3); border-left: 2px solid var(--color-border); overflow-wrap: anywhere; }

/* A new ETA from a supplier mail, on the stock order page and Your list (decision 200). */
.eta-question { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.eta-question p { margin: 0; flex: 1 1 14rem; }
.eta-question__actions { display: flex; gap: var(--space-2); }
.card.eta-question-card { border-left: 4px solid var(--color-warning); }

/* Decision 203: the role edit buttons under each details card, and the registered name under a reference name. */
.card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.company-registered { margin: var(--space-1) 0 0; }
/* One tick a row, its help line under its own label, a clear gap to the next tick (decision 205). */
.company-ticks { display: flex; flex-direction: column; gap: var(--space-4); }
.company-ticks label { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--font-size-base); color: inherit; }
.company-ticks input { margin-top: 0.2rem; }
.company-tick__text { display: flex; flex-direction: column; gap: 0.125rem; }
.company-tick__text small { font-weight: 400; color: var(--color-text-muted); font-size: var(--font-size-sm); }

/* Merge check cards (decision 204): room above the headings, and the Link form. */
.merge-check h3 { margin-top: var(--space-5); }
.merge-check .merge-link { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.merge-check .merge-link label { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); max-width: 100%; }
.merge-check .merge-link button { white-space: nowrap; }

/* An order due today or overdue, until Mark received (decision 206). */
.reorder-link--due { color: var(--color-warning); font-weight: 600; }
/* A quiet Delete on Meetings and Leads files (decision 206): small grey text, still asks first. */
button.link-delete { background: none; border: 0; padding: 0; min-height: 0; color: var(--color-text-muted); font: inherit; font-size: var(--font-size-sm); font-weight: 400; cursor: pointer; box-shadow: none; }
button.link-delete:hover { color: var(--color-danger); text-decoration: underline; background: none; }
.meetings-year .table-wrap { margin-top: var(--space-2); }
.visit-past { margin-top: var(--space-5); }
/* Spotter Reports (decision 206): Parked countries fold into one clickable line; totals unchanged. */
.mines-parked { display: none; }
.mines-parked-toggle:checked + .table-wrap .mines-parked { display: table-row; }
.mines-parked-line label { display: inline; cursor: pointer; color: var(--color-primary); font-weight: 600; margin: 0; }
.mines-parked-line label::after { content: " \25B8"; }
.mines-parked-toggle:checked + .table-wrap .mines-parked-line label::after { content: " \25BE"; }
.mines-parked-toggle:focus-visible + .table-wrap .mines-parked-line label { outline: 2px solid var(--color-primary); outline-offset: 2px; }
