:root {
  color-scheme: dark;
  --bg: #17171b;
  --surface: #212126;
  --raised: #2b2b31;
  --ink: #f7f5f9;
  --muted: #b6b2be;
  --line: #38373f;
  --accent: #d5c2fc;
  --on-accent: #2b1e40;
  --tint: #383044;
  --crew: #89d6be;
  --note: #e2bd85;
  --danger: #ffacb0;
  --danger-bg: #48282e;
  --shadow: 0 16px 48px #0005;
  --dock-clearance: calc(98px + env(safe-area-inset-bottom, 0px));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--bg);
  scroll-padding-bottom: var(--dock-clearance);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f6f4;
  --surface: #fff;
  --raised: #edecea;
  --ink: #232228;
  --muted: #625f69;
  --line: #d9d6db;
  --accent: #63448e;
  --on-accent: #fff;
  --tint: #eae2f5;
  --crew: #226c56;
  --note: #80581f;
  --danger: #9c3446;
  --danger-bg: #f8e4e7;
  --shadow: 0 16px 48px #231e3020;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; padding-top: env(safe-area-inset-top); -webkit-text-size-adjust: 100%; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 6vw, 2.75rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.16rem; line-height: 1.25; letter-spacing: -.025em; }
h3 { font-size: 1rem; line-height: 1.3; }
button, input, select, textarea, summary { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button, select, summary { cursor: pointer; }
button, .icon-button {
  border: 0; border-radius: 12px; min-height: 44px; padding: 8px 14px;
  background: var(--raised); font-weight: 620; font-size: .9rem; touch-action: manipulation;
}
button:disabled, select:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:active:not(:disabled), summary:active { filter: brightness(.91); }
svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; }
.primary { background: var(--accent); color: var(--on-accent); }
button.destructive { background: var(--danger-bg); color: var(--danger); }
input, select, textarea { font-size: 1rem; }
input:not([type="radio"]), textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); min-height: 46px; line-height: 1.48;
}
textarea { display: block; resize: vertical; }
textarea::placeholder { color: var(--muted); }
label, legend { font-size: .86rem; font-weight: 620; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
#preview-banner { padding: 5px 12px; text-align: center; color: var(--accent); background: var(--tint); font-size: .74rem; }
.gate { max-width: 440px; margin: clamp(22px, 8vh, 90px) auto; padding: 22px; }
.gate > img { border-radius: 15px; width: 56px; height: 56px; margin-bottom: 24px; }
.gate h1 { font-size: 2rem; margin-bottom: 15px; }
.gate p, .gate li { color: var(--muted); line-height: 1.55; }
.gate ol { padding: 0 0 0 1.45rem; margin: 22px 0; }
.gate li { padding: 7px 0 7px 5px; }
.gate li::marker, .gate strong { color: var(--ink); font-weight: 650; }
.gate label { display: block; margin: 22px 0 8px; }
.gate .primary { width: 100%; margin-top: 12px; }
.gate .gate-foot { margin-top: 18px; font-size: .85rem; }
.gate #retry { margin-top: 14px; }
.field-error, .gate .field-error { color: var(--danger); font-size: .9rem; margin-top: 10px; }
.error-box { color: var(--danger); font-size: .86rem; line-height: 1.4; }
.error-line:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--danger-bg); padding: 7px 12px; border-radius: 12px; margin: 12px 0; }
.error-line button { color: var(--ink); background: transparent; flex: none; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
dialog {
  width: min(440px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line);
  border-radius: 23px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow);
  max-height: calc(100dvh - env(safe-area-inset-top) - 20px); overflow-y: auto;
}
dialog::backdrop { background: #09080cb0; }
.confirm-content { padding: 25px; }
.confirm-content > p { margin: 10px 0; font-size: .94rem; line-height: 1.55; white-space: pre-line; }
.confirm-content > p:not(.field-error) { color: var(--muted); }
.confirm-content label { display: block; margin: 16px 0 7px; }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.confirm-actions button { flex: 1 0 auto; }
#remove-cleaning-note { color: var(--danger); background: transparent; }
.toast {
  position: fixed; z-index: 12; bottom: var(--dock-clearance); left: 50%; transform: translateX(-50%);
  max-width: 90vw; width: max-content; padding: 11px 18px; font-size: .9rem; border-radius: 16px;
  color: var(--bg); background: var(--ink); box-shadow: var(--shadow); text-align: center;
}
@media (max-width: 600px) {
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0; }
  .confirm-content { padding: 26px max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation: none !important; }
}
