/* Lokeo — дизайн-система. Характер: «посёлок у соснового леса» — тёплая бумага, хвойный зелёный,
   янтарный акцент солнца, топографические горизонтали. Текст — Golos Text, заголовки и цифры — Unbounded. */
@import url('/shared/fonts/fonts.css');

:root {
  color-scheme: light;
  --bg: #f4f1ea; --bg-deep: #ebe6db; --surface: #fffdf8; --surface-2: #f3efe6; --surface-3: #e9e3d6;
  --border: #e2dccf; --border-strong: #cfc6b4; --text: #1a2420; --text-2: #3a4540; --muted: #6d766f;
  --accent: #1f5c46; --accent-hover: #174a38; --accent-weak: #e3efe7; --accent-ink: #164634; --on-accent: #fff;
  --sun: #e39a2d; --sun-weak: #fbeed6;
  --ok: #2b7a4b; --ok-weak: #e1f1e6; --warn: #a5620a; --warn-weak: #fbedd5; --bad: #bf3b2b; --bad-weak: #fbe4df; --info: #2c63a8; --info-weak: #e3ecf8;
  --brand-mark: #1f5c46;
  --radius: 14px; --radius-sm: 10px;
  --shadow-sm: 0 1px 0 rgba(44, 38, 24, .04), 0 1px 2px rgba(44, 38, 24, .06);
  --shadow: 0 1px 2px rgba(44, 38, 24, .05), 0 6px 20px -6px rgba(44, 38, 24, .12);
  --shadow-lg: 0 24px 64px -16px rgba(24, 32, 26, .35), 0 2px 6px rgba(24, 32, 26, .08);
  --font: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  --mono: ui-monospace, 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1411; --bg-deep: #0a0f0c; --surface: #151d19; --surface-2: #1b2520; --surface-3: #233029;
    --border: #26322c; --border-strong: #34443b; --text: #e5ece7; --text-2: #c4cec8; --muted: #8f9d95;
    --accent: #5fbf8e; --accent-hover: #74cf9f; --accent-weak: #183228; --accent-ink: #8fd9b1; --on-accent: #0b1a12;
    --sun: #f0b252; --sun-weak: #3a2c14;
    --ok: #5cc98a; --ok-weak: #15301f; --warn: #e8a74a; --warn-weak: #36280f; --bad: #f07a68; --bad-weak: #3b1c17; --info: #79a8ee; --info-weak: #17263b;
    --brand-mark: #2a7a5b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5); --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1411; --bg-deep: #0a0f0c; --surface: #151d19; --surface-2: #1b2520; --surface-3: #233029;
  --border: #26322c; --border-strong: #34443b; --text: #e5ece7; --text-2: #c4cec8; --muted: #8f9d95;
  --accent: #5fbf8e; --accent-hover: #74cf9f; --accent-weak: #183228; --accent-ink: #8fd9b1; --on-accent: #0b1a12;
  --sun: #f0b252; --sun-weak: #3a2c14;
  --ok: #5cc98a; --ok-weak: #15301f; --warn: #e8a74a; --warn-weak: #36280f; --bad: #f07a68; --bad-weak: #3b1c17; --info: #79a8ee; --info-weak: #17263b;
  --brand-mark: #2a7a5b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5); --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--accent); color: var(--on-accent); }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1, .display { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 16.5px; line-height: 1.3; margin: 0 0 12px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 13px; margin: 20px 0 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
small { font-size: 12px; }
b, strong { font-weight: 600; }
.ico { flex: none; display: inline-block; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; cursor: pointer; }
details summary { cursor: pointer; color: var(--accent); }

input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d766f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; padding: 0; accent-color: var(--accent); flex: none; margin: 0; cursor: pointer; }
input[type=file] { padding: 6px; background: var(--surface-2); border-style: dashed; }
input[type=file]::file-selector-button { font: inherit; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 8px; padding: 4px 10px; margin-right: 10px; cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
textarea { resize: vertical; }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 8px 15px; border-radius: var(--radius-sm); white-space: nowrap; font-weight: 500; line-height: 1.3; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--surface-2); border-color: var(--muted); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 2px 6px -2px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.danger:hover { background: var(--bad-weak); border-color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; border-radius: 8px; gap: 5px; }
.btn.link { border: none; background: none; color: var(--accent); padding: 0; box-shadow: none; }
.btn.link:hover { text-decoration: underline; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.icon { border: none; background: none; font-size: 22px; line-height: 1; color: var(--muted); padding: 4px; border-radius: 8px; display: inline-grid; place-items: center; }
.icon:hover { background: var(--surface-2); color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 14px; }
.card > h2:first-child { display: flex; align-items: center; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; }
.kpi .v { font-family: var(--display); font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.2; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); transform: translateY(-1px); box-shadow: var(--shadow); }

