:root {
  --ink: #152238;
  --muted: #607086;
  --line: #d8e0ea;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --brand: #183153;
  --brand-strong: #10243f;
  --accent: #2b6cb0;
  --success: #1f7a4d;
  --warning: #9a6410;
  --danger: #a63c3c;
  --shadow: 0 10px 30px rgba(21, 34, 56, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { background: var(--surface-soft); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(43, 108, 176, 0.08), transparent 32rem),
    var(--surface-soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  background: transparent;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(1rem + env(safe-area-inset-top)) 1rem 0.9rem;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  box-shadow: 0 8px 24px rgba(16, 36, 63, 0.22);
}

.eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  opacity: 0.78;
}

.app-header h1 {
  margin: 0;
  font-size: 1.85rem;
  line-height: 1;
  letter-spacing: 0.04em;
}

.subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.86rem;
  opacity: 0.88;
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 14px;
  color: #fff;
  background: rgba(255,255,255,0.10);
  font-size: 1.35rem;
  cursor: pointer;
}

.main-content { padding: 1rem 1rem 7rem; }

.app-footer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  width: min(100%, 720px);
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  font-size: 0.76rem;
}

.card {
  padding: 1rem;
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 1rem; }
.center-card { text-align: center; padding: 2rem 1rem; }

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.section-title h2, .section-title h3 { margin: 0; }
.section-title p { margin: 0.28rem 0 0; color: var(--muted); font-size: 0.9rem; }

.step-kicker {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field { margin-top: 1rem; }
.field:first-child { margin-top: 0; }

label, .field-label {
  display: block;
  margin-bottom: 0.42rem;
  font-size: 0.88rem;
  font-weight: 750;
}

.input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 0.8rem;
  border: 1px solid #bcc8d7;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea { min-height: 100px; resize: vertical; }
.input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43,108,176,0.14);
}

.help {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.search-wrap { position: relative; }
.search-results {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow);
}

.search-result {
  width: 100%;
  padding: 0.8rem;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  color: var(--ink);
  background: #fff;
}
.search-result:last-child { border-bottom: 0; }
.search-result:active { background: #edf4fc; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-top: 1rem;
}

.primary-button, .secondary-button, .danger-button, .ghost-button {
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 800;
  cursor: pointer;
}

.primary-button { color: #fff; background: var(--brand); }
.secondary-button { color: var(--brand); background: #e9f1fb; border-color: #c7d8ee; }
.danger-button { color: #fff; background: var(--danger); }
.ghost-button { color: var(--ink); background: #fff; border-color: var(--line); }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.inline-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; }
.inline-actions > * { flex: 1 1 140px; }

.notice {
  padding: 0.8rem 0.9rem;
  border-radius: 13px;
  font-size: 0.86rem;
  line-height: 1.45;
}
.notice.info { color: #174a7a; background: #e8f2fd; }
.notice.warning { color: #6d480b; background: #fff4d8; }
.notice.error { color: #7e2828; background: #fdeaea; }
.notice.success { color: #175c3b; background: #e5f5ec; }

.trolley-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fbfcfe;
}
.trolley-card + .trolley-card { margin-top: 0.85rem; }

.trolley-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.trolley-head h3 { margin: 0; font-size: 1rem; }
.small-button {
  min-height: 38px;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--danger);
  background: #fff;
  font-weight: 700;
}

.photo-box {
  margin-top: 0.75rem;
  padding: 0.8rem;
  border: 1px dashed #9eb0c5;
  border-radius: 13px;
  background: #f7f9fc;
}
.photo-box input { width: 100%; }
.photo-preview {
  display: block;
  width: 100%;
  max-height: 280px;
  margin-top: 0.7rem;
  object-fit: contain;
  border-radius: 12px;
  background: #e9eef5;
}

.summary-bar {
  position: sticky;
  bottom: 3.2rem;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 15px;
  color: #fff;
  background: var(--brand);
  box-shadow: var(--shadow);
}
.summary-bar strong { font-size: 1rem; }
.summary-bar span { font-size: 0.8rem; opacity: 0.86; }

.session-card {
  width: 100%;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  text-align: left;
  color: var(--ink);
  background: #fff;
}
.session-card + .session-card { margin-top: 0.75rem; }
.session-card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.session-meta { display: grid; gap: 0.18rem; color: var(--muted); font-size: 0.82rem; }

.check-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.6rem;
  align-items: start;
  margin-top: 0.85rem;
}
.check-row input { width: 22px; height: 22px; margin: 0.1rem 0 0; }
.check-row label { margin: 0; font-weight: 600; line-height: 1.4; }

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 1rem;
  border: 4px solid #d9e3ef;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.bold { font-weight: 800; }

@media (min-width: 620px) {
  .main-content { padding: 1.25rem 1.25rem 7rem; }
  .action-grid { grid-template-columns: 1fr 1fr; }
}

.custom-entry {
  margin-top: 0.75rem;
  padding: 0.8rem;
  border: 1px solid #c7d8ee;
  border-radius: 13px;
  background: #f4f8fd;
}

.field-disabled {
  opacity: 0.55;
}

.field-disabled .input {
  background: #eef2f6;
}
