:root {
  --bg: #0f1720;
  --bg-soft: #16212d;
  --card: #1b2836;
  --card-2: #213243;
  --line: #2b3d4f;
  --text: #e8eef4;
  --muted: #8da3b8;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --danger: #f87171;
  --green: #34d399;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #16303a 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Навигация ── */
.nav {
  display: flex; align-items: center;
  gap: 8px 14px; padding: 14px 18px; max-width: 880px; margin: 0 auto; flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-right: auto; white-space: nowrap; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-account { display: flex; align-items: center; gap: 8px; }
.nav-link { color: var(--muted); font-size: 14px; padding: 6px 10px; border-radius: 10px; }
.nav-link:hover { color: var(--text); background: var(--bg-soft); }
.nav-link.muted { opacity: 0.7; }
.nav-user { display: flex; align-items: center; gap: 9px; background: var(--card); padding: 5px 12px 5px 5px; border-radius: 999px; border: 1px solid var(--line); }
.nav-user:hover { border-color: var(--accent); }
.nav-user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.nav-name { font-size: 13px; font-weight: 600; }
.nav-bal { font-size: 12px; color: var(--muted); }
.nav-bal.neg { color: var(--danger); }
.nav-bal.pos { color: var(--green); }

.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--card-2); font-weight: 700; }
.avatar-ph { color: var(--accent); }
.avatar-lg { width: 64px; height: 64px; font-size: 26px; }

/* ── Контейнер ── */
.container { max-width: 880px; margin: 0 auto; padding: 8px 18px 80px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0 40px; }

/* ── Flash ── */
.flash { max-width: 844px; margin: 4px auto; padding: 11px 16px; border-radius: 12px; font-size: 14px; }
.flash-ok { background: rgba(45, 212, 191, 0.12); color: var(--accent); border: 1px solid rgba(45, 212, 191, 0.3); }
.flash-err { background: rgba(248, 113, 113, 0.12); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.3); }

/* ── Hero ── */
.hero { padding: 18px 4px 22px; }
.hero h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -0.03em; }
.hero .sub { margin: 0; color: var(--muted); max-width: 520px; }

/* ── Сетка карточек ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

.trip-card { display: flex; flex-direction: column; gap: 8px; transition: transform 0.12s ease, border-color 0.12s ease; }
.trip-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.trip-dates { display: flex; align-items: baseline; gap: 8px; }
.date-range { font-weight: 700; font-size: 18px; }
.date-range.big { font-size: 24px; }
.date-dow { font-size: 12px; color: var(--muted); text-transform: lowercase; }
.trip-card h3 { margin: 0; font-size: 17px; }
.trip-desc { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.trip-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 10px; }
.price { font-weight: 700; }
.price .per { font-weight: 400; color: var(--muted); font-size: 12px; }
.seats { font-size: 13px; color: var(--green); background: rgba(52, 211, 153, 0.12); padding: 3px 9px; border-radius: 999px; }
.seats.low { color: #fbbf24; background: rgba(251, 191, 36, 0.12); }
.seats.full { color: var(--muted); background: var(--bg-soft); }

.empty { color: var(--muted); padding: 24px; text-align: center; background: var(--bg-soft); border-radius: var(--radius); border: 1px dashed var(--line); }
.empty a { color: var(--accent); }

/* ── Деталь сплава ── */
.back { color: var(--muted); font-size: 14px; display: inline-block; margin: 6px 0 14px; }
.back:hover { color: var(--text); }
.trip-detail-head { display: flex; align-items: center; gap: 12px; }
.trip-detail h1 { margin: 8px 0; font-size: 28px; letter-spacing: -0.02em; }
.lead { color: var(--muted); font-size: 15px; max-width: 560px; }
.badge { font-size: 12px; color: var(--accent); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; text-transform: lowercase; }
.badge-past { color: var(--muted); border-color: var(--muted); }
.past-note { color: var(--muted); }
.trip-card.is-past { opacity: 0.62; }
.trip-card.is-past:hover { opacity: 0.85; }
.seats.past { color: var(--muted); }
.facts { display: flex; gap: 12px; margin: 18px 0; flex-wrap: wrap; }
.fact { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.fact-k { font-size: 12px; color: var(--muted); }
.fact-v { font-size: 18px; font-weight: 700; }
.fact-v.neg { color: var(--danger); }

/* ── Формы ── */
.book-form { max-width: 460px; margin-top: 10px; }
.book-form h3 { margin: 0 0 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 11px; padding: 11px 13px; font-size: 15px; font-family: inherit; width: 100%; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.check input { width: auto; }
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }
.total-row strong { font-size: 22px; color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 4px 0; }
.cta-box { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--muted); }

