:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #6b7385;
  --side-ink: var(--text); /* left menu text */
  --line: #e3e6ec;
  --brand: #1f5fbf;
  --brand-ink: #ffffff;
  --brand-soft: #e8f0fc;
  --danger: #c0392b;
  --ok-bg: #e7f6ec; --ok-ink: #1e6b3a;
  --err-bg: #fdecea; --err-ink: #9b2c1f;
  --warn-bg: #fff1e0; --warn-ink: #9a4a00;
  --top: #172033; --top-ink: #d9deea;
  --radius: 10px; /* cards and buttons */
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
/* Dark theme: follows the device unless the header switch picks Light or Dark (html[data-theme]). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c; --card: #1b2029; --text: #e5e8ef; --muted: #98a0b3; --line: #2c3340;
    --brand: #5b8fe6; --brand-soft: #1f2c44; --ok-bg: #173323; --ok-ink: #8fd6a7; --err-bg: #3a1c19; --err-ink: #f2a59b; --warn-bg: #3a2812; --warn-ink: #f5bb73;
    --top: #0c0f15; --top-ink: #c6cbd8; --shadow: none; --side-ink: #ffffff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #12151c; --card: #1b2029; --text: #e5e8ef; --muted: #98a0b3; --line: #2c3340;
    --brand: #5b8fe6; --brand-soft: #1f2c44; --ok-bg: #173323; --ok-ink: #8fd6a7; --err-bg: #3a1c19; --err-ink: #f2a59b; --warn-bg: #3a2812; --warn-ink: #f5bb73;
    --top: #0c0f15; --top-ink: #c6cbd8; --shadow: none; --side-ink: #ffffff;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .2rem; font-weight: 650; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 650; display: flex; align-items: baseline; gap: .5rem; }
h2 .small { margin-left: auto; font-weight: 400; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.prewrap { white-space: pre-wrap; }
.count { font-size: 1rem; font-weight: 600; color: #fff; background: var(--brand); border: 1px solid var(--brand); border-radius: 99px; padding: .05rem .65rem; min-width: 1.9rem; text-align: center; }
.overdue, h2.overdue { color: var(--danger); }

/* Left menu (sidebar) with a slim top bar for the group, theme and account. The sidebar collapses to
   icons (html[data-nav=collapsed], remembered per browser); on phones and tablets it slides in from
   the burger button. */
