/* Компоненты вебаппа; те же размеры и цвета — в Compose (ui/components). */
.app { min-height: 100%; display: flex; flex-direction: column; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }
/* Снизу запас под меню и клавиатуру (--kb из main.js): экран прокручивается до конца, фиксированное ею не перекрыто. */
.screen { flex: 1; padding: 16px 16px calc(var(--nav-h) + 16px + var(--kb, 0px)); display: flex; flex-direction: column; gap: var(--gap); }
.screen.no-nav { padding-bottom: calc(16px + var(--kb, 0px)); }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; 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; }

.i { width: 24px; height: 24px; flex: none; display: inline-block; vertical-align: middle; }
.i use { pointer-events: none; }
.i.sm, .i.star-sm { width: 16px; height: 16px; }
.i.star-sm { color: var(--warning); }

.card { background: var(--surface); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.tap { cursor: pointer; }
.card.warn { box-shadow: inset 0 0 0 1.5px var(--warning); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px; border-radius: var(--radius-sm); font-weight: 500; background: var(--surface2); color: var(--onSurface); width: 100%; transition: transform .1s; }
.btn:active { transform: scale(.98); }
.btn .i { width: 20px; height: 20px; }
.btn.primary { background: var(--primary); color: var(--onPrimary); }
.btn.secondary { background: var(--secondary); color: var(--onSecondary); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 38px; padding: 0 14px; width: auto; font-size: 14px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.card .btn:not(.primary):not(.secondary) { background: var(--surface2); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.input, textarea.input, select.input { width: 100%; min-height: 48px; padding: 11px 14px; border: 1.5px solid transparent; border-radius: 14px; background: var(--surface2); outline: none; }
.input:focus { border-color: var(--onSurface); }
.input::placeholder { color: var(--muted); }
textarea.input { min-height: 110px; resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--primary); }
.error { color: var(--danger); font-size: 14px; }

/* Плитки: выбранная — тонированная акцентом с обводкой. Ширина не меньше 140 px (на телефоне две в ряд):
   подписи переносятся только по словам (webapp/README.md), а слово вроде «Противобуксовочные» уже трети экрана не влезает. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.groups { display: flex; flex-direction: column; gap: 8px; }
.groups h3.group { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); text-align: left; min-height: 92px; }
.card .tile { background: var(--surface2); }
.tile .i { color: var(--muted); }
.tile.on, .card .tile.on { color: var(--onSurface); background: color-mix(in srgb, var(--primary) 14%, var(--surface)); box-shadow: inset 0 0 0 1.5px var(--primary); }
.tile.on .i { color: var(--primary); }
.tile .label { font-size: 13px; line-height: 1.25; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; padding: 5px 11px; border-radius: 999px; background: color-mix(in srgb, var(--secondary) 12%, var(--surface)); color: var(--secondary); }
.chip .i { width: 16px; height: 16px; }
.chip.warn { background: color-mix(in srgb, var(--warning) 22%, var(--surface)); color: color-mix(in srgb, var(--warning) 45%, var(--onSurface)); }
.chip.danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.chip.ok { background: var(--onSurface); color: var(--background); }
button.chip { cursor: pointer; background: var(--surface2); color: var(--onSurface); padding: 8px 14px; font-size: 14px; }
.chip.on, button.chip.on { background: var(--onSurface); color: var(--background); }

.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: var(--onPrimary); font-size: 11px; font-weight: 700; }
.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: calc(var(--nav-h) + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-around; gap: 4px; padding: 0 10px env(safe-area-inset-bottom); background: var(--surface); box-shadow: 0 -1px 0 var(--outline); z-index: 5; }
.nav a { position: relative; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 23px; color: var(--muted); font-size: 14px; font-weight: 500; transition: background .2s, color .2s; }
.nav a .label { display: none; }
.nav a.active { background: var(--onSurface); color: var(--background); }
.nav a.active .label { display: inline; }
.nav a .badge { position: absolute; top: 2px; left: 28px; border: 2px solid var(--surface); height: 20px; }
.nav a.active .badge { border-color: var(--onSurface); }

.map { width: 100%; height: 44vh; min-height: 240px; border-radius: var(--radius); overflow: hidden; background: var(--surface2); }
.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; }
/* Строки списка в одной карточке (профиль, другие машины). */
.lrows { background: var(--surface); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.lrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left; color: var(--onSurface); }
.lrow + .lrow { border-top: 1px solid var(--outline); }
.lrow-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--surface2); }
.lrow-ic .i { width: 20px; height: 20px; }
.lrow-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.lrow-go { width: 18px; height: 18px; color: var(--muted); }
.lrow.danger { color: var(--danger); justify-content: center; font-weight: 500; }
.lrow.danger .lrow-ic { background: none; color: var(--danger); }
.lrow.danger .lrow-t { flex: none; }

.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: 9px 13px; border-radius: 18px; max-width: 88%; white-space: pre-wrap; font-size: 15px; }
.msg.user { align-self: flex-end; background: var(--onSurface); color: var(--background); border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 6px; }

