/* ==========================================================================
   Overseer · Client intake
   GNOME/Adwaita + Apple HIG principles: quiet, spacious, precise.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 22px;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--motion) ease-out, color var(--motion) ease-out;
}
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); font-size: 13px; line-height: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.num  { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--s-4); top: -100px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: var(--s-2) var(--s-4);
  border-radius: var(--radius-sm); text-decoration: none; font-weight: 600;
}
.skip:focus { top: var(--s-2); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

.icon { width: 18px; height: 18px; flex: none; }
.icon-16 { width: 16px; height: 16px; flex: none; }

/* ---------- Header bar ------------------------------------------------- */
.headerbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: 0 var(--s-3) 0 var(--s-4);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--s-2); text-decoration: none; color: var(--text); min-width: 0; }
.brand-mark { width: 28px; height: 28px; flex: none; display: block; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: 0.08em; white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: var(--s-2); }
.save-state {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px; line-height: 18px; white-space: nowrap;
}
.save-state .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.save-state[data-state="saving"] .dot { background: var(--muted); animation: pulse 1s ease-in-out infinite; }
.save-state[data-state="offline"] .dot { background: var(--warning); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Progress --------------------------------------------------- */
.progress {
  position: sticky; top: var(--header-h); z-index: 15;
  background: var(--bg);
  padding: var(--s-4) var(--s-5) var(--s-3);
}
.progress-inner { max-width: var(--column); margin: 0 auto; }
.progress ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.progress li { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.progress .seg-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.progress .seg-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 240ms var(--ease); }
.progress li.done .seg-bar span, .progress li.current .seg-bar span { width: 100%; }
.progress .seg-name {
  font-size: 13px; line-height: 18px; color: var(--muted);
  display: flex; align-items: center; gap: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.progress li.current .seg-name { color: var(--text); font-weight: 600; }
.progress .seg-text { overflow: hidden; text-overflow: ellipsis; }
.progress li.done .seg-name { color: var(--text); }
.progress-mobile { display: none; font-size: 13px; line-height: 18px; color: var(--muted); margin-top: var(--s-2); }
.progress-mobile strong { color: var(--text); font-weight: 600; }

/* ---------- Main column ------------------------------------------------ */
main { flex: 1; outline: none; }
.column {
  max-width: calc(var(--column) + 2 * var(--s-5));
  margin: 0 auto;
  padding: var(--s-5) var(--s-5) var(--s-7);
}
.view-enter { animation: enter var(--motion) var(--ease) both; }
.view-enter.back { animation-name: enter-back; }
@keyframes enter      { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }

.screen-title { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; outline: none; }
.screen-sub { color: var(--muted); margin-top: var(--s-2); }
.screen-head { margin-bottom: var(--s-6); }

.section { margin-top: var(--s-6); }
#form > .section:first-of-type, .consents:first-child { margin-top: 0; }
.section-label { font-size: 15px; line-height: 22px; font-weight: 600; margin-bottom: var(--s-3); }
.section-label + .helper { margin-top: calc(-1 * var(--s-2)); margin-bottom: var(--s-3); }
.stack > * + * { margin-top: var(--s-5); }

/* ---------- Boxed list (Adwaita) --------------------------------------- */
.box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: visible;
}
.box > .field { padding: var(--s-4); }
.box > .field + .field { border-top: 1px solid var(--border); }
.box > .field:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.box > .field:last-child  { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.plain > .field + .field { margin-top: var(--s-5); }

.field.boxed {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--s-4);
}
.btn-inline-link {
  background: none; border: 0; padding: 0; margin: 0; font: inherit; cursor: pointer;
  color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
}
.flash { margin-bottom: var(--s-5); }

/* ---------- Labels, helper, errors ------------------------------------- */
.label, .legend {
  display: block; font-weight: 600; font-size: 15px; line-height: 22px;
  margin-bottom: var(--s-2); padding: 0;
}
.opt { font-weight: 400; color: var(--muted); font-size: 13px; }
.label-sm { display: block; font-size: 13px; line-height: 18px; color: var(--muted); margin-bottom: var(--s-1); }
.helper { color: var(--muted); font-size: 13px; line-height: 18px; margin-top: var(--s-2); }
.helper-row { display: flex; justify-content: space-between; gap: var(--s-3); align-items: flex-start; }
.helper-row .helper { flex: 1; }
.counter { color: var(--muted); margin-top: var(--s-2); flex: none; }
.counter.near { color: var(--text); }
.err {
  display: flex; gap: 6px; align-items: flex-start;
  color: var(--danger); font-size: 13px; line-height: 18px; margin-top: var(--s-2);
}
.err .icon-16 { margin-top: 1px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.err-summary {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4); margin-bottom: var(--s-5);
  border: 1px solid var(--danger); border-left-width: 4px;
  background: var(--surface); border-radius: var(--radius-sm);
  outline: none;
}
.err-summary .icon { color: var(--danger); margin-top: 2px; }
.err-summary p { font-weight: 600; }
.err-summary ul { margin: var(--s-1) 0 0; padding-left: 18px; font-size: 13px; line-height: 18px; }
.err-summary a { color: var(--text); }

.banner {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4); border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--text); font-size: 13px; line-height: 18px;
}
.banner .icon { color: var(--accent); }
.banner.danger { background: var(--surface); border: 1px solid var(--danger); }
.banner.danger .icon { color: var(--danger); }

