/* Build My Trip App: shared design system and layout. Light by default, dark when the device asks for it.
   Tokens first: every other stylesheet (builder, chat, suppliers) reads these names, so change a value here, not in each file. */
:root {
    color-scheme: light dark;
    --navy:#0f1e3d; --navy-2:#172c57;
    --bg:#f1f5f9; --card:#fff; --ink:#0f172a; --body:#334155; --muted:#5b6b80; --line:#e2e8f0; --field:#f8fafc; --soft:#f1f5f9;
    --accent:#1a63e0; --accent-hover:#1559cc; --accent-ink:#fff; --accent-soft:#eef4ff;
    --good:#047857; --good-bg:#ecfdf5; --warn:#b45309; --warn-bg:#fffbeb; --bad:#b91c1c; --bad-bg:#fef2f2;
    --ring:rgba(29,108,242,.18); --line-strong:#cbd5e1; --row-hover:#f8fafd;
    --shadow:0 1px 2px rgba(15,23,42,.04), 0 12px 32px -16px rgba(15,23,42,.10);
    --pop-shadow:0 16px 40px -12px rgba(15,23,42,.25);
    --max:1440px;
    --font:Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /* aliases used by the design mockups and older stylesheets */
    --blue:var(--accent); --blue-hover:var(--accent-hover); --blue-soft:var(--accent-soft);
}
@media (prefers-color-scheme: dark) {
    :root {
        --navy:#0a1530; --navy-2:#112247;
        --bg:#0b1220; --card:#121b2d; --ink:#e8edf5; --body:#c5cfdd; --muted:#8f9bb0; --line:#23304a; --field:#0d1526; --soft:#18233a;
        --accent:#6ea0ff; --accent-hover:#8ab4ff; --accent-ink:#0b1220; --accent-soft:#16264a;
        --good:#5fd39a; --good-bg:#0f2a20; --warn:#f0b35a; --warn-bg:#2c2210; --bad:#ff8a80; --bad-bg:#321416;
        --ring:rgba(110,160,255,.28); --line-strong:#33425f; --row-hover:#16213a;
        --shadow:0 1px 2px rgba(0,0,0,.3), 0 12px 32px -16px rgba(0,0,0,.5);
        --pop-shadow:0 16px 40px -12px rgba(0,0,0,.6);
    }
}
* { box-sizing:border-box }
body { margin:0; min-height:100vh; background:var(--bg); color:var(--body); font:15px/1.55 var(--font); -webkit-font-smoothing:antialiased }
h1, h2, h3 { color:var(--ink) }
a { color:var(--accent) }
code { word-break:break-all }
.muted { color:var(--muted) }
.ok { color:var(--good) }
.err { color:var(--bad); margin:8px 0 }
.sr-only { position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0 }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px }