.fit { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); cursor: pointer; user-select: none; white-space: nowrap; }
th:hover { color: var(--text); }
th.sorted { color: var(--accent); }
th .sort { margin-left: 4px; font-size: 10px; }
tbody tr { transition: background .1s; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 35%, transparent); }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-weak); }
tr.selected td { background: var(--accent-weak); box-shadow: inset 3px 0 0 var(--accent); }
tr.selected td ~ td { box-shadow: none; }
tr.archived td { color: var(--muted); text-decoration: line-through; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.empty { text-align: center; color: var(--muted); padding: 36px 16px; background: none !important; }
td.empty .ico { display: block; margin: 0 auto 8px; opacity: .5; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.5; background: var(--surface-2); color: var(--muted); white-space: nowrap; border: 1px solid color-mix(in srgb, currentColor 14%, transparent); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.bad { background: var(--bad-weak); color: var(--bad); }
.badge.info { background: var(--info-weak); color: var(--info); }
.pos { color: var(--ok); } .neg { color: var(--bad); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs > * { flex-shrink: 0; }
.tabs > [hidden] { display: none; }
.tabs-more-wrap { position: relative; margin-left: auto; }
.tabs-more { display: inline-flex; align-items: center; gap: 4px; }
.tabs-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tabs-menu[hidden] { display: none; }
.tabs-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: none; background: none; text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; white-space: nowrap; }
.tabs-menu-item:hover { background: var(--surface-2); }
.tabs-menu-item .count { font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 1px 7px; }
.tab { position: relative; border: none; background: none; padding: 9px 12px 11px; color: var(--muted); white-space: nowrap; font-weight: 500; border-radius: 8px 8px 0 0; transition: color .15s; }
.tab:hover { color: var(--text); }
.tab::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px; border-radius: 3px 3px 0 0; background: transparent; transition: background .15s; }
.tab.active { color: var(--text); }
.tab.active::after { background: var(--accent); }
.tab .count { margin-left: 6px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 1px 7px; }
.tab.active .count { background: var(--accent); color: var(--on-accent); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field small.muted { font-size: 12px; }
.span2 { grid-column: span 2; }
.req { color: var(--bad); }
.check { display: flex; gap: 9px; align-items: center; font-size: 14px; color: var(--text) !important; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; max-height: 220px; overflow: auto; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .span2 { grid-column: span 1; } }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

.overlay { position: fixed; inset: 0; background: color-mix(in srgb, #0c1510 48%, transparent); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow: auto; animation: fade .18s ease-out; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); animation: rise .22s var(--ease); }
.modal.wide { max-width: 1000px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 18px 20px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px 11px 12px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); animation: pop .22s var(--ease); font-weight: 500; }
.toast .ico { color: var(--accent-weak); margin-top: 1px; }
.toast.error { background: var(--bad); color: #fff; }
.toast.error .ico { color: #fff; }

.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state h2 { color: var(--text); }
.empty-state > .ico { color: var(--accent); opacity: .7; margin-bottom: 8px; }
.empty-state p { max-width: 460px; margin-left: auto; margin-right: auto; }
.empty-ico { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--accent-weak); color: var(--accent); box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-weak) 45%, transparent); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 10px 0 10px 20px; border-bottom: 1px dashed var(--border); }
.timeline li::before { content: ''; position: absolute; left: 3px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.timeline li:last-child { border: none; }

/* Отдельные страницы (шлюз, квитанция, пропуск) */
body.standalone { display: flex; flex-direction: column; align-items: center; padding: 40px 16px; min-height: 100vh; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-weak), transparent 70%), var(--bg); }
body.standalone::before { content: 'Lokeo'; font: 600 15px var(--display); color: var(--accent); letter-spacing: .02em; margin-bottom: 18px; padding-left: 30px; background: no-repeat left center / 22px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%231f5c46'/%3E%3Cpath d='M7 15.5 16 8l9 7.5' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M8.5 20.5c2.5-1.6 5-1.6 7.5 0s5 1.6 7.5 0' fill='none' stroke='%23fff' stroke-opacity='.72' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='23.5' cy='8.5' r='2.2' fill='%23f2b24c'/%3E%3C/svg%3E"); }
body.standalone main { max-width: 560px; width: 100%; }
body.standalone main.card { padding: 26px 28px; box-shadow: var(--shadow); border-radius: 20px; animation: rise .3s var(--ease); }
body.standalone main.card h1 { font-size: 30px; margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
body.standalone label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin: 14px 0; }
body.standalone .gateway form + form .btn { margin-top: -2px; }
.pass-share { position: relative; text-align: center; overflow: hidden; }
.pass-share::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: repeating-linear-gradient(90deg, var(--accent) 0 18px, var(--sun) 18px 36px); }
.pass-share .plate { font-size: 26px; margin: 8px 0 14px; }
.pass-share .code { display: block; margin-top: 6px; padding: 12px; border: 2px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2); }
.gateway form { margin-top: 10px; } .gateway .btn { width: 100%; justify-content: center; padding: 11px; }
.qr { width: 150px; height: 150px; border-radius: 14px; margin: 14px auto; display: grid; place-items: center; font: 700 15px var(--mono); color: var(--text); background:
  linear-gradient(var(--surface), var(--surface)) center / 64px 30px no-repeat,
  repeating-conic-gradient(var(--text) 0 25%, transparent 0 50%) 0 0 / 15px 15px; border: 10px solid var(--surface); outline: 1px solid var(--border); }