/* ── Кнопки ── */
.btn { cursor: pointer; border: none; border-radius: 11px; padding: 12px 18px; font-size: 15px; font-weight: 600; font-family: inherit; }
.btn-primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #06222b; width: 100%; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-ghost.danger:hover { color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Профиль ── */
.profile-head { display: flex; align-items: center; gap: 16px; margin: 14px 0 18px; }
.profile-head h1 { margin: 0; font-size: 24px; }
.balance-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.balance-card.neg { border-color: rgba(248, 113, 113, 0.4); }
.balance-card.pos { border-color: rgba(52, 211, 153, 0.4); }
.balance-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.balance-amount { font-size: 38px; font-weight: 800; letter-spacing: -0.02em; }
.balance-card.neg .balance-amount { color: var(--danger); }
.balance-card.pos .balance-amount { color: var(--green); }
.balance-note { font-size: 13px; color: var(--muted); }

.section-title { font-size: 18px; margin: 26px 0 12px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 13px 16px; }
.row-muted { opacity: 0.55; }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; align-items: flex-start; }
.row-main strong { font-size: 15px; }
.row-side { display: flex; align-items: center; gap: 10px; }
.amount { font-weight: 700; }
.amount.neg { color: var(--danger); }
.amount.pos { color: var(--green); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.neg { color: var(--danger); }
.pos { color: var(--green); }

.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.tag-green { background: rgba(52, 211, 153, 0.14); color: var(--green); }
.chat-badge { display: inline-block; vertical-align: middle; font-size: 12px; font-weight: 700; color: #fb923c; background: rgba(251, 146, 60, 0.14); border: 1px solid rgba(251, 146, 60, 0.4); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.tag-grey { background: var(--bg-soft); color: var(--muted); }

/* ── Админка ── */
.admin-block { margin: 22px 0; }
.admin-block h2 { font-size: 18px; margin: 0 0 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid .field { margin-bottom: 0; }
.admin-trip { margin-bottom: 12px; }
.admin-trip-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-trip-head strong { margin-right: 8px; }
.admin-trip-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-trip-actions form { display: inline; }
.bookings-mini { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.bm-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.bm-row form { display: inline; }
.bm-name { flex: 1; min-width: 0; }
.bm-amount { white-space: nowrap; }
.btn-paid { background: rgba(52, 211, 153, 0.16); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.4); }
.btn-paid:hover { background: rgba(52, 211, 153, 0.24); }
.narrow { max-width: 420px; margin: 30px auto; }

/* ── Анонсы ── */
.announce { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 18px; }
.ann { display: flex; gap: 12px; background: linear-gradient(100deg, rgba(45,212,191,0.1), rgba(56,189,248,0.06)); border: 1px solid rgba(45,212,191,0.28); border-radius: var(--radius); padding: 14px 16px; }
.ann-pin { font-size: 18px; line-height: 1.3; }
.ann-body { min-width: 0; }
.ann-body h3 { margin: 0 0 4px; font-size: 16px; }
.ann-body p { margin: 0; color: var(--text); white-space: pre-wrap; line-height: 1.5; word-break: break-word; }

/* ── Календарь (компактный) ── */
.cal { margin: 8px 0 26px; padding: 16px; }
.cal-head { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 14px; }
.cal-label { margin: 0; font-size: 19px; text-transform: capitalize; min-width: 170px; text-align: center; }
.cal-nav { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; font-size: 22px; line-height: 1; color: var(--text); }
.cal-nav:hover { border-color: var(--accent); color: var(--accent); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 5px; }
.cal-weekdays span { text-align: center; font-size: 11px; color: var(--muted); }
.cal-grid-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cd { height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 9px; font-size: 14px; font-weight: 500; background: var(--bg-soft); color: var(--muted); border: 1px solid transparent; font-family: inherit; }
.cd.out { opacity: 0.3; }
.cd.we { background: #182533; }
.cd.today { border-color: var(--accent); color: var(--accent); font-weight: 700; }
button.cd.can-add { cursor: pointer; }
button.cd.can-add:hover { background: var(--card-2); border-color: var(--accent); color: var(--text); }
/* дни сплавов — подкрашены, кликабельны */
.cd.trip { color: #06222b; font-weight: 700; }
.cd.trip.free { background: var(--accent); }
.cd.trip.low { background: #fbbf24; }
.cd.trip.full { background: var(--card-2); color: var(--muted); border-color: var(--line); }
.cd.trip.past { background: #475569; color: #cbd5e1; border-color: #475569; }
.cd.trip:hover { filter: brightness(1.1); }
/* скругление только по краям диапазона, середина «склеена» */
.cd.trip:not(.st) { border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
.cd.trip:not(.en) { border-top-right-radius: 2px; border-bottom-right-radius: 2px; }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.cal-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.cal-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.dot.free { background: var(--accent); } .dot.low { background: #fbbf24; } .dot.full { background: var(--card-2); border: 1px solid var(--line); } .dot.past { background: #475569; }
.cal-tip { font-size: 12px; color: var(--muted); }
.cal-loading { opacity: 0.5; transition: opacity 0.1s; }

/* ── Карта плота ── */
.map-head h1 { margin: 6px 0 2px; }
.map-head { margin-bottom: 12px; }
.raft-map { height: 440px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.leaflet-popup-content { color: #06222b; }
.map-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 4px; }
.ms { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.ms-k { font-size: 12px; color: var(--muted); }
.ms-v { font-size: 19px; font-weight: 700; }
.rp-form { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 8px; }
.rp-form-2 { display: grid; grid-template-columns: repeat(2, 1fr) auto; gap: 8px; }
.rp-form-2 select, .rp-form-2 button { grid-column: span 1; }
.rp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-actions form { display: inline; }
.edit-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 8px; background: var(--card); border: 1px solid var(--accent); border-radius: 18px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 14px; max-width: min(680px, calc(100% - 20px)); }
.edit-bar > span { white-space: nowrap; flex-basis: 100%; text-align: center; }
.edit-bar input { width: auto; flex: 1 1 110px; min-width: 80px; padding: 7px 10px; font-size: 13px; border-radius: 10px; }
.edit-bar input[type="date"] { flex: 0 1 150px; }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; font-size: 16px; line-height: 1; flex: none; }
.coord-readout { margin: 10px 0 4px; padding: 10px 14px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.coord-readout b { color: var(--text); font-variant-numeric: tabular-nums; }
.cr-bad { color: var(--danger); }

/* ── О плоте ── */
.info-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.info-block { margin-bottom: 14px; }
.info-block h2 { font-size: 18px; margin: 0 0 10px; }
.info-body { white-space: pre-wrap; line-height: 1.55; word-break: break-word; }
.info-edit { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.info-edit summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.drink-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.drink-grid .field { margin-bottom: 0; }
.drink-out { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line); line-height: 1.7; }
.drink-out b { color: var(--accent); font-variant-numeric: tabular-nums; }
.drink-box { margin: 6px 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); padding: 10px 14px; }
.drink-box > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); list-style: none; }
.drink-box > summary::-webkit-details-marker { display: none; }
.drink-box > summary::before { content: '▸ '; }
.drink-box[open] > summary::before { content: '▾ '; }
.row-claimed { opacity: 0.7; }
.claimed-by { color: var(--green); font-size: 12px; }
@media (max-width: 560px) { .drink-grid { grid-template-columns: 1fr 1fr; } }

/* маркеры на карте + легенда */
.mkr-wrap { background: none !important; border: none !important; }
.mkr { position: relative; display: inline-block; font-size: 24px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7)); }
.mkr.now { filter: drop-shadow(0 0 6px rgba(56,189,248,0.9)); }
.mkr.past { filter: grayscale(1) brightness(1.15) drop-shadow(0 1px 2px rgba(0,0,0,0.7)); opacity: 0.9; }
.mkr.future { filter: grayscale(0.55); opacity: 0.95; }
.mkr.pick { filter: drop-shadow(0 0 5px rgba(56,189,248,0.9)); }
.mkr.pick.bad { filter: drop-shadow(0 0 5px rgba(248,113,113,0.95)) saturate(1.4); }
.mkr.live { font-size: 27px; }
.mkr.live.moving { filter: drop-shadow(0 0 7px rgba(45,212,191,1)); animation: raftPulse 1.6s ease-in-out infinite; }
.mkr.live.moving::after { content: ''; position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 2px solid rgba(45,212,191,0.7); animation: raftRing 1.6s ease-out infinite; }
.mkr.live.idle { filter: grayscale(0.2) drop-shadow(0 1px 3px rgba(0,0,0,0.8)); }
.live-panel h2 { margin: 0 0 4px; }
.time-scrub input[type=range] { width: 100%; accent-color: var(--accent); margin: 2px 0; }
@keyframes raftPulse { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.08); } }
@keyframes raftRing { 0% { transform: scale(0.5); opacity: 0.9; } 100% { transform: scale(1.5); opacity: 0; } }

/* баннер live-трансляции */
.live-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 12px; font-size: 14px; }
.live-banner.on-air { border-color: rgba(45,212,191,0.5); background: rgba(45,212,191,0.08); }
.live-banner.stale { border-color: var(--line); color: var(--muted); }
.live-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.live-banner.on-air .live-dot { background: #2dd4bf; box-shadow: 0 0 0 0 rgba(45,212,191,0.7); animation: liveDot 1.4s infinite; }
@keyframes liveDot { 0% { box-shadow: 0 0 0 0 rgba(45,212,191,0.7); } 70% { box-shadow: 0 0 0 8px rgba(45,212,191,0); } 100% { box-shadow: 0 0 0 0 rgba(45,212,191,0); } }
.mkr .q { position: absolute; top: -7px; right: -9px; font-size: 12px; font-style: normal; font-weight: 800; color: #06222b; background: #fbbf24; border-radius: 50%; width: 16px; height: 16px; display: grid; place-items: center; }
.legend { padding: 14px 16px; }
.legend h2 { font-size: 15px; margin: 0 0 10px; }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; font-size: 13px; color: var(--muted); }
.legend-grid > span { display: inline-flex; align-items: center; gap: 8px; }
.legend-grid .mkr { font-size: 19px; }
.river-progress { padding: 16px; margin-bottom: 12px; }
.rp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 15px; margin-bottom: 8px; }
.rp-pct { font-weight: 800; font-size: 18px; color: var(--accent); }
.rp-bar { height: 12px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.rp-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width 0.4s ease; }
.rp-bottom { margin-top: 8px; font-size: 13px; }
.legs { padding: 14px 16px; margin-top: 12px; }
.legs h2 { font-size: 15px; margin: 0 0 10px; }
.leg { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.leg:last-child { border-bottom: none; }
@media (max-width: 560px) { .rp-form-2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .raft-map { height: 340px; }
  .rp-form { grid-template-columns: 1fr 1fr; }
  .map-stats { grid-template-columns: 1fr; }
}

/* ── Пополнение кошелька ── */
.topup { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.topup-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.topup-info strong { font-size: 15px; }

/* ── Бронь с участниками ── */
.bk { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 13px 16px; }
.bk-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bk-link { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; align-items: flex-start; border-radius: 8px; transition: color 0.12s ease; }
.bk-link:hover strong { color: var(--accent); }
.bk-go { color: var(--muted); font-size: 13px; transition: transform 0.12s ease; display: inline-block; }
.bk-link:hover .bk-go { color: var(--accent); transform: translateX(3px); }
.bk-mates { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.mates { display: flex; flex-wrap: wrap; gap: 8px; }
.mate { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px 3px 3px; font-size: 13px; }
.mate-av { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--card-2); font-size: 12px; font-weight: 700; }
.mate-ph { color: var(--accent); }

/* ── Диалог создания сплава ── */
dialog.mk { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: var(--radius); padding: 0; max-width: 440px; width: calc(100% - 32px); box-shadow: var(--shadow); }
dialog.mk::backdrop { background: rgba(6, 12, 18, 0.6); backdrop-filter: blur(2px); }
.mk-form { padding: 20px; }
.mk-form h3 { margin: 0 0 16px; }
.mk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mk-actions { display: flex; gap: 10px; margin-top: 8px; }
.mk-actions .btn { flex: 1; }

/* ── Пагинация ── */
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 22px 0 6px; }
.pg-arrow { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; font-size: 20px; color: var(--text); background: var(--card); }
.pg-arrow:hover { border-color: var(--accent); color: var(--accent); }
.pg-arrow.disabled { opacity: 0.3; pointer-events: none; }
.pg-info { font-size: 14px; color: var(--muted); }

.book-form.booked { border-color: rgba(52, 211, 153, 0.4); }
.book-form.booked h3 { color: var(--green); margin-top: 0; }

/* ── Вход через Telegram ── */
.btn-tg { display: inline-flex; align-items: center; gap: 7px; background: linear-gradient(90deg, #2aabee, #229ed9); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.btn-tg:hover { filter: brightness(1.07); }
.btn-tg svg { flex: none; }
.tglogin { text-align: center; }
.tg-icon { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #2aabee, #229ed9); }
.tglogin h1 { font-size: 22px; margin: 0 0 8px; }
.tglogin .muted { margin: 0 0 18px; }
.btn-lg { display: inline-block; padding: 14px 22px; font-size: 16px; width: 100%; }
.tg-wait { margin: 16px 0 6px; color: var(--muted); font-size: 14px; opacity: 0; transition: opacity 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.tg-wait.show { opacity: 1; }
.tg-denied { margin: 14px 0 4px; padding: 12px 14px; border-radius: 12px; font-size: 14px; background: rgba(248,113,113,0.12); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .hero h1 { font-size: 24px; }
  .hero { padding: 12px 4px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: 1; }
  /* на телефоне прячем имя, но баланс оставляем (если он есть) */
  .nav-name { display: none; }
  .nav-user-meta:not(.has-bal) { display: none; }
  .nav-user { padding: 4px; gap: 6px; }
  .nav-user-meta.has-bal { padding-right: 6px; }
  .nav-bal { font-size: 13px; font-weight: 600; }
  /* шапка: ряд 1 — лого + аккаунт по краям, ряд 2 — ссылки разделов на всю ширину */
  .nav { padding: 12px 14px; gap: 8px 8px; }
  .nav-account { margin-left: auto; }
  .nav-links { order: 3; flex-basis: 100%; justify-content: space-between; gap: 4px; }
  .nav-links .nav-link { flex: 1; text-align: center; padding: 8px 6px; background: var(--bg-soft); }
  .nav-link { font-size: 13px; }
  .container { padding: 8px 12px 70px; }
  .cal { padding: 12px; }
  .cal-grid-days, .cal-weekdays { gap: 4px; }
  .cd { height: 40px; font-size: 13px; border-radius: 8px; }
  .cal-label { font-size: 17px; min-width: 140px; }
  .mk-row { grid-template-columns: 1fr 1fr; }
}

/* ── Вахтовый сплав: бейджи, выбор сегментов, чипы ── */
.badge-shift { display: inline-block; vertical-align: middle; font-size: 12px; font-weight: 700; color: var(--accent-2); background: rgba(56, 189, 248, 0.14); border: 1px solid rgba(56, 189, 248, 0.4); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.tag-shift { background: rgba(56, 189, 248, 0.14); color: var(--accent-2); }

.seg-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.seg-opt { display: flex; align-items: center; gap: 10px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; cursor: pointer; transition: border-color 0.12s ease; }
.seg-opt:hover { border-color: var(--muted); }
.seg-opt input { width: auto; accent-color: var(--accent); }
.seg-opt:has(input:checked) { border-color: var(--accent); background: rgba(45, 212, 191, 0.08); }
.seg-opt.full { opacity: 0.5; cursor: not-allowed; }
.seg-name { flex: 1; font-weight: 600; font-size: 15px; }
.seg-free { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* сетка сегментов вахты: колонка на сегмент, в ней — люди */
.seg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; }
.seg-col { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.seg-col-head { font-size: 13px; font-weight: 700; color: var(--accent); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.seg-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 6px 0; }
.seg-person { display: flex; align-items: center; gap: 7px; min-width: 0; }
.seg-person-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-xs { width: 22px; height: 22px; font-size: 11px; flex: 0 0 auto; }

.seg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.seg-chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); color: var(--muted); }
.seg-chip.on { color: var(--accent); border-color: rgba(45, 212, 191, 0.4); background: rgba(45, 212, 191, 0.1); }

/* ── Список участников ── */
.avatar-sm { width: 30px; height: 30px; font-size: 13px; flex: 0 0 auto; }
/* ── Сворачиваемая карточка-секция ── */
details.collapsible > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::after { content: '▸'; margin-left: auto; color: var(--muted); font-size: 18px; transition: transform 0.15s ease; }
details.collapsible[open] > summary::after { transform: rotate(90deg); }
details.collapsible .sum-h { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
details.collapsible[open] > summary { margin-bottom: 6px; }

/* ── Tricount: расходы ── */
.bal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 6px 0 4px; }
.bal { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; }
.bal-name { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bal-val { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bal.pos { border-color: rgba(52, 211, 153, 0.4); } .bal.pos .bal-val { color: var(--green); }
.bal.neg { border-color: rgba(248, 113, 113, 0.4); } .bal.neg .bal-val { color: var(--danger); }
.add-exp { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); padding: 10px 14px; }
.add-exp > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); }
.share-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.share-opt { display: flex; align-items: center; gap: 7px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 14px; cursor: pointer; }
.share-opt input { width: auto; accent-color: var(--accent); }
.receipt-thumb { flex: 0 0 auto; display: block; width: 42px; height: 42px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.receipt-add { cursor: pointer; color: var(--accent); display: inline-block; margin-top: 2px; }
.recognize-form { margin-top: 4px; }
.from-receipt-btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin-top: 4px; }

/* Подвоз: персональный баннер и предупреждение */
.carpool-banner { margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 14px; }
.carpool-banner.ok { border-color: var(--green); }
.carpool-warn { margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: rgba(251,191,36,0.1); border: 1px solid #fbbf24; color: #fbbf24; font-size: 13px; }
.janki-check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.sug-line { display: block; margin-top: 2px; }
.pax { display: inline-flex; align-items: center; gap: 3px; margin-right: 8px; white-space: nowrap; }
.pax-f { display: inline; margin: 0; }
.pax-f button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 2px; }
.pax-f button.pax-take { color: var(--accent); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.pax-f button.pax-take:hover { border-color: var(--accent); }

/* Бухгалтерия плота */
.buh-head { margin-bottom: 12px; }
.buh-head h1 { margin: 6px 0 4px; }
.buh-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.buh-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--bg-soft); border-radius: 12px; }
.buh-stat-label { font-size: 13px; color: var(--muted); }
.buh-stat-val { font-size: 22px; font-weight: 700; }
.buh-verdict { font-size: 15px; font-weight: 600; margin: 8px 0 0; }
/* Вишлист */
.wl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.wl-item { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); text-decoration: none; color: inherit; }
.wl-item:hover { border-color: var(--accent); }
.wl-img { width: 100%; height: 110px; object-fit: contain; border-radius: 8px; background: #fff; }
.wl-img-ph { display: flex; align-items: center; justify-content: center; font-size: 36px; background: var(--bg); }
.wl-info { display: flex; flex-direction: column; gap: 3px; }
.wl-title { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wl-price { font-weight: 700; font-size: 14px; }
.buh-edit { align-self: stretch; width: 100%; margin-top: 4px; }
.buh-edit > summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; user-select: none; }
.buh-edit > summary::-webkit-details-marker { display: none; }

/* Модалка подтверждения (замена браузерного confirm) */
.modal-overlay { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.modal-overlay[hidden] { display: none; }
.modal-box { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,.4); padding: 20px; }
.modal-msg { margin: 0 0 18px; font-size: 15px; line-height: 1.45; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions .btn { min-width: 92px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Оверлей-крутилка при загрузке/распознавании чека */
.plot-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.plot-overlay[hidden] { display: none; }
.plot-overlay-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 32px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0,0,0,.3); text-align: center; max-width: 80vw; }
.plot-overlay-box > span:first-of-type { font-weight: 600; font-size: 15px; }
.plot-spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: plot-spin .8s linear infinite; }
@keyframes plot-spin { to { transform: rotate(360deg); } }

/* Строка траты с распознанными позициями: крестик и фото — к верху, не по центру */
.exp-row { align-items: flex-start; }
.exp-row .receipt-thumb, .exp-row .row-side { margin-top: 2px; }
.exp-row .row-main { overflow: hidden; }

/* Позиции распознанного чека — свёрнуты, раскрываются по клику */
.items-details { margin-top: 6px; align-self: stretch; max-width: 100%; }
.items-details > summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; display: inline-flex; align-items: center; gap: 4px; user-select: none; }
.items-details > summary::-webkit-details-marker { display: none; }
.items-details > summary::before { content: '▸'; font-size: 11px; transition: transform .15s; }
.items-details[open] > summary::before { transform: rotate(90deg); }
.items-list { margin-top: 6px; display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-width: 100%; align-self: stretch; }
.item-form { margin: 0; width: 100%; }
.item-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; background: var(--bg-soft); box-sizing: border-box; }
.item-btn { width: 100%; border: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.item-btn:hover { background: var(--bg); }
.item-check { flex: 0 0 auto; font-size: 14px; }
.item-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-price { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.item-off .item-name { text-decoration: line-through; opacity: .5; }
.item-off .item-price { text-decoration: line-through; opacity: .5; }
.item-off .item-check { opacity: .5; }

.mate-row { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.mate-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* ── Сборы: категории + чекбоксы ── */
.cat-head { font-size: 13px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin: 14px 0 6px; }
.cat-head:first-of-type { margin-top: 4px; }
.chk-toggle { flex: 0 0 auto; }
.chk-box { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); color: #06222b; font-weight: 800; font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.chk-box.on { background: var(--accent); border-color: var(--accent); }
.chk-box.taken { background: var(--card-2); border-color: var(--line); color: var(--green); cursor: default; }
.qty-badge { flex: 0 0 auto; min-width: 40px; height: 26px; padding: 0 8px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); color: var(--muted); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.qty-badge.done { background: var(--accent); border-color: var(--accent); color: #06222b; }
.qty-claim { display: flex; align-items: center; gap: 6px; }
.qty-claim input { width: 56px; padding: 6px 8px; text-align: center; }
.cap-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); flex: 0 0 auto; }
.cap-field input { width: 52px; padding: 6px 8px; text-align: center; }

/* машины и подвоз */
.meet-row { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.mini-edit > summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-top: 6px; }
.cars-forms { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.mini-h { display: block; width: 100%; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.cars-map { height: 260px; border-radius: 12px; overflow: hidden; margin: 12px 0 8px; border: 1px solid var(--line); }
.cars-legend { margin-bottom: 6px; }
.dest-sel { flex: 0 1 150px; max-width: 160px; padding: 8px 10px; font-size: 13px; }
.meet-row code { background: var(--card-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.mini-edit code { background: var(--card-2); padding: 1px 5px; border-radius: 5px; }

/* единые отступы между блоками на странице карты */
.map-page > * { margin: 0 0 14px; }
.map-page > script, .map-page > link, .map-page > .edit-bar { margin: 0; }
.map-page > *:last-child { margin-bottom: 0; }
