/* Nexa Build: concrete-grey neutrals, ochre for "attention", ink-dark primary buttons.
   Layout: a menu on the left (it slides in on phones, with a bar at the bottom), a top bar with the site picker, then pages of stacked panels. */
:root {
  --bg: #EDEFF2; --surface: #FFFFFF; --sunk: #F4F5F7; --ink: #1B222C; --muted: #5B6575; --line: #D7DCE2;
  --accent: #C2841C; --on-accent: #1B222C;
  /* Links and soft backgrounds follow the accent, so a company's brand colour flows through. */
  --accent-ink: color-mix(in srgb, var(--accent) 70%, #000); --accent-bg: color-mix(in srgb, var(--accent) 14%, #fff);
  --primary: #1F2A37; --on-primary: #FFFFFF;
  --good: #2E7A4E; --good-bg: #E2F1E7; --warn: #93600A; --warn-bg: #F8ECD3; --bad: #B03A3A; --bad-bg: #F7E1DF; --info: #2C5C8A; --info-bg: #E2ECF6;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* One font everywhere: the phone's or computer's own, so headings look the same on every device and nothing is downloaded. */
  --font-head: var(--font);
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161B; --surface: #1A2028; --sunk: #151A21; --ink: #E5E9EE; --muted: #9AA4B2; --line: #2B333E;
    --accent: #E2A23E;
    --accent-ink: color-mix(in srgb, var(--accent) 62%, #fff); --accent-bg: color-mix(in srgb, var(--accent) 16%, #1A2028);
    --primary: #E5E9EE; --on-primary: #12161B;
    --good: #72C697; --good-bg: #183326; --warn: #E8B65C; --warn-bg: #382B13; --bad: #F08A80; --bad-bg: #3D1E1C; --info: #8AB8E6; --info-bg: #1B2B3D;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--font-head); font-weight: 700; font-size: 26px; line-height: 1.15; letter-spacing: -.015em; text-wrap: balance; }
h2 { font-family: var(--font-head); font-weight: 700; font-size: 19px; line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; }
h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
a { color: var(--accent-ink); }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.neg { color: var(--bad); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.boot { padding: 40px 16px; color: var(--muted); }

/* top bar and menu */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar-in { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; }
.brand svg { flex: none; }
.brand .bubble { fill: var(--accent); }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 17px; line-height: 1.1; letter-spacing: -.01em; }
.brand-co { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account { position: relative; }
.account summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--r); }
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: var(--sunk); }
.account .who { text-align: right; line-height: 1.2; }
.account .who b { display: block; font-size: 14px; }
.account .who span { font-size: 12px; color: var(--muted); }
.account-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px; min-width: 190px; display: flex; flex-direction: column; z-index: 20; }
.account-menu button { font: inherit; text-align: left; background: none; border: 0; color: var(--ink); padding: 9px 10px; border-radius: 4px; cursor: pointer; }
.account-menu button:hover { background: var(--sunk); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--accent-bg); color: var(--accent-ink); flex: none; }

.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }

/* app frame: a menu on the left on wide screens; on phones it slides in, and a bar at the bottom keeps the main places close */
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.ic.sm { width: 15px; height: 15px; vertical-align: -3px; }
.pill .ic.sm { width: 13px; height: 13px; vertical-align: -2px; }
.side { position: fixed; inset: 0 auto 0 0; width: 252px; max-width: 86vw; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; transform: translateX(-105%); transition: transform .2s ease; padding-top: env(safe-area-inset-top, 0px); }
.nav-open .side { transform: none; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.scrim { display: none; }
.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 35; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 12px 16px; border-bottom: 1px solid var(--line); min-height: 61px; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; overscroll-behavior: contain; }
.side-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 10px 4px; }
.side-gap { height: 10px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: var(--r); color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14.5px; position: relative; }
.side-link:hover { background: var(--sunk); color: var(--ink); }
.side-link.on { background: var(--accent-bg); color: var(--ink); font-weight: 600; }
.side-link.on::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-link.on .ic { color: var(--accent-ink); }
.side-link .badge { margin-left: auto; }
.side-foot { padding: 10px 18px calc(12px + env(safe-area-inset-bottom, 0px)); font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.main { min-width: 0; padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
.grow { flex: 1; }
.icon-btn .ic { width: 22px; height: 22px; }
.icon-btn { display: inline-grid; place-items: center; text-decoration: none; }
.top-brand { min-width: 0; display: flex; }
.site-pick { flex-direction: row; align-items: center; gap: 2px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 2px 0 10px; background: var(--sunk); min-width: 0; }
.site-pick select { border: 0; background: transparent; padding: 6px 4px; font-size: 14px; font-weight: 600; color: var(--ink); width: auto; max-width: 34vw; }
.bell { position: relative; color: var(--muted); }
.bell .dot, .bottombar .dot { position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; line-height: 1; }
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.bottombar a, .bottombar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; font: inherit; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; background: none; border: 0; position: relative; cursor: pointer; }
.bottombar .on { color: var(--accent-ink); }
.bottombar .ic { width: 22px; height: 22px; }
.bottombar .dot { top: 2px; right: calc(50% - 22px); }
.bottombar .bb-new .ic { background: var(--primary); color: var(--on-primary); border-radius: 50%; padding: 5px; width: 32px; height: 32px; margin-top: -8px; }
@media (min-width: 960px) {
  .side { transform: none; transition: none; max-width: none; }
  .side-close, .menu-btn, .top-brand, .scrim, .bottombar { display: none !important; }
  .main { margin-left: 252px; padding-bottom: 0; }
  .site-pick select { max-width: 320px; }
}
@media (max-width: 959px) { .page-head .new-menu { display: none; } }
@media (max-width: 560px) {
  .top-brand .brand-name, .top-brand .brand-co { display: none !important; }
  .topbar-in { gap: 6px; }
}
@media (max-width: 340px) { .top-brand { display: none; } }

/* dashboard */
.nudge { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.needs { display: flex; flex-direction: column; }
.need { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.need:first-child { border-top: 0; padding-top: 2px; }
.need:hover { background: var(--sunk); }
.need .rl-main { flex: 1; }
a.rl-main { color: inherit; text-decoration: none; }
.need .btn { flex: none; }
.need-ic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--sunk); color: var(--muted); }
.need-ic.bad { background: var(--bad-bg); color: var(--bad); }
.need-ic.warn { background: var(--warn-bg); color: var(--warn); }
.need-ic.info { background: var(--info-bg); color: var(--info); }
.all-clear { display: flex; align-items: center; gap: 8px; color: var(--good); font-weight: 600; }
.site-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.site-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; min-width: 0; }
.site-tile:hover { border-color: var(--muted); }
.warn-text { color: var(--warn); }
.new-menu summary { list-style: none; }
.new-menu summary::-webkit-details-marker { display: none; }
.account-menu button { display: flex; align-items: center; gap: 8px; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .btn { justify-content: flex-start; padding: 12px 14px; font-size: 15px; }

/* announcements */
.ann-banner { background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.ann-top { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); flex-wrap: wrap; }
.ann { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.ann.pinned { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: inset 3px 0 0 var(--accent); }
.ann.ended h2, .ann.ended .pre { color: var(--muted); }

/* roles and access */
.roles-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .roles-layout { grid-template-columns: 230px minmax(0, 1fr); } }
.role-list { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 899px) { .role-list { flex-direction: row; overflow-x: auto; padding-bottom: 4px; } .role-item { flex: none; } }
.role-item { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: var(--r); border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; }
.role-item:hover { background: var(--surface); }
.role-item.on { background: var(--surface); border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); }
.perms { display: flex; flex-direction: column; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.perm-label { display: flex; flex-direction: column; min-width: 190px; flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; max-width: 100%; }
.lvl { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; white-space: nowrap; }
.lvl:first-child { border-left: 0; }
.lvl:hover { color: var(--ink); }
.lvl.on.l0 { background: var(--sunk); color: var(--ink); }
.lvl.on.l1 { background: var(--info-bg); color: var(--info); }
.lvl.on.l2 { background: var(--warn-bg); color: var(--warn); }
.lvl.on.l3 { background: var(--good-bg); color: var(--good); }
@media (max-width: 480px) { .lvl { padding: 6px 7px; font-size: 12px; } }

/* people */
.people { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.person { display: flex; align-items: center; gap: 8px; }
.person > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.avatar.sm { width: 28px; height: 28px; font-size: 11.5px; }
.checks { display: grid; gap: 6px 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); max-height: 260px; overflow-y: auto; padding: 2px; }
.page { display: flex; flex-direction: column; gap: 16px; padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(48px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); max-width: 1120px; width: 100%; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; max-width: 65ch; }
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 6px; }
.crumb:hover { color: var(--ink); }

/* building blocks */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar select, .toolbar input { width: auto; padding: 6px 8px; font-size: 14px; }
.toolbar .grow { flex: 1; }
.empty { border: 1px dashed var(--line); border-radius: var(--r); padding: 18px; color: var(--muted); background: var(--surface); }
.empty.inline { background: transparent; padding: 12px; }

