:root {
  --bg: #f9fafb;
  --card: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --input: #d1d5db;
  --primary: #030213;
  --primary-fg: #ffffff;
  --accent: #f3f4f6;
  --danger: #d4183d;
  --star: #f59e0b;
  --ring: rgba(3, 2, 19, 0.18);
  --primary-hover: #22212e;
  --field: #f3f3f5;
  --field-focus: #ffffff;
  --star-empty: #d1d5db;
  --ok-bg: #dcfce7;
  --ok-fg: #16a34a;
  --shadow: rgba(0, 0, 0, .08);
  --radius: 10px;
}

/* InCare Team palette (dark): Charcoal #242323 · Off-White #f4f0e8 · Mocha #725548 · Muted Gold #c19a5b.
   Text pairs checked for contrast: off-white on charcoal 13.8:1, muted 6.9:1, charcoal on gold 6.0:1. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --charcoal: #242323;
  --offwhite: #f4f0e8;
  --mocha: #725548;
  --gold: #c19a5b;
  --gold-soft: rgba(193, 154, 91, .16);
  --mocha-soft: rgba(114, 85, 72, .35);

  --bg: #1b1a19;                 /* page: a step darker than the charcoal cards */
  --card: var(--charcoal);
  --fg: var(--offwhite);
  --muted: #b5aa9c;
  --border: #3d3734;
  --input: #5c4f47;
  --primary: var(--gold);
  --primary-fg: var(--charcoal);
  --primary-hover: #d2ae72;
  --accent: #2f2b29;             /* hover wash */
  --danger: #e07a5f;
  --star: var(--gold);
  --star-empty: #5c4f47;
  --ring: rgba(193, 154, 91, .35);
  --field: #2d2a29;
  --field-focus: #332f2d;
  --ok-bg: rgba(84, 140, 96, .2);
  --ok-fg: #8fc79a;
  --warn-fg: #e3b86a;
  --bad-fg: #f0a08a;
  --shadow: rgba(0, 0, 0, .45);
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[hidden] { display: none !important; }

.wrap { max-width: 56rem; margin: 0 auto; padding: 2rem 16px; }
.wrap.wide { max-width: 80rem; }
.topright { text-align: right; margin-bottom: 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.5rem;
}
.card + .card { margin-top: 1.5rem; }
.card-title { font-size: 1.25rem; font-weight: 600; margin: 0 0 1.5rem; }
.card-title.center { text-align: center; }

h3 { font-size: 1.1rem; font-weight: 600; margin: 0 0 1rem; }
h4 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .75rem; }
section { border-top: 1px solid var(--border); padding-top: 1.5rem; margin-top: 1.5rem; }
.muted { color: var(--muted); font-size: .9rem; }
.muted ul { padding-left: 1.5rem; }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 768px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.field { margin-bottom: 1rem; }
.grid2 .field { margin-bottom: 0; }
.grid2 + .field, .field + .grid2 { margin-top: 1rem; }

