:root {
  --bg: oklch(0.976 0.008 78);
  --canvas: oklch(0.976 0.008 78);
  --panel: oklch(0.998 0.003 80);
  --panel-soft: oklch(0.962 0.011 76);
  --surface2: oklch(0.962 0.011 76);
  --line: oklch(0.912 0.013 74);
  --line-strong: oklch(0.860 0.016 74);
  --ink: oklch(0.330 0.020 62);
  --ink-strong: oklch(0.262 0.022 62);
  --ink2: oklch(0.418 0.020 62);
  --muted: oklch(0.588 0.018 66);
  --brand: oklch(0.560 0.140 42);
  --brand-dark: oklch(0.490 0.135 40);
  --brand-soft: oklch(0.948 0.032 55);
  --brand-ink: oklch(0.998 0.003 80);
  --signal: oklch(0.640 0.130 62);
  --signal-soft: oklch(0.960 0.040 70);
  --success: oklch(0.545 0.105 158);
  --success-soft: oklch(0.948 0.035 158);
  --pos: oklch(0.600 0.130 160);
  --neg: oklch(0.590 0.180 25);
  --danger: oklch(0.555 0.175 25);
  --danger-soft: oklch(0.955 0.030 25);
  --warning: oklch(0.545 0.110 72);
  --warning-soft: oklch(0.955 0.045 78);
  --nav: oklch(0.268 0.028 58);
  --nav-soft: oklch(0.360 0.028 58);
  --nav-ink: oklch(0.985 0.005 80);
  --nav-muted: oklch(0.760 0.018 70);
  --radius: 14px;
  --radius-small: 10px;
  --shadow: 0 1px 2px oklch(0.32 0.03 60/.05), 0 6px 20px oklch(0.32 0.03 60/.07);
  --shadow-hover: 0 2px 4px oklch(0.32 0.03 60/.07), 0 12px 30px oklch(0.32 0.03 60/.12);
}

/* Operations directory profiles */
.directory-primary-link { color: var(--ink-strong); text-decoration: none; }
.directory-primary-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.directory-contact-preview { display: grid; gap: 4px; min-width: 0; }
.directory-contact-preview a { width: fit-content; max-width: 100%; overflow: hidden; color: var(--ink2); text-overflow: ellipsis; white-space: nowrap; }
.directory-contact-preview a:hover { color: var(--brand); }
.row-view-link { color: var(--brand); font-weight: 750; }
.profile-backline { margin: -8px 0 14px; }
.profile-backline a { color: var(--muted); font-size: 13px; font-weight: 700; }
.profile-backline a:hover { color: var(--brand); }
.directory-profile-hero { display: grid; grid-template-columns: 66px minmax(0, 1fr) auto; align-items: start; gap: 20px; margin-bottom: 20px; padding: clamp(20px, 2.4vw, 32px); border-top: 3px solid var(--brand); }
.profile-monogram { display: grid; place-items: center; width: 66px; height: 66px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); font: 800 22px/1 "Public Sans", sans-serif; letter-spacing: .03em; }
.profile-identity { min-width: 0; }
.profile-identity h1 { margin: 8px 0 6px; font-size: clamp(25px, 3vw, 38px); line-height: 1.06; overflow-wrap: anywhere; }
.profile-identity > p { margin: 0; color: var(--muted); }
.profile-identity > p a { color: var(--brand); font-weight: 700; }
.profile-labels { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.profile-contact-strip { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.profile-contact-strip > a { display: grid; gap: 2px; min-width: 150px; max-width: min(100%, 360px); padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); color: var(--ink-strong); }
.profile-contact-strip > a:hover { border-color: var(--brand); background: var(--brand-soft); }
.profile-contact-strip span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.profile-contact-strip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.profile-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.profile-actions form { margin: 0; }
.directory-profile-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .75fr); align-items: start; gap: 20px; }
.profile-main, .profile-aside { display: grid; gap: 20px; min-width: 0; }
.profile-aside { position: sticky; top: 88px; }
.profile-section { padding: clamp(18px, 2vw, 26px); }
.profile-section-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.profile-section-head .eyebrow { margin-bottom: 4px; }
.profile-section-head h2 { margin: 0; font-size: 19px; }
.profile-count { display: grid; place-items: center; min-width: 32px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; }
.profile-data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.profile-data-grid > div { min-width: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.profile-data-grid > div:nth-last-child(-n + 2) { border-bottom: 0; }
.profile-data-grid .profile-wide { grid-column: 1 / -1; }
.profile-data-grid dt { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; }
.profile-data-grid dd { margin: 0; overflow-wrap: anywhere; color: var(--ink-strong); font-weight: 650; }
.profile-data-grid dd small { display: block; margin-top: 4px; }
.profile-single-column { grid-template-columns: 1fr; }
.profile-single-column > div { border-bottom: 1px solid var(--line) !important; }
.profile-single-column > div:last-child { border-bottom: 0 !important; }
.profile-notes { font-weight: 500 !important; line-height: 1.55; }
.profile-subhead { margin: 18px 0 8px; color: var(--muted); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.profile-order-list { display: grid; }
.profile-order-list a { display: grid; grid-template-columns: minmax(90px, .45fr) minmax(180px, 1.6fr) auto; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink2); }
.profile-order-list a:hover { color: var(--brand); background: var(--brand-soft); }
.profile-order-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.profile-order-list b { text-align: right; white-space: nowrap; }
.profile-people-list { display: grid; gap: 8px; }
.profile-people-list > a { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px; border: 1px solid transparent; border-radius: 10px; color: var(--ink-strong); }
.profile-people-list > a:hover { border-color: var(--line); background: var(--panel-soft); }
.profile-people-list > a > span:last-child { display: grid; min-width: 0; }
.profile-people-list small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.profile-person-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 800; }
.profile-full-button { width: 100%; margin-top: 18px; }
.person-profile-layout { grid-template-columns: minmax(0, 1.45fr) minmax(280px, .7fr); }

@media (max-width: 980px) {
  .directory-profile-layout, .person-profile-layout { grid-template-columns: 1fr; }
  .profile-aside { position: static; }
}

@media (max-width: 680px) {
  .directory-profile-hero { grid-template-columns: 52px minmax(0, 1fr); gap: 13px; }
  .profile-monogram { width: 52px; height: 52px; border-radius: 14px; font-size: 17px; }
  .profile-actions { grid-column: 1 / -1; justify-content: stretch; }
  .profile-actions .button, .profile-actions form { flex: 1 1 150px; }
  .profile-actions form .button { width: 100%; }
  .profile-contact-strip { display: grid; grid-template-columns: 1fr; }
  .profile-contact-strip > a { max-width: 100%; }
  .profile-data-grid { grid-template-columns: 1fr; }
  .profile-data-grid .profile-wide { grid-column: auto; }
  .profile-data-grid > div { border-bottom: 1px solid var(--line) !important; }
  .profile-data-grid > div:last-child { border-bottom: 0 !important; }
  .profile-order-list a { grid-template-columns: 1fr auto; }
  .profile-order-list span { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
}

[data-theme="dark"] {
  --bg: oklch(0.192 0.014 62);
  --canvas: oklch(0.192 0.014 62);
  --panel: oklch(0.238 0.015 62);
  --panel-soft: oklch(0.282 0.016 62);
  --surface2: oklch(0.282 0.016 62);
  --line: oklch(0.330 0.016 62);
  --line-strong: oklch(0.398 0.018 62);
  --ink: oklch(0.930 0.010 76);
  --ink-strong: oklch(0.968 0.008 78);
  --ink2: oklch(0.862 0.012 74);
  --muted: oklch(0.718 0.014 70);
  --brand: oklch(0.720 0.135 55);
  --brand-dark: oklch(0.780 0.130 58);
  --brand-soft: oklch(0.322 0.055 48);
  --brand-ink: oklch(0.192 0.014 62);
  --signal: oklch(0.790 0.115 70);
  --signal-soft: oklch(0.322 0.050 70);
  --success: oklch(0.740 0.115 158);
  --success-soft: oklch(0.305 0.048 158);
  --pos: oklch(0.720 0.120 160);
  --neg: oklch(0.660 0.165 25);
  --danger: oklch(0.700 0.155 25);
  --danger-soft: oklch(0.322 0.052 25);
  --warning: oklch(0.790 0.115 78);
  --warning-soft: oklch(0.322 0.050 78);
  --nav: oklch(0.162 0.014 60);
  --nav-soft: oklch(0.288 0.016 60);
  --nav-ink: oklch(0.975 0.008 78);
  --nav-muted: oklch(0.695 0.014 70);
  --shadow: 0 1px 2px oklch(0 0 0/.32), 0 6px 20px oklch(0 0 0/.30);
  --shadow-hover: 0 2px 4px oklch(0 0 0/.34), 0 12px 30px oklch(0 0 0/.34);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-width: 320px; color-scheme: light; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% -5%, rgba(213, 151, 49, .10), transparent 28rem),
    var(--canvas);
  font: 15px/1.55 "Public Sans", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3 {
  color: var(--ink-strong);
  font-family: "Public Sans", "Arial Narrow", "Segoe UI", sans-serif;
  
  line-height: 1.12;
}
h1 { margin: .15rem 0 .4rem; font-size: clamp(2rem, 3vw, 2.8rem); letter-spacing: -.035em; }
h2 { margin: 0 0 1rem; font-size: 1.18rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; }
p { margin-top: 0; }
code { font-family: Consolas, "SFMono-Regular", monospace; font-size: .9em; }

.topbar {
  min-height: 76px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: clamp(22px, 3vw, 48px);
  padding: 0 max(24px, calc((100vw - 1440px) / 2));
  color: var(--panel);
  background: rgba(43, 32, 17, .98);
  box-shadow: 0 8px 30px rgba(28, 20, 8, .17);
}
.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: linear-gradient(90deg, var(--signal) 0 9%, transparent 9% 13%, var(--brand) 13% 67%, transparent 67%);
  opacity: .85;
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; color: var(--panel); }
.brand > span:last-child { display: grid; font-family: "Public Sans", "Arial Narrow", sans-serif; font-size: 1.08rem; line-height: 1; letter-spacing: .025em; }
.brand strong { color: var(--panel); }
.brand small { margin-top: 5px; color: var(--brand); font: 600 .58rem/1 "Segoe UI", sans-serif; letter-spacing: .16em; text-transform: uppercase; }
.brand-mark { position: relative; width: 34px; height: 26px; display: flex; align-items: center; justify-content: space-between; }
.brand-mark::before { content: ""; position: absolute; left: 5px; right: 5px; top: 12px; height: 2px; background: var(--brand); }
.brand-mark i { position: relative; z-index: 1; width: 8px; height: 8px; border: 2px solid var(--nav); border-radius: 50%; background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.brand-mark i:nth-child(2) { align-self: flex-start; margin-top: 1px; background: var(--signal); box-shadow: 0 0 0 1px var(--brand); }
.topbar nav { display: flex; align-items: stretch; align-self: stretch; gap: 4px; flex: 1; }
.topbar nav a { position: relative; display: flex; align-items: center; padding: 0 14px; color: var(--brand); font-weight: 650; font-size: .91rem; }
.topbar nav a::after { content: ""; position: absolute; right: 14px; bottom: 17px; left: 14px; height: 2px; border-radius: 2px; background: var(--signal); transform: scaleX(0); transition: transform .18s ease; }
.topbar nav a:hover, .topbar nav a.active { color: var(--panel); }
.topbar nav a.active::after { transform: scaleX(1); }
.user-menu { display: flex; align-items: center; gap: 14px; color: var(--brand-soft); }
.user-menu form { margin: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; }
.user-chip i { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--brand); border-radius: 50%; background: var(--nav-soft); color: var(--panel); font-style: normal; font-size: .75rem; }
.link-button { padding: 6px 0; border: 0; background: none; color: var(--brand); cursor: pointer; font: inherit; font-size: .86rem; }
.link-button:hover { color: var(--panel); }

.container { width: min(100%, 1440px); min-height: calc(100vh - 137px); margin: 0 auto; padding: 38px 26px 70px; }
.auth-container { min-height: 100vh; display: grid; place-items: center; padding: 30px 20px; }
.app-footer { display: flex; justify-content: space-between; gap: 20px; padding: 20px max(24px, calc((100vw - 1390px) / 2)); border-top: 1px solid var(--line); color: var(--muted); background: var(--brand-soft); font-size: .78rem; }
.app-footer span:first-child { color: var(--ink); font-weight: 750; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 0 0 26px; }
.page-head > div:first-child { min-width: 0; }
.page-head p:last-child { max-width: 820px; margin-bottom: 0; }
.eyebrow { margin: 0 0 7px; color: var(--signal); font: 750 .71rem/1 "Public Sans", "Segoe UI", sans-serif; letter-spacing: .14em; text-transform: uppercase; }
.muted, .hint, small { color: var(--muted); }
small { display: block; }
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); font-weight: 650; }
.back:hover { color: var(--brand); }
.actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.button {
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-small);
  color: var(--panel);
  background: var(--brand);
  box-shadow: 0 4px 12px rgba(213, 151, 49, .16);
  font: 700 .9rem/1 "Segoe UI", sans-serif;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); background: var(--brand-dark); border-color: var(--brand-dark); box-shadow: 0 7px 16px rgba(213, 151, 49, .22); }
