/* ===================================================================
   ЦИФРУС · Operations Console — дизайн-система
   Aesthetic: «Editorial Operations Console»
   Шрифты: Fraunces (display, italic), Manrope (UI), JetBrains Mono (data)
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,500;0,9..144,700;1,9..144,400;1,9..144,600;1,9..144,800&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* === paper / ink === */
  --paper:      #f5f4f2;     /* warm off-white фон страницы */
  --paper-2:    #ebe8e2;     /* secondary surface, hover row */
  --paper-3:    #ddd9d0;     /* hairline-soft */
  --surface:    #ffffff;     /* карточки, поля, header */

  --ink:        #1a1817;     /* основной текст, off-black */
  --ink-2:      #4a4642;     /* secondary text */
  --sub:        #8a857e;     /* caption / muted / placeholder */

  --rule:       #d6d2c8;     /* hairline 1px между элементами */
  --rule-2:     #4a4642;     /* 2px правило только под крупными разделами */

  /* === brand: Цифрус === */
  --purple:        #6e419e;
  --purple-deep:   #5a3382;
  --purple-tint:   #f0eaf6;
  --green:         #2aad6f;
  --green-deep:    #15803d;
  --green-bright:  #26d07c;

  /* === статусы (для desktop: deeper-ink + светлый tint) === */
  --st-assigned-ink:    #475569; --st-assigned-tint:    #f1f5f9;
  --st-accepted-ink:    #6e419e; --st-accepted-tint:    #f3eef7;
  --st-en-route-ink:    #b45309; --st-en-route-tint:    #fef3c7;
  --st-arrived-ink:     #4d7c0f; --st-arrived-tint:     #ecfccb;
  --st-delivered-ink:   #15803d; --st-delivered-tint:   #d1fae5;
  --st-failed-ink:      #b91c1c; --st-failed-tint:      #fee2e2;
  --st-rescheduled-ink: #6d28d9; --st-rescheduled-tint: #ede9fe;

  /* === шрифты === */
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body:    'Manrope', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Menlo', monospace;

  /* === spacing scale === */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  20px;
  --s-6:  24px;
  --s-8:  32px;
  --s-10: 40px;
  --s-14: 56px;
  --s-20: 80px;

  /* === density === */
  --header-h:  56px;
  --toolbar-h: 64px;
  --row-h:     40px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =================================================================
   ТИПОГРАФИКА
   ================================================================= */

.display-1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 80px;
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}
.display-2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 44px;
  line-height: 1.0;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}
.h1 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0;
}
.h2 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0;
}
.eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sub);
  display: inline-block;
}
.tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  color: var(--ink-2);
  letter-spacing: 0.005em;
}
.mono { font-family: var(--font-mono); }
.muted { color: var(--sub); }

/* =================================================================
   FORMS
   ================================================================= */

.field {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field:hover  { border-color: var(--ink-2); }
.field:focus  { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-tint); }
.field::placeholder { color: var(--sub); }

.field-label {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: var(--s-2);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  padding: 10px 18px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
  user-select: none;
}
.btn:hover   { background: var(--ink-2); }
.btn:active  { transform: translateY(1px); }
.btn-primary { background: var(--purple); color: #fff; border-color: var(--purple); }
.btn-primary:hover { background: var(--purple-deep); border-color: var(--purple-deep); }
.btn-ghost   { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-link    {
  background: none; border: none; padding: 0;
  color: var(--purple); font-weight: 600;
  text-transform: none; letter-spacing: 0;
  font-size: 13px; cursor: pointer;
}
.btn-link:hover { color: var(--purple-deep); text-decoration: underline; }

/* =================================================================
   APP LAYOUT (orders / order)
   ================================================================= */

.app {
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.appbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  height: var(--header-h);
  padding: 0 var(--s-6);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-6);
}
.appbar-brand {
  display: flex; align-items: center; gap: var(--s-3);
  text-decoration: none; color: var(--ink);
}
.appbar-brand-logo {
  width: 28px; height: 28px;
  display: inline-block;
}
.appbar-brand-name {
  font-family: var(--font-display);
  font-style: italic; font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.appbar-brand-sub {
  font-family: var(--font-body);
  font-weight: 600; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--sub);
  margin-left: var(--s-1);
  padding-left: var(--s-3);
  border-left: 1px solid var(--rule);
}
.appbar-nav {
  display: flex; align-items: center; gap: var(--s-2);
}
.appbar-nav a {
  font-family: var(--font-body);
  font-weight: 600; font-size: 13px;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--sub);
  padding: 8px 14px;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: color 120ms;
}
.appbar-nav a:hover { color: var(--ink-2); text-decoration: none; }
.appbar-nav a.is-active {
  color: var(--ink);
  border-bottom-color: var(--purple);
}
.appbar-user {
  display: flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-body); font-size: 13px;
}
.appbar-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  font-style: normal;
}

