/* Оформление «A»: лесной зелёный + жёлтый лапачо (tajy), крупно и дружелюбно. */
:root {
  --bg: #f4f8f5;
  --card: #ffffff;
  --ink: #1b2a20;
  --muted: #4a5c50;
  --line: #dce6df;
  --field: #cbd8cf;
  --green: #1e6b3a;
  --green-dark: #134726;
  --green-soft: #eef6f0;
  --on-green: #ffffff;
  --on-green-muted: #d3ecdc;
  --yellow: #f5c21b;
  --yellow-dark: #c99a06;
  --on-yellow: #1b2a20;
  --warn: #9a5a00;
  --warn-soft: #fff3d6;
  --danger: #b3261e;
  --danger-soft: #f9e3e1;
  --info: #24589a;
  --info-soft: #e3edf9;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(20, 60, 35, .08);
  --tabbar: 68px;
  --font-display: "Baloo 2", "Nunito Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101713; --card: #18221c; --ink: #e8efe9; --muted: #a3b3a8; --line: #26342b; --field: #33463a;
    --green: #3f9b62; --green-dark: #1b5131; --green-soft: #1a2c21; --on-green: #ffffff; --on-green-muted: #cfe8d8;
    --warn: #f0b54d; --warn-soft: #3a2d14; --danger: #f08a80; --danger-soft: #3d2120; --info: #8db6f2; --info-soft: #1d2a3d;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101713; --card: #18221c; --ink: #e8efe9; --muted: #a3b3a8; --line: #26342b; --field: #33463a;
  --green: #3f9b62; --green-dark: #1b5131; --green-soft: #1a2c21; --on-green: #ffffff; --on-green-muted: #cfe8d8;
  --warn: #f0b54d; --warn-soft: #3a2d14; --danger: #f08a80; --danger-soft: #3d2120; --info: #8db6f2; --info-soft: #1d2a3d;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; font-family: var(--font-display); font-weight: 700; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.12rem; }
p { margin: 0 0 .8em; }
a { color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong-accent { color: var(--green); font-weight: 800; }
.error { color: var(--danger); font-size: .9rem; margin: 10px 0 0; min-height: 0; }
.error:empty { display: none; }

/* шапка приложения магазина */
.appbar {
  background: var(--green); color: var(--on-green); padding: 14px 16px 20px; position: relative; overflow: hidden;
}
.appbar .lace { position: absolute; right: -44px; top: -46px; width: 160px; height: 160px; opacity: .2; pointer-events: none; }
.brandrow { display: flex; align-items: center; gap: 10px; position: relative; }
.logo { width: 36px; height: 36px; border-radius: 11px; background: var(--yellow); display: flex; align-items: center; justify-content: center; flex: none; }
.logo svg { width: 21px; height: 21px; color: var(--green-dark); }
.brandname { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; letter-spacing: .2px; }
#hero { position: relative; margin-top: 12px; max-width: 728px; }
#hero:empty { display: none; }
.hero-title { font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; line-height: 1.08; }
.hero-sub { color: var(--on-green-muted); margin-top: 4px; font-size: .95rem; }
.hero-note { display: flex; align-items: center; gap: 8px; background: var(--yellow); color: var(--on-yellow); border-radius: 12px; padding: 9px 12px; margin-top: 12px; font-weight: 800; font-size: .9rem; }
.hero-note svg { width: 20px; height: 20px; flex: none; }

/* шапка админки */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--green); color: var(--on-green);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
}
.topbar .title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .iconbtn { color: var(--on-green); }
.topbar .btn.ghost { color: var(--on-green); border-color: rgba(255,255,255,.4); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar) + 96px); }
.wide main { max-width: 1180px; padding-bottom: calc(var(--tabbar) + 28px); }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list > .item { padding: 12px 14px; border-top: 1px solid var(--line); }
.list > .item:first-child { border-top: 0; }
.item.tap { cursor: pointer; }
.item.tap:active { background: var(--green-soft); }
.cards { display: flex; flex-direction: column; gap: 10px; }
.pcard {
  background: var(--card); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; width: 100%; font: inherit; color: inherit; text-align: left;
}
button.pcard { display: block; cursor: pointer; }
button.pcard:active { background: var(--green-soft); }
.ptile { width: 50px; height: 50px; border-radius: 14px; flex: none; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: #3d4a41; }
.section-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; margin: 20px 4px 8px; }

