/* ================================================================
   Gusss Care — design system (Apple Human Interface inspired)
   ================================================================ */
:root {
  --bg: #f5f5f7;
  --bg-elev: #ffffff;
  --bg-sunken: #ececf0;
  --fill: rgba(118,118,128,.12);
  --fill-2: rgba(118,118,128,.08);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --sep: rgba(60,60,67,.14);
  --accent: #0066cc;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0,102,204,.09);
  --brand: linear-gradient(160deg, #3a3a3c 0%, #111113 100%);
  --brand-ink: #ffffff;
  --green: #248a3d; --green-soft: rgba(52,199,89,.14);
  --orange: #c93400; --orange-soft: rgba(255,149,0,.16);
  --red: #d70015; --red-soft: rgba(255,59,48,.12);
  --purple: #8944ab; --purple-soft: rgba(175,82,222,.13);
  --teal: #0071a4; --teal-soft: rgba(48,176,199,.14);
  --yellow: #a05a00; --yellow-soft: rgba(255,204,0,.2);
  --gray-soft: rgba(142,142,147,.16);
  --shadow-1: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  --shadow-2: 0 4px 12px rgba(0,0,0,.06), 0 16px 40px rgba(0,0,0,.08);
  --radius: 18px;
  --radius-sm: 12px;
  --glass: rgba(251,251,253,.78);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.55, 0, .75, .2);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur-1: .16s;
  --dur-2: .28s;
  --dur-3: .45s;
  --sidebar: 248px;
  --top: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --bg-elev: #1c1c1e; --bg-sunken: #2c2c2e;
    --fill: rgba(118,118,128,.24); --fill-2: rgba(118,118,128,.16);
    --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #8e8e93; --sep: rgba(84,84,88,.6);
    --accent: #2997ff; --accent-soft: rgba(41,151,255,.16);
    --brand: linear-gradient(160deg, #f5f5f7 0%, #c7c7cc 100%); --brand-ink: #111113;
    --green: #30d158; --green-soft: rgba(48,209,88,.18);
    --orange: #ff9f0a; --orange-soft: rgba(255,159,10,.18);
    --red: #ff453a; --red-soft: rgba(255,69,58,.18);
    --purple: #bf5af2; --purple-soft: rgba(191,90,242,.2);
    --teal: #64d2ff; --teal-soft: rgba(100,210,255,.16);
    --yellow: #ffd60a; --yellow-soft: rgba(255,214,10,.16);
    --gray-soft: rgba(142,142,147,.24);
    --shadow-1: 0 0 0 1px rgba(255,255,255,.05);
    --shadow-2: 0 0 0 1px rgba(255,255,255,.08), 0 20px 50px rgba(0,0,0,.6);
    --glass: rgba(22,22,24,.72);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.47 var(--font);
  letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01", "ss03"; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.022em; margin: 0; font-weight: 700; }
h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.12; }
h2 { font-size: 21px; line-height: 1.2; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; box-shadow: 0 0 0 1px var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hidden { display: none !important; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 24px; }
.boot-logo { width: 64px; height: 64px; border-radius: 16px; background: var(--brand); box-shadow: var(--shadow-2); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--fill); border-top-color: var(--text-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-left)); background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
}
.brand { display: flex; align-items: center; gap: 10px; text-align: left; font-weight: 600; font-size: 16px; color: var(--text); cursor: pointer; border: 0; background: none; padding: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--brand-ink); background: var(--brand); box-shadow: inset 0 0 0 .5px rgba(255,255,255,.12), 0 1px 2px rgba(0,0,0,.18); }
.brand-mark svg { width: 18px; height: 18px; }
.brand small { display: block; font-size: 11px; color: var(--text-2); font-weight: 500; line-height: 1; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #8e8e93, #636366); flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: calc(100vh - var(--top)); }
.sidebar { position: sticky; top: var(--top); height: calc(100vh - var(--top)); padding: 16px 12px; border-right: 0.5px solid var(--sep); overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; color: var(--text-3); font-weight: 600; padding: 12px 12px 6px; text-transform: uppercase; letter-spacing: .04em; }
.nav-item { position: relative; isolation: isolate; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 500; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; transition: background var(--dur-1) ease, color var(--dur-1) ease; }
.nav-item:hover { background: var(--fill-2); text-decoration: none; }
.nav-item.active { color: var(--accent); }
.nav-item.active:hover { background: none; }
/* The active highlight is its own element so it can glide between items (view transitions). */
.nav-pill { position: absolute; inset: 0; z-index: -1; border-radius: 10px; background: var(--accent-soft); view-transition-name: nav-pill; }
.nav-item svg { transition: transform var(--dur-2) var(--ease-spring); }
.nav-item:active svg { transform: scale(.9); }
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item .count { margin-left: auto; font-size: 12px; background: var(--red); color: #fff; border-radius: 10px; padding: 0 7px; line-height: 18px; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--text-3); }
.main { min-width: 0; padding: 28px clamp(16px, 4vw, 40px) 64px; }
.main.public { max-width: 1080px; margin: 0 auto; }
.page { max-width: 1240px; margin: 0 auto; animation: rise var(--dur-3) var(--ease-out) both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { color: var(--text-2); margin-top: 6px; font-size: 15px; }
.page-head .head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.tabbar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding-bottom: calc(96px + var(--safe-b)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--glass);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--sep); padding: 6px 4px calc(6px + var(--safe-b));
  }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 500; color: var(--text-3); border: 0; background: none; padding: 4px 0; cursor: pointer; position: relative; }
  .tab svg { width: 24px; height: 24px; }
  .tab { transition: color var(--dur-1) ease; }
  .tab svg { transition: transform var(--dur-2) var(--ease-spring); }
  .tab:active svg { transform: scale(.86); }
  .tab.active { color: var(--accent); }
  .tab-pill { position: absolute; top: -6px; left: 50%; width: 22px; height: 3px; margin-left: -11px; border-radius: 0 0 3px 3px; background: var(--accent); view-transition-name: tab-pill; }
  .tab .dot { position: absolute; top: 2px; left: 55%; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; line-height: 16px; padding: 0 4px; }
  .hide-sm { display: none !important; }
}