/* =================================================================
   TOOLBAR (filters)
   ================================================================= */

.toolbar {
  position: sticky; top: var(--header-h); z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  height: var(--toolbar-h);
  padding: 0 var(--s-6);
  display: flex; align-items: center; gap: var(--s-3);
}
.toolbar-group {
  display: flex; align-items: center; gap: var(--s-2);
}
.toolbar-divider {
  width: 1px; height: 24px;
  background: var(--rule);
  margin: 0 var(--s-2);
}
.toolbar-grow { flex: 1; }
.toolbar-counter {
  font-family: var(--font-mono);
  font-weight: 500; font-size: 12px;
  color: var(--ink-2);
  letter-spacing: 0;
}
.toolbar-counter b {
  color: var(--ink);
  font-weight: 700;
  font-family: var(--font-mono);
}

.chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 30px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 120ms, color 120ms, background 120ms;
  user-select: none;
}
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip.is-active {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.chip-search {
  display: flex; align-items: center; gap: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--rule);
  height: 30px;
  padding: 0 10px;
  width: 280px;
}
.chip-search:focus-within { border-color: var(--purple); }
.chip-search input {
  border: none; outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  flex: 1;
}
.chip-search input::placeholder { color: var(--sub); }
.chip-search .icon { color: var(--sub); font-size: 14px; }

/* =================================================================
   STATUS CHIP (используется в таблице, в карточке)
   ================================================================= */

.st {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px;
  padding: 0 10px 0 8px;
  background: var(--st-bg, var(--paper-2));
  color: var(--st-ink, var(--ink));
  border: 1px solid color-mix(in oklab, var(--st-ink, var(--ink)) 22%, transparent);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.st::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--st-ink, var(--ink));
}

.st[data-status="assigned"]    { --st-ink: var(--st-assigned-ink);    --st-bg: var(--st-assigned-tint); }
.st[data-status="accepted"]    { --st-ink: var(--st-accepted-ink);    --st-bg: var(--st-accepted-tint); }
.st[data-status="en_route"]    { --st-ink: var(--st-en-route-ink);    --st-bg: var(--st-en-route-tint); }
.st[data-status="arrived"]     { --st-ink: var(--st-arrived-ink);     --st-bg: var(--st-arrived-tint); }
.st[data-status="delivered"]   { --st-ink: var(--st-delivered-ink);   --st-bg: var(--st-delivered-tint); }
.st[data-status="failed"]      { --st-ink: var(--st-failed-ink);      --st-bg: var(--st-failed-tint); }
.st[data-status="rescheduled"] { --st-ink: var(--st-rescheduled-ink); --st-bg: var(--st-rescheduled-tint); }
.st[data-status="new"],
.st[data-status="imported"],
.st[data-status="sms_sent"]    { --st-ink: var(--st-assigned-ink);    --st-bg: var(--paper-2); }

/* =================================================================
   TABLE
   ================================================================= */

.table-wrap {
  flex: 1;
  overflow: auto;
  border-bottom: 1px solid var(--rule);
}
table.orders {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 13px;
}
table.orders thead th {
  position: sticky;
  top: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--rule-2);
  font-family: var(--font-body);
  font-weight: 700; font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sub);
  padding: 10px var(--s-4);
  text-align: left;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
table.orders thead th:hover { color: var(--ink-2); }
table.orders thead th.is-sorted { color: var(--ink); }
table.orders thead th .arrow {
  font-size: 10px; margin-left: 4px;
  display: inline-block;
}
table.orders tbody tr {
  height: var(--row-h);
  border-bottom: 1px solid var(--rule);
  transition: background 90ms ease;
  cursor: pointer;
}
table.orders tbody tr:hover { background: var(--paper-2); }
table.orders tbody tr.is-selected { background: var(--purple-tint); }

