/* Парус Автопарк — оформление. Без внешних шрифтов и CDN (строгая CSP). */
:root {
  --bg: #f1f4f9; --surface: #ffffff; --surface-2: #f7f9fc; --text: #0f172a; --muted: #64748b; --line: #e3e8f0;
  --brand: #1d5fd6; --brand-600: #174fb4; --brand-50: #eaf1fd;
  --side: #0d1b34; --side-2: #14264a; --side-text: #c7d3ea; --side-muted: #7f90b0;
  --green: #15803d; --green-50: #e7f6ec; --amber: #b45309; --amber-50: #fdf2e2; --red: #c81e1e; --red-50: #fdeaea;
  --gray-50: #eef1f5; --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
  --glass: rgba(255, 255, 255, .76); --glass-2: rgba(241, 245, 251, .6);   /* блоки поверх фона с корабликами */
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --surface: #121b2d; --surface-2: #17223a; --text: #e5ebf5; --muted: #8d9bb3; --line: #233150;
          --brand: #5b9bff; --brand-600: #7aaeff; --brand-50: #172a4d; --side: #070d19; --side-2: #101b30;
          --green: #4ade80; --green-50: #12301f; --amber: #fbbf24; --amber-50: #33270f; --red: #f87171; --red-50: #3a1717;
          --gray-50: #1b2740; --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
          --glass: rgba(18, 27, 45, .76); --glass-2: rgba(30, 44, 72, .5); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 1.08rem; font-weight: 650; margin: 0 0 .8rem; }
h3 { font-size: .98rem; font-weight: 650; margin: 1rem 0 .5rem; }
code { font-family: "Cascadia Mono", Consolas, monospace; background: var(--gray-50); padding: 1px 6px; border-radius: 6px; }

/* ---------- каркас: боковое меню ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--side), var(--side-2)); color: var(--side-text);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem; padding: 4px 8px 18px; }
.logo img { width: 40px; height: 40px; background: #fff; border-radius: 11px; padding: 3px; flex: none; } .logo small { display: block; font-weight: 400; color: var(--side-muted); font-size: .76rem; }
.logo:hover { text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--side-text); font-size: .94rem; }
.nav a .i { width: 22px; text-align: center; font-size: 1.05rem; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.on { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(29, 95, 214, .35); }
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; color: var(--side-text); border-radius: 10px; }
.me:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.me b { color: #fff; font-weight: 600; display: block; font-size: .9rem; } .me small { color: var(--side-muted); font-size: .76rem; }
.logout { width: 100%; margin-top: 6px; background: transparent; color: var(--side-muted); border: 1px solid rgba(255,255,255,.12); }
.logout:hover { color: #fff; border-color: rgba(255,255,255,.3); }
.content { min-width: 0; }
.page { max-width: 1320px; margin: 0 auto; padding: 26px 30px 48px; }
.mobilebar, .navtoggle { display: none; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; background: var(--side); color: #fff;
    padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
  .mobilebar label { font-size: 1.5rem; cursor: pointer; padding: 0 6px; }
  .sidebar { display: none; position: fixed; inset: 52px 0 0 0; height: auto; z-index: 19; }
  .navtoggle:checked ~ .sidebar { display: flex; }
  .page { padding: 18px 16px 40px; }
}

/* ---------- заголовок страницы ---------- */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead .sub { color: var(--muted); margin-top: 4px; }
.pagehead .tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h2:first-child { display: flex; align-items: center; gap: 8px; }
.card.flush { padding: 0; overflow: hidden; } .card.flush > h2 { padding: 16px 20px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 980px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; gap: 14px; align-items: center; color: var(--text); }
a.kpi:hover { text-decoration: none; border-color: var(--brand); }
.kpi .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex: none; background: var(--brand-50); }
.kpi.green .ico { background: var(--green-50); } .kpi.amber .ico { background: var(--amber-50); } .kpi.red .ico { background: var(--red-50); }
.kpi .v { display: block; font-size: 1.6rem; font-weight: 750; line-height: 1.15; } .kpi .l { display: block; color: var(--muted); font-size: .84rem; line-height: 1.3; }
.kpi.red .v { color: var(--red); } .kpi.amber .v { color: var(--amber); }
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .kpi .ico { width: 38px; height: 38px; font-size: 1.1rem; }
  .kpi .v { font-size: 1.35rem; }
}

/* ---------- статус-полоса ---------- */
.statusbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }

/* ---------- метки ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--gray-50); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.green, .ok-badge { background: var(--green-50); color: var(--green); }
.badge.amber { background: var(--amber-50); color: var(--amber); }
.badge.red { background: var(--red-50); color: var(--red); }
.badge.blue { background: var(--brand-50); color: var(--brand); }
.ok { color: var(--green); } .warn { color: var(--amber); } .bad { color: var(--red); } .muted { color: var(--muted); }
.small { font-size: .84rem; } .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }

/* ---------- машины ---------- */
.cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-bottom: 20px; }
.car { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  color: var(--text); display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
a.car:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.car .cover { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, #dfe8f7, #c8d6ee); }
.car .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.car .cover .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; opacity: .5; }
.car .cover .badge { position: absolute; top: 10px; left: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.car .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.car .title { font-weight: 700; font-size: 1.02rem; }
.plate { display: inline-block; font-family: "Cascadia Mono", Consolas, monospace; font-size: .82rem; letter-spacing: .04em;
  border: 1.5px solid var(--text); border-radius: 5px; padding: 0 6px; background: var(--surface); color: var(--text); width: max-content; }
.car .meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .86rem; margin-top: 4px; flex-wrap: wrap; }
.car.archived { opacity: .55; }

.hero { display: grid; grid-template-columns: 340px 1fr; gap: 22px; margin-bottom: 20px; align-items: stretch; }
.hero .cover { position: relative; aspect-ratio: 4 / 3; align-self: start; border-radius: var(--radius); overflow: hidden; background: linear-gradient(135deg, #dfe8f7, #c8d6ee); box-shadow: var(--shadow); }
.hero .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .info { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.hero .facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fact .l { color: var(--muted); font-size: .78rem; } .fact .v { font-weight: 700; font-size: 1.05rem; }
@media (max-width: 980px) { .hero { grid-template-columns: 1fr; } }

/* ---------- вкладки ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; padding: 5px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.tabs a { padding: 7px 13px; border-radius: 9px; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.tabs a.on { background: var(--brand); color: #fff; }
.tabs .count { opacity: .7; font-size: .8rem; margin-left: 3px; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: var(--surface-2); }
tbody tr:hover td, table tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 20px; }
table.kv th { width: 44%; text-transform: none; letter-spacing: 0; font-size: .88rem; background: transparent; font-weight: 500; }
.row-bad td { background: var(--red-50); } .row-done td { opacity: .5; }
.total-row td { font-weight: 700; background: var(--surface-2); }

/* ---------- формы и кнопки ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: .86rem; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
input, select, textarea { font: inherit; font-size: .95rem; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
button, .button { font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); transition: background .15s, border-color .15s; }
button:hover, .button:hover { border-color: var(--brand); text-decoration: none; }
button.primary, .button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--brand-600); }
button.danger, .button.danger { background: var(--red); border-color: var(--red); color: #fff; }
button.small, .button.small { padding: 5px 10px; font-size: .82rem; border-radius: 8px; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 500; }
.wide { width: 100%; justify-content: center; }
form.inline { display: inline; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row label { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.actions-cell { white-space: nowrap; } .actions-cell form { margin: 2px; }
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; background: var(--green-50); color: var(--green); font-weight: 500; border: 1px solid transparent; }
.flash.error { background: var(--red-50); color: var(--red); }

/* ---------- фото и документы ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery img, .doc img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; }
.gallery a img:hover { outline: 3px solid var(--brand); }
.ph { position: relative; }
.ph form { position: absolute; right: 6px; bottom: 6px; }
.ph button { padding: 3px 8px; font-size: .75rem; background: rgba(15,23,42,.72); color: #fff; border: 0; }
.ph.is-cover img { outline: 3px solid var(--green); }
.thumbs-inline img { width: 58px; height: 42px; object-fit: cover; border-radius: 6px; margin-right: 4px; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.doc { display: flex; flex-direction: column; gap: 4px; word-break: break-word; background: var(--surface-2); padding: 8px; border-radius: 12px; }
.docicon { font-size: 2.4rem; text-align: center; background: var(--brand-50); border-radius: 10px; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.docicon:hover { text-decoration: none; }

/* ---------- мониторинг ---------- */
.stat .big { font-size: 1.7rem; font-weight: 750; } .stat h3 { margin: 0 0 6px; color: var(--muted); font-size: .84rem; font-weight: 600; }
.meter { height: 8px; background: var(--gray-50); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; width: 0; }
pre.log { white-space: pre-wrap; font-size: .8rem; max-height: 340px; overflow: auto; background: var(--surface-2); padding: 12px; border-radius: 10px; margin: 0; }

/* ---------- вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
body.is-auth { background: radial-gradient(1200px 600px at 10% -10%, #2b6fe0 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #0f9d8a 0%, transparent 55%), var(--side); background-attachment: fixed; }
.auth .card { width: 100%; max-width: 430px; padding: 30px 30px 26px; box-shadow: var(--shadow-lg); border: 0; }
.auth .card.wide-card { max-width: 560px; }
.auth .brand-big { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth .brand-big img { width: 44px; height: 44px; }
.auth .brand-big b { font-size: 1.2rem; display: block; } .auth .brand-big small { color: var(--muted); }
.qr { display: flex; justify-content: center; margin: 14px 0; }
.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 12px; box-shadow: var(--shadow); }
code.secret { font-size: 1.05rem; letter-spacing: 1px; user-select: all; }
ul.codes { columns: 2; font-size: 1.05rem; padding-left: 18px; } ul.codes li { margin: 4px 0; }
.steps { padding-left: 20px; color: var(--muted); } .steps li { margin: 4px 0; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pager a, .pager b { min-width: 34px; text-align: center; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); }
.pager b { background: var(--brand); color: #fff; border-color: var(--brand); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
ul.plain li:last-child { border-bottom: 0; }

@media print {
  .sidebar, .mobilebar, .noprint, .flash, .tabs { display: none !important; }
  .layout { display: block; } body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; padding: 0; } .report { page-break-after: always; }
}

/* эмблема в мобильной шапке */
.mlogo { display: flex; align-items: center; gap: 8px; }
.mlogo img { width: 28px; height: 28px; background: #fff; border-radius: 8px; padding: 2px; }
.auth .brand-big img { background: #fff; border-radius: 12px; }

/* обложка машины: кнопки поверх фото */
.hero .cover .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; opacity: .4; }
.cover-tools { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.cover-tools .button, .cover-tools button { background: rgba(15, 23, 42, .72); color: #fff; border: 0; backdrop-filter: blur(4px); margin: 0; }
.cover-tools .button:hover, .cover-tools button:hover { background: rgba(15, 23, 42, .9); }
.cover-tools label { flex-direction: row; margin: 0; }

/* документы по видам */
.small-tabs a { font-size: .84rem; padding: 5px 10px; }
h3.doc-rec { font-size: .9rem; font-weight: 600; color: var(--muted); margin: 14px 0 8px; display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
h3.doc-rec:first-of-type { margin-top: 4px; }

/* журнал: свёрнут до 6 строк */
.collapsible.is-collapsed { overflow: hidden; position: relative; }
.collapsible.is-collapsed::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46px;
  background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
.collapse-btn { margin: 10px 20px 16px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; max-width: 520px; word-break: break-word; }
.clamp.open { -webkit-line-clamp: unset; display: block; }

/* компактный список документов */
.doc-list { display: flex; flex-direction: column; }
.doc-row { display: grid; grid-template-columns: minmax(220px, 38%) 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.doc-row:first-child { border-top: 0; padding-top: 2px; }
.doc-row > .chips:only-child { grid-column: 1 / -1; }
.doc-rec { font-size: .88rem; color: var(--muted); }
.doc-rec a { margin-left: 6px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px 10px 4px 4px; max-width: 100%; }
.chip > a:first-child { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--text); }
.chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 7px; flex: none; }
.chip .ci { width: 36px; height: 36px; border-radius: 7px; background: var(--brand-50); display: grid; place-items: center; flex: none; }
.chip .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; font-size: .88rem; }
@media (max-width: 700px) { .doc-row { grid-template-columns: 1fr; gap: 6px; } }

/* плитки документов с превью */
.dtiles { display: flex; flex-wrap: wrap; gap: 12px; }
.dtile { width: 132px; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.dprev { position: relative; display: block; width: 132px; height: 100px; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line); transition: box-shadow .15s, transform .15s; }
.dprev:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.dprev img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; background: #fff; }
.dprev .ci { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; }
.dtag { position: absolute; right: 6px; bottom: 6px; background: var(--red); color: #fff; font-size: .66rem; font-weight: 700;
  padding: 1px 6px; border-radius: 5px; letter-spacing: .04em; }
.dtile figcaption { font-size: .8rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; word-break: break-word; min-height: 2.5em; }
.dtools { display: flex; gap: 8px; align-items: center; font-size: .78rem; }
.dtools a, .dtools button { font-size: .85rem; }
.doc-row { grid-template-columns: minmax(200px, 30%) 1fr; align-items: start; }
.minithumbs { white-space: nowrap; }
.minithumbs a { display: inline-block; margin-right: 4px; vertical-align: middle; }
.minithumbs img { width: 40px; height: 30px; object-fit: cover; object-position: top; border-radius: 5px; border: 1px solid var(--line); background: #fff; display: block; }

/* страховки: действующие подсвечены, истёкшие — тусклые */
tr.row-active td { background: var(--green-50); }
tr.row-active td:first-child { box-shadow: inset 4px 0 0 var(--green); }
tr.row-expired td { opacity: .5; }
tr.row-expired:hover td { opacity: .8; }

/* просмотрщик */
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(8, 13, 25, .88); display: flex; flex-direction: column; }
.lb-top { display: flex; gap: 10px; align-items: center; padding: 12px 16px; color: #fff; }
.lb-top .lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-top a, .lb-top button { background: rgba(255,255,255,.12); color: #fff; border: 0; }
.lb-top a:hover, .lb-top button:hover { background: rgba(255,255,255,.25); text-decoration: none; }
.lb-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 60px 20px; position: relative; }
.lb-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff; border: 0; font-size: 1.4rem; justify-content: center; padding: 0; }
.lb-nav:hover { background: rgba(255,255,255,.3); }
.lb-prev { left: 10px; } .lb-next { right: 10px; }
.lb-note { color: #c7d3ea; text-align: center; font-size: .85rem; padding-bottom: 12px; }
@media (max-width: 700px) { .lb-body { padding: 0 8px 16px; } .lb-nav { display: none; } }

.dcap { color: var(--muted); }
.dcap a { color: var(--text); }

/* компактные плитки KPI */
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { padding: 9px 12px; gap: 10px; border-radius: 12px; }
.kpi .ico { width: 34px; height: 34px; border-radius: 9px; font-size: 1.05rem; }
.kpi .v { font-size: 1.2rem; line-height: 1.1; }
.kpi .l { font-size: .76rem; line-height: 1.2; }
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { flex-direction: row; align-items: center; padding: 8px 10px; }
  .kpi .ico { width: 30px; height: 30px; font-size: .95rem; }
  .kpi .v { font-size: 1.1rem; }
}

/* недоступность машины */
.unavail { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--red-50); border: 1px solid rgba(200, 30, 30, .25); border-radius: 12px; padding: 10px 14px; color: var(--text); }
.unavail .u-text b { color: var(--red); }
.avail-form { position: relative; }
.avail-form > summary { list-style: none; cursor: pointer; }
.avail-form > summary::-webkit-details-marker { display: none; }
.avail-form[open] > summary { border-color: var(--red); color: var(--red); }
.avail-form > form { position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; width: min(440px, 90vw); box-shadow: var(--shadow-lg); margin: 0; }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip-radio { margin: 0; flex-direction: row; }
.chip-radio input { position: absolute; opacity: 0; pointer-events: none; }
.chip-radio span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: .86rem; cursor: pointer; }
.chip-radio input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.chip-radio input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-50); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); margin: 0 0 8px; }
label.check input { width: auto; }

/* документы без подписей (вкладка «Основное») */
.dtiles.bare .dtile, .dtiles.bare .dprev { width: 104px; } .dtiles.bare .dprev { height: 78px; }

/* телефон: фото машины поменьше */
@media (max-width: 980px) {
  .hero { gap: 14px; }
  .hero .cover { aspect-ratio: 16 / 9; max-height: 210px; width: 100%; }
}
@media (max-width: 600px) {
  .cars { grid-template-columns: 1fr 1fr; gap: 10px; }
  .car .cover { aspect-ratio: 4 / 3; }
  .car .body { padding: 8px 10px 10px; }
  .car .title { font-size: .92rem; }
  .car .meta, .car .small { font-size: .76rem; }
  .car .cover .badge { top: 6px; left: 6px; font-size: .68rem; padding: 2px 7px; }
  .plate { font-size: .72rem; }
  .hero .cover { max-height: 180px; }
  .hero .facts { grid-template-columns: 1fr 1fr; }
  .avail-form > form { position: fixed; left: 5vw; right: 5vw; top: 70px; width: auto; }
}

/* плитки в одну строку */
.kpis-inline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kpis-inline .kpi { padding: 7px 12px; gap: 9px; }
.kpis-inline .ico { width: 30px; height: 30px; font-size: .95rem; border-radius: 8px; }
.kpis-inline .kv { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.kpis-inline .v { display: inline; font-size: 1.15rem; }
.kpis-inline .l { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
@media (max-width: 600px) { .kpis-inline { grid-template-columns: 1fr 1fr; gap: 6px; } .kpis-inline .kpi { padding: 6px 9px; } }

/* рассылки */
.pick { margin: 4px 0 12px; }
.pick summary { cursor: pointer; color: var(--brand); }
.pick-list { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; }
.pick-list label.check { margin: 4px 0; }
.form-grid.tight { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.wday { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.wday h3 { margin-top: 0; }
.periods { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.kpi { min-width: 0; } .kpi .v { white-space: nowrap; }
@media (max-width: 600px) { .kpi .v { font-size: 1rem; } }

/* ---------- иконки (спрайт Lucide, /static/icons.svg) ---------- */
.ic { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.ic.filled { fill: currentColor; } .ic.gold { color: #d4a017; }
.nav a .i { display: grid; place-items: center; } .nav a .i .ic { width: 19px; height: 19px; stroke-width: 1.9; }
.kpi .ico { color: var(--brand); } .kpi .ico .ic { width: 52%; height: 52%; }
.kpi.green .ico { color: var(--green); } .kpi.amber .ico { color: var(--amber); } .kpi.red .ico { color: var(--red); }
h2 > .ic, h3 > .ic { color: var(--brand); margin-right: 2px; }
.mobilebar label .ic { width: 26px; height: 26px; vertical-align: middle; }
.noimg .ic { stroke-width: 1.3; } .chip .ci .ic, .dprev .ci .ic { color: var(--brand); }
.good { color: var(--green); }

/* ---------- фон «море» (canvas под интерфейсом) ---------- */
.sea { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.layout, .auth { position: relative; z-index: 1; }
.foot-row { display: flex; gap: 6px; margin-top: 6px; } .foot-row form { flex: 1; }
.foot-row .logout { margin-top: 0; justify-content: center; }
.sea-btn { width: 40px; flex: none; padding: 5px 0; justify-content: center; } .sea-btn.off { opacity: .45; }
@media print { .sea { display: none; } }
/* ---------- справка ---------- */
.help-intro p { margin: 0 0 .6rem; max-width: 980px; } .help-intro p:last-child { margin: 0; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.help-grid .card, .help-grid + .grid2 .card { margin: 0; } .help-grid p { margin: 0 0 .5rem; font-size: .9rem; } .help-grid p:last-child { margin: 0; }
.help-list { margin: 0; padding-left: 1.1rem; font-size: .9rem; } .help-list li { margin-bottom: .35rem; }
@media (max-width: 600px) { .help-grid { grid-template-columns: 1fr; } }

/* полупрозрачные блоки (76%): кораблики слегка просвечивают (без размытия — оно тяжёлое для анимированного фона) */
.card, .kpi, .car, .fact, .tabs { background: var(--glass); }
.card th, .card .total-row td, .card tr:hover td { background: var(--glass-2); }
.auth .card { background: var(--surface); }
@media print { .card, .kpi, .car, .fact { background: #fff; } }

/* ---------- окно брони ---------- */
tr.js-booking { cursor: pointer; }
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(8, 13, 25, .55); display: flex; align-items: flex-start;
  justify-content: center; padding: 4vh 16px; overflow-y: auto; }
.modal-panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 980px;
  padding: 14px 22px 22px; }
.modal-top { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 4px; }
.bview-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.bview-title { margin: 0 0 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bview-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.bview-facts .fact .v { font-size: .95rem; }
.bview-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.bview-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bview .timeline li { justify-content: flex-start; gap: 14px; padding: 5px 0; font-size: .9rem; }
.bview-group { margin-bottom: 12px; }
.bthumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; margin-top: 5px; }
.bthumbs a { display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.bthumbs img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s; }
.bthumbs a:hover img { transform: scale(1.04); }
@media (max-width: 700px) {
  .modal { padding: 0; } .modal-panel { border-radius: 0; min-height: 100%; padding: 10px 14px 18px; }
  .bview-cols { grid-template-columns: 1fr; gap: 6px; } .bthumbs { grid-template-columns: repeat(3, 1fr); }
}
