/* Equipixel Teleradiology - interface styles
   Self-hosted, no external dependencies. Calm clinical palette, dense but
   readable tables, and forms that stay usable on a laptop in a stable yard. */

:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --surface-3: #eaeff3;
  --border: #dbe2e8;
  --border-strong: #c3ced7;
  --text: #1b2733;
  --text-soft: #5b6b7a;
  --text-faint: #8b9aa8;
  /* Equipixel brand blue, sampled from the logo (#305098) */
  --accent: #304f98;
  --accent-dark: #253e7a;
  --accent-soft: #e9eef9;
  --accent-ring: rgba(48, 79, 152, .2);
  --brand-grey: #8e97a8;
  --ok: #1d7a4c; --ok-bg: #e3f4ea;
  --warn: #9a6207; --warn-bg: #fdf1dc;
  --danger: #a32b2b; --danger-bg: #fbe6e6;
  --info: #1f5f9e; --info-bg: #e5eefa;
  --radius: 9px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 14px rgba(16, 32, 48, .05);
  --shadow-lg: 0 8px 30px rgba(16, 32, 48, .13);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.22rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
small { font-size: .82rem; }
code, .mono { font-family: var(--mono); font-size: .88em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

/* ----------------------------------------------------------------- layout */

.topbar {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 0 22px;
  display: flex; align-items: center; gap: 22px; min-height: 58px;
}
.brand { display: flex; align-items: baseline; gap: 9px; color: #fff; font-weight: 700; font-size: 1.06rem; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 27px; height: 27px; border-radius: 7px;
  background: rgba(255,255,255,.16); font-size: .82rem; font-weight: 800; align-self: center;
}
.brand-sub { font-size: .73rem; font-weight: 500; color: #b8c6e6; letter-spacing: .3px; }

.mainnav { display: flex; gap: 2px; margin-left: 8px; flex: 1; flex-wrap: wrap; }
.mainnav a {
  color: #ccd8ef; padding: 8px 13px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500; white-space: nowrap;
}
.mainnav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.mainnav a.active { background: rgba(255,255,255,.17); color: #fff; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.langswitch { display: flex; border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius-sm); overflow: hidden; }
.langswitch a { color: #ccd8ef; padding: 3px 9px; font-size: .74rem; font-weight: 700; letter-spacing: .4px; }
.langswitch a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.langswitch a.active { background: #fff; color: var(--accent); }
.userchip { display: flex; align-items: center; gap: 9px; color: #e8edf8; font-size: .85rem; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: #fff;
}
.topbar-right a.linkish { color: #ccd8ef; font-size: .85rem; }

.page { max-width: 1320px; margin: 0 auto; padding: 26px 22px 70px; }
.page-narrow { max-width: 780px; }
.page-mid { max-width: 1020px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 3px; }
.page-head .sub { color: var(--text-soft); font-size: .9rem; }
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 13px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 18px; }
.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)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 960px) { .grid-3, .grid-4, .grid-side { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .grid-2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ stats */

.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow); display: block;
}
a.stat:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); transition: .12s; }
.stat-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 650; }
.stat-value { font-size: 1.85rem; font-weight: 700; margin-top: 4px; color: var(--text); line-height: 1.1; }
.stat-note { font-size: .8rem; color: var(--text-soft); margin-top: 3px; }
.stat.accent .stat-value { color: var(--accent); }
.stat.warn .stat-value { color: var(--warn); }
.stat.ok .stat-value { color: var(--ok); }

/* ----------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .885rem; }
table.data th {
  text-align: left; padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); font-size: .74rem; text-transform: uppercase;
  letter-spacing: .055em; color: var(--text-soft); font-weight: 700; white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .strong { font-weight: 650; }
table.data a.row-link { font-weight: 600; }
.row-sub { display: block; color: var(--text-faint); font-size: .79rem; margin-top: 1px; }
tr.clickable { cursor: pointer; }
tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

.empty { padding: 44px 20px; text-align: center; color: var(--text-faint); }
.empty-icon { font-size: 2rem; opacity: .45; display: block; margin-bottom: 8px; }

/* ----------------------------------------------------------------- badges */

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 20px; font-size: .755rem; font-weight: 650; white-space: nowrap;
  border: 1px solid transparent; line-height: 1.5;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.nodot::before { display: none; }