table.orders td {
  padding: 0 var(--s-4);
  vertical-align: middle;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
table.orders td.col-id    { font-family: var(--font-mono); font-weight: 500; font-size: 12px; }
table.orders td.col-time  { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
table.orders td.col-addr  { max-width: 380px; }
table.orders td.col-courier { color: var(--ink-2); }
table.orders td.col-courier.is-empty { color: var(--sub); font-style: italic; }
table.orders td.col-priority {
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
}
table.orders td.col-actions { text-align: right; }

/* =================================================================
   PAGINATION
   ================================================================= */

.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-6);
  background: var(--paper);
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-2);
}
.pager-pages { display: flex; align-items: center; gap: 2px; }
.pager-btn {
  min-width: 28px; height: 28px;
  padding: 0 8px;
  background: transparent; color: var(--ink-2);
  border: 1px solid transparent;
  font-family: var(--font-mono); font-weight: 500; font-size: 12px;
  cursor: pointer;
  transition: background 90ms;
}
.pager-btn:hover { background: var(--paper-2); color: var(--ink); }
.pager-btn.is-active {
  background: var(--ink); color: var(--paper);
  border-color: var(--ink);
}
.pager-btn[disabled] { color: var(--paper-3); cursor: not-allowed; background: transparent; }
.pager-ellipsis { padding: 0 4px; color: var(--sub); }

/* =================================================================
   ORDER CARD
   ================================================================= */

.order-page {
  flex: 1;
  padding: var(--s-8) var(--s-6) var(--s-14);
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}
.order-breadcrumb {
  display: flex; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-6);
  font-family: var(--font-body); font-size: 13px;
  color: var(--sub);
}
.order-breadcrumb a { color: var(--sub); }
.order-breadcrumb a:hover { color: var(--ink); text-decoration: none; }
.order-breadcrumb .sep { color: var(--rule); }
.order-breadcrumb .here { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }

.order-hero {
  border-bottom: 1px solid var(--rule-2);
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-8);
}
.order-hero-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
}
.order-hero-top .num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--sub);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.order-hero-top .meta {
  display: flex; align-items: center; gap: var(--s-3);
}
.order-hero-top .meta .updated {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--sub);
}

.order-hero-main {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--s-8);
  align-items: center;
}
.order-hero .title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0;
}
.order-hero .st { height: 22px; padding: 0 10px 0 8px; font-size: 11px; }

/* Inline assign в hero — занимает всю правую ячейку (синхрон с правой колонкой grid) */
.order-assign {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 10px 12px 10px 16px;
  width: 100%;
}
.order-assign .who {
  display: flex; flex-direction: column;
  padding-right: var(--s-3);
  border-right: 1px solid var(--rule);
  min-width: 0;
}
.order-assign .who .label {
  font-family: var(--font-body);
  font-weight: 600; font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sub);
  line-height: 1.2;
}
.order-assign .who .name {
  font-family: var(--font-body);
  font-weight: 700; font-size: 14px;
  color: var(--ink);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-assign .who .name.empty { color: var(--sub); font-weight: 500; }
.order-assign .who .phone {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.3;
}
.order-assign select {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 7px 10px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  width: 100%;
  min-width: 0;
}
.order-assign select:focus { border-color: var(--purple); }
.order-assign .btn {
  padding: 8px 16px;
  font-size: 12px;
}

.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--s-8);
  align-items: start;
}

.section-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  padding-bottom: var(--s-2);
  margin: 0 0 var(--s-4);
}

.row-pair {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.row-pair .k {
  font-family: var(--font-body);
  font-weight: 600; font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sub);
}
.row-pair .v {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
}
.row-pair .v.mono { font-family: var(--font-mono); font-size: 13px; }
.row-pair .v a { color: var(--ink); border-bottom: 1px dashed var(--purple); }
.row-pair .v a:hover { color: var(--purple); text-decoration: none; }

/* === inline geocoord toggle + map (Step 6+) === */
.geocoord-toggle {
  background: none; border: 0; padding: 0;
  font-family: inherit; font-size: inherit; color: var(--ink);
  cursor: pointer;
  border-bottom: 1px dashed var(--purple);
  display: inline-flex; align-items: center; gap: 6px;
}
.geocoord-toggle:hover { color: var(--purple); }
.geocoord-toggle .caret {
  display: inline-block;
  transition: transform 150ms ease;
  font-size: 10px;
  color: var(--sub);
}
.geocoord-toggle.is-open .caret { transform: rotate(90deg); color: var(--purple); }