.plate { display: inline-flex; align-items: center; gap: 8px; font: 600 20px/1 var(--mono); letter-spacing: .06em; color: #111; background: #fff; border: 2px solid #111; padding: 6px 10px; border-radius: 7px; box-shadow: var(--shadow-sm); }
.code { font: 600 24px var(--mono); letter-spacing: .3em; }
.receipt table th { width: 180px; cursor: default; position: static; }
@media print { .noprint { display: none; } body, body.standalone { background: #fff; } body.standalone::before { display: none; } .card { box-shadow: none; border: none; } }

/* Бренд: знак, аватар и декоративные слои */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font: 600 13px var(--display); color: #fff; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--sun))); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.logo-mark { display: inline-block; flex: none; line-height: 0; }
.logo-mark svg { display: block; }
.contours, .forest { position: absolute; pointer-events: none; }
.contours { inset: 0; }
.forest { left: 0; right: 0; bottom: 0; height: 46px; }

/* Мини-графики */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bars .bar .stackcol { width: 100%; max-width: 34px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; }
.bars .bar i { display: block; width: 100%; border-radius: 5px 5px 2px 2px; background: var(--accent); min-height: 2px; transition: height .5s var(--ease); }
.bars .bar i.ghost { background: var(--surface-3); border-radius: 5px 5px 2px 2px; }
.bars .bar small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.bars .bar.now i:not(.ghost) { background: var(--sun); }
.meter { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.meter > span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
