[hidden] { display: none !important; } /* the hidden attribute always wins over display: grid/flex */
/* KCL Client Portal: palette from kcltd.es / kcl.cloud */
:root {
  --purple: #5b2d8e; --purple-2: #6551a4; --deep: #2a1450; --pink: #e890c2; --gold: #c9a227;
  --lav: #f4eefb; --lav-2: #ece3f7; --line: #e0d8ea; --line-2: #eee8f4; --bg: #f7f4fb;
  --ink: #1a1033; --muted: #4a3d66; --good-bg: #e3f4ea; --good: #1d5c38; --bad-bg: #fde7e9; --bad: #8a1c24; --gold-bg: #fbf3d6; --gold-ink: #5c4a05;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 'PT Sans', system-ui, sans-serif; }
h1, h2, h3 { font-family: Raleway, system-ui, sans-serif; margin: 0; line-height: 1.25; }
h1 { font-size: 28px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
a { color: var(--purple); } a:hover { color: var(--deep); }
.muted { color: var(--muted); } .small { font-size: 13px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 10; }

/* Header */
.top { background: var(--deep); color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: Raleway; font-weight: 700; font-size: 18px; flex: 1 1 200px; }
.brand:hover { color: #fff; }
.top a { color: #f4eefb; }
.top form { margin: 0; }
.top select { min-height: 40px; }
.areas { display: flex; gap: 14px; font-size: 14px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--pink); color: var(--deep); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.banner { background: var(--gold-bg); color: var(--gold-ink); padding: 10px 20px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.banner form { margin: 0; }

/* Layout */
.wrap { display: flex; flex-wrap: wrap; gap: 24px; padding: 24px; max-width: 1360px; margin: 0 auto; }
.side { flex: 1 1 200px; max-width: 240px; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.nav a:hover { background: var(--lav); }
.nav a.on { background: var(--lav-2); color: var(--deep); font-weight: 700; }
.nav .ic, .nav-toggle .ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a .ic { color: var(--purple-2); }
.nav a.on .ic { color: var(--deep); }
.nav-toggle { display: none; }
.nav .count { margin-left: auto; min-width: 22px; height: 22px; border-radius: 11px; background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
details.menu > summary { display: none; }

/* Cards, tables, badges */
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.tight { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--purple); color: var(--ink); }
.tile .big { font-family: Raleway; font-size: 28px; font-weight: 700; margin: 4px 0; }
.stat .k { font-size: 13px; color: var(--muted); } .stat .v { font-size: 24px; font-weight: 700; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 700; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr.hi td { background: var(--gold-bg); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--lav); color: var(--deep); white-space: nowrap; }
.badge.gold { background: var(--gold-bg); color: var(--gold-ink); } .badge.good { background: var(--good-bg); color: var(--good); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--lav); font-size: 12px; margin: 2px 4px 2px 0; color: var(--deep); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.secret { background: var(--gold-bg); border: 1px dashed var(--gold); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--gold-ink); }
.note { background: var(--lav); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.ok { background: var(--good-bg); color: var(--good); border-radius: 8px; padding: 10px 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 0; background: var(--purple); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--deep); color: #fff; }
.btn.ghost { background: #fff; color: var(--purple); border: 1px solid #c9b8e0; }
.btn.ghost.danger { color: var(--bad); border-color: #e7b9be; }
.btn.ghost.danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn.ghost:hover { background: var(--lav); color: var(--deep); }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; white-space: nowrap; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--purple); font: inherit; text-decoration: underline; cursor: pointer; }
input[type=text], input[type=search], input[type=url], input[type=email], input[type=number], input[type=date], input[type=time], input[type=month], select, textarea { font: inherit; font-size: 15px; border: 1px solid #c9b8e0; border-radius: 8px; padding: 0 12px; color: var(--ink); background: #fff; width: 100%; height: 44px; }
textarea { height: auto; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--purple-2); outline-offset: 1px; border-color: var(--purple-2); }
input[type=date], input[type=time], input[type=month] { font-family: inherit; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator, input[type=month]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.7; }
select { appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b2d8e' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
label.f.inline { flex-direction: row; align-items: center; gap: 8px; height: 44px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: end; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label.f { min-width: 140px; }
/* Colour field: swatch picker plus the hex code, kept in sync by app.js */
.colour { display: flex; gap: 8px; align-items: center; }
.colour input[type=color] { width: 52px; height: 44px; padding: 3px; border: 1px solid #c9b8e0; border-radius: 8px; background: #fff; cursor: pointer; flex: none; }
.colour input[type=text] { font-family: ui-monospace, monospace; }
/* Avatars */
.avatar.img { overflow: hidden; background: var(--lav); border-radius: 50%; padding: 0; }
.avatar.img img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 34px; height: 34px; flex: none; }
.bar.link { cursor: pointer; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
legend { padding: 0 6px; font-weight: 700; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
/* File pickers look like the other fields: same box, with a small ghost-style "Choose file" button inside. */
input[type=file] { font: inherit; font-size: 15px; color: var(--muted); border: 1px solid #c9b8e0; border-radius: 8px; background: #fff; width: 100%; height: 44px; padding: 0 6px 0 4px; display: flex; align-items: center; cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; font-size: 14px; font-weight: 700; color: var(--purple); background: var(--lav); border: 1px solid #c9b8e0; border-radius: 6px; height: 34px; padding: 0 12px; margin: 4px 10px 4px 0; cursor: pointer; }
input[type=file]:hover::file-selector-button { background: #e9dff6; color: var(--deep); }
input[type=file]:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.earn-select { width: auto; min-width: 84px; height: 36px; font-size: 14px; }
.memb-table { width: 100%; border-collapse: collapse; margin: 4px 0 0; }
.memb-table th, .memb-table td { text-align: left; vertical-align: top; padding: 8px 8px 8px 0; border-bottom: 1px solid #eee6f6; }
.memb-table .checks { gap: 4px 14px; }
.memb-table select { height: 36px; font-size: 14px; }
.memb-removing-note { display: none; color: #9a3412; }
.memb-row.removing .memb-detail { opacity: 0.35; pointer-events: none; }
.memb-row.removing strong { text-decoration: line-through; }
.memb-row.removing .memb-removing-note { display: block; }
.memb-table select[data-memb-company] { min-width: 200px; }

/* "What we offer" panels and tiles for sections with nothing in them yet */
.card.offer { background: linear-gradient(135deg, #fff 0%, var(--lav) 100%); border-style: dashed; }
.card.offer h2 { margin-bottom: 6px; }
.card.offer p { margin: 0 0 12px; max-width: 70ch; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.offer-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 24px; margin: 0 0 14px; max-width: 980px; }
.offer-cats dt { font-family: Raleway, sans-serif; font-weight: 700; font-size: 14px; color: var(--purple, #5b2d8e); }
.offer-cats dd { margin: 2px 0 0; font-size: 14px; }
.form-grid .f.wide, .form-grid p.wide { grid-column: 1 / -1; }
.row-btns input[type=file] { flex: 1 1 240px; }
.tile-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted, #6b6480); }
.tile-label .ic { width: 20px; height: 20px; flex: none; color: var(--purple); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile.offer .tile-label .ic { color: #a08cc8; }
.tile.offer { border-style: dashed; background: linear-gradient(135deg, #fff 0%, var(--lav) 100%); }

/* Ticket messages from Zendesk (cleaned HTML) */
.msg-html { margin-top: 6px; overflow-wrap: anywhere; }
.msg-html p, .msg-html div { margin: 0 0 8px; }
.msg-html p:empty { display: none; }
.msg-html img { display: block; max-width: min(100%, 640px); height: auto; margin: 8px 0; border: 1px solid #eee6f6; border-radius: 8px; }
.msg-html table { border-collapse: collapse; max-width: 100%; display: block; overflow-x: auto; }
.msg-html td, .msg-html th { border: 1px solid #eee6f6; padding: 4px 8px; }
.msg-html blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid #e5daf2; color: #555; }

/* Pop-up forms (Add user, Add client, ...) */
dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(820px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); color: var(--ink); background: #fff; box-shadow: 0 24px 60px rgba(42, 20, 80, 0.35); overflow: auto; }
dialog.modal::backdrop { background: rgba(42, 20, 80, 0.45); backdrop-filter: blur(2px); }
dialog.modal:not([open]):target { display: block; position: static; margin: 16px auto; } /* without JavaScript */
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 16px 24px; border-bottom: 1px solid #eee6f6; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-close { width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: var(--purple); font-size: 28px; line-height: 1; cursor: pointer; }
.modal-close:hover, .modal-close:focus-visible { background: var(--lavender, #f4eefb); }
.modal-body { padding: 20px 24px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid #eee6f6; margin-top: 4px; padding-top: 16px; }
@media (max-width: 720px) {
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .modal-body { padding: 16px; }
}
.toggle { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.toggle a { min-height: 36px; padding: 6px 14px; border: 1px solid #c9b8e0; border-radius: 999px; text-decoration: none; color: var(--ink); background: #fff; }
.toggle a.on { background: var(--purple); color: #fff; border-color: var(--purple); }

/* Hours chart (bars drawn with CSS; each bar is a link with a tooltip and an accessible label) */
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 240px; margin-top: 16px; border-bottom: 1px solid #c9b8e0; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; padding: 4px 2px 0; border-radius: 8px; text-decoration: none; color: var(--ink); }
.bar:hover, .bar.sel { background: var(--lav); color: var(--ink); }
.bar .val { font-size: 12px; font-weight: 700; }
.bar .col { position: relative; width: 34px; max-width: 70%; display: flex; flex-direction: column; gap: 2px; }
.bar .over { background: var(--gold); }
.bar .payg { background: #e890c2; }
.bar .over.cap, .bar .payg.cap { border-radius: 4px 4px 0 0; }
.bar .in { background: var(--purple-2); }
.bar .in.cap { border-radius: 4px 4px 0 0; } /* not "top": that is the page header class */
.bar .avail { position: absolute; left: -8px; right: -8px; border-top: 2px dashed var(--deep); }
.labels { display: flex; gap: 6px; margin-top: 6px; } .labels div { flex: 1; text-align: center; font-size: 13px; color: var(--muted); }
/* Client Hours: a period can cross contract terms; mark where a new term (or the contract) starts. */
.bar.starts { position: relative; }
.bar.starts::before { content: ''; position: absolute; left: -4px; top: 0; bottom: 0; border-left: 2px dashed #c9b8e0; }
.labels .term-note { display: block; font-size: 11px; color: var(--purple-2); font-weight: 700; }
/* More than 12 months: narrower columns, values in the hover text only. */
.chart.many { gap: 3px; } .chart.many .bar { padding: 4px 0 0; } .chart.many .val { display: none; } .chart.many .bar .col { width: 70%; }
.labels.many { gap: 3px; } .labels.many div { font-size: 11px; min-width: 0; overflow: hidden; }
.progress { height: 12px; background: var(--line-2); border-radius: 6px; overflow: hidden; } .progress > div { height: 12px; background: var(--purple-2); }
.timeline { display: flex; height: 10px; background: var(--lav); border-radius: 5px; overflow: hidden; margin: 8px 0 0; }

/* Ticket conversation */
.msg { border-top: 1px solid var(--line-2); padding-top: 12px; } .msg:first-child { border-top: 0; padding-top: 0; }
.msg.kcl .who { color: var(--purple); }
#latest { scroll-margin-top: 16px; }

/* Timer */
.timerbar { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 24px; }
.timerbar .inner { max-width: 1360px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.clock { font-family: Raleway; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Landing */
.hero { background: var(--deep); color: #fff; position: relative; overflow: hidden; isolation: isolate; }
.hero svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero .in { max-width: 1200px; margin: 0 auto; padding: 56px 24px 80px; display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(34px, 5vw, 52px); }
.btn.light { background: #fff; color: var(--deep); } .btn.light:hover { background: var(--lav); color: var(--deep); }
.btn.outline { background: transparent; color: #fff; border: 1px solid #c9b8e0; }
.features { max-width: 1200px; margin: 0 auto; padding: 48px 24px; display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.footer { border-top: 1px solid var(--line); padding: 20px 24px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; font-size: 14px; color: var(--muted); }

/* Phones: sidebar becomes a menu button; tables become stacked rows where marked */
@media (max-width: 720px) {
  .wrap { padding: 16px; gap: 16px; }
  .side { max-width: none; flex-basis: 100%; }
  details.menu > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 700; list-style: none; }
  details.menu > summary::-webkit-details-marker { display: none; }
  details.menu:not([open]) .nav { display: none; }
  details.menu[open] .nav { margin-top: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
  h1 { font-size: 24px; }
  table.stack-sm thead { display: none; }
  table.stack-sm tr { display: block; border-bottom: 1px solid var(--line-2); padding: 8px 0; }
  table.stack-sm td { display: block; border: 0; padding: 2px 4px; }
  table.stack-sm td[data-l]::before { content: attr(data-l) ': '; color: var(--muted); font-size: 13px; }
  .chart { height: 200px; } .bar .col { width: 22px; }
  .chart .bar, .labels div { min-width: 0; } .chart.mid .val, .chart.many .val { display: none; } .chart.mid, .chart.many, .labels.mid, .labels.many { gap: 2px; } .labels.mid div { font-size: 11px; }
  .top { padding: 10px 14px; }
}

/* Logo and landing illustration */
img.logo { display: block; flex: none; }
.portal-illus { flex: 1 1 340px; max-width: 480px; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(10, 0, 30, 0.45); overflow: hidden; transform: rotate(-2deg); }
.pi-top { background: var(--lav); padding: 10px 14px; display: flex; gap: 6px; } .pi-top span { width: 10px; height: 10px; border-radius: 50%; }
.pi-body { display: flex; gap: 14px; padding: 16px; }
.pi-nav { width: 70px; display: flex; flex-direction: column; gap: 10px; } .pi-nav i { height: 10px; border-radius: 5px; background: var(--line-2); } .pi-nav i.on { background: var(--lav-2); }
.pi-main { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.pi-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .pi-tiles i { height: 46px; border-radius: 8px; border: 1px solid var(--line); }
.pi-chart { display: flex; align-items: flex-end; gap: 8px; height: 110px; border-bottom: 1px solid var(--line); padding: 0 6px; }
.pi-chart b { flex: 1; background: var(--purple-2); border-radius: 4px 4px 0 0; } .pi-chart b.light { background: #c9b8e0; }
.pi-chart b.split { background: linear-gradient(var(--gold) 0 18%, #fff 18% calc(18% + 2px), var(--purple-2) calc(18% + 2px)); }
.pi-lines { display: flex; flex-direction: column; gap: 8px; } .pi-lines i { height: 10px; border-radius: 5px; background: var(--line-2); }
@media (max-width: 720px) { .portal-illus { display: none; } }

/* Month + year picker */
fieldset.monthyear { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.monthyear legend { padding: 0; font-weight: 400; font-size: 14px; margin-bottom: 4px; }
.monthyear-row { display: flex; gap: 6px; }
.monthyear-row select:first-child { width: 150px; } .monthyear-row select:last-child { width: 100px; }
.filters > .btn, .filters > button { flex: none; }

/* ---------- Desktop app shell: fixed header and side menu; only the content scrolls ---------- */
@media (min-width: 721px) {
  body.shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body.shell > .top, body.shell > .banner, body.shell > .timerbar { flex: none; }
  body.shell > .wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-wrap: nowrap; gap: 0; padding: 0; max-width: none; margin: 0; }
  body.shell .side { flex: none; width: 248px; max-width: none; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; background: #fff; border-right: 1px solid var(--line); padding: 16px 12px; transition: width .15s ease; }
  body.shell .main { flex: 1 1 auto; overflow-y: auto; padding: 28px 32px 56px; scroll-padding-top: 16px; }
  body.shell .main > * { flex-shrink: 0; }
  body.shell .main > p { max-width: 90ch; }
  body.shell .timerbar .inner { max-width: none; }
  .nav-toggle:not([hidden]) { display: flex; align-items: center; gap: 10px; margin-top: auto; min-height: 44px; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
  .nav-toggle:hover { background: var(--lav); color: var(--ink); }
  .nav-toggle .ic { transition: transform .15s ease; }
  /* Icons only */
  body.nav-mini .side { width: 72px; padding-left: 10px; padding-right: 10px; }
  body.nav-mini .nav a, body.nav-mini .nav-toggle { justify-content: center; padding: 0; }
  body.nav-mini .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  body.nav-mini .nav .count { position: absolute; margin: -22px -26px 0 0; min-width: 18px; height: 18px; font-size: 11px; }
  body.nav-mini .nav a { position: relative; }
  body.nav-mini .nav-toggle .ic { transform: scaleX(-1); }
}
@media (prefers-reduced-motion: reduce) { body.shell .side, .nav-toggle .ic { transition: none; } }
@media print {
  body.shell { height: auto; overflow: visible; display: block; }
  body.shell .side, body.shell > .top, .skip { display: none; }
  body.shell .main { overflow: visible; padding: 0; }
}

/* ---------- Landing: photographic background (built by design/make-landing-bg.py) ----------
   The image's left edge fades to solid --deep, so the picture is pinned to the right and the text sits on plain colour.
   Height: keeps the text left of the first icon in the image (icon's left edge = 2.21 x height from the right edge),
   and keeps the whole page (hero + features + footer) within one screen. */
.hero.photo { background-color: var(--deep); background-repeat: no-repeat; background-size: auto 100%; background-position: right center;
  background-image: url('/static/landing-bg-1440.jpg');
  background-image: image-set(url('/static/landing-bg-1440.webp') type('image/webp'), url('/static/landing-bg-1440.jpg') type('image/jpeg')); }
.hero.photo .in { max-width: none; margin: 0; box-sizing: border-box; padding: 20px clamp(24px, 4vw, 64px);
  height: clamp(350px, min(calc((100vw - 570px) / 2.21), calc(100vh - 300px)), 600px);
  height: clamp(350px, min(calc((100vw - 570px) / 2.21), calc(100dvh - 300px)), 600px); }
.hero.photo h1 { font-size: clamp(28px, 1.6vw + 14px, 46px); line-height: 1.12; margin: 0; }
.hero-text .logo { width: 44px; height: 44px; }
.hero-text { flex: 0 1 500px; display: flex; flex-direction: column; gap: 12px; text-shadow: 0 1px 12px rgba(20, 8, 40, 0.6); }
.hero-text .lead { font-size: 18px; margin: 0; color: #f4eefb; }
@media (min-width: 1601px) {
  .hero.photo { background-image: url('/static/landing-bg-2400.jpg');
    background-image: image-set(url('/static/landing-bg-2400.webp') type('image/webp'), url('/static/landing-bg-2400.jpg') type('image/jpeg')); }
}
/* Narrower desktops: the text overlaps the picture, so put a wash behind it. */
@media (min-width: 721px) and (max-width: 1365px) {
  .hero.photo { background-size: cover, auto 100%; background-position: left top, right center;
    background-image: linear-gradient(90deg, rgba(42, 20, 80, 0.92) 0, rgba(42, 20, 80, 0.8) 440px, rgba(42, 20, 80, 0) 680px), url('/static/landing-bg-1440.jpg');
    background-image: linear-gradient(90deg, rgba(42, 20, 80, 0.92) 0, rgba(42, 20, 80, 0.8) 440px, rgba(42, 20, 80, 0) 680px), image-set(url('/static/landing-bg-1440.webp') type('image/webp'), url('/static/landing-bg-1440.jpg') type('image/jpeg')); }
}
@media (max-width: 720px) {
  .hero.photo { background-size: cover; background-position: 80% center;
    background-image: linear-gradient(rgba(42, 20, 80, 0.74), rgba(42, 20, 80, 0.88)), url('/static/landing-bg-960.jpg');
    background-image: linear-gradient(rgba(42, 20, 80, 0.74), rgba(42, 20, 80, 0.88)), image-set(url('/static/landing-bg-960.webp') type('image/webp'), url('/static/landing-bg-960.jpg') type('image/jpeg')); }
  .hero.photo .in { height: auto; padding: 40px 20px 48px; }
}

/* Landing feature icons: echo the circled icons in the hero image */
.landing-features { padding-top: 28px; padding-bottom: 28px; }
.landing-features h3 { margin: 0 0 6px; }
.landing-features p { margin: 0; }
.feat-ic { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; margin-bottom: 12px;
  background: radial-gradient(circle at 35% 30%, var(--purple-2), var(--deep)); box-shadow: 0 0 0 4px var(--lav-2), 0 6px 16px rgba(91, 45, 142, 0.28); color: #fff; }
.feat-ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Ticket attachments ---------- */
.attach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.attach-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.attach-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.attach-btn:focus-within { outline: 3px solid var(--pink); outline-offset: 2px; }
.attach .ic, .att-file .ic, .attach-chosen .ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attach-chosen { list-style: none; margin: 0; padding: 0; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.attach-chosen:empty { display: none; }
.attach-chosen li { display: inline-flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--lav); font-size: 14px; }
.attach-chosen li.err { background: var(--bad-bg); color: var(--bad); border-color: transparent; padding: 6px 12px; border-radius: 8px; }
.attach-chosen button { border: 0; background: none; cursor: pointer; min-width: 32px; min-height: 32px; border-radius: 50%; color: var(--muted); font-size: 18px; line-height: 1; }
.attach-chosen button:hover { background: var(--lav-2); color: var(--ink); }
form.dragging { outline: 2px dashed var(--purple-2); outline-offset: 4px; background: var(--lav); }
.att-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.att-thumb img { display: block; max-width: 200px; max-height: 140px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.att-file { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; font-size: 14px; }
.att-file small { display: block; font-size: 12px; }
a.att-file:hover { border-color: var(--purple-2); }
.att-file.blocked { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.filters label.f.grow { flex: 1 1 240px; }

/* ---------- Header: company switcher, name, photo; account menu (click the photo) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.company-switch select { min-height: 40px; padding: 0 32px 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.35); background-color: rgba(255, 255, 255, 0.08); color: #fff; font: inherit; font-size: 15px; }
.company-switch select option { color: var(--ink); background: #fff; }
.company-name { color: #e0d8ea; }
.acct { position: relative; }
.acct > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 4px 4px 12px; border-radius: 999px; cursor: pointer; user-select: none; }
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary:hover, .acct[open] > summary { background: rgba(255, 255, 255, 0.1); }
.acct > summary:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.acct[open] > summary .avatar { box-shadow: 0 0 0 2px var(--deep), 0 0 0 4px var(--pink); }
.acct-name { font-size: 14px; color: #f4eefb; }
.acct-panel { position: absolute; right: 0; top: calc(100% + 10px); z-index: 50; width: 310px; max-width: calc(100vw - 24px); padding: 8px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(20, 8, 40, 0.25); }
.acct-who { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.acct-who .avatar { width: 44px; height: 44px; font-size: 15px; flex: none; }
.acct-who .small { overflow-wrap: anywhere; }
.acct-sec { padding: 8px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.top .acct-item { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.top .acct-item:hover { background: var(--lav); color: var(--ink); }
.top .acct-item.on { background: var(--lav-2); font-weight: 700; }
.acct-item.on span:last-child { color: var(--purple-2); }
.top .acct-out { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.acct-panel form { margin: 0; }
@media (max-width: 720px) {
  .acct-name, .company-name { display: none; }
  .company-switch select { max-width: 52vw; }
}

/* ---------- Apps: grid for staff, tiles, and "Open in" links on client pages ---------- */
.app-tile { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: 0.02em; }
.app-tile.sm { width: 22px; height: 22px; border-radius: 5px; font-size: 10px; }
.app-group { display: flex; flex-direction: column; gap: 10px; }
.app-group-title { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-family: inherit; }
.app-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.app-card { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.app-card:hover { border-color: var(--purple-2); box-shadow: 0 4px 14px rgba(91, 45, 142, 0.12); color: var(--ink); }
.app-card:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.app-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.app-text .small { overflow-wrap: anywhere; }
.app-note { margin-top: 2px; }
.ext { color: var(--muted); font-size: 14px; }
.title-row { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.open-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
.open-in-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.open-in a { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px 0 7px; background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 14px; text-decoration: none; }
.open-in a:hover { border-color: var(--purple-2); color: var(--ink); }
@media (max-width: 720px) { .open-in { justify-content: flex-start; margin-left: 0; } }

/* ---------- Excel-style column sort and filter (public/grid.js, tables with data-grid) ---------- */
tr.grid-out { display: none !important; }
th.grid-th { padding: 0; }
.grid-btn { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 6px; width: 100%; padding: 10px 8px; cursor: pointer; font: inherit; font-weight: 600; color: inherit; border-radius: 6px; }
.grid-btn:hover { background: var(--lav); }
.grid-btn:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; }
.grid-ic { width: 16px; height: 16px; flex: none; opacity: .45; background: no-repeat center / 14px 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%235b2d8e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.grid-btn:hover .grid-ic { opacity: 1; }
.grid-btn.sorted .grid-ic, .grid-btn.filtered .grid-ic { opacity: 1; }
.grid-btn.sorted[data-dir="asc"] .grid-ic { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 13V3M4 7l4-4 4 4' fill='none' stroke='%235b2d8e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.grid-btn.sorted[data-dir="desc"] .grid-ic { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3v10M4 9l4 4 4-4' fill='none' stroke='%235b2d8e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.grid-btn.filtered { color: var(--purple); }
.grid-btn.filtered .grid-ic { background-color: var(--lav-2); border-radius: 4px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 3h12l-4.5 5.5V13l-3-1.5v-3z' fill='%235b2d8e'/%3E%3C/svg%3E"); }
.grid-info { display: flex; align-items: center; gap: 4px; margin: 0 0 8px; color: var(--muted); }
.grid-menu { position: absolute; z-index: 1000; width: 280px; max-width: calc(100vw - 16px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(42, 20, 80, .18); padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 400; color: var(--ink); }
.grid-sort { display: flex; flex-direction: column; border-bottom: 1px solid var(--line-2); padding-bottom: 6px; }
.grid-sort button { all: unset; cursor: pointer; padding: 8px; border-radius: 6px; }
.grid-sort button:hover, .grid-sort button:focus-visible { background: var(--lav); }
.grid-menu .grid-search { width: 100%; }
.grid-list { max-height: 240px; overflow: auto; border: 1px solid var(--line-2); border-radius: 6px; padding: 4px; }
.grid-list label, .grid-all { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 4px; cursor: pointer; }
.grid-list label:hover { background: var(--lav); }
.grid-list label[hidden] { display: none; }
.grid-list input, .grid-all input { width: 16px; height: 16px; min-height: 0; margin: 0; flex: none; accent-color: var(--purple); }
.grid-list span:first-of-type { flex: 1; overflow-wrap: anywhere; }
.grid-n { color: var(--muted); font-size: 12px; }
.grid-foot { display: flex; gap: 6px; align-items: center; }
@media (max-width: 720px) {
  /* Phones: tables stack, so show the column buttons as a wrapped row of chips above the rows. */
  table.stack-sm[data-grid] thead { display: block; }
  table.stack-sm[data-grid] thead tr { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0 0 8px; }
  table.stack-sm[data-grid] thead th { display: block; border: 0; padding: 0; }
  table.stack-sm[data-grid] thead th:not(.grid-th) { display: none; }
  table.stack-sm[data-grid] .grid-btn { width: auto; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
}

/* Totals row (tfoot) */
tfoot td { font-weight: 700; border-top: 2px solid var(--line); white-space: nowrap; }
@media (max-width: 720px) {
  table.stack-sm tfoot tr { border-bottom: 0; }
  table.stack-sm tfoot td:empty { display: none; }
}

/* Read-only fields (e.g. markup while a manual price is set) look inactive but keep the standard field size */
input[readonly] { background: var(--line-2, #f4f4f4); color: var(--muted); }

/* Compact pop-out timer */
.pipc { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.pipc-row { display: flex; align-items: center; gap: 10px; }
.pipc-clock { font-size: 22px; font-variant-numeric: tabular-nums; flex: none; }
.pipc-what { flex: 1 1 auto; min-width: 0; }
.pipc-what strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipc-ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipc .btn { flex: none; }
.pipc-more > summary { cursor: pointer; color: var(--muted); padding: 2px 0; }
.pipc-more[open] > summary { margin-bottom: 6px; }
.pipc-col, .pipc-more form { display: flex; flex-direction: column; gap: 6px; }
.pipc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pipc label.f { gap: 2px; }
.pipc .linkbtn { align-self: flex-start; }

/* Staff Reports: chart columns share the table's grid, so each column sits above its month. */
.filters-group { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.report { width: 100%; }
.report th, .report td { min-width: 66px; padding-left: 6px; padding-right: 6px; }
.report th, .report td { text-align: center; }
.report th:first-child, .report td:first-child { min-width: 160px; text-align: left; }
.report .chart-row td { height: 220px; vertical-align: bottom; padding: 0 3px; border-bottom: 1px solid #c9b8e0; background: none; }
.report .chart-row td.axis { vertical-align: top; padding-top: 8px; }
.report .chart-row .bar { height: 220px; padding-top: 6px; }
.report td.sel, .report th.sel { background: #f4eefb; }
.report tbody td.sel { font-weight: 700; }
.report tfoot td { font-weight: 700; border-top: 2px solid #c9b8e0; }
.bar .col.stack { gap: 0; width: 34px; flex: none; }
.bar .seg { display: block; width: 100%; box-sizing: border-box; border-top: 1px solid #fff; }
.bar .seg.cap { border-radius: 4px 4px 0 0; }
@media (max-width: 720px) { .report th, .report td { min-width: 64px; } .report th:first-child, .report td:first-child { min-width: 130px; } }

/* Multi-select drop-down (tick boxes in a panel), styled like the other fields. */
.multi-select-field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; min-width: 220px; position: relative; }
.multi-select { position: relative; }
.multi-select > summary { list-style: none; cursor: pointer; height: 44px; display: flex; align-items: center; padding: 0 34px 0 12px; border: 1px solid #c9b8e0; border-radius: 8px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b2d8e' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center; font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi-select > summary::-webkit-details-marker { display: none; }
.multi-select[open] > summary, .multi-select > summary:focus-visible { outline: 2px solid var(--purple-2); outline-offset: 1px; border-color: var(--purple-2); }
.multi-panel { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 100%; max-width: 360px; max-height: 320px; overflow: auto; background: #fff; border: 1px solid #c9b8e0; border-radius: 8px; box-shadow: 0 8px 24px rgba(42, 20, 80, 0.15); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.multi-panel label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; white-space: nowrap; font-size: 15px; cursor: pointer; }
.multi-panel label:hover { background: var(--lav); }
.multi-panel input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--purple); }
.multi-actions { display: flex; justify-content: flex-end; padding: 2px 4px 6px; border-bottom: 1px solid #eee8f4; margin-bottom: 4px; }
.multi-group { padding: 8px 8px 2px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--purple); text-decoration: underline; cursor: pointer; font: inherit; font-size: 14px; }

/* Reports chart: scale lines, line chart and the hover card. */
.report .chart-row td { position: relative; }
.report .chart-row td.chart-cell:not(.total-col):hover { background: var(--lav); }
.report .chart-row .bar, .report .chart-row .bar:hover, .report .chart-row .bar.sel { background: transparent; position: relative; z-index: 1; }
.report .chart-row td.axis { vertical-align: top; }
.axis-caption { display: block; padding-top: 0; }
.gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(101, 81, 164, 0.2); z-index: 0; pointer-events: none; }
.tick-label { position: absolute; right: 10px; transform: translateY(50%); font-size: 11px; line-height: 1; color: var(--muted); white-space: nowrap; }
.lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.lines line { stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.dot { position: absolute; left: 50%; width: 10px; height: 10px; box-sizing: border-box; border-radius: 50%; border: 2px solid #fff; transform: translate(-50%, 50%); z-index: 3; pointer-events: none; }
.chart-tip { position: fixed; z-index: 60; min-width: 210px; max-width: 320px; padding: 10px 12px; background: #fff; border: 1px solid #c9b8e0; border-radius: 10px; box-shadow: 0 10px 28px rgba(42, 20, 80, 0.18); font-size: 13px; color: var(--ink); pointer-events: none; }
.chart-tip .tip-title { font-family: Raleway, sans-serif; font-weight: 700; font-size: 14px; color: var(--deep); margin-bottom: 6px; }
.chart-tip .tip-row { display: grid; grid-template-columns: 12px 1fr auto 38px; gap: 8px; align-items: center; padding: 2px 4px; margin: 0 -4px; border-radius: 4px; }
.chart-tip .tip-row .sw { margin: 0; width: 12px; height: 12px; }
.chart-tip .tip-row.on { background: var(--lav); font-weight: 700; }
.chart-tip .tip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-tip .tip-val { text-align: right; font-variant-numeric: tabular-nums; }
.chart-tip .tip-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-tip .tip-total { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 6px; border-top: 1px solid #eee8f4; font-weight: 700; }
.chart-tip .tip-hint { margin-top: 4px; font-size: 11px; color: var(--muted); }
.chart-tip .tip-total + .tip-sub { margin-top: 6px; }
.chart-tip .tip-sub { font-size: 12px; color: var(--muted); }
.chart-tip .sw.dash { height: 0; background: none; border-top: 2px dashed var(--deep); border-radius: 0; }
.chart-tip .tip-note { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--purple-2); }

/* Red bar on every page outside production (e.g. staging). */
.env-banner { background: #b3261e; color: #fff; padding: 8px 20px; font-size: 14px; text-align: center; line-height: 1.4; }
.env-banner a { color: #fff; text-decoration: underline; font-weight: 700; }
body.shell > .env-banner { flex: none; }
@media print { .env-banner { display: none; } }

/* Inside the KCL app in Microsoft Teams: Teams already shows the app's name and icon above the page, so the
   header is slimmer. */
body.in-teams .top { padding: 6px 16px; }
body.in-teams .brand { font-size: 15px; }
body.in-teams .brand .logo { width: 26px; height: 26px; }