.row-pair-map {
  grid-column: 1 / -1;
  display: block;
  position: relative;
  height: 0;
  overflow: hidden;
  border: 0 solid var(--rule-2);
  margin: 0;
  transition: height 180ms ease-out, border-width 180ms ease-out, margin 180ms ease-out;
  background: var(--paper-2);
}
.row-pair-map.is-open {
  height: 340px;
  border-width: 1px;
  margin: 8px 0 16px;
}
.map-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  background: var(--paper-2);
}
.map-canvas .placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--sub); font-style: italic; font-size: 13px;
}

.map-actions {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 5;
  display: flex; align-items: center; gap: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  height: 28px;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.map-actions a, .map-actions button {
  display: inline-flex; align-items: center;
  height: 26px;
  padding: 0 10px;
  background: none; border: 0;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.map-actions a:hover, .map-actions button:hover { color: var(--ink); background: var(--paper); }
.map-actions .map-divider {
  width: 1px; height: 18px;
  background: var(--rule);
}
.map-actions .map-close {
  font-size: 16px;
  padding: 0 10px;
  line-height: 1;
}

.assign-block {
  margin-top: var(--s-8);
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: var(--s-5);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-5);
}
.assign-block .who {
  display: flex; flex-direction: column; gap: var(--s-1);
}
.assign-block .who .label {
  font-family: var(--font-body);
  font-weight: 600; font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sub);
}
.assign-block .who .name {
  font-family: var(--font-display);
  font-weight: 700; font-size: 22px;
  font-style: italic;
  color: var(--ink);
}
.assign-block .who .name.empty { color: var(--sub); font-style: italic; font-weight: 400; }
.assign-block .who .phone {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
}
.assign-block .controls {
  display: flex; align-items: center; gap: var(--s-3);
}
.assign-block select {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 9px 10px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  min-width: 240px;
  outline: none;
}
.assign-block select:focus { border-color: var(--purple); }

/* === side panels === */
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
}
.panel-head {
  border-bottom: 1px solid var(--rule);
  padding: var(--s-3) var(--s-4);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-head .h2 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
.panel-head .count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--sub);
}
.panel-body { padding: var(--s-4); }
.panel + .panel { margin-top: var(--s-5); }

.event {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.event:last-child { border-bottom: none; }
.event .ts {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sub);
  padding-top: 2px;
}
.event .body { color: var(--ink); }
.event .meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sub);
}

.placeholder {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--sub);
  font-style: italic;
  padding: var(--s-4) 0;
  text-align: center;
}

/* =================================================================
   LOGIN
   ================================================================= */

.login-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse at top right, rgba(110,65,158,0.06), transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(42,173,111,0.06), transparent 50%),
    var(--paper);
}
.login-page-top {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-10);
}
.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: var(--s-10) var(--s-10) var(--s-8);
  position: relative;
}
.login-card::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 4px;
  background: linear-gradient(90deg, var(--green) 0%, var(--purple) 100%);
}
.login-brand {
  text-align: center;
  margin-bottom: var(--s-8);
}
.login-wordmark {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-display);
  font-style: italic; font-weight: 700;
  font-size: 36px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.login-wordmark .dot { color: var(--green); }
.login-sub {
  display: block;
  font-family: var(--font-body);
  font-weight: 600; font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sub);
  margin-top: 6px;
}
.login-form .field-row + .field-row { margin-top: var(--s-4); }
.login-form .btn { width: 100%; margin-top: var(--s-6); }
.login-form .error {
  margin-top: var(--s-4);
  padding: 10px 12px;
  background: var(--st-failed-tint);
  border: 1px solid color-mix(in oklab, var(--st-failed-ink) 30%, transparent);
  color: var(--st-failed-ink);
  font-size: 13px;
  font-family: var(--font-mono);
}
.login-tagline {
  text-align: center;
  margin-top: var(--s-8);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.login-tagline .quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  color: var(--ink-2);
  letter-spacing: 0.005em;
}
.login-tagline .quote::before { content: "« "; color: var(--green); }
.login-tagline .quote::after  { content: " »"; color: var(--purple); }

.login-page-foot {
  border-top: 1px solid var(--rule);
  padding: var(--s-4) var(--s-6);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sub);
  letter-spacing: 0.04em;
}
.login-page-foot .v {
  text-transform: uppercase;
}

