:root {
  --paper: #f3efe6;
  --paper-2: #fbf9f4;
  --card: #ffffff;
  --ink: #10141c;
  --ink-2: #3a4150;
  --muted: #7a7f8a;
  --line: #ddd6c8;
  --line-2: #ebe5d8;
  --navy: #141b2b;
  --accent: #e5481f;
  --accent-soft: #fde6dc;
  --ok: #1e8a5a;
  --ok-soft: #dcf1e6;
  --warn: #c98412;
  --warn-soft: #fbefd5;
  --risk: #c7302a;
  --risk-soft: #fbe0de;
  --display: 'Unbounded', 'Golos Text', sans-serif;
  --body: 'Golos Text', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(16, 20, 28, .04), 0 8px 24px -12px rgba(16, 20, 28, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body {
  font-family: var(--body);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(16, 20, 28, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 20, 28, .045) 1px, transparent 1px);
  background-size: 32px 32px;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; margin: 0; line-height: 1.1; }
h1 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin-bottom: 14px; }
p { margin: 0; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.muted { color: var(--muted); }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.boot, .center-msg { min-height: 60vh; display: grid; place-content: center; text-align: center; gap: 12px; color: var(--ink-2); }

/* ---------- buttons & forms ---------- */
.btn {
  font: 600 14px/1 var(--body); border: 1.5px solid var(--ink); background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 11px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { box-shadow: 0 4px 0 #9f2c0e; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { box-shadow: 0 4px 0 #0f5537; }
.btn.ghost { border-color: var(--line); background: transparent; }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

input, select, textarea {
  font: 500 15px var(--body); color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; outline: none;
  transition: border-color .12s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { resize: vertical; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.err { color: var(--risk); font-size: 14px; min-height: 1.2em; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand small { font-family: var(--body); font-weight: 500; font-size: 12px; opacity: .6; letter-spacing: 0; }
.logo { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 17px; transform: rotate(-6deg); }

/* ---------- label chip (трек-номер как наклейка на коробке) ---------- */
.label-chip {
  display: inline-grid; gap: 2px; padding: 10px 16px; background: var(--card);
  border: 1.5px dashed var(--ink); border-radius: 8px; position: relative;
}
.label-chip span { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.label-chip b { font-size: 18px; }

/* ---------- public ---------- */
.public { max-width: 1120px; margin: 0 auto; padding: 22px 20px 60px; }
.pub-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.staff-link { font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; border-bottom: 1.5px solid var(--line); }
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; min-height: 64vh; }
.hero h1 { font-size: clamp(40px, 6.4vw, 78px); font-weight: 800; line-height: .98; margin-bottom: 20px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 18px; color: var(--ink-2); max-width: 30em; margin-bottom: 28px; }
.track-form { display: flex; gap: 10px; max-width: 520px; }
.track-form input { font: 700 18px var(--mono); padding: 15px 16px; text-transform: uppercase; border: 2px solid var(--ink); }
.track-form .btn { padding: 0 24px; font-size: 16px; }
.demo-hint { margin-top: 14px; font-size: 13px; color: var(--muted); }

.route-mini { list-style: none; margin: 0; padding: 28px 28px 28px 26px; background: var(--navy); color: #fff; border-radius: 22px; position: relative; box-shadow: var(--shadow); transform: rotate(1.2deg); }
.route-mini li { position: relative; padding: 0 0 22px 34px; opacity: 0; animation: rise .5s ease forwards; }
.route-mini li:last-child { padding-bottom: 0; }
.route-mini li::before { content: ''; position: absolute; left: 4px; top: 5px; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid #fff; background: var(--navy); }
.route-mini li::after { content: ''; position: absolute; left: 10px; top: 20px; bottom: 2px; border-left: 2px dashed rgba(255, 255, 255, .35); }
.route-mini li:last-child::after { display: none; }
.route-mini li:last-child::before { background: var(--accent); border-color: var(--accent); }
.route-mini b { font-family: var(--display); font-weight: 700; font-size: 18px; display: block; }
.route-mini span { font-size: 13px; opacity: .65; }
.route-mini li:nth-child(1) { animation-delay: .05s } .route-mini li:nth-child(2) { animation-delay: .15s }
.route-mini li:nth-child(3) { animation-delay: .25s } .route-mini li:nth-child(4) { animation-delay: .35s }
.route-mini li:nth-child(5) { animation-delay: .45s } .route-mini li:nth-child(6) { animation-delay: .55s }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.track-wrap { display: grid; gap: 22px; }
.track-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.track-top .muted { margin-top: 8px; }

.status-card { background: var(--navy); color: #fff; border-radius: 22px; padding: 30px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.status-card .eyebrow { color: rgba(255, 255, 255, .55); }
.status-card h2 { font-size: clamp(24px, 3vw, 34px); margin-bottom: 10px; }
.status-card p { color: rgba(255, 255, 255, .78); }
.status-card .since { margin-top: 14px; font-size: 13px; color: rgba(255, 255, 255, .55); }
.status-eta { border-left: 1px dashed rgba(255, 255, 255, .25); padding-left: 28px; }
.eta { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 4vw, 46px); color: #fff; line-height: 1; }
.eta-note { margin-top: 10px; font-size: 13px; }
.status-card.delivered .eta { color: #7ee2ad; }
.segbar { grid-column: 1 / -1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; }
.segbar i { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .14); }
.segbar i.done { background: #7ee2ad; }
.segbar i.active { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.track-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; align-items: start; }
.pos-summary { font-size: 15px; color: var(--ink-2); }
.pos-list { display: grid; gap: 18px; }
.pos-item { display: grid; gap: 0; }
.status-card.compact { padding: 22px 26px; gap: 20px; border-radius: 22px 22px 0 0; }
.status-card.compact h2 { font-size: clamp(20px, 2.4vw, 26px); }
.status-card.compact .eta { font-size: clamp(24px, 3vw, 34px); }
.status-card.compact .eyebrow { color: #ffb79f; }
.route-details { border-radius: 0 0 var(--radius) var(--radius); border-top: 0; padding: 14px 22px; box-shadow: none; }
.route-details summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.route-details[open] summary { margin-bottom: 16px; }
.panel { background: var(--card); border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stack { display: grid; gap: 22px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 20px 34px; }
.timeline li::before { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); z-index: 1; }
.timeline li::after { content: ''; position: absolute; left: 10px; top: 18px; bottom: -2px; border-left: 2px solid var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.done::after { border-color: var(--ok); }
.timeline li.active::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.timeline .t-name { font-weight: 600; }
.timeline li.pending .t-name { color: var(--muted); font-weight: 500; }
.timeline .t-date { font-size: 13px; color: var(--muted); }
.timeline li.active .t-date { color: var(--accent); font-weight: 600; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.feed li { display: grid; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }
.feed time { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.feed .who { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.tag.client { background: var(--accent-soft); color: #a8340f; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.items li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--paper-2); border-radius: 8px; }
.items .sub { font-size: 12px; color: var(--muted); }
.others a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); text-decoration: none; }
.others a:last-child { border-bottom: 0; }

/* ---------- admin ---------- */
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 28px; padding: 12px 24px; position: sticky; top: 0; z-index: 20; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; color: rgba(255, 255, 255, .7); }
.topbar nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.topbar nav a.on { color: #fff; background: rgba(255, 255, 255, .12); }
.topbar nav a.cta { color: #fff; background: var(--accent); }
.who { font-size: 13px; color: rgba(255, 255, 255, .7); display: flex; gap: 12px; align-items: center; }
.who .role { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, .12); text-transform: uppercase; letter-spacing: .06em; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 28px 24px 120px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin-top: 8px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.tile { background: var(--card); border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile b { font-family: var(--display); font-size: 38px; font-weight: 800; display: block; line-height: 1; margin-bottom: 8px; }
.tile span { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.tile small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line); }
.tile.ok::before { background: var(--ok); } .tile.ok b { color: var(--ok); }
.tile.warn::before { background: var(--warn); } .tile.warn b { color: var(--warn); }
.tile.risk::before { background: var(--risk); } .tile.risk b { color: var(--risk); }
.tile.info::before { background: #5b7bd5; } .tile.info b { color: #3450a8; }
.tile.dark { background: var(--navy); color: #fff; border-color: var(--navy); }
.tile.dark span, .tile.dark small { color: rgba(255, 255, 255, .7); }
.tile.dark::before { background: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.dist { display: grid; gap: 10px; }
.dist-row { display: grid; grid-template-columns: 210px 1fr 30px; gap: 12px; align-items: center; font-size: 14px; text-decoration: none; }
.dist-bar { height: 22px; border-radius: 6px; background: var(--paper-2); display: flex; overflow: hidden; }
.dist-bar i { display: block; height: 100%; }
.dist-bar .b-ok { background: var(--ok); } .dist-bar .b-warn { background: var(--warn); } .dist-bar .b-risk { background: var(--risk); } .dist-bar .b-idle { background: #9aa0ab; }
.dist-row b { text-align: right; font-family: var(--mono); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.attn { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attn a { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--paper-2); text-decoration: none; border: 1.5px solid transparent; }
.attn a:hover { border-color: var(--ink); }
.attn .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.lvl-3 .dot, .dot.lvl-3 { background: var(--risk); box-shadow: 0 0 0 4px var(--risk-soft); }
.lvl-2 .dot, .dot.lvl-2 { background: var(--warn); }
.lvl-1 .dot, .dot.lvl-1 { background: #5b7bd5; }
.attn .t1 { font-weight: 600; font-size: 14px; }
.attn .t2 { font-size: 13px; color: var(--ink-2); }
.attn .mgr { font-size: 12px; color: var(--muted); }
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1.5px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.st-active td { background: #fff7f3; }
tr.st-done td { color: var(--ink-2); }
.days-input { width: 64px; padding: 6px 8px; font-family: var(--mono); font-size: 14px; }
.extra { font-size: 12px; color: var(--warn); font-weight: 700; margin-left: 4px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); line-height: 1.3; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: #8a5a07; }
.badge.risk { background: var(--risk-soft); color: var(--risk); }
.badge.info { background: #e3e9fb; color: #3450a8; }
.badge.accent { background: var(--accent-soft); color: #a8340f; }

/* board */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: start; }
.col { background: rgba(255, 255, 255, .55); border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 10px; min-height: 140px; backdrop-filter: blur(2px); }
.col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 6px 10px; }
.col-head h4 { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.25; }
.col-head .n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.col-head .idx { font-family: var(--mono); font-size: 11px; color: var(--accent); display: block; margin-bottom: 2px; }
.cards { display: grid; gap: 8px; }
.card { background: var(--card); border: 1.5px solid var(--line-2); border-left: 5px solid var(--ok); border-radius: 10px; position: relative; transition: transform .12s ease, box-shadow .12s ease; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card.lvl-3 { border-left-color: var(--risk); }
.card.lvl-2 { border-left-color: var(--warn); }
.card.lvl-1 { border-left-color: #5b7bd5; }
.card.idle { border-left-color: #9aa0ab; }
.card.sel { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.card-body { display: block; padding: 12px 12px 12px 14px; text-decoration: none; }
.card-client { font-size: 12px; color: var(--muted); font-weight: 600; padding-right: 26px; }
.card-title { font-weight: 700; font-size: 14px; margin: 2px 0 6px; line-height: 1.25; }
.card-pos { font-size: 12.5px; color: var(--ink-2); margin: -3px 0 6px; line-height: 1.3; }
.card-meta { font-size: 12px; color: var(--ink-2); display: flex; gap: 6px; flex-wrap: wrap; }
.card .badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.card-foot { margin-top: 8px; font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; }
.card .chk { position: absolute; top: 9px; right: 9px; z-index: 2; }
.card .chk input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.batchbar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--navy); color: #fff; border-radius: 14px; padding: 12px 14px 12px 20px; display: flex; gap: 14px; align-items: center; box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .45); z-index: 30; animation: rise .2s ease; }
.batchbar .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }

/* order */
.crumbs { margin-bottom: 14px; font-size: 14px; }
.crumbs a { text-decoration: none; color: var(--ink-2); font-weight: 600; }
.order-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.order-head .muted { margin-top: 8px; }
.head-side { display: grid; gap: 10px; justify-items: end; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpis > div, .kpis > .kpi-eco { background: var(--card); border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; }
.kpi-eco { text-align: left; font: inherit; color: inherit; cursor: pointer; border-left: 5px solid var(--ok) !important; }
.kpi-eco:hover { border-color: var(--ink) !important; }
.kpis span { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpis b { display: block; font-family: var(--display); font-size: 20px; margin-top: 6px; line-height: 1.15; }
.kpis small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpis b.red { color: var(--risk); }
.kpis b.green { color: var(--ok); }

.action { border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; border: 1.5px solid var(--line); background: var(--card); display: grid; gap: 12px; }
.action h4 { margin: 0; font-family: var(--display); font-size: 16px; letter-spacing: -.01em; }
.action p { color: var(--ink-2); font-size: 14px; }
.action.warn { background: var(--warn-soft); border-color: #ecc77a; }
.action.risk { background: var(--risk-soft); border-color: #eaa29e; }
.action.ok { background: var(--ok-soft); border-color: #9dd5b8; }
.action.info { background: #e9eefc; border-color: #b9c6ef; }
.action form, .action .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.action form label { flex: 0 0 auto; }
.action form label.grow { flex: 1 1 220px; }
.action input[type=number] { width: 90px; }
.action input[type=date] { width: 170px; }
.action details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.action details[open] summary { margin-bottom: 10px; }
.order-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; align-items: start; }
.pos-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pos-tab { display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; font: inherit; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.pos-tab:hover { transform: translateY(-1px); }
.pos-tab.on { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.pos-tab b { display: block; font-size: 14px; }
.pos-tab small { display: block; font-size: 12px; color: var(--muted); }
.pos-tab .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); }

/* new order */
.form-grid { display: grid; gap: 18px; max-width: 980px; }
.fieldset { background: var(--card); border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 22px; display: grid; gap: 14px; }
.fieldset h3 { margin-bottom: 0; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cols-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); flex-wrap: wrap; }
.seg label { display: block; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.seg input { display: none; }
.seg span { display: block; padding: 10px 14px; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.positions { display: grid; gap: 14px; }
.pos-block { border: 1.5px dashed var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; background: var(--paper-2); }
.pos-block-head { display: flex; justify-content: space-between; align-items: center; }
.pos-block-head b { font-family: var(--display); font-size: 15px; }
.pos-block-head .rm { font-size: 13px; color: var(--muted); }
.stage-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.stage-days label { font-size: 12px; }
.stage-days input { font-family: var(--mono); }
.pos-total { display: flex; justify-content: space-between; align-items: end; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.pos-total b { font-family: var(--mono); }
.pos-total input { width: 120px; font-family: var(--mono); font-weight: 700; }
.calc-rows { display: grid; gap: 8px; font-size: 14px; }
.calc-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px dashed rgba(255, 255, 255, .2); }
.calc-row:last-child { border-bottom: 0; padding-bottom: 0; }
.calc-row b { font-family: var(--mono); color: #ffb79f; }
.calc { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 22px; display: grid; gap: 14px; }
.calc .parts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.calc .parts span { background: rgba(255, 255, 255, .1); border-radius: 6px; padding: 5px 9px; }
.calc .parts b { font-family: var(--mono); color: #ffb79f; }
.calc .total { font-family: var(--display); font-size: 28px; font-weight: 800; }
.calc label { color: rgba(255, 255, 255, .8); }
.calc input { max-width: 140px; font-family: var(--mono); font-weight: 700; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* stages reference */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.ref { background: var(--card); border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 20px; display: grid; gap: 10px; align-content: start; box-shadow: var(--shadow); }
.ref .num { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 700; }
.ref h4 { margin: 0; font-family: var(--display); font-size: 17px; letter-spacing: -.01em; }
.ref dl { margin: 0; display: grid; gap: 8px; font-size: 13.5px; }
.ref dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.ref dd { margin: 0; color: var(--ink-2); }
.protocol { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 22px; }
.protocol h3 { color: rgba(255, 255, 255, .6); }
.protocol ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.protocol b { color: #ffb79f; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 22px; padding: 32px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; margin-top: 8px; }

.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; z-index: 50; box-shadow: var(--shadow); animation: rise .2s ease; }
.toast.error { background: var(--risk); }

@media (max-width: 900px) {
  .hero, .track-grid, .grid-2, .order-grid, .status-card { grid-template-columns: 1fr; }
  .status-eta { border-left: 0; padding-left: 0; border-top: 1px dashed rgba(255, 255, 255, .25); padding-top: 20px; }
  .kpis, .cols-3, .cols-4 { grid-template-columns: 1fr 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
  .pos-tab { flex: 1 1 100%; }
  .stage-days { grid-template-columns: 1fr 1fr; }
  .dist-row { grid-template-columns: 130px 1fr 26px; font-size: 13px; }
  .wrap { padding: 20px 16px 120px; }
  .track-form { flex-direction: column; }
  .track-form .btn { padding: 14px; justify-content: center; }
}

.tg-btn { color: #ffb79f; }

/* записи в заказе: режимы, история, окно проверки сообщения клиенту */
.composer { transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.composer[data-mode="client"] { border-color: var(--accent); background: #fff7f3; box-shadow: 0 0 0 3px var(--accent-soft); }
.composer[data-mode="self"] { border-style: dashed; border-color: var(--line); }
.seg.modes { display: flex; }
.seg.modes label { flex: 1 1 auto; text-align: center; }
.seg.modes span, .seg.small span { padding: 8px 10px; font-size: 13px; }
.composer[data-mode="client"] .seg.modes input:checked + span { background: var(--accent); }
.mode-hint { font-size: 13px; color: var(--ink-2); margin: 10px 0; }
.composer[data-mode="client"] .mode-hint { color: #a8340f; font-weight: 600; }
.hist-filter { margin-bottom: 12px; }
.feed li.ev-client { border-left: 3px solid var(--accent); padding-left: 10px; }
.feed li.ev-private { border-left: 3px dashed var(--line); padding-left: 10px; }
.feed li.ev-hidden { border-left: 3px solid var(--line); padding-left: 10px; }
.feed li.ev-hidden > span:first-of-type { text-decoration: line-through; color: var(--muted); }
.tag.private { background: #ece8ff; color: #4b3aa8; }
.hide-link { font-size: 12px; color: var(--risk); margin-left: 4px; }
.action.note { background: #fff8e1; border-color: #ecc77a; }
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 16px; z-index: 60; animation: rise .15s ease; }
.modal { background: var(--card); border-radius: 18px; padding: 24px; width: 100%; max-width: 520px; display: grid; gap: 14px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5); }
.modal h3 { color: var(--ink); text-transform: none; letter-spacing: -.01em; font-size: 18px; margin: 0; }
.client-preview { display: grid; gap: 4px; padding: 14px 16px; border-radius: 12px; background: var(--paper-2); border: 1.5px solid var(--line-2); }
.client-preview time { font: 12px var(--mono); color: var(--muted); }
.warn-box { background: var(--risk-soft); border: 1.5px solid #eaa29e; border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; font-size: 14px; }
.warn-box ul { margin: 0; padding-left: 18px; }
.modal-actions { justify-content: flex-end; }

/* экономика позиции */
.eco-form { display: grid; gap: 16px; }
.eco-step { border-left: 3px solid var(--line); padding-left: 14px; display: grid; gap: 8px; }
.eco-step.sale { border-left-color: var(--accent); }
.eco-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.eco-head output { font-family: var(--mono); font-weight: 700; font-size: 15px; }
.eco-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.eco-row input { font-family: var(--mono); }
.eco-note { font-size: 13px; }
.eco-result { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; background: var(--navy); color: rgba(255, 255, 255, .8); border-radius: 12px; padding: 14px 16px; }
.eco-result b { font-family: var(--display); font-size: 22px; color: #7ee2ad; }
.eco-result.neg b { color: #ff9b8f; }
.eco-total { margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.large-client { margin-top: 6px; font-size: 13px; font-weight: 700; color: #8a5a07; }
.sale-line { margin-top: 12px; font-size: 14px; }
.eco-sum-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.eco-sum-grid span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.eco-sum-grid b { display: block; font-family: var(--display); font-size: 18px; margin-top: 4px; }
.eco-sum-grid small { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) { .eco-sum-grid { grid-template-columns: 1fr; } }

.update-bar { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 70; display: flex; gap: 14px; align-items: center; background: var(--ink); color: #fff; padding: 10px 12px 10px 18px; border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .5); font-size: 14px; animation: rise .2s ease; }
@media (max-width: 900px) { .update-bar { left: 16px; right: 16px; transform: none; flex-wrap: wrap; } }

/* компенсации */
.comp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.comp-item { background: var(--card); border: 1.5px solid var(--line-2); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.comp-item .row { margin-top: 4px; }
.comp-form { display: grid; gap: 10px; margin-top: 10px; }
.comp-options { display: grid; gap: 6px; }
.comp-opt { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; padding: 8px 10px; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--card); cursor: pointer; }
.comp-opt input { width: auto; margin-top: 3px; }
.comp-opt b { display: block; font-size: 14px; color: var(--ink); }
.comp-opt small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.comp-fields { display: grid; gap: 10px; }
.budget-bar { height: 14px; border-radius: 7px; background: var(--paper-2); display: flex; overflow: hidden; }
.budget-bar i { display: block; height: 100%; }
.budget-bar .b-used { background: var(--accent); }
.budget-bar .b-res { background: #f3b49c; }
.comp-rules { margin-bottom: 22px; }
.comp-rules td { vertical-align: top; }

/* подарки к праздникам */
.hol-tabs { display: flex; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.gifts input { min-width: 140px; padding: 7px 9px; }
.gift-actions { flex-wrap: nowrap; }

/* фото и документы */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery a { display: grid; gap: 6px; text-decoration: none; font-size: 12.5px; color: var(--ink-2); }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--paper-2); }
.gallery.staff { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 12px; }
.gallery.staff figure { margin: 0; display: grid; gap: 6px; }
.gallery.staff figcaption { display: grid; gap: 4px; font-size: 12.5px; }
.doc-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.doc-list li { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 8px 10px; background: var(--paper-2); border-radius: 8px; font-size: 14px; }
.file-actions { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.link.danger { color: var(--risk); }
.file-form { display: grid; gap: 10px; border-top: 1px dashed var(--line); padding-top: 12px; }
.file-pick { display: inline-flex; width: max-content; cursor: pointer; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick span { padding: 8px 12px; border: 1.5px solid var(--ink); border-radius: 10px; font-weight: 600; font-size: 13px; background: var(--card); }
.file-pick:focus-within span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* получение и оценка клиентом */
.receive-btn { margin-top: 14px; }
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; width: max-content; margin-bottom: 4px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input span { font-size: 34px; line-height: 1; color: var(--line); cursor: pointer; transition: color .1s ease, transform .1s ease; }
.star-input label:hover span, .star-input label:hover ~ label span, .star-input input:checked + span, .star-input label:has(input:checked) ~ label span { color: #f2a900; }
.star-input input:focus-visible + span { outline: 2px solid var(--accent); border-radius: 4px; }
.star-input label { display: block; }
.feedback form { display: grid; gap: 10px; }
.stars-big { font-size: 28px; color: #f2a900; letter-spacing: 2px; }
.stars { color: #f2a900; letter-spacing: 1px; }

/* подписка клиента на новости в Telegram */
.tg-sub { margin-top: 10px; }
.sub-state { margin: 0; text-align: right; }

/* машины */
.truck-tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: #e3e9fb; color: #3450a8; }
.truck-line { margin: -6px 0 14px; font-size: 14px; color: var(--ink-2); }
.truck-new { display: grid; gap: 12px; margin-bottom: 18px; }
.truck-new h3 { margin-bottom: 0; }
.truck { margin-bottom: 16px; display: grid; gap: 10px; }
.truck.closed { opacity: .75; }
.truck-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.truck-head h2 { font-size: 22px; }
.truck-head .row { align-items: end; }
.truck-head input[type=date] { width: 160px; }
.truck-add select { max-width: 520px; }
.closed-trucks summary { cursor: pointer; font-weight: 600; margin: 10px 0; }

/* аналитика */
.stackbar { display: flex; gap: 2px; height: 16px; border-radius: 8px; overflow: hidden; background: var(--paper-2); }
.stackbar i { display: block; height: 100%; }
.stackbar i.ok, .sw.ok, .meter.ok i { background: var(--ok); }
.stackbar i.warn, .sw.warn, .meter.warn i { background: var(--warn); }
.stackbar i.risk, .sw.risk { background: var(--risk); }
.legend-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; }
.legend-list li { display: flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.meter { display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: var(--paper-2); vertical-align: middle; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; }
.meter.star i { background: #f2a900; }
.rating-dist { display: grid; gap: 8px; }
.rd-row { display: grid; grid-template-columns: 36px 1fr 28px; gap: 10px; align-items: center; font-size: 14px; }
.rd-row .meter { width: 100%; height: 10px; }
.rd-row b { text-align: right; }
.sub-h { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
td.red, .red { color: var(--risk); }

/* amoCRM: сделка в форме нового заказа и в карточке заказа */
.amo-pick { border-style: dashed; }
#amo-info.ok { color: var(--ok); }
#amo-info.err { color: var(--risk); }
.amo-state { margin: 0; text-align: right; }
.amo-ok { color: var(--ok); font-weight: 600; }
.amo-err { color: var(--risk); font-weight: 600; }
.amo-link { font-size: 13px; }
.amo-link summary { cursor: pointer; color: var(--ink-2); font-weight: 600; text-align: right; }
.amo-link form { margin-top: 8px; flex-wrap: nowrap; }
.amo-link input { padding: 7px 10px; font-size: 13px; min-width: 0; width: 240px; }

/* партия: товары с одного завода; правка заказа; пройденные этапы */
.batch-items { display: grid; gap: 8px; margin: 10px 0 12px; }
.item-rows { display: grid; gap: 8px; }
.item-row { display: grid; grid-template-columns: 1fr 160px auto; gap: 8px; align-items: center; }
.item-row .rm-item { color: var(--muted); text-decoration: none; font-size: 14px; padding: 0 4px; }
.batch-items .add-item { justify-self: start; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.done-input { width: auto; padding: 3px 6px; font: 500 13px var(--mono); border-color: transparent; background: transparent; }
.done-input:hover, .done-input:focus { border-color: var(--line); background: var(--card); }
.btn.danger { background: var(--risk); border-color: var(--risk); color: #fff; }
.btn.danger:hover { box-shadow: 0 4px 0 #8a1f1a; }
.danger-zone { margin-top: 28px; border-color: var(--risk-soft); }
@media (max-width: 900px) { .item-row { grid-template-columns: 1fr 110px auto; } }

/* шапка админки на телефоне: логотип и пользователь в первой строке, разделы — лентой с прокруткой вбок */
@media (max-width: 900px) {
  .topbar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px 12px; padding: 12px 16px 0; position: static; }
  .topbar .brand { font-size: 17px; }
  .topbar .brand small, .topbar .who .role { display: none; }
  .topbar .who { grid-column: 2; grid-row: 1; gap: 10px; font-size: 13px; white-space: nowrap; }
  .topbar nav { grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { flex: none; white-space: nowrap; }
  .topbar nav a.cta { order: -1; }
}
/* на телефоне таблицы прокручиваются внутри своей панели, а не растягивают страницу */
@media (max-width: 900px) {
  .wrap > *, .stack, .panel, .order-grid > *, .grid-2 > * { min-width: 0; }
  .wrap table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
/* длинные слова и ссылки в истории переносятся, а не раздвигают колонку */
.feed { grid-template-columns: minmax(0, 1fr); }
.feed li > span { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .kpis > *, .cols-3 > *, .cols-4 > * { min-width: 0; }
  .kpis > div, .kpis > .kpi-eco { padding: 12px; }
  .kpis b { font-size: 17px; overflow-wrap: anywhere; }
  .kpis span { font-size: 11px; letter-spacing: .03em; }
}
@media (max-width: 900px) {
  .wrap .btn { white-space: normal; line-height: 1.25; }
  .action > *, .action .row > * { min-width: 0; }
}
@media (max-width: 900px) {
  .head-side { justify-items: start; }
  .head-side .sub-state, .amo-state, .amo-link summary { text-align: left; }
}
