:root {
  --bg: #EDF1F5;
  --surface: #FFFFFF;
  --ink: #16202C;
  --muted: #5B6776;
  --line: #D5DCE4;
  --line-soft: #E6EBF0;
  --navy: #16325C;
  --primary: #1E4E8C;
  --primary-soft: #E3ECF7;
  --paid: #2E7D57;
  --deposit: #D9981C;
  --unpaid: #C2413A;
  --free-line: #9FACBA;
  --radius: 10px;
  --seat: 44px;
  --font: Onest, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid #7FA7DC; outline-offset: 2px; }
[hidden] { display: none !important; }

/* Горна лента */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 10px 22px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand-mark { width: 26px; height: 18px; border-radius: 8px 4px 4px 8px; background: #fff; position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: 5px; top: 4px; width: 5px; height: 5px; border-radius: 2px; background: var(--navy); box-shadow: 7px 0 0 var(--navy), 14px 0 0 var(--navy); }
.mainnav { display: flex; gap: 4px; }
.mainnav a { color: #C9D6E8; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-weight: 500; }
.mainnav a:hover, .mainnav a.active { color: #fff; background: rgba(255,255,255,.12); }
.search { flex: 1; max-width: 420px; margin-left: auto; }
.search input { width: 100%; border: 0; border-radius: 8px; padding: 8px 12px; background: rgba(255,255,255,.14); color: #fff; }
.search input::placeholder { color: #B6C5DA; }
.search input:focus { background: #fff; color: var(--ink); outline: none; }
.userchip { display: grid; grid-template-columns: auto auto; column-gap: 12px; align-items: center; font-size: 13px; }
.user-name { font-weight: 600; }
.user-role { grid-row: 2; color: #B6C5DA; font-size: 12px; }
.logout { grid-row: 1 / span 2; grid-column: 2; color: #C9D6E8; font-size: 13px; }

.app { max-width: 1320px; margin: 0 auto; padding: 24px 22px 80px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 8px; }
.back:hover { color: var(--primary); }
.section-title { font-size: 17px; font-weight: 600; margin: 28px 0 10px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 18px 0; }

/* Бутони и форми */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 7px; cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--free-line); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--navy); border-color: var(--navy); }
.btn-danger { color: var(--unpaid); }
.btn-danger:hover { border-color: var(--unpaid); }
.btn-ghost { background: transparent; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
input:not([type=checkbox]):not([type=radio]), select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font-size: 15px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { background: #FBEAEA; color: #8E2B25; border-radius: 7px; padding: 8px 12px; margin: 0 0 12px; font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 15px; color: var(--ink); font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.check .price { margin-left: auto; color: var(--muted); }

/* Статуси */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.badge::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--free-line); }
.badge.paid::before { background: var(--paid); }
.badge.deposit::before { background: var(--deposit); }
.badge.unpaid::before { background: var(--unpaid); }
.badge.cancelled { color: var(--muted); text-decoration: line-through; }
.badge.overdue { color: var(--unpaid); }

/* Табло */
.attention { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.alert { display: block; background: var(--surface); border-left: 4px solid var(--deposit); border-radius: 0 8px 8px 0; padding: 10px 14px; text-decoration: none; color: var(--ink); }
.alert.overdue { border-color: var(--unpaid); }
.alert.waitlist { border-color: var(--primary); }
.alert strong { display: block; }
.alert span { color: var(--muted); font-size: 14px; }
.alert:hover { background: #F7F9FB; }

.ex-list { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.ex-row { display: grid; grid-template-columns: minmax(200px, 1.3fr) minmax(220px, 2fr) minmax(150px, .8fr); gap: 20px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.ex-row:last-child { border-bottom: 0; }
.ex-row:hover { background: #F7F9FB; }
.ex-row h3 { font-size: 17px; font-weight: 600; }
.ex-row .dates { color: var(--muted); font-size: 14px; margin-top: 2px; }
.ex-row.past { opacity: .62; }
.occ-top { display: flex; gap: 14px; font-size: 14px; margin-bottom: 6px; }
.occ-top .full { color: var(--unpaid); font-weight: 600; }
.mini-seats { display: flex; flex-wrap: wrap; gap: 2px; }
.mini-seats i { width: 7px; height: 11px; border-radius: 2px; background: #fff; box-shadow: inset 0 0 0 1px var(--free-line); }
.mini-seats i.paid { background: var(--paid); box-shadow: none; }
.mini-seats i.deposit { background: var(--deposit); box-shadow: none; }
.mini-seats i.unpaid { background: var(--unpaid); box-shadow: none; }
.ex-money { text-align: right; font-size: 14px; }
.ex-money div { color: var(--muted); }
.ex-money strong { color: var(--ink); font-weight: 600; }

/* Екскурзия */
.ex-head h1 { font-size: 28px; }
.ex-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); margin-top: 6px; }
.ex-facts b { color: var(--ink); font-weight: 600; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--ink); border-color: var(--primary); }
.tabs a .count { font-size: 12px; background: var(--line-soft); border-radius: 10px; padding: 1px 7px; margin-left: 4px; }

.seat-layout { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 12px; }
.panel h2 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.legend { display: grid; gap: 8px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legend-row .sw { width: 18px; height: 18px; border-radius: 5px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--free-line); }
.legend-row .sw.paid { background: var(--paid); box-shadow: none; }
.legend-row .sw.deposit { background: var(--deposit); box-shadow: none; }
.legend-row .sw.unpaid { background: var(--unpaid); box-shadow: none; }
.legend-row .sw.selected { background: var(--primary); box-shadow: none; }
.legend-row .n { margin-left: auto; font-weight: 600; }
.sync { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; margin-top: 12px; }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--paid); }
.selection { border: 2px solid var(--primary); }
.selection .seats-picked { font-size: 20px; font-weight: 700; margin: 2px 0 12px; }

/* Автобусът */
.bus-wrap { display: flex; background: var(--surface); border-radius: var(--radius); padding: 22px; overflow-x: auto; }
.bus { --cols: 5; display: inline-flex; flex-direction: row; background: #F6F8FA; border: 2px solid #B8C3CF; border-radius: 46px 16px 16px 46px; padding: 14px 18px 14px 12px; min-width: max-content; margin: 0 auto; }
.bus-front { display: flex; flex-direction: column; justify-content: space-between; align-items: center; width: 54px; margin-right: 14px; padding: 2px 0; border-right: 2px dashed #CBD3DC; }
.bus-front .door, .bus-cell.door { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); border: 2px solid #CBD3DC; border-radius: 6px; background: repeating-linear-gradient(90deg, transparent 0 6px, #E4E9EE 6px 8px); }
.bus-front .door { width: 40px; height: 44px; }
.wheel { width: 34px; height: 34px; border-radius: 50%; border: 4px solid #8D99A6; position: relative; margin: 4px 0; }
.wheel::after { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: #8D99A6; }
.bus-front .driver-label { font-size: 11px; color: var(--muted); }
.bus-grid { display: grid; grid-template-rows: repeat(var(--cols), var(--seat)); grid-auto-columns: var(--seat); gap: 6px; }
.bus-cell { grid-row: var(--h-row); grid-column: var(--h-col); }

.seat { position: relative; width: 100%; height: 100%; border: 0; padding: 0; border-radius: 9px 5px 5px 9px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--free-line), inset -5px 0 0 #E7ECF1; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.seat:hover { box-shadow: inset 0 0 0 2px var(--primary), inset -5px 0 0 #E7ECF1; }
.seat.paid, .seat.deposit, .seat.unpaid { color: #fff; box-shadow: inset -5px 0 0 rgba(0,0,0,.14); }
.seat.paid { background: var(--paid); }
.seat.deposit { background: var(--deposit); color: #2B1E00; }
.seat.unpaid { background: var(--unpaid); }
.seat.selected { background: var(--primary); color: #fff; box-shadow: inset -5px 0 0 rgba(0,0,0,.2), 0 0 0 3px var(--primary-soft); }
.seat.overdue::after { content: "!"; position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%; background: #fff; color: var(--unpaid); font-size: 11px; line-height: 16px; box-shadow: 0 0 0 1.5px var(--unpaid); }
.seat.highlight { outline: 3px solid var(--ink); outline-offset: 2px; }
.seat.just-changed { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* Таблици */
.table-wrap { background: var(--surface); border-radius: var(--radius); overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: #F7F9FB; }
table.data .num { text-align: right; white-space: nowrap; }
table.data tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line); }
.toolbar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-row .spacer { flex: 1; }

/* Финанси */
.fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.fin-lines div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.fin-lines div:last-child { border-bottom: 0; }
.fin-lines .result { font-size: 20px; font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; margin-top: 4px; padding-top: 12px; }
.fin-lines .result.neg { color: var(--unpaid); }
.bar { height: 10px; border-radius: 5px; background: var(--line-soft); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--paid); }

/* Модален прозорец */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(22, 32, 44, .45); }
.modal-box { position: relative; width: 100%; max-width: 720px; background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(22,32,44,.3); animation: pop .16s ease-out; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-body { padding: 22px 24px 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { font-size: 21px; font-weight: 700; }
.modal-close { border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.modal-section { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.modal-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.client-found { background: var(--primary-soft); border-radius: 7px; padding: 8px 12px; font-size: 14px; margin-top: 10px; }
.calc { background: #F4F7FA; border-radius: 8px; padding: 12px 14px; }
.calc div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 14px; }
.calc .total { font-size: 18px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.money-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 10px; }
.money-strip div { background: #F4F7FA; border-radius: 8px; padding: 8px 12px; }
.money-strip span { display: block; font-size: 12px; color: var(--muted); }
.money-strip strong { font-size: 18px; }
.money-strip .rem strong { color: var(--unpaid); }
.money-strip .rem.zero strong { color: var(--paid); }
.pay-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 10px; }
.log { list-style: none; padding: 0; margin: 0; font-size: 13px; color: var(--muted); }
.log li { padding: 3px 0; }
.travelers { display: grid; gap: 8px; }
.traveler-row { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: center; }
.traveler-row .seat-tag { font-weight: 600; font-size: 14px; white-space: nowrap; }
.seat-line { display: grid; grid-template-columns: 76px 1fr; }
.warn { color: var(--unpaid); font-weight: 500; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8E2B25; }

.loading { color: var(--muted); padding: 40px 0; }

/* Вход */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); padding: 20px; }
.login { width: 100%; max-width: 380px; }
.login-brand { color: #fff; margin-bottom: 20px; }
.login-brand .brand-mark { width: 40px; height: 27px; border-radius: 12px 6px 6px 12px; margin-bottom: 14px; }
.login-brand .brand-mark::after { left: 8px; top: 7px; width: 7px; height: 7px; box-shadow: 10px 0 0 var(--navy), 20px 0 0 var(--navy); }
.login-brand h1 { font-size: 28px; }
.login-brand p { color: #B6C5DA; margin: 4px 0 0; }
.login-form { background: #fff; border-radius: 14px; padding: 22px; display: grid; gap: 12px; }
.demo-logins { border-top: 1px solid var(--line-soft); padding-top: 12px; display: grid; gap: 6px; }
.demo-logins p { margin: 0 0 2px; font-size: 13px; color: var(--muted); }

/* Статуси на екскурзии */
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; background: var(--line-soft); color: var(--muted); vertical-align: middle; white-space: nowrap; line-height: 1.3; }
.pill-draft { background: #ECE7F7; color: #5B3F95; }
.pill-closed { background: #FFF1D6; color: #8A5A00; }
.pill-full, .pill-cancelled { background: #FBE4E2; color: #9A2F29; }
.pill-running { background: #E2F1E8; color: #23613F; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex-row .title-row h3 { margin-right: 2px; }

/* Банери над страницата */
.banner { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; border-radius: 9px; padding: 11px 16px; margin: 0 0 18px; background: #ECE7F7; color: #3D2A66; }
.banner p { margin: 0; flex: 1; min-width: 220px; }
.banner.warn { background: #FFF1D6; color: #5E3E00; }
.banner.danger { background: #FBE4E2; color: #7A2520; }

/* Падащо меню */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(22,32,44,.16); padding: 6px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--ink); }
.menu button:hover, .menu button:focus-visible { background: var(--primary-soft); outline: none; }
.menu button.danger { color: var(--unpaid); }
.menu button.danger:hover { background: #FBE4E2; }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 5px 0; }
.btn .caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; margin-left: 2px; }

/* Диалози за потвърждение */
.dialog { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog-backdrop { position: fixed; inset: 0; background: rgba(22, 32, 44, .5); }
.dialog-box { position: relative; width: 100%; max-width: 470px; background: #fff; border-radius: 14px; padding: 20px 22px; box-shadow: 0 24px 70px rgba(22,32,44,.35); animation: pop .14s ease-out; max-height: calc(100vh - 32px); overflow-y: auto; }
.dialog-box.wide { max-width: 620px; }
.dialog-box h2 { font-size: 19px; font-weight: 700; margin-bottom: 12px; }
.dialog-body { display: grid; gap: 12px; }
.dialog-body p { margin: 0; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.dialog .form-error { margin: 14px 0 0; }
.btn-danger-solid { background: var(--unpaid); border-color: var(--unpaid); color: #fff; }
.btn-danger-solid:hover { background: #A3352F; border-color: #A3352F; }
.summary-box { background: #F4F7FA; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.summary-box div { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.summary-box .strong { font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.pick-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.pick-list .choice { padding: 8px 10px; }

/* Грешки по полета */
.invalid { border-color: var(--unpaid) !important; box-shadow: 0 0 0 3px #FBE4E2 !important; }
.field-error { display: block; color: var(--unpaid); font-size: 13px; margin-top: 4px; font-weight: 500; }

/* Избор с радио бутони */
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; color: var(--ink); font-size: 14px; font-weight: 400; }
.choice.checked, .choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice input { margin-top: 3px; accent-color: var(--primary); flex: none; }
.choice strong { display: block; font-weight: 600; }
.choice span { color: var(--muted); }

/* Режими на схемата: преместване и добавяне */
.panel.mode { border: 2px solid var(--deposit); background: #FFFBF1; }
.panel.mode .mode-who { font-size: 17px; font-weight: 600; margin: 2px 0 4px; }
.seat.source { outline: 3px solid var(--deposit); outline-offset: 2px; z-index: 1; }
.seat.target { outline: 2px dashed var(--primary); outline-offset: -5px; }
.bus-wrap.moding { box-shadow: inset 0 0 0 2px #F3D58E; }

/* Бележки */
.notes-text { white-space: pre-line; max-width: 70ch; }
.note-box { background: #FFF6DB; border-radius: 7px; padding: 8px 12px; font-size: 14px; margin-top: 8px; white-space: pre-line; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }

/* Детайли на резервация */
.booking-people { grid-template-columns: minmax(0, .8fr) minmax(0, 1.25fr); }
.booking-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: -2px 0 16px; }
.seat-line { display: grid; grid-template-columns: 76px 1fr auto; gap: 8px; align-items: center; padding: 3px 0; }
.line-actions { display: flex; gap: 2px; }
.btn-link { border: 0; background: none; color: var(--primary); padding: 3px 7px; font-size: 13px; cursor: pointer; border-radius: 5px; font-weight: 500; text-decoration: none; }
.btn-link:hover { background: var(--primary-soft); }
.btn-link.danger { color: var(--unpaid); }
.btn-link.danger:hover { background: #FBE4E2; }
table.data tr.refund td strong { color: var(--unpaid); }
table.data tr.deleted td { color: var(--muted); }
table.data tr.deleted td.amt { text-decoration: line-through; }
.deleted-reason { font-size: 12px; color: var(--muted); }
.meta-line { font-size: 14px; margin-top: 3px; }
.meta-line span { color: var(--muted); }

/* Форма за екскурзия */
.form-actions { position: sticky; bottom: 0; z-index: 15; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 14px 0 16px; margin-top: 8px; background: linear-gradient(to top, var(--bg) 75%, rgba(237,241,245,0)); }
.form-actions .dirty { color: var(--muted); font-size: 14px; margin-left: auto; }
.form-panels .panel { margin-bottom: 14px; }
.form-panels .panel + .panel { margin-top: 0; }
.dyn-row { display: grid; grid-template-columns: 1fr 130px auto; gap: 10px; align-items: end; margin-bottom: 8px; }
.dyn-row .usage { font-size: 12px; color: var(--muted); grid-column: 1 / -1; margin-top: -4px; }
.conflict { background: #FBE4E2; color: #7A2520; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.conflict ul { margin: 6px 0 0; padding-left: 18px; }
details.cancelled-list { margin-top: 26px; }
details.cancelled-list summary { cursor: pointer; font-weight: 600; font-size: 16px; margin-bottom: 10px; }
.history { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.history li:last-child { border-bottom: 0; }
.history li span { color: var(--muted); font-size: 13px; display: block; }
.stat-row { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 8px; color: var(--muted); }
.stat-row b { color: var(--ink); }

/* Адаптивност */
@media (max-width: 1180px) {
  .seat-layout { grid-template-columns: 1fr; }
  .seat-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
  .seat-side .panel + .panel { margin-top: 0; }
}
@media (max-width: 860px) {
  :root { --seat: 42px; }
  .topbar { flex-wrap: wrap; gap: 8px 14px; padding: 10px 14px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .userchip { margin-left: auto; }
  .user-role { display: none; }
  .logout { grid-row: 1; }
  .app { padding: 16px 14px 90px; }
  .ex-row { grid-template-columns: 1fr; gap: 10px; }
  .ex-money { text-align: left; display: flex; gap: 16px; }
  .fin-grid { grid-template-columns: 1fr; }
  .page-head h1, .ex-head h1 { font-size: 23px; }

  /* Вертикален автобус на телефон: предницата е отгоре */
  .bus-wrap { padding: 16px 10px; }
  .bus { flex-direction: column; border-radius: 40px 40px 14px 14px; padding: 12px 14px 16px; }
  .bus-front { flex-direction: row-reverse; width: auto; height: 54px; margin: 0 0 12px; border-right: 0; border-bottom: 2px dashed #CBD3DC; padding: 0 2px 6px; }
  .bus-front .door { width: 44px; height: 38px; }
  .bus-grid { grid-template-rows: none; grid-template-columns: repeat(var(--cols), var(--seat)); grid-auto-columns: auto; grid-auto-rows: var(--seat); }
  .bus-cell { grid-row: var(--v-row); grid-column: var(--v-col); }
  .seat { border-radius: 9px 9px 5px 5px; box-shadow: inset 0 0 0 1.5px var(--free-line), inset 0 -5px 0 #E7ECF1; }
  .seat:hover { box-shadow: inset 0 0 0 2px var(--primary), inset 0 -5px 0 #E7ECF1; }
  .seat.paid, .seat.deposit, .seat.unpaid { box-shadow: inset 0 -5px 0 rgba(0,0,0,.14); }
  .seat.selected { box-shadow: inset 0 -5px 0 rgba(0,0,0,.2), 0 0 0 3px var(--primary-soft); }

  .selection { position: sticky; bottom: 10px; z-index: 10; box-shadow: 0 8px 30px rgba(22,32,44,.25); }
  .form-grid, .booking-people { grid-template-columns: 1fr; }
  .money-strip { grid-template-columns: 1fr 1fr 1fr; }
  .money-strip strong { font-size: 15px; }
  .pay-form { grid-template-columns: 1fr 1fr; }
  .pay-form .btn { grid-column: 1 / -1; }
  .dyn-row { grid-template-columns: 1fr 100px; }
  .dyn-row .btn { grid-column: 1 / -1; justify-self: start; }
  .page-head .btn-row { width: 100%; }
  .menu { right: auto; left: 0; }
  .dialog { align-items: flex-end; padding: 0; }
  .dialog-box { border-radius: 14px 14px 0 0; max-height: 92vh; }
  .modal { padding: 0; }
  .modal-box { border-radius: 0; min-height: 100%; }
  .modal-body { padding: 18px 16px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .topbar, .tabs, .btn { display: none !important; }
}