/* =================================================================
   UTIL
   ================================================================= */

.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: var(--s-2); }
.spacer { flex: 1; }
.arrow-right::after { content: " →"; color: var(--sub); }
.kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 1px 5px;
  color: var(--ink-2);
}

/* =================================================================
   ШАГ 7: МАРШРУТЫ (routes.html) и плашка маршрута в order.html
   ================================================================= */

/* --- toolbar-расширения для routes --- */
.field-date {
  width: auto;
  height: 30px;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.toolbar-couriers {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.chip-row {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  overflow-x: auto;
  padding: 2px 0;
  max-height: 60px;
}
.chip-mini {
  height: 24px;
  padding: 0 9px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.chip-check {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px;
  padding: 0 10px 0 6px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.chip-check:hover { border-color: var(--ink-2); }
.chip-check .check-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: transparent;
  font-size: 10px; font-weight: 700;
}
.chip-check.is-on {
  border-color: var(--purple);
  background: var(--purple-tint);
  color: var(--ink);
}
.chip-check.is-on .check-mark {
  border-color: var(--purple);
  background: var(--purple);
  color: #fff;
}

/* --- pinned-конфликт banner --- */
.pin-banner {
  position: sticky; top: var(--header-h); z-index: 45;
  background: #f6ecd0;                         /* paper-tint amber */
  border-top: 1px solid #c89b3f;
  border-bottom: 1px solid #c89b3f;
  color: #5a4116;
}
.pin-banner-inner {
  display: flex; align-items: flex-start; gap: var(--s-6);
  padding: var(--s-3) var(--s-6);
}
.pin-banner-text { flex: 1; min-width: 0; }
.pin-banner-eyebrow {
  display: block;
  font-family: var(--font-display);
  font-style: italic; font-weight: 700;
  font-size: 18px;
  color: #5a4116;
  margin-bottom: 2px;
}
.pin-banner-line {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  color: #5a4116;
}
.pin-banner-list {
  margin: 6px 0 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #5a4116;
  display: flex; flex-wrap: wrap; gap: 0 var(--s-4);
}
.pin-banner-list li::before {
  content: "·";
  margin-right: 6px;
  color: #b07a26;
}
.pin-banner-list li:first-child::before { content: ""; margin: 0; }
.pin-banner-list .ord-num { font-weight: 700; }
.pin-banner-actions {
  display: flex; align-items: center; gap: var(--s-2);
  flex-shrink: 0;
}
.btn-line {
  display: inline-flex; align-items: center;
  background: transparent;
  border: 1px solid #c89b3f;
  color: #5a4116;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-weight: 600; font-size: 12px;
  letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms;
}
.btn-line:hover { background: rgba(200, 155, 63, 0.18); }
.btn-line.is-ghost {
  width: 28px; height: 28px;
  padding: 0;
  font-size: 18px;
  font-weight: 400;
  border-color: #c89b3f;
}

/* --- routes layout --- */
.routes-page {
  flex: 1;
  padding: var(--s-6) var(--s-6) var(--s-10);
  display: flex; flex-direction: column; gap: var(--s-4);
  max-width: 1600px; width: 100%;
  margin: 0 auto;
}
.placeholder-pad {
  text-align: center;
  padding: 64px 24px;
  color: var(--sub);
  font-family: var(--font-body);
  font-size: 14px;
  border: 1px dashed var(--rule);
  background: var(--surface);
}

/* --- route-card --- */
.route-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  position: relative;
  opacity: 0;
  animation: route-rise 360ms ease-out forwards;
  animation-delay: var(--stagger, 0ms);
}
@keyframes route-rise {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.route-card-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-4) var(--s-6);
  cursor: pointer;
  user-select: none;
  transition: background 120ms;
}
.route-card-head:hover { background: var(--paper-2); }

.route-card-byline {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.route-card-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.route-card-meta {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--sub);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.route-card-meta .dot { color: var(--rule); }
.route-card-meta .mono { letter-spacing: 0; text-transform: none; }
.route-card-meta .route-status {
  color: var(--ink-2);
  text-transform: lowercase;
  letter-spacing: 0;
}

.route-card-totals {
  display: flex; align-items: center; gap: var(--s-3);
  font-size: 14px;
  color: var(--ink);
}
.route-card-totals .t-num {
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.route-card-totals .t-unit {
  margin-left: 6px;
  font-size: 11px;
  color: var(--sub);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.route-card-totals .t-rule {
  width: 1px; height: 18px;
  background: var(--rule);
}

.route-card-chevron {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink-2);
  transition: transform 200ms ease;
  display: inline-block;
}
.route-card.is-open .route-card-chevron { transform: rotate(90deg); }

.route-card-body {
  border-top: 1px solid var(--rule);
  position: relative;
  padding: var(--s-3) var(--s-6) var(--s-5);
}
.route-card-body-loading {
  padding: var(--s-4);
  font-size: 13px;
}

/* spine — вертикальная hairline слева, как «корешок» */
.stops-spine {
  position: absolute;
  left: var(--s-6);
  top: var(--s-3);
  bottom: var(--s-5);
  width: 1px;
  background: linear-gradient(to bottom,
    var(--purple) 0,
    var(--purple) 12px,
    var(--rule) 12px,
    var(--rule) calc(100% - 12px),
    var(--purple) calc(100% - 12px),
    var(--purple) 100%);
  pointer-events: none;
}

/* --- stops table --- */
table.stops {
  width: 100%;
  border-collapse: collapse;
  margin-left: var(--s-5);                /* отступ под spine */
  font-family: var(--font-body);
  font-size: 13px;
}
table.stops thead th {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sub);
  text-align: left;
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--rule);
}
table.stops tbody td {
  padding: 10px var(--s-3);
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
table.stops tbody tr:last-child td { border-bottom: none; }
table.stops .seq {
  width: 36px;
  font-family: var(--font-mono);
  color: var(--sub);
  font-weight: 700;
  text-align: right;
  padding-right: var(--s-4);
}
table.stops .ord { width: 130px; }
table.stops .ord-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  border-bottom: 1px dotted var(--rule);
}
table.stops .ord-link:hover { color: var(--purple); border-bottom-color: var(--purple); text-decoration: none; }
table.stops .addr {
  max-width: 480px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink);
}
table.stops .win {
  width: 110px;
  color: var(--ink-2);
  font-size: 12px;
}
table.stops .eta {
  width: 150px;
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
}
table.stops .eta-arrow { margin: 0 6px; }
table.stops .st-cell { width: 130px; }
table.stops tr.is-eta-out .eta {
  color: var(--st-failed-ink);
  font-weight: 700;
}
table.stops tr.is-eta-out .eta::after {
  content: " ⚠";
  color: var(--st-failed-ink);
  font-size: 11px;
}
table.stops tbody tr:hover { background: var(--paper-2); }

