.app { min-height: 100%; display: flex; flex-direction: column; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }
.screen { flex: 1; padding: 16px 16px calc(var(--nav-h) + 16px); display: flex; flex-direction: column; gap: var(--gap); }
.screen.no-nav { padding-bottom: 16px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }

.card { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card.tap { cursor: pointer; }
.card.warn { border-color: var(--warning); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--outline); color: var(--onSurface); width: 100%; }
.btn.primary { background: var(--primary); color: var(--onPrimary); border-color: var(--primary); }
.btn.secondary { background: var(--secondary); color: var(--onSecondary); border-color: var(--secondary); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; width: auto; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sos { min-height: 72px; font-size: 20px; border-radius: 20px; box-shadow: 0 6px 20px rgba(216,67,21,.35); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; color: var(--muted); }
.input, textarea.input, select.input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--outline); border-radius: 10px; background: var(--surface); }
textarea.input { min-height: 110px; resize: vertical; }
.error { color: var(--danger); font-size: 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border: 2px solid var(--outline); border-radius: 12px; background: var(--surface); text-align: left; min-height: 74px; }
.tile.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.tile .icon { font-size: 22px; }
.tile .label { font-size: 14px; line-height: 1.2; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--secondary) 12%, var(--surface)); color: var(--secondary); }
.chip.warn { background: color-mix(in srgb, var(--warning) 20%, var(--surface)); color: #7a5b00; }
.chip.danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.chip.ok { background: color-mix(in srgb, var(--success) 12%, var(--surface)); color: var(--success); }

.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 12px; text-align: center; }
.state { font-weight: 600; }
.state.open { color: var(--secondary); } .state.chosen, .state.confirmed { color: var(--success); } .state.expired, .state.cancelled { color: var(--muted); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h); display: flex; background: var(--surface); border-top: 1px solid var(--outline); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 12px; position: relative; }
.nav a.active { color: var(--primary); }
.nav a .badge { position: absolute; top: 8px; right: calc(50% - 22px); }

.map { width: 100%; height: 44vh; min-height: 240px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--outline); background: #e8e8e8; }
.map.tall { height: 60vh; }
.map-fallback { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); padding: 16px; text-align: center; }

.list { display: flex; flex-direction: column; gap: 8px; }
.steps { padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.chat { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.msg { padding: 8px 12px; border-radius: 12px; max-width: 88%; white-space: pre-wrap; font-size: 15px; }
.msg.user { align-self: flex-end; background: color-mix(in srgb, var(--secondary) 15%, var(--surface)); }
.msg.assistant { align-self: flex-start; background: color-mix(in srgb, var(--muted) 12%, var(--surface)); }

.code { font-size: 36px; letter-spacing: 8px; font-weight: 700; text-align: center; padding: 8px; }
.stars { display: flex; gap: 6px; font-size: 28px; }
.stars button { color: #bbb; } .stars button.on { color: var(--warning); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--outline); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + 12px); padding: 12px 14px; border-radius: 12px; background: #333; color: #fff; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; border: 1px solid var(--outline); }
.segmented { display: flex; border: 1px solid var(--outline); border-radius: 10px; overflow: hidden; }
.hint-wrap { display: block; }
.save-fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px); width: 60px; height: 60px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 26px; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(216,67,21,.4); z-index: 6; }
.mode-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mode-row .btn.small { width: auto; }
.wheels { display: flex; align-items: center; gap: 6px; }
.wheels select { min-height: 44px; font-size: 20px; font-weight: 600; padding: 4px 8px; width: 74px; }
hr { border: 0; border-top: 1px solid var(--outline); margin: 4px 0; }
.chips.filters { margin-bottom: 4px; }
.chip.on { background: var(--primary); color: #fff; }
button.chip { cursor: pointer; }
.pro .call { margin-top: 4px; }
.pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); font-size: 40px; z-index: 3; pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,.35); }
.map-bottom { position: absolute; left: 16px; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.tip { align-self: flex-start; background: #333; color: #fff; padding: 8px 12px; border-radius: 10px; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
button.counter { text-align: left; }
.map-ctl { position: absolute; right: 12px; top: calc(50% + 24px); display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.map-ctl button { width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 95%, transparent); color: var(--onSurface); font-size: 22px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.status { font-size: 14px; color: var(--muted); }
.segmented button { flex: 1; padding: 10px 6px; font-size: 14px; }
.segmented button.on { background: var(--primary); color: #fff; }
