/* Data Collector portal. Brand colours come from the organisation's branding (--brand, --accent), set in _Layout. */
:root {
  --brand: #1F5F8B;
  --accent: #F2A541;
  --ink: #1d2733;
  --ink-2: #4a5868;
  --ink-3: #6b7886;
  --line: #dfe4ea;
  --bg: #f4f6f8;
  --card: #ffffff;
  --ok: #1b7a43;
  --ok-bg: #e5f5ec;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --err: #b42318;
  --err-bg: #fdecea;
  --info-bg: #e8f1f8;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
p { margin: .25rem 0 .75rem; }
code, pre { font-family: var(--mono); font-size: .85em; }
pre { background: #0f1720; color: #e6edf3; padding: 1rem; border-radius: var(--radius); overflow: auto; max-height: 480px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: .5rem; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: var(--mono); font-size: .85rem; }
.hidden { display: none !important; }
.inline { display: inline; }
.spacer { flex: 1; }

/* ---------- shell */
.topbar { display: flex; align-items: center; gap: 1rem; height: 56px; padding: 0 1.25rem; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 650; font-size: 1.05rem; }
.brand img { height: 32px; width: auto; border-radius: 4px; background: #fff; }
.org-name { opacity: .85; font-size: .9rem; border-left: 1px solid rgba(255,255,255,.35); padding-left: 1rem; }
.topbar-right { margin-left: auto; display: flex; gap: 1rem; align-items: center; font-size: .9rem; }
.topbar .link { color: #fff; }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 56px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 1rem .5rem; display: flex; flex-direction: column; gap: 2px; }
.sidebar a { padding: .5rem .75rem; border-radius: 6px; color: var(--ink-2); text-decoration: none; }
.sidebar a:hover { background: var(--bg); color: var(--ink); }
.sidebar a.active { background: var(--info-bg); color: var(--brand); font-weight: 600; }
.nav-heading { margin: 1rem .75rem .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.content { padding: 1.5rem 2rem 3rem; min-width: 0; }
.powered { text-align: center; font-size: .8rem; color: var(--ink-3); padding: 1rem; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .content { padding: 1rem; }
  .org-name { display: none; }
}

/* ---------- page header */
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumb { font-size: .85rem; color: var(--ink-3); margin-bottom: .25rem; }
.breadcrumb a { color: var(--ink-3); }

/* ---------- cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.kpi { padding: 1rem 1.25rem; }
.kpi .label { color: var(--ink-3); font-size: .85rem; }
.kpi .value { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.kpi .sub { font-size: .8rem; color: var(--ink-3); }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; background: #fafbfc; }
tr:hover td { background: #fafcfe; }
td.actions { white-space: nowrap; text-align: right; }
.empty { padding: 2rem; text-align: center; color: var(--ink-3); }

/* ---------- forms */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25rem; }
.field { margin-bottom: .9rem; }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: .8rem; margin-top: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time],
input[type=tel], input[type=search], input[type=url], input:not([type]), select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid #c7ced6; border-radius: 6px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); outline-offset: 0; }
textarea { min-height: 90px; resize: vertical; }
input[type=color] { width: 56px; height: 36px; padding: 2px; border: 1px solid #c7ced6; border-radius: 6px; background: #fff; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.check input { width: auto; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }
.row.row-top { align-items: flex-start; } /* fields with a hint under them: keep the inputs level */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 150px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .3rem; font-size: .9rem; }

/* ---------- buttons */
.btn, button.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border-radius: 6px; border: 1px solid #c7ced6;
  background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: #f3f5f7; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: #f0b6b0; }
.btn.danger:hover { background: var(--err-bg); }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }

/* ---------- pills and alerts */
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #eef1f4; color: var(--ink-2); white-space: nowrap; }
.pill-published, .pill-approved, .pill-active, .pill-complete, .pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-draft, .pill-submitted, .pill-trial { background: var(--info-bg); color: var(--brand); }
.pill-underreview, .pill-corrected, .pill-returned, .pill-invited, .pill-readonly, .pill-warning { background: var(--warn-bg); color: var(--warn); }
.pill-rejected, .pill-archived, .pill-deactivated, .pill-suspended, .pill-blocked, .pill-reached { background: var(--err-bg); color: var(--err); }
.alert { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.alert ul { margin: 0; padding-left: 1.2rem; }
.alert.ok { background: var(--ok-bg); border-color: #b5e2c6; color: #0f5130; }
.alert.err { background: var(--err-bg); border-color: #f5c2bd; color: #7a1a12; }
.alert.warn { background: var(--warn-bg); border-color: #f3d9a4; color: #5d3d00; }
.alert.info { background: var(--info-bg); border-color: #c4d9ea; color: #163a55; }

/* ---------- usage meters */
.usage-row { display: grid; grid-template-columns: 200px 1fr 110px auto; gap: .75rem; align-items: center; padding: .35rem 0; }
.meter { height: 8px; background: #e7ebef; border-radius: 999px; overflow: hidden; display: block; }
.meter > span { display: block; height: 100%; background: var(--brand); }
.usage-row.warning .meter > span { background: #d69100; }
.usage-row.reached .meter > span { background: var(--err); }
.usage-num { font-variant-numeric: tabular-nums; text-align: right; font-size: .9rem; }

/* ---------- tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button, .tabs a { background: none; border: 0; padding: .6rem .9rem; font: inherit; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 3px solid transparent; text-decoration: none; }
.tabs .active, .tabs [aria-selected=true] { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- login (split layout: brand panel + sign-in card) */
body.public { background: #fff; }
.public-main { min-height: calc(100vh - 44px); padding: 0; display: block; background: none; }
.auth { min-height: inherit; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-hero { position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(1200px 600px at 0% 0%, color-mix(in srgb, var(--brand) 85%, #fff) 0%, transparent 60%),
              linear-gradient(150deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 60%, #000) 100%); }
.auth-hero-inner { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; padding: 2.5rem clamp(1.5rem, 5vw, 4rem); }
.auth-brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.1rem; }
.auth-logo { width: 46px; height: 46px; border-radius: 12px; background: #fff; display: grid; place-items: center; padding: 5px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.auth-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.auth-pitch { margin: auto 0; max-width: 30rem; padding: 2rem 0; }
.auth-pitch h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 1rem; color: #fff; }
.auth-pitch p { color: rgba(255,255,255,.85); font-size: 1.02rem; margin: 0 0 2rem; }
.auth-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.auth-features li { display: flex; gap: .9rem; align-items: flex-start; }
.auth-features svg { flex: none; width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: rgba(255,255,255,.14); fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-features span { color: rgba(255,255,255,.85); font-size: .93rem; line-height: 1.4; }
.auth-features strong { display: block; color: #fff; font-size: 1rem; }
.auth-blob { position: absolute; border-radius: 50%; background: rgba(255,255,255,.07); z-index: 0; pointer-events: none; }
.auth-blob-1 { width: 420px; height: 420px; right: -140px; bottom: -120px; }
.auth-blob-2 { width: 220px; height: 220px; right: 18%; top: -90px; background: rgba(255,255,255,.06); }

.auth-panel { display: grid; place-items: center; padding: 2.5rem 1.25rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 2.25rem 2rem; box-shadow: 0 12px 40px rgba(16,24,40,.08); }
.auth-card h1 { font-size: 1.65rem; letter-spacing: -.01em; margin: 0 0 .35rem; }
.auth-card > .muted { margin: 0 0 1.5rem; }
.auth-card .field { margin-bottom: 1.05rem; }
.auth-card label { font-weight: 600; font-size: .88rem; }
.input-icon { position: relative; display: flex; align-items: center; margin-top: .35rem; }
.input-icon > svg { position: absolute; left: .85rem; width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.input-icon input { width: 100%; height: 46px; padding: 0 2.75rem 0 2.6rem; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: #fff; transition: border-color .15s, box-shadow .15s; }
.input-icon input::placeholder { color: #9aa5b1; }
.input-icon input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.input-icon input:focus ~ svg, .input-icon:focus-within > svg { stroke: var(--brand); }
.input-icon input[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 4px rgba(180,35,24,.1); }
.pw-toggle { position: absolute; right: .4rem; width: 36px; height: 36px; border: 0; background: none; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink-3); }
.pw-toggle:hover { background: var(--bg); }
.pw-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle.on { color: var(--brand); }
.caps-hint { color: var(--warn); font-weight: 600; }
.auth-org { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; margin-bottom: 1.05rem; border-radius: 12px; background: color-mix(in srgb, var(--brand) 8%, #fff); font-size: .92rem; }
.auth-org-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(27,122,67,.15); }
.auth-submit { width: 100%; height: 48px; justify-content: center; gap: .6rem; border-radius: 12px; font-size: 1rem; font-weight: 700; margin-top: .4rem; box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 30%, transparent); transition: transform .1s, box-shadow .15s; }
.auth-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px color-mix(in srgb, var(--brand) 35%, transparent); }
.auth-submit:disabled { opacity: .85; cursor: progress; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-help { margin: 1.25rem 0 0; text-align: center; font-size: .85rem; color: var(--ink-3); }
.auth-card .alert { border-radius: 12px; }
body.public .powered { color: var(--ink-3); background: var(--bg); border-top: 1px solid var(--line); }
body.public .powered a { color: var(--brand); }

/* tablets and phones: brand panel becomes a slim banner above the card */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero-inner { padding: 1.25rem 1.25rem 4.5rem; }
  .auth-pitch, .auth-blob-2 { display: none; }
  .auth-blob-1 { width: 260px; height: 260px; right: -90px; bottom: -150px; }
  .auth-panel { place-items: start center; padding: 0 1rem 2rem; margin-top: -3.25rem; background: none; position: relative; z-index: 2; }
  .auth-card { padding: 1.75rem 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } .auth-submit { transition: none; } }

/* ---------- label / value lists (submission details, etc.) */
dl.meta { display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: .55rem 1rem; margin: 0 0 1rem; font-size: .9rem; }
dl.meta dt { color: var(--ink-3); margin: 0; }
dl.meta dd { margin: 0; font-weight: 500; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
dl.meta dd .pill { margin-top: .3rem; }

/* ---------- submission detail */
.answers { display: grid; grid-template-columns: minmax(180px, 34%) 1fr; border-top: 1px solid var(--line); }
.answers > div { padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.answers .q { color: var(--ink-2); font-size: .9rem; }
.answers .a { font-weight: 500; word-break: break-word; }
.answers .section { grid-column: 1 / -1; background: #fafbfc; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.answers .repeat-row { grid-column: 1 / -1; padding: 0 0 0 1rem; border-left: 3px solid var(--line); }
.masked { color: var(--ink-3); letter-spacing: .1em; }
.diff-old { background: var(--err-bg); text-decoration: line-through; padding: 0 .2rem; }
.diff-new { background: var(--ok-bg); padding: 0 .2rem; }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.thumbs img { max-width: 180px; max-height: 140px; border-radius: 6px; border: 1px solid var(--line); }
#map, .map { height: 380px; border-radius: var(--radius); border: 1px solid var(--line); }

/* ---------- branding preview */
.preview-frame { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.preview-frame .pv-top { padding: .7rem 1rem; color: #fff; font-weight: 650; display: flex; align-items: center; gap: .5rem; }
.preview-frame .pv-top img { height: 26px; background: #fff; border-radius: 3px; }
.preview-frame .pv-body { padding: 1rem; }
.phone { width: 300px; max-width: 100%; height: 560px; border: 10px solid #1c232b; border-radius: 34px; overflow: hidden; background: #fff; display: flex; flex-direction: column; margin: 0 auto; }
.phone .pv-top {
  /* status-bar safe area + side padding so the title clears the frame's rounded corners */
  padding: 30px 22px 12px; border-radius: 0; color: #fff; font-weight: 650; font-size: 15px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
}
.phone .pv-top img { height: 22px; vertical-align: middle; margin-right: 6px; }
.phone .phone-body { flex: 1; overflow-y: auto; padding: .8rem; font-size: 14px; }
/* Inline field messages */
.hint.error-text, .error-text { color: #b42318; font-weight: 600; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #b42318; box-shadow: 0 0 0 3px rgba(180, 35, 24, .12); }


/* =====================================================================================================
   Modern theme (matches the sign-in page): branded gradient sidebar, light top bar, soft rounded cards.
   Placed last so it refines the base rules above without changing any page markup.
   ===================================================================================================== */
:root {
  --radius: 14px;
  --radius-sm: 10px;
  --bg: #f4f6fa;
  --line: #e4e8ee;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .10);
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
  --brand-dark: color-mix(in srgb, var(--brand) 62%, #000);
}
body.app { background: var(--bg); }
h1 { font-size: 1.6rem; letter-spacing: -.015em; }
h2 { font-size: 1.05rem; letter-spacing: -.005em; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- app shell */
.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.app-shell .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 1.1rem .85rem 1rem; gap: 2px; border: 0; color: #fff;
  background: radial-gradient(600px 400px at 0% 0%, color-mix(in srgb, var(--brand) 80%, #fff) 0%, transparent 65%),
              linear-gradient(170deg, var(--brand) 0%, var(--brand-dark) 100%); }
.app-shell .sidebar a.side-brand { display: flex; align-items: center; gap: .7rem; padding: .35rem .5rem 1.1rem; margin-bottom: .35rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.14); }
.side-logo { width: 42px; height: 42px; flex: none; border-radius: 12px; background: #fff; display: grid; place-items: center; padding: 4px; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.side-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.side-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.side-brand-text strong { font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-brand-text small { font-size: .7rem; letter-spacing: .08em; opacity: .75; font-weight: 600; }
.app-shell .nav-heading { margin: 1.1rem .65rem .35rem; font-size: .68rem; font-weight: 700; letter-spacing: .1em; color: rgba(255,255,255,.55); }
.app-shell .sidebar a.nav-link { display: flex; align-items: center; gap: .75rem; padding: .58rem .7rem; border-radius: 10px; color: rgba(255,255,255,.82); font-weight: 500; font-size: .93rem; text-decoration: none; transition: background .15s, color .15s; }
.app-shell .sidebar a.nav-link .ico { opacity: .85; }
.app-shell .sidebar a.nav-link:hover { background: rgba(255,255,255,.10); color: #fff; }
.app-shell .sidebar a.nav-link.active { background: #fff; color: var(--brand); font-weight: 650; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.app-shell .sidebar a.nav-link.active .ico { opacity: 1; }
.side-foot { margin-top: auto; padding: 1.25rem .65rem 0; font-size: .72rem; color: rgba(255,255,255,.5); }
.main-col { min-width: 0; display: flex; flex-direction: column; }

/* ---------- top bar */
.app-shell .topbar { position: sticky; top: 0; z-index: 30; height: 64px; padding: 0 1.75rem; gap: .75rem; color: var(--ink);
  background: color-mix(in srgb, #fff 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.app-shell .topbar a { color: inherit; }
.top-title { min-width: 0; }
.top-org { font-weight: 650; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: none; place-items: center; cursor: pointer; color: var(--ink-2); }
.user-menu { position: relative; }
.check.select-all { font-weight: 600; }
/* Notification bell (top bar) */
.notif-menu { position: relative; }
.notif-menu > summary { list-style: none; position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-2); }
.notif-menu > summary::-webkit-details-marker { display: none; }
.notif-menu > summary:hover, .notif-menu[open] > summary { border-color: #cfd6df; color: var(--brand); }
.notif-menu > summary .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #d93025; color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.notif-badge.hidden { display: none; }
.notif-panel { color: var(--ink); text-align: left; position: absolute; right: -60px; top: calc(100% + 8px); width: 380px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 45; overflow: hidden; }
.notif-head { display: flex; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.notif-markall { border: 0; background: none; color: var(--brand); font: inherit; font-size: .82rem; cursor: pointer; padding: 0; }
.notif-markall:hover { text-decoration: underline; }
.notif-list { max-height: min(460px, 70vh); overflow-y: auto; }
.notif-item { display: flex; gap: .7rem; padding: .75rem 1rem; border-bottom: 1px solid #f0f2f5; text-decoration: none; color: inherit; }
.notif-panel a.notif-item, .notif-panel a.notif-item:visited { color: var(--ink); text-decoration: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: color-mix(in srgb, var(--brand) 6%, #fff); }
.notif-item.unread:hover { background: color-mix(in srgb, var(--brand) 10%, #fff); }
.notif-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: .45rem; background: transparent; }
.notif-item.unread .notif-dot { background: var(--brand); }
.notif-item.sev-warning.unread .notif-dot { background: #d97706; }
.notif-item.sev-error.unread .notif-dot { background: #d93025; }
.notif-body { min-width: 0; flex: 1; }
.notif-body > span { display: block; }
.notif-title { font-weight: 600; font-size: .9rem; line-height: 1.35; }
.notif-text { font-size: .82rem; color: var(--ink-2); margin-top: .1rem; }
.notif-time { font-size: .75rem; color: var(--ink-3); margin-top: .2rem; }
.notif-empty { padding: 2rem 1rem; text-align: center; color: var(--ink-3); font-size: .9rem; }
@media (max-width: 600px) { .notif-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: .6rem; cursor: pointer; padding: .3rem .55rem .3rem .3rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { border-color: #cfd6df; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.user-name { font-weight: 600; font-size: .9rem; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-id { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.user-role { font-size: .72rem; font-weight: 500; color: var(--ink-3); max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-badge { align-self: flex-start; margin: .3rem 0 .15rem; padding: .1rem .55rem; border-radius: 999px; background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand-dark); font-size: .75rem !important; font-weight: 600; }
.chev { width: 16px; height: 16px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .4rem; z-index: 40; }
.menu-head { padding: .6rem .7rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; display: flex; flex-direction: column; }
.menu-head span { font-size: .8rem; color: var(--ink-3); }
.user-menu .menu a, .user-menu .menu button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .7rem; border: 0; background: none; border-radius: 10px; font: inherit; font-size: .9rem; color: var(--ink); text-decoration: none; cursor: pointer; }
.user-menu .menu a:hover, .user-menu .menu button:hover { background: var(--bg); }
.user-menu .menu button { color: var(--err); }
.app-shell .content { padding: 1.75rem 1.75rem 3rem; max-width: 1480px; width: 100%; }
.app-shell .powered { padding: 0 1.75rem 1.5rem; text-align: left; }

/* ---------- page header, cards, grids */
.page-head { margin-bottom: 1.5rem; }
.page-head p.muted { margin: .2rem 0 0; }
.card { border-radius: var(--radius); border-color: var(--line); box-shadow: var(--shadow); padding: 1.25rem 1.4rem; }
.card > h2:first-child { display: flex; align-items: center; gap: .5rem; }
.grid { gap: 1.1rem; }
.grid + .grid { margin-top: .1rem; }

/* ---------- tables */
table { background: transparent; }
th { background: #f8fafc; color: var(--ink-3); font-size: .72rem; letter-spacing: .07em; padding: .7rem .8rem; border-bottom: 1px solid var(--line); }
td { padding: .75rem .8rem; border-bottom-color: #eef1f5; }
thead th:first-child { border-top-left-radius: 10px; } thead th:last-child { border-top-right-radius: 10px; }
tbody tr { transition: background .12s; }
tr:hover td { background: #f7f9fc; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- forms */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time],
input[type=tel], input[type=search], input[type=url], input:not([type]), select, textarea {
  border-color: var(--line); border-radius: var(--radius-sm); padding: .6rem .8rem; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
label { color: var(--ink-2); }

/* ---------- buttons */
.btn, button.btn { border-radius: var(--radius-sm); border-color: var(--line); padding: .55rem 1rem; transition: background .15s, box-shadow .15s, transform .1s; }
.btn:hover { background: #f5f7fa; }
.btn.primary { box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 25%, transparent); }
.btn.primary:hover { filter: none; background: color-mix(in srgb, var(--brand) 88%, #000); transform: translateY(-1px); }
.btn.small { border-radius: 8px; padding: .32rem .65rem; }

/* ---------- pills and alerts */
.pill { padding: .18rem .6rem; font-size: .72rem; }
.alert { border-radius: 12px; }

/* ---------- mobile: off-canvas sidebar */
.side-scrim { display: none; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-shell .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); flex-direction: column; flex-wrap: nowrap; }
  body.nav-open .app-shell .sidebar { transform: none; }
  body.nav-open .side-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, .45); }
  .icon-btn { display: grid; }
  .app-shell .topbar { padding: 0 1rem; }
  .app-shell .content { padding: 1.1rem 1rem 2.5rem; }
  .user-name, .user-role, .chev { display: none; }
  .user-menu summary { padding: .25rem; }
}
@media (prefers-reduced-motion: reduce) { .app-shell .sidebar, .btn { transition: none; } }

/* ---------- dashboard */
.dash-hero { position: relative; overflow: hidden; border-radius: 18px; padding: 1.6rem 1.75rem; margin-bottom: 1.25rem; color: #fff;
  background: radial-gradient(700px 300px at 0% 0%, color-mix(in srgb, var(--brand) 78%, #fff) 0%, transparent 60%), linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; }
.dash-hero::after { content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; right: -90px; top: -150px; background: rgba(255,255,255,.08); }
.dash-hero h1 { color: #fff; font-size: 1.7rem; margin: 0; }
.dash-hero p { color: rgba(255,255,255,.85); margin: .3rem 0 0; }
.dash-hero .filters { margin: 0 0 0 auto; position: relative; z-index: 1; gap: .6rem; }
.dash-hero .filters label { color: rgba(255,255,255,.85); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.dash-hero .filters select { background: rgba(255,255,255,.95); border-color: transparent; min-width: 170px; }
/* Dashboard live status (automatic refresh) */
.live-status { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .5rem; margin-top: .7rem; padding: .25rem .35rem .25rem .7rem; border-radius: 999px; background: rgba(255,255,255,.16); color: #fff; font-size: .8rem; font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74,222,128,.7); animation: live-pulse 2s infinite; }
.live-status[data-state="error"] .live-dot { background: #fbbf24; animation: none; }
.live-status[data-state="new"] .live-dot { background: #a7f3d0; }
.live-refresh { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; cursor: pointer; padding: 0; }
.live-refresh:hover { background: rgba(255,255,255,.3); }
.live-refresh svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.live-refresh.spinning svg { animation: live-spin .8s linear infinite; }
.live-flash { animation: live-flash 1.6s ease-out; border-radius: var(--radius); }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.7); } 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
@keyframes live-spin { to { transform: rotate(360deg); } }
@keyframes live-flash { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 45%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .live-dot, .live-refresh.spinning svg, .live-flash { animation: none; } }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.1rem; margin-bottom: 1.1rem; }
.kpi-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.15rem 1.25rem; display: flex; gap: 1rem; align-items: flex-start; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .15s; }
a.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.kpi-ico .ico { width: 22px; height: 22px; }
.kpi-label { font-size: .82rem; color: var(--ink-3); font-weight: 600; }
.kpi-value { font-size: 1.9rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .8rem; color: var(--ink-3); margin-top: .15rem; }
.tone-brand .kpi-ico { background: var(--brand-soft); color: var(--brand); }
.tone-green .kpi-ico { background: #e7f6ee; color: #1b7a43; }
.tone-amber .kpi-ico { background: #fff3db; color: #9a6200; }
.tone-violet .kpi-ico { background: #efeafd; color: #6b4bd8; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.1rem; margin-bottom: 1.1rem; }
.card-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .9rem; }
.card-head h2 { margin: 0; }
.card-head .spacer + a, .card-head > a { font-size: .85rem; font-weight: 600; text-decoration: none; }
.chart-box { position: relative; height: 260px; }
.dash-grid #map { height: 300px; border-radius: 12px; }
.attention { display: grid; gap: .6rem; margin-bottom: 1.1rem; }
.attention .item { display: flex; gap: .75rem; align-items: center; padding: .8rem 1rem; border-radius: 12px; background: #fff7e6; border: 1px solid #f6dfae; color: #6a4500; font-size: .92rem; }
.attention .item .ico { color: #b07300; }
.person { display: flex; align-items: center; gap: .65rem; }
.person .avatar { width: 30px; height: 30px; font-size: .72rem; }
.person a { font-weight: 600; text-decoration: none; color: var(--ink); }
.person a:hover { color: var(--brand); }
.progress { display: flex; align-items: center; gap: .6rem; }
.progress .meter { flex: 1; height: 8px; background: #edf0f4; }
.progress .meter > span { border-radius: 999px; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #fff)); }
.progress b { font-size: .8rem; color: var(--ink-2); min-width: 2.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.device-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.device-list li { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem; border-radius: 12px; background: #fafbfd; border: 1px solid #eef1f5; }
.device-list .kpi-ico { width: 36px; height: 36px; border-radius: 10px; background: #fdecea; color: var(--err); }
.device-list .meta { flex: 1; min-width: 0; }
.device-list .meta strong { display: block; font-size: .92rem; }
.device-list .meta span { font-size: .8rem; color: var(--ink-3); }
.ok-state { display: flex; align-items: center; gap: .75rem; padding: 1.25rem; border-radius: 12px; background: #f1faf5; color: #1b7a43; font-weight: 600; }
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 960px) { .dash-grid { grid-template-columns: 1fr; } .dash-hero .filters { margin-left: 0; } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } .dash-hero { padding: 1.25rem; } .dash-hero .filters select { min-width: 0; } }
.dash-grid.wide-left { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.dash-grid .card { margin-bottom: 0; }
.person a, .person { white-space: nowrap; }
th { white-space: nowrap; }
.side-brand-text strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 960px) { .dash-grid.wide-left { grid-template-columns: 1fr; } }
@media (max-width: 960px) { .dash-grid, .dash-grid.wide-left { grid-template-columns: minmax(0, 1fr); } .kpis > * { min-width: 0; } }
@media (min-width: 420px) and (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-card { flex-direction: column; gap: .6rem; } }
/* Sign-in fields with an icon: keep room for the icon (and the show-password button) over the general input style. */
.input-icon input[type], .input-icon input:not([type]) { height: 46px; padding: 0 2.75rem 0 2.6rem; border-radius: 12px; }
.input-icon input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #fff inset; }

/* Match the mobile app: Roboto, card radius 16 / controls 12, title sizes from the app's theme. */
:root { --font: "Roboto", system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif; --radius: 16px; --radius-sm: 12px; }
body { font-family: var(--font); letter-spacing: .005em; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }   /* app: page titles 22-26 bold */
h2 { font-size: 1.05rem; font-weight: 600; }                         /* app: card titles 16 semibold */
.nav-heading, th { font-weight: 700; }                                /* app: SECTION TITLES, bold caps */
.btn, button.btn { font-weight: 600; letter-spacing: .01em; }
.kpi-value, .dash-hero h1 { font-weight: 700; }
.pill { font-weight: 600; }



/* Submissions filter bar: one grid, same label and control height, everything bottom-aligned. */
.filter-grid { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,1.6fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto auto; gap: .75rem 1rem; align-items: end; }
.filter-grid .field { min-width: 0; margin: 0; display: flex; flex-direction: column; }
.filter-grid .field > label:not(.check) { margin: 0 0 .35rem; line-height: 1.2; }
.filter-grid select, .filter-grid input[type="date"] { width: 100%; height: 44px; margin: 0; box-sizing: border-box; }
.filter-grid .field-check, .filter-grid .field-action { justify-content: flex-end; }
.filter-grid .field-check .check { height: 44px; display: flex; align-items: center; gap: .45rem; margin: 0; white-space: nowrap; }
.filter-grid .field-action .btn { height: 44px; padding: 0 1.4rem; }
@media (max-width: 1200px) { .filter-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } .filter-grid .field-check { justify-content: flex-end; } }
@media (max-width: 640px) { .filter-grid { grid-template-columns: 1fr 1fr; } .filter-grid .field-action .btn { width: 100%; } }
@media (max-width: 420px) { .filter-grid { grid-template-columns: 1fr; } }

/* Sign-in pages fill the whole window. Room for the bottom footer is kept only when there is one
   (an organisation's support email); otherwise it left an empty band under the split layout. */
.public-main { min-height: 100vh; }
body.public:has(footer.powered) .public-main { min-height: calc(100vh - 52px); }

/* Searchable dropdown (select[data-searchable]): looks like the other selects, list opens below. */
.combo { position: relative; }
.combo .combo-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.combo .combo-input { width: 100%; padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center; }
.combo-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .3rem; list-style: none;
  max-height: min(280px, 45vh); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--surface, #fff); border: 1px solid var(--line, #dfe3e8); border-radius: var(--radius-sm, 12px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .12); }
.combo-option { padding: .55rem .7rem; border-radius: 8px; cursor: pointer; line-height: 1.3; }
.combo-option.active { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.combo-option[aria-selected="true"] { font-weight: 600; color: var(--brand); }
.combo-empty { padding: .7rem; color: var(--ink-3, #64748b); font-size: .9rem; text-align: center; }
@media (pointer: coarse) { .combo-option { padding: .8rem .75rem; } } /* bigger touch targets on phones */

/* Password field with the show/hide eye button (same button as the sign-in page). */
.pw-field { position: relative; display: flex; align-items: center; }
.pw-field input { width: 100%; padding-right: 2.8rem; }
.pw-field .pw-toggle { right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 8px; }
.pw-field .pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
/* Eye when the password is hidden, crossed-out eye while it is shown. */
.pw-toggle .pw-slash { display: none; }
.pw-toggle.on .pw-slash { display: inline; }
.field .hint.field-error, .field-error { color: #b42318; }
.pw-field input[aria-invalid="true"] { border-color: #b42318; }

/* List toolbar: search box on the left, main action on the right (e.g. Organisations). */
.list-toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.search-box { position: relative; flex: 1 1 280px; display: flex; align-items: center; }
.search-box > svg { position: absolute; left: .85rem; width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.search-box input { width: 100%; padding-left: 2.5rem; }
.search-box:focus-within > svg { stroke: var(--brand); }
.btn-ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.list-count { margin: 0 0 .6rem; }
@media (max-width: 560px) { .list-toolbar .btn { width: 100%; justify-content: center; } }

/* Dialog (native <dialog>): header, scrolling body, footer with the buttons on the right. */
dialog.modal { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); color: var(--ink); box-shadow: 0 24px 60px rgba(15, 23, 42, .22); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in .16s ease-out; }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 34px); }
.modal-head { display: flex; align-items: flex-start; gap: 1rem; padding: 1.15rem 1.4rem .5rem; }
.modal-head h2 { margin: 0 0 .2rem; }
.modal-head .hint { margin: 0; }
.modal-x { margin-left: auto; flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--ink-3); cursor: pointer; }
.modal-x:hover { background: var(--bg); color: var(--ink); }
.modal-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.modal-body { padding: .6rem 1.4rem .4rem; overflow-y: auto; min-height: 0; }
.modal-body fieldset:last-child { margin-bottom: .4rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.4rem 1.15rem; border-top: 1px solid var(--line); }
@media (max-width: 560px) { .modal-head, .modal-body, .modal-foot { padding-left: 1rem; padding-right: 1rem; } .modal-foot .btn { flex: 1; justify-content: center; } }
.combo-list.combo-float { position: fixed; right: auto; z-index: 1000; }
.modal-foot .btn { white-space: nowrap; }

/* Plan picker (Create organisation): looks like a select; opens into a list of plans with their prices. */
.field > .label { display: block; font-weight: 600; font-size: .88rem; color: var(--ink-2); margin-bottom: .25rem; }
.plan-picker { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); transition: border-color .15s, box-shadow .15s; }
.plan-picker[open], .plan-picker:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.plan-picker > summary { list-style: none; display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; cursor: pointer; min-height: 44px; border-radius: var(--radius-sm); outline: none; }
.plan-picker > summary::-webkit-details-marker { display: none; }
.plan-picker-value { flex: 1; display: flex; align-items: baseline; gap: .75rem; min-width: 0; }
.plan-picker-value strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-picker-price { margin-left: auto; color: var(--ink-2); white-space: nowrap; }
.plan-picker-chev { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .22s cubic-bezier(.2, .7, .2, 1); }
.plan-picker.is-open .plan-picker-chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .plan-picker-chev { transition: none; } }
.plan-options { border-top: 1px solid var(--line); padding: .4rem; display: grid; gap: 2px; }
.plan-option { position: relative; display: flex; align-items: center; gap: 1rem; padding: .7rem .8rem; border-radius: 10px; cursor: pointer; margin: 0; font-weight: normal; color: var(--ink); }
.plan-option:hover { background: #f5f7fa; }
.plan-option:has(input:checked) { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.plan-option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: -2px; }
.plan-option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.plan-option-text { flex: 1; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.plan-option-text strong { font-weight: 600; }
.plan-option-price { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; text-align: right; white-space: nowrap; }
.plan-option-price strong { font-weight: 600; }
.plan-option-check { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.plan-option:has(input:checked) .plan-option-check { visibility: visible; }
.plan-price-line { margin: -.2rem 0 .8rem; font-weight: 600; color: var(--ink-2); }
@media (max-width: 480px) { .plan-option { gap: .6rem; padding: .65rem .6rem; } .plan-picker-value { flex-direction: column; gap: 0; } .plan-picker-price { margin-left: 0; } }

/* Pager under lists (client lists from site.js and server-paged lists from _Pager). */
.pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding-top: .85rem; margin-top: .25rem; border-top: 1px solid #eef1f5; }
.pager[hidden] { display: none; }
.pager-info { color: var(--ink-3); font-size: .85rem; }
.pager-btns { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.pager-btn { min-width: 36px; height: 36px; padding: 0 .65rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--ink-2); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.pager-btn:hover:not([disabled]):not(.current) { background: #f5f7fa; border-color: #cfd6de; }
.pager-btn.current { background: var(--brand); border-color: var(--brand); color: #fff; cursor: default; }
.pager-btn[disabled], .pager-btn.disabled { opacity: .45; cursor: default; pointer-events: none; }
.pager-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pager-gap { color: var(--ink-3); padding: 0 .15rem; }
.pager-btn.wide { padding: 0 .85rem; }
@media (max-width: 560px) { .pager { justify-content: center; } .pager-info { width: 100%; text-align: center; } }
[data-page-size] > [hidden], [data-filter-empty][hidden] { display: none !important; } /* list items on other pages stay hidden even when they set their own display */

/* Devices: Block and Wipe data are separate actions */
.device-actions { display: inline-flex; gap: .4rem; justify-content: flex-end; }
.device-actions form { margin: 0; }
.device-status { display: flex; flex-wrap: wrap; gap: .3rem; }

/* Plan & payments (Settings) and paid-until warnings */
.text-warn { color: var(--warn); font-weight: 600; }
.billing-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.billing-facts > div { background: var(--bg); border-radius: 10px; padding: .7rem .9rem; display: flex; flex-direction: column; gap: .1rem; }
.billing-facts span { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.billing-facts strong { font-size: 1.05rem; }
.billing-sub { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.billing-instructions { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; font-size: .92rem; }

/* On/off switch row (project settings: approve submissions automatically) */
.switch-row { display: flex; align-items: flex-start; gap: .75rem; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; margin: .4rem 0 .8rem; }
.switch-row > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-row .switch-ui { flex: 0 0 auto; position: relative; width: 40px; height: 22px; margin-top: 2px; border-radius: 999px; background: #c9d2dc; transition: background .15s; }
.switch-row .switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch-row > input:checked + .switch-ui { background: var(--brand); }
.switch-row > input:checked + .switch-ui::after { transform: translateX(18px); }
.switch-row > input:focus-visible + .switch-ui { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-row strong { display: block; }
.switch-row .hint { display: block; margin-top: .15rem; }
.project-settings .ps-waiting { margin: 0 0 .8rem; }
.project-settings .ps-waiting[hidden] { display: none; }

/* Daily email report: Save with its message on the right */
.dr-save { display: flex; align-items: center; gap: .6rem 1rem; margin-top: .6rem; flex-wrap: wrap; }
.dr-save .btn { flex: 0 0 auto; }
.dr-msg { flex: 1 1 auto; min-width: 0; font-size: .9rem; font-weight: 600; line-height: 1.35; }
.dr-msg.ok { color: var(--ok); }
.dr-msg.err { color: var(--err); }

.dr-time-row { align-items: flex-start; }
.dr-time-row .field { flex: 1 1 200px; margin-bottom: .2rem; }
.dr-time-hint { margin: 0 0 1rem; }
.dr-tz-note { margin: 0 0 .6rem; padding: .5rem .7rem; border-radius: 8px; background: #fff6e5; color: #7a4b00; }

/* Confirmation window (data-confirm), used instead of the browser's own confirm box */
dialog.modal.confirm-modal { width: min(460px, calc(100vw - 32px)); }
.confirm-modal .confirm-text { margin: 0; line-height: 1.5; color: var(--ink-2); white-space: pre-line; }
.btn.danger-solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); }

/* Users: a row in edit mode (Edit button) */
#user-rows tr.editing { background: color-mix(in srgb, var(--brand) 5%, #fff); }
#user-rows .u-edit { display: flex; flex-direction: column; gap: .35rem; min-width: 10rem; }
#user-rows .u-edit[hidden] { display: none; }
#user-rows td.actions .u-edit { flex-direction: row; flex-wrap: wrap; align-items: center; min-width: 0; }
#user-rows .u-edit input, #user-rows .u-edit select { width: 100%; padding: .35rem .5rem; font-size: .9rem; }
#user-rows td.actions .u-view { display: flex; gap: .4rem; justify-content: flex-end; }
#user-rows td.actions .u-view[hidden] { display: none; }