/* --- side-blocks (unassigned / excluded) --- */
.side-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
  margin-top: var(--s-4);
}
.side-block {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-2);
  padding: var(--s-4) var(--s-5);
}
.side-block.side-warn { border-left-color: #b45309; }
.side-eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: var(--s-2);
}
.side-list {
  list-style: none;
  margin: 0; padding: 0;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-2);
}
.side-list li {
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
  line-height: 1.45;
}
.side-list li:last-child { border-bottom: none; }
.side-list li a.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-right: var(--s-2);
}

/* --- route-plate в order.html --- */
.route-plate {
  display: inline-flex; align-items: center; gap: var(--s-3);
  margin-top: var(--s-3);
  padding: 8px var(--s-4) 8px var(--s-3);
  background: var(--purple-tint);
  border: 1px solid color-mix(in oklab, var(--purple) 35%, transparent);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 13px;
  transition: border-color 120ms, background 120ms;
}
.route-plate:hover {
  background: #e6dbf2;
  border-color: var(--purple);
  text-decoration: none;
}
.route-plate-eyebrow {
  font-weight: 600; font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--purple-deep);
}
.route-plate-divider {
  width: 1px; height: 16px;
  background: color-mix(in oklab, var(--purple) 35%, transparent);
}
.route-plate-num,
.route-plate-pos,
.route-plate-eta {
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.route-plate-num { color: var(--purple-deep); font-weight: 700; }
.route-plate-eta { color: var(--ink); }
.route-plate-eta .muted { margin: 0 4px; }
.route-plate-arrow {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--purple-deep);
  margin-left: 4px;
}

/* =================================================================
   ШАГ 8: ЖУРНАЛ КУРЬЕРА (order.html aside) + EVENTS PAGE
   ================================================================= */