/* ---------- cards & grids ---------- */
.card { background: var(--bg-elev); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.card-head h3 { flex: 1; }
.card + .card, .stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g-2, .g-3 { grid-template-columns: 1fr; } .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.divider { height: 0.5px; background: var(--sep); margin: 16px 0; border: 0; }

/* ---------- KPI tiles ---------- */
.kpi { padding: 16px 18px; border-radius: var(--radius); background: var(--bg-elev); box-shadow: var(--shadow-1); text-align: left; border: 0; cursor: default; }
button.kpi { cursor: pointer; transition: transform .15s ease; }
button.kpi:hover { transform: translateY(-1px); }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-label svg { width: 15px; height: 15px; }
.kpi-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.t-red .kpi-value, .t-red .kpi-label { color: var(--red); }
.t-orange .kpi-value, .t-orange .kpi-label { color: var(--orange); }
.t-green .kpi-value, .t-green .kpi-label { color: var(--green); }
.t-blue .kpi-value, .t-blue .kpi-label { color: var(--accent); }
.t-purple .kpi-value, .t-purple .kpi-label { color: var(--purple); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 16px;
  border-radius: 980px; border: 0; font-weight: 500; font-size: 15px; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, transform .1s ease, opacity .15s ease; text-decoration: none !important;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--fill); color: var(--text); }