/* ---------- Inputs ----------------------------------------------------- */
.input, .select {
  width: 100%; min-height: 44px;
  padding: 10px var(--s-3);
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; line-height: 22px;
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out, background-color 120ms;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:hover, .select:hover { border-color: color-mix(in srgb, var(--border) 50%, var(--muted)); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.input:focus-visible, .select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled, .select:disabled { opacity: .5; cursor: not-allowed; }
textarea.input { min-height: 112px; resize: vertical; }
.input-sm { min-height: 36px; padding: 6px 10px; font-size: 13px; line-height: 18px; }
input[type="number"].input { font-variant-numeric: tabular-nums; }
input[type="date"].input { min-height: 44px; }

.select {
  padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%235F6470' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
html[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23A3A7B0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}

.inline { display: flex; gap: var(--s-2); align-items: stretch; }
.inline > .grow { flex: 1; min-width: 0; }
.phone .select { width: 176px; flex: none; }
.qty { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: var(--s-2); }
.month { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s-2); }
.money { position: relative; }
.money .prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.money .input { padding-left: 52px; }
.sub-check { margin-top: var(--s-3); }

/* Contact verification */
.otp-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.otp-entry { margin-top: var(--s-3); padding: var(--s-3); border-radius: var(--radius-sm); background: var(--accent-softer); border: 1px solid var(--border); }
.otp-entry .inline { max-width: 320px; }
.otp-input { letter-spacing: 0.3em; font-size: 18px; text-align: center; }
.verified {
  display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm); background: color-mix(in srgb, var(--success) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
}
.verified .icon-16 { color: var(--success); }
.verified span { flex: 1; }
.helper.credit { font-size: 11px; line-height: 16px; margin-top: var(--s-1); opacity: .85; }
.combo-list li.combo-custom { color: var(--accent); font-weight: 500; }

/* Checkbox */
.check { display: flex; gap: var(--s-3); align-items: flex-start; cursor: pointer; min-height: 24px; }
.check input {
  -webkit-appearance: none; appearance: none; margin: 1px 0 0; flex: none;
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid color-mix(in srgb, var(--border) 30%, var(--muted));
  background: var(--surface); display: grid; place-items: center; cursor: pointer;
  transition: background-color 120ms, border-color 120ms;
}
.check input::after {
  content: ""; width: 10px; height: 6px; margin-top: -2px;
  border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent);
  transform: rotate(-45deg) scale(0); transition: transform 120ms var(--ease);
}
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check input[aria-invalid="true"] { border-color: var(--danger); }
.check-text { flex: 1; }
.check-text a, .linkbtn { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Segmented (radio pills) ------------------------------------ */
.seg { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 8px var(--s-4);
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 15px; line-height: 22px;
  transition: background-color 120ms, border-color 120ms, color 120ms;
  user-select: none;
}
.seg-opt:hover span { background: var(--hover); }
.seg-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 500; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg-opt .icon-16 { display: none; }
.seg-opt input:checked + span .icon-16 { display: block; }
[aria-invalid="true"] .seg-opt span { border-color: color-mix(in srgb, var(--danger) 60%, var(--border)); }

/* Tri-state rows */
.tri { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.tri-label { font-weight: 500; }
.tri .seg-opt span { min-height: 36px; padding: 6px 14px; font-size: 13px; line-height: 18px; }
.tri .err { flex-basis: 100%; margin-top: 0; }

/* ---------- Choice cards ----------------------------------------------- */
.cards { display: grid; gap: var(--s-2); }
.card { position: relative; display: block; cursor: pointer; }
.card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.card-inner {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4); min-height: 64px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 120ms, background-color 120ms, box-shadow 120ms;
}
.card:hover .card-inner { border-color: color-mix(in srgb, var(--border) 40%, var(--muted)); }
.card-body { flex: 1; min-width: 0; }
.card-title { display: block; font-weight: 600; }
.card-desc { display: block; color: var(--muted); font-size: 13px; line-height: 18px; margin-top: 2px; }
.card-check {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 1.5px solid color-mix(in srgb, var(--border) 30%, var(--muted));
  display: grid; place-items: center; color: var(--on-accent);
  transition: background-color 120ms, border-color 120ms;
}
.card-check .icon-16 { width: 14px; height: 14px; opacity: 0; transform: scale(.6); transition: all 120ms var(--ease); }
.card input:checked + .card-inner { border-color: var(--accent); background: var(--accent-softer); box-shadow: 0 0 0 1px var(--accent); }
.card input:checked + .card-inner .card-check { background: var(--accent); border-color: var(--accent); }
.card input:checked + .card-inner .card-check .icon-16 { opacity: 1; transform: none; }
.card input:focus-visible + .card-inner { outline: 2px solid var(--accent); outline-offset: 2px; }
[aria-invalid="true"] .card-inner { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.card-icon {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.card-icon .icon { width: 20px; height: 20px; }

/* Multi-select cards (checkbox behaviour: square check) */
.card.multi .card-check { border-radius: 6px; }

/* ---------- Chips ------------------------------------------------------ */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 15px; line-height: 22px;
  transition: all 120ms; user-select: none;
}
.chip span .icon-16 { width: 14px; height: 14px; display: none; }
.chip:hover span { background: var(--hover); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 500; }
.chip input:checked + span .icon-16 { display: block; color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
[aria-invalid="true"] .chip span { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }

/* ---------- Country combobox ------------------------------------------- */
.combo { position: relative; }
.combo .input { padding-right: 36px; }
.combo-arrow { position: absolute; right: 12px; top: 14px; color: var(--muted); pointer-events: none; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 264px; overflow-y: auto; margin: 0; padding: var(--s-1);
  list-style: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.combo-list li {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-3);
  padding: 8px 10px; border-radius: 6px; cursor: pointer; min-height: 36px;
}
.combo-list li .mono { color: var(--muted); }
.combo-list li.active { background: var(--accent-soft); }
.combo-list li[aria-selected="true"] { font-weight: 600; }
.combo-empty { color: var(--muted); cursor: default !important; }

/* ---------- Buttons ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; min-width: 44px; padding: 10px 20px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 15px; line-height: 22px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background-color 120ms, border-color 120ms, transform 80ms, opacity 120ms;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--hover); }
.btn-flat { background: transparent; color: var(--text); }
.btn-flat:hover { background: var(--hover); }
.btn-link { background: none; border: 0; color: var(--accent); padding: 10px 4px; font-weight: 500; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 13px; line-height: 18px; }
.btn[disabled] { opacity: .55; cursor: progress; transform: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.header-btn { min-height: 36px; padding: 6px 12px; font-size: 13px; line-height: 18px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer action bar ------------------------------------------ */
.actionbar {
  position: sticky; bottom: 0; z-index: 15;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  padding: var(--s-3) var(--s-5) calc(var(--s-3) + env(safe-area-inset-bottom));
}
.actionbar-inner { max-width: var(--column); margin: 0 auto; }
.actionbar-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.actionbar-row .spacer { flex: 1; }
.actionbar .btn-primary { min-width: 128px; }
.actionbar-note { color: var(--muted); font-size: 13px; line-height: 18px; text-align: right; margin-top: var(--s-2); }

/* ---------- Welcome ---------------------------------------------------- */
.welcome-hero { display: flex; flex-direction: column; gap: var(--s-4); margin-bottom: var(--s-6); }
.welcome-mark {
  width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; box-shadow: var(--shadow-lg);
}
.welcome-mark .icon { width: 28px; height: 28px; }
.need { margin-top: var(--s-5); padding: var(--s-4); border-radius: var(--radius); background: var(--accent-softer); border: 1px solid var(--border); }
.need-title { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: var(--s-2); }
.need ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); color: var(--muted); }
.need li { display: flex; gap: var(--s-3); align-items: flex-start; }
.need li .icon-16 { color: var(--accent); margin-top: 3px; }
.meta-time { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; line-height: 18px; }

/* ---------- Uploads ---------------------------------------------------- */
.dropzone {
  border: 1.5px dashed color-mix(in srgb, var(--border) 30%, var(--muted));
  border-radius: var(--radius); padding: var(--s-5) var(--s-4);
  background: var(--field); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  transition: background-color 120ms, border-color 120ms;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin-bottom: var(--s-1);
}
.dropzone .dz-title { font-weight: 500; }
.dz-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: center; margin-top: var(--s-1); }
.dropzone.dz-compact {
  flex-direction: row; text-align: left; align-items: center; gap: var(--s-4);
  padding: var(--s-4); border-radius: var(--radius);
}
.dz-compact .dz-icon { margin: 0; flex: none; }
.dz-compact .dz-text { flex: 1; min-width: 0; }
.dz-compact .dz-actions { margin: 0; }
.thumb.thumb-logo { background: #FFFFFF; padding: 6px; }
.thumb.thumb-logo img { object-fit: contain; }
@media (max-width: 599px) {
  .dropzone.dz-compact { flex-wrap: wrap; }
  .dz-compact .dz-actions { width: 100%; }
}
.upload-errors:empty { display: none; }
.upload-errors { margin-top: var(--s-3); display: grid; gap: var(--s-1); }
.upload-errors .err { margin-top: 0; }
.file-list { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; gap: var(--s-2); }
.file-list:empty { display: none; }
.file {
  display: flex; gap: var(--s-3); padding: var(--s-3);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  animation: enter var(--motion) var(--ease) both;
}
.thumb {
  width: 56px; height: 56px; border-radius: 8px; flex: none; overflow: hidden;
  background: var(--field); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--muted);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .icon { width: 24px; height: 24px; }
.thumb .ext { font-size: 10px; line-height: 12px; font-weight: 700; letter-spacing: .04em; margin-top: 2px; }
.thumb-pdf { color: var(--danger); display: flex; flex-direction: column; align-items: center; }
.file-main { flex: 1; min-width: 0; display: grid; gap: var(--s-2); }
.file-top { display: flex; align-items: center; gap: var(--s-2); }
.file-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.file-size { color: var(--muted); flex: none; }
.file-top .icon-btn { margin: -8px -8px -8px 0; }
.bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); transition: width 160ms linear; }
.bar.done span { background: var(--success); }
.file-status { display: inline-flex; align-items: center; gap: 4px; color: var(--success); font-size: 13px; line-height: 18px; }
.file-status .icon-16 { width: 14px; height: 14px; }

