/* Фирменная гамма: зелёный #134033 и бронзовое золото #B08841. Мягкие углы и тени. */
:root {
  --bg: #f1f0ea;            /* светлый тёплый серый, как фон логотипа */
  --card: #ffffff;
  --ink: #1c2a24;           /* почти чёрный с зелёным оттенком */
  --muted: #6b756f;
  --line: #e4e0d4;
  --line-2: #efece3;
  --green: #134033;         /* фирменный зелёный */
  --green-2: #1a4d3e;
  --green-3: #24604d;
  --green-soft: #e8f0ec;
  --gold: #b08841;          /* фирменное бронзовое золото */
  --gold-2: #93702f;
  --gold-soft: #f3ecdc;
  --gold-light: #d6b878;    /* золото для текста на тёмно-зелёном: контрастнее */
  --on-green: #f3efe2;
  --crit: #a8322d; --high: #c2621c; --mid: #b8892b; --low: #2e7d5b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 59, 46, .06), 0 6px 20px rgba(15, 59, 46, .06);
  --head: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --brand: "Russo One", "Manrope", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 var(--head); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--green-3); }

/* ---------- шапка ---------- */
.top { background: linear-gradient(180deg, var(--green) 0%, #0e3428 100%); color: var(--on-green); padding: 0 28px;
  display: flex; align-items: stretch; gap: 24px; flex-wrap: wrap; position: relative; border-bottom: 1px solid var(--gold); }
.brand { font-family: var(--brand); font-weight: 400; font-size: 21px; letter-spacing: .02em; display: flex; align-items: center; padding: 14px 0; color: #fff; }
.brand-logo { height: 34px; width: auto; margin-right: 12px; background: #fff; border-radius: 6px; padding: 3px; }
.brand span { font-family: var(--head); color: var(--gold-light); margin-left: 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em;
  border: 1px solid rgba(214, 184, 120, .55); border-radius: 999px; padding: 3px 10px; }
nav { display: flex; align-items: stretch; gap: 4px; }
nav button { background: none; border: 0; color: rgba(243, 239, 226, .72); font: 600 14px/1 var(--head); letter-spacing: .01em;
  padding: 0 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .15s, border-color .15s; }
nav button:hover { color: #fff; }
nav button.active { color: var(--gold-light); border-bottom-color: var(--gold-light); }
.status { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(243, 239, 226, .65); padding: 8px 0; }
.owner-btn { background: transparent; color: var(--gold-light); border: 1px solid rgba(214, 184, 120, .7); border-radius: 999px; padding: 5px 14px;
  font: 600 12px/1.2 var(--head); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.owner-btn:hover { background: var(--gold-light); color: var(--green); }
.owner-btn:disabled { cursor: default; opacity: .85; background: transparent; color: var(--gold-light); }

main { max-width: 1240px; margin: 0 auto; padding: 32px 20px 64px; }
.tab { display: none; } .tab.active { display: block; }
.hidden { display: none !important; }

/* ---------- карточки и заголовки ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
h1, h2, h3, h4 { font-family: var(--head); color: var(--green); }
h1 { font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 0 0 16px; font-weight: 700; letter-spacing: -.005em; display: flex; align-items: center; gap: 10px; }
h2::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--gold); flex: none; }
h3 { font-size: 16px; margin: 22px 0 8px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; }
.muted { color: var(--muted); }
.note { font-size: 13px; color: var(--muted); }

/* ---------- формы ---------- */
.drops { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 22px; }
.drop { border: 1.5px dashed #cfc7b2; border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 4px; cursor: pointer;
  background: #fbfaf6; transition: border-color .15s, background .15s; }
.drop:hover { border-color: var(--gold); background: var(--gold-soft); }
.drop b { font-weight: 700; color: var(--green); }
.drop small { color: var(--muted); }
.drop input { margin-top: 8px; max-width: 100%; }
.files { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.grid label, .drop { font-size: 14px; }
.grid label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: #34433c; }
.grid .wide { grid-column: 1 / -1; }
.grid .check { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea { font: inherit; font-weight: 400; padding: 9px 12px; border: 1px solid #d6d1c3; border-radius: 8px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 136, 65, .22); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green-3); }
input[type=file] { padding: 6px; background: #fff; border-radius: 8px; }
input[type=file]::file-selector-button { font: 600 13px/1 var(--head); background: var(--green); color: var(--on-green); border: 0; border-radius: 6px;
  padding: 9px 14px; margin-right: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--green-3); }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; flex-wrap: wrap; }

/* ---------- кнопки ---------- */
button.primary, .btn { background: var(--green); color: #fff; border: 1px solid var(--green); border-radius: 999px;
  padding: 10px 22px; font: 700 14px/1.2 var(--head); letter-spacing: .01em; cursor: pointer; text-decoration: none; display: inline-block;
  box-shadow: inset 0 -2px 0 var(--gold), 0 2px 8px rgba(19, 64, 51, .18); transition: background .15s, box-shadow .15s, transform .05s; }
button.primary:hover, .btn:hover { background: var(--green-3); box-shadow: inset 0 -2px 0 var(--gold), 0 4px 14px rgba(19, 64, 51, .25); }
button.primary:active, .btn:active { transform: translateY(1px); }
button.primary:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: #fff; color: var(--green); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--gold); background: var(--gold-soft); }
.btn.small { padding: 5px 12px; font-size: 12px; box-shadow: none; }
.msg { color: var(--crit); font-weight: 600; }
.msg.ok { color: var(--low); }

/* ---------- прогресс ---------- */
.progress, #progress { display: flex; gap: 16px; align-items: center; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- таблицы ---------- */
.scroll { overflow-x: auto; border-radius: 10px; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl th { background: var(--green); color: var(--on-green); font: 600 12px/1.35 var(--head); letter-spacing: .02em; border-bottom: 2px solid var(--gold); }
.tbl tr:first-child th:first-child { border-top-left-radius: 10px; }
.tbl tr:first-child th:last-child { border-top-right-radius: 10px; }
.tbl tr:nth-child(even) td { background: #faf9f5; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--gold-soft); }
.tbl.mini { font-size: 13px; background: #fff; }
.tbl.mini th { background: var(--green-2); }
.tbl tr.rec td { background: var(--gold-soft) !important; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.num.neg, .neg { color: var(--crit); font-weight: 700; }
input.price { width: 110px; text-align: right; padding: 5px 8px; }
#kp-items td { vertical-align: middle; }

/* ---------- показатели ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); }
.kpi .v { font: 700 26px/1.15 var(--head); color: var(--green); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13px; color: var(--muted); margin-top: 4px; }
.kpi.bad::before { background: var(--crit); }
.kpi.bad .v { color: var(--crit); }

/* ---------- метки ---------- */
.risk { display: inline-block; padding: 2px 10px; border-radius: 999px; font: 600 12px/1.5 var(--head); color: #fff; white-space: nowrap; }
.risk.Критический { background: var(--crit); } .risk.Высокий { background: var(--high); }
.risk.Средний { background: var(--mid); } .risk.Низкий { background: var(--low); }
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eeebe2; color: #4a514c; white-space: nowrap; }
.tag.ok { background: #e2efe8; color: #1f5a40; }
.tag.bad { background: #f6e1df; color: #8f2723; }
.tag.warn { background: var(--gold-soft); color: #7a5b12; }

/* ---------- блоки ---------- */
.bars .row { display: grid; grid-template-columns: 160px 1fr 130px; gap: 10px; align-items: center; font-size: 14px; margin: 6px 0; }
.bars .bar { height: 10px; background: linear-gradient(90deg, var(--green-3), var(--gold)); border-radius: 999px; min-width: 2px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.detail td { background: #faf9f5 !important; }
.detail dl { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; margin: 0; }
.detail dt { color: var(--muted); font-weight: 600; }
.detail dd { margin: 0; }
.proc { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.proc h4, .detail h4 { margin: 8px 0 6px; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; border-top: 3px solid var(--gold); }
.report-head h1 { font-size: 26px; margin: 0 0 4px; color: var(--green); }
ul.plain { margin: 0; padding-left: 20px; }
ul.plain li { margin: 3px 0; }
.demo-flag { background: var(--gold-soft); border: 1px solid #e6d3a2; border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 10px;
  margin-bottom: 14px; font-weight: 600; color: #5c4510; }
.card.warn { background: #fcf8ec; border-color: #eadbb2; }
.card.gaps { border-top: 3px solid var(--gold); }
details.card > summary { cursor: pointer; font: 700 16px/1.3 var(--head); color: var(--green); list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸ "; color: var(--gold-2); }
details.card[open] > summary::before { content: "▾ "; }
details.card[open] > summary { margin-bottom: 12px; }

/* минимальный аванс и кассовый разрыв */
.advance-block { border: 1px solid #e6d3a2; border-top: 3px solid var(--gold); background: linear-gradient(180deg, #fffdf7 0%, #fff 60%); }
.cash-line { font: 700 18px/1.45 var(--head); padding: 14px 16px; border-radius: 10px; margin-top: 12px; border-left: 4px solid; }
.cash-line.ok { background: #e7f2ec; color: #1f5a40; border-color: var(--low); }
.cash-line.bad { background: #f8e6e4; color: #8f2723; border-color: var(--crit); }
.cash-line.pending { background: #f3f1ea; color: var(--muted); border-color: #c9c2b0; font: 400 15px/1.45 var(--head); }
.minadv { border-width: 1px; }
.minadv.ok { border-color: #bfd9cb; border-top: 3px solid var(--low); background: #f4f9f6; }
.minadv.bad { border-color: #e6bdb9; border-top: 3px solid var(--crit); background: #fdf5f4; }
.minadv-label { font: 700 12px/1.3 var(--head); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.minadv-main { font-size: 18px; margin-bottom: 4px; }

/* переключатель разделов на вкладке «Цены» */
.segmented { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; padding: 4px; border: 1px solid var(--line); border-radius: 999px;
  width: fit-content; max-width: 100%; background: #fff; }
.segmented button { border: 0; background: none; padding: 8px 18px; font: 600 13px/1.2 var(--head); cursor: pointer; color: var(--green); border-radius: 999px; }
.segmented button:hover { background: var(--gold-soft); }
.segmented button.active { background: var(--green); color: var(--gold-light); }
.ret-pick { display: flex; gap: 6px; }
.ret-pick select { flex: 1; }

/* доступ */
body:not(.is-owner) #tab-prices form, body:not(.is-owner) #tab-prices .segmented, body:not(.is-owner) #tab-prices .sub,
body:not(.is-owner) #settings-form { display: none !important; }
body.is-owner .guest-only { display: none; }
body:not(.is-owner) .owner-only, body:not(.is-demo) .demo-only, body.is-demo .not-demo { display: none !important; }
.demo-card { background: var(--gold-soft); border-color: #e6d3a2; border-left: 4px solid var(--gold); }
.demo-card a { color: var(--green); font-weight: 700; }
.gate { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--green-3) 0%, var(--green) 45%, #0a2a20 100%); }
.gate.hidden { display: none; }
.gate-card { width: 100%; max-width: 420px; padding: 32px 30px; border: 1px solid rgba(176, 136, 65, .5); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.gate-brand { font-family: var(--brand); font-size: 25px; color: var(--green); margin-bottom: 14px; }
.gate-brand span { display: block; font-family: var(--head); color: var(--gold-2); font-size: 13px; letter-spacing: .06em; margin-top: 4px; }
#gate-code { width: 100%; font-size: 22px; letter-spacing: 4px; text-transform: uppercase; padding: 12px; text-align: center; margin-top: 6px; }
.gate-card .actions button.primary { width: 100%; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 12px 0 0; font: inherit; font-size: 13px; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; letter-spacing: 1px; white-space: nowrap; color: var(--green); font-weight: 600; }

/* ---------- телефон ---------- */
@media (max-width: 760px) {
  .top { padding: 0 14px; gap: 0; }
  .brand { font-size: 19px; padding: 12px 0 6px; width: 100%; }
  nav { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav button { padding: 12px 10px 10px; font-size: 13px; }
  .status { width: 100%; margin: 0; padding: 6px 0 10px; font-size: 11px; justify-content: space-between; }
  main { padding: 20px 12px 40px; }
  .card { padding: 16px; }
  h2 { font-size: 17px; }
  .kpi .v { font-size: 22px; }
  .bars .row { grid-template-columns: 90px 1fr 100px; }
  .detail dl { grid-template-columns: 1fr; }
  .tbl { font-size: 13px; }
  .scroll > .tbl { min-width: 640px; }  /* широкие таблицы прокручиваются, а не сжимаются */
  .cash-line { font-size: 16px; }
  .segmented { width: 100%; border-radius: 14px; }
  .segmented button { flex: 1 1 100%; border-radius: 10px; }
  .report-head .actions { width: 100%; }
}

/* ---------- печать ---------- */
@media print {
  .top, .tab, .no-print, .filters { display: none !important; }
  body { background: #fff; font-size: 11px; }
  main { padding: 0; max-width: none; }
  .card, .kpi { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
  .detail { display: table-row !important; }
  .risk, .tbl th, .cash-line { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.pct-in { width: 70px; text-align: right; padding: 5px 8px; }
.extra-tbl td { vertical-align: middle; }
.extra-tbl .trip-crew { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.extra-tbl th { white-space: nowrap; }
.extra-tbl label.check { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.row-actions { white-space: nowrap; }
.row-actions button { margin: 2px 4px 2px 0; padding: 5px 12px; font: 600 12px/1.2 var(--head); border: 1px solid var(--line); background: #fff;
  color: var(--green); border-radius: 999px; cursor: pointer; }
.row-actions button:hover { border-color: var(--gold); background: var(--gold-soft); }
.logo-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 140px; height: 90px; border: 1px dashed var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #fff; }
.logo-preview img { max-width: 124px; max-height: 76px; }