.btn-secondary:hover { background: var(--gray-soft); }
.btn-tinted { background: var(--accent-soft); color: var(--accent); }
.btn-plain { background: none; color: var(--accent); padding: 0 8px; }
.btn-plain:hover { background: var(--fill-2); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-success { background: var(--green); color: #fff; }
.btn-warn { background: var(--orange-soft); color: var(--orange); }
.btn-sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 50px; padding: 0 28px; font-size: 17px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .5; pointer-events: none; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--fill-2); display: grid; place-items: center; cursor: pointer; color: var(--text); flex: none; }
.icon-btn:hover { background: var(--fill); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- forms ---------- */
.field { display: block; }
.field > span, .label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin: 0 0 6px 2px; }
.field + .field, .field + .grid, .grid + .field { margin-top: 14px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--fill-2); color: var(--text); outline: none; transition: background .15s, border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.field select, select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.field textarea { min-height: 96px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { background: var(--bg-elev); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.hint { font-size: 12px; color: var(--text-3); margin: 6px 2px 0; }
.err { font-size: 13px; color: var(--red); margin-top: 8px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.search input { padding-left: 38px; min-height: 38px; border-radius: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 51px; height: 31px; border-radius: 16px; background: var(--fill); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .2s; }
.switch input:checked + .track { background: #34c759; }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--accent-soft); }

/* segmented control */
.seg { display: inline-flex; background: var(--fill-2); border-radius: 10px; padding: 2px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.seg button[aria-pressed="true"] { background: var(--bg-elev); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); font-weight: 600; }
.seg .n { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--sep); background: var(--bg-elev); border-radius: 980px; padding: 7px 14px; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .15s; }
.chip:hover { border-color: var(--text-3); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip svg { width: 15px; height: 15px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 980px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 20px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-OPEN { background: var(--accent-soft); color: var(--accent); }
.s-ASSIGNED { background: var(--purple-soft); color: var(--purple); }
.s-ASSESSED { background: var(--teal-soft); color: var(--teal); }
.s-AWAITING_RESOURCES { background: var(--yellow-soft); color: var(--yellow); }
.s-RESOURCES_GRANTED { background: var(--teal-soft); color: var(--teal); }
.s-IN_PROGRESS { background: var(--orange-soft); color: var(--orange); }
.s-ON_HOLD { background: var(--gray-soft); color: var(--text-2); }
.s-COMPLETED { background: var(--green-soft); color: var(--green); }
.s-CLOSED { background: var(--green-soft); color: var(--green); }
.s-REOPENED { background: var(--red-soft); color: var(--red); }
.s-CANCELLED { background: var(--gray-soft); color: var(--text-3); }
.prio { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.p-EMERGENCY { background: var(--red); color: #fff; }
.p-HIGH { background: var(--orange-soft); color: var(--orange); }
.p-NORMAL { background: var(--fill-2); color: var(--text-2); }
.p-LOW { background: var(--fill-2); color: var(--text-3); }

/* time-left pill */
.tl { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 980px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl svg { width: 13px; height: 13px; }
.tl-ok { background: var(--green-soft); color: var(--green); }
.tl-warn { background: var(--orange-soft); color: var(--orange); }
.tl-bad { background: var(--red-soft); color: var(--red); animation: pulse 2s ease-in-out infinite; }
.tl-done { background: var(--fill-2); color: var(--text-2); }
.tl-paused { background: var(--fill-2); color: var(--text-3); }
@keyframes pulse { 50% { opacity: .65; } }
.meter { height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; border-radius: 2px; background: currentColor; transition: width .4s; }

/* ---------- request list ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 220px; max-width: 360px; }
.toolbar select.input { width: auto; min-height: 38px; border-radius: 10px; font-size: 14px; }
.list { background: var(--bg-elev); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.req-row {
  display: grid; grid-template-columns: 4px minmax(0, 2.4fr) minmax(0, 1.4fr) minmax(0, 1.1fr) 150px 24px; gap: 14px; align-items: center;
  padding: 14px 18px 14px 0; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; transition: background .12s;
}
.req-row + .req-row { border-top: 0.5px solid var(--sep); }
.req-row:hover { background: var(--fill-2); }
.req-row .bar { align-self: stretch; border-radius: 0 3px 3px 0; background: transparent; }
.req-row.p-row-EMERGENCY .bar { background: var(--red); }
.req-row.p-row-HIGH .bar { background: #ff9500; }
.req-title { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.req-title span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-meta { font-size: 13px; color: var(--text-2); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.req-row .chev { color: var(--text-3); width: 18px; height: 18px; }
.req-row .col-tl { text-align: right; }
.compact .req-row { grid-template-columns: 4px minmax(0, 1fr) auto; grid-template-areas: "bar main tl" "bar sub sub"; row-gap: 6px; }
.compact .req-row .bar { grid-area: bar; }
.compact .req-row .col-main { grid-area: main; }
.compact .req-row .col-tl { grid-area: tl; }
.compact .req-row .col-loc { grid-area: sub; }
.compact .req-row .col-who, .compact .req-row .chev { display: none; }
@media (max-width: 960px) {
  .req-row { grid-template-columns: 4px minmax(0, 1fr) auto; grid-template-areas: "bar main tl" "bar sub sub"; row-gap: 6px; }
  .req-row .bar { grid-area: bar; }
  .req-row .col-main { grid-area: main; }
  .req-row .col-tl { grid-area: tl; }
  .req-row .col-loc { grid-area: sub; }
  .req-row .col-who, .req-row .chev { display: none; }
}

/* ---------- sheets (modals) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.32); display: flex; align-items: center; justify-content: center; padding: 24px; animation: bdin .2s ease; backdrop-filter: blur(2px); }
@keyframes bdin { from { opacity: 0; } }
.sheet { background: var(--bg); border-radius: 22px; box-shadow: var(--shadow-2); width: 100%; max-width: 520px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; animation: sheetin .28s cubic-bezier(.2,.9,.3,1.1); }
.sheet.wide { max-width: 880px; }
@keyframes sheetin { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px 22px; border-bottom: 0.5px solid var(--sep); background: var(--glass); }
.sheet-head h2 { font-size: 18px; flex: 1; min-width: 0; }
.sheet-body { padding: 20px 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.sheet-foot { padding: 12px 22px calc(12px + var(--safe-b)); border-top: 0.5px solid var(--sep); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: var(--glass); }
@media (max-width: 640px) {
  .sheet-backdrop { padding: 0; align-items: flex-end; }
  .sheet, .sheet.wide { max-width: none; max-height: 94vh; border-radius: 22px 22px 0 0; animation: sheetup .32s cubic-bezier(.2,.9,.3,1); }
  @keyframes sheetup { from { transform: translateY(100%); } }
  .sheet-head::before { content: ""; position: absolute; left: 50%; margin-left: -18px; top: 6px; width: 36px; height: 5px; border-radius: 3px; background: var(--fill); }
  .sheet-head { position: relative; padding-top: 18px; }
  .sheet-foot .btn { flex: 1; }
}

/* grouped list (iOS settings style) */
.group { background: var(--bg-elev); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-1); }
.group-title { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; margin: 22px 4px 8px; font-weight: 500; }
.group-title:first-child { margin-top: 0; }
.cell { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; min-height: 44px; }
.cell + .cell { border-top: 0.5px solid var(--sep); }
.cell .k { color: var(--text-2); width: 128px; flex: none; font-size: 14px; }
.cell .v { flex: 1; min-width: 0; word-wrap: break-word; }
.cell-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; color: #fff; }
.cell-ico svg { width: 17px; height: 17px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); top: 14px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); color: var(--text); box-shadow: var(--shadow-2); border-radius: 14px; padding: 11px 16px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; animation: toastin .3s cubic-bezier(.2,.9,.3,1.2); }
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.ok svg { color: #34c759; } .toast.bad svg { color: var(--red); }
@keyframes toastin { from { opacity: 0; transform: translateY(-12px) scale(.96); } }

/* ---------- public / hero ---------- */
.hero { text-align: center; padding: clamp(28px, 7vw, 72px) 0 32px; }
.hero .eyebrow { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .08em; }
.hero h1 { font-size: clamp(36px, 7vw, 60px); line-height: 1.05; letter-spacing: -0.035em; }
.hero p { font-size: clamp(17px, 2.2vw, 21px); color: var(--text-2); max-width: 620px; margin: 16px auto 0; line-height: 1.4; }
.action-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 760px; margin: 28px auto 0; }
@media (max-width: 620px) { .action-cards { grid-template-columns: 1fr; } }
.action-card { text-align: left; border: 0; cursor: pointer; padding: 26px; border-radius: 22px; background: var(--bg-elev); box-shadow: var(--shadow-1); transition: transform .2s ease, box-shadow .2s ease; display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.action-card .ac-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--brand-ink); background: var(--brand); }
.action-card .ac-ico.ac-2 { background: var(--accent-soft); color: var(--accent); }
.action-card .ac-ico svg { width: 26px; height: 26px; }
.action-card h3 { font-size: 21px; font-weight: 700; }
.action-card p { color: var(--text-2); }
.action-card .go { color: var(--accent); font-weight: 500; display: inline-flex; align-items: center; gap: 2px; margin-top: 4px; }
.action-card .go svg { width: 16px; height: 16px; transition: transform .2s; }
.action-card:hover .go svg { transform: translateX(3px); }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; max-width: 900px; margin: 56px auto 0; text-align: center; }
.features svg { width: 28px; height: 28px; color: var(--accent); margin: 0 auto 10px; }
.features h3 { font-size: 15px; } .features p { font-size: 14px; color: var(--text-2); margin-top: 4px; }
@media (max-width: 620px) { .features { grid-template-columns: 1fr; } }

/* ---------- wizard ---------- */
.wizard { max-width: 760px; margin: 0 auto; }
.steps { display: flex; gap: 6px; margin: 4px 0 24px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--fill); transition: background .3s; }
.steps i.on { background: var(--accent); }
.step-title { margin-bottom: 4px; }
.step-sub { color: var(--text-2); margin-bottom: 20px; }
.wizard-foot { display: flex; gap: 10px; margin-top: 28px; align-items: center; position: sticky; bottom: 0; padding: 12px 0 calc(12px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
@media (max-width: 860px) { .with-tabbar .wizard-foot { bottom: calc(62px + var(--safe-b)); } }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.cat-card { border: 2px solid transparent; background: var(--bg-elev); border-radius: 16px; box-shadow: var(--shadow-1); overflow: hidden; cursor: pointer; text-align: left; padding: 0; transition: transform .15s ease, border-color .15s; display: flex; flex-direction: column; color: var(--text); }
.cat-card:hover { transform: translateY(-2px); }
.cat-card.selected { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.cat-img { aspect-ratio: 4 / 3; background: var(--fill-2); display: grid; place-items: center; position: relative; overflow: hidden; }
.cat-img img { width: 100%; height: 100%; object-fit: cover; }
.cat-img .ph { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fff; }
.cat-img .ph svg { width: 28px; height: 28px; }
.cat-img .prio { position: absolute; top: 8px; right: 8px; }
.cat-body { padding: 10px 12px 12px; }
.cat-body b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.cat-body small { color: var(--text-2); font-size: 12px; }

.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; padding: 2px; }
.pick { border: 1px solid var(--sep); background: var(--bg-elev); border-radius: 12px; padding: 10px 6px; cursor: pointer; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; }
.pick:hover { border-color: var(--text-3); }
.pick[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.photo-drop { border: 1.5px dashed var(--sep); border-radius: 16px; padding: 20px; text-align: center; cursor: pointer; display: block; color: var(--text-2); transition: border-color .15s, background .15s; }
.photo-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.photo-drop svg { width: 28px; height: 28px; margin: 0 auto 6px; color: var(--accent); }
.geo-add { width: 100%; background: none; font: inherit; }
.geo-add.loading::after { margin: 8px auto 0; display: block; }
.geo-box { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 16px; background: var(--fill-2); }
.geo-box .v { flex: 1; min-width: 0; }
.photo-prev { position: relative; border-radius: 16px; overflow: hidden; max-width: 320px; }
.photo-prev img { width: 100%; max-height: 260px; object-fit: cover; }
.photo-prev .icon-btn { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.55); color: #fff; }

.token-display { font-family: var(--mono); font-size: clamp(26px, 6vw, 40px); font-weight: 700; letter-spacing: .04em; padding: 18px 24px; border-radius: 18px; background: var(--fill-2); display: inline-block; user-select: all; }
.success-ico { width: 72px; height: 72px; border-radius: 50%; background: #34c759; color: #fff; display: grid; place-items: center; margin: 0 auto 18px; animation: pop .45s cubic-bezier(.2,.9,.3,1.4); }
.success-ico svg { width: 38px; height: 38px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* progress stepper (tracking) */
.progress { display: flex; align-items: flex-start; margin: 8px 0 4px; }
.progress .ps { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--text-3); font-weight: 500; }
.progress .ps::before { content: ""; position: absolute; top: 11px; left: -50%; right: 50%; height: 2px; background: var(--fill); }
.progress .ps:first-child::before { display: none; }
.progress .ps i { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-elev); border: 2px solid var(--fill); display: grid; place-items: center; margin: 0 auto 6px; position: relative; z-index: 1; font-style: normal; }
.progress .ps i svg { width: 14px; height: 14px; }
.progress .ps.done { color: var(--text); }
.progress .ps.done i { background: var(--accent); border-color: var(--accent); color: #fff; }
.progress .ps.done::before, .progress .ps.cur::before { background: var(--accent); }
.progress .ps.cur i { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.progress .ps.cur { color: var(--accent); }
@media (max-width: 520px) { .progress .ps span { display: none; } .progress .ps.cur span { display: block; } }

/* timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--fill); border-radius: 1px; }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--text-3); }
.tl-item.st::before { border-color: var(--accent); background: var(--accent); }
.tl-item.internal::before { border-style: dashed; }
.tl-item .when { font-size: 12px; color: var(--text-3); }
.tl-item .what { font-size: 14px; }
.tl-item .note { font-size: 14px; color: var(--text-2); margin-top: 2px; white-space: pre-wrap; word-wrap: break-word; }
.lock-tag { font-size: 11px; color: var(--text-3); border: 1px solid var(--sep); border-radius: 5px; padding: 0 5px; margin-left: 4px; }

/* rating */
.stars { display: inline-flex; gap: 4px; }
.stars button { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--fill); }
.stars button svg { width: 34px; height: 34px; }
.stars button.on { color: #ff9f0a; }
.stars-ro { color: #ff9f0a; letter-spacing: 1px; white-space: nowrap; }

/* count ring */
.ring { width: 76px; height: 76px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 11px; line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; }

/* bars */
.bar-list { display: grid; gap: 12px; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; gap: 8px; }
.bar-row .top b { font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-track { height: 8px; border-radius: 4px; background: var(--fill-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .5s cubic-bezier(.2,.9,.3,1); transform-origin: left center; animation: grow .9s var(--ease-out) both .15s; }
@keyframes grow { from { transform: scaleX(0); } }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2); padding: 10px 14px; border-bottom: 0.5px solid var(--sep); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 0.5px solid var(--sep); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; } .table tr.click:hover td { background: var(--fill-2); }
.table input.input { min-height: 36px; padding: 6px 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* facilities columns */
.fac { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 960px) { .fac { grid-template-columns: 1fr; } }
.fac-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; color: var(--text); }
.fac-item + .fac-item { border-top: 0.5px solid var(--sep); }
.fac-item:hover { background: var(--fill-2); }
.fac-item.active { background: var(--accent-soft); color: var(--accent); }
.fac-item .c { margin-left: auto; font-size: 12px; color: var(--text-3); }
.fac-item.off { opacity: .45; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; padding: 14px; }
.room-chip { border-radius: 10px; background: var(--fill-2); padding: 8px 4px; text-align: center; font-weight: 600; font-size: 13px; cursor: pointer; border: 0; color: var(--text); }
.room-chip.off { opacity: .4; text-decoration: line-through; }

/* empty & skeleton */
.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty svg { width: 44px; height: 44px; color: var(--text-3); margin: 0 auto 12px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.sk { background: linear-gradient(90deg, var(--fill-2) 25%, var(--fill) 50%, var(--fill-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* misc */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--accent-soft); color: var(--text); font-size: 14px; }
.notice svg { width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 1px; }
.notice.warn { background: var(--orange-soft); } .notice.warn svg { color: var(--orange); }
.notice.bad { background: var(--red-soft); } .notice.bad svg { color: var(--red); }
.detail-hero { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.detail-hero .info { flex: 1; min-width: 0; }
.detail-photo { border-radius: 14px; overflow: hidden; max-width: 360px; background: var(--fill-2); min-height: 80px; }
.actions-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.items-table td { padding: 6px 4px; border: 0; }
.items-table th { padding: 4px; border: 0; }
.items-edit input.input { min-height: 40px; padding: 6px 10px; }
@media (max-width: 640px) {
  .items-edit thead { display: none; }
  .items-edit, .items-edit tbody { display: block; }
  .items-edit tr { display: grid; grid-template-columns: 1fr 1fr 1.4fr 36px; gap: 6px; align-items: center; padding: 8px 0; border-bottom: .5px solid var(--sep); }
  .items-edit td { padding: 0; }
  .items-edit td:first-child { grid-column: 1 / -1; }
}
.kbd { font-family: var(--mono); font-size: 12px; background: var(--fill-2); padding: 1px 6px; border-radius: 5px; }
.auth-wrap { max-width: 420px; margin: 4vh auto 0; }
.auth-wrap .card { padding: 28px; }
.auth-wrap .brand-mark { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px; }
.auth-wrap .brand-mark svg { width: 30px; height: 30px; }
.foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 48px; }

/* ---------- print (requisition slips) ---------- */
#print { display: none; }
@media print {
  body.printing > *:not(#print) { display: none !important; }
  body.printing #print { display: block; color: #000; font: 12pt/1.4 -apple-system, "Segoe UI", Arial, sans-serif; }
  #print h1 { font-size: 20pt; } #print table { width: 100%; border-collapse: collapse; margin: 12pt 0; }
  #print th, #print td { border: 1px solid #999; padding: 6pt; text-align: left; }
  #print .sig { display: flex; gap: 24pt; margin-top: 36pt; } #print .sig div { flex: 1; border-top: 1px solid #000; padding-top: 4pt; }
}
/* Reports, coverage, inspections */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.report-card { padding: 18px; display: flex; flex-direction: column; justify-content: space-between; transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); animation: rise .5s var(--ease-out) both; }
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.report-table td { white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.cov-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 980px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.cov-chip.all { background: var(--purple-soft); color: var(--purple); }
.cov-chip .mono { opacity: .7; font-weight: 500; }
.insp-row { padding: 12px 16px; transition: background var(--dur-1) ease; }
.insp-row + .insp-row { border-top: .5px solid var(--sep); }
.insp-row.attn { background: var(--orange-soft); }
.insp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.insp-head .v { flex: 1; min-width: 140px; }
.insp-note { margin-top: 10px; animation: rise .3s var(--ease-out) both; }
.insp-seg button[data-state="ATTN"][aria-pressed="true"] { color: var(--orange); }
.insp-seg button[data-state="OK"][aria-pressed="true"] { color: var(--green); }

/* Report preview: the printed document on a grey desk */
.sheet.doc-sheet { max-width: 1100px; }
.doc-frame { background: #e9e9ee; border-radius: 12px; padding: 18px; }
.doc-frame iframe { display: block; width: 100%; height: 66vh; box-sizing: border-box; padding: 22px 26px; border: 0; background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 12px 32px rgba(0,0,0,.12); }
@media (max-width: 640px) { .doc-frame { padding: 8px; } .doc-frame iframe { height: 62vh; padding: 12px; } }

/* Stores */
.stock-hint { margin-top: 4px; min-height: 0; }
.stock-hint.good { color: var(--green); } .stock-hint.bad { color: var(--red); font-weight: 600; } .stock-hint.warn { color: var(--orange); font-weight: 600; }
.bill-card { animation: rise .45s var(--ease-out) both; }
.bill-lines td { padding: 7px 8px; border-bottom: .5px solid var(--sep); }
.bill-lines th { padding: 4px 8px; }
.recv-edit input.input { min-height: 38px; }
@media (max-width: 640px) { .recv-edit tr { grid-template-columns: 1fr 1fr 1fr 1fr 36px; } }

/* Activity log */
.act-layout { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 1000px) { .act-layout { grid-template-columns: 1fr; } }
.act-row { align-items: flex-start; }
.act-time { width: 44px; flex: none; font-size: 12px; color: var(--text-3); padding-top: 6px; }
.act-row .cell-ico { margin-top: 1px; }
.act-sum { font-weight: 500; }
.act-who { margin-top: 2px; }
.act-detail { margin-top: 4px; color: var(--text-2); white-space: pre-wrap; word-wrap: break-word; }
.act-bad { background: linear-gradient(90deg, var(--red-soft), transparent 60%); }
.act-person { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 6px; border-radius: 10px; cursor: pointer; color: inherit; text-align: left; transition: background var(--dur-1) ease; }
.act-person:hover { background: var(--fill-2); }
.act-person .v { flex: 1; min-width: 0; }

/* ================================================================
   Motion — smooth, quiet, Apple-like. Everything respects
   "reduce motion" (see the last rule).
   ================================================================ */

/* Page-to-page: the top bar and side menu stay put; the page content
   cross-fades and lifts; the nav highlight glides to the new item. */
.topbar { view-transition-name: topbar; }
.sidebar { view-transition-name: sidebar; }
.tabbar { view-transition-name: tabbar; }
#main { view-transition-name: main; }
::view-transition-group(*) { animation-duration: var(--dur-3); animation-timing-function: var(--ease-out); }
::view-transition-old(main) { animation: vt-out var(--dur-1) var(--ease-in) both; }
::view-transition-new(main) { animation: vt-in var(--dur-3) var(--ease-out) both; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--dur-2); }
@keyframes vt-out { to { opacity: 0; transform: scale(.99); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }

/* Report wizard: steps slide forward / back. */
html[data-vt="forward"]::view-transition-old(main) { animation: slide-out-l var(--dur-2) var(--ease-in) both; }
html[data-vt="forward"]::view-transition-new(main) { animation: slide-in-r var(--dur-3) var(--ease-out) both; }
html[data-vt="back"]::view-transition-old(main) { animation: slide-out-r var(--dur-2) var(--ease-in) both; }
html[data-vt="back"]::view-transition-new(main) { animation: slide-in-l var(--dur-3) var(--ease-out) both; }
@keyframes slide-out-l { to { opacity: 0; transform: translateX(-40px); } }
@keyframes slide-in-r { from { opacity: 0; transform: translateX(48px); } }
@keyframes slide-out-r { to { opacity: 0; transform: translateX(40px); } }
@keyframes slide-in-l { from { opacity: 0; transform: translateX(-48px); } }

/* Signing in / out: the whole screen dissolves (no shared elements). */
html[data-vt="auth"] .topbar, html[data-vt="auth"] .sidebar, html[data-vt="auth"] .tabbar, html[data-vt="auth"] #main,
html[data-vt="auth"] .nav-pill, html[data-vt="auth"] .tab-pill { view-transition-name: none; }
html[data-vt="auth"]::view-transition-old(root) { animation: auth-out .42s var(--ease-in) both; }
html[data-vt="auth"]::view-transition-new(root) { animation: auth-in .6s var(--ease-out) both; }
@keyframes auth-out { to { opacity: 0; transform: scale(.96); filter: blur(6px); } }
@keyframes auth-in { from { opacity: 0; transform: scale(1.03); filter: blur(6px); } }

/* Frosted veil shown while signing in / out. */
.veil { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; align-content: center; gap: 18px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(28px); -webkit-backdrop-filter: saturate(180%) blur(28px);
  animation: veil-in .35s var(--ease-out) both; }
.veil .brand-mark { width: 64px; height: 64px; border-radius: 16px; animation: veil-mark .6s var(--ease-spring) both; }
.veil .brand-mark svg { width: 34px; height: 34px; }
.veil p { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -.01em; animation: rise .5s var(--ease-out) .08s both; }
.veil .spinner { animation: spin .8s linear infinite, fade .3s ease .15s both; }
@keyframes veil-in { from { opacity: 0; backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); } }
@keyframes veil-mark { from { opacity: 0; transform: scale(.7); } }

/* Dialogs leave as smoothly as they arrive. */
.sheet-backdrop.closing { animation: bdout var(--dur-2) var(--ease-in) both; pointer-events: none; }
.sheet-backdrop.closing .sheet { animation: sheetout var(--dur-2) var(--ease-in) both; }
@keyframes bdout { to { opacity: 0; } }
@keyframes sheetout { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@media (max-width: 640px) {
  .sheet-backdrop.closing .sheet { animation: sheetdown var(--dur-2) var(--ease-in) both; }
  @keyframes sheetdown { to { transform: translateY(100%); } }
}

/* Content arrives in a gentle cascade. */
.list > .req-row, .cat-grid > *, .grid > .kpi, .page .group > .cell, .table tbody tr, .bar-list > *, .action-card, .features > *, .timeline > .tl-item, #trackOut > * {
  animation: rise .5s var(--ease-out) both;
}
.list > :nth-child(2), .cat-grid > :nth-child(2), .grid > .kpi:nth-child(2), .group > .cell:nth-child(2), .table tbody tr:nth-child(2), .bar-list > :nth-child(2), .action-card:nth-child(2), .features > :nth-child(2), .timeline > :nth-child(2) { animation-delay: .04s; }
.list > :nth-child(3), .cat-grid > :nth-child(3), .grid > .kpi:nth-child(3), .group > .cell:nth-child(3), .table tbody tr:nth-child(3), .bar-list > :nth-child(3), .features > :nth-child(3), .timeline > :nth-child(3) { animation-delay: .08s; }
.list > :nth-child(4), .cat-grid > :nth-child(4), .grid > .kpi:nth-child(4), .group > .cell:nth-child(4), .table tbody tr:nth-child(4), .bar-list > :nth-child(4), .timeline > :nth-child(4) { animation-delay: .12s; }
.list > :nth-child(5), .cat-grid > :nth-child(5), .grid > .kpi:nth-child(5), .group > .cell:nth-child(5), .table tbody tr:nth-child(5), .bar-list > :nth-child(5), .timeline > :nth-child(5) { animation-delay: .16s; }
.list > :nth-child(6), .cat-grid > :nth-child(6), .grid > .kpi:nth-child(6), .group > .cell:nth-child(6), .table tbody tr:nth-child(6), .bar-list > :nth-child(6), .timeline > :nth-child(6) { animation-delay: .2s; }
.list > :nth-child(7), .cat-grid > :nth-child(7), .table tbody tr:nth-child(7), .group > .cell:nth-child(7), .timeline > :nth-child(7) { animation-delay: .24s; }
.list > :nth-child(8), .cat-grid > :nth-child(8), .table tbody tr:nth-child(8), .group > .cell:nth-child(8) { animation-delay: .28s; }
.list > :nth-child(n+9), .cat-grid > :nth-child(n+9), .table tbody tr:nth-child(n+9), .group > .cell:nth-child(n+9) { animation-delay: .32s; }
/* No cascade while typing in a search box (the list redraws on every key). */
.quiet *, .quiet { animation: none !important; }
/* Dialog contents are already animated by the dialog itself. */
.sheet .group > .cell, .sheet .table tbody tr, .sheet .timeline > .tl-item { animation: none; }

/* Countdown rings fill on arrival. */
.ring svg circle:nth-child(2) { animation: ring-in 1.1s var(--ease-out) both .1s; }
@keyframes ring-in { from { stroke-dashoffset: 188.5; } }

/* Tactile feedback & smooth state changes. */
.chip, .seg button, .pick, .cat-card, .kpi, .icon-btn, .fac-item, .room-chip, .req-row { transition: background var(--dur-1) ease, color var(--dur-1) ease, border-color var(--dur-1) ease, box-shadow var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-spring); }
.chip:active, .pick:active, .cat-card:active, .room-chip:active, button.kpi:active, .icon-btn:active { transform: scale(.96); }
.seg button[aria-pressed="true"] { animation: seg-pop var(--dur-2) var(--ease-spring); }
@keyframes seg-pop { from { transform: scale(.94); } }
.req-row:active { background: var(--fill); }
.success-ico svg path { stroke-dasharray: 30; animation: draw .5s var(--ease-out) .25s both; }
@keyframes draw { from { stroke-dashoffset: 30; } }
.steps i { transition: background var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-spring); }
.steps i.on { transform: scaleY(1.25); }
.photo-prev, .geo-box { animation: rise .4s var(--ease-out) both; }
.err:not(.hidden) { animation: shake .4s var(--ease-out); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