label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .375rem; }
input, textarea, select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .5rem .75rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 5rem; }
input:focus, textarea:focus, select:focus { border-color: var(--input); box-shadow: 0 0 0 3px var(--ring); background: var(--field-focus); }
.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(212, 24, 61, .15) !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-size: .875rem; font-weight: 500;
  padding: .5rem 1rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--fg);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger:hover { background: #b3122f; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); background: var(--accent); }
.btn.lg { padding: .7rem 1.25rem; font-size: 1rem; }
.btn.sm { padding: .3rem .6rem; font-size: .8rem; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

/* Star rating */
.rating label { margin-bottom: .25rem; }
.stars { display: inline-flex; gap: 2px; }
.stars button {
  background: none; border: 0; padding: 2px; cursor: pointer; line-height: 0; border-radius: 4px;
}
.stars button:focus-visible { outline: 2px solid var(--primary); }
.stars svg { width: 28px; height: 28px; fill: none; stroke: var(--star-empty); stroke-width: 1.5; transition: transform .1s; }
.stars button:hover svg { transform: scale(1.1); }
.stars .on svg { fill: var(--star); stroke: var(--star); }
.stars-caption { font-size: .8rem; color: var(--muted); margin-left: .5rem; vertical-align: middle; }

/* Signature pad */
.sigbox { border: 2px solid var(--input); border-radius: 8px; padding: .5rem; background: var(--card); }
.sigbox canvas {
  display: block; width: 100%; height: 150px;
  border: 1px solid var(--border); border-radius: 6px;
  touch-action: none; cursor: crosshair; background: #fff;
}
.sigbox .sig-row { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; }
.sigbox.invalid { box-shadow: none !important; }

/* Toasts */
#toasts { position: fixed; top: 16px; right: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 100; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 420px; width: 100%;
  background: var(--card); color: var(--fg); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 8px; padding: .75rem 1rem; font-size: .9rem;
  box-shadow: 0 8px 24px var(--shadow);
  animation: toast-in .2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok-fg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* Success panel */
.done { text-align: center; padding: 1rem 0; }
.done .check { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-bg); color: var(--ok-fg); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.done .check svg { width: 28px; height: 28px; }
.done .actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem; }

/* Admin */
.adminbar { background: var(--card); border-bottom: 1px solid var(--border); }
.adminbar .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding-top: 1rem; padding-bottom: 1rem; }
.adminbar h1 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.adminbar .actions { display: flex; gap: .5rem; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.stat b { display: block; font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: .85rem; }

.filters { display: flex; gap: .75rem; flex-wrap: wrap; }
.filters input { flex: 1 1 240px; }
.filters select { width: auto; flex: 0 0 auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 500; color: var(--muted); padding: .6rem .5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: .7rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--muted); font-size: .8rem; }
td.trunc { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.actions { white-space: nowrap; }
td.actions .btn { padding: .3rem .45rem; }
.badge { display: inline-block; border: 1px solid var(--border); border-radius: 6px; padding: .05rem .45rem; font-size: .8rem; font-weight: 500; }
.badge.warn { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.badge.ok { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.badge.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.badge.muted { color: var(--muted); }
.cw-line { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }

.login { max-width: 400px; margin: 10vh auto 0; }
.error-box { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 8px; padding: .6rem .8rem; font-size: .875rem; margin-bottom: 1rem; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--card); border-radius: 12px; width: 100%; max-width: 56rem; max-height: 90vh; overflow-y: auto; padding: 1.5rem; }
.modal.small { max-width: 28rem; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.kv div { margin-bottom: .35rem; font-size: .9rem; }
.kv b { font-weight: 500; }
.ratings-list div { display: flex; justify-content: space-between; font-size: .9rem; padding: .15rem 0; }
.ratings-list .avg { border-top: 1px solid var(--border); margin-top: .35rem; padding-top: .5rem; font-weight: 600; }
.comment { background: var(--bg); border-radius: 8px; padding: .75rem; font-size: .9rem; white-space: pre-wrap; }
.sigs img { max-width: 100%; height: 90px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; background: #fff; display: block; }
.modal-foot { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1.5rem; }
.modal-foot .right { display: flex; gap: .5rem; flex-wrap: wrap; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--fg); border-radius: 50%; animation: spin .7s linear infinite; margin: 3rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.mt { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.hint { margin: .25rem 0 .5rem; }
.card-title.tight { margin-bottom: .5rem; }
.center-link { text-align: center; margin: 1rem 0 0; }

/* Equipment receipt photos */
.optional { font-weight: 400; color: var(--muted); font-size: .9rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.photo-picker { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.photo-picker input:focus-visible + span, #photo-btn:focus-within { outline: 2px solid var(--primary); }
.photo-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; }
.photo-list:empty { display: none; }
.photo-list li { border: 1px solid var(--border); border-radius: 8px; padding: .4rem; background: var(--card); font-size: .78rem; color: var(--muted); }
.photo-list img, .photo-list .pdf-tile { display: block; width: 100%; height: 100px; object-fit: cover; border-radius: 5px; background: var(--accent); }
.photo-list .pdf-tile { display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--fg); }
.photo-list .meta { display: flex; justify-content: space-between; align-items: center; gap: .25rem; margin-top: .35rem; }
.photo-list .meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-list button { border: 0; background: none; color: var(--danger); cursor: pointer; font: inherit; padding: 0 .2rem; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.attach-grid a { display: block; border: 1px solid var(--border); border-radius: 8px; padding: .4rem; text-decoration: none; color: var(--muted); font-size: .78rem; }
.attach-grid img, .attach-grid .pdf-tile { display: block; width: 100%; height: 120px; object-fit: cover; border-radius: 5px; background: var(--accent); margin-bottom: .3rem; }
.attach-grid .pdf-tile { display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--fg); }

.checks { display: grid; gap: .5rem; margin: 0 0 1rem; }
.check { display: flex; align-items: flex-start; gap: .6rem; font-weight: 400; font-size: .95rem; margin: 0; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; margin: .15rem 0 0; flex: none; padding: 0; accent-color: var(--primary); }
.photo-picker.invalid { border: 1px solid var(--danger); border-radius: 8px; padding: .5rem; }

.rating-key { display: inline-flex; gap: 1.25rem; margin: 0 0 1rem; padding: .3rem .75rem; background: var(--accent); border-radius: 999px; font-size: .85rem; font-weight: 500; }

/* The signature pad stays white "paper" with black ink in every theme: that is what goes on the PDF. */
.sigbox canvas { color-scheme: light; }
:root[data-theme="dark"] .btn.danger { color: #1a0509; }
:root[data-theme="dark"] ::placeholder { color: #6f7a8a; opacity: 1; }

/* Technician sign-in + ticket picker */
.gate { max-width: 400px; margin: 6vh auto 0; }
.pin { font-size: 1.6rem; letter-spacing: .5em; text-align: center; }
.center-text { text-align: center; margin: 0 0 1rem; }
.ticket-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .6rem; }
.ticket-list .group { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: .6rem; }
.ticket {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--field); border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem;
  transition: border-color .15s, background .15s;
}
.ticket:hover, .ticket:focus-visible { border-color: var(--primary); background: var(--field-focus); outline: none; }
.ticket .top { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.ticket .co { font-weight: 600; }
.ticket .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.ticket .sum { margin-top: .15rem; font-size: .92rem; }
.ticket .meta { margin-top: .3rem; font-size: .8rem; color: var(--muted); }
.lookup { display: flex; gap: .5rem; }
.lookup input { flex: 1; }
#lookup-result { margin-top: .75rem; }
.techbar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted);
  border-bottom: 1px solid var(--border); padding-bottom: .9rem; margin-bottom: 1.25rem; }
.techbar-actions { display: flex; gap: .4rem; }
input[readonly] { opacity: .75; cursor: not-allowed; }

.tf-active { margin-top: 1.9rem; }
#tech-rows td { vertical-align: middle; }
.grid2 + .grid2 { margin-top: 1rem; }

/* ---- incare.team shell ---------------------------------------------------------------------- */
.appbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.appbar-inner { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .55rem 16px; max-width: none; }
.appbar-right { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 480px) { .appbar-name { display: none; } }
.noaccess { max-width: 420px; margin: 8vh auto 0; }
.shell-error { margin: 16px; }
.pin-modal .pin { margin: .5rem 0 .25rem; }

/* ---- Palette refinement (incare.team) ----------------------------------------------------- */
:root[data-theme="dark"] body {
  font: 15.5px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1100px 500px at 50% -180px, rgba(114, 85, 72, .22), transparent 70%),
    var(--bg) fixed;
}
/* Headings in a refined serif (system fonts only; nothing is downloaded). */
:root[data-theme="dark"] :is(h1, h2, .card-title, .brand, .hello) {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  font-weight: 600; letter-spacing: .005em;
}
:root[data-theme="dark"] ::placeholder { color: #978c82; opacity: 1; }
:root[data-theme="dark"] .card {
  border-color: var(--border); border-radius: 14px;
  box-shadow: 0 1px 0 rgba(244, 240, 232, .03) inset, 0 10px 30px rgba(0, 0, 0, .25);
}
:root[data-theme="dark"] input:focus, :root[data-theme="dark"] textarea:focus, :root[data-theme="dark"] select:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px var(--ring);
}
:root[data-theme="dark"] .btn { border-radius: 10px; border-color: var(--border); background: var(--field); }
:root[data-theme="dark"] .btn:hover { background: var(--accent); border-color: var(--input); }
:root[data-theme="dark"] .btn.primary { background: var(--gold); border-color: var(--gold); color: var(--charcoal); font-weight: 600; }
:root[data-theme="dark"] .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
:root[data-theme="dark"] .btn.ghost { background: transparent; border-color: transparent; }
:root[data-theme="dark"] .btn.ghost:hover { background: var(--accent); }
:root[data-theme="dark"] .btn.danger { background: #a63d2f; border-color: #a63d2f; color: #fff; }
:root[data-theme="dark"] .btn.danger:hover { background: #8f3326; }
:root[data-theme="dark"] .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Go / Stop keep their meaning in palette-friendly tones (white text 6.3:1). */
:root[data-theme="dark"] .btn.go { background: #2f6b45; border-color: #2f6b45; color: #fff; }
:root[data-theme="dark"] .btn.go:hover { background: #285c3b; }
:root[data-theme="dark"] .btn.stop { background: #a63d2f; border-color: #a63d2f; color: #fff; }
:root[data-theme="dark"] .btn.stop:hover { background: #8f3326; }

:root[data-theme="dark"] .badge { border-color: var(--border); color: var(--fg); background: var(--field); }
:root[data-theme="dark"] .badge.ok { background: var(--ok-bg); border-color: rgba(143, 199, 154, .35); color: var(--ok-fg); }
:root[data-theme="dark"] .badge.warn { background: var(--gold-soft); border-color: rgba(193, 154, 91, .45); color: var(--warn-fg); }
:root[data-theme="dark"] .badge.bad { background: rgba(166, 61, 47, .2); border-color: rgba(240, 160, 138, .35); color: var(--bad-fg); }
:root[data-theme="dark"] .badge.muted { color: var(--muted); }
:root[data-theme="dark"] .error-box { background: rgba(166, 61, 47, .16); border-color: rgba(240, 160, 138, .35); color: var(--bad-fg); }
:root[data-theme="dark"] .invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(224, 122, 95, .2) !important; }
:root[data-theme="dark"] .toast { background: var(--card); border-color: var(--border); border-left-color: var(--gold); }
:root[data-theme="dark"] .toast.success { border-left-color: var(--ok-fg); }
:root[data-theme="dark"] .toast.error { border-left-color: var(--danger); }
:root[data-theme="dark"] .modal-bg { background: rgba(15, 13, 12, .7); backdrop-filter: blur(2px); }
:root[data-theme="dark"] .modal { border: 1px solid var(--border); border-radius: 16px; }
:root[data-theme="dark"] .seg input:checked + span { background: var(--mocha); color: var(--offwhite); }
:root[data-theme="dark"] .ticket:hover, :root[data-theme="dark"] .ticket:focus-visible { border-color: var(--gold); }
:root[data-theme="dark"] .ticket-list .group, :root[data-theme="dark"] .ticket-list .group { color: var(--gold); }
:root[data-theme="dark"] .check input { accent-color: var(--gold); }
:root[data-theme="dark"] .done .check { background: var(--ok-bg); color: var(--ok-fg); }
:root[data-theme="dark"] .spinner { border-color: var(--border); border-top-color: var(--gold); }
:root[data-theme="dark"] a { color: var(--gold); }
:root[data-theme="dark"] a.btn, :root[data-theme="dark"] a.tile { color: inherit; }
:root[data-theme="dark"] a.btn.primary { color: var(--charcoal); }

/* ---- App bar ------------------------------------------------------------------------------- */
:root[data-theme="dark"] .appbar { background: rgba(36, 35, 35, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 rgba(193, 154, 91, .18); }
.appbar-left { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.appbar-logo { display: flex; align-items: baseline; gap: .35rem; text-decoration: none; color: var(--fg) !important; font-weight: 700; letter-spacing: .02em;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 1.05rem; white-space: nowrap; }
.appbar-logo .mark { color: var(--gold); font-size: .8rem; }
.appbar-logo .team { color: var(--gold); font-weight: 500; }
.appbar-back { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px; text-decoration: none;
  border: 1px solid rgba(193, 154, 91, .45); background: var(--gold-soft); color: var(--fg) !important; font-size: .85rem; font-weight: 500; white-space: nowrap; }
.appbar-back:hover, .appbar-back:focus-visible { border-color: var(--gold); outline: none; }
.appbar-back svg { width: 15px; height: 15px; color: var(--gold); }
.appbar-app { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: .9rem; border-left: 1px solid var(--border); }
.appbar-app:empty { display: none; }
@media (max-width: 560px) { .appbar-app { display: none; } .appbar-logo .team { display: none; } }

/* ---- "Asking ConnectWise for the latest data. Stand By." with thinking orbs -------------------- */
#cw-wait { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20, 18, 17, .72); backdrop-filter: blur(3px); opacity: 0; transition: opacity .25s ease; }
#cw-wait.on { opacity: 1; }
.cw-wait-card { text-align: center; padding: 2rem 2.25rem 1.6rem; border-radius: 18px; background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); max-width: 27rem; }
.cw-wait-card p { margin: 1.4rem 0 0; color: var(--muted); line-height: 1.5; }
.cw-wait-card b { color: var(--fg); font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 1.1rem; letter-spacing: .03em; }
.orbs { position: relative; width: 96px; height: 96px; margin: 0 auto; }
.orbs i { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border-radius: 50%;
  animation: orbit 2.4s cubic-bezier(.45, .05, .55, .95) infinite; }
.orbs i:nth-child(1) { background: radial-gradient(circle at 35% 30%, #f3dcb0, var(--gold) 60%, #8d6d39); box-shadow: 0 0 18px rgba(193, 154, 91, .8); }
.orbs i:nth-child(2) { background: radial-gradient(circle at 35% 30%, #c9a796, var(--mocha) 60%, #4a362d); box-shadow: 0 0 16px rgba(114, 85, 72, .8); animation-delay: -.6s; }
.orbs i:nth-child(3) { background: radial-gradient(circle at 35% 30%, #fffdf8, var(--offwhite) 60%, #bdb4a6); box-shadow: 0 0 16px rgba(244, 240, 232, .55); animation-delay: -1.2s; }
.orbs i:nth-child(4) { background: radial-gradient(circle at 35% 30%, #f3dcb0, var(--gold) 60%, #8d6d39); box-shadow: 0 0 14px rgba(193, 154, 91, .6); animation-delay: -1.8s; width: 12px; height: 12px; margin: -6px; }
@keyframes orbit {
  0%   { transform: rotate(0deg)   translateX(34px) scale(1);   opacity: 1; }
  25%  { transform: rotate(90deg)  translateX(22px) scale(.7);  opacity: .75; }
  50%  { transform: rotate(180deg) translateX(34px) scale(1.15); opacity: 1; }
  75%  { transform: rotate(270deg) translateX(22px) scale(.7);  opacity: .75; }
  100% { transform: rotate(360deg) translateX(34px) scale(1);   opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .orbs i { animation: pulse-orb 2s ease-in-out infinite; transform: translateX(calc((var(--n, 0) - 1.5) * 22px)); }
  .orbs i:nth-child(1) { --n: 0; } .orbs i:nth-child(2) { --n: 1; } .orbs i:nth-child(3) { --n: 2; } .orbs i:nth-child(4) { --n: 3; }
  @keyframes pulse-orb { 50% { opacity: .45; } }
}

html { background: var(--bg); }