.status-waiting { background: var(--warn-bg); color: var(--warn); border-color: #f0dcb4; }
.status-progress { background: var(--info-bg); color: var(--info); border-color: #c8dcf3; }
.status-complete { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cd; }
.status-cancelled { background: var(--surface-3); color: var(--text-faint); border-color: var(--border); }
.urgency-routine { background: var(--surface-3); color: var(--text-soft); border-color: var(--border); }
.urgency-urgent { background: var(--warn-bg); color: var(--warn); border-color: #f0dcb4; }
.urgency-emergency { background: var(--danger-bg); color: var(--danger); border-color: #f1c9c9; }
.badge-muted { background: var(--surface-3); color: var(--text-soft); }
.badge-lang { background: var(--accent-soft); color: var(--accent-dark); border-color: #c4d2ee; font-family: var(--mono); text-transform: uppercase; }
.overdue-flag { color: var(--danger); font-weight: 650; font-size: .78rem; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 17px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: .885rem; font-weight: 600;
  cursor: pointer; transition: .12s; font-family: inherit; text-align: center;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8d2323; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { padding: 5px 11px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: .96rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------ forms */

.field { margin-bottom: 15px; }
.field > label, .field-label {
  display: block; font-size: .83rem; font-weight: 650; margin-bottom: 5px; color: var(--text);
}
.req { color: var(--danger); margin-left: 2px; }
.hint { font-size: .795rem; color: var(--text-soft); margin-top: 4px; line-height: 1.45; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=tel], input[type=month], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: #fff; color: var(--text);
  font: inherit; font-size: .9rem; transition: border-color .12s, box-shadow .12s;
}
select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6b7a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
input[readonly], input[disabled], select[disabled] { background: var(--surface-3); color: var(--text-soft); }
textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row-zip { grid-template-columns: 130px minmax(0, 1fr); }
@media (max-width: 680px) { .form-row, .form-row-3, .form-row-zip { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent);
  font-weight: 700; padding: 0; margin-bottom: 12px; width: 100%;
  border-bottom: 1px solid var(--border); padding-bottom: 7px;
}
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .88rem; margin-bottom: 9px; }
.check input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.radio-cards { display: grid; gap: 9px; }
.radio-card {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer;
  background: #fff; transition: .12s;
}
.radio-card:hover { border-color: var(--accent); background: var(--surface-2); }
.radio-card input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.radio-card .rc-title { font-weight: 650; font-size: .89rem; }
.radio-card .rc-note { font-size: .8rem; color: var(--text-soft); margin-top: 2px; }
.radio-card .rc-price { margin-left: auto; font-weight: 700; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ file upload */

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 30px 20px; text-align: center; background: var(--surface-2);
  cursor: pointer; transition: .15s; position: relative;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dz-icon { font-size: 1.7rem; opacity: .5; }
.dz-main { font-weight: 600; margin-top: 7px; font-size: .92rem; }
.dz-sub { font-size: .81rem; color: var(--text-soft); margin-top: 4px; }
.filelist { margin-top: 12px; display: grid; gap: 5px; }
.fileitem {
  display: flex; align-items: center; gap: 10px; padding: 7px 11px; font-size: .84rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.fileitem .fi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fileitem .fi-size { color: var(--text-faint); font-variant-numeric: tabular-nums; font-size: .8rem; }
.fi-kind { font-size: .68rem; font-weight: 700; letter-spacing: .05em; padding: 2px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-dark); text-transform: uppercase; }
.fi-kind.image { background: #eae7f8; color: #4b3f8f; }
.fi-kind.history { background: #f9ecdc; color: #8a5a17; }
.fi-kind.other { background: var(--surface-3); color: var(--text-soft); }

/* ----------------------------------------------------------------- alerts */

.alert {
  padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 17px;
  border: 1px solid transparent; font-size: .885rem; display: flex; gap: 10px; align-items: flex-start;
}
.alert-success { background: var(--ok-bg); border-color: #bfe3cd; color: #14603a; }
.alert-error { background: var(--danger-bg); border-color: #f1c9c9; color: #8d2323; }
.alert-warn { background: var(--warn-bg); border-color: #f0dcb4; color: #7d4f06; }
.alert-info { background: var(--info-bg); border-color: #c8dcf3; color: #1a4f85; }
.alert ul { margin: 5px 0 0; padding-left: 19px; }
.alert a { color: inherit; font-weight: 650; text-decoration: underline; }

/* ------------------------------------------------------------------- misc */

.dl { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 7px 18px; font-size: .885rem; margin: 0; }
.dl dt { color: var(--text-soft); }
.dl dd { margin: 0; font-weight: 500; }
.dl dd.mono { font-family: var(--mono); font-size: .84rem; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 15px 25px; font-size: .865rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 5px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; border: 2px solid var(--border-strong);
}
.timeline li.done::before { border-color: var(--ok); background: var(--ok); }
.timeline li.current::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.tl-title { font-weight: 600; }
.tl-time { color: var(--text-faint); font-size: .8rem; }

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow);
}
.toolbar .field { margin: 0; min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 190px; }

.logo-preview { max-height: 46px; max-width: 170px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; padding: 4px; }
.client-logo-sm { max-height: 26px; max-width: 78px; vertical-align: middle; }

.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------- auth pages */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; background: linear-gradient(160deg, #304f98 0%, #223a74 42%, #eef2f5 42%, #eef2f5 100%); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 13px; box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-card.wide { max-width: 720px; }
.auth-head { padding: 26px 30px 20px; text-align: center; border-bottom: 1px solid var(--border); }
.auth-head .brand-mark { width: 44px; height: 44px; font-size: 1.15rem; background: var(--accent); color: #fff; margin: 0 auto 11px; }
.auth-head h1 { font-size: 1.28rem; margin: 0 0 3px; }
.auth-head .sub { color: var(--text-soft); font-size: .87rem; }
.auth-body { padding: 24px 30px 28px; }
.auth-foot { padding: 15px 30px; background: var(--surface-2); border-top: 1px solid var(--border); text-align: center; font-size: .87rem; }
.auth-lang { text-align: center; padding-top: 14px; }
.auth-lang a { color: #fff; font-size: .8rem; opacity: .85; margin: 0 6px; }

/* --------------------------------------------------------------- stepper */

.stepper { display: flex; gap: 0; margin-bottom: 22px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 9px 16px 9px 13px; font-size: .84rem; color: var(--text-faint); font-weight: 600; }
.step-n { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text-soft); display: grid; place-items: center; font-size: .76rem; font-weight: 700; }
.step.active { color: var(--accent); }
.step.active .step-n { background: var(--accent); color: #fff; }

@media print {
  .topbar, .head-actions, .btn, .toolbar { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ------------------------------------------------------------ brand marks */

.brand-logo { height: 30px; width: auto; display: block; }
.auth-logo { height: 46px; width: auto; margin: 0 auto 14px; display: block; }
@media (max-width: 560px) { .brand-logo { height: 24px; } }

/* --------------------------------------------------------- report editor */

.sticky { position: sticky; top: 74px; z-index: 5; }
.report-field label { display: flex; align-items: center; gap: 8px; }
.report-field textarea { font-size: .92rem; line-height: 1.6; }
.report-field .btn-sm { margin-left: auto; font-weight: 500; }
.char-count { text-align: right; font-size: .72rem; color: var(--text-faint); min-height: 12px; }

.figures { display: grid; gap: 12px; }
.figure-row {
  display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 13px;
  align-items: start; padding: 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.figure-thumb { position: relative; }
.figure-thumb img {
  width: 100%; height: 92px; object-fit: cover; border-radius: 5px;
  background: #11131a; border: 1px solid var(--border);
}
.figure-no {
  position: absolute; left: 5px; top: 5px; background: rgba(0,0,0,.72); color: #fff;
  font-size: .68rem; font-weight: 700; padding: 2px 6px; border-radius: 4px;
}
.figure-meta label { font-size: .78rem; font-weight: 650; display: block; margin-bottom: 4px; }
.figure-actions { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 760px) {
  .figure-row { grid-template-columns: 1fr; }
  .figure-thumb img { height: 150px; }
  .figure-actions { flex-direction: row; }
}

/* --------------------------------------------------------- ZIP help block */

.ziphelp { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.ziphelp > summary {
  cursor: pointer; padding: 11px 15px; font-weight: 650; font-size: .88rem;
  color: var(--accent); list-style: none; display: flex; align-items: center; gap: 7px;
}
.ziphelp > summary::-webkit-details-marker { display: none; }
.ziphelp > summary::before { content: "?"; display: inline-grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  color: #fff; font-size: .72rem; font-weight: 800; }
.ziphelp[open] > summary { border-bottom: 1px solid var(--border); }
.ziphelp-body { padding: 15px; font-size: .875rem; }
.ziphelp-col h4 { margin: 0 0 7px; font-size: .88rem; }
.ziphelp-col ol { margin: 0; padding-left: 19px; line-height: 1.75; }
.ziphelp-col li { margin-bottom: 3px; }

/* ------------------------------------------------------- region selection */

.region-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 720px) { .region-grid { grid-template-columns: 1fr; } }
.region-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; font-size: .875rem; transition: .12s;
}
.region-item:hover { border-color: var(--accent); background: var(--surface-2); }
.region-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.region-item input[type=checkbox] { width: auto; margin: 0; accent-color: var(--accent); flex: none; }
.region-item .region-name { flex: 1; min-width: 0; }
.region-item .region-side { width: auto; min-width: 84px; padding: 3px 24px 3px 7px; font-size: .78rem; flex: none; }
.region-item.hidden { display: none; }
.pricelines { font-size: .85rem; }
.pricelines > .flex-between { padding: 2px 0; }

/* --------------------------------------------------------- rich text editor */

.rt-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 8px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); position: sticky; top: 58px; z-index: 6;
}
.rt-group { display: flex; gap: 3px; align-items: center;
  padding-right: 8px; margin-right: 4px; border-right: 1px solid var(--border); }
.rt-group:last-child { border-right: 0; }
.rt-btn {
  min-width: 30px; height: 28px; padding: 0 7px; border: 1px solid transparent;
  border-radius: 5px; background: transparent; cursor: pointer; font-size: .86rem;
  color: var(--text); font-family: inherit; line-height: 1;
}
.rt-btn:hover { background: #fff; border-color: var(--border-strong); }
.rt-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rt-select {
  height: 28px; width: auto; padding: 0 24px 0 8px; font-size: .8rem;
  border-radius: 5px; background-position: right 7px center;
}
.rt-colours { gap: 4px; }
.rt-swatch {
  width: 19px; height: 19px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2);
  cursor: pointer; padding: 0;
}
.rt-swatch:hover { transform: scale(1.18); transition: .1s; }

.richtext {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; background: #fff; font-size: .92rem; line-height: 1.6;
  overflow-wrap: break-word; transition: border-color .12s, box-shadow .12s;
}
.richtext:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.richtext[contenteditable=false] { background: var(--surface-3); color: var(--text-soft); }
.richtext.is-empty::before {
  content: attr(data-placeholder); color: var(--text-faint); pointer-events: none;
}
.richtext ul, .richtext ol { margin: 5px 0; padding-left: 22px; }
.richtext li { margin-bottom: 2px; }
.richtext p { margin: 0 0 6px; }

/* Mirror the PDF so the editor shows what will print */
.richtext font[face="sans"]  { font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.richtext font[face="serif"] { font-family: Georgia, "Times New Roman", serif; }
.richtext font[face="mono"]  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.richtext font[size="2"] { font-size: .84rem; }
.richtext font[size="3"] { font-size: .92rem; }
.richtext font[size="5"] { font-size: 1.16rem; }
.richtext font[size="6"] { font-size: 1.45rem; }

/* --------------------------------------------------------------- footer */

.sitefooter { border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; }
.sitefooter-inner {
  max-width: 1320px; margin: 0 auto; padding: 16px 22px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--text-faint);
}
.sitefooter nav { display: flex; gap: 16px; flex-wrap: wrap; }
.sitefooter a { color: var(--text-soft); }
.auth-legal { text-align: center; padding-top: 16px; font-size: .78rem; }
.auth-legal a { color: #fff; opacity: .8; margin: 0 5px; }
.auth-legal span { color: #fff; opacity: .4; }

/* ---------------------------------------------------------- legal pages */

.legal { font-size: .93rem; line-height: 1.7; }
.legal h1 { font-size: 1.5rem; margin-bottom: 18px; }
.legal h2 { font-size: 1.05rem; margin: 26px 0 8px; color: var(--accent-dark); }
.legal h3 { font-size: .95rem; margin: 18px 0 6px; }
.legal p, .legal li { max-width: 68ch; }
.legal ul, .legal ol { padding-left: 22px; }
.legal li { margin-bottom: 5px; }
.legal table.data { margin: 12px 0; font-size: .86rem; }
.legal .box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; margin: 14px 0;
}

/* ---- consent blocks (registration and the consent page) ---------------- */
.consent-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 14px;
  background: var(--surface-2, #fafbfc);
}
.consent-box.optional { border-style: dashed; }
.consent-box h3 {
  font-size: .95rem;
  margin: 0 0 8px;
}
.consent-docs {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.consent-docs a { font-weight: 600; }
.consent-note {
  font-size: .82rem;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.45;
}
.consent-version {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 10px;
}
.consent-history { font-size: .85rem; margin-top: 10px; }
.consent-history li { margin-bottom: 4px; }
.sub strong.ok { color: var(--ok); }