/* event-group token mapping (поверх существующих --st-X-ink/tint) */
:root {
  --evg-arrival-ink:    var(--st-arrived-ink);
  --evg-arrival-tint:   var(--st-arrived-tint);
  --evg-delivered-ink:  var(--st-delivered-ink);
  --evg-delivered-tint: var(--st-delivered-tint);
  --evg-departure-ink:  var(--st-rescheduled-ink);
  --evg-departure-tint: var(--st-rescheduled-tint);
  --evg-alarm-ink:      var(--st-failed-ink);
  --evg-alarm-tint:     var(--st-failed-tint);
  --evg-movement-ink:   var(--st-en-route-ink);
  --evg-movement-tint:  var(--st-en-route-tint);
  --evg-operator-ink:   var(--st-accepted-ink);
  --evg-operator-tint:  var(--st-accepted-tint);
}

/* === Journal panel в order.html === */

.journal-panel .panel-head {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--s-3);
}
.journal-panel .panel-head .eyebrow { color: var(--sub); }
.journal-panel .panel-head .h2 { margin: 0; }
.journal-panel .panel-head .count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  background: var(--paper-2);
  padding: 1px 8px;
  border: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.btn-refresh {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  transition: transform 200ms ease, color 120ms ease, border-color 120ms ease;
}
.btn-refresh:hover { color: var(--purple); border-color: var(--purple); }
.btn-refresh:disabled { opacity: 0.6; cursor: default; }
.btn-refresh.is-spinning { animation: spin 700ms linear; }
@keyframes spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

.journal-body {
  position: relative;
  padding: 0;
}
.journal-empty {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--sub);
  padding: var(--s-5) var(--s-4);
  font-size: 14px;
  text-align: center;
}

/* spine — 1px вертикаль слева на 22px */
.journal-body::before {
  content: "";
  position: absolute;
  left: 22px; top: 12px; bottom: 12px;
  width: 1px;
  background: var(--rule);
  pointer-events: none;
}

.journal-entry {
  display: grid;
  grid-template-columns: 28px 56px 1fr;     /* dot | time | body */
  align-items: start;
  gap: 0;
  padding: 8px 12px 8px 6px;
  border-bottom: 1px solid var(--rule);
  position: relative;
  transition: background 120ms;
}
.journal-entry:last-child { border-bottom: none; }
.journal-entry:hover { background: var(--paper-2); }
.journal-entry.has-pos { cursor: default; }

.je-dot {
  width: 10px; height: 10px;
  margin: 6px auto 0;
  background: var(--evg-ink, var(--ink));
  border: 1px solid var(--evg-ink, var(--ink));
  box-shadow: 0 0 0 3px var(--surface);    /* «вырезает» dot из spine */
  border-radius: 50%;
  position: relative;
  z-index: 1;
  display: block;
}
.journal-entry[data-group="arrival"]   { --evg-ink: var(--evg-arrival-ink); }
.journal-entry[data-group="delivered"] { --evg-ink: var(--evg-delivered-ink); }
.journal-entry[data-group="departure"] { --evg-ink: var(--evg-departure-ink); }
.journal-entry[data-group="alarm"]     { --evg-ink: var(--evg-alarm-ink); }
.journal-entry[data-group="movement"]  { --evg-ink: var(--evg-movement-ink); }
.journal-entry[data-group="operator"]  { --evg-ink: var(--evg-operator-ink); }

.je-time {
  font-size: 12px;
  color: var(--ink-2);
  padding-top: 4px;
  font-variant-numeric: tabular-nums;
}
.je-body {
  display: flex; flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: 2px;
}
.je-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.3;
}
.je-courier {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-2);
}
.je-message {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--sub);
  line-height: 1.35;
}
.je-coords {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sub);
  letter-spacing: 0;
}

/* === Events page (events.html) === */

.events-toolbar {
  height: auto;
  min-height: var(--toolbar-h);
  padding: 8px var(--s-6);
  flex-wrap: wrap;
  gap: var(--s-3);
}
.toolbar-event-types {
  flex: 1;
  min-width: 0;
  max-height: 70px;
  overflow: hidden;
}
.toolbar-event-types .chip-row {
  flex-wrap: wrap;
  max-height: 56px;
  overflow-y: auto;
}