/* ---- top bar and menu (always present once signed in) ---- */
.topbar { background:linear-gradient(160deg, var(--navy-2), var(--navy)); position:sticky; top:0; z-index:20; box-shadow:0 1px 0 rgba(255,255,255,.06), 0 6px 20px -12px rgba(15,23,42,.5) }
.bar { max-width:var(--max); margin:0 auto; padding:0 24px; display:flex; align-items:center; gap:24px; min-height:64px }
.brand { display:flex; align-items:center; gap:12px; text-decoration:none; padding:8px 0; flex:none }
.brand small { padding:3px 9px; border-radius:999px; background:rgba(255,255,255,.12); color:#cfe0ff; font-size:11px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; white-space:nowrap }
/* The supplied logo is dark lettering on white, so it sits on a white chip on the navy bar. Swap for a white logo file when one exists. */
.brand-logo { display:block; height:36px; width:auto; background:#fff; border-radius:8px; padding:3px 8px }
.menu { display:flex; gap:4px; flex:1; min-width:0 }
.menu a, .who summary { display:inline-block; padding:8px 14px; border-radius:8px; color:rgba(255,255,255,.74); text-decoration:none; font-weight:500; white-space:nowrap; transition:background .15s, color .15s }
.menu a:hover { color:#fff; background:rgba(255,255,255,.09) }
.menu a.on { color:#fff; background:rgba(255,255,255,.16) }
.menu a[target="_blank"]::after { content:" \2197"; opacity:.7 }
.who { margin-left:auto; position:relative }
.who summary { display:flex; align-items:center; gap:10px; list-style:none; cursor:pointer; padding:4px 12px 4px 4px; border-radius:999px; color:#fff }
.who summary::-webkit-details-marker { display:none }
.who summary:hover, .who[open] summary { background:rgba(255,255,255,.1) }
.who summary::before { content:attr(data-initial); display:grid; place-items:center; width:30px; height:30px; border-radius:50%; background:var(--accent); color:var(--accent-ink); font-size:13px; font-weight:700 }
.who summary::after { content:""; width:7px; height:7px; margin-left:2px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg) translateY(-2px); opacity:.7 }
.who .drop { position:absolute; right:0; top:calc(100% + 8px); min-width:240px; background:var(--card); border:1px solid var(--line); border-radius:12px; padding:6px; box-shadow:var(--pop-shadow) }
.who .drop a, .who .drop .who-line { display:block; padding:9px 12px; border-radius:8px; text-decoration:none; color:var(--body); font-weight:500 }
.who .drop a:hover { background:var(--soft); color:var(--ink) }
.who .drop .who-line { color:var(--muted); font-size:.85rem; font-weight:400; margin-bottom:4px; padding-bottom:12px; border-bottom:1px solid var(--line); border-radius:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
/* "Working as" strip (super admin inside an agency): amber, so it stands apart from the navy bar */
.acting { background:#fef3c7; color:#78350f; border-bottom:1px solid #fcd34d; font-size:.9rem }
.acting .bar { min-height:40px; gap:12px }
.acting .bar > span::before { content:""; display:inline-block; width:8px; height:8px; margin-right:8px; border-radius:50%; background:#d97706 }
.acting form { margin:0 0 0 auto }
.acting button { margin:0; padding:0 12px; height:28px; border-radius:8px; background:#78350f; color:#fff; font-size:13px }
.acting button:hover { background:#5b2a0c }
@media (prefers-color-scheme: dark) { .acting { background:#33260a; color:#f6dfa0; border-color:#6b5513 } .acting .bar > span::before { background:#f0b35a } .acting button { background:#f6dfa0; color:#33260a } .acting button:hover { background:#fff0c4 } }

/* ---- page ---- */
main { max-width:var(--max); margin:0 auto; padding:32px 24px 64px }
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px 24px; flex-wrap:wrap; margin-bottom:24px }
.page-head h1 { display:flex; align-items:center; gap:12px; margin:0 0 4px; font-size:1.75rem; font-weight:700; letter-spacing:-.02em }
.page-head .muted { margin:0; max-width:64ch; line-height:1.55 }
.count { padding:2px 10px; border-radius:999px; background:var(--accent-soft); color:var(--accent); font-size:13px; font-weight:600; letter-spacing:0 }
.card { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:24px; margin-bottom:20px; box-shadow:var(--shadow) }
.card.narrow, .narrow { max-width:680px }
.card h1 { margin-top:0 }
.card h2 { letter-spacing:-.01em }
.empty { padding:48px 24px; text-align:center; color:var(--muted) }
.empty strong { display:block; margin-bottom:4px; color:var(--ink); font-size:1rem }

/* ---- admin tabs ---- */
.tabs { display:flex; gap:2px; border-bottom:1px solid var(--line); margin:0 0 24px; overflow-x:auto; scrollbar-width:none }
.tabs::-webkit-scrollbar { display:none }
.tabs a { padding:10px 16px; text-decoration:none; color:var(--muted); border-bottom:3px solid transparent; margin-bottom:-1px; font-weight:500; white-space:nowrap }
.tabs a:hover { color:var(--ink) }
.tabs a.on { color:var(--accent); border-bottom-color:var(--accent); font-weight:600 }

/* ---- forms ---- */
label { display:block; margin:14px 0 6px; font-size:.9rem; font-weight:600; color:var(--body) }
input, select, textarea { width:100%; min-height:42px; padding:9px 13px; border:1px solid var(--line); border-radius:10px; background:var(--field); color:var(--ink); font:inherit; transition:border-color .15s, box-shadow .15s, background .15s }
input:hover, select:hover, textarea:hover { border-color:var(--line-strong) }
input:focus, select:focus, textarea:focus { outline:none; background:var(--card); border-color:var(--accent); box-shadow:0 0 0 4px var(--ring) }
input::placeholder, textarea::placeholder { color:var(--muted); opacity:.8 }
input[type=checkbox], input[type=radio] { width:auto; min-height:0; margin-right:8px; accent-color:var(--accent) }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { font-weight:600; display:flex; align-items:flex-start; gap:2px }
button, .btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:40px; margin-top:16px; padding:0 18px; border:1px solid transparent; border-radius:10px; background:var(--accent); color:var(--accent-ink); font:inherit; font-size:.93rem; font-weight:600; cursor:pointer; text-decoration:none; white-space:nowrap; transition:background .15s, border-color .15s, color .15s }
button:hover, .btn:hover { background:var(--accent-hover) }
button:disabled { opacity:.55; cursor:not-allowed }
button.secondary, .btn.secondary { background:var(--card); color:var(--body); border-color:var(--line) }
button.secondary:hover, .btn.secondary:hover { background:var(--soft); border-color:var(--line-strong); color:var(--ink) }
button.danger, .btn.danger { background:var(--bad); color:#fff }
button.secondary.danger, .btn.secondary.danger { background:var(--card); color:var(--body); border-color:var(--line) }
button.secondary.danger:hover, .btn.secondary.danger:hover { background:var(--bad-bg); border-color:var(--bad); color:var(--bad) }
input[type=color] { width:64px; height:42px; padding:3px; cursor:pointer }
.colour-row { display:flex; align-items:center; gap:16px; flex-wrap:wrap }
.colour-row label.inline { margin:0 }
.agency-logo-preview { display:block; max-width:220px; height:auto; background:#fff; border:1px solid var(--line); border-radius:8px; padding:6px }
.phone-form { display:flex; gap:6px; align-items:center }
.phone-form input { width:12em; min-height:34px; padding:4px 10px }
.phone-form button { margin:0; min-height:34px; padding:0 12px }
.stat { display:flex; align-items:baseline; gap:12px; margin:4px 0 12px }
.stat .num { font-size:3rem; font-weight:700; line-height:1; color:var(--ink) }
.stat .what { font-size:1.1rem }
.copyrow { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin:6px 0 }
.copyrow input { flex:1 1 22em; width:auto; min-width:0 }
.copyrow button { margin:0 }
.filters { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end }
.filters > div { flex:0 1 auto }
.filters label { margin:0 0 4px; font-size:.82rem; color:var(--muted); font-weight:600 }
.filters input, .filters select { width:auto; min-width:150px }
.filters input[type=search] { min-width:260px }
.filters button, .filters .btn { margin:0 }

/* ---- tables ---- */
.table-wrap { overflow-x:auto; border-radius:12px }
table { width:100%; border-collapse:collapse }
th, td { padding:14px 16px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top }
thead th { font-size:.74rem; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); white-space:nowrap; background:var(--field); font-weight:600 }
tbody tr:last-child td { border-bottom:0 }
tbody tr:hover { background:var(--row-hover) }
td.actions { white-space:nowrap }
/* A row's secondary actions behind "More": a list that drops down under the button, over the rows below (the table's wrapper must not
   clip it: give it .wrap-visible). On a phone the list opens in place. Closed by Escape or a click elsewhere (nav.js). */
.table-wrap.wrap-visible { overflow:visible }
td.actions .row-more { display:inline-block; vertical-align:top; position:relative }
td.actions .row-more > summary { list-style:none; cursor:pointer; margin:0 }
td.actions .row-more > summary::-webkit-details-marker { display:none }
td.actions .row-more > summary::after { content:" \25BE"; opacity:.7 }
td.actions .row-more[open] > summary::after { content:" \25B4" }
.row-more-list { display:flex; flex-direction:column; align-items:stretch; gap:6px; position:absolute; right:0; top:calc(100% + 6px); z-index:30; min-width:240px; padding:8px; border:1px solid var(--line); border-radius:10px; background:var(--card); box-shadow:0 12px 32px rgba(0,0,0,.28); white-space:nowrap }
.row-more-list form { display:flex; gap:6px; align-items:center; margin:0 }
.row-more-list form:not(.more-row) > button { width:100%; text-align:left; margin:0 }
.row-more-list select { width:auto; flex:1; margin:0 }
@media (max-width:760px) { .row-more-list { position:static; margin-top:8px; box-shadow:none } }
.team-table .badge { white-space:nowrap }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums }
code { padding:2px 6px; border-radius:6px; background:var(--soft); color:var(--body); font-family:ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size:.85em }
.badge { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px; font-size:.78rem; font-weight:600; background:var(--soft); color:var(--muted) }
.badge::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor }
.badge.good { background:var(--good-bg); color:var(--good) }
.badge.warn { background:var(--warn-bg); color:var(--warn) }
.badge.bad { background:var(--bad-bg); color:var(--bad) }

/* ---- pagination ---- */
.pager { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:16px }
.pager a, .pager span { padding:6px 12px; border:1px solid var(--line); border-radius:8px; text-decoration:none; color:var(--body); background:var(--card) }
.pager a:hover { background:var(--soft) }
.pager .on { background:var(--accent); color:var(--accent-ink); border-color:var(--accent) }
.pager .gap { border:0; background:none; color:var(--muted) }
.pager .total { margin-left:auto; border:0; background:none; color:var(--muted) }

/* table cells: dates and references stay on one line; only titles and text wrap */
td code { white-space:nowrap; word-break:normal }
tbody td:first-child { white-space:nowrap }
.admin-body h1 { font-size:1.25rem }
.prepared { display:flex; flex-wrap:wrap; gap:6px 18px; align-items:center; margin:0 0 12px; }
.prepared label { margin:0; }
.prepared input[type=text] { width:240px; max-width:100%; margin:0 0 0 8px; }
.prepared-for { font-size:.82em; font-style:italic; color:var(--muted); margin-top:2px; }

main.narrow { max-width:1200px }
.back { display:inline-flex; align-items:center; gap:6px; margin:0 0 20px; color:var(--muted); font-weight:500; text-decoration:none }
.back:hover { color:var(--accent) }

/* ---- Agency tab: vanity addresses ---- */
.vanity-rows { display:flex; flex-direction:column; gap:10px; margin:12px 0 }
.vanity-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto; gap:10px; align-items:center }
.vanity-row select, .vanity-row input, .vanity-row button { margin:0 }

/* ---- phones ---- */
@media (max-width: 720px) {
    .bar, main { padding-left:16px; padding-right:16px }
    main { padding-top:24px; padding-bottom:48px }
    .page-head h1 { font-size:1.5rem }
    .card { padding:18px }
}
@media (max-width: 640px) {
    .bar { gap:12px }
    .brand small, .who summary span, .who summary::after { display:none }
    .brand-logo { height:30px }
    .who { margin-left:0 }
    .who summary { padding:4px }
    .who .drop { position:fixed; right:12px; left:12px; top:68px; min-width:0 }
    .page-head .btn { width:100% }
}
@media (prefers-reduced-motion: reduce) { * { transition:none !important } }

/* ---- shared components (see /styleguide) ---- */

/* Menu on a phone or small tablet: one button opens a full-width list, so every item is reachable (a sideways-scrolling strip hid most of them). */
.menu-toggle { display:none; margin:0; min-height:40px; width:40px; padding:0; border-radius:10px; background:rgba(255,255,255,.1); border-color:transparent; color:#fff }
.menu-toggle:hover { background:rgba(255,255,255,.18) }
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after { display:block; width:18px; height:2px; border-radius:2px; background:currentColor; content:""; position:relative }
.menu-toggle span::before { position:absolute; top:-6px }
.menu-toggle span::after { position:absolute; top:6px }
@media (max-width: 760px) {
    .bar { flex-wrap:wrap; gap:8px 12px }
    .menu-toggle { display:inline-flex; margin-left:auto; order:2 }
    .who { order:3; margin-left:0 }
    .menu { display:none; order:4; flex:1 0 100%; flex-direction:column; gap:2px; padding:4px 0 12px }
    .topbar.open .menu { display:flex }
    .menu a { padding:12px 14px }
}

/* Buttons: primary (the one main action), secondary, quiet (a text action), danger (never the loudest thing on the page). */
button.quiet, .btn.quiet { background:transparent; color:var(--accent); border-color:transparent; padding:0 10px }
button.quiet:hover, .btn.quiet:hover { background:var(--accent-soft); color:var(--accent-hover) }
button.quiet.danger, .btn.quiet.danger { background:transparent; color:var(--bad) }
button.quiet.danger:hover, .btn.quiet.danger:hover { background:var(--bad-bg) }
button.small, .btn.small { min-height:34px; padding:0 12px; font-size:.86rem; margin-top:0 }
button.block, .btn.block { width:100%; min-height:46px }
/* A finger needs 44 px: every button, link-button and field grows on a touch screen. */
@media (pointer: coarse) {
    button, .btn, select, input:not([type=checkbox]):not([type=radio]):not([type=color]), summary { min-height:44px }
    button.small, .btn.small { min-height:44px }
}

/* Pills: status in words (never colour alone). One vocabulary on every page: neutral, info, good, warn, bad. */
.badge.info { background:var(--accent-soft); color:var(--accent) }
.badge.plain::before { display:none }

/* Cards: a header with a title, a line of help and an action on the right; a quiet variant for secondary blocks. */
.card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:8px 16px; flex-wrap:wrap; margin:0 0 14px }
.card-head h2, .card-head h3 { margin:0 }
.card-head .sub { margin:2px 0 0; color:var(--muted); font-size:.9rem }
.card.quiet { box-shadow:none; background:var(--field) }
.card.tight { padding:18px }
.card-label { margin:0 0 10px; font-size:.78rem; font-weight:700; letter-spacing:.07em; text-transform:uppercase; color:var(--muted) }

/* An inline notice (saved, copied, a warning, a failure); the flash messages use it too. */
.notice { display:flex; gap:10px; align-items:flex-start; margin:0 0 16px; padding:10px 14px; border:1px solid var(--line); border-radius:10px; background:var(--field); color:var(--body) }
.notice.good { background:var(--good-bg); border-color:var(--good); color:var(--good) }
.notice.warn { background:var(--warn-bg); border-color:var(--warn); color:var(--warn) }
.notice.bad { background:var(--bad-bg); border-color:var(--bad); color:var(--bad) }
.notice.info { background:var(--accent-soft); border-color:var(--accent); color:var(--accent) }
/* The beta banner over the Admin pages (in-beta): fixed colours, white on blue to violet (at least 5:1), the same in light and dark. */
.beta-banner { display:flex; align-items:center; gap:12px 14px; margin:0 0 24px; padding:14px 18px; border-radius:12px; background:linear-gradient(100deg, #1a56c9, #5b3cc4); color:#fff; box-shadow:0 6px 20px rgba(26,86,201,.25) }
.beta-banner p { margin:0; line-height:1.5; font-weight:500 }
.beta-pill { flex:none; padding:3px 10px; border-radius:999px; background:#fff; color:#1a56c9; font-size:.72rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase }
@media (max-width:640px) { .beta-banner { align-items:flex-start; flex-direction:column; gap:8px } }

/* Expandable row: a one-line summary that opens to the detail (corrections, advanced settings, long explanations). */
details.expander { border:1px solid var(--line); border-radius:12px; background:var(--card) }
details.expander > summary { display:flex; align-items:center; gap:10px; padding:12px 14px; cursor:pointer; list-style:none; font-weight:600; color:var(--body); border-radius:12px }
details.expander > summary::-webkit-details-marker { display:none }
details.expander > summary::before { content:""; width:7px; height:7px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(-45deg); transition:transform .15s; opacity:.7 }
details.expander[open] > summary::before { transform:rotate(45deg) }
details.expander > summary:hover { background:var(--soft) }
details.expander > .expander-body { padding:4px 14px 14px }
.more-help { margin:0 0 14px; color:var(--muted); font-size:.9rem }
.more-help > summary { cursor:pointer; color:var(--accent); font-weight:500 }
.more-help[open] > summary { margin-bottom:6px }

/* Breadcrumb: where you are, one line, on every inner page. */
.crumbs { display:flex; flex-wrap:wrap; align-items:center; gap:2px 8px; margin:0 0 14px; padding:0; font-size:.88rem; color:var(--muted) }
.crumbs a { color:var(--muted); text-decoration:none; font-weight:500 }
.crumbs a:hover { color:var(--accent); text-decoration:underline }
.crumbs li { list-style:none; display:flex; align-items:center; gap:8px }
.crumbs li + li::before { content:"/"; opacity:.5 }
.crumbs [aria-current] { color:var(--body); font-weight:600 }

/* Form layout: fields in a responsive grid, and a save bar that stays in view. */
.form-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(260px, 1fr)); gap:0 20px }
.form-grid .wide { grid-column:1 / -1 }
.field-help { margin:4px 0 0; color:var(--muted); font-size:.85rem }
.savebar { position:sticky; bottom:0; z-index:5; display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:24px -24px -24px; padding:12px 24px; background:var(--card); border-top:1px solid var(--line); border-radius:0 0 16px 16px; box-shadow:0 -8px 20px -16px rgba(15,23,42,.35) }
.savebar button { margin:0 }
.savebar .state { color:var(--muted); font-size:.9rem }
.savebar .state.dirty { color:var(--warn); font-weight:600 }

/* Checks list on the Details page: the text takes the width, the Dismiss button stays compact at the right whatever the text length */
ul.checks { list-style:none; margin:0; padding:0 }
ul.checks li { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:10px 0; border-top:1px solid var(--line) }
ul.checks li:first-child { border-top:0 }
ul.checks .check-text { flex:1 1 auto; min-width:0; overflow-wrap:anywhere }
ul.checks .check-action { flex:0 0 auto; margin:0 }
ul.checks .check-action button { margin:0; min-height:32px; padding:0 12px; font-size:.85rem; white-space:nowrap }
ul.checks .check-days { display:flex; flex-direction:column; gap:4px; flex:0 0 auto; font-size:.85rem; white-space:nowrap }
ul.checks .check-actions { display:flex; gap:6px; flex:0 0 auto; align-items:flex-start }
ul.checks .check-actions .check-action { flex:0 0 auto }
details.add-block { margin:8px 0; padding:10px 14px; border:1px solid var(--line); border-radius:10px }
details.add-block > summary { cursor:pointer; font-weight:600 }
details.add-block form { margin-top:10px }
details.add-block label { display:block; margin:8px 0 4px; font-weight:500 }

/* Admin pages: grouped cards in two columns, an intro, and a brand preview. */
.page-intro { margin:0 0 18px; max-width:78ch }
.page-intro h1 { margin:0 0 6px; font-size:1.4rem }
.cards-2 { column-width:360px; column-gap:18px }
.cards-2 > .card { margin:0 0 18px; break-inside:avoid; display:inline-block; width:100% }
.cards-2 > .card.wide { column-span:all; display:block }
.card h2 { font-size:1.05rem }
.card label:not(.inline) { margin-top:12px }
.card .card-head + label:not(.inline), .card .card-head + p + label:not(.inline) { margin-top:0 }
.savebar.free { margin:16px 0 0; border:1px solid var(--line); border-radius:12px; bottom:12px }
.brand-preview { --bp:var(--accent); display:flex; align-items:center; gap:12px; padding:14px; margin:0 0 6px; border-radius:12px; background:linear-gradient(135deg, #1e293b, #0f172a); color:#fff }
.brand-preview .bp-tile { flex:none; width:44px; height:44px; display:grid; place-items:center; border-radius:10px; background:var(--bp); color:#fff; font-weight:800; font-family:var(--display, var(--font)) }
.brand-preview img { flex:none; max-height:44px; max-width:150px; background:#fff; border-radius:8px; padding:4px }
.brand-preview.wordmark img { max-width:220px; max-height:48px }
.brand-preview .bp-text { display:flex; flex-direction:column; min-width:0 }
.brand-preview .bp-text small { color:rgba(255, 255, 255, .75) }
.brand-preview.wordmark .bp-text { display:none }
.brand-preview [hidden] { display:none }
[hidden] { display:none !important }
#addMember .form-grid { grid-template-columns:repeat(auto-fit, minmax(380px, 1fr)); gap:0 24px; margin-bottom:12px }

/* A row of equal cards (AI provider keys): flex, not grid, so a helper element a browser extension injects cannot take a cell. */
.cards-row { display:flex; flex-wrap:wrap; gap:18px; align-items:stretch }
.cards-row > .card { flex:1 1 340px; max-width:calc(33.34% - 12px); margin:0; display:flex; flex-direction:column }
.cards-row > .card form:last-of-type { margin-top:auto }
@media (max-width:1100px) { .cards-row > .card { max-width:none } }

/* A panel that opens and closes: a title and a one-line description always show; the detail waits behind it. */
details.panel-toggle { padding:0 }
details.panel-toggle > summary { display:flex; align-items:flex-start; gap:12px; padding:18px 24px; cursor:pointer; list-style:none; border-radius:16px }
details.panel-toggle > summary::-webkit-details-marker { display:none }
details.panel-toggle > summary::before { content:""; flex:none; margin-top:9px; width:8px; height:8px; border-right:2px solid var(--muted); border-bottom:2px solid var(--muted); transform:rotate(-45deg); transition:transform .15s }
details.panel-toggle[open] > summary::before { transform:rotate(45deg) }
details.panel-toggle > summary:hover { background:var(--soft) }
details.panel-toggle .pt-title h2 { margin:0 }
details.panel-toggle .pt-title .sub { display:block; margin:2px 0 0; color:var(--muted); font-size:.9rem; font-weight:400 }
details.panel-toggle > .pt-body { padding:14px 24px 22px; border-top:1px solid var(--line) }
details.panel-toggle[open] > summary { border-bottom-left-radius:0; border-bottom-right-radius:0 }
.seats { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; margin:0 0 14px }
.seats .badge b { margin:0 2px }
.presets { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 0 }
.plain-list { margin:0 0 12px; padding-left:18px; display:grid; gap:8px }
.usage table { width:100%; border-collapse:collapse; margin:8px 0 }
.usage th, .usage td { padding:6px 8px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top }
.usage td.n, .usage th.n { text-align:right; white-space:nowrap }
.usage .scroll { overflow-x:auto }
.usage .tiles { display:flex; flex-wrap:wrap; gap:12px; margin:12px 0 }
.usage .tile { display:block; flex:1 1 140px; border:1px solid var(--line); border-radius:10px; padding:10px 12px; margin:0 }
.usage .tile strong { display:block; font-size:1.3em }
.usage .tile-cost { flex:2 1 260px; border-color:var(--accent); background:var(--accent-soft) }
.usage .tile-cost strong { font-size:2rem }
.usage .monthnav { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin:6px 0 }
.usage .monthnav .disabled { opacity:.5; pointer-events:none }
.usage .monthjump { display:flex; align-items:center; gap:6px; margin-left:auto }
.usage .small-h { font-size:1rem; margin:14px 0 6px }
.usage .history { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:8px }
.usage .history a { display:grid; gap:4px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; text-decoration:none; color:var(--ink) }
.usage .history .current a { border-color:var(--accent) }
.usage .history meter { width:100%; height:10px }
.usage td.share { min-width:120px }
.usage td.share meter { width:70px; height:10px; vertical-align:middle }
.usage tr.costly td { background:var(--warn-bg) }
.usage .inline-label { display:inline; margin-right:8px }
.usage .rate-select { padding:8px; border:1px solid var(--line); border-radius:6px; background:var(--bg); color:var(--ink); font:inherit }
.usage .rate-in { width:6.5em; text-align:right }
.usage form.rates label { margin:0 0 4px; font-weight:400; font-size:.9em }
/* Agency page: one ordered column of cards, with a sticky preview and section list beside it. */
.agency-layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:18px; align-items:start }
.agency-main { display:flex; flex-direction:column; gap:18px; min-width:0 }
.agency-main > .card { margin:0 }
.agency-sticky { position:sticky; top:16px; margin:0 }
.agency-sticky h2 { margin:0 0 10px }
.agency-side .brand-preview { margin:0 0 6px }
.sub-h { font-size:.9rem; margin:16px 0 6px; color:var(--muted); font-weight:600 }
.jump { display:flex; flex-direction:column; gap:2px }
.jump a { padding:6px 8px; border-radius:8px; text-decoration:none }
.jump a:hover { background:var(--soft) }
.opt { margin-left:6px; font-size:.75rem; font-weight:500; color:var(--muted) }
.colour-row input.hex { width:7.5em; margin:0; font-family:monospace }
.colour-row input:disabled { opacity:.45 }
.field-error { color:var(--bad); font-size:.85rem; margin:4px 0 0 }
.field-error-text { color:var(--bad) }
.vanity-row .field-error { grid-column:1 / -1; margin:0 }
@media (max-width:1000px) {
    .agency-layout { grid-template-columns:1fr }
    .agency-side { order:-1 }
    .agency-sticky { position:static }
}
/* Builds page */
.builds table { width:100%; border-collapse:collapse }
.builds th, .builds td { padding:8px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top }
.builds tr.why td { border-bottom:1px solid var(--line); padding-top:0 }
.builds tr.why .notice { margin:0 0 8px }
.builds tr.failed td { border-bottom-color:transparent }
.builds td.actions { white-space:nowrap; text-align:right }
.builds .inline-form { display:inline; margin:0 }
.builds progress { width:120px; height:8px }
.build-filters { display:flex; gap:6px; margin:8px 0 12px }
.build-filters a { padding:5px 12px; border:1px solid var(--line); border-radius:999px; text-decoration:none; color:var(--muted); font-size:.9rem }
.build-filters a.on { background:var(--accent-soft); color:var(--accent); border-color:var(--accent) }
.count-badge { display:inline-block; min-width:1.4em; padding:0 6px; margin-left:4px; border-radius:999px; background:var(--bad); color:#fff; font-size:.72rem; font-weight:700; line-height:1.5; text-align:center }
.builds tr.dismissed td { opacity:.65 }
.builds .dismiss-all { margin:0 0 6px }
.keyline { margin:6px 0 }
.key-actions { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0 }
.key-actions form { margin:0 }
.key-new { margin-top:auto; padding-top:12px }
@media (max-width:760px) {
    .builds .table-wrap { overflow:visible }
    .builds table, .builds tbody { display:block }
    .builds thead { display:none }
    .builds tr.job { display:grid; grid-template-columns:1fr; gap:2px; padding:10px 0; border-bottom:1px solid var(--line) }
    .builds tr.job td { display:grid; grid-template-columns:5.5em 1fr; gap:8px; border:0; padding:2px 0 }
    .builds tr.job td::before { content:attr(data-label); color:var(--muted); font-size:.8rem }
    .builds tr.job td.actions { display:flex; justify-content:flex-start; gap:8px; padding-top:6px }
    .builds tr.job td.actions::before { content:none }
    .builds tr.why { display:block }
    .builds tr.why td { display:block; padding:0 0 8px; border:0 }
}
@media (max-width:760px) {
    table.stack, table.stack tbody { display:block }
    table.stack thead { display:none }
    table.stack tr { display:grid; grid-template-columns:1fr; gap:2px; padding:10px 0; border-bottom:1px solid var(--line) }
    table.stack td { display:grid; grid-template-columns:6.5em 1fr; gap:8px; border:0; padding:2px 0; text-align:left }
    table.stack td::before { content:attr(data-label); color:var(--muted); font-size:.8rem }
    table.stack td.actions { display:flex; flex-wrap:wrap; justify-content:flex-start; gap:8px; padding-top:6px }
    table.stack td.actions::before { content:none }
    table.stack .phone-form { flex-wrap:wrap }
}