:root { --side-w: 196px; }
html[data-nav=collapsed] { --side-w: 56px; }
body.has-side .topbar, body.has-side .page { margin-left: var(--side-w); }
.sidenav { position: fixed; top: 0; bottom: 0; left: 0; z-index: 12; width: var(--side-w); display: flex; flex-direction: column; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
/* The logo is white on transparent, so it sits on a dark tile in both themes. */
.brand-logo { width: 32px; height: 32px; padding: 4px; border-radius: 8px; background: #1c2430; object-fit: contain; flex: 0 0 auto; }
.side-brand { padding: .75rem .85rem; min-height: 56px; border-bottom: 1px solid var(--line); }
.sidelinks { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .55rem; flex: 1; }
.sidelinks a { display: flex; align-items: center; gap: .6rem; padding: .45rem .55rem; border-radius: 8px; color: var(--side-ink); font-weight: 500; white-space: nowrap; position: relative; }
.sidelinks a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.sidelinks a.active { background: var(--brand-soft); color: var(--brand); }
.sidelinks .navcount { margin-left: auto; }
.navcount.late { background: var(--danger); color: #fff; }
.navicon { flex: 0 0 auto; }
.sidegroup { margin: .8rem .6rem .25rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--side-ink); opacity: .7; white-space: nowrap; }
.side-collapse { display: flex; align-items: center; gap: .7rem; margin: .5rem .55rem .75rem; padding: .5rem .6rem; border: 0; border-radius: 8px; background: none; color: var(--side-ink); font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.side-collapse:hover { background: var(--bg); color: var(--text); }
html[data-nav=collapsed] .side-label { display: none; }
html[data-nav=collapsed] .sidegroup { height: 1px; margin: .55rem .6rem; background: var(--line); }
html[data-nav=collapsed] .side-collapse .navicon { transform: rotate(180deg); }
html[data-nav=collapsed] .side-brand { padding: .75rem 0; justify-content: center; }
html[data-nav=collapsed] .sidelinks a, html[data-nav=collapsed] .side-collapse { justify-content: center; padding: .55rem 0; }
/* Collapsed: the new-leads count becomes a small badge on the icon */
html[data-nav=collapsed] .sidelinks .navcount { position: absolute; top: 2px; right: 6px; margin: 0; min-width: 1rem; padding: 0 .25rem; font-size: .65rem; line-height: 1rem; }

.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { padding: 0 1.25rem; display: flex; align-items: center; justify-content: flex-end; gap: 1rem; min-height: 56px; }
.top-brand { display: none; }
/* Event picker: every page's event filter (the member's default event) */
.topevent { margin: 0 auto 0 0; }
.topevent select { width: auto; max-width: 340px; padding: .35rem .6rem; font-size: .92rem; }
.usermenu { display: flex; align-items: center; gap: .5rem; }
.usermenu > a { padding: .4rem .7rem; border-radius: 8px; color: var(--muted); font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu > a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.usermenu > a.active { background: var(--brand-soft); color: var(--brand); }
.usermenu form { margin: 0; }
.usermenu.in-side { display: none; }
.groupswitch select { max-width: 220px; padding: .3rem .5rem; font-size: .9rem; text-overflow: ellipsis; }
.groupname { font-weight: 600; color: var(--muted); white-space: nowrap; }
.theme-switch { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .65rem; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--muted); font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.theme-switch:hover { color: var(--text); background: var(--bg); }
.theme-switch span[aria-hidden] { font-size: 1rem; line-height: 1; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg); border-color: transparent; }
.burger { display: none; width: 44px; height: 44px; border: 0; background: none; border-radius: 8px; cursor: pointer; padding: 10px; flex-direction: column; justify-content: space-between; }
.burger span { display: block; height: 2px; border-radius: 2px; background: var(--text); transition: transform .2s, opacity .2s; }
.burger[aria-expanded=true] span:nth-child(1) { transform: translateY(10px) rotate(45deg); }
.burger[aria-expanded=true] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded=true] span:nth-child(3) { transform: translateY(-10px) rotate(-45deg); }
.nav-backdrop { display: none; }
/* Phones and tablets: the sidebar is a drawer (always with labels); the top bar keeps the burger and logo */
@media (max-width: 900px) {
  body.has-side .topbar, body.has-side .page { margin-left: 0; }
  .sidenav { width: 280px; max-width: 85vw; transform: translateX(-100%); transition: transform .2s; z-index: 30; }
  .sidenav.open { transform: none; box-shadow: 0 12px 40px rgb(0 0 0 / 25%); }
  html[data-nav=collapsed] .side-label { display: inline; }
  html[data-nav=collapsed] .sidegroup { height: auto; margin: .8rem .6rem .25rem; background: none; }
  html[data-nav=collapsed] .side-brand { padding: .75rem 1rem; justify-content: flex-start; }
  html[data-nav=collapsed] .sidelinks a { justify-content: flex-start; padding: .7rem .6rem; }
  html[data-nav=collapsed] .sidelinks .navcount { position: static; margin-left: auto; min-width: 1.25rem; padding: 0 .35rem; font-size: .75rem; line-height: 1.25rem; }
  .sidelinks a { padding: .7rem .6rem; font-size: 1.02rem; }
  .side-collapse { display: none; }
  .burger { display: flex; }
  .top-brand { display: inline-flex; margin-right: auto; }
  .topbar-inner { justify-content: flex-start; }
  .usermenu.in-top { display: none; }
  .topbar-inner { flex-wrap: wrap; row-gap: .25rem; }
  .topevent { order: 3; flex: 1 0 100%; margin: 0 0 .5rem; }
  .topevent select { width: 100%; max-width: none; }
  .usermenu.in-side { display: flex; flex-direction: column; align-items: stretch; gap: .25rem; border-top: 1px solid var(--line); padding: .5rem .55rem 1rem; }
  .usermenu.in-side > a { max-width: none; padding: .7rem .6rem; }
  .usermenu.in-side .groupswitch select { max-width: none; width: 100%; padding: .6rem .7rem; font-size: 1rem; }
  .usermenu.in-side .groupname { padding: .4rem .6rem; }
  .usermenu.in-side .theme-switch { align-self: flex-start; margin: .25rem .6rem; }
  .usermenu.in-side .btn.small { width: 100%; justify-content: flex-start; padding: .7rem .6rem; font-size: 1.02rem; color: var(--danger); }
  .nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 25; background: rgb(10 15 25 / 30%); }
}
@media print { .sidenav, .topbar { display: none !important; } body.has-side .page { margin-left: 0; } }

.page { margin: 0 auto; padding: 1.25rem; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.crumb { font-size: .88rem; margin-bottom: .15rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow-x: auto; }
.card .pad { padding: 1rem 1.15rem 0; }
.card.narrow { max-width: 440px; margin: 3rem auto; }
.login h1 { justify-content: center; margin-bottom: 1rem; }
.twocol { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; }
.twocol > div > .card:last-child { margin-bottom: 1rem; }
@media (max-width: 900px) { .twocol { grid-template-columns: 1fr; } }

.btn { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: .45rem .85rem; border-radius: var(--radius); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--danger); }
.btn.on { background: var(--brand-soft); border-color: var(--brand); }
.btn.small { padding: .2rem .55rem; font-size: .88rem; }
.btnrow { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.btnrow form { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.linkbtn.danger { color: var(--danger); }

input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .45rem .6rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[disabled] { background: var(--bg); }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.stack label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
/* Sized so the deals filters (search, event, stage, billing, currency, owner) fit one row at laptop widths */
.filters input[type=search] { flex: 1 1 160px; width: auto; min-width: 120px; }
.filters .daterange { display: inline-flex; align-items: center; gap: .35rem; }
.filters .daterange input { width: auto; }
.filters .daterange select { width: auto; max-width: none; flex: 0 0 auto; }
.filters select, .filters .ref { width: auto; min-width: 0; flex: 0 1 140px; padding-right: 1.4rem; text-overflow: ellipsis; }
.filters .eventselect { flex: 0 1 230px; }
.filters .ref { flex: 0 1 190px; padding-right: 0; }
.filters .btn { padding: .45rem .7rem; }
/* Laptop and wider: keep one row and let the controls shrink instead of wrapping */
@media (min-width: 1100px) {
  .filters { flex-wrap: nowrap; }
  .filters input[type=search] { min-width: 100px; }
  .filters > * { flex-shrink: 1; }
  .filters .btn, .filters > a { flex-shrink: 0; }
}

.recordform fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
.recordform legend { font-weight: 650; margin-bottom: .6rem; color: var(--muted); text-transform: uppercase; font-size: .78rem; letter-spacing: .04em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem 1rem; }
.field { display: flex; flex-direction: column; gap: .25rem; }
.field > span { font-weight: 500; font-size: .92rem; }
.field.wide { grid-column: 1 / -1; }
.field.rowstart { grid-column-start: 1; } /* starts a new row in the form */
.region { display: block; }
.region select, .region input { width: 100%; }
.field.check, label.check { flex-direction: row; align-items: center; gap: .4rem; }
.field.check input, label.check input { width: auto; }
.actions { display: flex; gap: .5rem; border-top: 1px solid var(--line); padding-top: 1rem; }

.ref { position: relative; }
.ref-menu { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; min-width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 320px; overflow-y: auto; }
.ref-item { padding: .45rem .65rem; cursor: pointer; }
.ref-item.on, .ref-item:hover { background: var(--brand-soft); }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
table.data th a { color: inherit; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
table.data .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data .empty { color: var(--muted); text-align: center; padding: 1.5rem; }
table.data.compact td { padding: .35rem .5rem; }
table.data tr.done td { color: var(--muted); }
table.data tr.done td a { color: var(--muted); text-decoration: line-through; }
table.data tr.inactive td { color: var(--danger); }
.scorebadge { display: inline-flex; align-items: baseline; gap: .3rem; margin-left: .4rem; padding: .1rem .55rem; border-radius: 999px; background: var(--brand); color: #fff; font-size: .95rem; font-weight: 700; vertical-align: middle; font-variant-numeric: tabular-nums; }
.scorebadge small { font-size: .7rem; font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: .03em; }
.score { font-weight: 600; font-variant-numeric: tabular-nums; }
/* Admin tables edited in place (products, lookup lists): one input per cell so columns line up with the header */
table.rowedit td { vertical-align: middle; }
table.rowedit td input:not([type=checkbox]) { width: 100%; min-width: 0; }
table.rowedit input.num { text-align: right; }
table.rowedit th.c-code { width: 9rem; }
table.rowedit th.c-type { width: 12rem; }
table.rowedit th.c-price { width: 8rem; }
table.rowedit th.c-sort { width: 6rem; }
table.rowedit td.btncell { width: 1%; white-space: nowrap; }
table.rowedit td.btncell form { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.score[data-zero="1"] { color: var(--muted); font-weight: 400; }
table.data tfoot td { border-bottom: 0; }
table.data tr.strong td { font-weight: 700; }
td.check { width: 34px; }
td.check form { margin: 0; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; color: transparent; cursor: pointer; font-size: 12px; line-height: 1; padding: 0; }
.tick:hover { border-color: var(--brand); color: var(--brand); }
.tick.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 520px; }
.lines.edit textarea { min-height: 2.3rem; resize: vertical; }
.lines.edit input { text-align: right; max-width: 120px; min-width: 64px; }
.lines.edit input.price { min-width: 96px; }
.lines.edit textarea { min-width: 140px; }
.lines.edit select { min-width: 200px; }
.recordform:has(.lines.edit) { overflow-x: auto; }
.lines.edit td:first-child { min-width: 280px; }
@media (min-width: 760.02px) {
  /* Number boxes sit under their right-aligned headings; text lines up with the boxes */
  .lines.edit td > input { display: block; margin-left: auto; }
  .lines.edit tbody td { vertical-align: middle; }
}

.logo-upload { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.logo-preview { width: 240px; height: 96px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.logo-preview img { max-width: 100%; max-height: 100%; }
.logo-upload .stack { flex: 1 1 240px; }
.sigimg { max-width: 100%; max-height: 90px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
code.wrapall { word-break: break-all; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .05rem .5rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill[data-v="Closed Won"], .pill[data-v="Invoiced Full"], .pill[data-v="Paid"], .pill[data-v="Paid In Full"], .pill[data-v="Active"], .pill[data-v="Completed"], .pill[data-v="Signed"] { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.pill[data-v="Closed Lost"], .pill[data-v="Not Invoiced"], .pill[data-v="Void"], .pill[data-v="Overdue"], .pill[data-v="Deleted"], .pill[data-v="High"] { background: var(--err-bg); color: var(--err-ink); border-color: transparent; }
.pill[data-v="Sent"], .pill[data-v="Partial"], .pill[data-v="Part paid"], .pill[data-v="Paid Partial"], .pill[data-v="In Negotiation"], .pill[data-v="Contract Sent"], .pill[data-v="Open"] { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

dl.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem 1.25rem; margin: 0 0 1rem; }
dl.fields .wide { grid-column: 1 / -1; }
dl.fields dt { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
dl.fields dd { margin: .1rem 0 0; word-break: break-word; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; }
.stat span { font-size: .8rem; color: var(--muted); }
a.statlink { color: var(--text); }
a.statlink:hover { border-color: var(--brand); text-decoration: none; }
.stat strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stagebar { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--line); border-radius: 6px; padding: .35rem .65rem; color: var(--text); display: flex; flex-direction: column; }
.chip small { color: var(--muted); }
.chip.on { border-color: var(--brand); background: var(--brand-soft); }

/* Horizontal bar chart: single series, 20px bars, 4px rounded data end, value at the tip */
.chartcard .charthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.chartcard .charthead h2 { margin-bottom: .1rem; }
.chartcard .charthead p { margin: 0; }
.chartfilters { display: flex; gap: .5rem; flex-wrap: wrap; }
.chartfilters select { width: auto; }
.eventselect { max-width: 320px; }
/* The event picker stands out: it drives the dashboard and the lists */
select.eventselect { background-color: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
select.eventselect option { background: var(--card); color: var(--text); font-weight: 400; }
.pill[data-v="Invoiced Partial"] { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.tablewrap { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.yoy .yoy-prev { border-left: 1px solid var(--line); }
.yoy tr.past td { color: var(--muted); }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta[data-sign="1"] { color: var(--ok-ink); }
.delta[data-sign="-1"] { color: var(--err-ink); }
.delta[data-sign="0"] { color: var(--muted); font-weight: 400; }
.chartpair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.chartpair > .card { margin-bottom: 1rem; }
@media (max-width: 900px) { .chartpair { grid-template-columns: 1fr; } }
.notes-body { white-space: pre-wrap; margin: 0; }
/* Series colours (validated: blue / orange / aqua, stepped for dark mode); "no currency" is neutral */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-none: #9aa1ad; --series-ref: #4a5060; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-none: #6b7280; --series-ref: #98a0b3; } }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-none: #6b7280; --series-ref: #98a0b3; }
[data-slot="1"] { --bar: var(--series-1); }
[data-slot="2"] { --bar: var(--series-2); }
[data-slot="3"] { --bar: var(--series-3); }
[data-slot="none"] { --bar: var(--series-none); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: 0 0 .6rem; padding: 0; font-size: .88rem; align-items: center; }
.legend li { display: flex; align-items: center; gap: .35rem; }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--bar); display: inline-block; }
.hbars { list-style: none; margin: 0; padding: 0; }
.hgroup { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; align-items: center; gap: .75rem; padding: 5px 0; border-bottom: 1px solid var(--line); }
.hgroup:last-child { border-bottom: 0; }
.hbar-label { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); padding: 2px 6px; border-radius: 6px; }
.hbar-label:hover { background: var(--brand-soft); text-decoration: none; }
.hbar-bars { display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
.hbar { display: flex; align-items: center; gap: .5rem; min-height: 22px; padding-right: 6px; border-radius: 0 6px 6px 0; color: var(--text); }
.hbar:hover, .hbar:focus-visible { background: var(--brand-soft); text-decoration: none; }
.hbar:hover .hbar-fill, .hbar:focus-visible .hbar-fill { filter: brightness(1.12); }
.hbar-fill { display: block; height: 16px; width: 0; flex: none; background: var(--bar, var(--brand)); border-radius: 0 4px 4px 0; }
.hbar-value { font-size: .85rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-value .muted { font-weight: 400; }
/* Closed Won target: a marker line across the bar and how much of it is reached */
.hbar-hastarget { position: relative; }
/* Short of the target: the rest of the way filled grey, continuing the bar up to the target */
.hbar-rest { display: block; flex: none; height: 16px; width: 0; margin-left: -.5rem; background: var(--series-none); opacity: .45; border-radius: 0 4px 4px 0; }
.hbar-fill:has(+ .hbar-rest) { border-radius: 0; }
/* Past it: a line across the bar where the target is */
.hbar-target { position: absolute; top: 3px; height: 16px; width: 0; border-left: 2px solid var(--bg); pointer-events: none; }
.hbar-hastarget .hbar-value { white-space: normal; min-width: 0; line-height: 1.25; }
.hbar-goal { display: block; font-weight: 400; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.hbar-goal.met { color: #2f8f5b; font-weight: 600; }
.defaultrow { display: inline-flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-right: .5rem; }
@media (max-width: 600px) { .hgroup { grid-template-columns: 1fr; gap: .2rem; } .hbar-bars { border-left: 0; } }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash.error { background: var(--err-bg); color: var(--err-ink); }
.twofa .steps { padding-left: 1.2rem; margin: .5rem 0; }
.twofa .steps li { margin: .25rem 0; }
.qr-box { display: flex; justify-content: center; margin: .75rem 0; }
.qr-box img { background: #fff; padding: 8px; border-radius: 8px; }
.center { text-align: center; }
.setupkey { font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.codeinput { font-size: 1.4rem; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }
.recovery-codes { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.recovery-codes code { font-size: 1.05rem; letter-spacing: .05em; }
.visually-hidden { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.copyrow { display: flex; gap: .5rem; margin-top: .5rem; }

.pager { display: flex; gap: .75rem; align-items: center; justify-content: center; margin: 1rem 0; }
.subnav { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subnav a { padding: .5rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; }
.subnav a.on { color: var(--text); border-color: var(--brand); }
form.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0; }
form.inline input { width: auto; flex: 1 1 160px; }
form.inline input.short, input.short { flex: 0 0 80px; width: 80px; }
form.inline select { width: auto; }
.addrow { margin-top: 1rem; }
.eventpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .3rem 1rem; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: .6rem; margin: .5rem 0; }
.eventpick label { font-weight: 400; }
.emailpreview { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: 6px; background: #f5f6f8; }
.inline-radio { display: inline-flex; margin-right: 1rem; font-weight: 400; }
details summary { cursor: pointer; margin: .75rem 0 .25rem; color: var(--brand); }
input[type=color] { padding: 2px; height: 2.3rem; }
form.inline input.mid { flex: 0 1 180px; width: 180px; }
.productrow input[name=name] { flex: 1 1 220px; }
.lookuplayout { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; }
.listnav { display: flex; flex-direction: column; padding: .5rem; }
.listnav a { padding: .4rem .6rem; border-radius: 6px; color: var(--text); display: flex; justify-content: space-between; }
.listnav a.on { background: var(--brand-soft); }
@media (max-width: 760px) {
  .lookuplayout { grid-template-columns: 1fr; }
  .page { padding: 1rem; }
  h1 { font-size: 1.35rem; }


  .pagehead { flex-direction: column; align-items: stretch; }
  .pagehead > .btn { align-self: flex-start; }
  .pagehead .btnrow { justify-content: flex-start; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
  .filters > * { width: 100%; max-width: none; min-width: 0; }
  .filters input[type=search], .filters .eventselect, .filters .ref { grid-column: 1 / -1; }
  .filters > a { align-self: center; justify-self: start; width: auto; }
  .filters select { padding: .4rem .5rem; font-size: .9rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat strong { font-size: 1.1rem; }

  /* Tables become stacked cards */
  table.data.stacked thead { display: none; }
  table.data.stacked, table.data.stacked tbody, table.data.stacked tfoot { display: block; width: 100%; }
  table.data.stacked tr { display: block; padding: .6rem .9rem; border-bottom: 1px solid var(--line); }
  table.data.stacked td { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; border: 0; padding: .12rem 0; text-align: right; }
  table.data.stacked td > * { min-width: 0; max-width: 100%; }
  table.data.stacked td form.inline select { width: 100%; }
  table.data.stacked td::before { content: attr(data-label); flex: 0 1 auto; max-width: 45%; overflow-wrap: anywhere; text-align: left; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
  table.data.stacked td[data-label=""]::before { display: none; }
  table.data.stacked td.blank { display: none; }
  table.data.stacked td.primary { display: block; text-align: left; font-weight: 600; font-size: 1rem; padding-bottom: .25rem; }
  table.data.stacked td.primary::before { display: none; }
  table.data.stacked td.empty { display: block; text-align: center; }
  table.data.stacked td.empty::before { display: none; }
  table.data.stacked td.check { display: inline-block; width: auto; padding-right: .5rem; }
  table.data.stacked td.check::before { display: none; }
  table.data.stacked .clamp { max-width: none; }
  table.data.stacked tfoot tr { display: flex; justify-content: space-between; padding: .3rem .9rem; border: 0; }
  table.data.stacked tfoot td { display: block; padding: 0; }
  table.data.stacked tfoot td::before { display: none; }
  table.data.stacked tfoot td:empty { display: none; }

  /* Line editors (invoices, deal products): one stacked card per line */
  .lines.edit td { flex-wrap: wrap; }
  .lines.edit td:first-child { min-width: 0; }
  table.data.stacked tfoot td { min-width: 0; }
  .lines.edit td > input, .lines.edit td > select, .lines.edit td > textarea { flex: 1 1 60%; max-width: none; min-width: 0; text-align: left; }
  .lines.edit tbody tr { position: relative; padding-right: 2.2rem; }
  .lines.edit tbody td:last-child { position: absolute; top: .6rem; right: .6rem; }
  .lines.edit tbody td:last-child::before { display: none; }
  .recordform:has(.lines.edit) { overflow-x: visible; }

  .hgroup { grid-template-columns: 1fr; }
  .chartfilters, .chartfilters select, .eventselect { width: 100%; max-width: none; }
  .copyrow { flex-wrap: wrap; }
  .copyrow input { flex: 1 1 100%; }
  .emailpreview { height: 380px; }
}

/* Company category tags and logos */
.tag { display: inline-block; font-size: .78rem; padding: 0 .45rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; margin: 1px 0; }
.tagpick { display: flex; flex-wrap: wrap; gap: .3rem 1rem; padding: .35rem 0; }
.tagpick .check { font-weight: 400; }
a.withlogo { display: inline-flex; align-items: center; gap: .45rem; }
.colog { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; background: #fff; border: 1px solid var(--line); flex: none; }
.cologo-lg { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--line); padding: 3px; }
/* Assistant chat: same look as the inventory app (pill button bottom right; the panel opens in its place) */
/* Assistant button in the top bar: a purple → blue → green gradient border */
.ask-btn { flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .38rem .95rem; font: inherit; font-size: .92rem; font-weight: 600; color: var(--text); cursor: pointer; border-radius: 6px; margin-right: auto;
  border: 2px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(90deg, #7c3aed, #2563eb, #10b981) border-box;
  box-shadow: 0 2px 10px rgb(99 102 241 / 25%); transition: box-shadow .15s, transform .15s; }
.ask-btn:hover, .ask-btn.on { box-shadow: 0 3px 16px rgb(37 99 235 / 40%); transform: translateY(-1px); }
.ask-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
@media (max-width: 900px) { .ask-btn { margin: 0 0 0 auto; } } /* phones: the event picker gets its own row; the button stays top right */
.topevent:has(+ .ask-btn) { margin-right: 0; } /* the button sits just right of the event picker */
.chat-panel { position: fixed; right: 16px; top: 64px; z-index: 40; width: 400px; max-width: calc(100vw - 32px); height: min(640px, calc(100vh - 80px)); display: flex; flex-direction: column; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 50px rgb(0 0 0 / 30%); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .75rem .6rem 1rem; border-bottom: 1px solid var(--line); }
.chat-head-actions { display: flex; align-items: center; gap: .25rem; }
.chat-head-actions [hidden] { display: none; }
.icon-btn { border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 .25rem; }
.chat-body { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .6rem; }
.chat-intro p { margin: 0 0 .6rem; color: var(--muted); }
.chat-example { display: block; width: 100%; text-align: left; margin-bottom: .4rem; padding: .55rem .75rem; font: inherit; cursor: pointer; background: var(--brand-soft); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); }
.chat-example:hover { border-color: var(--brand); }
.chat-msg { max-width: 88%; padding: .55rem .8rem; border-radius: 12px; overflow-wrap: anywhere; line-height: 1.4; }
.chat-msg.user { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-msg.assistant { align-self: flex-start; background: var(--bg); border-bottom-left-radius: 4px; }
.chat-msg.typing { color: var(--muted); font-style: italic; }
.chat-msg.error { align-self: stretch; max-width: none; background: var(--err-bg); color: var(--err-ink); }
.chat-msg p { margin: 0 0 .4rem; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul { margin: .2rem 0 .4rem; padding-left: 1.2rem; }
.chat-form { display: flex; gap: .5rem; padding: .6rem; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .chat-panel { inset: 0; width: auto; max-width: none; height: auto; border-radius: 0; border: 0; }
  .chat-form input { font-size: 16px; } /* stops phones zooming in on focus */
}
@media print { .ask-btn, .chat-panel { display: none !important; } }
.chat-pick { width: auto; max-width: 150px; padding: .2rem .4rem; font-size: .85rem; }
.chat-pick[hidden] { display: none; }
.chat-msg.action { align-self: stretch; max-width: none; background: var(--card); border: 1px solid transparent; border-radius: 12px;
  background: linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(90deg, #7c3aed, #2563eb, #10b981) border-box; }
.chat-msg.action p { margin: 0 0 .35rem; }
.chat-act-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.chat-act-btns { display: flex; gap: .4rem; }
.chat-act-ok { color: var(--ok-ink, #15803d); font-weight: 600; }
.chat-act-bad { color: var(--err-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bdot { width: 12px; height: 12px; vertical-align: -1px; flex: none; }
.filters .stagebar { display: inline-flex; flex-wrap: wrap; gap: .3rem; margin: 0; }
/* Event checklist filter (closed won / not closed won at) */
.msel { position: relative; }
.msel > summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 6px; padding: .45rem .6rem; background: var(--card); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.msel > summary::-webkit-details-marker { display: none; }
.msel > summary::after { content: ' ▾'; color: var(--muted); }
.msel.on > summary { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.msel-menu { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; width: 320px; max-width: 90vw; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgb(0 0 0 / 18%); padding: .6rem; }
.msel-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: .15rem; margin: .5rem 0; }
.msel-list label { display: flex; gap: .45rem; align-items: flex-start; font-weight: 400; padding: .15rem .2rem; border-radius: 4px; }
.msel-list label:hover { background: var(--bg); }
.msel-list label[hidden] { display: none; }
.msel-list input { width: auto; margin-top: .2rem; }
.msel-actions { display: flex; gap: .4rem; }
@media (max-width: 700px) { .msel { grid-column: 1 / -1; } .msel > summary { max-width: none; } }
/* Companies / contacts: event filters on their own row above the rest */
.filterform .filters-top { margin-bottom: .5rem; }
.filterform .filters-top .eventselect { flex: 0 1 300px; }
/* Marketing email */
.mailbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: -.4rem 0 .6rem; }
.mailbar[hidden] { display: none; }
/* Two cards side by side (Executive page), stacking on narrow screens */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1rem; }
/* Executive page: visitors per day columns (one series, so no legend; a tooltip on each column) */
.trend { width: 100%; height: auto; display: block; }
.trend-grid { stroke: var(--line); stroke-width: 1; }
.trend-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.trend-bar { fill: var(--series-1); }
.trend-hit { fill: transparent; }
.trend-line { fill: none; stroke: var(--series-ref); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.swatch-line { height: 2px; width: 14px; border-radius: 1px; background: var(--series-ref); }
.trend-col:hover .trend-bar { filter: brightness(1.15); }
.trend-col:hover .trend-hit { fill: var(--brand-soft); }
.chartfilters .daterange { display: inline-flex; align-items: center; gap: .35rem; }
th.check, td.check { width: 2rem; }
.mailform { max-width: none; }
.mailedit { display: flex; flex-direction: column; gap: .35rem; }
.mailedit-bar { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.mailedit-bar .btn { min-width: 2rem; justify-content: center; }
.mailedit-field { width: auto; padding: .25rem .4rem; font-size: .88rem; }
.mailedit-area, .mailpreview { min-height: 260px; max-height: 60vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1rem; background: var(--card); line-height: 1.55; }
.mailedit-area:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.mailedit-area p, .mailpreview p { margin: 0 0 .8rem; }
.mailedit-area h2, .mailpreview h2 { font-size: 1.35rem; margin: 0 0 .6rem; }
.mailedit-area h3, .mailpreview h3 { font-size: 1.1rem; margin: 0 0 .5rem; }
.mailedit-area blockquote, .mailpreview blockquote { margin: 0 0 .8rem; padding-left: .8rem; border-left: 3px solid var(--line); color: var(--muted); }
.mailpreview { min-height: 0; margin-top: .6rem; }
/* Delete = red trash can */
.ico-trash { width: 1.05em; height: 1.05em; display: block; flex: none; }
.btn.trash { background: var(--danger); border-color: var(--danger); color: #fff; padding: .45rem .6rem; }
.btn.trash:hover { filter: brightness(1.1); border-color: var(--danger); }
.btn.small.trash { padding: .25rem .45rem; }
.trashlink { background: none; border: 0; padding: .2rem; cursor: pointer; color: var(--danger); border-radius: 4px; display: inline-flex; }
.trashlink:hover { background: var(--err-bg); }
[data-mact="del"] .ico-trash { display: inline-block; vertical-align: -2px; margin-right: .3rem; }
h2 .h2-actions { margin-left: auto; display: inline-flex; gap: .4rem; font-weight: 400; }
.msel-group { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .35rem .2rem .1rem; }

/* Email header image + call-to-action buttons */
.mailheader-img { display: block; width: 100%; max-width: 600px; height: auto; border: 1px solid var(--line); border-radius: 6px; margin: .3rem 0; }
.mailedit-area a.button, .mailpreview a.button { display: inline-block; background: #3b5bdb; color: #fff; text-decoration: none; font-weight: 600; padding: .65rem 1.6rem; border-radius: 8px; }
.error-text { color: var(--danger, #c0392b); }

/* Dashboard chart: event picker on the left, title on the right */
.chartcard .charttitle-right { text-align: right; }
@media (max-width: 700px) { .chartcard .charttitle-right { text-align: left; } }
/* Events list: my default event */
th.center, td.center { text-align: center; }
.defcheck { width: 1.6rem; height: 1.6rem; border-radius: 6px; border: 1.5px solid var(--line); background: var(--card); color: #fff; font-weight: 700; line-height: 1; cursor: pointer; padding: 0; }
.defcheck:hover { border-color: var(--brand); }
.defcheck.on { background: var(--brand); border-color: var(--brand); }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.cardhead h2 { margin: 0; }
.cardhead select { width: auto; }

/* Leads */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin: 0 0 .75rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .5rem .85rem; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; display: inline-flex; gap: .4rem; align-items: center; }
.tabs a.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }
.tabs .count { font-size: .8rem; padding: 0 .45rem; min-width: 1.4rem; }
.plainlist { margin: 0; padding-left: 1.1rem; }
.plainlist li { margin-bottom: .45rem; }
.navcount { display: inline-block; min-width: 1.25rem; padding: 0 .35rem; border-radius: 99px; background: #2f9e5b; color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.25rem; }

/* Dashboard: revenue chart beside new leads + my activities */
.dashgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.dashgrid > .card, .dashgrid > div > .card { margin-bottom: 1rem; }
@media (max-width: 1000px) { .dashgrid { grid-template-columns: 1fr; } }
.leadcard.has-new { border-color: #2f9e5b; box-shadow: inset 4px 0 0 #2f9e5b; }
.leadcard.has-new h2 .count { background: #2f9e5b; border-color: #2f9e5b; }
.leadlist { list-style: none; margin: 0; padding: 0 1rem .75rem; }
.leadlist li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.leadlist li:last-child { border-bottom: 0; }
/* Report buttons: a small bar-chart icon */
.icon-chart { display: inline-block; vertical-align: -2px; flex: none; }
h1 .icon-chart { width: 20px; height: 20px; vertical-align: -1px; color: var(--brand); }

/* Icons in buttons */
.btn .icon, a .icon { display: inline-block; vertical-align: -2px; flex: none; }
/* Event page: deals beside a booths card */
.eventgrid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
.eventgrid > .card { margin-bottom: 1rem; }
@media (max-width: 900px) { .eventgrid { grid-template-columns: 1fr; } }
.boothcard h2 { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.boothbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--line); margin: .3rem 0 .8rem; }
.boothbar span { display: block; height: 100%; }
.b-sold { background: #d9534f; } .b-hold { background: #f0c048; } .b-avail { background: #8fb6ec; } .b-blocked { background: #9aa3b2; }
.boothstats { list-style: none; margin: 0 0 .6rem; padding: 0; }
.boothstats li { display: flex; align-items: center; gap: .45rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.boothstats li strong { margin-left: auto; }
.boothstats .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dangerzone { margin: 2rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.dangerzone .btn.trash { display: inline-flex; gap: .4rem; align-items: center; width: auto; padding: .45rem .9rem; }

.mailedit-area a.button { background: var(--btn, #3b5bdb); }
.colorrow { display: flex; align-items: center; gap: .6rem; }
.colorrow input[type=color] { width: 3rem; height: 2.2rem; padding: .1rem; }

/* Email template: events it belongs to */
.evpick { border: 0; padding: 0; margin: 0; }
.evpick legend { font-weight: 600; margin-bottom: .3rem; padding: 0; }
.evpick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem .75rem; max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: .5rem .7rem; }
.deletedbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
/* Deal page: Booths card */
#booths form.boothadd { display: flex; padding-bottom: 1rem; }
#booths form.boothadd #boothPick { flex: 1 1 260px; width: auto; }
#booths > p.pad:last-child { padding-bottom: 1rem; }

/* Formatted text box (contract terms) and formatted text shown on a record */
.richtext-edit .mailedit-area { min-height: 220px; }
.mailedit-area ul, .mailedit-area ol, .richtext ul, .richtext ol { margin: 0 0 .8rem; padding-left: 1.4rem; }
.richtext p { margin: 0 0 .6rem; }
.richtext h2, .richtext h3 { font-size: 1rem; margin: .4rem 0 .4rem; }
/* Saved lists: "Save as list" / rename pop-overs, the viewing-a-list banner, the bulk bar's list picker */
.savelist { position: relative; }
.savelist > summary { list-style: none; cursor: pointer; }
.savelist > summary::-webkit-details-marker { display: none; }
.savelist-pop { position: absolute; left: 0; top: calc(100% + .35rem); z-index: 30; width: min(320px, 85vw); display: grid; gap: .5rem; padding: .8rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-align: left; }
.savelist-pop label { display: grid; gap: .25rem; font-weight: 500; }
.savelist-pop.right { left: auto; right: 0; }
.colpick-row { display: flex; justify-content: flex-end; margin: 0 0 .4rem; }
.savelist-pop label.check { display: flex; gap: .45rem; align-items: center; font-weight: 400; }
.savelist-pop p { margin: 0; }
.listbanner { margin: -.3rem 0 .7rem; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.mailbar .addlist { display: inline-flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.mailbar .addlist input[hidden] { display: none; }
.listactions { justify-content: flex-end; flex-wrap: nowrap; }
.mailbar .addlist select, .mailbar .addlist input { width: auto; min-width: 0; margin: 0; }
.mailbar .addlist select { max-width: 220px; }
.mailbar .addlist input { width: 180px; }
/* Bulk bar: what's selected on top, then the two choices (email now, or save to a fixed list) */
#bulkPick.mailbar { display: grid; gap: .6rem; padding: .75rem .9rem; margin: 0 0 .8rem; background: var(--card); border: 1px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow); }
#bulkPick.mailbar[hidden] { display: none; }
.bulk-head { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.pickmatch { display: inline-flex; gap: .4rem; align-items: center; font-weight: 500; cursor: pointer; white-space: nowrap; }
.pickmatch input { width: auto; margin: 0; }
.bulk-choices { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.4fr); gap: .8rem; align-items: start; }
.bulk-choice { display: grid; gap: .35rem; justify-items: start; align-content: start; }
.bulk-label { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.bulk-or { align-self: center; color: var(--muted); font-style: italic; }
@media (max-width: 800px) { .bulk-choices { grid-template-columns: 1fr; } .bulk-or { justify-self: start; } }
.listkinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; } .listkinds .card { margin: 0; } .listkinds p { margin: .4rem 0 0; }
.filterchip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .65rem; border: 1px solid var(--brand); border-radius: 99px; font-size: .85rem; white-space: nowrap; text-decoration: none; }
.savelist-pop.flip { left: auto; right: 0; }
/* Anything marked hidden stays hidden, even when a class (e.g. .btn) sets a display */
[hidden] { display: none !important; }
/* Email compose: header image placeholder and file row, CC / BCC, folded recipients */
.mailheader-empty { padding: .9rem; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); font-size: .9rem; margin: .3rem 0; }
.mailheader-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.mailheader-row input[type=file] { width: auto; flex: 0 1 auto; }
.ccrow { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 700px) { .ccrow { grid-template-columns: 1fr; } }
.recips-more > summary { cursor: pointer; color: var(--brand); border-top: 1px solid var(--line); }
.listactions .btn.trash svg { width: 15px; height: 15px; }
/* Deals selection bar: three choices (email, deal actions, list) */
.bulk-choices:has(> div:nth-of-type(5)) { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.3fr); }
@media (max-width: 1100px) { .bulk-choices:has(> div:nth-of-type(5)) { grid-template-columns: 1fr; } .bulk-choices .bulk-or { justify-self: start; } }
.ref-item.ref-create { color: var(--brand); font-weight: 600; border-top: 1px solid var(--line); }
/* User photo / initial: top bar and My account */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; overflow: hidden; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .8rem; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 5rem; height: 5rem; font-size: 2rem; }
.usermenu > a.useracct { display: inline-flex; align-items: center; gap: .45rem; padding: .25rem .6rem .25rem .3rem; }
.useracct-name { overflow: hidden; text-overflow: ellipsis; }
.photorow { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: .5rem; }
.photoform { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.photoform input[type=file] { width: auto; }
/* Deal form: the company's contacts as a pick list */
.contactpick { display: grid; gap: .3rem; }
.contactpick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .3rem .9rem; }
.contactpick .ref { max-width: 420px; }
.h1-sub { font-weight: 500; color: var(--muted); font-size: .7em; }
/* One height for every button, dropdown and box (filters, page headers, forms, the top bar's event picker).
   Small buttons (.small) stay small; text areas, checkboxes and colour/file pickers keep their own sizes. */
:root { --control-h: 2.5rem; }
.btn:not(.small):not(.trashlink), select, summary.btn:not(.small), details.msel > summary,
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]):not([type=hidden]):not([type=range]) {
  height: var(--control-h); min-height: var(--control-h); box-sizing: border-box; padding-top: 0; padding-bottom: 0; line-height: 1.2;
}
.btn:not(.small) { align-items: center; justify-content: center; }
details.msel > summary { display: flex; align-items: center; }
/* Files library */
.files-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .files-layout { grid-template-columns: 1fr; } }
.folderlist { display: grid; gap: .1rem; margin-bottom: .8rem; }
.folderlist a { padding: .4rem .55rem; border-radius: 6px; color: var(--text); text-decoration: none; display: flex; justify-content: space-between; gap: .5rem; }
.folderlist a:hover { background: var(--bg); }
.folderlist a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.folder-new { display: grid; gap: .4rem; margin-bottom: .6rem; }
.dropzone { border: 2px dashed var(--line); text-align: center; }
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone p { margin: .3rem 0; }
.uploadlist { list-style: none; padding: 0; margin: .4rem 0 0; text-align: left; font-size: .9rem; }
.mailedit-files { position: relative; display: inline-flex; }
.mailedit-filepop { position: absolute; top: calc(100% + .3rem); left: 0; z-index: 40; width: 320px; max-width: calc(100vw - 2.5rem); display: grid; gap: .35rem; padding: .6rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.mailedit-fileitem { text-align: left; background: none; border: 0; padding: .35rem .4rem; border-radius: 5px; color: var(--text); cursor: pointer; font: inherit; font-size: .9rem; }
.mailedit-fileitem:hover { background: var(--brand-soft); }
/* One-to-one email attachments */
.attachlist { display: flex; flex-wrap: wrap; gap: .35rem; }
.attachlist:empty { display: none; }
.attachchip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: 99px; font-size: .88rem; background: var(--bg); }
.attachrow .btnrow { align-items: center; }
/* Pickers and buttons that open a pop-over (details) line up with the controls beside them:
   no text-section margin on their summary, and the wrapper sits in the middle of its row */
details.msel > summary, details.savelist > summary, details.fp-planmenu > summary, summary.btn { margin: 0; }
.filters > details, .btnrow > details, .pagehead details, .fp-plans > details { align-self: center; }
/* Small buttons (table rows, pop-overs) are one height too, trash can included */
.btn.small, summary.btn.small { min-height: 1.8rem; box-sizing: border-box; align-items: center; }
/* Deal page: two equal columns (details, booths, activities | products, contracts, invoices) */
.twocol.dealcols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
/* Contacts: a narrower details card so Activities, Deals and the rest get more room */
.twocol.contactcols, .twocol.halfcols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.twocol.contactcols dl.fields { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@media (max-width: 900px) { .twocol.contactcols, .twocol.halfcols { grid-template-columns: 1fr; } }
.twocol.dealcols .data { font-size: .92rem; }
@media (max-width: 1000px) { .twocol.dealcols { grid-template-columns: 1fr; } }
/* Deal page: the total value, featured beside the name; Edit in the details card's heading */
.dealvalue { display: inline-flex; align-items: baseline; gap: .45rem; margin-left: .6rem; padding: .25rem .85rem; border-radius: 10px; background: var(--brand); color: #fff; font-size: 1.35rem; font-weight: 800; vertical-align: middle; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }
.dealvalue small { font-size: .68rem; font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.cardhead-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: 0; }
/* Dashboard top row: Deals by Stage | closed won vs last edition + booths (quiet tiles, big numbers) */
.dash-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; margin-bottom: 1rem; }
.dash-top > .card { margin-bottom: 0; }
.dash-side { display: grid; gap: 1rem; align-content: start; }
.dash-side > .card { margin-bottom: 0; }
@media (max-width: 1000px) { .dash-top { grid-template-columns: 1fr; } }
.dash-code { font-size: .78rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .45rem; margin-left: .35rem; vertical-align: middle; letter-spacing: .02em; }
.tiles { display: grid; gap: .6rem; }
.tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles + .tiles { margin-top: .6rem; }
.tiles-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.weekcard { margin-bottom: 1rem; }
.wk-link { color: inherit; text-decoration: none; display: grid; }
.wk-link:hover .tile, .wk-link:focus-visible .tile { border-color: var(--brand); }
@media (max-width: 1000px) { .tiles-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .tiles-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: .65rem .8rem; display: grid; gap: .1rem; background: var(--bg); }
.tile span { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tile strong { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.tile small { color: var(--muted); font-size: .8rem; }
.tile.up small { color: #2f8f5b; font-weight: 600; }
.tile.down small { color: var(--danger); font-weight: 600; }
.tile.st-sold { border-left: 3px solid #2f8f5b; }
.tile.st-hold { border-left: 3px solid #e3b341; }
.tile.st-available { border-left: 3px solid #8a94a6; }
/* Dashboard tiles: count with its figure side by side; clickable tiles; two links in a card heading */
.tile-row { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
.tile-row small { white-space: nowrap; }
a.tile-link { color: inherit; text-decoration: none; transition: border-color .15s; }
a.tile-link:hover { border-color: var(--brand); }
.h2-links { display: inline-flex; gap: .9rem; }
.dashgrid { align-items: start; }
.dash-grow { flex: 1; }
/* Booth Status: sq ft easier to read; links sit under the Outstanding tiles */
.booth-tiles .tile-row small { font-size: .95rem; color: var(--text); opacity: .8; }
.tile-under { display: inline-block; margin-top: .35rem; }
/* Email template: the setup details (name, who can use it, events) boxed apart from the email itself */
.setupcard { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: .9rem 1rem 1rem; margin: 0; display: grid; gap: .8rem; min-width: 0; }
.setupcard > legend { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 .35rem; }
.setupcard fieldset.field:not(.evpick) { border: 0; padding: 0; margin: 0; min-width: 0; }
.setupcard fieldset.field:not(.evpick) > legend { padding: 0; margin-bottom: .3rem; font-size: .85rem; font-weight: 600; }
/* Email editor: links underlined (as in the sent email); the Button pop-over */
.mailedit-area a:not(.button) { text-decoration: underline; }
.mailedit-btnpop { width: 340px; }
.mailedit-btnpop label { display: grid; gap: .2rem; }
.mailedit-btncolor { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.mailedit-btncolor label { display: inline-flex; align-items: center; gap: .4rem; }
.mailedit-btncolor input[type=color] { width: 2.4rem; height: 1.8rem; padding: 0; }
/* Exhibitor list settings: the live preview of the public list */
.expreview { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
/* Yes/no fields with an explanation (e.g. Do not email, Email bounced): two columns each, so the note has room */
.grid > .field-bool { grid-column: span 2; padding-right: 1.5rem; }
@media (max-width: 700px) { .grid > .field-bool { grid-column: 1 / -1; padding-right: 0; } }
/* Activity page: full width; when it was completed, and its contact / company / deal in full */
.twocol.onecol { grid-template-columns: minmax(0, 1fr); }
.twocol.onecol > div:empty { display: none; }
.act-done { margin: .2rem 0 .8rem; padding: .5rem .75rem; border-radius: 8px; background: color-mix(in srgb, #2f8f5b 12%, transparent); color: #2f8f5b; font-weight: 600; }
.act-related { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; margin: .4rem 0 .9rem; }
.act-rel { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .85rem; display: grid; gap: .15rem; align-content: start; }
.act-rel-k { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
/* Lookup lists: the new value and the one Save for the whole list */
.lookup-save { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.lookup-save input { flex: 1 1 240px; max-width: 360px; }
.rowedit tr:has(input[name^="remove_"]:checked) td input:not([name^="remove_"]) { text-decoration: line-through; opacity: .55; }
/* Events list: All / None under the "In my filters" heading */
.th-all { display: flex; justify-content: center; gap: .5rem; margin-top: .15rem; font-weight: 400; text-transform: none; letter-spacing: 0; }
/* Invoice: refunding a card payment through Stripe */
/* The payment link box, highlighted when "Get payment link" brings you to it */
#payonline:target, .flashcard { animation: flashcard 1.6s ease-out; }
@keyframes flashcard { 0%, 30% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 0 0 3px transparent; } }
.payactions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-start; margin-top: .4rem; }
.payactions details[open] { flex-basis: 100%; }
.refundbox > summary { cursor: pointer; list-style: none; display: inline-flex; margin: 0; }
.refundbox > summary::-webkit-details-marker { display: none; }
.refundbox form { margin-top: .5rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 8px; max-width: 380px; }
/* Bulk email: send now or schedule; a scheduled email's page */
.sendwhen { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; }
.sendwhen > legend { width: 100%; }
.sendwhen input[type=datetime-local] { width: auto; }
.sendwhen small { width: 100%; }
.scheduledcard { border-left: 4px solid #e3b341; }
.scheduledcard form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .4rem; }
.scheduledcard label { display: inline-flex; align-items: center; gap: .4rem; }

/* Plain list (e.g. payment reminders on an invoice) */
ul.plain { list-style: none; padding: 0; margin: .3rem 0 1rem; }
ul.plain li { padding: .2rem 0; }

/* Attendee marketing */
.attfilters .filters { margin-bottom: .25rem; }
.attfilters { margin-bottom: 1rem; }
.attfilters .searchrow select { flex: 0 1 220px; }
.attfilters .attsummary { margin: .5rem 0 0; }
.attfilters .filterpanel .filters { margin-bottom: .6rem; }
.inlinepop { position: relative; display: inline-block; }
.inlinepop > summary { list-style: none; }
.inlinepop > summary::-webkit-details-marker { display: none; }
.inlinepop .popform { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20; width: min(340px, 85vw); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.mapgrid td select { width: 100%; }
.mapgrid .sample { color: var(--muted); font-size: .85rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apikey { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.attfilters .filters input:not([type=search]) { flex: 0 1 150px; width: auto; min-width: 0; }
.attfilters .filters select { flex: 0 0 auto; max-width: 230px; }
/* New attendee email: how to start */
.starthead { margin: .5rem 0 .2rem; font-size: 1.1rem; }
.startgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; margin: .8rem 0 1.4rem; }
.startcard { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: .9rem 1rem 1rem; min-height: 200px; background: var(--card); color: var(--text); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s; }
.startcard:hover, .startcard:focus-visible { border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 8px 22px rgb(0 0 0 / 14%); text-decoration: none; }
.startcard-when { align-self: flex-start; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); background: var(--brand-soft); padding: .1rem .45rem; border-radius: 4px; }
.startcard-name { font-weight: 700; font-size: 1.02rem; }
.startcard-blurb { color: var(--muted); font-size: .88rem; line-height: 1.35; }
.startcard-preview { margin-top: .4rem; padding: .55rem .65rem; flex: 1; white-space: pre-line; font-size: .74rem; line-height: 1.35; color: var(--muted); background: var(--bg); border-radius: 6px; max-height: 96px; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.startcard.blank { justify-content: center; align-items: center; text-align: center; border-style: dashed; }
.startcard-plus { font-size: 2.2rem; line-height: 1; color: var(--brand); order: -1; margin-bottom: .2rem; }
.startlists .card h2 { margin-top: 0; }
.startlist { list-style: none; margin: 0; padding: 0; }
.startlist li { padding: .45rem 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .1rem; }
.startlist li:first-child { border-top: 0; }
.startfrom { margin: 0; padding: .45rem .65rem; background: var(--brand-soft); border-radius: 6px; }
.tplpick { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.tplpick select { flex: 1 1 240px; width: auto; }
.pickbanner a { font-weight: 600; }

/* Deal clone: booth status beside the "clone booths" tick */
.narrowfield{max-width:220px}
/* Admin · Discount codes */
form.inline-block { display: inline-block; margin: 0; }
form.inline-block + form.inline-block { margin-left: .35rem; }
.dccode { text-transform: uppercase; }

/* Product description under an invoice line (formatted: bold, lists) */
.itemdetails { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.itemdetails p, .itemdetails ul, .itemdetails ol { margin: 0 0 .3rem; }
.itemdetails ul, .itemdetails ol { padding-left: 1.2rem; }
.itemdetails h2, .itemdetails h3 { font-size: .9rem; margin: .2rem 0; color: var(--text); }
.linedetails { margin-top: .3rem; padding: .3rem .5rem; border-left: 3px solid var(--line); }
.linedetails .richtext p, .linedetails .richtext ul, .linedetails .richtext ol { margin: 0 0 .25rem; }
.openlink { text-decoration: none; font-weight: 600; }

/* My account: email signature */
.sigform .mailedit-area { min-height: 6rem; }
.esig-image { display: flex; gap: 1rem; align-items: flex-start; margin: .75rem 0; flex-wrap: wrap; }
.esig-image-preview { display: flex; align-items: center; justify-content: center; min-width: 120px; min-height: 60px; padding: .4rem; border: 1px dashed var(--line); border-radius: 8px; background: var(--card); }
.esig-image-preview img { display: block; max-width: 300px; max-height: 150px; height: auto; }
.sigpreview-label { margin: 1rem 0 .3rem; }
.sigpreview { padding: .25rem 1rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #1d2330; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.sigpreview p { margin: 0 0 4px; }
.sigpreview img { max-width: 300px; height: auto; margin-top: 8px; display: block; }

/* Change history on contact and company pages */
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list > li { padding: .55rem 0; border-top: 1px solid var(--line); }
.history-list > li:first-child { border-top: 0; }
.history-head { font-size: .92rem; }
.history-changes { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .88rem; }
.history-changes li { margin: .1rem 0; overflow-wrap: anywhere; }
.history-field { color: var(--muted); }
.history-changes del { color: var(--muted); }
.history-changes ins { text-decoration: none; font-weight: 600; }
.history-more summary { cursor: pointer; margin-top: .4rem; color: var(--brand); }

/* Compose: the editor and your signature in one box */
.mailedit-frame { border: 1px solid var(--line); border-radius: 6px; background: var(--card); max-height: 70vh; overflow-y: auto; }
.mailedit-frame:focus-within { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.mailedit-frame .mailedit-area { border: 0; border-radius: 6px; min-height: 180px; max-height: none; overflow: visible; }
.mailedit-frame .mailedit-area:focus { outline: none; }
.mailedit-sig { padding: 0 1rem .9rem; line-height: 1.5; cursor: default; user-select: none; }
.mailedit-sig-label { display: block; padding-top: .5rem; margin-bottom: .35rem; border-top: 1px dashed var(--line); font-size: .78rem; }
.mailedit-sig-body { opacity: .85; overflow-wrap: anywhere; }
.mailedit-sig-body > div { margin: 0; }
.mailedit-sig-body p { margin: 0 0 4px; }
.mailedit-sig-body img { max-width: 300px; height: auto; margin-top: 8px; display: block; }

/* Top bar: your photo opens the account menu */
.acctmenu { position: relative; }
.acctmenu-btn { list-style: none; cursor: pointer; display: inline-flex; margin: 0; padding: 3px; border-radius: 50%; border: 2px solid transparent; }
.acctmenu-btn::-webkit-details-marker { display: none; }
.acctmenu-btn:hover, .acctmenu[open] > .acctmenu-btn { border-color: var(--line); }
.acctmenu-btn.active { border-color: var(--brand); }
.acctmenu-btn .avatar { width: 2rem; height: 2rem; font-size: .9rem; }
.acctmenu-pop { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 60; min-width: 230px; max-width: calc(100vw - 2rem); display: grid; padding: .35rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.acctmenu-who { display: grid; gap: .1rem; padding: .5rem .65rem .6rem; margin-bottom: .25rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.acctmenu-pop form { margin: 0; }
.acctmenu-item { display: block; width: 100%; text-align: left; padding: .5rem .65rem; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; cursor: pointer; }
.acctmenu-item:hover { background: var(--bg); text-decoration: none; }
.signout-item { color: var(--danger); }

/* Files: folders inside folders, indented in the list */
.folderlist .fd-name { display: inline-flex; align-items: center; gap: .35rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folderlist .fd-icon { font-size: .85em; opacity: .8; }
.folderlist .fd-1 { padding-left: 1.3rem; } .folderlist .fd-2 { padding-left: 2.05rem; } .folderlist .fd-3 { padding-left: 2.8rem; }
.folderlist .fd-4 { padding-left: 3.55rem; } .folderlist .fd-5 { padding-left: 4.3rem; }
.folder-edit { margin-bottom: .6rem; }
.folder-edit summary { font-size: .9rem; }
.folder-crumbs { margin: 0 0 .6rem; font-size: .95rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
tr.folderrow td { background: color-mix(in srgb, var(--brand-soft) 35%, transparent); }

/* Contact details: name, job, company, emails, phones and address as a card, without field titles */
.contact-card { display: grid; gap: .2rem; margin: 0 0 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.contact-card .cc-name { font-size: 1.15rem; font-weight: 600; }
.contact-card .cc-job { color: var(--muted); margin-bottom: .2rem; }
.contact-card .cc-address { margin-top: .35rem; color: var(--text); line-height: 1.4; }

/* Sign-in: the emailed-code option under the code box */
.emailcode { margin: .8rem 0 .2rem; }

/* ---- Customer support ---- */
.pill.st-new { background: var(--brand); color: #fff; border-color: transparent; }
.pill.st-open { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.pill.st-pending { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.pill.st-solved { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
tr.unread td strong { font-weight: 700; }
.support-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .75rem 0; }
.support-filters input[type=search] { flex: 1 1 16rem; min-width: 12rem; }
.support-thread { padding: 0; overflow: hidden; }
.smsg { padding: .9rem 1.1rem; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); }
.smsg:last-child { border-bottom: 0; }
.smsg-reply { background: var(--brand-soft); }
/* The automatic reply: shaded amber with a bar on the left, so it stands apart from people's messages (light and dark) */
.smsg-auto { background: rgba(245, 159, 0, .12); box-shadow: inset 4px 0 0 #f59f00; }
.smsg-auto .smsg-head strong { color: #b26a00; }
:root[data-theme="dark"] .smsg-auto .smsg-head strong { color: #ffc14d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .smsg-auto .smsg-head strong { color: #ffc14d; } }
.smsg-auto .smsg-body { font-size: .9em; }
.smsg-head { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; margin-bottom: .4rem; }
.smsg-when { margin-left: auto; }
.smsg-body { overflow-wrap: anywhere; }
.smsg-body p { margin: 0 0 .6em; }
.smsg-body blockquote { margin: .5em 0; padding-left: .8em; border-left: 3px solid var(--line, rgba(127,127,127,.35)); opacity: .8; }
.smsg-files { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.support-reply-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.support-reply-head h2 { margin: 0; }
.support-reply textarea { width: 100%; }
.support-sig { margin: .5rem 0 .75rem; }
.btn.small.copybtn { height: 1.75rem; min-height: 1.75rem; width: 1.75rem; padding: 0; margin-left: .35rem; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; color: var(--brand); }
.btn.small.copybtn:hover, .btn.small.copybtn:focus-visible { border-color: var(--brand); }
.copybtn .copybtn-ok { display: none; }
.copybtn.copied .copybtn-copy { display: none; }
.copybtn.copied .copybtn-ok { display: inline; }
.btn.small.copybtn.copyfail { border-color: var(--danger, #c92a2a); color: var(--danger, #c92a2a); }
.support-sig-body { margin-top: .25rem; padding: .5rem .75rem; border-left: 3px solid var(--line, #d6dae2); color: var(--muted, #6b7385); font-size: .9rem; }
.support-reply .actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: flex-end; }
.support-reply .actions .muted { margin-right: auto; }
.support-ticket form.stack { margin: 0 0 .5rem; }
.accesspick { display: inline-flex; flex-direction: column; gap: .1rem; margin-right: .5rem; }
.snippet-pick { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: .5rem; } .snippet-pick .field { flex: 1 1 14rem; }

/* ---- Inventory ---- */
.inv-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.inv-fig { display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1rem; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.inv-fig strong { font-size: 1.7rem; line-height: 1.1; }
.inv-fig span { color: var(--muted); font-size: .9rem; }
.inv-fig:hover { border-color: var(--brand); }
.inv-fig.warn strong { color: var(--warn-ink); }
.inv-sub { font-size: .7em; font-weight: 500; }
.inv-locs { padding: .6rem 1rem; }
.inv-locs summary { cursor: pointer; }
.inv-locs table { margin-top: .5rem; }
.inv-locs tr.hl td { background: var(--brand-soft); }
.inv-locs tr.totals td { border-top: 2px solid var(--line); }
.inv-filters select { max-width: 13rem; }
.inv-countline { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0 0 .5rem; }
.inv-countline .muted { margin-right: auto; }
.pill.inv-out { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; text-decoration: none; }
tr.grouprow td { background: var(--bg, rgba(127,127,127,.06)); padding-top: .6rem; }
tr.clickrow { cursor: pointer; }
tr.clickrow:hover td { background: var(--brand-soft); }
tr.inv-outrow td { background: color-mix(in srgb, var(--warn-bg) 45%, transparent); }
.inv-hist { list-style: none; margin: 0; padding: 0; }
.inv-hist li { padding: .6rem 1rem; border-top: 1px solid var(--line); }
.inv-hist li.current { background: color-mix(in srgb, var(--warn-bg) 50%, transparent); }
th .sortlink { color: inherit; text-decoration: none; white-space: nowrap; }
td.num, th.num { text-align: right; }
.show-sm { display: none; }
@media (max-width: 760px) { .hide-sm { display: none; } .show-sm { display: block; } }
@media (max-width: 420px) { .hide-xs { display: none; } }
.flash.warn { background: var(--warn-bg); color: var(--warn-ink); }
.inv-problems ul, .inv-dialog .flash ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.inv-info { display: flex; flex-wrap: wrap; gap: .2rem .9rem; }
.inv-assign-row { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: flex-end; }
.inv-assign-row .field { max-width: 12rem; }
.inv-assign textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; }
.cardhead-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.cardhead-row h2 { margin: 0; }
.inv-toolbar { align-items: center; }
.inline-field { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; }
.inline-field input { width: auto; }
.inv-bulkbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
td.inv-tick, th.inv-tick { width: 2rem; }
tr.picked td { background: var(--brand-soft); }
.inv-returned summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; }
.inv-dialog { border: 0; border-radius: 14px; padding: 1.2rem; width: min(560px, 94vw); background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.inv-dialog::backdrop { background: rgba(10,14,24,.5); }
.inv-dialog h2 { margin-top: 0; }
.inv-dialog .actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; align-items: center; margin-top: 1rem; }
.inv-stock { width: min(900px, 96vw); }
.inv-stock-list { max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.inv-stock tr[data-stock] { cursor: pointer; }
.inv-stock tr.disabled { opacity: .5; cursor: not-allowed; }
/* Camera scanner (full screen) */
body.invscan-open { overflow: hidden; }
.invscan { position: fixed; inset: 0; z-index: 1000; background: #000; color: #fff; display: flex; flex-direction: column; }
.invscan-top { display: flex; justify-content: space-between; align-items: center; padding: .6rem .9rem; background: rgba(0,0,0,.6); }
.invscan-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.invscan-stage video { width: 100%; height: 100%; object-fit: cover; }
.invscan-frame { position: absolute; left: 10%; right: 10%; top: 35%; height: 30%; border: 3px solid rgba(255,255,255,.8); border-radius: 12px; transition: border-color .15s; }
.invscan-frame.hit { border-color: #2fbf71; box-shadow: 0 0 0 9999px rgba(47,191,113,.12); }
.invscan-frame.warn { border-color: #f5a524; box-shadow: 0 0 0 9999px rgba(245,165,36,.12); }
.invscan-hint { position: absolute; left: 0; right: 0; bottom: 1rem; text-align: center; font-weight: 600; text-shadow: 0 1px 3px #000; padding: 0 1rem; }
.invscan-tools { display: flex; gap: .4rem; justify-content: center; padding: .4rem; background: rgba(0,0,0,.6); }
.invscan-bottom { display: flex; gap: .6rem; align-items: center; padding: .6rem .9rem; background: #111; }
.invscan-chips { flex: 1; display: flex; flex-wrap: wrap; gap: .35rem; max-height: 6.5rem; overflow: auto; }
.invscan-empty { margin: 0; color: #aaa; }
.invscan-chip { display: inline-flex; align-items: center; gap: .3rem; background: #2fbf71; color: #04210f; border-radius: 999px; padding: .15rem .3rem .15rem .6rem; font-weight: 700; }
.invscan-chip.warn { background: #f5a524; color: #2a1800; }
.invscan-chip button { background: transparent; border: 0; color: inherit; font-size: 1.05rem; cursor: pointer; padding: 0 .2rem; }
.inv-sendline { display: grid; grid-template-columns: 1fr 6rem auto; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.inv-sendline .inv-over { grid-column: 1 / -1; color: var(--err-ink); }
.inv-sendline input.bad { border-color: var(--err-ink); }
.inv-plus { color: var(--ok-ink); font-weight: 600; }
.inv-minus { color: var(--err-ink); font-weight: 600; }
tr.inactive td { opacity: .55; }
form.inline { display: inline; }
/* Inventory tick boxes: drawn by the CRM so they look the same in every browser and theme */
td.inv-tick, th.inv-tick { width: 2.4rem; text-align: center; vertical-align: middle; border-left: 0; border-right: 0; }
td.inv-tick input[type=checkbox], th.inv-tick input[type=checkbox], input[type=checkbox][data-select-group] {
  -webkit-appearance: none; appearance: none; width: 1.15rem; height: 1.15rem; min-height: 0; margin: 0; padding: 0;
  border: 2px solid var(--muted); border-radius: 4px; background: var(--card); display: inline-grid; place-content: center;
  vertical-align: middle; cursor: pointer; box-shadow: none;
}
td.inv-tick input[type=checkbox]::after, th.inv-tick input[type=checkbox]::after, input[type=checkbox][data-select-group]::after {
  content: ''; width: .34rem; height: .62rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); opacity: 0;
}
td.inv-tick input[type=checkbox]:checked, th.inv-tick input[type=checkbox]:checked, input[type=checkbox][data-select-group]:checked { background: var(--brand); border-color: var(--brand); }
td.inv-tick input[type=checkbox]:checked::after, th.inv-tick input[type=checkbox]:checked::after, input[type=checkbox][data-select-group]:checked::after { opacity: 1; }
td.inv-tick input[type=checkbox]:focus-visible, th.inv-tick input[type=checkbox]:focus-visible, input[type=checkbox][data-select-group]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
td.inv-tick input[type=checkbox]:disabled { opacity: .35; cursor: not-allowed; }
/* Phones (stacked tables): the tick box sits on the same line as the asset / heading, not on its own line */
@media (max-width: 760px) {
  table.data.stacked.inv-select td.inv-tick { display: inline-block; width: auto; padding: 0 .6rem 0 0; vertical-align: middle; }
  table.data.stacked.inv-select td.inv-tick::before { display: none; }
  table.data.stacked.inv-select td.inv-tick + td { display: inline-flex; vertical-align: middle; padding: 0; }
  table.data.stacked.inv-select td.inv-tick + td::before { display: none; }
}
.inv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.inv-grid > div > .card:last-child { margin-bottom: 1rem; }
@media (max-width: 900px) { .inv-grid { grid-template-columns: 1fr; } .inv-grid > div:empty { display: none; } }
.support-req dd { margin: 0; }
.support-url { overflow-wrap: anywhere; }
.smsg-frame { display: block; width: 100%; height: 320px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
/* Contacts / companies / deals: one search row, the rest of the filters in a panel that opens under it */
.cfilters { margin-bottom: 1rem; }
.cfilters .searchrow { margin-bottom: 0; flex-wrap: nowrap; }
.cfilters .searchrow input[type=search] { flex: 1 1 320px; max-width: 520px; }
.filtertoggle { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.filtertoggle.on { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.filtertoggle .fcount { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem; border-radius: 99px; background: var(--brand); color: #fff; font-size: .75rem; }
.filtertoggle[aria-expanded="true"] { background: var(--brand-soft); }
.filterpanel { margin-top: .6rem; padding: .9rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filterpanel[hidden] { display: none; }
.filterpanel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem 1rem; align-items: end; }
.fp-field { display: grid; gap: .25rem; font-weight: 500; font-size: .85rem; min-width: 0; }
.fp-field > span:first-child { color: var(--muted); }
.fp-field select, .fp-field .ref, .fp-field .msel > summary { width: 100%; max-width: none; font-weight: 400; font-size: .95rem; }
.fp-field .daterange { display: flex; gap: .35rem; }
.fp-field .daterange select { flex: 0 0 auto; width: auto; }
.fp-field .daterange input { flex: 1 1 auto; min-width: 0; }
.fp-wide { grid-column: span 2; }
.filterpanel-actions { display: flex; gap: .5rem; margin-top: .9rem; }
.chiprow { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
@media (max-width: 760px) {
  .cfilters .searchrow { display: flex; flex-wrap: wrap; }
  .cfilters .searchrow input[type=search] { flex: 1 1 100%; max-width: none; }
  .cfilters .searchrow > * { width: auto; }
  .fp-wide { grid-column: auto; }
  .filterpanel-grid { grid-template-columns: 1fr; }
}
.filtertoggle .ico-filter { flex: none; }
/* Tiles: three across while the card is wide enough; in a narrow card (half-width dashboard column, phones)
   they stack, so large amounts are never cut off */
.card:has(> .tiles-3) { container: tilecard / inline-size; }
.tile { min-width: 0; }
.tile strong { overflow-wrap: anywhere; }
@container tilecard (max-width: 560px) {
  .tiles-3 { grid-template-columns: 1fr; }
  .tiles-3 .tile { grid-template-columns: 1fr auto; align-items: baseline; column-gap: .6rem; }
  .tiles-3 .tile span { grid-column: 1 / -1; }
  .tiles-3 .tile strong { font-size: 1.25rem; white-space: nowrap; }
}
.cfilters .booth-status { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .6rem; }
/* Phones: two-column cards never grow wider than the screen (a long email on a lead), and the analytics date range wraps */
.twocol > * { min-width: 0; }
table.data.compact td { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .chartfilters .daterange { display: flex; flex-wrap: wrap; width: 100%; }
  .chartfilters .daterange input[type=date] { flex: 1 1 120px; min-width: 0; width: auto; }
}
/* Event calendar board: a wide grid that scrolls inside its box, header and the first three columns stay put */
.cg-ranges { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .6rem; }
.cg-custom { display: inline-flex; gap: .3rem; align-items: center; margin-left: .4rem; }
.cg-custom input[type=date] { width: auto; padding: .3rem .4rem; }
.cg-span { margin-left: auto; }
.cg-away { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 0 0 .7rem; font-size: .85rem; }
.cg-awaychip { padding: .2rem .55rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.cg-awaychip.all { background: #fbe3cc; color: #8a4b0f; }
.cg-wrap { overflow: auto; max-height: calc(100vh - 260px); min-height: 240px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.cg { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 1rem; }
.cg th, .cg td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: .2rem .35rem; vertical-align: middle; white-space: nowrap; background: var(--card); }
.cg thead th { position: sticky; top: 0; z-index: 3; background: var(--bg); font-weight: 600; font-size: .9rem; text-align: left; padding: .45rem .4rem; }
.cg .cg-s1, .cg .cg-s2, .cg .cg-s3 { position: sticky; z-index: 2; }
.cg .cg-s1 { left: 0; width: 120px; min-width: 120px; max-width: 120px; }
.cg .cg-s2 { left: 120px; width: 140px; min-width: 140px; max-width: 140px; }
.cg .cg-s3 { left: 260px; width: 280px; min-width: 280px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; box-shadow: 2px 0 0 var(--line); }
.cg thead .cg-s1, .cg thead .cg-s2, .cg thead .cg-s3 { z-index: 4; }
.cg-code { font-variant-numeric: tabular-nums; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.cg tr.cg-month th { position: sticky; top: 33px; z-index: 1; background: var(--brand-soft); color: var(--brand); text-align: left; padding: .3rem .5rem; font-size: .95rem; }
.cg tr.cg-month th span { position: sticky; left: .5rem; }
.cg-in, .cg-qty { border: 1px solid transparent; background: transparent; padding: .2rem .3rem; border-radius: 4px; font: inherit; color: inherit; width: 100%; min-width: 0; }
.cg-in:hover, .cg-qty:hover { border-color: var(--line); }
.cg-in:focus, .cg-qty:focus { border-color: var(--brand); background: var(--bg); outline: none; }
.cg select.cg-in { padding-right: 1.2rem; min-width: 80px; }
.cg-date { min-width: 92px; }
.cg-text input { width: 120px; }
.cg td.cg-text:last-child input { width: 220px; }
.cg input[type=checkbox].cg-in { width: auto; }
.cg-status[data-v=Open] { color: #2f8f5b; font-weight: 600; }
.cg-status[data-v=Cancelled] { color: var(--danger); font-weight: 600; }
.cg-status[data-v=Closed] { color: var(--muted); }
.cg tr.cg-cancel td:not(.cg-s1):not(.cg-s2) { opacity: .55; }
.cg tr.cg-cancel .cg-s3 a { text-decoration: line-through; }
.cg tr.cg-past td { color: var(--muted); }
.cg tr.cg-now .cg-s3 { box-shadow: inset 3px 0 0 #2f8f5b, 2px 0 0 var(--line); }
.cg th.cg-eq, .cg td.cg-eq { text-align: center; min-width: 54px; }
.cg td.cg-eq { white-space: nowrap; }
.cg-qty { width: 3rem; text-align: right; -moz-appearance: textfield; }
.cg-qty::-webkit-outer-spin-button, .cg-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cg-got { color: var(--muted); font-size: .85rem; }
.cg-note { color: var(--brand); margin-left: .1rem; }
.cg td.cg-ok { background: color-mix(in srgb, #2f8f5b 16%, var(--card)); }
.cg td.cg-part { background: color-mix(in srgb, #e3b341 22%, var(--card)); }
.cg td.cg-none { background: color-mix(in srgb, #8a94a6 14%, var(--card)); }
.cg-key { padding: .05rem .4rem; border-radius: 4px; }
.cg-key.cg-ok { background: color-mix(in srgb, #2f8f5b 16%, var(--card)); }
.cg-key.cg-part { background: color-mix(in srgb, #e3b341 22%, var(--card)); }
.cg-key.cg-none { background: color-mix(in srgb, #8a94a6 14%, var(--card)); }
.cg-onsite { min-width: 120px; max-width: 180px; }
.cg-staff { position: relative; }
.cg-staff > summary { list-style: none; cursor: pointer; overflow: hidden; text-overflow: ellipsis; padding: .2rem .3rem; border-radius: 4px; border: 1px solid transparent; }
.cg-staff > summary::-webkit-details-marker { display: none; }
.cg-staff > summary:hover { border-color: var(--line); }
.cg-staffmenu { position: absolute; z-index: 10; top: calc(100% + 2px); left: 0; width: 230px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: .5rem; display: grid; gap: .2rem; white-space: normal; }
.cg-staffmenu label.check { display: flex; gap: .4rem; align-items: center; font-weight: 400; }
.cg-staffmenu input[type=checkbox] { width: auto; }
.cg-other { display: grid; gap: .15rem; margin-top: .3rem; }
.cg td.cg-saved { animation: cgSaved 1.2s ease-out; }
.cg td.cg-err { box-shadow: inset 0 0 0 2px var(--danger); }
@keyframes cgSaved { from { background: color-mix(in srgb, #2f8f5b 35%, var(--card)); } }
.cg-legend { margin-top: .5rem; }
@media (max-width: 760px) {
  .cg-wrap { max-height: none; }
  .cg .cg-s1 { position: static; } .cg .cg-s2 { position: static; }
  .cg .cg-s3 { left: 0; width: 170px; min-width: 170px; max-width: 170px; }
  .cg-span { margin-left: 0; width: 100%; }
}
.timeoff-form { margin-bottom: 1rem; }
.timeoff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem 1rem; }
.opscard { margin-bottom: 1rem; }
.opsgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem 1rem; margin: .4rem 0 0; }
.opsgrid dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.opsgrid dd { margin: 0; }
.opsequip { margin: .7rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
/* Calendar dates: a short label ("Sun Apr 4"); clicking it opens the date picker of the hidden date box under it */
.cg-dt { position: relative; display: block; min-width: 86px; }
.cg-dtbtn { all: unset; box-sizing: border-box; display: block; width: 100%; padding: .2rem .3rem; border: 1px solid transparent; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.cg-dtbtn:hover { border-color: var(--line); }
.cg-dtbtn.empty { color: var(--muted); }
.cg-dtin { position: absolute; inset: 0; opacity: 0; pointer-events: none; width: 100%; }
.cg-dt:focus-within .cg-dtbtn { border-color: var(--brand); }
.cg td { padding: .1rem .3rem; }
.cg-in, .cg-qty { padding: .15rem .3rem; }
.colcode { width: 7rem; } .colsort { width: 5rem; }
/* Calendar grid: tighter rows */
.cg td { padding: 0 .3rem; }
.cg-in, .cg-qty, .cg-dtbtn, .cg-staff > summary { padding-top: .1rem; padding-bottom: .1rem; }
.cg select.cg-in { padding-top: .05rem; padding-bottom: .05rem; }
.cg thead th { padding: .35rem .4rem; }
.cg tr.cg-month th { padding: .2rem .5rem; top: 31px; }
.cg .cg-in, .cg .cg-qty { min-height: 0 !important; height: 1.75rem !important; line-height: 1.2; }
.cg input[type=checkbox].cg-in { height: auto; }
.cg-dtbtn, .cg-staff > summary { line-height: 1.3; }
.cg .cg-staff > summary { margin: 0; }

/* ---- Event tasks: To-do card, Event tasks page, task page ---- */
.tk-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.tk-list { list-style: none; margin: 0; padding: 0; }
.tk-item { display: flex; align-items: center; gap: .65rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.tk-list .tk-item:first-child { border-top: 0; }
.tk-check { margin: 0; display: contents; }
.tk-box { width: 1.25rem; height: 1.25rem; min-height: 0; flex: none; padding: 0; border: 2px solid var(--line); border-radius: 5px; background: var(--card); color: #fff; font-size: .8rem; line-height: 1; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tk-box:hover { border-color: var(--brand); }
.tk-box.on { background: var(--brand); border-color: var(--brand); }
.tk-box.tk-ro { cursor: default; }
.tk-main { flex: 1 1 auto; min-width: 0; }
.tk-title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.tk-done .tk-title, .tk-g-done .tk-title { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.tk-meta { display: flex; flex-wrap: wrap; gap: .25rem .75rem; font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.tk-late .tk-due { color: var(--err-ink); font-weight: 600; }
.tk-today .tk-due { color: var(--brand); font-weight: 600; }
.tk-people { display: flex; align-items: center; gap: .2rem; flex: 0 1 auto; min-width: 0; }
.tk-av { width: 1.5rem; height: 1.5rem; font-size: .7rem; margin-left: -.3rem; box-shadow: 0 0 0 2px var(--card); }
.tk-av:first-child { margin-left: 0; }
.tk-ini { font-size: .6rem; font-weight: 700; letter-spacing: -.02em; }
.tk-names { margin-left: .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
.tk-done { margin-top: .5rem; }
.tk-done > summary { cursor: pointer; margin: 0; }
.tk-add { margin-top: .75rem; }
.tk-add > summary { list-style: none; display: inline-flex; margin: 0; }
.tk-add > summary::-webkit-details-marker { display: none; }
.tk-add[open] > summary { display: none; }
.tk-form { display: grid; gap: .6rem; margin-top: .5rem; }
.tk-formrow { display: flex; gap: .6rem; flex-wrap: wrap; }
.tk-formrow label { display: grid; gap: .2rem; }
.tk-formrow .tk-grow { flex: 1 1 240px; }
.tk-pick { display: flex; flex-wrap: wrap; gap: .25rem 1rem; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .75rem .55rem; margin: 0; }
.tk-pick legend { font-size: .85rem; padding: 0 .3rem; }
.tk-pick .check { margin: 0; }
.tk-delete { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.tk-g-late h2 { color: var(--err-ink); }
.tk-filters select { flex: 0 1 170px; }
.tk-filters .tk-evsel { flex: 0 1 260px; }
.tk-mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.tk-mbody { color: var(--muted); margin-top: .1rem; }
.tk-donetitle { color: var(--muted); text-decoration: line-through; }
.tk-pill-late { background: var(--err-bg); color: var(--err-ink); border-color: transparent; }
.tk-pill-today { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.tk-notes { margin: .75rem 0 0; }
.tk-comments { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .9rem; }
.tk-comment { display: flex; gap: .65rem; align-items: flex-start; }
.tk-comment:target .tk-cbody { background: var(--brand-soft); }
.tk-cbody { flex: 1; min-width: 0; border-radius: 6px; padding: .1rem .3rem; }
.tk-chead { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; }
.tk-cact { margin-left: auto; display: inline-flex; gap: .6rem; align-items: baseline; }
.tk-cact form { margin: 0; }
.tk-ctext { margin-top: .15rem; overflow-wrap: anywhere; }
.tk-mention { color: var(--brand); font-weight: 600; }
.tk-cform { display: grid; gap: .5rem; }
.tk-count { display: inline-block; min-width: 2.2rem; padding: 0 .35rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.tk-count.late { background: var(--err-bg); color: var(--err-ink); }
.tk-count.all { background: var(--ok-bg); color: var(--ok-ink); }
.tk-count.none { background: none; color: var(--muted); }
@media (max-width: 640px) {
  .tk-item { flex-wrap: wrap; }
  .tk-people { flex-basis: 100%; padding-left: 1.9rem; }
  .tk-names { max-width: none; }
}
/* Event task categories: palette colours (index stored on the category) */
.tk-cat { display: inline-block; font-size: .72rem; font-weight: 600; padding: 0 .45rem; border-radius: 99px; line-height: 1.5; white-space: nowrap; color: #fff; }
.tk-cat.tk-dot { width: .65rem; height: .65rem; padding: 0; vertical-align: middle; }
.tkc-0 { background: #2f80ed; } .tkc-1 { background: #27ae60; } .tkc-2 { background: #e8833a; } .tkc-3 { background: #9b51e0; }
.tkc-4 { background: #eb5e9b; } .tkc-5 { background: #1f9fb4; } .tkc-6 { background: #c0392b; } .tkc-7 { background: #8a94a6; }
.tk-cathead { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: .9rem 0 .15rem; display: flex; align-items: center; gap: .4rem; }
.tk-cathead:first-of-type { margin-top: .3rem; }
/* Event Planner card: one table of the event's tasks with filters */
.tk-tfilters { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; margin: .5rem 0 .4rem; }
.tk-tfilters label { display: flex; flex-direction: column; gap: .15rem; font-size: .75rem; color: var(--muted); font-weight: 600; }
.tk-tfilters select { min-width: 9rem; }
.tk-tfilters [data-tk-shown] { margin-left: auto; align-self: center; }
.tk-table td { vertical-align: middle; }
.tk-table .tk-tickcol { width: 1%; padding-right: 0; }
.tk-table .tk-check { margin: 0; }
.tk-table .tk-nowrap { white-space: nowrap; width: 1%; }
.tk-table .tk-people { display: inline-flex; flex-wrap: nowrap; gap: 0; }
.tk-tmeta { display: inline-flex; gap: .5rem; margin-left: .5rem; font-size: .75rem; }
.tk-st { font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--brand-soft); color: var(--text); }
.tk-st-late { background: var(--err-bg); color: var(--err-ink); }
.tk-st-today { background: var(--warn-bg); color: var(--warn-ink); }
.tk-st-done { background: transparent; color: var(--ok-ink); }
/* Event tasks page: one table per section, same column widths in each so they line up */
@media (min-width: 900px) {
  .tk-fixed { table-layout: fixed; }
  .tk-fixed .tk-tickcol { width: 2.75rem; }
  .tk-fixed .tk-c-event { width: 24%; } .tk-fixed .tk-c-cat { width: 11rem; } .tk-fixed .tk-c-due { width: 7.5rem; }
  .tk-fixed .tk-c-who { width: 7.5rem; } .tk-fixed .tk-c-st { width: 6.5rem; }
  .tk-fixed td { overflow: hidden; text-overflow: ellipsis; }
  .tk-fixed .tk-nowrap { width: auto; }
}
.tk-by { display: flex; gap: .4rem; align-items: center; margin: -.4rem 0 1rem; flex-wrap: wrap; }
.tk-by .chip { flex-direction: row; padding: .2rem .65rem; font-size: .85rem; }
.tk-by .chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tk-cattable input[name^="name_"] { width: auto; min-width: 14rem; display: inline-block; }
.tk-sort { width: 5rem; }
.tk-newcat { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .8rem .7rem; margin: 1rem 0; }
/* Event task checklists (templates) */
.tk-tpllist { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .45rem; }
.tk-newtpl { align-items: flex-end; margin: 0; }
.tk-newtpl label { display: grid; gap: .2rem; }
.tk-tplform { display: grid; gap: .75rem; }
.tk-tplname { display: grid; gap: .2rem; max-width: 420px; font-weight: 600; }
.tk-tplitem { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 8px; }
.tk-tplitem label { display: grid; gap: .2rem; font-size: .85rem; }
.tk-tplnew { border-style: dashed; }
.tk-tplwhen { display: grid; gap: .2rem; font-size: .85rem; }
.tk-tplwhenrow { display: flex; gap: .35rem; align-items: center; }
.tk-tplwhenrow select { width: auto; }
.tk-days { width: 4.2rem; }
.tk-tpltitle { flex: 1 1 260px; }
.tk-tplitem select { width: auto; max-width: 100%; }
.tk-tplitem > label:not(.tk-tpltitle):not(.tk-tplnotes):not(.tk-tplsort):not(.tk-tplremove) { flex: 0 1 190px; }
.tk-tplsort { flex: 0 0 5.5rem; }
.tk-tplnotes { flex: 1 1 100%; }
.tk-tplitem label.tk-tplremove { display: flex; align-items: center; gap: .35rem; }
.tk-addrow { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.tk-apply { display: flex; gap: .4rem; align-items: center; margin: 0; }
.tk-apply select { width: auto; max-width: 260px; }
.tk-addrow + .tk-add { margin-top: .5rem; }

/* Event tasks: a task's checklist, and the event's plan page */
.tk-chk { white-space: nowrap; }
.tk-chk.all { color: var(--brand); }
.tk-checks { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .1rem; }
.tk-ck { display: flex; align-items: center; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.tk-ck:last-child { border-bottom: 0; }
.tk-ck.on .tk-cktitle { text-decoration: line-through; color: var(--muted); }
.tk-cktitle { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tk-ckedit { flex: 1; display: flex; gap: .4rem; align-items: center; margin: 0; }
.tk-ckedit input { flex: 1; min-width: 0; }
.tk-ckadd { display: flex; gap: .5rem; align-items: flex-start; margin: 0; }
.tk-ckadd textarea { flex: 1; min-height: 2.3rem; resize: vertical; }
.tk-planform { display: grid; gap: .35rem; }
.tk-planrow { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 8px; }
.tk-planrow label { margin: 0; }
.tk-planrow select, .tk-planrow input[type=date] { width: auto; max-width: 100%; }
.tk-plannew { border-style: dashed; }
.tk-plannew .tk-plantitle input { border-style: dashed; }
.tk-plandone .tk-plantitle input { text-decoration: line-through; color: var(--muted); }
.tk-plantitle { flex: 1 1 260px; display: flex; }
.tk-plantitle input { width: 100%; }
.tk-planinfo { white-space: nowrap; }
.tk-planremove { flex: 0 0 auto; min-width: 5.5rem; display: flex; align-items: center; gap: .3rem; }
.tk-ppl { position: relative; flex: 0 1 220px; min-width: 0; }
.tk-ppl summary { list-style: none; cursor: pointer; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.tk-ppl summary::-webkit-details-marker { display: none; }
.tk-ppl summary::after { content: ' ▾'; color: var(--muted); }
.tk-ppl[open] summary { border-color: var(--brand); }
.tk-pplmenu { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 220px; max-height: 300px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .15); padding: .4rem .6rem; display: grid; gap: .15rem; }
.tk-pplmenu .check { margin: 0; white-space: nowrap; }
.tk-sticky { position: sticky; bottom: 0; background: var(--card); padding: .6rem 0 .2rem; margin-top: .4rem; z-index: 5; }
.tk-planapply { flex-wrap: wrap; margin-top: 1rem; }
@media (max-width: 640px) {
  .tk-ppl { flex: 1 1 100%; }
  .tk-pplmenu { right: 0; }
}

/* Cards with an Edit button (event page): the button sits top right; open, the form replaces the details */
.card.hasedit { position: relative; }
.cardedit > summary { position: absolute; top: 1rem; right: 1rem; list-style: none; }
.cardedit > summary::-webkit-details-marker { display: none; }
.cardedit[open] > summary::before { content: "Cancel"; }
.cardedit[open] > summary { background: var(--card, #fff); color: inherit; border-color: var(--line); }
.cardedit[open] > summary { font-size: 0; }
.cardedit[open] > summary::before { font-size: .85rem; }
.card.hasedit:has(> .cardedit[open]) > .cardview { display: none; }
.editform { display: flex; flex-direction: column; gap: .9rem; margin-top: .6rem; }
.editform fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem .7rem; margin: 0; }
.editform .tk-pick { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.editform .tk-pick .field { flex: 1 1 100%; }
.opsplan { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* Folding cards (event page): closed by default so the Event Planner gets the room; a summary line shows when closed */
.cardfold > summary.foldhead { display: flex; align-items: baseline; gap: .75rem; cursor: pointer; list-style: none; padding-right: 5.5rem; }
.cardfold > summary.foldhead::-webkit-details-marker { display: none; }
.cardfold > summary.foldhead h2 { margin: 0; }
.cardfold > summary .foldsum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cardfold > summary .foldtoggle::after { content: "Show ▾"; font-size: .8rem; color: var(--brand); white-space: nowrap; }
.cardfold[open] > summary .foldtoggle::after { content: "Hide ▴"; }
.cardfold[open] > summary .foldsum { visibility: hidden; }
.cardfold[open] > summary.foldhead { margin-bottom: .4rem; padding-right: 0; }
.cardfold[open] > summary .foldtoggle { margin-right: 4.5rem; }
details.card.opscard, details.card.cardfold { margin-bottom: 1rem; }

/* Support settings: messages by show */
.showintro { border-top: 1px solid var(--line); padding: .5rem 0; }
.showintro > summary { cursor: pointer; }
.showintro > summary.btn { display: inline-flex; list-style: none; margin-top: .3rem; }
.showintro > summary.btn::-webkit-details-marker { display: none; }
.showintro .showintro-peek { margin-left: .4rem; }
.showintro form { margin-top: .6rem; }

/* Payment schedules: the invoice editor and the group's default */
.schedtable td { vertical-align: middle; }
.schedtable input[name$="[amount]"] { max-width: 9rem; }
.paywhen { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.paywhen .paywhen-days { width: 4.5rem; }
.paywhen select { width: auto; }
.schedview td { vertical-align: middle; }

/* One-click badge printing on an attendee's record */
.badgequick { display: inline-flex; align-items: center; gap: .3rem; }
.badgequick .inlinepop > summary { padding-left: .55rem; padding-right: .55rem; }
.bq-msg { margin-right: .3rem; }
.bq-msg[data-state="failed"] { color: var(--danger, #b3261e); }
.bq-msg[data-state="done"] { color: var(--ok, #1a7f37); font-weight: 600; }

/* Event products and prices: the event picker shows the whole event name */
.filters.pricepick select { flex: 0 1 420px; }

/* Support ticket: status as buttons */
.statusbtns { display: flex; flex-wrap: wrap; gap: .35rem; }