.button.secondary { border-color: var(--brand-soft); color: var(--brand); background: var(--brand-soft); box-shadow: none; }
.button.secondary:hover { border-color: var(--brand); background: var(--brand-soft); }
.button.ghost { border-color: var(--line-strong); color: var(--ink); background: var(--panel); box-shadow: none; }
.button.ghost:hover { border-color: var(--brand); background: var(--panel-soft); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.full { width: 100%; }

.panel {
  min-width: 0;
  margin-bottom: 22px;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel hr { margin: 28px 0; border: 0; border-top: 1px solid var(--line); }
.narrow { width: min(700px, 100%); margin-right: auto; margin-left: auto; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }

.alert { position: relative; margin: 0 0 20px; padding: 13px 16px 13px 18px; border: 1px solid var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 10px; color: var(--brand); background: var(--brand-soft); }
.alert-error { border-color: var(--danger-soft); border-left-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.alert-success { border-color: var(--success); border-left-color: var(--success); color: var(--success); background: var(--success-soft); }
.alert-warning { border-color: var(--brand); border-left-color: var(--signal); color: var(--brand); background: var(--warning-soft); }
.inline-error { margin: 14px 0 0; padding: 11px 13px; border-radius: 8px; color: var(--danger); background: var(--danger-soft); font-size: .88rem; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 22px; }
.stats article { position: relative; overflow: hidden; min-height: 116px; padding: 20px 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.stats article::after { content: ""; position: absolute; right: 0; bottom: 0; width: 38px; height: 4px; background: var(--brand); }
.stats article:nth-child(3)::after { background: var(--success); }
.stats article:nth-child(4)::after { background: var(--signal); }
.stats span { display: block; margin-bottom: 10px; color: var(--muted); font-size: .79rem; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; }
.stats strong { color: var(--ink-strong); font: 700 2.15rem/1 "Public Sans", "Arial Narrow", sans-serif; }
.stats .small-strong { font-size: 1.22rem; }
.danger-stat strong { color: var(--danger); }
.compact article { min-height: 92px; padding: 17px 18px; }

/* Settlements — compact commission ledger within the existing warm operations theme. */
.settlement-strip { display: grid; grid-template-columns: 1.4fr .7fr 1fr; gap: 1px; margin: 0 0 20px; overflow: hidden; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); background: var(--line); box-shadow: var(--shadow); }
.settlement-strip > div { padding: 15px 18px; background: var(--surface); }
.settlement-strip span, .settlement-person-total span { display: block; color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.settlement-strip strong { display: block; margin-top: 5px; color: var(--ink-strong); }
.settlement-filters { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(160px, .55fr)) auto; gap: 12px; align-items: end; }
.settlement-filters label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.settlement-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin: 18px 0; }
.settlement-totals article { position: relative; overflow: hidden; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.settlement-totals article::after { content: ""; position: absolute; inset: auto 0 0; height: 4px; background: var(--brand); }
.settlement-totals span, .settlement-totals small { display: block; color: var(--muted); }
.settlement-totals strong { display: block; margin: 7px 0; color: var(--ink-strong); font-size: 1.5rem; }
.settlement-person-card { margin-bottom: 12px; padding: 15px 18px; }
.settlement-person-card header { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.settlement-person-card h2 { margin: 2px 0 0; font-size: 1.15rem; }
.settlement-person-total { text-align: right; }
.settlement-person-total strong { display: block; margin-top: 4px; color: var(--brand); font-size: 1.1rem; }
.settlement-percent { display: inline-grid; min-width: 58px; place-items: center; padding: 6px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.settlement-edit-form { display: grid; min-width: 250px; gap: 8px; }
.settlement-edit-form label { display: grid; grid-template-columns: minmax(92px, 1fr) 82px; align-items: center; gap: 8px; }
.settlement-edit-form label span { color: var(--muted); font-size: .69rem; font-weight: 750; }
.settlement-edit-form input { min-height: 34px; padding: 6px 8px; }
.settlement-edit-form > div { display: flex; flex-wrap: wrap; gap: 6px; }
.settlement-field { grid-column: 1 / -1; max-width: 420px; padding: 14px; border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 0 8px 8px 0; }

@media (max-width: 760px) {
  .settlement-strip, .settlement-filters { grid-template-columns: 1fr; }
  .settlement-person-card header { align-items: flex-start; flex-direction: column; }
  .settlement-person-total { text-align: left; }
  .settlement-ledger { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .settlement-ledger table, .settlement-ledger tbody, .settlement-ledger tr, .settlement-ledger td { display: block; min-width: 0; width: 100%; }
  .settlement-ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .settlement-ledger tr { margin-bottom: 12px; padding: 10px 14px; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
  .settlement-ledger td { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); text-align: right; }
  .settlement-ledger td:last-child { border-bottom: 0; }
  .settlement-ledger td::before { content: attr(data-label); color: var(--muted); font-size: .69rem; font-weight: 750; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
}

.status-list a, .list-row { display: flex; justify-content: space-between; gap: 20px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.status-list a:last-child, .list-row:last-child { border-bottom: 0; }
.status-list a:hover, .list-row:hover { color: var(--brand); }

.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; min-width: 850px; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
th { color: var(--muted); background: var(--brand-soft); font: 750 .69rem/1.25 "Segoe UI", sans-serif; letter-spacing: .065em; text-transform: uppercase; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--brand-soft); }
tbody tr:last-child td { border-bottom: 0; }
.company { color: var(--ink-strong); font-weight: 750; }
.company:hover { color: var(--brand); }
.badge, .status-pill { display: inline-flex; align-items: center; width: fit-content; padding: 4px 9px; border: 1px solid var(--brand-soft); border-radius: 99px; color: var(--brand); background: var(--brand-soft); font-size: .76rem; font-weight: 700; }
.status-pill { padding: 5px 10px; }
.status-completed { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.status-running, .status-queued { border-color: var(--brand-soft); color: var(--brand); background: var(--brand-soft); }
.status-failed { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.flag-yes { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.flag-no { border-color: var(--brand); color: var(--brand); background: var(--warning-soft); }
.empty-table { display: grid; justify-items: center; gap: 4px; padding: 28px; color: var(--muted); text-align: center; }
.empty-table strong { color: var(--ink); }

/* Etapy leadów: kolory odzwierciedlają drogę od nowego kontaktu do wyniku. */
.stage-nowy { --stage: #eb9a25; --stage-soft: #fff8ee; --stage-line: #ffe5bf; }
.stage-do-kontaktu { --stage: #edd23a; --stage-soft: #fffdf0; --stage-line: #fff6c9; }
.stage-skontaktowany { --stage: #9c4408; --stage-soft: #fcf1ea; --stage-line: #eeceb9; }
.stage-zainteresowany { --stage: #0f8a68; --stage-soft: #eaf8f3; --stage-line: #bce5d7; }
.stage-oferta-wyslana { --stage: #b86a08; --stage-soft: #fff6e7; --stage-line: #efd4a7; }
.stage-negocjacje { --stage: #d34f13; --stage-soft: #fff1e9; --stage-line: #f3c5ad; }
.stage-wygrany { --stage: #157347; --stage-soft: #eaf8f0; --stage-line: #b9dfca; }
.stage-przegrany { --stage: #b42318; --stage-soft: #fff0ef; --stage-line: #efc3bf; }
.stage-brak-odpowiedzi { --stage: #7e705f; --stage-soft: #f6f4f1; --stage-line: #ded7cf; }

.stage-legend {
  position: relative;
  display: flex;
  gap: 8px;
  margin: -5px 0 18px;
  padding: 10px 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.stage-legend::before { content: ""; position: absolute; right: 10px; bottom: 50%; left: 10px; height: 2px; background: #e9e2d8; }
.stage-chip {
  --stage: #8b7a64;
  --stage-soft: #f8f6f3;
  --stage-line: #e4ded7;
  position: relative;
  z-index: 1;
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--stage-line);
  border-radius: 8px;
  color: var(--brand);
  background: var(--stage-soft);
  font-size: .75rem;
  font-weight: 700;
}
.stage-chip i, .stage-badge i { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--stage); box-shadow: 0 0 0 3px #ffffff; }
.stage-chip strong { min-width: 22px; padding: 2px 6px; border-radius: 6px; color: #ffffff; background: var(--stage); text-align: center; font: 750 .68rem/1.3 "Public Sans", sans-serif; }
.stage-chip:hover, .stage-chip.active { color: var(--stage); border-color: var(--stage); box-shadow: 0 3px 10px color-mix(in srgb, var(--stage) 18%, transparent); }

.lead-table-wrap { overflow: hidden; }
.lead-table-wrap.table-wrap { overflow-x: auto; }
.lead-table { min-width: 1180px; }
.lead-table th { padding-top: 12px; padding-bottom: 12px; }
.lead-table td { padding-top: 16px; padding-bottom: 16px; vertical-align: middle; }
.lead-stage-row {
  --stage: #8b7a64;
  --stage-soft: #f8f6f4;
  --stage-line: #e4ded7;
  background: linear-gradient(90deg, var(--stage-soft) 0, rgba(255, 255, 255, .97) 58px, #ffffff 150px);
}
.lead-stage-row:hover { background: linear-gradient(90deg, var(--stage-soft) 0, #fffcf8 150px, #fffcf8 100%); }
.lead-stage-row td:first-child { border-left: 4px solid var(--stage); }
.check-cell { text-align: center; }
.lead-company-cell { min-width: 230px; }
.lead-company-line { display: flex; align-items: center; gap: 10px; }
.lead-company-line .company { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-edit-link { flex: 0 0 auto; padding: 3px 7px; border: 1px solid var(--brand); border-radius: 6px; color: var(--brand); background: rgba(255, 255, 255, .88); font-size: .67rem; font-weight: 750; letter-spacing: .025em; }
.row-edit-link:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.lead-domain { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-source { display: inline-flex; margin-top: 7px; padding: 2px 7px; border: 1px solid var(--brand-soft); border-radius: 5px; color: var(--muted); background: var(--panel); font-size: .65rem; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; }
.cell-primary { color: var(--ink-strong); font-weight: 650; }

.lead-status-cell { min-width: 220px; }
.row-status-form {
  --stage: #8b7a64;
  --stage-soft: #f8f6f3;
  --stage-line: #e4ded7;
  display: grid;
  grid-template-columns: minmax(126px, 1fr) auto;
  gap: 7px;
  align-items: center;
}
.row-status-form select { min-height: 35px; padding: 7px 28px 7px 10px; border-color: var(--stage-line); color: var(--stage); background-color: var(--stage-soft); font-size: .79rem; font-weight: 750; }
.row-status-form select:focus { border-color: var(--stage); box-shadow: 0 0 0 3px color-mix(in srgb, var(--stage) 15%, transparent); }
.row-save { min-height: 35px; padding: 7px 10px; border: 1px solid var(--stage); border-radius: 7px; color: #ffffff; background: var(--stage); cursor: pointer; font: 700 .72rem/1 "Segoe UI", sans-serif; }
.row-save:hover { filter: brightness(.91); }
.stage-badge { --stage: #8b7a64; --stage-soft: #f8f6f3; --stage-line: #e4ded7; display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid var(--stage-line); border-radius: 7px; color: var(--stage); background: var(--stage-soft); font-size: .77rem; font-weight: 750; }
.priority-label { margin-top: 6px; font-size: .68rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.priority-low { color: var(--muted); }
.priority-normal { color: var(--brand); }
.priority-high { color: var(--brand); }
.priority-urgent { color: var(--danger); }

.lead-contact-cell { min-width: 210px; max-width: 280px; }
.contact-email { display: block; overflow: hidden; color: var(--ink); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.contact-email:hover { color: var(--brand); }
.data-warning { display: inline-flex; margin-top: 6px; padding: 3px 6px; border: 1px solid var(--danger); border-radius: 5px; color: var(--danger); background: var(--danger-soft); font-size: .66rem; font-weight: 750; }
.score-cell { min-width: 110px; }
.score-cell div { display: flex; align-items: baseline; gap: 2px; }
.score-cell strong { color: var(--ink-strong); font: 750 1.02rem/1 "Public Sans", sans-serif; }
.score-cell span { color: var(--muted); font-size: .74rem; }
.score-cell meter { width: 82px; height: 7px; display: block; margin-top: 8px; border: 0; background: var(--brand-soft); }
.score-cell meter::-webkit-meter-bar { border: 0; border-radius: 9px; background: var(--brand-soft); }
.score-cell meter::-webkit-meter-optimum-value { border-radius: 9px; background: linear-gradient(90deg, var(--brand), var(--brand)); }
.score-cell meter::-moz-meter-bar { border-radius: 9px; background: linear-gradient(90deg, var(--brand), var(--brand)); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Nadpisania są na końcu komponentów, aby każdy element etapu używał tej samej barwy. */
.stage-chip.stage-nowy, .lead-stage-row.stage-nowy, .row-status-form.stage-nowy, .stage-badge.stage-nowy { --stage: #eb9a25; --stage-soft: #fff8ee; --stage-line: #ffe5bf; }
.stage-chip.stage-do-kontaktu, .lead-stage-row.stage-do-kontaktu, .row-status-form.stage-do-kontaktu, .stage-badge.stage-do-kontaktu { --stage: #edd23a; --stage-soft: #fffdf0; --stage-line: #fff6c9; }
.stage-chip.stage-skontaktowany, .lead-stage-row.stage-skontaktowany, .row-status-form.stage-skontaktowany, .stage-badge.stage-skontaktowany { --stage: #9c4408; --stage-soft: #fcf1ea; --stage-line: #eeceb9; }
.stage-chip.stage-zainteresowany, .lead-stage-row.stage-zainteresowany, .row-status-form.stage-zainteresowany, .stage-badge.stage-zainteresowany { --stage: #0f8a68; --stage-soft: #eaf8f3; --stage-line: #bce5d7; }
.stage-chip.stage-oferta-wyslana, .lead-stage-row.stage-oferta-wyslana, .row-status-form.stage-oferta-wyslana, .stage-badge.stage-oferta-wyslana { --stage: #b86a08; --stage-soft: #fff6e7; --stage-line: #efd4a7; }
.stage-chip.stage-negocjacje, .lead-stage-row.stage-negocjacje, .row-status-form.stage-negocjacje, .stage-badge.stage-negocjacje { --stage: #d34f13; --stage-soft: #fff1e9; --stage-line: #f3c5ad; }
.stage-chip.stage-wygrany, .lead-stage-row.stage-wygrany, .row-status-form.stage-wygrany, .stage-badge.stage-wygrany { --stage: #157347; --stage-soft: #eaf8f0; --stage-line: #b9dfca; }
.stage-chip.stage-przegrany, .lead-stage-row.stage-przegrany, .row-status-form.stage-przegrany, .stage-badge.stage-przegrany { --stage: #b42318; --stage-soft: #fff0ef; --stage-line: #efc3bf; }
.stage-chip.stage-brak-odpowiedzi, .lead-stage-row.stage-brak-odpowiedzi, .row-status-form.stage-brak-odpowiedzi, .stage-badge.stage-brak-odpowiedzi { --stage: #7e705f; --stage-soft: #f6f4f1; --stage-line: #ded7cf; }

form p { margin: 0 0 17px; }
label { display: inline-block; margin-bottom: 6px; color: var(--brand); font-size: .86rem; font-weight: 700; }
input, select, textarea {
  width: 100%;
  display: block;
  padding: 10px 11px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--panel);
  font: inherit;
  transition: border-color .14s ease, box-shadow .14s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--brand); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(213, 151, 49, .13); }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; display: inline-block; flex: 0 0 17px; padding: 0; accent-color: var(--brand); }
input[type="file"] { padding: 8px; background: var(--panel-soft); }
textarea { min-height: 110px; resize: vertical; }
.errorlist { margin: 6px 0; padding-left: 20px; color: var(--danger); font-size: .86rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.form-grid p:has(textarea), .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.lead-form-head { align-items: flex-start; }
.lead-editor { max-width: 1080px; display: grid; gap: 18px; margin: 0 auto; }
.lead-form-section { padding: 0; overflow: hidden; }
.lead-form-section-head { display: flex; align-items: flex-start; gap: 14px; padding: 19px 22px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(100deg, var(--brand-soft), var(--panel)); }
.lead-form-section-head .section-mark { min-width: 28px; padding-top: 3px; color: var(--signal); font: 800 .72rem/1 "Public Sans", sans-serif; letter-spacing: .08em; }
.lead-form-section-head h2 { margin: 0 0 4px; font-size: 1rem; }
.lead-form-section-head p { margin: 0; color: var(--muted); font-size: .82rem; }
.lead-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 22px; padding: 22px; }
.lead-form-fields > p { margin: 0; }
.lead-form-fields .field-wide { grid-column: 1 / -1; }
.contact-section { border-color: var(--brand-soft); box-shadow: 0 5px 18px rgba(213, 151, 49, .07); }
.contact-section .lead-form-section-head { background: linear-gradient(100deg, var(--brand-soft), var(--panel)); }
.form-check-card { display: flex; align-items: flex-start; gap: 11px; padding: 14px; border: 1px solid var(--brand); border-radius: 9px; background: var(--brand-soft); }
.form-check-card input { margin-top: 2px; }
.form-check-card label { margin: 0; cursor: pointer; }
.form-check-card label strong, .form-check-card label span { display: block; }
.form-check-card label span { margin-top: 3px; color: var(--muted); font-size: .79rem; font-weight: 500; }
.form-alert { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.lead-form-actions { position: sticky; bottom: 12px; z-index: 4; display: flex; justify-content: flex-end; gap: 10px; padding: 13px; border: 1px solid var(--brand-soft); border-radius: 12px; background: rgba(255, 255, 255, .94); box-shadow: 0 8px 24px rgba(65, 48, 25, .12); backdrop-filter: blur(10px); }
.filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.filters label { min-width: 140px; flex: 1; }
.filters label:first-child { min-width: 230px; flex: 2; }
.filters input, .filters select { margin-top: 5px; }
.bulk { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-bottom: 12px; }
.bulk label { display: flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; }
.bulk select { width: 220px; }
.check-col { width: 40px; }
.check-field { display: flex; align-items: flex-start; gap: 9px; padding-top: 29px; }
.check-field label { margin: -1px 0 0; }
.hint { font-size: .82rem; }

.choice-box { max-height: 260px; overflow: auto; margin: 8px 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); }
.choice-box ul, .source-options ul { margin: 0; padding: 0; list-style: none; columns: 2; }
.country-box ul { columns: 3; }
.choice-box li, .source-options li { margin: 0 0 7px; break-inside: avoid; }
.choice-box label, .source-options label { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-weight: 500; }
.source-options { margin: 8px 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); }
.source-options ul { columns: 2; }
.source-note { margin-top: 0; }
.compact-fields { align-items: end; }
.search-builder .panel { margin-bottom: 18px; }
.search-criteria { align-items: start; }
.search-step { position: relative; overflow: hidden; }
.search-step::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(var(--brand), var(--brand)); }
.step-heading { display: flex; gap: 13px; align-items: flex-start; margin: -2px 0 22px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.step-heading > span { min-width: 35px; padding-top: 2px; color: var(--signal); font: 800 .78rem/1 "Public Sans", sans-serif; letter-spacing: .08em; }
.step-heading h2 { margin: 0 0 4px; }
.step-heading p { margin: 0; color: var(--muted); font-size: .85rem; }
.search-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 5px 0 10px; }
.search-safety { max-width: 900px; margin-left: auto; text-align: right; }
.query-preview ol { max-height: 360px; overflow: auto; padding-left: 28px; }
.query-preview li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.query-preview code { white-space: normal; overflow-wrap: anywhere; }
.api-status { display: flex; gap: 8px; flex-wrap: wrap; margin: -8px 0 20px; }
.api-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 16px; }
.api-panel-head p { margin: 5px 0 0; }
.api-key-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.api-key-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); }
.api-key-card h3 { margin: 0 0 10px; }
.api-key-card .api-clear { padding-top: 0; margin-bottom: 12px; }
.api-key-actions, .settings-save { display: flex; justify-content: flex-end; margin-top: 20px; }
.result-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.result-toolbar .filters { flex: 1; }
.result-toolbar .inline-filter { min-width: auto; flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding-bottom: 10px; }
.result-toolbar .inline-filter input { width: auto; margin: 0; }
.export-actions { margin-left: auto; }
.discovery-results-table table { min-width: 1100px; }
.discovery-results-table td { max-width: 420px; overflow-wrap: anywhere; }
.discovery-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.import-next-step { margin-top: 20px; }

.history-stack { display: grid; gap: 17px; }
.search-history-card { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: var(--shadow); transition: transform .16s ease, box-shadow .16s ease; }
.search-history-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.history-card-head { display: flex; justify-content: space-between; gap: 25px; padding: 21px 22px 16px; }
.history-title { min-width: 0; }
.history-title h2 { margin: 8px 0 5px; font-size: 1.13rem; overflow-wrap: anywhere; }
.history-title p { margin: 0; color: var(--muted); font-size: .85rem; }
.history-meta { display: flex; gap: 8px 14px; flex-wrap: wrap; color: var(--muted); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .045em; }
.history-meta span { position: relative; }
.history-meta span::before { content: ""; position: absolute; left: -8px; top: .45em; width: 3px; height: 3px; border-radius: 50%; background: var(--signal); }
.history-status { flex: 0 0 auto; display: grid; justify-items: end; align-content: space-between; gap: 12px; }
.history-status > strong { color: var(--ink-strong); font: 750 1.7rem/1 "Public Sans", sans-serif; }
.history-status > strong small { display: inline; color: var(--muted); font: 600 .71rem/1 "Segoe UI", sans-serif; text-transform: uppercase; letter-spacing: .05em; }
.progress-track { height: 4px; background: var(--brand-soft); }
.progress-track span { height: 100%; display: block; background: linear-gradient(90deg, var(--brand), var(--brand)); transition: width .35s ease; }
.history-metrics { display: flex; gap: 8px 24px; flex-wrap: wrap; padding: 11px 22px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--brand-soft); font-size: .78rem; }
.history-metrics strong { color: var(--ink); }
.history-preview { padding: 7px 22px; }
.preview-lead { display: grid; grid-template-columns: minmax(220px, 1.3fr) minmax(100px, .55fr) minmax(190px, 1fr) 72px; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .84rem; }
.preview-lead:last-child { border-bottom: 0; }
.preview-lead:hover { color: var(--brand); }
.preview-lead b { justify-self: end; color: var(--ink-strong); font-family: "Public Sans", sans-serif; }
.preview-company { min-width: 0; }
.preview-company strong { display: block; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.preview-company small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--brand-soft); }
.empty-inline { margin: 0; padding: 18px 22px; color: var(--muted); }
.empty-state { display: grid; justify-items: center; padding: 60px 24px; text-align: center; }
.empty-state > span { display: grid; width: 55px; height: 55px; place-items: center; margin-bottom: 14px; border: 1px solid var(--brand-soft); border-radius: 50%; color: var(--brand); background: var(--brand-soft); font-size: 1.7rem; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { max-width: 470px; color: var(--muted); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 24px; margin: 24px; }
.pagination a { font-weight: 700; }
dl { display: grid; grid-template-columns: 145px 1fr; gap: 11px; }
dt { color: var(--muted); font-weight: 650; }
dd { margin: 0; }
blockquote { margin: 0; padding: 14px 17px; border-left: 4px solid var(--brand); border-radius: 0 9px 9px 0; background: var(--brand-soft); }
.notes { margin-top: 18px; }
.contact-card { display: flex; flex-direction: column; padding: 12px 0; border-bottom: 1px solid var(--line); }
details { margin-top: 15px; }
summary { color: var(--brand); font-weight: 700; cursor: pointer; }
details form { margin-top: 15px; padding: 15px; border-radius: 9px; background: var(--panel-soft); }
.timeline article { margin-top: 15px; padding: 0 0 17px 15px; border-left: 3px solid var(--brand-soft); }
.timeline span { display: block; color: var(--muted); font-size: .82rem; }
.qr { width: 240px; height: 240px; image-rendering: pixelated; }
.code-list { padding: 18px; list-style: none; columns: 2; background: var(--panel-soft); }
.code-list code { font-size: 1rem; }

.auth-card { position: relative; overflow: hidden; width: min(440px, 100%); padding: 40px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 25px 65px rgba(68, 50, 24, .15); }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--signal) 0 18%, var(--brand) 18% 78%, var(--nav) 78%); }
.auth-card h1 { font-size: 2.3rem; }

@media (max-width: 1040px) {
  .topbar { gap: 20px; padding: 0 20px; }
  .topbar nav a { padding: 0 9px; }
  .topbar nav a::after { right: 9px; left: 9px; }
  .country-box ul { columns: 2; }
  .preview-lead { grid-template-columns: minmax(190px, 1.2fr) 90px 1fr 65px; }
}

@media (max-width: 850px) {
  .topbar { position: relative; min-height: auto; flex-wrap: wrap; padding: 14px 18px 0; }
  .topbar nav { order: 3; width: calc(100% + 36px); height: 48px; margin: 0 -18px; padding: 0 11px; overflow-x: auto; background: var(--brand); }
  .topbar nav a { flex: 0 0 auto; }
  .topbar nav a::after { bottom: 8px; }
  .user-menu { margin-left: auto; }
  .user-chip { font-size: 0; }
  .user-chip i { font-size: .75rem; }
  .container { padding: 28px 16px 55px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two, .form-grid, .api-key-grid { grid-template-columns: 1fr; }
  .lead-form-fields { grid-template-columns: 1fr; }
  .lead-form-fields .field-wide { grid-column: auto; }
  .page-head { align-items: flex-start; flex-wrap: wrap; }
  .form-grid p:has(textarea), .form-actions { grid-column: auto; }
  .preview-lead { grid-template-columns: 1fr auto; }
  .preview-lead > span:nth-child(2), .preview-lead > span:nth-child(3) { display: none; }
  .app-footer { flex-direction: column; gap: 4px; }
}

@media (max-width: 650px) {
  h1 { font-size: 2rem; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .actions, .page-head > .button { width: 100%; }
  .page-head .actions .button, .page-head > .button { flex: 1; }
  .choice-box ul, .country-box ul, .source-options ul { columns: 1; }
  .search-actions { flex-direction: column-reverse; }
  .search-actions .button { width: 100%; }
  .search-safety { text-align: left; }
  .result-toolbar { align-items: stretch; }
  .result-toolbar .filters { display: grid; grid-template-columns: 1fr; }
  .result-toolbar .filters label { min-width: 0; }
  .export-actions { width: 100%; margin: 0; }
  .export-actions .button { flex: 1; }
  .history-card-head { align-items: flex-start; padding: 18px; }
  .history-status > strong { font-size: 1.25rem; }
  .history-status > strong small { display: block; margin-top: 3px; }
  .history-metrics { gap: 6px 14px; padding: 10px 18px; }
  .history-preview { padding: 5px 18px; }
  .history-actions { display: grid; grid-template-columns: 1fr 1fr; padding: 13px 18px; }
  .history-actions .button:first-child { grid-column: 1 / -1; }
  .bulk { align-items: stretch; flex-direction: column; }
  .bulk label { align-items: stretch; flex-direction: column; }
  .bulk .button { width: 100%; }
  dl { grid-template-columns: 1fr; gap: 3px; }
  dd { margin-bottom: 10px; }
}

@media (max-width: 460px) {
  .stats, .discovery-stats { grid-template-columns: 1fr; }
  .stats article { min-height: 94px; }
  .brand small, .link-button { display: none; }
  .panel { padding: 18px; }
  .lead-form-section { padding: 0; }
  .lead-form-section-head, .lead-form-fields { padding: 17px; }
  .lead-form-actions { position: static; display: grid; grid-template-columns: 1fr; }
  .history-card-head { display: grid; }
  .history-status { justify-items: start; grid-template-columns: auto 1fr; align-items: center; }
  .history-status > strong { justify-self: end; }
  .auth-card { padding: 30px 23px; }
  .code-list { columns: 1; }
}

/* Transport — operacyjny język TIBa TSL z linią trasy jako motywem przewodnim. */
.compact-head { align-items: center; }
.transport-editor, .wizard-head { width: min(100%, 1120px); margin-right: auto; margin-left: auto; }
.wizard-head { display: flex; align-items: center; justify-content: space-between; gap: 32px; margin-bottom: 24px; }
.wizard-head h1 { margin-bottom: 0; }
.order-stepper { display: flex; align-items: center; gap: 12px; }
.order-stepper a { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .84rem; font-weight: 750; }
.order-stepper b { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--brand); border-radius: 50%; color: var(--muted); background: var(--panel); }
.order-stepper a.current { color: var(--brand); }
.order-stepper a.current b { border-color: var(--brand); color: var(--panel); background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.order-stepper a.done { color: var(--success); }
.order-stepper a.done b { border-color: var(--success); color: var(--panel); background: var(--success); }
.order-stepper i { width: 34px; border-top: 2px dotted var(--brand); }

.form-section { margin-bottom: 18px; padding: clamp(22px, 3vw, 34px); }
.section-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-heading > span { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 9px; color: var(--signal); background: var(--signal-soft); font: 750 .76rem/1 "Public Sans", sans-serif; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading p { margin-top: 4px; color: var(--muted); font-size: .82rem; }
.transport-grid { gap: 0 24px; }
.transport-grid > p, .transport-grid > div, .transport-grid > fieldset { margin: 0 0 18px; }
.span-2 { grid-column: 1 / -1; }
.role-fieldset { margin: 0 0 22px; padding: 0; border: 0; }
.role-fieldset legend { margin-bottom: 8px; color: var(--brand); font-size: .86rem; font-weight: 750; }
.role-fieldset > div { display: flex; flex-wrap: wrap; gap: 10px; }
.role-fieldset > div > div label { display: flex; min-height: 42px; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); cursor: pointer; }
.role-fieldset > div > div:has(input:checked) label { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(213, 151, 49, .08); }
.input-action { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.input-action .button { white-space: nowrap; }
.vies-status { display: block; margin-top: 6px; }
.vies-status.is-loading { color: var(--brand); }
.vies-status.is-valid, .vies-ok { color: var(--success); }
.vies-status.is-invalid, .vies-status.is-error { color: var(--danger); }
.check-group { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.check-group h3 { width: 100%; margin: 0 0 2px; }
.check-group label { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 600; }
.people-editor { margin-top: 10px; border-top: 1px solid var(--line); }
.people-editor summary { padding: 20px 0 8px; color: var(--ink-strong); cursor: pointer; font-weight: 750; }
.people-editor summary span { display: inline-grid; min-width: 24px; height: 24px; place-items: center; margin-left: 7px; border-radius: 12px; color: var(--brand); background: var(--brand-soft); font-size: .75rem; }
.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; padding-top: 12px; }
.person-card { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); }
.person-card p { margin-bottom: 12px; }
.field-with-add { position: relative; }
.field-with-add > a { position: absolute; top: 28px; right: 7px; display: grid; width: 30px; height: 30px; place-items: center; border-radius: 7px; color: var(--panel); background: var(--brand); font-size: 1.2rem; font-weight: 700; }
.field-with-add select { padding-right: 48px; }
.money-field > div { display: grid; grid-template-columns: 1fr 95px; }
.money-field > div input { border-radius: 8px 0 0 8px; }
.money-field > div select { border-left: 0; border-radius: 0 8px 8px 0; }
.coordinate-fields > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.wizard-actions { display: flex; justify-content: space-between; gap: 14px; padding: 18px 0; }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; margin-top: 10px; padding: 16px; border: 1px solid rgba(223, 214, 201, .9); border-radius: 12px; background: rgba(250, 248, 244, .94); box-shadow: 0 -8px 25px rgba(51, 39, 23, .06); backdrop-filter: blur(10px); }

.transport-filter-panel { margin-bottom: 16px; padding: 16px; }
.transport-filters { display: grid; grid-template-columns: minmax(240px,1fr) auto auto; gap: 12px; align-items: center; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.segmented a { padding: 7px 11px; border-radius: 6px; color: var(--muted); font-size: .79rem; font-weight: 700; white-space: nowrap; }
.segmented a.active { color: var(--brand); background: var(--panel); box-shadow: 0 2px 8px rgba(67, 50, 25, .08); }
.transport-table-wrap { overflow-x: auto; }
.transport-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.transport-table th, .transport-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.transport-table th { color: var(--muted); background: var(--panel-soft); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.transport-table tbody tr:hover { background: var(--brand-soft); }
.transport-table td small { display: block; margin-top: 4px; }
.partner-role, .order-status { display: inline-flex; padding: 4px 8px; border: 1px solid; border-radius: 7px; font-size: .72rem; font-weight: 750; }
.role-client { border-color: var(--brand-soft); color: var(--brand); background: var(--brand-soft); }
.role-carrier { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.role-both { border-color: var(--brand-soft); color: var(--warning); background: var(--warning-soft); }
.order-status { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.status-processing, .status-planned { border-color: var(--brand-soft); color: var(--brand); background: var(--brand-soft); }
.status-in_transit { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.status-completed { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.status-cancelled { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.route-count { display: inline-flex; color: var(--brand); font-weight: 750; }
.empty-state { padding: 40px !important; color: var(--muted); text-align: center !important; }

.route-builder, .assignment-builder { padding: clamp(20px,3vw,34px); }
.route-builder-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 26px; }
.route-builder-head h2, .route-builder-head p { margin: 0; }
.route-rail { position: relative; display: grid; gap: 12px; }
.route-rail::before { content: ""; position: absolute; top: 25px; bottom: 25px; left: 22px; width: 3px; border-radius: 3px; background: linear-gradient(var(--signal), var(--brand)); opacity: .38; }
.route-point { position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.route-point[open] { border-color: var(--brand); box-shadow: 0 8px 28px rgba(213, 151, 49, .08); }
.route-point summary { position: relative; z-index: 1; display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; min-height: 74px; padding: 12px 16px 12px 0; cursor: pointer; list-style: none; }
.route-point summary::-webkit-details-marker { display: none; }
.route-point summary b { display: grid; width: 32px; height: 32px; justify-self: center; place-items: center; border: 3px solid var(--panel); border-radius: 50%; color: var(--panel); background: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.route-point summary span { display: grid; }
.route-point summary small { margin-top: 3px; }
.route-summary-actions { display: flex; align-items: center; gap: 9px; }
.route-point summary em { color: var(--brand); font-style: normal; font-size: .78rem; font-weight: 750; }
.route-summary-actions button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--danger); font: inherit; font-size: .72rem; font-weight: 750; cursor: pointer; }
.route-summary-actions button:hover { border-color: var(--danger); background: var(--danger-soft); }
.route-point.is-removed { border-style: dashed; opacity: .68; }
.route-point.is-removed summary b { background: var(--muted); box-shadow: 0 0 0 2px var(--muted); }
.route-point-body { padding: 22px 24px 8px 58px; border-top: 1px solid var(--line); background: var(--brand-soft); }
.route-map-card { position: relative; min-height: 230px; display: grid; place-items: center; margin-top: 24px; overflow: hidden; border: 1px solid var(--brand); border-radius: 13px; background: var(--success-soft); }
.map-grid { position: absolute; inset: 0; opacity: .45; background-image: linear-gradient(var(--success) 1px, transparent 1px), linear-gradient(90deg,var(--success) 1px,transparent 1px); background-size: 32px 32px; transform: rotate(-7deg) scale(1.2); }
.route-map-card::after { content: ""; position: absolute; width: 58%; height: 38%; border: 5px solid var(--brand); border-color: transparent transparent var(--brand) var(--brand); border-radius: 50%; transform: rotate(-8deg); opacity: .65; }
.route-map-copy { position: relative; z-index: 1; display: grid; max-width: 470px; gap: 5px; padding: 20px 24px; border: 1px solid rgba(255, 255, 255, .9); border-radius: 12px; background: rgba(255, 255, 255, .88); box-shadow: var(--shadow); text-align: center; backdrop-filter: blur(8px); }
.route-map-copy span { color: var(--signal); font: 750 .68rem/1 "Public Sans",sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.route-options { display: grid; grid-template-columns: minmax(280px,.8fr) minmax(360px,1.2fr); gap: 18px; align-items: end; margin-top: 18px; }
.route-options .input-action { align-items: end; }
.route-options .check-group { min-height: 70px; align-items: center; }
.assignment-card { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); overflow: hidden; }
.assignment-title { display: flex; align-items: center; gap: 10px; padding: 16px 20px; color: var(--ink-strong); background: var(--panel-soft); }
.assignment-title span { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; color: var(--panel); background: var(--brand); font-size: .76rem; }
.assignment-title label { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; color: var(--danger); font-size: .75rem; }
.assignment-card > section, .assignment-card > .transport-grid { padding: 22px 24px 6px; border-top: 1px solid var(--line); }
.assignment-card section h3 { margin: 0 0 18px; color: var(--signal); font-size: .84rem; letter-spacing: .04em; text-transform: uppercase; }
.carrier-picker { position: relative; display: grid; grid-template-columns: minmax(180px,.7fr) minmax(260px,1.3fr) auto; gap: 8px; align-items: end; }
.carrier-picker label { grid-column: 1 / -1; }
.carrier-picker a, .carrier-add-inline { padding: 10px 4px; border: 0; background: transparent; color: var(--brand); font: inherit; font-size: .8rem; font-weight: 750; white-space: nowrap; cursor: pointer; }
.carrier-add-inline:hover { color: var(--brand-dark); text-decoration: underline; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 8px 20px; padding-top: 12px; padding-bottom: 12px; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .topbar nav a { min-height: 42px; padding: 0 10px; white-space: nowrap; }
  .wizard-head { align-items: flex-start; flex-direction: column; }
  .transport-filters { grid-template-columns: 1fr auto; }
  .segmented { grid-column: 1 / -1; overflow-x: auto; }
  .sticky-actions { bottom: calc(70px + env(safe-area-inset-bottom)); }
}

@media (max-width: 700px) {
  .transport-grid, .people-grid { grid-template-columns: 1fr; }
  .transport-grid .span-2 { grid-column: auto; }
  .order-stepper { width: 100%; justify-content: space-between; }
  .order-stepper i { flex: 1; min-width: 12px; }
  .order-stepper span { display: none; }
  .route-builder-head { align-items: stretch; flex-direction: column; }
  .route-point summary { grid-template-columns: 46px 1fr; }
  .route-summary-actions { grid-column: 2; justify-content: flex-end; }
  .route-point summary em { display: none; }
  .route-point-body { padding-left: 18px; }
  .carrier-picker { grid-template-columns: 1fr; }
  .route-options { grid-template-columns: 1fr; }
  .carrier-picker label { grid-column: auto; }
  .transport-filters { grid-template-columns: 1fr; }
  .segmented { grid-column: auto; }
}

@media (max-width: 460px) {
  .input-action, .money-field > div { grid-template-columns: 1fr; }
  .input-action .button { width: 100%; }
  .money-field > div input, .money-field > div select { border: 1px solid var(--brand); border-radius: 8px; }
  .sticky-actions { position: static; flex-direction: column-reverse; }
  .sticky-actions .button { width: 100%; }
  .form-section, .route-builder, .assignment-builder { padding: 18px 15px; }
  .route-point summary { padding-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

:focus-visible { outline: 3px solid rgba(239, 141, 50, .55); outline-offset: 2px; }

/* Centrum ofert e-mail: spokojny pulpit operacyjny, nie kreator marketingowy. */
.outreach-head { margin-bottom: 18px; }
.mailbox-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid var(--brand);
  border-radius: 11px;
  background: var(--brand-soft);
}
.mailbox-strip.connected { border-color: var(--success); background: var(--success-soft); }
.mailbox-strip > div { min-width: 0; flex: 1; }
.mailbox-strip strong, .mailbox-strip small { display: block; }
.mailbox-strip small { margin-top: 2px; color: var(--muted); }
.mailbox-strip a { font-size: .82rem; font-weight: 750; }
.mailbox-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.mailbox-strip.connected .mailbox-dot { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.outreach-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: -2px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.section-head > div { display: flex; align-items: center; gap: 10px; }
.section-head h2 { margin: 0; font-size: 1.12rem; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
.step-number { color: var(--signal); font: 800 .72rem/1 "Public Sans", sans-serif; letter-spacing: .08em; }
.private-library-badge { padding: 4px 8px; border: 1px solid var(--brand-soft); border-radius: 6px; color: var(--brand); background: var(--brand-soft); font-size: .68rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.template-library-bar { display: grid; grid-template-columns: minmax(190px, 1.2fr) minmax(170px, 1fr) auto auto; align-items: end; gap: 10px; margin-bottom: 7px; padding: 13px; border: 1px solid var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 9px; background: linear-gradient(105deg, var(--brand-soft), var(--brand-soft)); }
.message-editor .template-library-bar label { margin: 0; }
.template-library-bar label > span:first-child { display: block; margin-bottom: 5px; color: var(--brand); font-size: .68rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.template-library-bar input, .template-library-bar select { min-height: 37px; padding: 7px 9px; font-size: .78rem; }
.template-default { display: flex !important; align-items: center; gap: 7px; min-height: 37px; padding: 0 4px; white-space: nowrap; }
.template-default input { min-height: auto; }
.template-default span { margin: 0 !important; color: var(--brand) !important; font-size: .74rem !important; letter-spacing: 0 !important; text-transform: none !important; }
.template-buttons { display: flex; gap: 7px; }
.button.subtle-danger { border-color: var(--danger); color: var(--danger); background: var(--panel); }
.button.subtle-danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.button.subtle-danger:disabled { opacity: .42; cursor: not-allowed; }
.template-library-note { margin: 0 0 18px; color: var(--muted); font-size: .72rem; }
.message-editor label { margin-top: 9px; }
.message-editor textarea { min-height: 390px; line-height: 1.62; }
.format-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 0 0 18px; padding: 0; border: 0; }
.format-switch legend { margin-bottom: 7px; color: var(--brand); font-size: .78rem; font-weight: 750; }
.format-switch label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 11px 12px; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand-soft); cursor: pointer; }
.format-switch label:has(input:checked) { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.format-switch span { min-width: 0; }
.format-switch strong, .format-switch small { display: block; }
.format-switch strong { font-size: .79rem; }
.format-switch small { margin-top: 2px; color: var(--muted); font-size: .67rem; font-weight: 500; }
.html-code-editor { color: var(--brand-soft); border-color: var(--brand); background: var(--brand); font: 500 .79rem/1.6 Consolas, "Courier New", monospace; tab-size: 2; }
.html-code-editor:hover, .html-code-editor:focus { border-color: var(--brand); background: var(--brand); }
.button.compact { padding: 8px 11px; font-size: .76rem; }
.token-guide { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: .78rem; }
.token-guide code { padding: 3px 6px; border: 1px solid var(--brand); border-radius: 5px; color: var(--brand); background: var(--brand-soft); font-size: .72rem; }
.dispatch-summary { position: sticky; top: 86px; border-top: 4px solid var(--signal); }
.send-counter { display: flex; align-items: baseline; gap: 8px; padding: 4px 0 17px; border-bottom: 1px solid var(--line); }
.send-counter strong { color: var(--ink-strong); font: 800 2.25rem/1 "Public Sans", sans-serif; }
.send-counter span { color: var(--muted); font-size: .8rem; }
.dispatch-facts { grid-template-columns: 76px 1fr; gap: 8px 12px; margin: 16px 0; font-size: .78rem; }
.delay-control { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin: 15px 0 4px; padding: 12px; border: 1px solid var(--brand-soft); border-radius: 8px; background: var(--brand-soft); font-size: .76rem; }
.delay-input { display: flex; align-items: center; gap: 6px; }
.delay-input input { width: 72px; min-height: 34px; padding: 6px 8px; text-align: right; }
.delay-input b { color: var(--muted); font-size: .7rem; }
.delay-hint { margin: 0 0 12px; font-size: .68rem; }
.legal-confirmation { display: flex; gap: 9px; margin: 18px 0; padding: 12px; border: 1px solid var(--brand-soft); border-radius: 8px; background: var(--brand-soft); font-size: .75rem; font-weight: 600; line-height: 1.45; }
.legal-confirmation input { margin-top: 2px; }
.send-primary { width: 100%; min-height: 46px; background: var(--brand); }
.send-primary:disabled { opacity: .48; cursor: not-allowed; }
.send-note { margin: 10px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; text-align: center; }
.recipient-panel { grid-column: 1 / -1; margin-top: 18px; padding: 0; overflow: hidden; }
.recipient-heading { margin: 0; padding: 18px 20px; }
.recipient-heading > div { align-items: flex-start; }
.recipient-heading > div > div { display: block; }
.recipient-tools { display: grid !important; grid-template-columns: minmax(190px, 1fr) 190px auto; align-items: center !important; gap: 9px !important; }
.recipient-tools input, .recipient-tools select { min-height: 36px; padding: 7px 9px; font-size: .78rem; }
.select-all { display: flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; }
.recipient-table-wrap { overflow-x: auto; }
.recipient-table { min-width: 900px; }
.recipient-table th:first-child, .recipient-table td:first-child { width: 48px; text-align: center; }
.recipient-table td { vertical-align: middle; }
.recipient-table small { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipient-email { color: var(--ink); font-size: .86rem; }
.never-sent { color: var(--muted); font-size: .76rem; }
.offer-sent-badge { display: inline-flex; margin-top: 7px; padding: 3px 7px; border: 1px solid var(--success); border-radius: 5px; color: var(--success); background: var(--success-soft); font-size: .67rem; font-weight: 750; white-space: nowrap; }
.mail-button { margin-right: auto; background: var(--brand); }
.connection-pill, .campaign-status, .delivery-status { display: inline-flex; padding: 5px 8px; border: 1px solid var(--brand); border-radius: 7px; color: var(--brand); background: var(--brand-soft); font-size: .72rem; font-weight: 750; }
.connection-pill.ok, .status-completed, .delivery-sent { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.status-failed, .delivery-failed { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.status-partial, .delivery-skipped { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.status-sending, .status-queued, .delivery-queued { border-color: var(--brand-soft); color: var(--brand); background: var(--brand-soft); }
.delivery-sending { border-color: var(--brand-soft); color: var(--brand); background: var(--brand-soft); }
.mailbox-settings-grid { align-items: start; }
.mailbox-form .check-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.mailbox-form .check-row label { margin: 0; }
.mailbox-form .check-row input { grid-column: 2; grid-row: 1; }
.mailbox-form .check-row .hint { grid-column: 1 / -1; }
.connection-test { display: flex; align-items: center; gap: 10px; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.connection-test small { color: var(--muted); }
.setup-guide ol { margin: 20px 0; padding-left: 24px; }
.setup-guide li { margin-bottom: 12px; padding-left: 5px; line-height: 1.5; }
.security-callout { padding: 15px; border-left: 4px solid var(--signal); border-radius: 0 8px 8px 0; background: var(--brand-soft); }
.security-callout p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
.campaign-card .history-status { min-width: 180px; }
.campaign-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.textual-stat { font-size: 1.25rem !important; }
.delivery-error { max-width: 380px; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }

@media (max-width: 980px) {
  .outreach-layout { grid-template-columns: 1fr; }
  .dispatch-summary { position: static; }
  .recipient-panel { grid-column: auto; }
  .template-library-bar { grid-template-columns: 1fr 1fr; }
  .template-buttons { justify-content: flex-end; }
}

@media (max-width: 650px) {
  .mailbox-strip { align-items: flex-start; flex-wrap: wrap; }
  .mailbox-strip > div { flex-basis: calc(100% - 30px); }
  .mailbox-strip a { margin-left: 22px; }
  .section-head { align-items: flex-start; }
  .recipient-heading { display: grid; }
  .recipient-tools { grid-template-columns: 1fr; width: 100%; }
  .select-all { margin-left: 27px; }
  .campaign-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .format-switch { grid-template-columns: 1fr; }
  .private-library-badge { display: none; }
  .template-library-bar { grid-template-columns: 1fr; }
  .template-buttons { display: grid; grid-template-columns: 1fr 1fr; }
}
/* Private lead shelf and per-user Gmail workspace */
.nav-unread{display:inline-grid;place-items:center;min-width:19px;height:19px;margin-left:6px;padding:0 5px;border-radius:999px;background:var(--danger);color:var(--panel);font-size:11px;font-weight:800;line-height:1}
.lead-scope-switch{display:inline-flex;gap:4px;margin:0 0 18px;padding:4px;border:1px solid var(--brand-soft);border-radius:12px;background:var(--brand-soft)}
.lead-scope-switch a{display:flex;align-items:center;gap:8px;padding:8px 14px;border-radius:9px;color:var(--brand);font-size:13px;font-weight:750;text-decoration:none}
.lead-scope-switch a.active{background:var(--panel);color:var(--brand);box-shadow:0 3px 12px rgba(93, 63, 26, .08)}
.lead-scope-switch strong{display:inline-grid;place-items:center;min-width:21px;height:21px;border-radius:7px;background:var(--brand-soft);color:var(--brand);font-size:11px}
.private-lead-action{border-color:var(--warning)!important;background:var(--warning-soft)!important;color:var(--warning)!important}.private-lead-badge{display:inline-flex;align-items:center;padding:3px 8px;border:1px solid var(--warning);border-radius:999px;background:var(--warning-soft);color:var(--warning);font-size:10px;font-weight:800;letter-spacing:.035em;text-transform:uppercase}.private-lead-choice{border-color:var(--warning-soft);background:linear-gradient(105deg,var(--warning-soft),var(--panel))}.private-lead-choice strong{color:var(--warning)}
.save-lead-form{display:inline-flex;margin:0}
.save-lead-button{border:0;background:transparent;color:var(--brand);font-size:17px;line-height:1;cursor:pointer;padding:5px}
.save-lead-button:hover,.save-lead-button.saved{color:var(--brand)}
.saved-button{background:var(--warning-soft)!important;border-color:var(--brand)!important;color:var(--brand)!important}
.unread-dot{display:inline-block;width:9px;height:9px;margin:0 8px 1px 0;border-radius:50%;background:var(--brand);box-shadow:0 0 0 3px rgba(223, 104, 47, .12)}
.unread-dot.large{width:11px;height:11px;vertical-align:middle}

/* Centrum operacyjne transportu */
.head-actions,.row-actions{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.head-actions form,.row-actions form{margin:0}.button-danger{border-color:var(--brand);background:var(--brand)}.status-danger{border-color:var(--danger)!important;color:var(--danger)!important;background:var(--danger-soft)!important}.status-success{border-color:var(--success)!important;color:var(--success)!important;background:var(--success-soft)!important}.order-kpis{margin-bottom:18px}.detail-tabs{display:flex;gap:3px;margin:0 0 18px;padding:5px;border:1px solid var(--brand-soft);border-radius:12px;background:var(--brand-soft);overflow-x:auto}.detail-tabs a{display:flex;align-items:center;gap:7px;padding:10px 13px;border-radius:8px;color:var(--ink2);font-size:.78rem;font-weight:750;text-decoration:none;white-space:nowrap}.detail-tabs a.active{color:var(--brand);background:var(--panel);box-shadow:0 3px 12px rgba(87, 62, 27, .1)}.detail-tabs span{display:grid;place-items:center;min-width:20px;height:20px;padding:0 5px;border-radius:999px;background:var(--brand-soft);font-size:.65rem}.detail-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 20px;margin:0}.detail-list>div{padding:11px 0;border-bottom:1px solid var(--brand-soft)}.detail-list dt{color:var(--muted);font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em}.detail-list dd{margin:4px 0 0;font-weight:700}.subcard{padding:17px;border:1px solid var(--brand-soft);border-radius:10px;background:var(--brand-soft)}.subcard h3{margin-top:0}.transport-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.order-route-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(350px,.9fr);gap:18px;align-items:start}.route-timeline{margin:0;padding:0;list-style:none}.route-timeline li{display:grid;grid-template-columns:38px 1fr;gap:12px;position:relative;padding:0 0 24px}.route-timeline li:after{content:"";position:absolute;left:18px;top:33px;bottom:0;width:2px;background:var(--brand-soft)}.route-timeline li:last-child:after{display:none}.route-marker{z-index:1;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;color:var(--panel);background:var(--brand);font-weight:850}.route-timeline strong,.route-timeline small{display:block;margin-top:6px}.route-timeline p{margin:4px 0;color:var(--brand)}.osm-map{min-height:390px;border:1px solid var(--brand-soft);border-radius:10px;background:var(--brand-soft);overflow:hidden}.osm-map>p{padding:30px;color:var(--muted)}.map-attribution{margin:8px 0 0;color:var(--muted);font-size:.68rem}.event-timeline article{display:grid;grid-template-columns:14px 1fr;gap:12px;padding:0 0 20px}.event-timeline article>span{width:10px;height:10px;margin-top:4px;border-radius:50%;background:var(--brand);box-shadow:0 0 0 5px var(--brand-soft)}.event-timeline strong,.event-timeline small{display:block}.event-timeline small{margin-top:4px;color:var(--muted)}
@media(max-width:950px){.order-route-layout{grid-template-columns:1fr}.route-map-card{position:static}.transport-cards{grid-template-columns:1fr}.osm-map{min-height:330px}}
@media(max-width:650px){.order-detail-head{align-items:flex-start}.head-actions{width:100%}.head-actions .button,.head-actions form{flex:1}.head-actions form .button{width:100%}.detail-list{grid-template-columns:1fr}.osm-map{min-height:280px}}
.finance-hero{margin-bottom:18px}.finance-stats{grid-template-columns:repeat(6,minmax(0,1fr));margin:0 0 18px}.finance-stats article{min-width:0}.finance-stats strong{font-size:clamp(1rem,1.7vw,1.45rem);overflow-wrap:anywhere}.finance-chart-wrap{position:relative;min-height:310px;padding:8px;border:1px solid var(--brand-soft);border-radius:11px;background:var(--panel)}.finance-chart-wrap canvas{display:block;width:100%;height:310px}.finance-data-table{margin-top:14px;max-height:280px}.processing-orders{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.processing-card{display:grid;gap:8px;padding:16px;border:1px solid var(--brand-soft);border-radius:10px;color:inherit;text-decoration:none;background:var(--brand-soft)}.processing-card:hover{border-color:var(--brand);background:var(--brand-soft)}.processing-card .order-status{justify-self:start}.processing-card small{color:var(--muted)}
@media(max-width:1050px){.finance-stats{grid-template-columns:repeat(3,minmax(0,1fr))}.processing-orders{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.finance-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.processing-orders{grid-template-columns:1fr}.finance-chart-wrap{overflow-x:auto}.finance-chart-wrap canvas{min-width:720px}}

.mail-page-head{align-items:flex-end;margin-bottom:16px}.mail-page-head h1{font-size:clamp(30px,4vw,46px)}
.mail-connect-banner{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:18px;padding:18px 22px;border:1px solid var(--brand);border-radius:14px;background:linear-gradient(110deg,var(--brand-soft),var(--panel))}
.mail-connect-banner div{display:grid;gap:4px}.mail-connect-banner span{color:var(--brand);font-size:14px}
.mailbox-layout{display:grid;grid-template-columns:246px minmax(0,1fr);gap:18px;align-items:start;padding:10px;border:1px solid var(--brand-soft);border-radius:20px;background:var(--brand-soft);box-shadow:0 18px 46px rgba(72, 53, 27, .08)}
.mailbox-sidebar{position:sticky;top:16px;padding:6px 4px 12px}
.mail-compose-button{display:flex;align-items:center;justify-content:center;gap:9px;width:calc(100% - 12px);margin:2px 6px 16px;padding:13px 18px;border-radius:15px;background:var(--panel);color:var(--brand);font-size:14px;font-weight:800;text-decoration:none;box-shadow:0 5px 18px rgba(105, 77, 39, .14)}.mail-compose-button:hover{box-shadow:0 7px 23px rgba(105, 77, 39, .2);transform:translateY(-1px)}.mail-compose-button span{font-size:22px;font-weight:400;line-height:1}
.mailbox-nav{display:grid;gap:2px}
.mailbox-nav a{display:grid;grid-template-columns:22px minmax(0,1fr) auto;align-items:center;gap:10px;padding:10px 13px;border-radius:0 999px 999px 0;color:var(--brand);font-size:13px;font-weight:650;text-decoration:none}
.mailbox-nav a:hover{background:var(--brand-soft)}.mailbox-nav a.active{background:var(--brand-soft);color:var(--brand);font-weight:850}
.mail-nav-icon{display:grid;place-items:center;width:20px;color:var(--muted);font-size:13px}.mail-nav-icon.star{color:var(--brand)}.mailbox-nav a.active .mail-nav-icon{color:var(--brand)}
.mailbox-nav a strong{display:grid;place-items:center;min-width:21px;height:20px;padding:0 5px;border-radius:999px;background:var(--brand);color:white;font-size:10px}
.private-folders a{grid-template-columns:12px minmax(0,1fr)}.private-folders i{width:9px;height:9px;border-radius:3px;background:var(--folder-color)}
.folder-head{margin:18px 13px 7px;padding-top:15px;border-top:1px solid var(--brand-soft);color:var(--muted);font-size:10px;letter-spacing:.11em;text-transform:uppercase}.folder-empty-note{padding:4px 13px}
.folder-create{margin:8px 12px}.folder-create summary{color:var(--brand);font-size:12px;font-weight:750;cursor:pointer}.folder-create form{margin-top:10px}.folder-create p{margin:8px 0}.folder-create label{font-size:12px}.folder-create input{padding:8px;background:var(--panel)}
.link-danger{border:0;background:transparent;color:var(--brand);font-size:12px;cursor:pointer;padding:10px}
.mailbox-main{min-width:0;overflow:hidden;border:1px solid var(--brand-soft);border-radius:14px;background:var(--panel);box-shadow:0 4px 16px rgba(75, 56, 29, .05)}
.mail-toolbar{display:grid;gap:12px;padding:14px 16px 10px;border-bottom:1px solid var(--brand-soft)}.mail-search{display:flex;align-items:center;gap:8px;padding:0 8px 0 15px;border-radius:999px;background:var(--brand-soft)}.mail-search>span{color:var(--muted);font-size:21px}.mail-search input{flex:1;margin:0;padding:12px 2px;border:0;background:transparent;box-shadow:none}.mail-search input:focus{outline:none}.mail-search .button{padding:8px 14px;border-radius:999px}.mail-toolbar-meta{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:0 5px}.mail-toolbar-meta strong{font-size:13px}.mail-toolbar-meta span{color:var(--muted);font-size:11px}
.mail-list-head{display:grid;grid-template-columns:42px 42px minmax(135px,.75fr) minmax(260px,2fr) minmax(100px,.65fr) 80px;gap:10px;padding:9px 14px 9px 0;border-bottom:1px solid var(--brand-soft);background:var(--brand-soft);color:var(--muted);font-size:10px;font-weight:750;text-transform:uppercase;letter-spacing:.07em}.mail-list-head span:first-child{grid-column:2}.mail-list-head span:nth-child(2){grid-column:3}.mail-list-head span:nth-child(3){grid-column:4}.mail-list-head span:nth-child(4){grid-column:5}.mail-list-head span:nth-child(5){grid-column:6;text-align:right}
.mail-row{position:relative;display:grid;grid-template-columns:42px minmax(0,1fr);align-items:stretch;border-bottom:1px solid var(--brand-soft);background:var(--panel);transition:background .12s ease,box-shadow .12s ease}
.mail-row:hover{z-index:1;background:var(--brand-soft);box-shadow:0 2px 8px rgba(65, 49, 28, .12)}.mail-row.unread{background:var(--brand-soft);box-shadow:inset 4px 0 var(--brand)}.mail-row.unread .mail-party,.mail-row.unread .mail-subject strong{font-weight:850;color:var(--brand)}.mail-row.unread:after{content:"";position:absolute;right:8px;top:8px;width:7px;height:7px;border-radius:50%;background:var(--brand)}
.mail-star-form{display:grid;place-items:center;margin:0}.mail-star{border:0;background:transparent;color:var(--brand);font-size:18px;cursor:pointer;transition:color .12s ease,transform .12s ease}.mail-star:hover{color:var(--brand);transform:scale(1.08)}.mail-star.active{color:var(--brand)}
.mail-row-content{display:grid;grid-template-columns:42px minmax(135px,.75fr) minmax(260px,2fr) minmax(100px,.65fr) 80px;gap:10px;align-items:center;min-height:64px;padding:8px 14px 8px 0;color:inherit;text-decoration:none}
.mail-avatar{display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:var(--brand-soft);color:var(--brand);font-size:12px;font-weight:850}.mail-row.unread .mail-avatar{background:var(--brand);color:var(--panel)}
.mail-party{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:650}.mail-subject{display:flex;gap:6px;min-width:0;align-items:baseline}.mail-subject strong{max-width:46%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:650}.mail-subject small{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}
.mail-lead{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:4px 8px;border-radius:999px;background:var(--success-soft);color:var(--success);font-size:10px;font-weight:750}.mail-lead.unmatched{background:var(--brand-soft);color:var(--muted)}.mail-row time{color:var(--muted);font-size:10px;font-weight:650;text-align:right}
.mail-empty{display:grid;place-items:start;gap:7px;padding:42px;color:var(--brand)}.mail-empty strong{color:var(--brand)}.mail-empty a{font-weight:750}
.mail-count-pill{padding:7px 10px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-size:12px;font-weight:750}.mail-count-pill.unread{background:var(--danger-soft);color:var(--brand)}
.lead-mail-panel{margin-bottom:18px;padding:0;border-top:3px solid var(--brand);overflow:hidden}.lead-mail-summary{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:18px 20px;cursor:pointer;list-style:none}.lead-mail-summary::-webkit-details-marker{display:none}.lead-mail-summary h2,.lead-mail-summary p{margin:0}.lead-mail-summary .actions{display:flex;align-items:center;gap:9px}.lead-mail-summary>div:first-child{display:grid;gap:4px}.lead-mail-summary i{width:9px;height:9px;border-right:2px solid var(--brand);border-bottom:2px solid var(--brand);transform:rotate(45deg);transition:transform .16s ease}.lead-mail-panel[open] .lead-mail-summary i{transform:rotate(225deg)}.mail-collapse-label:before{content:"Rozwiń";color:var(--brand);font-size:11px;font-weight:750}.lead-mail-panel[open] .mail-collapse-label:before{content:"Zwiń"}.lead-mail-content{padding:14px 18px 18px;border-top:1px solid var(--brand-soft);background:var(--brand-soft)}.lead-mail-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:12px}.lead-mail-toolbar>span{color:var(--brand);font-size:11px}.lead-mail-stream{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.lead-mail-item{position:relative;display:grid;grid-template-columns:1fr auto;gap:4px 12px;padding:14px;border:1px solid var(--brand-soft);border-radius:11px;color:inherit;text-decoration:none;background:var(--panel)}.lead-mail-item:hover{border-color:var(--brand)}.lead-mail-item.unread{background:var(--brand-soft);border-color:var(--brand)}.lead-mail-item>strong,.lead-mail-item>span,.lead-mail-item>p{grid-column:1}.lead-mail-item time{grid-column:2;grid-row:1;color:var(--brand);font-size:11px}.lead-mail-item p{margin:5px 0 0;color:var(--brand);font-size:12px}.mail-direction{color:var(--brand);font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.07em}

.mail-detail-title{max-width:900px;font-size:clamp(24px,3vw,38px)}
.mail-detail-grid{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:16px;align-items:start}.mail-thread{display:grid;gap:12px;background:var(--brand-soft)}.thread-message{border:1px solid var(--brand-soft);border-radius:14px;overflow:hidden;background:var(--panel);box-shadow:0 3px 10px rgba(76, 57, 31, .04)}.thread-message.direction-outbound{margin-left:8%;border-color:var(--brand);background:var(--brand-soft)}.thread-message header{display:flex;justify-content:space-between;gap:18px;padding:14px 17px;border-bottom:1px solid var(--brand-soft);background:rgba(253, 251, 248, .82)}.thread-message header>div{display:flex;gap:10px;align-items:center}.thread-message header div div{display:grid}.thread-message header small,.thread-message time{color:var(--brand);font-size:11px}.thread-avatar{display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:var(--brand-soft);color:var(--brand);font-weight:850}.thread-body{padding:20px 22px;line-height:1.65;white-space:normal;overflow-wrap:anywhere}.quoted-mail{margin:0 22px 18px;border-top:1px solid var(--brand-soft)}.quoted-mail summary{display:inline-flex;margin-top:12px;padding:6px 10px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-size:11px;font-weight:750;cursor:pointer}.quoted-mail>div{max-height:520px;margin-top:12px;padding:15px;border-left:3px solid var(--brand-soft);background:var(--brand-soft);color:var(--ink2);font-size:12px;line-height:1.55;overflow:auto}.reply-box{margin-top:8px;padding:18px;border:1px solid var(--brand-soft);border-radius:14px;background:var(--brand-soft)}.reply-box textarea{background:var(--panel)}.reply-box .form-actions{display:flex;align-items:center;gap:12px}.reply-box small{color:var(--brand)}
.mail-context{position:sticky;top:16px}.mail-context hr{border:0;border-top:1px solid var(--brand-soft);margin:18px 0}.mail-context form{display:inline}.mail-context .full{width:100%;justify-content:center}.folder-tag{margin:3px 3px 3px 0;padding:6px 9px;border:1px solid color-mix(in srgb,var(--folder-color) 45%,var(--brand-soft));border-radius:999px;background:var(--panel);color:var(--brand);font-size:11px;cursor:pointer}.folder-tag.active{background:color-mix(in srgb,var(--folder-color) 12%,var(--panel));color:var(--brand)}
.sync-note{margin-top:16px;color:var(--muted);font-size:12px}

@media (max-width:1050px){.mailbox-layout,.mail-detail-grid{grid-template-columns:1fr}.mailbox-sidebar,.mail-context{position:static}.mailbox-sidebar{display:grid;grid-template-columns:180px 1fr;gap:8px}.mail-compose-button{grid-row:1 / 3}.mailbox-nav{grid-template-columns:repeat(2,minmax(0,1fr))}.folder-head,.private-folders,.folder-create,.mailbox-sidebar>.link-danger{grid-column:2}.mail-row-content{grid-template-columns:38px minmax(120px,.7fr) minmax(220px,2fr) 75px}.mail-list-head{grid-template-columns:42px 38px minmax(120px,.7fr) minmax(220px,2fr) 75px}.mail-lead,.mail-list-head span:nth-child(4){display:none}.lead-mail-stream{grid-template-columns:1fr}}
@media (max-width:680px){.mail-connect-banner{align-items:flex-start;flex-direction:column}.mailbox-layout{padding:7px}.mailbox-sidebar{display:block}.mailbox-nav{grid-template-columns:1fr}.folder-head,.private-folders,.folder-create{display:none}.mail-toolbar-meta{align-items:flex-start;flex-direction:column;gap:3px}.mail-list-head{display:none}.mail-row-content{grid-template-columns:34px minmax(0,1fr) auto;gap:8px}.mail-avatar{grid-column:1;grid-row:1 / 3}.mail-party,.mail-subject{grid-column:2}.mail-row time{grid-column:3;grid-row:1}.mail-subject small{display:none}.thread-message.direction-outbound{margin-left:0}.lead-scope-switch{display:flex}.lead-scope-switch a{flex:1;justify-content:center}}


/* ==========================================================================
   Redesign 2026 — warstwa nadrzędna: typografia, powłoka aplikacji, komponenty
   ========================================================================== */

html { color-scheme: light; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Public Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
h1, h2, h3 { font-family: "Public Sans", "Segoe UI", sans-serif; color: var(--ink-strong); letter-spacing: -.02em; }
h1 { font-size: clamp(28px, 3vw, 34px); font-weight: 750; line-height: 1.12; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
a { color: var(--brand); }
a:hover { color: var(--ink-strong); }
code, .mono, time { font-family: "IBM Plex Mono", Consolas, monospace; }
.eyebrow { color: var(--brand); font: 700 11px/1 "Public Sans", sans-serif; letter-spacing: .16em; }
::selection { background: var(--brand-soft); }

/* --- Belka górna ------------------------------------------------------- */
.topbar {
  min-height: 64px;
  gap: 18px;
  padding: 0 24px;
  background: var(--nav);
  color: var(--nav-ink);
  border-bottom: 1px solid color-mix(in oklab, var(--nav-ink) 14%, transparent);
  box-shadow: none;
}
.topbar::after { display: none; }
.brand > span:last-child { font-family: "Public Sans", sans-serif; font-weight: 700; font-size: 15px; }
.brand small { color: var(--nav-muted); font-size: 9.5px; letter-spacing: .18em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; }
.brand-mark::before { display: none; }
.brand-mark i { width: 6px; height: 6px; border: 0; border-radius: 2px; background: var(--brand-ink); box-shadow: none; }
.brand-mark i:nth-child(2) { align-self: center; margin: 0; background: var(--brand-ink); box-shadow: none; opacity: .75; }
.brand-mark i:nth-child(3) { opacity: .5; }
.topbar-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 14px; color: var(--nav-ink); font-size: 14px; font-weight: 600; }
.topbar-title::before { content: ""; width: 1px; height: 26px; background: color-mix(in oklab, var(--nav-ink) 22%, transparent); }
.topbar-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu { gap: 10px; color: var(--nav-ink); }
.user-chip { gap: 9px; padding: 5px 12px 5px 5px; border: 1px solid color-mix(in oklab, var(--nav-ink) 20%, transparent); border-radius: 999px; font-size: 13px; }
.user-chip i { width: 24px; height: 24px; border: 0; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 700; }
.theme-toggle {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid color-mix(in oklab, var(--nav-ink) 20%, transparent);
  border-radius: 10px;
  background: transparent; color: var(--nav-ink);
  font-size: 14px; cursor: pointer;
}
.theme-toggle:hover { background: color-mix(in oklab, var(--nav-ink) 12%, transparent); }
.link-button { color: var(--nav-muted); font-size: 13px; }
.link-button:hover { color: var(--nav-ink); }
.top-actions { display: flex; align-self: stretch; align-items: stretch; gap: 2px; }
.top-actions a { display: flex; align-items: center; padding: 0 12px; color: var(--nav-muted); font-size: 13px; font-weight: 650; }
.top-actions a:hover, .top-actions a.active { color: var(--nav-ink); }
.user-dropdown { position: relative; }
.user-dropdown > summary { list-style: none; cursor: pointer; }
.user-dropdown > summary::-webkit-details-marker { display: none; }
.user-dropdown-panel { position: absolute; z-index: 30; top: calc(100% + 10px); right: 0; display: grid; min-width: 220px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-hover); }
.user-dropdown-panel a, .user-dropdown-panel button { display: block; width: 100%; padding: 9px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--ink2); font: 600 13px/1.3 "Public Sans", sans-serif; text-align: left; cursor: pointer; }
.user-dropdown-panel a:hover, .user-dropdown-panel button:hover { background: var(--brand-soft); color: var(--brand); }

/* --- Powłoka: menu boczne + treść -------------------------------------- */
.app-shell { display: grid; grid-template-columns: 246px minmax(0, 1fr); align-items: start; }
.sidenav {
  position: sticky; top: 64px;
  height: calc(100vh - 64px);
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
  scrollbar-width: none;
}
.sidenav::-webkit-scrollbar { display: none; }
.nav-group { display: grid; gap: 2px; margin-bottom: 14px; }
.nav-group > p {
  margin: 0 10px 8px;
  color: var(--muted);
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink2);
  font-size: 14.5px; font-weight: 500;
}
.nav-item::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 2px; background: var(--line-strong); }
.nav-item span.nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--panel-soft); color: var(--ink-strong); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.nav-item.active::before { background: var(--brand); }
.nav-subs { display: grid; gap: 1px; margin: 2px 0 8px 21px; padding-left: 12px; border-left: 1px solid var(--line); }
.nav-subs a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--muted); font-size: 13.5px; font-weight: 500;
}
.nav-subs a:hover { background: var(--panel-soft); color: var(--ink-strong); }
.nav-subs a.active { background: var(--panel-soft); color: var(--ink-strong); font-weight: 700; }
.sidenav-note {
  margin-top: 18px; padding: 13px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-soft);
}
.sidenav-note strong { display: block; margin-bottom: 5px; font-size: 12.5px; }
.sidenav-note span { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.operational-nav .nav-orders::before { content: "O"; }
.operational-nav .nav-invoices::before { content: "I"; }
.operational-nav .nav-documents::before { content: "D"; }
.operational-nav .nav-mail::before { content: "M"; }
.operational-nav .nav-item::before { display: grid; place-items: center; width: 22px; height: 22px; flex-basis: 22px; border-radius: 7px; color: var(--muted); font: 700 10px/1 "IBM Plex Mono", monospace; }
.operational-nav .nav-item.active::before { color: var(--brand-ink); }
.container { width: 100%; max-width: 1420px; min-height: 0; margin: 0; padding: 34px 40px 64px; }
.app-shell + .app-footer { padding-left: 286px; }
.app-footer { background: var(--panel-soft); border-top: 1px solid var(--line); color: var(--muted); }
.app-footer span:first-child { color: var(--ink-strong); }

/* ========================================================================
   Final operations-console overrides
   Kept last on purpose: the stylesheet contains legacy module sections.
   ======================================================================== */
:root {
  --line: oklch(0.885 0.017 70);
  --line-strong: oklch(0.805 0.024 66);
  --muted: oklch(0.510 0.022 62);
  --brand: oklch(0.505 0.145 38);
  --brand-dark: oklch(0.445 0.135 35);
  --brand-soft: oklch(0.940 0.042 50);
  --nav-muted: oklch(0.825 0.018 70);
  --focus: oklch(0.690 0.145 55);
}
[data-theme="dark"] {
  --line: oklch(0.390 0.018 62);
  --line-strong: oklch(0.470 0.020 62);
  --muted: oklch(0.770 0.014 70);
  --brand: oklch(0.735 0.135 48);
  --brand-dark: oklch(0.790 0.125 52);
  --brand-soft: oklch(0.330 0.060 42);
  --nav-muted: oklch(0.790 0.016 70);
}
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in oklab, var(--focus) 58%, transparent);
  outline-offset: 2px;
}
body { font-size: 15.5px; }
.topbar { min-height: 68px; gap: 22px; padding-inline: clamp(18px, 2.2vw, 36px); }
.top-actions { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.top-actions::-webkit-scrollbar { display: none; }
.top-actions a { position: relative; padding-inline: 15px; color: var(--nav-muted); font-size: 13.5px; }
.top-actions a::after { content: ""; position: absolute; right: 15px; bottom: 0; left: 15px; height: 2px; background: transparent; }
.top-actions a:hover, .top-actions a.active { color: var(--nav-ink); background: color-mix(in oklab, var(--nav-ink) 6%, transparent); }
.top-actions a.active::after { background: var(--brand); }
.theme-toggle { width: auto; min-width: 96px; height: 38px; gap: 7px; padding: 0 11px; border-color: color-mix(in oklab, var(--nav-ink) 32%, transparent); color: var(--nav-ink); font: 650 12px/1 "Public Sans", sans-serif; }
.theme-glyph { display: grid; place-items: center; width: 18px; height: 18px; font-size: 17px; }
.user-chip { min-height: 38px; border-color: color-mix(in oklab, var(--nav-ink) 32%, transparent); }

.app-shell { grid-template-columns: 238px minmax(0, 1fr); }
.sidenav { top: 68px; height: calc(100vh - 68px); padding: 22px 14px; }
.container { width: 100%; max-width: 1780px; padding: 36px clamp(24px, 2.6vw, 48px) 72px; }
.app-shell + .app-footer { padding-left: 286px; }
.nav-group { gap: 4px; }
.nav-item { min-height: 44px; padding: 9px 11px; color: var(--ink2); font-size: 14px; }
.operational-nav .nav-item::before { display: none; content: none; }
.nav-icon { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 27px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); color: var(--muted); }
.nav-icon svg { width: 17px; height: 17px; fill: currentColor; }
.nav-item:hover .nav-icon { border-color: var(--line-strong); color: var(--ink-strong); background: var(--panel); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-item.active .nav-icon { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.mobile-only-nav { display: none; }
.directory-tabs { display:flex; gap:6px; margin:-10px 0 22px; padding:5px; width:max-content; max-width:100%; overflow-x:auto; border:1px solid var(--line); border-radius:11px; background:var(--panel-soft); }
.directory-tabs a { padding:9px 15px; border-radius:8px; color:var(--muted); font-size:13px; font-weight:700; white-space:nowrap; }
.directory-tabs a:hover { color:var(--ink-strong); }
.directory-tabs a.active { background:var(--panel); color:var(--brand); box-shadow:0 2px 8px color-mix(in oklab,var(--nav) 8%,transparent); }
.directory-table .row-actions { flex-wrap:wrap; justify-content:flex-end; }
.directory-table .row-actions form { margin:0; }
.directory-table .link-button { color:var(--brand); font-weight:700; }
.nav-unread { min-width: 23px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 10px; }
.mailbox-nav-subs { margin: 2px 0 10px 23px; padding: 5px 0 5px 15px; }
.mailbox-nav-subs a { min-height: 34px; padding: 6px 8px; }
.mailbox-nav-subs a > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-nav-subs a strong { min-width: 20px; padding: 2px 5px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 10px; text-align: center; }
.nav-sub-icon { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; color: var(--muted); }
.nav-sub-icon svg { width: 15px; height: 15px; fill: currentColor; }
.mailbox-state { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--line-strong); box-shadow: 0 0 0 3px var(--panel); }
.mailbox-state.is-connected { background: var(--success); }
.mailbox-nav-subs .mailbox-add-link { color: var(--brand); font-weight: 650; }

.panel, .order-ledger-card, .stats article { border-color: var(--line); box-shadow: 0 1px 2px oklch(0.28 0.03 55 / .05), 0 8px 24px oklch(0.28 0.03 55 / .055); }
.button, a.button, button.button, .mail-compose-button, .row-save { color: var(--brand-ink); font-family: "Public Sans", sans-serif; }
.button.secondary, .button.ghost, .button-secondary, .button-quiet,
a.button.secondary, a.button.ghost, a.button-secondary, a.button-quiet,
button.button.secondary, button.button.ghost, button.button-secondary, button.button-quiet {
  border-color: var(--line-strong); background: var(--panel); color: var(--brand); box-shadow: none;
}
.button.secondary:hover, .button.ghost:hover, .button-secondary:hover, .button-quiet:hover {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark);
}
.order-ledger-actions .button.button-quiet { border-color: var(--line-strong); background: var(--panel); color: var(--brand); }
.order-ledger-actions .button.button-quiet:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.order-ledger { gap: 16px; }
.order-ledger-card { border-radius: 15px; }
.order-ledger-head { grid-template-columns: minmax(220px, .65fr) minmax(280px, 1.35fr) auto; padding: 16px 20px; background: color-mix(in oklab, var(--brand-soft) 38%, var(--panel)); }
.order-client { font-size: 16px; }
.order-route-rail { padding: 13px 22px; }
.order-route-rail li { grid-template-columns: 34px minmax(0, 1fr) auto; min-height: 59px; gap: 13px; }
.order-route-rail li:not(:last-child)::after { top: 44px; bottom: -15px; left: 16px; background: var(--line-strong); }
.stop-icon { width: 33px; height: 33px; border: 1px solid color-mix(in oklab, var(--brand) 70%, var(--line)); box-shadow: 0 0 0 4px var(--panel); }
.stop-icon svg { width: 17px; height: 17px; fill: currentColor; }
.order-route-rail .is-unloading .stop-icon { border-color: color-mix(in oklab, var(--success) 56%, var(--line)); box-shadow: 0 0 0 4px var(--panel); }
.order-route-rail strong { font-size: 14.5px; }
.stop-kind { border-color: var(--line-strong); background: var(--panel); color: var(--ink2); }
input, select, textarea { border-color: var(--line-strong); color: var(--ink-strong); }

@media (min-width: 1500px) {
  .order-ledger-body { grid-template-columns: minmax(0, 1.85fr) minmax(320px, .72fr); }
}
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 218px minmax(0, 1fr); }
  .container { padding: 30px 26px 64px; }
  .app-shell + .app-footer { padding-left: 244px; }
  .theme-toggle { min-width: 38px; padding: 0 9px; }
  .theme-toggle [data-theme-label] { display: none; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidenav { position: static; top: auto; width: 100%; height: auto; display: flex; padding: 9px 14px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .nav-group { display: flex; align-items: center; gap: 5px; margin: 0; }
  .nav-group > p, .nav-subs { display: none; }
  .nav-item { min-width: max-content; min-height: 42px; }
  .app-shell + .app-footer { padding-left: 24px; }
  .container { padding: 26px 20px 58px; }
  .order-ledger-head { grid-template-columns: 1fr auto; }
  .order-ledger-head .order-client { grid-column: 1 / -1; grid-row: 2; }
  .order-ledger-body { grid-template-columns: 1fr; }
  .order-ledger-metrics { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 700px) {
  body { padding-bottom: 76px; }
  .topbar { position: sticky; top: 0; z-index: 40; min-height: 58px; }
  .top-actions { flex: 1 1 auto; }
  .top-actions a { padding-inline: 10px; font-size: 12px; }
  .top-actions a:not(:first-child) { display: none; }
  .brand small { display: none; }
  .brand > span:last-child { font-size: 13px; }
  .user-menu { margin-left: auto; }
  .user-chip span, .theme-toggle [data-theme-label] { display: none; }
  .theme-toggle { min-width: 36px; width: 36px; height: 36px; padding: 0; border-radius: 999px; }
  .user-chip { border-radius: 999px; }
  .sidenav { position: fixed; z-index: 35; right: 0; bottom: 0; left: 0; top: auto; height: 70px; display: block; padding: 6px max(7px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left)); border: 0; border-top: 1px solid var(--line); background: var(--panel); box-shadow: 0 -8px 24px color-mix(in oklab, var(--nav) 10%, transparent); }
  .operational-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: 3px; }
  .operational-nav > p, .operational-nav .nav-subs { display: none; }
  .operational-nav .mobile-only-nav { display: grid; }
  .operational-nav .directory-desktop { display:none; }
  .operational-nav .nav-item { display: grid; justify-items: center; gap: 2px; min-width: 0; min-height: 57px; padding: 3px 1px; border-radius: 9px; font-size: 9.5px; line-height: 1; }
  .operational-nav .nav-icon { width: 27px; height: 27px; }
  .operational-nav .nav-label { max-width: 100%; text-align: center; }
  .operational-nav .nav-unread { position: absolute; margin: -28px 0 0 27px; }
  .container { padding: 20px 14px 40px; overflow-x: hidden; }
  .directory-tabs { width:100%; margin:-4px 0 16px; }
  .directory-tabs a { flex:1; text-align:center; }
  .directory-table-wrap { overflow:visible; padding:0; border:0; background:transparent; box-shadow:none; }
  .directory-table { display:block; min-width:0; }
  .directory-table thead { display:none; }
  .directory-table tbody { display:grid; gap:12px; }
  .directory-table tr { display:grid; grid-template-columns:1fr 1fr; gap:0; overflow:hidden; border:1px solid var(--line); border-radius:12px; background:var(--panel); box-shadow:var(--shadow); }
  .directory-table td { display:grid; grid-template-columns:minmax(78px,.42fr) 1fr; align-items:start; gap:9px; padding:10px 13px; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
  .directory-table td::before { content:attr(data-label); color:var(--muted); font-size:10px; font-weight:750; letter-spacing:.06em; text-transform:uppercase; }
  .directory-table td:first-child,.directory-table td:last-child { grid-column:1/-1; }
  .directory-table td:not(:first-child):not(:last-child) { grid-template-columns:1fr; gap:5px; }
  .directory-table td:first-child { padding-top:14px; }
  .directory-table td:last-child { border-bottom:0; }
  .directory-table .row-actions { justify-content:flex-start; }
  .directory-table .empty-state { display:block; grid-column:1/-1; }
  .directory-table .empty-state::before { display:none; }
  .order-ledger-head { grid-template-columns: 1fr; gap: 8px; padding: 14px 15px; }
  .order-ledger-head .order-client { grid-column: auto; grid-row: auto; white-space: normal; }
  .order-route-rail { padding: 10px 14px; }
  .order-route-rail li { grid-template-columns: 33px minmax(0, 1fr); }
  .stop-kind { display: none; }
  .order-ledger-metrics { grid-template-columns: 1fr 1fr; padding: 8px; }
  .order-ledger-actions .button, .order-ledger-actions form, .order-ledger-actions form .button { width: 100%; }
  .order-ledger-actions .order-invoice-state { margin: 5px 0 0; }
}
@media (max-width: 430px) {
  .brand-mark { width: 28px; height: 28px; }
  .top-actions a { padding-inline: 7px; }
  .user-menu { gap: 5px; }
  .order-ledger-metrics { grid-template-columns: 1fr; }
}

/* Directory UI guard: must remain after legacy navigation and table rules. */
.directory-tabs { display:flex; gap:6px; margin:-10px 0 22px; padding:5px; width:max-content; max-width:100%; overflow-x:auto; border:1px solid var(--line); border-radius:11px; background:var(--panel-soft); }
.directory-tabs a { padding:9px 15px; border-radius:8px; color:var(--muted); font-size:13px; font-weight:700; white-space:nowrap; }
.directory-tabs a:hover { color:var(--ink-strong); }
.directory-tabs a.active { background:var(--panel); color:var(--brand); box-shadow:0 2px 8px color-mix(in oklab,var(--nav) 8%,transparent); }
.directory-table .row-actions { flex-wrap:wrap; justify-content:flex-end; }
.directory-table .row-actions form { margin:0; }
.directory-table .link-button { color:var(--brand); font-weight:700; }

@media (max-width:900px) {
  .operational-nav .directory-desktop { display:none; }
}

@media (max-width:700px) {
  .directory-tabs { width:100%; margin:-4px 0 16px; }
  .directory-tabs a { flex:1; text-align:center; }
  .directory-table-wrap { overflow:visible; padding:0; border:0; background:transparent; box-shadow:none; }
  .directory-table { display:block; min-width:0; }
  .directory-table thead { display:none; }
  .directory-table tbody { display:grid; gap:12px; }
  .directory-table tr { display:grid; grid-template-columns:1fr 1fr; gap:0; overflow:hidden; border:1px solid var(--line); border-radius:12px; background:var(--panel); box-shadow:var(--shadow); }
  .directory-table td { display:grid; grid-template-columns:minmax(78px,.42fr) 1fr; align-items:start; gap:9px; padding:10px 13px; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
  .directory-table td::before { content:attr(data-label); color:var(--muted); font-size:10px; font-weight:750; letter-spacing:.06em; text-transform:uppercase; }
  .directory-table td:first-child,.directory-table td:last-child { grid-column:1/-1; }
  .directory-table td:first-child { padding-top:14px; }
  .directory-table td:last-child { border-bottom:0; }
  .directory-table .row-actions { justify-content:flex-start; }
  .directory-table .empty-state { display:block; grid-column:1/-1; }
  .directory-table .empty-state::before { display:none; }
}

/* Transport documents, action menus and carrier email composer. */
.transport-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.transport-card-head h3 { margin:0; }
.action-menu { position:relative; }
.action-menu summary { display:grid; place-items:center; width:36px; height:36px; border:1px solid var(--line); border-radius:9px; cursor:pointer; font-size:24px; line-height:1; list-style:none; }
.action-menu summary::-webkit-details-marker { display:none; }
.action-menu > div { position:absolute; z-index:30; top:41px; right:0; min-width:220px; overflow:hidden; border:1px solid var(--line); border-radius:10px; background:var(--panel); box-shadow:var(--shadow); }
.action-menu a,.action-menu button { display:block; width:100%; padding:11px 14px; border:0; background:transparent; color:var(--ink-strong); text-align:left; font:inherit; cursor:pointer; }
.action-menu a:hover,.action-menu button:hover { background:var(--panel-soft); color:var(--brand); }
.action-menu form { margin:0; }
.row-actions { display:flex; align-items:center; justify-content:flex-end; gap:12px; }
.document-name-link { color:var(--ink-strong); text-decoration:none; }
.document-name-link:hover { color:var(--brand); text-decoration:underline; text-underline-offset:3px; }
.document-preview-panel { padding:0; overflow:hidden; }
.document-preview-frame { display:block; width:100%; min-height:calc(100vh - 255px); border:0; background:#f3f3f3; }
.composer-grid { display:grid; grid-template-columns:minmax(0,2fr) minmax(260px,.8fr); gap:24px; }
.composer-summary { padding:20px; border:1px solid var(--line); border-radius:12px; background:var(--panel-soft); }
.attachment-list { display:grid; gap:8px; padding-left:20px; }
.attachment-missing { color:var(--danger); font-weight:700; }
.check-row { display:flex; align-items:center; gap:9px; }
@media (max-width:850px) { .composer-grid { grid-template-columns:minmax(0,1fr); } .document-preview-frame { min-height:68vh; } }

.calendar-actions { display:flex; gap:8px; }
.calendar-weekdays,.calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
.calendar-weekdays { margin-top:16px; border:1px solid var(--line); border-bottom:0; border-radius:10px 10px 0 0; background:var(--panel-soft); }
.calendar-weekdays span { padding:9px; color:var(--muted); text-align:center; font-size:11px; font-weight:750; text-transform:uppercase; }
.calendar-grid { overflow:hidden; border-top:1px solid var(--line); border-left:1px solid var(--line); border-radius:0 0 10px 10px; }
.calendar-day { min-height:126px; padding:8px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); background:var(--panel); }
.calendar-day.outside-month { background:var(--panel-soft); opacity:.55; }
.calendar-day.is-today { box-shadow:inset 0 0 0 2px var(--accent); }
.calendar-day > header { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.calendar-day > header time { font-weight:800; }
.calendar-day > header span { min-width:20px; padding:2px 6px; border-radius:999px; background:var(--brand); color:white; text-align:center; font-size:10px; }
.calendar-orders { display:grid; gap:5px; }
.calendar-order { display:grid; gap:1px; padding:6px; overflow:hidden; border-left:3px solid var(--accent); border-radius:6px; background:var(--panel-soft); }
.calendar-order strong,.calendar-order span,.calendar-order small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.calendar-order span { color:var(--ink-strong); font-size:11px; }
.calendar-order small { color:var(--muted); font-size:10px; }
.calendar-empty { color:var(--muted); }
@media (max-width:820px) { .calendar-weekdays { display:none; } .calendar-grid { grid-template-columns:minmax(0,1fr); border:0; gap:9px; overflow:visible; } .calendar-day { min-height:0; border:1px solid var(--line); border-radius:9px; } .calendar-day.outside-month,.calendar-day:not(:has(.calendar-order)) { display:none; } }

/* Order wizard async search — compact, searchable address and carrier books. */
.saved-address-native,
.carrier-search-native {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  margin: -1px !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

.saved-address-field,
.async-search {
  position: relative;
}

.carrier-picker > .async-search {
  grid-column: 1 / 3;
}

.carrier-picker > .carrier-add-inline {
  grid-column: 3;
}

.saved-address-field > label {
  display: block;
  margin-bottom: 7px;
}

.async-search > input[type="search"] {
  width: 100%;
  padding-right: 42px;
  background-image: linear-gradient(45deg, transparent 50%, var(--brand) 50%), linear-gradient(135deg, var(--brand) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.async-search > input[aria-expanded="true"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 18%, transparent);
}

.async-search-results {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(360px, 48vh);
  padding: 6px;
  overflow-y: auto;
  border: 1px solid color-mix(in oklab, var(--brand) 32%, var(--line));
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 45px color-mix(in oklab, var(--nav) 18%, transparent);
}

.async-search-results[hidden] {
  display: none;
}

.async-search-option {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.async-search-option strong {
  font-size: .86rem;
  line-height: 1.25;
}

.async-search-option small,
.async-search-empty {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.35;
}

.async-search-option:hover,
.async-search-option:focus-visible {
  outline: none;
  background: color-mix(in oklab, var(--brand) 10%, var(--panel));
}

.async-search-option.is-create {
  margin-top: 5px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--brand);
}

.async-search-empty {
  margin: 0;
  padding: 12px;
}

.route-error-summary {
  margin-bottom: 14px;
}

@media (max-width: 700px) {
  .carrier-picker > .async-search,
  .carrier-picker > .carrier-add-inline {
    grid-column: auto;
  }

  .async-search-results {
    position: fixed;
    z-index: 250;
    top: auto;
    right: 10px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 10px;
    max-height: 46vh;
    border-radius: 14px;
  }
}

/* Import history — operational results, not raw exception output. */
.import-history-table { width: 100%; min-width: 1040px; border-collapse: collapse; }
.import-history-table th, .import-history-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.import-history-table th { background: var(--panel-soft); color: var(--muted); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
.import-history-row.has-errors { box-shadow: inset 4px 0 0 var(--danger); }
.import-file-name { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-problems details { min-width: 250px; }
.import-problems summary { color: var(--danger); cursor: pointer; font-weight: 750; }
.import-error-list { display: grid; gap: 9px; margin: 10px 0 0; padding: 0; list-style: none; }
.import-error-list li { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--danger-soft); }
.import-error-list span { color: var(--danger); font: 750 .72rem/1.4 var(--font-mono, monospace); white-space: nowrap; }
.import-error-list p { margin: 0; color: var(--ink); font-size: .8rem; line-height: 1.45; }
.import-ok { color: var(--success); font-weight: 750; }

@media (max-width: 760px) {
  .import-history-wrap { overflow: visible; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .import-history-table { display: block; min-width: 0; }
  .import-history-table thead { display: none; }
  .import-history-table tbody { display: grid; gap: 12px; }
  .import-history-table tr { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
  .import-history-table td { display: grid; grid-template-columns: minmax(76px, .42fr) 1fr; gap: 8px; padding: 10px 13px; overflow-wrap: anywhere; }
  .import-history-table td::before { content: attr(data-label); color: var(--muted); font-size: .66rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
  .import-history-table td[data-label="File"], .import-history-table td[data-label="Problems"], .import-history-table td[data-label="User"] { grid-column: 1 / -1; }
  .import-file-name { max-width: min(66vw, 390px); }
  .import-problems details { min-width: 0; }
  .import-history-table .empty-state { display: block; grid-column: 1 / -1; }
  .import-history-table .empty-state::before { display: none; }
}

/* ========================================================================
   Operations console polish — contrast, navigation and responsive scale
   ======================================================================== */
:root {
  --line: oklch(0.885 0.017 70);
  --line-strong: oklch(0.805 0.024 66);
  --muted: oklch(0.510 0.022 62);
  --brand: oklch(0.505 0.145 38);
  --brand-dark: oklch(0.445 0.135 35);
  --brand-soft: oklch(0.940 0.042 50);
  --nav-muted: oklch(0.825 0.018 70);
  --focus: oklch(0.690 0.145 55);
}
[data-theme="dark"] {
  --line: oklch(0.390 0.018 62);
  --line-strong: oklch(0.470 0.020 62);
  --muted: oklch(0.770 0.014 70);
  --brand: oklch(0.735 0.135 48);
  --brand-dark: oklch(0.790 0.125 52);
  --brand-soft: oklch(0.330 0.060 42);
  --nav-muted: oklch(0.790 0.016 70);
}
html { scroll-padding-top: 82px; }
body { font-size: 15.5px; }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in oklab, var(--focus) 58%, transparent);
  outline-offset: 2px;
}
h1 { font-size: clamp(2rem, 2.4vw, 2.55rem); }
.muted, small, .hint, .help, .form-text { color: var(--muted); }

.topbar { min-height: 68px; gap: 22px; padding-inline: clamp(18px, 2.2vw, 36px); }
.top-actions { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.top-actions::-webkit-scrollbar { display: none; }
.top-actions a { position: relative; padding-inline: 15px; color: var(--nav-muted); font-size: 13.5px; }
.top-actions a::after { content:""; position:absolute; right:15px; bottom:0; left:15px; height:2px; border-radius:2px 2px 0 0; background:transparent; }
.top-actions a:hover, .top-actions a.active { color: var(--nav-ink); background: color-mix(in oklab, var(--nav-ink) 6%, transparent); }
.top-actions a.active::after { background: var(--brand); }
.theme-toggle { width:auto; min-width:96px; height:38px; gap:7px; padding:0 11px; border-color:color-mix(in oklab,var(--nav-ink) 32%,transparent); color:var(--nav-ink); font:650 12px/1 "Public Sans",sans-serif; }
.theme-glyph { display:grid; place-items:center; width:18px; height:18px; font-size:17px; line-height:1; }
.user-chip { min-height:38px; border-color:color-mix(in oklab,var(--nav-ink) 32%,transparent); }

.app-shell { grid-template-columns: 238px minmax(0,1fr); }
.sidenav { top:68px; height:calc(100vh - 68px); padding:22px 14px; }
.container { width:100%; max-width:1780px; padding:36px clamp(24px,2.6vw,48px) 72px; }
.app-shell + .app-footer { padding-left:286px; }
.nav-group { gap:4px; }
.nav-item { min-height:44px; padding:9px 11px; color:var(--ink2); font-size:14px; }
.operational-nav .nav-item::before { display:none; content:none; }
.nav-icon { display:grid; place-items:center; width:27px; height:27px; flex:0 0 27px; border:1px solid var(--line); border-radius:8px; background:var(--panel-soft); color:var(--muted); }
.nav-icon svg { width:17px; height:17px; fill:currentColor; }
.nav-item:hover .nav-icon { border-color:var(--line-strong); color:var(--ink-strong); background:var(--panel); }
.nav-item.active { background:var(--brand-soft); color:var(--brand); }
.nav-item.active .nav-icon { border-color:var(--brand); background:var(--brand); color:var(--brand-ink); }
.mobile-only-nav { display:none; }
.nav-unread { min-width:23px; height:20px; padding:0 6px; border-radius:999px; font-size:10px; }

.mailbox-nav-subs { margin:2px 0 10px 23px; padding:5px 0 5px 15px; }
.mailbox-nav-subs a { min-height:34px; padding:6px 8px; }
.mailbox-nav-subs a > span:nth-child(2) { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mailbox-nav-subs a strong { min-width:20px; padding:2px 5px; border-radius:999px; background:var(--danger-soft); color:var(--danger); font-size:10px; text-align:center; }
.nav-sub-icon { display:grid; place-items:center; width:18px; height:18px; flex:0 0 18px; color:var(--muted); }
.nav-sub-icon svg { width:15px; height:15px; fill:currentColor; }
.mailbox-state { width:8px; height:8px; flex:0 0 8px; border-radius:50%; background:var(--line-strong); box-shadow:0 0 0 3px var(--panel); }
.mailbox-state.is-connected { background:var(--success); }
.mailbox-nav-subs .mailbox-add-link { color:var(--brand); font-weight:650; }

.panel, .order-ledger-card, .stats article { border-color:var(--line); box-shadow:0 1px 2px oklch(0.28 0.03 55/.05),0 8px 24px oklch(0.28 0.03 55/.055); }
.page-head { margin-bottom:28px; }
.page-head p:last-child { font-size:14px; }

/* Keep primary actions readable; outlined actions stay intentionally quiet. */
.button, a.button, button.button, .mail-compose-button, .row-save { color:var(--brand-ink); font-family:"Public Sans",sans-serif; }
.button.secondary, .button.ghost, .button-secondary, .button-quiet,
a.button.secondary, a.button.ghost, a.button-secondary, a.button-quiet,
button.button.secondary, button.button.ghost, button.button-secondary, button.button-quiet {
  border-color:var(--line-strong);
  background:var(--panel);
  color:var(--brand);
  box-shadow:none;
}
.button.secondary:hover, .button.ghost:hover, .button-secondary:hover, .button-quiet:hover {
  border-color:var(--brand);
  background:var(--brand-soft);
  color:var(--brand-dark);
}
.button:disabled { color:var(--brand-ink); opacity:.58; }
.order-ledger-actions .button.button-quiet { border-color:var(--line-strong); background:var(--panel); color:var(--brand); }
.order-ledger-actions .button.button-quiet:hover { border-color:var(--brand); background:var(--brand-soft); color:var(--brand-dark); }

.order-ledger { gap:16px; }
.order-ledger-card { border-radius:15px; }
.order-ledger-head { grid-template-columns:minmax(220px,.65fr) minmax(280px,1.35fr) auto; padding:16px 20px; background:color-mix(in oklab,var(--brand-soft) 38%,var(--panel)); }
.order-number { font-size:13.5px; }
.order-client { font-size:16px; }
.order-date { color:var(--muted); font-size:12.5px; }
.order-route-rail { padding:13px 22px; }
.order-route-rail li { grid-template-columns:34px minmax(0,1fr) auto; min-height:59px; gap:13px; }
.order-route-rail li:not(:last-child)::after { top:44px; bottom:-15px; left:16px; background:var(--line-strong); }
.stop-icon { width:33px; height:33px; border:1px solid color-mix(in oklab,var(--brand) 70%,var(--line)); box-shadow:0 0 0 4px var(--panel); }
.stop-icon svg { width:17px; height:17px; }
.order-route-rail .is-unloading .stop-icon { border-color:color-mix(in oklab,var(--success) 56%,var(--line)); box-shadow:0 0 0 4px var(--panel); }
.order-route-rail strong { font-size:14.5px; }
.order-route-rail div > span { color:var(--muted); font-size:12.5px; }
.stop-kind { border-color:var(--line-strong); background:var(--panel); color:var(--ink2); }
.order-ledger-metrics { padding:14px 20px; border-left-color:var(--line); background:var(--panel-soft); }
.order-ledger-metrics dt { color:var(--muted); }
.order-ledger-metrics dd { color:var(--ink-strong); font-size:13.5px; }
.order-ledger-actions { padding:13px 18px; }

.filters.panel, .transport-filter-panel { border-color:var(--line-strong); }
input, select, textarea { border-color:var(--line-strong); color:var(--ink-strong); }
input::placeholder, textarea::placeholder { color:color-mix(in oklab,var(--muted) 82%,transparent); }

@media (min-width: 1500px) {
  .order-ledger-body { grid-template-columns:minmax(0,1.85fr) minmax(320px,.72fr); }
  .order-ledger-metrics { grid-template-columns:repeat(2,minmax(135px,1fr)); }
}
@media (max-width: 1200px) {
  .app-shell { grid-template-columns:218px minmax(0,1fr); }
  .container { padding:30px 26px 64px; }
  .app-shell + .app-footer { padding-left:244px; }
  .theme-toggle { min-width:38px; padding:0 9px; }
  .theme-toggle [data-theme-label] { display:none; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns:1fr; }
  .sidenav { position:static; top:auto; width:100%; height:auto; display:flex; padding:9px 14px; border-right:0; border-bottom:1px solid var(--line); overflow-x:auto; }
  .nav-group { display:flex; align-items:center; gap:5px; margin:0; }
  .nav-group > p, .nav-subs { display:none; }
  .nav-item { min-width:max-content; min-height:42px; }
  .app-shell + .app-footer { padding-left:24px; }
  .topbar { min-height:60px; padding-inline:14px; }
  .container { padding:26px 20px 58px; }
  .order-ledger-head { grid-template-columns:1fr auto; }
  .order-ledger-head .order-client { grid-column:1/-1; grid-row:2; }
  .order-ledger-body { grid-template-columns:1fr; }
  .order-ledger-metrics { border-left:0; border-top:1px solid var(--line); }
}
@media (max-width: 700px) {
  body { padding-bottom:76px; }
  .topbar { position:sticky; top:0; z-index:40; min-height:58px; }
  .top-actions { flex:1 1 auto; }
  .top-actions a { padding-inline:10px; font-size:12px; }
  .top-actions a:not(:first-child) { display:none; }
  .brand small { display:none; }
  .brand > span:last-child { font-size:13px; }
  .user-menu { margin-left:auto; }
  .user-chip span { display:none; }
  .theme-toggle { min-width:36px; width:36px; height:36px; padding:0; border-radius:999px; }
  .user-chip { border-radius:999px; }
  .sidenav { position:fixed; z-index:35; right:0; bottom:0; left:0; top:auto; height:70px; display:block; padding:6px max(7px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left)); border:0; border-top:1px solid var(--line); background:var(--panel); box-shadow:0 -8px 24px color-mix(in oklab,var(--nav) 10%,transparent); }
  .operational-nav { display:grid; grid-template-columns:repeat(auto-fit,minmax(48px,1fr)); gap:3px; }
  .operational-nav > p, .operational-nav .nav-subs { display:none; }
  .operational-nav .mobile-only-nav { display:grid; }
  .operational-nav .nav-item { display:grid; justify-items:center; gap:2px; min-width:0; min-height:57px; padding:3px 1px; border-radius:9px; font-size:9.5px; line-height:1; }
  .operational-nav .nav-icon { width:27px; height:27px; }
  .operational-nav .nav-label { max-width:100%; text-align:center; }
  .operational-nav .nav-unread { position:absolute; margin:-28px 0 0 27px; }
  .container { padding:20px 14px 40px; overflow-x:hidden; }
  .page-head { gap:16px; }
  .page-head, .page-head .actions { align-items:stretch; }
  .page-head .actions, .page-head > .button { width:100%; }
  .page-head .actions .button, .page-head > .button { flex:1; }
  .panel { padding:18px 15px; }
  .filter-grid { grid-template-columns:1fr; }
  .order-ledger-head { grid-template-columns:1fr; gap:8px; padding:14px 15px; }
  .order-ledger-head .order-client { grid-column:auto; grid-row:auto; white-space:normal; }
  .order-route-rail { padding:10px 14px; }
  .order-route-rail li { grid-template-columns:33px minmax(0,1fr); }
  .stop-kind { display:none; }
  .order-ledger-metrics { grid-template-columns:1fr 1fr; padding:8px; }
  .order-ledger-actions .button, .order-ledger-actions form { width:100%; }
  .order-ledger-actions form .button { width:100%; }
  .order-ledger-actions .order-invoice-state { margin:5px 0 0; }
  .stats.finance-stats { grid-template-columns:1fr 1fr; }
}
@media (max-width: 430px) {
  .brand-mark { width:28px; height:28px; }
  .top-actions a { padding-inline:7px; }
  .user-menu { gap:5px; }
  .order-ledger-metrics { grid-template-columns:1fr; }
  .stats.finance-stats { grid-template-columns:1fr; }
}

/* Operations ledger: orders, invoices and documents -------------------- */
.filter-grid { grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(138px, .8fr)) auto; align-items: end; }
.filter-grid label { display: grid; gap: 5px; min-width: 0; }
.filter-grid label > span:not(.sr-only) { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.button-small { min-height: 35px; padding: 0 12px; font-size: 12px; }
.button-quiet { border: 1px solid var(--line); background: var(--panel); color: var(--ink2); }
.button-quiet:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.order-ledger { display: grid; gap: 13px; }
.order-ledger-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.order-ledger-card:hover { border-color: var(--brand); box-shadow: var(--shadow-hover); }
.order-ledger-head { display: grid; grid-template-columns:minmax(190px,.7fr) minmax(250px,1.4fr) auto; align-items: center; gap: 18px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: var(--panel-soft); }
.order-ledger-head > div { display: flex; align-items: center; gap: 10px; }
.order-number { color: var(--brand); font: 750 14px/1.2 "IBM Plex Mono", monospace; }
.order-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.order-ledger-body { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(270px,.8fr); }
.order-route-rail { position: relative; display: grid; gap: 0; margin: 0; padding: 10px 20px; list-style: none; }
.order-route-rail li { position: relative; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 54px; }
.order-route-rail li:not(:last-child)::after { content:""; position:absolute; top:40px; bottom:-14px; left:14px; width:1px; background:var(--line-strong); }
.stop-icon { z-index: 1; display:grid; place-items:center; width:29px; height:29px; border-radius:50%; background:var(--brand); color:var(--brand-ink); font-weight:850; }
.order-route-rail .is-unloading .stop-icon { background:var(--success-soft); color:var(--success); border:1px solid color-mix(in oklab, var(--success) 30%, transparent); }
.order-route-rail strong,.order-route-rail span { display:block; }
.order-route-rail div > span { margin-top:2px; color:var(--muted); font-size:12px; }
.stop-kind { padding:3px 8px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:10px; font-weight:700; }
.order-ledger-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-content:center; gap:0; margin:0; padding:12px 18px; border-left:1px solid var(--line); background:color-mix(in oklab,var(--panel-soft) 55%,var(--panel)); }
.order-ledger-metrics div { padding:10px; border-bottom:1px solid var(--line); }
.order-ledger-metrics dt { font-size:10px; text-transform:uppercase; letter-spacing:.07em; }
.order-ledger-metrics dd { margin:4px 0 0; font-size:13px; }
.order-ledger-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:12px 18px; border-top:1px solid var(--line); }
.order-ledger-actions form { margin:0; }
.order-ledger-actions .order-invoice-state { margin-left:auto; color:var(--muted); font-size:12px; font-weight:700; }
.order-ledger-actions .order-invoice-state.is-ready { color:var(--success); }
.ledger-table { width:100%; border-collapse:collapse; min-width:900px; }
.ledger-table th { padding:11px 13px; text-align:left; color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.08em; background:var(--panel-soft); }
.ledger-table td { padding:13px; border-top:1px solid var(--line); vertical-align:middle; font-size:13px; }
.ledger-table td small { display:block; margin-top:3px; color:var(--muted); }
.ledger-table tbody tr:hover { background:var(--brand-soft); }
.document-type { display:inline-flex; align-items:center; min-height:25px; padding:0 9px; border:1px solid var(--line); border-radius:999px; color:var(--ink2); font-size:10px; font-weight:750; }
.document-type.type-order { border-color:var(--brand); background:var(--brand-soft); color:var(--brand); }
.document-type.type-invoice { border-color:var(--success); background:var(--success-soft); color:var(--success); }
.route-map-card { display:block; min-height:0; margin:0; padding:18px; overflow:visible; background:var(--panel); }
.osm-map.is-empty { display:grid; place-items:center; min-height:230px; }
.map-empty { margin:9px 0 0; color:var(--muted); font-size:12px; }

@media (max-width: 1180px) {
  .filter-grid { grid-template-columns: repeat(3,minmax(150px,1fr)); }
}
@media (max-width: 820px) {
  .filter-grid { grid-template-columns:1fr 1fr; }
  .order-ledger-head { grid-template-columns:1fr auto; }
  .order-ledger-head .order-client { grid-column:1/-1; grid-row:2; }
  .order-ledger-body { grid-template-columns:1fr; }
  .order-ledger-metrics { border-left:0; border-top:1px solid var(--line); }
}
@media (max-width: 560px) {
  html, body { max-width:100%; overflow-x:hidden; }
  .filter-grid { grid-template-columns:1fr; }
  .order-ledger-head { grid-template-columns:1fr; gap:8px; }
  .order-ledger-head .order-client { grid-column:auto; grid-row:auto; }
  .order-route-rail { padding:10px 14px; }
  .order-route-rail li { grid-template-columns:30px minmax(0,1fr); }
  .stop-kind { display:none; }
  .order-ledger-metrics { grid-template-columns:1fr 1fr; padding:8px; }
  .order-ledger-actions .button,.order-ledger-actions form { width:100%; }
  .order-ledger-actions form .button { width:100%; }
  .order-ledger-actions .order-invoice-state { margin:4px 0 0; }
}

/* Order-side company dialog ------------------------------------------------ */
.field-with-add > button {
  position: absolute; top: 30px; right: 7px; display: grid; width: 32px; height: 32px;
  padding: 0; place-items: center; border: 0; border-radius: 8px; background: var(--brand);
  color: var(--brand-ink); font: 700 20px/1 "Public Sans", sans-serif; cursor: pointer;
}
.field-with-add > button:hover { filter: brightness(.94); transform: translateY(-1px); }
.field-with-add > button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.partner-dialog {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden;
}
.partner-dialog-form { display: flex; max-height: calc(100dvh - 34px); flex-direction: column; overflow-y: auto; }
.partner-dialog-form > header, .partner-dialog-form > footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.partner-dialog-form > header { position: sticky; top: 0; z-index: 3; }
.partner-dialog-form > header h2 { margin: 2px 0 0; font-size: 24px; }
.partner-dialog-form > footer { position: sticky; bottom: 0; z-index: 3; justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.partner-dialog-form > section { padding: 20px 24px; border-bottom: 1px solid var(--line); overflow: visible; }
.partner-dialog-form > section h3 { margin: 0 0 14px; color: var(--brand); font-size: 15px; }
.partner-dialog-form .dialog-errors { margin: 14px 24px 0; }
.dialog-close { width: 38px; height: 38px; border: 0; background: transparent; color: var(--muted); font-size: 28px; cursor: pointer; }
.dialog-close:hover { color: var(--brand); }
[data-private-vat][hidden] { display: none !important; }

@media (max-width: 700px) {
  .partner-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .partner-dialog-form { max-height: 100dvh; }
  .partner-dialog-form > header, .partner-dialog-form > footer, .partner-dialog-form > section { padding: 16px; }
  .partner-dialog-form > section { overflow: visible; }
  .partner-dialog-form { overflow-y: auto; }
  .partner-dialog-form > footer { position: sticky; bottom: 0; z-index: 2; }
}

/* --- Komponenty --------------------------------------------------------- */
.panel, .stats article, .search-history-card, .assignment-card, .subcard, .processing-card, .route-point, .api-key-card, .person-card {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel { border-radius: var(--radius); padding: 26px; }
.subcard, .processing-card, .api-key-card, .person-card { background: var(--panel-soft); box-shadow: none; }
.stats { gap: 16px; }
.stats article { min-height: 0; padding: 20px; border-radius: 13px; }
.stats article::after { display: none; }
.stats span { color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.stats strong { font: 700 26px/1.1 "Public Sans", sans-serif; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.danger-stat strong { color: var(--danger); }
.button {
  min-height: 40px; padding: 0 18px;
  border-color: var(--brand); border-radius: var(--radius-small);
  background: var(--brand); color: var(--brand-ink);
  box-shadow: none;
  font: 650 14px/1 "Public Sans", sans-serif;
}
.button:hover { transform: none; background: var(--brand-dark); border-color: var(--brand-dark); box-shadow: none; }
.button.secondary, .button-secondary, .button.ghost {
  border-color: var(--line-strong); color: var(--ink-strong); background: var(--panel); box-shadow: none;
}
.button.secondary:hover, .button-secondary:hover, .button.ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--panel); }
input, select, textarea {
  min-height: 42px; padding: 10px 14px;
  border-color: var(--line-strong); border-radius: var(--radius-small);
  background: var(--panel); color: var(--ink);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: var(--brand); }
label { color: var(--ink2); font-size: 13px; font-weight: 600; }
:focus-visible { outline: 3px solid color-mix(in oklab, var(--brand) 45%, transparent); outline-offset: 2px; }
.settings-card { max-width: 720px; }
.permission-panel { overflow: hidden; }
.permission-matrix { overflow-x: auto; }
.permission-matrix table { min-width: 980px; }
.permission-matrix th:first-child { position: sticky; left: 0; z-index: 2; background: var(--panel-soft); }
.matrix-check { display: inline-grid; justify-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.matrix-check input { width: 18px; height: 18px; }
.mailbox-account-tabs, .mailbox-filter { display: flex; gap: 10px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 3px; }
.mailbox-account-card { display: grid; flex: 0 0 230px; gap: 2px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink2); }
.mailbox-account-card span, .mailbox-account-card small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-account-card.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.mailbox-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.mailbox-filter a { flex: 0 0 auto; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 650; }
.mailbox-filter a.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

table { min-width: 720px; }
th {
  padding: 13px 20px;
  background: var(--panel-soft); color: var(--muted);
  font: 700 11.5px/1.3 "Public Sans", sans-serif; letter-spacing: .09em;
  border-bottom: 1px solid var(--line);
}
td { padding: 16px 20px; border-bottom: 1px solid var(--line); }
tbody tr:hover { background: var(--panel-soft); }

.badge, .status-pill, .order-status, .partner-role {
  padding: 4px 11px; border: 0; border-radius: 999px;
  background: var(--panel-soft); color: var(--ink2);
  font-size: 11.5px; font-weight: 650;
}
.status-completed, .flag-yes, .status-success, .delivery-sent, .connection-pill.ok { background: var(--success-soft) !important; color: var(--success) !important; border: 0 !important; }
.status-processing, .status-planned, .status-running, .status-queued, .status-sending, .role-client { background: var(--brand-soft) !important; color: var(--brand) !important; border: 0 !important; }
.status-in_transit, .flag-no, .status-partial, .role-carrier { background: var(--warning-soft) !important; color: var(--warning) !important; border: 0 !important; }
.status-failed, .status-cancelled, .status-danger, .delivery-failed { background: var(--danger-soft) !important; color: var(--danger) !important; border: 0 !important; }

.detail-tabs, .segmented, .lead-scope-switch {
  gap: 4px; padding: 5px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-soft);
}
.detail-tabs a, .segmented a, .lead-scope-switch a {
  padding: 9px 15px; border-radius: 8px;
  color: var(--muted); font-size: 13.5px; font-weight: 500;
}
.detail-tabs a:hover, .segmented a:hover, .lead-scope-switch a:hover { color: var(--ink-strong); }
.detail-tabs a.active, .segmented a.active, .lead-scope-switch a.active {
  background: var(--panel); color: var(--ink-strong); font-weight: 700; box-shadow: var(--shadow);
}
.detail-tabs span { background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.alert { border-radius: 11px; border-color: var(--line); border-left: 4px solid var(--brand); background: var(--brand-soft); color: var(--ink-strong); }
.alert-error { border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.alert-success { border-left-color: var(--success); background: var(--success-soft); color: var(--success); }
.alert-warning { border-left-color: var(--warning); background: var(--warning-soft); color: var(--warning); }

/* --- Karty zamówień ----------------------------------------------------- */
.order-cards { display: flex; flex-direction: column; gap: 12px; }
.order-card {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink);
  box-shadow: var(--shadow);
}
.order-card:hover { border-color: var(--brand); color: var(--ink); box-shadow: var(--shadow-hover); }
.order-card-main { display: grid; gap: 14px; align-content: start; padding: 18px 20px; min-width: 0; }
.order-card-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-card-top .order-number { color: var(--brand); font-size: 15.5px; font-weight: 750; }
.route-chip { padding: 3px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-soft); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.order-stops { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.order-stops li { display: grid; grid-template-columns: 22px auto auto minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; }
.order-stops b {
  display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 999px; background: var(--brand-soft); color: var(--brand);
  font-size: 11px; font-weight: 700;
}
.order-stops li:first-child b { background: var(--brand); color: var(--brand-ink); }
.stop-time { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stop-date { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stop-place { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stop-cc { padding: 1px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-soft); color: var(--ink2); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; }
.stop-city { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-card-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.order-card-foot b { color: var(--ink2); font-weight: 650; }
.order-card-money { display: grid; align-content: center; gap: 7px; padding: 18px 20px; border-left: 1px solid var(--line); min-width: 0; }
.order-client { font-size: 16px; font-weight: 700; color: var(--ink-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-price { font-size: 24px; font-weight: 750; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.order-card-marks { display: grid; align-content: center; gap: 11px; padding: 18px 20px; border-left: 1px solid var(--line); background: var(--panel-soft); min-width: 0; }
.order-mark { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 13px; color: var(--ink); }
.order-mark i {
  display: grid; place-items: center; width: 18px; height: 18px;
  border-radius: 999px; font-style: normal; font-size: 10.5px; font-weight: 800;
  background: var(--line); color: var(--muted);
}
.order-mark span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-mark.is-ok i { background: var(--success-soft); color: var(--success); }
.order-mark.is-danger i { background: var(--danger-soft); color: var(--danger); }
.order-mark.is-danger span { color: var(--danger); font-weight: 700; }
.order-mark.is-accent i { background: var(--brand-soft); color: var(--brand); }

/* --- Pulpit finansowy --------------------------------------------------- */
.finance-chart-wrap { border-color: var(--line); border-radius: 12px; background: var(--panel); }
.processing-orders { gap: 12px; }
.processing-card { border-radius: 12px; }
.processing-card:hover { border-color: var(--brand); background: var(--panel-soft); }

/* --- Tryb ciemny: powierzchnie ------------------------------------------ */
[data-theme="dark"] .panel,
[data-theme="dark"] .stats article,
[data-theme="dark"] .search-history-card,
[data-theme="dark"] .assignment-card,
[data-theme="dark"] .route-point,
[data-theme="dark"] .auth-card,
[data-theme="dark"] .mailbox-main,
[data-theme="dark"] .thread-message,
[data-theme="dark"] .lead-mail-item,
[data-theme="dark"] .mail-row,
[data-theme="dark"] .order-card,
[data-theme="dark"] .finance-chart-wrap,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: var(--panel); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .subcard,
[data-theme="dark"] .processing-card,
[data-theme="dark"] .api-key-card,
[data-theme="dark"] .person-card,
[data-theme="dark"] .check-group,
[data-theme="dark"] .choice-box,
[data-theme="dark"] .source-options,
[data-theme="dark"] .form-check-card,
[data-theme="dark"] .order-card-marks,
[data-theme="dark"] .mailbox-layout,
[data-theme="dark"] .lead-mail-content,
[data-theme="dark"] .history-metrics,
[data-theme="dark"] .history-actions,
[data-theme="dark"] th { background: var(--panel-soft); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] th { color: var(--muted); }
[data-theme="dark"] .lead-stage-row,
[data-theme="dark"] .lead-stage-row:hover { background: var(--panel); }
[data-theme="dark"] .route-point-body,
[data-theme="dark"] .assignment-title,
[data-theme="dark"] details form,
[data-theme="dark"] blockquote,
[data-theme="dark"] .code-list,
[data-theme="dark"] .sticky-actions,
[data-theme="dark"] .lead-form-actions,
[data-theme="dark"] .reply-box { background: var(--panel-soft); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .lead-form-section-head,
[data-theme="dark"] .contact-section .lead-form-section-head,
[data-theme="dark"] .template-library-bar,
[data-theme="dark"] .mail-connect-banner { background: var(--panel-soft); }
[data-theme="dark"] .row-edit-link,
[data-theme="dark"] .lead-source,
[data-theme="dark"] .folder-tag { background: var(--panel-soft); color: var(--ink2); border-color: var(--line); }
[data-theme="dark"] .mail-search,
[data-theme="dark"] .mail-count-pill,
[data-theme="dark"] .mail-list-head,
[data-theme="dark"] .mail-toolbar { background: var(--panel-soft); color: var(--ink); }
[data-theme="dark"] .mail-row.unread { background: color-mix(in oklab, var(--brand) 12%, var(--panel)); }
[data-theme="dark"] .stage-chip, [data-theme="dark"] .stage-badge { background: var(--panel-soft); border-color: var(--line); }

/* --- Responsywność ------------------------------------------------------ */
@media (max-width: 1100px) {
  .container { padding: 28px 22px 56px; }
  .app-shell + .app-footer { padding-left: 22px; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidenav {
    position: static; height: auto;
    display: flex; gap: 8px;
    padding: 10px 14px;
    border-right: 0; border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .nav-group { display: flex; align-items: center; gap: 4px; margin: 0; }
  .nav-group > p { margin: 0 6px 0 0; white-space: nowrap; }
  .nav-item { white-space: nowrap; }
  .nav-subs, .sidenav-note { display: none; }
  .topbar { min-height: 58px; padding: 0 16px; }
  .topbar-title { display: none; }
  .order-card-money, .order-card-marks { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 620px) {
  body { padding-bottom: 72px; }
  .container { padding: 18px 14px 36px; overflow-x: hidden; }
  .topbar { position: sticky; top: 0; z-index: 40; min-height: 56px; padding: 0 12px; }
  .brand small, .top-actions { display: none; }
  .brand > span:last-child { font-size: 13px; }
  .user-menu { margin-left: auto; }
  .user-chip span { display: none; }
  .theme-toggle, .user-chip { border-radius: 999px; }
  .sidenav { position: fixed; z-index: 35; right: 0; bottom: 0; left: 0; top: auto; height: 66px; display: block; padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border: 0; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px color-mix(in oklab, var(--nav) 9%, transparent); }
  .operational-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .operational-nav > p { display: none; }
  .operational-nav .nav-item { display: grid; justify-items: center; gap: 2px; min-width: 0; padding: 4px 2px; border-radius: 9px; font-size: 10px; line-height: 1; }
  .operational-nav .nav-item::before { width: 25px; height: 25px; }
  .operational-nav .nav-label { max-width: 100%; text-align: center; }
  .operational-nav .nav-unread { position: absolute; margin: -27px 0 0 24px; }
  .grid-two, .mailbox-layout, .mailbox-shell { grid-template-columns: 1fr; }
  .panel { padding: 18px 15px; }
  .page-head { align-items: flex-start; }
}


/* ==========================================================================
   Spójność 2026 — jeden język wizualny dla wszystkich modułów
   ========================================================================== */

/* Rytm i powierzchnie ---------------------------------------------------- */
.panel, .form-section, .route-builder, .assignment-builder, .lead-form-section,
.search-history-card, .campaign-card, .recipient-panel, .lead-mail-panel, .mailbox-main {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.form-section, .route-builder, .assignment-builder { padding: 26px; margin-bottom: 18px; }
.panel + .panel, .grid-two + .panel { margin-top: 0; }
.subcard, .api-key-card, .person-card, .choice-box, .source-options, .check-group,
.form-check-card, .processing-card, .delay-control, .legal-confirmation, .security-callout,
.route-point-body, details form, blockquote, .code-list, .assignment-title, .reply-box,
.history-metrics, .history-actions, .lead-mail-content, .mailbox-layout {
  border-radius: 12px;
  background: var(--panel-soft);
  border-color: var(--line);
  box-shadow: none;
}
.security-callout, blockquote { border-left: 3px solid var(--brand); border-radius: 0 12px 12px 0; }
.mailbox-layout { border: 1px solid var(--line); box-shadow: none; padding: 10px; }
.search-step::before, .auth-card::before, .lead-form-section-head, .contact-section .lead-form-section-head,
.template-library-bar, .mail-connect-banner, .progress-track span, .score-cell meter::-webkit-meter-optimum-value {
  background: var(--panel-soft);
  background-image: none;
}
.search-step::before { background: var(--brand); }
.progress-track { background: var(--line); }
.progress-track span { background: var(--brand); }
.score-cell meter::-webkit-meter-optimum-value, .score-cell meter::-moz-meter-bar { background: var(--brand); }
.dispatch-summary { border-top: 1px solid var(--line); }
.finance-hero, .order-kpis, .transport-filter-panel, .outreach-head, .mail-page-head { margin-bottom: 18px; }

/* Nagłówki sekcji i kroki ------------------------------------------------ */
.page-head { margin-bottom: 26px; }
.page-head p:last-child { color: var(--muted); }
.section-head, .section-heading, .step-heading, .route-builder-head, .api-panel-head, .lead-form-section-head {
  gap: 14px;
  margin: 0 0 20px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
  background: none;
}
.section-head h2, .section-heading h2, .step-heading h2, .lead-form-section-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.section-head p, .section-heading p, .step-heading p, .lead-form-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.section-heading > span, .step-heading > span, .step-number, .lead-form-section-head .section-mark {
  display: grid; place-items: center;
  min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: 9px;
  background: var(--brand-soft); color: var(--brand);
  font: 700 12px/1 "Public Sans", sans-serif; letter-spacing: .04em;
}
.order-stepper a { color: var(--muted); font-size: 13px; font-weight: 650; }
.order-stepper b { width: 28px; height: 28px; border: 1px solid var(--line-strong); color: var(--muted); background: var(--panel); }
.order-stepper a.current { color: var(--brand); }
.order-stepper a.current b { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.order-stepper a.done { color: var(--success); }
.order-stepper a.done b { border-color: var(--success); background: var(--success); color: var(--panel); }
.order-stepper i { border-top: 1px solid var(--line-strong); }

/* Formularze ------------------------------------------------------------- */
form p { margin: 0 0 16px; }
label, .role-fieldset legend, .format-switch legend { color: var(--ink2); font-size: 13px; font-weight: 600; }
.hint, .help, .form-text, small { color: var(--muted); font-size: 12.5px; }
.errorlist { color: var(--danger); font-size: 12.5px; }
.inline-error, .form-alert { border-radius: 10px; background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }
.role-fieldset > div > div label, .format-switch label, .form-check-card {
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--panel);
  font-weight: 500;
}
.role-fieldset > div > div:has(input:checked) label,
.format-switch label:has(input:checked) {
  border-color: var(--brand); color: var(--brand); background: var(--brand-soft); box-shadow: none;
}
.money-field > div input { border-radius: var(--radius-small) 0 0 var(--radius-small); }
.money-field > div select { border-radius: 0 var(--radius-small) var(--radius-small) 0; border-left: 0; }
.field-with-add > a { top: 30px; width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); }
.input-action .button { min-height: 42px; }
.sticky-actions, .lead-form-actions {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}
.form-actions, .search-actions, .wizard-actions, .api-key-actions, .settings-save { gap: 10px; }
.vies-status.is-valid, .vies-ok { color: var(--success); }
.vies-status.is-invalid, .vies-status.is-error { color: var(--danger); }
.vies-status.is-loading { color: var(--brand); }

/* Listy, wiersze, tabele ------------------------------------------------- */
.status-list a, .list-row, .contact-card, .preview-lead, .query-preview li {
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.status-list a:hover, .list-row:hover, .preview-lead:hover { color: var(--brand); }
.list-row small, .preview-lead small { color: var(--muted); }
.empty-state, .empty-table, .mail-empty, .empty-inline {
  display: grid; justify-items: center; gap: 6px;
  padding: 48px 24px !important;
  color: var(--muted); text-align: center !important;
}
.empty-state > span { width: 52px; height: 52px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-soft); color: var(--brand); }
.pagination { gap: 18px; margin: 24px 0 0; color: var(--muted); font-size: 13.5px; }
dl { grid-template-columns: 170px 1fr; gap: 10px; }
dt { color: var(--muted); font-size: 13px; font-weight: 600; }
dd { font-weight: 600; }
.detail-list > div { border-bottom: 1px solid var(--line); }
.detail-list dt { font-size: 11.5px; letter-spacing: .08em; }
.detail-list dd { margin-top: 4px; font-weight: 650; }

/* Osie czasu ------------------------------------------------------------- */
.timeline article, .event-timeline article { border-left: 1px solid var(--line); padding-left: 16px; }
.route-timeline li:after, .route-rail::before { background: var(--line); opacity: 1; }
.route-marker, .route-point summary b {
  background: var(--brand); color: var(--brand-ink);
  border: 0; box-shadow: none;
}
.route-point { border-radius: 12px; border-color: var(--line); }
.route-point[open] { border-color: var(--brand); box-shadow: none; }
.route-map-card {
  width: 100%;
  min-width: 0;
  place-items: initial;
  align-items: initial;
  justify-items: stretch;
  border-color: var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}
.route-map-card::after, .map-grid { display: none; }
.route-map-copy { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: none; backdrop-filter: none; }
.osm-map { width: 100%; min-width: 0; border-radius: 11px; }

/* Poczta ----------------------------------------------------------------- */
.mailbox-nav a { border-radius: var(--radius-small); color: var(--ink2); font-size: 13.5px; font-weight: 500; }
.mailbox-nav a:hover { background: var(--panel-soft); color: var(--ink-strong); }
.mailbox-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.mail-compose-button { border-radius: var(--radius-small); background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.mail-compose-button:hover { transform: none; box-shadow: none; background: var(--brand-dark); }
.mail-search { border-radius: var(--radius-small); background: var(--panel-soft); }
.mail-search input { min-height: 42px; background: transparent; border: 0; }
.mail-row.unread { background: var(--brand-soft); box-shadow: inset 3px 0 var(--brand); }
.mail-row.unread:after { background: var(--danger); }
.mail-row.mail-needs-attention{background:color-mix(in srgb,var(--danger) 14%,var(--panel));box-shadow:inset 4px 0 var(--danger)}
.mail-row.mail-needs-attention .mail-party,.mail-row.mail-needs-attention .mail-subject strong{color:var(--danger)}
.mail-avatar, .thread-avatar { background: var(--panel-soft); color: var(--ink2); font-weight: 700; }
.mail-row.unread .mail-avatar { background: var(--brand); color: var(--brand-ink); }
.customer-type-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin:10px 0 26px}.customer-type-card{display:grid;grid-template-columns:auto 1fr;gap:8px 12px;padding:24px;border:2px solid var(--line);border-radius:18px;cursor:pointer}.customer-type-card:has(input:checked){border-color:var(--accent);background:var(--brand-soft)}.customer-type-card input{grid-row:1 / 3}.customer-type-card strong{font-size:20px}.customer-type-card span{color:var(--muted)}.bulk-actions{display:flex;flex-wrap:wrap;gap:10px;margin:14px 0}
@media(max-width:680px){.customer-type-cards{grid-template-columns:1fr}}
.mail-lead { border-radius: 999px; background: var(--success-soft); color: var(--success); font-weight: 650; }
.mail-lead.unmatched { background: var(--panel-soft); color: var(--muted); }
.mail-count-pill { border-radius: 999px; background: var(--panel-soft); color: var(--muted); }
.mail-count-pill.unread { background: var(--danger-soft); color: var(--danger); }
.thread-message { border-radius: 12px; border-color: var(--line); box-shadow: none; }
.thread-message.direction-outbound { border-color: var(--brand); background: var(--brand-soft); }
.thread-message header { background: var(--panel-soft); border-bottom: 1px solid var(--line); }
.reply-box { border-color: var(--line); }
.nav-unread { background: var(--danger); color: var(--panel); font-weight: 700; }
.unread-dot { background: var(--danger); box-shadow: none; }
.mailbox-strip { border-radius: 12px; border-color: var(--warning-soft); background: var(--warning-soft); }
.mailbox-strip.connected { border-color: var(--success-soft); background: var(--success-soft); }
.mailbox-dot { background: var(--warning); box-shadow: none; }
.mailbox-strip.connected .mailbox-dot { background: var(--success); }
.html-code-editor { border-color: var(--line-strong); background: var(--ink-strong); color: var(--panel); font-family: "IBM Plex Mono", Consolas, monospace; }
.token-guide code { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); color: var(--brand); }
.send-primary, .mail-button { background: var(--brand); border-color: var(--brand); }

/* Wyszukiwarka i historia ------------------------------------------------ */
.search-history-card:hover { transform: none; box-shadow: var(--shadow-hover); border-color: var(--brand); }
.history-status > strong { font: 700 24px/1 "Public Sans", sans-serif; font-variant-numeric: tabular-nums; }
.history-meta { color: var(--muted); font-size: 11.5px; letter-spacing: .08em; }
.history-meta span::before { background: var(--brand); }
.private-library-badge, .lead-source, .offer-sent-badge, .private-lead-badge, .data-warning, .row-edit-link, .folder-tag {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink2);
  font-size: 11px; font-weight: 650; letter-spacing: 0; text-transform: none;
}
.offer-sent-badge { background: var(--success-soft); color: var(--success); border-color: var(--success-soft); }
.data-warning { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }
.row-edit-link:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.save-lead-button { color: var(--muted); }
.save-lead-button:hover, .save-lead-button.saved { color: var(--warning); }
.saved-button { background: var(--warning-soft) !important; border-color: var(--warning-soft) !important; color: var(--warning) !important; }

/* Rozwijane sekcje i „popupy" -------------------------------------------- */
summary { color: var(--brand); font-weight: 650; }
details[open] > summary { margin-bottom: 4px; }
dialog, .modal, .popover {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-hover);
}
dialog::backdrop { background: oklch(0.25 0.02 60 / .45); }

/* Logowanie i ekrany bez sesji ------------------------------------------- */
.auth-container { min-height: 100vh; place-items: center; }
.auth-card { width: min(430px, 100%); padding: 36px; border-radius: var(--radius); border-color: var(--line); box-shadow: var(--shadow-hover); }
.auth-card::before { display: none; }
.auth-card h1 { font-size: 28px; }
.qr { border: 1px solid var(--line); border-radius: 12px; }
.code-list { border-radius: 12px; }

/* Drobiazgi -------------------------------------------------------------- */
.button.compact { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.button.subtle-danger, .button-danger { border-color: var(--danger); background: var(--danger); color: var(--panel); }
.button.subtle-danger { background: var(--panel); color: var(--danger); }
.button.subtle-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.link-danger { color: var(--danger); }
.route-count, .cell-primary, .company { color: var(--ink-strong); font-weight: 650; }
.company:hover, .contact-email:hover { color: var(--brand); }
.check-cell input, .check-col { accent-color: var(--brand); }
.textual-stat { font-size: 18px !important; }
hr, .panel hr, .mail-context hr { border: 0; border-top: 1px solid var(--line); }
[data-theme="dark"] .html-code-editor { background: oklch(0.14 0.012 60); color: var(--ink); }

/* Poprawki spójności ------------------------------------------------------ */
.section-head > div, .api-panel-head > div, .route-builder-head > div { display: block; }
.section-head > div > div { display: block; }
.button, .mail-compose-button, .row-save { white-space: nowrap; }
.brand > span:last-child { white-space: nowrap; }
.brand > span:last-child strong { display: inline; }
.page-head .button { flex: 0 0 auto; }
.grid-two { gap: 20px; }
.actions { gap: 8px; }

/* Kontrast na ciemnej belce ---------------------------------------------- */
.brand, .brand strong, .brand > span:last-child, .topbar nav a, .user-menu, .user-chip { color: var(--nav-ink); }
.brand small, .link-button, .topbar nav a:not(.active) { color: var(--nav-muted); }
.brand:hover, .link-button:hover, .topbar nav a:hover { color: var(--nav-ink); }
.brand-mark i { background: var(--brand-ink); }
.nav-unread { color: oklch(0.99 0.002 80); }
.app-footer, .app-footer span { color: var(--muted); }
.app-footer span:first-child { color: var(--ink-strong); }

/* Final cascade guard: these rules must remain at the end of the file. */
.app-shell { grid-template-columns: 238px minmax(0, 1fr); }
.sidenav { top: 68px; height: calc(100vh - 68px); padding: 22px 14px; }
.container { width: 100%; max-width: 1780px; padding: 36px clamp(24px, 2.6vw, 48px) 72px; }
.operational-nav .nav-item::before { display: none; content: none; }
.nav-item { min-height: 44px; padding: 9px 11px; color: var(--ink2); font-size: 14px; }
.nav-icon { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 27px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); color: var(--muted); }
.nav-icon svg { width: 17px; height: 17px; fill: currentColor; }
.nav-item.active .nav-icon { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.mobile-only-nav { display: none; }
.mailbox-nav-subs { margin: 2px 0 10px 23px; padding: 5px 0 5px 15px; }
.mailbox-nav-subs a { min-height: 34px; padding: 6px 8px; }
.mailbox-nav-subs a > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub-icon { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; color: var(--muted); }
.nav-sub-icon svg { width: 15px; height: 15px; fill: currentColor; }
.mailbox-state { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--line-strong); }
.mailbox-state.is-connected { background: var(--success); }
.button, a.button, button.button, .mail-compose-button, .row-save { color: var(--brand-ink); }

/* Order finance, transport editing and regular mailbox composer */
.transport-money-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;margin:0 0 18px;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:var(--line)}
.transport-money-summary>div{display:grid;gap:5px;padding:15px 18px;background:var(--panel)}
.transport-money-summary span{color:var(--muted);font-size:.72rem;font-weight:750;text-transform:uppercase;letter-spacing:.045em}
.transport-money-summary strong{font-size:1.05rem;color:var(--ink-strong)}
.assignment-title [data-remove-assignment]{margin-left:auto;color:var(--danger);border-color:color-mix(in srgb,var(--danger) 35%,var(--line))}
.assignment-delete-field{display:none}
.invoice-issue-inline{display:flex;align-items:end;gap:8px;padding:7px;border:1px solid var(--line);border-radius:var(--radius-small);background:var(--panel)}
.invoice-issue-inline label{display:grid;gap:3px;margin:0;color:var(--muted);font-size:.7rem;font-weight:750}
.invoice-issue-inline input{width:120px;min-height:38px;padding:7px 10px}
.mail-offer-link{display:block;margin:-9px 12px 15px;color:var(--brand);font-size:.78rem;font-weight:750;text-align:center;text-decoration:none}
.mail-offer-link:hover{text-decoration:underline}
.mail-compose-panel{max-width:920px;margin-inline:auto}
.mail-message-form textarea{min-height:300px;resize:vertical}
.action-menu button.danger{color:var(--danger)}
@media(max-width:760px){.transport-money-summary{grid-template-columns:1fr}.invoice-issue-inline{width:100%;align-items:stretch;flex-direction:column}.invoice-issue-inline input{width:100%}.mail-message-form .form-grid{grid-template-columns:1fr}.mail-message-form .span-2{grid-column:auto}}
.button.secondary, .button.ghost, .button-secondary, .button-quiet,
a.button.secondary, a.button.ghost, a.button-secondary, a.button-quiet,
button.button.secondary, button.button.ghost, button.button-secondary, button.button-quiet,
.order-ledger-actions .button.button-quiet { border-color: var(--line-strong); background: var(--panel); color: var(--brand); box-shadow: none; }
.button.secondary:hover, .button.ghost:hover, .button-secondary:hover, .button-quiet:hover,
.order-ledger-actions .button.button-quiet:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.order-ledger { gap: 16px; }
.order-ledger-card { border-radius: 15px; }
.order-ledger-head { grid-template-columns: minmax(220px, .65fr) minmax(280px, 1.35fr) auto; padding: 16px 20px; }
.order-route-rail { padding: 13px 22px; }
.order-route-rail li { grid-template-columns: 34px minmax(0, 1fr) auto; min-height: 59px; gap: 13px; }
.order-route-rail li:not(:last-child)::after { top: 44px; bottom: -15px; left: 16px; background: var(--line-strong); }
.stop-icon { width: 33px; height: 33px; box-shadow: 0 0 0 4px var(--panel); }
.stop-icon svg { width: 17px; height: 17px; fill: currentColor; }

@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 218px minmax(0, 1fr); }
  .container { padding: 30px 26px 64px; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidenav { position: static; top: auto; width: 100%; height: auto; display: flex; padding: 9px 14px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .nav-group { display: flex; align-items: center; gap: 5px; margin: 0; }
  .nav-group > p, .nav-subs { display: none; }
  .nav-item { min-width: max-content; min-height: 42px; }
  .container { padding: 26px 20px 58px; }
  .order-ledger-head { grid-template-columns: 1fr auto; }
  .order-ledger-head .order-client { grid-column: 1 / -1; grid-row: 2; }
  .order-ledger-body { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  body { padding-bottom: 76px; }
  .topbar { position: sticky; top: 0; z-index: 40; min-height: 58px; }
  .top-actions a:not(:first-child) { display: none; }
  .theme-toggle [data-theme-label], .user-chip span { display: none; }
  .theme-toggle { min-width: 36px; width: 36px; padding: 0; border-radius: 999px; }
  .sidenav { position: fixed; z-index: 35; right: 0; bottom: 0; left: 0; top: auto; height: 70px; display: block; padding: 6px max(7px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left)); border: 0; border-top: 1px solid var(--line); background: var(--panel); }
  .operational-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: 3px; }
  .operational-nav > p, .operational-nav .nav-subs { display: none; }
  .operational-nav .mobile-only-nav { display: grid; }
  .operational-nav .nav-item { display: grid; justify-items: center; gap: 2px; min-width: 0; min-height: 57px; padding: 3px 1px; border-radius: 9px; font-size: 9.5px; line-height: 1; }
  .operational-nav .nav-label { max-width: 100%; text-align: center; }
  .container { padding: 20px 14px 40px; overflow-x: hidden; }
  .order-ledger-head { grid-template-columns: 1fr; gap: 8px; padding: 14px 15px; }
  .order-ledger-head .order-client { grid-column: auto; grid-row: auto; }
  .order-route-rail { padding: 10px 14px; }
  .order-route-rail li { grid-template-columns: 33px minmax(0, 1fr); }
  .stop-kind { display: none; }
  .order-ledger-actions .button, .order-ledger-actions form, .order-ledger-actions form .button { width: 100%; }
}

/* Wide lead tables and pipeline chips scroll inside their own panels. */
.app-shell > .container { min-width: 0; }
.stage-legend, .table-wrap { max-width: 100%; min-width: 0; }
@media (max-width: 700px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .topbar { max-width: 100vw; overflow: hidden; }
  .stage-legend { width: 100%; overscroll-behavior-inline: contain; }
}

/* Transport workspace: wide-screen scale and responsive alignment.
   Keep this block last so older transport rules cannot undo the layout. */
.transport-editor,
.wizard-head {
  width: min(100%, 1520px);
}

.transport-editor .form-section,
.transport-editor .route-builder,
.transport-editor .assignment-builder {
  padding: clamp(24px, 2vw, 32px);
}

.transport-editor .transport-grid {
  column-gap: clamp(20px, 2vw, 32px);
}

.order-route-rail {
  --route-stop-size: 34px;
  --route-line-width: 2px;
}

.order-route-rail li {
  grid-template-columns: var(--route-stop-size) minmax(0, 1fr) auto;
}

.order-route-rail li:not(:last-child)::after {
  left: calc((var(--route-stop-size) - var(--route-line-width)) / 2);
  width: var(--route-line-width);
}

.order-route-rail .stop-icon {
  display: grid;
  width: var(--route-stop-size);
  height: var(--route-stop-size);
  place-items: center;
  align-self: center;
  justify-self: center;
  padding: 0;
  line-height: 1;
}

.order-route-rail .stop-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0;
  overflow: visible;
}

.route-timeline .route-marker {
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}

.route-timeline .route-marker svg {
  display: block;
  width: 18px;
  height: 18px;
}

@media (min-width: 1400px) {
  .wizard-head {
    margin-bottom: 28px;
  }

  .transport-editor .form-section {
    margin-bottom: 22px;
  }
}

/* Compact route and repeatable cost controls -------------------------------- */
.additional-cost-builder {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--brand-soft);
}

.additional-cost-head,
.route-add-actions,
.additional-cost-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.additional-cost-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.additional-cost-head h3,
.additional-cost-head p,
.additional-cost-row p {
  margin: 0;
}

.additional-cost-head p {
  color: var(--muted);
  font-size: .8rem;
}

.additional-cost-list {
  display: grid;
  gap: 10px;
}

.additional-cost-row {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(130px, 1fr) auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.cost-remove,
.route-delete {
  color: var(--danger, #9f2238);
  font-weight: 700;
  cursor: pointer;
}

.route-add-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.transport-editor .route-builder {
  padding: clamp(18px, 1.7vw, 26px);
}

.transport-editor .route-builder-head {
  margin-bottom: 16px;
}

.transport-editor .route-rail {
  gap: 10px;
}

.transport-editor .route-point-compact summary {
  min-height: 58px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.transport-editor .route-point-compact .route-point-body {
  padding-top: 14px;
  padding-bottom: 4px;
}

.transport-editor .route-point-compact .transport-grid {
  row-gap: 12px;
}

.transport-editor .route-point-compact .transport-grid > p,
.transport-editor .route-point-compact .transport-grid > fieldset,
.transport-editor .route-point-compact .transport-grid > div {
  margin-top: 0;
  margin-bottom: 6px;
}

.transport-editor .route-point-compact input:not([type="radio"]):not([type="checkbox"]),
.transport-editor .route-point-compact select {
  min-height: 40px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.transport-editor .route-map-card {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
}

.transport-editor .route-map-card .osm-map {
  width: 100%;
  min-height: 330px;
}

@media (max-width: 700px) {
  .additional-cost-head {
    align-items: stretch;
    flex-direction: column;
  }

  .additional-cost-head .button,
  .route-add-actions .button {
    flex: 1 1 130px;
  }

  .additional-cost-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .route-add-actions {
    width: 100%;
  }

  .transport-editor .route-map-card .osm-map {
    min-height: 260px;
  }
}

/* Mobile navigation guard -------------------------------------------------
   Phones and compact tablets keep the operational navigation within reach.
   This block stays last so legacy tablet rules cannot turn it into a
   non-sticky strip above the page content. */
@media (max-width: 900px) {
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .sidenav {
    position: fixed;
    z-index: 50;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(70px + env(safe-area-inset-bottom));
    display: block;
    overflow: visible;
    padding: 6px max(7px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
    border: 0;
    border-top: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 -8px 24px color-mix(in oklab, var(--nav) 10%, transparent);
  }

  .operational-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    align-items: stretch;
    gap: 3px;
    width: 100%;
    margin: 0;
  }

  .operational-nav > p,
  .operational-nav .nav-subs {
    display: none;
  }

  .operational-nav .mobile-only-nav {
    display: grid;
  }

  .operational-nav .nav-item {
    position: relative;
    display: grid;
    grid-template-rows: 29px 13px;
    place-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 57px;
    padding: 3px 1px;
    border-radius: 9px;
    font-size: 9.5px;
    line-height: 1;
  }

  .operational-nav .nav-icon {
    width: 27px;
    height: 27px;
  }

  .operational-nav .nav-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operational-nav .nav-unread {
    position: absolute;
    top: 1px;
    left: calc(50% + 7px);
    margin: 0;
  }

  .app-shell + .app-footer {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 701px) and (max-width: 900px) {
  .transport-editor .transport-grid,
  .transport-editor .people-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transport-editor .transport-grid .span-2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .wizard-head {
    gap: 18px;
    margin-bottom: 18px;
  }

  .transport-editor .form-section,
  .transport-editor .route-builder,
  .transport-editor .assignment-builder {
    padding: 18px 15px;
  }

  .transport-editor .section-heading {
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .transport-editor .section-heading > span {
    min-width: 30px;
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .transport-editor .transport-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .transport-editor .transport-grid .span-2 {
    grid-column: auto;
  }

  .transport-editor .route-point-body,
  .transport-editor .assignment-card > section,
  .transport-editor .assignment-card > .transport-grid {
    padding-right: 14px;
    padding-left: 14px;
  }

  .transport-editor .coordinate-fields > div,
  .transport-editor .input-action,
  .transport-editor .money-field > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .transport-editor .input-action .button,
  .transport-editor .carrier-picker .button {
    width: 100%;
  }

  .order-route-rail {
    --route-stop-size: 34px;
  }

  .order-route-rail li {
    grid-template-columns: var(--route-stop-size) minmax(0, 1fr);
  }
}

@media (max-width: 430px) {
  .transport-editor .form-section,
  .transport-editor .route-builder,
  .transport-editor .assignment-builder {
    border-radius: 12px;
  }

  .transport-editor .role-fieldset > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .transport-editor .role-fieldset > div > div,
  .transport-editor .role-fieldset > div > div label {
    width: 100%;
  }
}

/* Operations directory — final cascade guard. */
.directory-tabs { display:flex; gap:6px; margin:-10px 0 22px; padding:5px; width:max-content; max-width:100%; overflow-x:auto; border:1px solid var(--line); border-radius:11px; background:var(--panel-soft); }
.directory-tabs a { padding:9px 15px; border-radius:8px; color:var(--muted); font-size:13px; font-weight:700; white-space:nowrap; }
.directory-tabs a:hover { color:var(--ink-strong); }
.directory-tabs a.active { background:var(--panel); color:var(--brand); box-shadow:0 2px 8px color-mix(in oklab,var(--nav) 8%,transparent); }
.directory-table .row-actions { flex-wrap:wrap; justify-content:flex-end; }
.directory-table .row-actions form { margin:0; }
.directory-table .link-button { color:var(--brand); font-weight:700; }

@media (max-width:900px) {
  .operational-nav .directory-desktop { display:none; }
}

@media (max-width:700px) {
  .directory-tabs { width:100%; margin:-4px 0 16px; }
  .directory-tabs a { flex:1; text-align:center; }
  .directory-table-wrap { overflow:visible; padding:0; border:0; background:transparent; box-shadow:none; }
  .directory-table { display:block; min-width:0; }
  .directory-table thead { display:none; }
  .directory-table tbody { display:grid; gap:12px; }
  .directory-table tr { display:grid; grid-template-columns:1fr 1fr; gap:0; overflow:hidden; border:1px solid var(--line); border-radius:12px; background:var(--panel); box-shadow:var(--shadow); }
  .directory-table td { display:grid; grid-template-columns:minmax(78px,.42fr) 1fr; align-items:start; gap:9px; padding:10px 13px; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
  .directory-table td::before { content:attr(data-label); color:var(--muted); font-size:10px; font-weight:750; letter-spacing:.06em; text-transform:uppercase; }
  .directory-table td:first-child,.directory-table td:last-child { grid-column:1/-1; }
  .directory-table td:not(:first-child):not(:last-child) { grid-template-columns:1fr; gap:5px; }
  .directory-table td:first-child { padding-top:14px; }
  .directory-table td:last-child { border-bottom:0; }
  .directory-table .row-actions { justify-content:flex-start; }
  .directory-table .empty-state { display:block; grid-column:1/-1; }
  .directory-table .empty-state::before { display:none; }
}