.events-page {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
  gap: var(--s-5);
  padding: var(--s-5) var(--s-6) var(--s-8);
  max-width: 1700px; width: 100%;
  margin: 0 auto;
  align-items: stretch;
}
.events-table-wrap {
  background: var(--surface);
  border: 1px solid var(--rule);
  overflow: auto;
  max-height: calc(100vh - var(--header-h) - var(--toolbar-h) - 80px);
  align-self: start;
  position: relative;
}
table.events-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 13px;
}
table.events-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--rule-2);
  font-family: var(--font-body);
  font-weight: 600; font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sub);
  text-align: left;
  padding: 10px 12px;
  z-index: 2;
}
table.events-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
table.events-table tbody tr:last-child td { border-bottom: none; }
table.events-table tbody tr.ev-row { transition: background 120ms; }
table.events-table tbody tr.ev-row:hover { background: var(--paper-2); }
table.events-table tbody tr.ev-row.has-pos { cursor: pointer; }
table.events-table tbody tr.ev-row.has-pos:hover { background: var(--purple-tint); }

table.events-table .ev-time { width: 80px; color: var(--ink-2); }
table.events-table .ev-courier { width: 180px; color: var(--ink); font-weight: 500; }
table.events-table .ev-order { width: 130px; }
table.events-table .ev-order a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  border-bottom: 1px dotted var(--rule);
}
table.events-table .ev-order a:hover { color: var(--purple); border-bottom-color: var(--purple); text-decoration: none; }
table.events-table .ev-coords { color: var(--sub); font-size: 12px; white-space: nowrap; }

.ev-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 2px 6px;
  background: var(--evg-tint, var(--paper-2));
  color: var(--evg-ink, var(--ink));
  border: 1px solid color-mix(in oklab, var(--evg-ink, var(--ink)) 22%, transparent);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.ev-chip[data-group="arrival"]   { --evg-ink: var(--evg-arrival-ink);   --evg-tint: var(--evg-arrival-tint); }
.ev-chip[data-group="delivered"] { --evg-ink: var(--evg-delivered-ink); --evg-tint: var(--evg-delivered-tint); }
.ev-chip[data-group="departure"] { --evg-ink: var(--evg-departure-ink); --evg-tint: var(--evg-departure-tint); }
.ev-chip[data-group="alarm"]     { --evg-ink: var(--evg-alarm-ink);     --evg-tint: var(--evg-alarm-tint); }
.ev-chip[data-group="movement"]  { --evg-ink: var(--evg-movement-ink);  --evg-tint: var(--evg-movement-tint); }
.ev-chip[data-group="operator"]  { --evg-ink: var(--evg-operator-ink);  --evg-tint: var(--evg-operator-tint); }
.ev-chip .ev-dot {
  width: 7px; height: 7px;
  background: var(--evg-ink);
  border-radius: 50%;
}

.events-map-wrap {
  position: sticky;
  top: calc(var(--header-h) + var(--toolbar-h) + 8px);
  height: calc(100vh - var(--header-h) - var(--toolbar-h) - 80px);
  display: flex; flex-direction: column;
  border: 1px solid var(--rule);
  background: var(--surface);
}
.events-map-canvas {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.events-map-canvas .placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--sub);
  font-family: var(--font-body);
  font-size: 13px;
}
.events-map-legend {
  display: flex; flex-wrap: wrap;
  gap: var(--s-3);
  padding: 8px var(--s-3);
  border-top: 1px solid var(--rule);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}
.legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.legend-dot {
  width: 8px; height: 8px;
  background: var(--evg-ink, var(--ink));
  border-radius: 50%;
}
.legend-item[data-group="arrival"]   { --evg-ink: var(--evg-arrival-ink); }
.legend-item[data-group="delivered"] { --evg-ink: var(--evg-delivered-ink); }
.legend-item[data-group="departure"] { --evg-ink: var(--evg-departure-ink); }
.legend-item[data-group="alarm"]     { --evg-ink: var(--evg-alarm-ink); }
.legend-item[data-group="movement"]  { --evg-ink: var(--evg-movement-ink); }
.legend-item[data-group="operator"]  { --evg-ink: var(--evg-operator-ink); }

/* tablet/below 1280: стек */
@media (max-width: 1280px) {
  .events-page {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .events-table-wrap {
    max-height: none;
  }
  .events-map-wrap {
    position: sticky;
    top: auto;
    bottom: 0;
    height: 60vh;
    z-index: 5;
  }
}