/* ---------- GPS / map -------------------------------------------------- */
.gps-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.gps-out {
  display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); background: var(--accent-soft);
}
.gps-out .icon-16 { color: var(--accent); }
.gps-out .grow { flex: 1; }
.map { height: 280px; margin-top: var(--s-3); border-radius: var(--radius-sm); border: 1px solid var(--border); overflow: hidden; z-index: 0; }

/* ---------- Review ----------------------------------------------------- */
.summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.summary + .summary { margin-top: var(--s-4); }
.summary-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.summary-head h2 { font-size: 15px; line-height: 22px; font-weight: 600; }
.summary dl { margin: 0; }
.summary-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--s-4); padding: var(--s-3) var(--s-4); }
.summary-row + .summary-row { border-top: 1px solid var(--border); }
.summary-row dt { color: var(--muted); font-size: 13px; line-height: 20px; }
.summary-row dd { margin: 0; overflow-wrap: anywhere; }
.unknown-note { display: flex; gap: 6px; align-items: flex-start; margin-top: var(--s-1); color: var(--muted); font-size: 13px; line-height: 18px; }
.unknown-note .icon-16 { color: var(--warning); margin-top: 1px; width: 14px; height: 14px; }
.review-files { display: grid; gap: var(--s-2); }
.review-file { display: flex; align-items: center; gap: var(--s-3); }
.review-file .thumb { width: 40px; height: 40px; }
.review-file .thumb .icon { width: 18px; height: 18px; }
.review-file .file-name { font-weight: 400; }
.consents { margin-top: var(--s-6); }
.consents .box > .field { padding: var(--s-4); }

