/* 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: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; }
.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; }

/* 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); border-radius: 4px 4px 0 0; }
.bar .in { background: var(--purple-2); }
.bar .in.top { border-radius: 4px 4px 0 0; }
.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); }
.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); }

/* 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; }
  .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; } }