.code { font-size: 36px; letter-spacing: 8px; font-weight: 700; text-align: center; padding: 8px; font-variant-numeric: tabular-nums; }
.stars { display: flex; gap: 6px; }
.stars button { color: var(--outline); } .stars button.on { color: var(--warning); }
.stars .i { width: 32px; height: 32px; }
.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: 13px 16px; border-radius: var(--radius-sm); background: var(--onSurface); color: var(--background); z-index: 20; box-shadow: var(--shadow); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 14px; }
.segmented { display: flex; padding: 3px; border-radius: 14px; background: var(--surface2); }
.hint-wrap { display: block; position: relative; }
.hint-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; max-height: 264px; overflow-y: auto; padding: 4px 0; border: 1px solid var(--outline); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
.hint-list button { display: block; width: 100%; padding: 11px 16px; text-align: left; color: var(--onSurface); }
.hint-list button:active { background: var(--surface2); }
.save-fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px); width: 58px; height: 58px; border-radius: 50%; background: var(--primary); color: var(--onPrimary); display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 22px -8px var(--primary); z-index: 6; }
.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; width: 100%; }
.pro .call { margin-top: 4px; }
.pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); z-index: 3; pointer-events: none; color: var(--primary); filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.pin .i { width: 44px; height: 44px; }
.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; display: flex; align-items: center; gap: 8px; background: var(--onSurface); color: var(--background); padding: 9px 13px; border-radius: 14px; font-size: 14px; box-shadow: var(--shadow); }
.tip .i { width: 18px; height: 18px; }
button.counter { text-align: left; }
/* Над кнопкой чата с запасом: fixed от низа окна — та же точка отсчёта, что у чата и аварийки
   (высота .map-full в мини-приложениях считается от --tg-viewport-stable-height и с ней не совпадает). */
.map-ctl { position: fixed; right: 20px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 170px); display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.map-ctl button { width: 46px; height: 46px; border-radius: var(--radius-sm); background: var(--surface); color: var(--onSurface); display: grid; place-items: center; box-shadow: var(--shadow); }
.map-ctl button.locate { margin-top: 8px; color: var(--secondary); }
.status { font-size: 14px; color: var(--muted); }
.warn { font-size: 14px; color: color-mix(in srgb, var(--warning) 55%, var(--onSurface)); }
.segmented button { padding: 9px 6px; font-size: 14px; border-radius: 11px; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--onSurface); font-weight: 500; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
:root[data-theme="dark"] .segmented button.on { background: var(--background); }

/* Адаптив: любой ряд кнопок/чипов переносится целиком, слова не рвутся по слогам (правило — webapp/README.md). */
.btn, .chip, .segmented button, .tile .label, .nav a { overflow-wrap: normal; word-break: keep-all; hyphens: manual; }
.row.nowrap { flex-wrap: nowrap; }
.row.nowrap > .col, .row.nowrap > div:not(.row) { min-width: 0; flex: 1; }
.segmented { flex-wrap: wrap; }
.segmented button { flex: 1 1 auto; white-space: nowrap; }

.color-dot { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--outline); vertical-align: middle; margin-right: 6px; }
.dot-holder .color-dot { width: 20px; height: 20px; margin: 0; }
.dot-holder:empty { display: none; }
.vehicle-line { display: flex; align-items: center; gap: 0; }
.avatar { flex: none; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: var(--secondary); color: var(--onSecondary); }

/* Госномер: пропорции настоящего, белый в обеих темах. */
.plate { display: inline-flex; align-items: stretch; height: 40px; border: 2px solid #111; border-radius: 6px; background: #fff; color: #111; font-weight: 600; line-height: 1; overflow: hidden; align-self: flex-start; }
.plate.plain { align-items: center; padding: 0 10px; font-size: 22px; letter-spacing: .04em; }
.pl-main { display: flex; align-items: flex-end; gap: 3px; padding: 0 9px 5px; font-size: 30px; }
.pl-main i { font-style: normal; font-size: 23px; }
.pl-reg { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 7px; border-left: 2px solid #111; }
.pl-reg b { font-size: 19px; font-weight: 600; }
.pl-rus { display: flex; align-items: center; gap: 2px; font-size: 7px; font-weight: 700; }
.flag { width: 10px; height: 7px; background: linear-gradient(#fff 33%, #1c57a5 33% 66%, #d52b1e 66%); outline: .5px solid #999; }
.plate.sm { height: 26px; border-width: 1.5px; border-radius: 4px; }
.plate.sm.plain { font-size: 14px; padding: 0 6px; }
.plate.sm .pl-main { font-size: 18px; padding: 0 5px 3px; gap: 2px; } .plate.sm .pl-main i { font-size: 14px; }
.plate.sm .pl-reg { padding: 0 4px; border-left-width: 1.5px; } .plate.sm .pl-reg b { font-size: 12px; } .plate.sm .pl-rus { font-size: 5px; } .plate.sm .flag { width: 7px; height: 5px; }

/* Цифры карточек: машина, рейтинг. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--surface2); }
.stats b { font-size: 22px; line-height: 1.1; font-weight: 700; }
.stats span { font-size: 12px; color: var(--muted); line-height: 1.25; }