/* нижние вкладки */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line); display: flex;
}
.tabbar button {
  flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: .75rem; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; position: relative; cursor: pointer;
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.on { color: var(--green); font-weight: 800; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: .7rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.tabbar .badge { position: absolute; top: 7px; left: calc(50% + 6px); }

/* формы */
label { display: block; font-size: .9rem; font-weight: 700; margin: 0 0 6px; }
.field + .field { margin-top: 14px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 5px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--field); border-radius: 12px; padding: 12px 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
textarea { min-height: 80px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 800; border-radius: 14px; padding: 12px 18px; border: 1.5px solid transparent;
  background: var(--green); color: var(--on-green); cursor: pointer; text-decoration: none; min-height: 48px;
}
.btn svg { width: 19px; height: 19px; flex: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }
.btn-cta { background: var(--yellow); color: var(--on-yellow); font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; box-shadow: 0 4px 0 var(--yellow-dark); min-height: 54px; }
.btn-cta:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--yellow-dark); }
.btn.ghost { background: var(--card); color: var(--green); border-color: var(--green); }
.btn.soft { background: var(--green-soft); color: var(--green); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.link { background: none; color: var(--green); min-height: 44px; }
.btn.small { min-height: 38px; padding: 7px 12px; font-size: .875rem; border-radius: 11px; }
.iconbtn { border: 0; background: none; color: var(--ink); padding: 8px; border-radius: 10px; cursor: pointer; display: inline-flex; }
.iconbtn svg { width: 22px; height: 22px; }

.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; font: inherit; font-weight: 700; padding: 9px; border-radius: 9px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1.5px solid var(--field); background: var(--card); color: var(--ink); border-radius: 999px;
  padding: 8px 16px; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--green); color: var(--on-green); border-color: var(--green); }

/* прайс */
.product .name { font-weight: 800; }
.product .price { color: var(--muted); font-size: .9rem; }
.stepper { display: flex; align-items: center; background: var(--green-soft); border-radius: 12px; overflow: hidden; flex: none; }
.stepper button { width: 42px; height: 42px; border: 0; background: none; color: var(--green); font-size: 1.4rem; font-weight: 800; cursor: pointer; }
.stepper input { width: 52px; border: 0; border-radius: 0; background: transparent; text-align: center; padding: 8px 2px; font-weight: 800; box-shadow: none !important; }
.add { width: 46px; height: 46px; border-radius: 13px; border: 0; background: var(--green); color: var(--on-green); font-size: 1.6rem; font-weight: 800; cursor: pointer; flex: none; }

.cartbar {
  position: fixed; left: 14px; right: 14px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 12px); z-index: 25;
  max-width: 732px; margin: 0 auto;
}
.cartbar .btn { width: 100%; justify-content: space-between; box-shadow: 0 4px 0 var(--yellow-dark), 0 8px 22px rgba(0,0,0,.16); }

/* регистрация: место */
.loc-card { background: var(--card); border: 2px solid var(--green); border-radius: 18px; overflow: hidden; }
.loc-card.warn { border-color: var(--yellow-dark); }
.loc-map { height: 150px; background: var(--green-soft); z-index: 0; }
.loc-info { padding: 12px 14px; }
.loc-title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--green-dark); }
.loc-card.warn .loc-title { color: var(--warn); }
.photo-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; border-radius: 13px;
  border: 1.5px dashed var(--green); background: var(--card); color: var(--green); font-weight: 800; cursor: pointer; margin: 0;
}
.photo-btn svg { width: 21px; height: 21px; }
.photo-preview { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 13px; margin-top: 10px; }

/* статусы */
.pill { display: inline-block; font-size: .78rem; font-weight: 800; padding: 4px 11px; border-radius: 999px; white-space: nowrap; }
.st-new { background: var(--info-soft); color: var(--info); }
.st-accepted, .st-assembling { background: var(--warn-soft); color: var(--warn); }
.st-on_way { background: var(--green-soft); color: var(--green); }
.st-delivered { background: var(--green); color: var(--on-green); }
.st-cancelled, .st-rejected { background: var(--danger-soft); color: var(--danger); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); display: inline-block; flex: none; }

.progress { display: flex; gap: 4px; margin: 14px 0 8px; }
.progress span { flex: 1; height: 7px; border-radius: 4px; background: var(--line); }
.progress span.done { background: var(--green); }
.steps { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); gap: 4px; }
.steps span { flex: 1; text-align: center; }
.steps span.done { color: var(--ink); font-weight: 800; }
.steps span:first-child { text-align: left; } .steps span:last-child { text-align: right; }

.eta { background: var(--yellow); color: var(--on-yellow); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; display: flex; flex-direction: column; }
.eta span { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.eta b { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; }
.delivery { background: var(--green-soft); color: var(--green); border-radius: 12px; padding: 12px 14px; font-weight: 800; }

/* чат */
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 9px 12px; border-radius: 14px; background: var(--green-soft); align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: var(--green); color: var(--on-green); }
.msg .meta { display: block; font-size: .72rem; opacity: .75; margin-top: 3px; }
.sys { align-self: center; font-size: .8rem; color: var(--muted); text-align: center; }
.composer { display: flex; gap: 8px; margin-top: 12px; }
.composer input { flex: 1; }