.btn { font: inherit; font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 5px; border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.small { padding: 5px 10px; font-size: 13px; font-weight: 500; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.link { font: inherit; font-size: 14px; background: none; border: 0; color: var(--accent-ink); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.icon-btn { font: inherit; font-size: 22px; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.plain { background: var(--sunk); color: var(--muted); }

.bar { display: block; height: 7px; background: var(--sunk); border-radius: 4px; overflow: hidden; min-width: 60px; flex: 1; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar.good i { background: var(--good); }
.bar.over i { background: var(--bad); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter .num { font-size: 12.5px; color: var(--muted); min-width: 36px; }

/* lists */
.list { display: flex; flex-direction: column; }
.row-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.row-link:last-child { border-bottom: 0; }
.row-link:hover { background: var(--sunk); }
.row-link > .rl-main { flex: 1; }
.rl-main { display: flex; flex-direction: column; min-width: 0; }
.rl-main .strong { overflow-wrap: anywhere; }
.rl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; }
.card:hover { border-color: var(--muted); }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }

/* tables */
.tbl { overflow-x: auto; min-width: 0; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num { text-align: right; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 600; }
td.text { min-width: 160px; }
/* Wide tables become one card per row on phones; cells with data-label show their column name. */
@media (max-width: 640px) {
  .cards-sm table, .cards-sm tbody, .cards-sm tr, .cards-sm td { display: block; }
  .cards-sm thead { display: none; }
  .cards-sm tr { padding: 12px 0; border-top: 1px solid var(--line); }
  .cards-sm tr:first-child { border-top: 0; padding-top: 0; }
  .cards-sm td { border: 0; padding: 3px 0; min-width: 0; text-align: left; }
  .cards-sm td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .cards-sm td.num:last-child:has(.btn) { padding-top: 8px; }
  .cards-sm.compact td[data-label] { display: inline-block; margin-right: 16px; }
  .cards-sm tfoot, .cards-sm tfoot tr { display: block; }
  .cards-sm tfoot td:empty { display: none; }
  .cards-sm td:first-child { font-weight: 600; }
  .cards-sm td.nil { display: none; }
}
td input { width: 100px; padding: 6px 8px; }
td input.wide { width: 140px; }

/* KPI tiles */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.kpi .label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi .val { font-family: var(--font-head); font-weight: 700; font-size: clamp(18px, 4.6vw, 22px); line-height: 1.2; letter-spacing: -.01em; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel .kpi { background: var(--sunk); border-color: transparent; }

/* tabs inside a project */
.subtabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { text-decoration: none; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 3px solid transparent; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.subtabs a.on { color: var(--ink); border-bottom-color: var(--accent); }

/* forms */
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.fields .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--muted); min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14.5px; }
label.check input { width: auto; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 9px 10px; min-width: 0; width: 100%; }
textarea { resize: vertical; min-height: 80px; }
input[readonly] { background: var(--sunk); }
.hint { color: var(--muted); font-size: 13px; max-width: 70ch; }
.form-err { color: var(--bad); font-size: 14px; }
.form-err:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.file-btn { cursor: pointer; }
.file-btn input { display: none; }

/* dialogs */
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 0; background: var(--surface); color: var(--ink); width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(10, 14, 20, .55); }
.modal-form { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
#lightbox { width: auto; max-width: calc(100vw - 24px); background: #0b0d10; border: 0; }
#lightbox img { display: block; max-width: calc(100vw - 24px); max-height: calc(100dvh - 80px); }
#lightbox .lb-bar { display: flex; justify-content: flex-end; padding: 6px; }
#lightbox .icon-btn { color: #fff; }

/* photos */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { padding: 0; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; width: 86px; height: 86px; background: var(--sunk); cursor: zoom-in; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.pending { cursor: default; }
.thumb .x { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; font-size: 14px; line-height: 1; cursor: pointer; }

/* site reports */
.report { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.report header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.report header > div { display: flex; flex-direction: column; min-width: 0; }
.report .issue { background: var(--warn-bg); color: var(--ink); padding: 8px 10px; border-radius: 5px; font-size: 14px; }
.report footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* discussion */
.thread { display: flex; flex-direction: column; gap: 12px; }
.thread-list { display: flex; flex-direction: column; gap: 14px; max-height: 560px; overflow-y: auto; padding-right: 4px; }
.msg { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
.msg-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.msg-head .when { font-size: 12px; color: var(--muted); }
.msg-body { margin-top: 2px; }
.msg .thumbs { margin-top: 6px; }
.msg.mine .avatar { background: var(--info-bg); color: var(--info); }
.composer { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.composer textarea { min-height: 60px; }
.composer-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.composer-row .thumbs { flex: 1; }

/* sign-in */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.auth-card .brand { margin-bottom: 4px; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--primary); color: var(--on-primary); padding: 10px 16px; border-radius: 6px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 50; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
td.d { white-space: nowrap; }
.outbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--warn-bg); color: var(--ink); font-size: 14px; border-bottom: 1px solid var(--line); padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); }
.brand-name { white-space: nowrap; }
@media (max-width: 560px) {
  .account .who { display: none; }
  .brand-co { max-width: 52vw; }
}
.brand-logo { height: var(--logo-h, 34px); max-width: calc(var(--logo-h, 34px) * 4); object-fit: contain; background: var(--logo-bg, #fff); border-radius: 5px; padding: 2px; flex: none; }
.brand.logo-only .brand-logo { max-width: 200px; }
.auth-card .brand-logo { height: calc(var(--logo-h, 34px) * 1.3); max-width: 100%; }
.top-brand .brand-logo { height: min(var(--logo-h, 34px), 40px); max-width: 140px; }
.logo-preview { max-height: 56px; max-width: 200px; background: #fff; border-radius: 6px; padding: 4px; border: 1px solid var(--line); display: inline-grid; place-items: center; min-height: 40px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; border: 1px solid var(--line); }
input[type=color] { padding: 2px; height: 42px; cursor: pointer; }
.powered { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--muted); }
.powered img { height: 16px; width: auto; display: block; }
.demo-box { border: 1px dashed var(--accent); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--accent-bg); }
/* help */
.help-topic summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.help-topic summary::-webkit-details-marker { display: none; }
.help-topic summary::after { content: "+"; font-size: 22px; color: var(--accent-ink); line-height: 1; }
.help-topic[open] summary::after { content: "\2013"; }
.help-body { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.help-body h3 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 16px; }
.help-body p { max-width: 68ch; }
.help-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 760px) { .help-grid { grid-template-columns: minmax(0, 1fr) 260px; } }
.help-shot { width: 100%; max-width: 260px; height: auto; border-radius: 18px; border: 1px solid var(--line); justify-self: center; display: block; }
.help-steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; max-width: 68ch; }
.help-faq { margin: 0; display: grid; gap: 4px; }
.help-faq dt { font-weight: 600; margin-top: 10px; }
.help-faq dd { margin: 0; color: var(--muted); max-width: 68ch; }

/* site team */
.team { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; align-items: center; }
.team dt { font-size: 13px; color: var(--muted); }
.team dd { margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.team .person > span:last-child { display: inline; }
@media (max-width: 520px) { .team { grid-template-columns: 1fr; gap: 4px; } .team dd { margin-bottom: 8px; } }
.team-pick + .team-pick { margin-top: 12px; }

/* report pages (weekly, monthly and other modules) */
.period-pick { flex-direction: row; align-items: center; gap: 4px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r); padding: 0 4px 0 10px; background: var(--surface); }
.period-pick select { border: 0; background: transparent; padding: 7px 4px; font-weight: 600; width: auto; }
.two-col { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
details.log > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
details.log > summary::-webkit-details-marker { display: none; }
details.log > summary::after { content: "+"; margin-left: auto; font-size: 22px; color: var(--accent-ink); line-height: 1; }
details.log[open] > summary::after { content: "\2013"; }
details.log:not([open]) { gap: 0; }
.print-head { display: none; }

/* paper: the monthly report (and any page) prints as a clean document, light, without the menus */
@media print {
  :root { --bg: #fff; --surface: #fff; --sunk: #f3f4f6; --ink: #111; --muted: #555; --line: #cfd4da; --accent-ink: #111; --accent-bg: #f3f4f6;
    --good: #1d5e3a; --good-bg: #e6f2ea; --warn: #7a4f06; --warn-bg: #f7eedb; --bad: #a12f2f; --bad-bg: #f6e3e1; --info: #234e78; --info-bg: #e3ecf6; color-scheme: light; }
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff; font-size: 10.5pt; }
  .side, .scrim, .topbar, .bottombar, #outbox-bar, .outbox-bar, .no-print, #toast, .crumb { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .page { padding: 0; max-width: none; gap: 10px; }
  .print-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 8px; text-align: right; }
  .panel, .kpi, tr { break-inside: avoid; }
  .tbl { overflow: visible; }
  a { color: inherit; text-decoration: none; }
  details > summary::after { display: none !important; }
  .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  td { padding: 6px 8px; }
  .log td[data-label="By"], .log td.d { white-space: nowrap; }
}

/* phones: slightly larger text, buttons easy to tap with a thumb, and form fields at 16px so iPhones do not zoom in */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .small, .crumb, .link, .hint { font-size: 14px; }
  h1 { font-size: 24px; }
  label { font-size: 14px; }
  label.check { font-size: 16px; min-height: 34px; }
  label.check input { width: 20px; height: 20px; flex: none; }
  .btn { min-height: 44px; padding: 10px 16px; font-size: 15px; justify-content: center; }
  .btn.small { min-height: 38px; padding: 7px 12px; font-size: 14px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .side-link { padding: 11px 10px; font-size: 16px; }
  .account-menu button { padding: 12px 10px; }
  .toolbar select, .toolbar input, .site-pick select, .period-pick select { font-size: 16px; }
  .lvl { padding: 9px 8px; font-size: 12.5px; }
  .kpi .label { font-size: 12px; }
  .bottombar a, .bottombar button { font-size: 11.5px; }
  .page { gap: 14px; padding-top: 16px; }
}
@media (max-width: 400px) {
  .panel { padding: 14px; }
  .need { gap: 10px; }
  .need-ic { width: 32px; height: 32px; border-radius: 8px; }
  /* the whole row opens it, so a small arrow replaces the button and leaves room for the text */
  a.need .btn { display: none; }
  a.need::after { content: "\203A"; font-size: 24px; line-height: 1; color: var(--muted); flex: none; }
}

/* automatic emails */
.auto-item { align-items: flex-start; }
.auto-item input { margin-top: 3px; }
.auto-item > span { display: flex; flex-direction: column; gap: 2px; }

/* documents made for paper (printSheet): a payroll to sign, a stock sheet to count */
#print-sheet { display: none; }
@page wide { size: A4 landscape; margin: 10mm; }
@media print {
  body.printing-sheet #root, body.printing-sheet #toast, body.printing-sheet dialog { display: none !important; }
  body.printing-sheet #print-sheet { display: block; }
  #print-sheet.landscape { page: wide; }
}
.sheet { color: #111; background: #fff; font-size: 10pt; line-height: 1.35; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 10px; }
.sheet-head .brand, .sheet-head .brand-co { color: #111; }
.sheet h1 { font-size: 17pt; letter-spacing: 0; }
.sheet .meta { font-size: 9pt; color: #333; }
.sheet .meta p + p { margin-top: 2px; }
.sheet h2 { font-size: 11pt; margin: 14px 0 6px; }
.sheet table { border-collapse: collapse; width: 100%; }
.sheet th, .sheet td, .sheet tbody tr:last-child td { border: 1px solid #888; padding: 4px 6px; font-size: 9pt; color: #111; vertical-align: top; }
.sheet th { background: #eceef1; text-transform: none; letter-spacing: 0; font-weight: 700; white-space: normal; }
.sheet tfoot td { font-weight: 700; border-top: 2px solid #111; }
.sheet td.blank { min-width: 80px; }
.sheet tr { break-inside: avoid; }
.sheet .note { font-size: 8.5pt; color: #444; margin-top: 8px; }
.sheet .signs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 28px 32px; margin-top: 34px; break-inside: avoid; }
.sheet .sign b { display: block; margin-bottom: 2px; font-size: 9.5pt; }
.sheet .sign p { display: flex; gap: 6px; align-items: flex-end; min-height: 26px; border-bottom: 1px solid #111; font-size: 9pt; margin: 0 0 4px; }
.sheet .sign p span { color: #444; flex: none; }
.page-tools { gap: 6px; }

/* logo background preview (Company settings → logo) */
.logo-try { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.logo-on { display: inline-grid; place-items: center; padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--line); }
.logo-on.light { background: #FFFFFF; }
.logo-on.dark { background: #1A2028; }
.logo-on { display: inline-flex; align-items: center; gap: 10px; }
.logo-on .brand-name { font-weight: 700; font-size: 15px; }
.logo-on.light .brand-name { color: #1B222C; }
.logo-on.dark .brand-name { color: #E5E9EE; }
.icon-preview { width: 56px; height: 56px; border-radius: 14px; border: 1px solid var(--line); }
.logo-try .hint { flex-basis: 100%; }