/* ---------- Confirmation / status -------------------------------------- */
.done-mark {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success);
  margin-bottom: var(--s-5);
  animation: pop 320ms var(--ease) both;
}
.done-mark .icon { width: 28px; height: 28px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.case-card {
  margin-top: var(--s-5); padding: var(--s-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap;
}
.case-id { font-size: 18px; line-height: 26px; font-weight: 600; letter-spacing: .02em; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: var(--s-4); padding-bottom: var(--s-5); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: 13px; top: 32px; bottom: 4px; width: 2px; background: var(--border);
}
.timeline li:last-child::before { display: none; }
.tl-dot {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--border); color: var(--muted);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.timeline li.done .tl-dot { background: var(--success); border-color: var(--success); color: var(--surface); }
.timeline li.current .tl-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-body { padding-top: 3px; }
.tl-body .tl-title { font-weight: 500; }
.timeline li.upcoming .tl-title { color: var(--muted); }
.tl-body .tl-sub { color: var(--muted); font-size: 13px; line-height: 18px; margin-top: 2px; }
.actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-6); }
.status-now {
  display: flex; gap: var(--s-4); align-items: center; padding: var(--s-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.status-now .card-icon { width: 44px; height: 44px; }
.status-now .label-sm { margin: 0; }
.status-now strong { font-size: 18px; line-height: 26px; font-weight: 600; }
.request {
  margin-top: var(--s-3); padding: var(--s-4); border-radius: var(--radius);
  border: 1px solid var(--warning); background: var(--surface);
}
.request .request-head { display: flex; gap: var(--s-2); align-items: center; font-weight: 600; }
.request .request-head .icon { color: var(--warning); }
.request p { margin-top: var(--s-2); }

/* ---------- Dialog ----------------------------------------------------- */
dialog {
  width: min(520px, calc(100vw - 32px)); max-height: min(80vh, 720px);
  padding: 0; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog[open] { animation: dlg 180ms var(--ease) both; display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(10, 12, 16, 0.42); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
@keyframes dlg { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-3) var(--s-3) var(--s-5); }
.dlg-head h2 { font-size: 18px; line-height: 26px; font-weight: 600; }
.dlg-body { padding: 0 var(--s-5) var(--s-5); overflow-y: auto; }
.dlg-body p + p, .dlg-body p + h3, .dlg-body ul + p { margin-top: var(--s-3); }
.dlg-body h3 { font-size: 15px; font-weight: 600; margin-top: var(--s-4); }
.dlg-body ul { margin: var(--s-2) 0 0; padding-left: 20px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5) var(--s-5); }
.draft-tag {
  display: inline-block; font-size: 12px; line-height: 16px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--text);
}

/* ---------- Debug panel (?debug=1) ------------------------------------- */
.debug { margin-top: var(--s-6); }
.debug summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.debug pre {
  margin: var(--s-2) 0 0; padding: var(--s-3); max-height: 420px; overflow: auto;
  background: var(--field); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 12px; line-height: 17px;
}

/* ---------- Responsive ------------------------------------------------- */
@media (max-width: 1023px) {
  .column { padding: var(--s-5) var(--s-4) var(--s-7); }
}
@media (max-width: 599px) {
  .headerbar { padding: 0 var(--s-2) 0 var(--s-4); }
  .brand-name { display: none; }
  .save-state .txt { display: none; }
  .progress { padding: var(--s-3) var(--s-4) var(--s-2); }
  .progress .seg-name { display: none; }
  .progress-mobile { display: block; }
  .column { padding: var(--s-4) var(--s-4) var(--s-6); }
  .screen-head { margin-bottom: var(--s-5); }
  .actionbar { padding-left: var(--s-4); padding-right: var(--s-4); }
  .actionbar .btn-primary { min-width: 0; flex: 1; }
  .actionbar-row { gap: var(--s-2); }
  .actionbar-note { text-align: left; }
  .summary-row { grid-template-columns: 1fr; gap: 2px; }
  .qty { grid-template-columns: 1fr 1fr; }
  .qty > :first-child { grid-column: 1 / -1; }
  .phone .select { width: 140px; }
  .tri { flex-direction: column; align-items: flex-start; }
  .actions .btn { flex: 1; }
}

html.preview *, html.preview *::before, html.preview *::after { animation: none !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .headerbar, .progress, .actionbar { display: none; }
}