/* карта */
.map { height: 300px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; z-index: 0; }
.map.tall { height: calc(100vh - 230px); min-height: 360px; }
.pin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); box-sizing: border-box; }
.prospect { width: 9px; height: 9px; border-radius: 50%; background: #7d8a82; border: 1.5px solid #fff; box-shadow: 0 0 2px rgba(0,0,0,.4); }

/* окно поверх */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 14, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 760px; max-height: 94vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 0 0 calc(20px + env(safe-area-inset-bottom));
}
.sheet .sheet-head { position: sticky; top: 0; background: var(--bg); padding: 12px 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); z-index: 2; }
.sheet .sheet-body { padding: 16px; }
@media (min-width: 900px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 20px; max-height: 88vh; }
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 84px); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: .92rem; font-weight: 700; max-width: calc(100% - 32px);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font-size: .8rem; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--muted); margin-bottom: 10px; align-items: center; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin: 0; cursor: pointer; }
.legend input { width: auto; }
.shop-photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; display: block; margin-top: 12px; }

/* переключатель языка в админке */
.langswitch { display: flex; background: rgba(255,255,255,.16); border-radius: 10px; padding: 3px; gap: 2px; flex: none; }
.langswitch button { border: 0; background: none; color: var(--on-green); font: inherit; font-weight: 800; font-size: .8rem; padding: 6px 10px; border-radius: 8px; cursor: pointer; min-width: 40px; min-height: 32px; }
.langswitch button.on { background: var(--on-green); color: var(--green-dark); }
.chips.quick { flex-wrap: wrap; }
.chips.quick .chip { white-space: normal; text-align: left; }
.chip small { display: block; font-weight: 500; font-size: .75rem; opacity: .75; }

/* приложение поставщика */
.brandtag { margin-left: 4px; background: var(--yellow); color: var(--on-yellow); font-weight: 800; font-size: .72rem; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 14px; padding: 12px 14px; font-weight: 700; margin-bottom: 12px; }
.supplier-tag { font-size: .78rem; color: var(--muted); }
.st-ready { background: #dff3e6; color: #17603a; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--field); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--green-soft); outline-offset: 2px; }
.net { background: var(--green-soft); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.sq-pin { width: 18px; height: 18px; border-radius: 5px; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); box-sizing: border-box; }

/* choferes (portado de «Заказ») */
.stopnum { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--green); color: var(--on-green); font-weight: 800; font-size: .9rem; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.stopnum.pick { background: var(--yellow); color: var(--on-yellow); border-radius: 8px; }
.link-btn { all: unset; color: var(--green-dark); font-weight: 800; text-decoration: underline; cursor: pointer; }
.duty { display: flex; align-items: center; gap: 8px; background: var(--green-soft); color: var(--green-dark); border-radius: 14px; padding: 10px 14px; font-weight: 700; font-size: .9rem; margin-bottom: 12px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #16a34a; flex: none; box-shadow: 0 0 0 0 rgba(22,163,74,.6); animation: livepulse 1.6s infinite; }
@keyframes livepulse { 70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.app-offer { margin-bottom: 12px; border: 2px solid var(--yellow); }
.setup-row { padding: 10px 0; border-top: 1px solid var(--line); }
.codebox .code { font-family: var(--font-display); font-size: 2rem; letter-spacing: .15em; color: var(--green-dark); font-variant-numeric: tabular-nums; flex: none; }
.codebox .row > span { min-width: 0; }
select.need { border-color: var(--danger); }
.docs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.doc { all: unset; cursor: pointer; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.doc img { display: block; width: 100%; height: 120px; object-fit: cover; }
.doc span { display: block; padding: 6px 10px; font-size: .8rem; font-weight: 700; }
.doc.big { grid-column: 1 / -1; }
.doc.big img { height: auto; max-height: 80vh; object-fit: contain; background: #000; }
.drv-pin { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px 0 7px; border-radius: 17px; white-space: nowrap;
  background: #2563eb; color: #fff; font-weight: 800; font-size: .8rem; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.drv-pin svg { width: 18px; height: 18px; flex: none; }
.drv-pin.stale { background: #8a8f8c; }
.drv-pin.mini { height: 20px; width: 20px; padding: 0; justify-content: center; border-radius: 50%; box-shadow: none; vertical-align: middle; margin-right: 4px; }
.drv-pin.mini svg { width: 12px; height: 12px; }
.fee-line { display: flex; justify-content: space-between; font-size: .9rem; margin-top: 4px; }
/* demo */
.demo-note { margin-bottom: 12px; border: 2px solid var(--yellow); }
.demo-roles { display: grid; gap: 12px; margin-top: 22px; }
@media (min-width: 760px) { .demo-roles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.demo-role { text-align: left; cursor: pointer; font: inherit; color: var(--ink); width: 100%; }
.demo-role h3 { margin: 0 0 6px; }
.demo-role p { margin: 0; }
.demo-role:hover, .demo-role:focus-visible { outline: 3px solid var(--yellow); }
