:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-border: #d9e0e7;
  --text: #18202a;
  --muted: #647282;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --line: #e7edf2;
  --warn-bg: #fef3c7;
  --panel-raised-border: #d5dee8;
  --panel-raised-shadow: 0 14px 34px rgb(15 23 42 / 7%), inset 0 1px 0 rgb(255 255 255 / 78%);
  --panel-header-bg: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.auth-body {
  min-height: 100vh;
  background: #050817;
}

.app-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--panel-border);
}

.auth-body .app-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  background: linear-gradient(180deg, rgb(3 7 18 / 72%), rgb(3 7 18 / 36%));
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  backdrop-filter: blur(18px) saturate(1.3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.auth-body .brand {
  color: #f8fafc;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 32px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
}

.auth-body .brand-mark {
  background: linear-gradient(135deg, #0f766e, #0891b2);
  box-shadow: 0 12px 30px rgb(15 118 110 / 28%);
}

.brand-name {
  font-size: 17px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.top-nav a,
.top-nav button,
.user-menu > button,
.user-menu-panel a,
.user-menu-panel button {
  color: var(--muted);
  background: transparent;
  border: 0;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
}


.nav-button-avito {
  align-items: center;
  display: inline-flex;
  gap: 7px;
}

.nav-icon-avito {
  display: inline-block;
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.top-nav a.active,
.top-nav a:hover,
.top-nav button.active,
.top-nav button:hover,
.user-menu > button.active,
.user-menu > button:hover {
  background: #ecfdf5;
  color: var(--accent-strong);
}

.nav-group {
  position: relative;
}

.nav-group::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
}

.nav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 190px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: 0 14px 35px rgb(15 23 42 / 12%);
  z-index: 20;
}

.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
  display: block;
}

.nav-menu a {
  display: block;
}

.nav-menu-more {
  min-width: 230px;
}

.nav-menu-section-title {
  padding: 8px 10px 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.nav-menu-section-title:not(:first-child) {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.nav-menu a.nav-menu-link-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-menu a.nav-menu-subitem {
  padding-left: 20px;
}

.user-menu {
  position: relative;
}

.user-menu::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
}

.user-menu > button {
  border: 1px solid var(--panel-border);
}

.user-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: 0 14px 35px rgb(15 23 42 / 12%);
  z-index: 20;
}

.user-menu:hover .user-menu-panel,
.user-menu:focus-within .user-menu-panel {
  display: block;
}

.nav-group.is-open .nav-menu,
.user-menu.is-open .user-menu-panel {
  display: block;
}

.mobile-header-menu-panel[hidden] {
  display: none !important;
}

.mobile-header-menu-panel {
  position: fixed;
  top: var(--mobile-header-menu-top, 96px);
  left: 10px;
  right: 10px;
  z-index: 200;
  max-height: calc(100vh - var(--mobile-header-menu-top, 96px) - 10px);
  overflow: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgb(15 23 42 / 18%);
}

.mobile-header-menu-panel a,
.mobile-header-menu-panel form,
.mobile-header-menu-panel button {
  width: 100%;
}

.mobile-header-menu-panel form {
  margin: 0;
}

.mobile-header-menu-panel a,
.mobile-header-menu-panel button {
  display: block;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
}

.mobile-header-menu-panel a.active,
.mobile-header-menu-panel a:hover,
.mobile-header-menu-panel button:hover {
  background: #ecfdf5;
  color: var(--accent-strong);
}

.mobile-header-menu-panel select {
  width: 100%;
  min-height: 36px;
  margin: 0 0 6px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0 10px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.user-menu-panel a,
.user-menu-panel form,
.user-menu-panel button {
  width: 100%;
}

.user-menu-panel form {
  margin: 0;
}

.user-menu-panel a,
.user-menu-panel button {
  display: block;
  text-align: left;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: #ecfdf5;
  color: var(--accent-strong);
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.data-freshness-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.data-freshness-light {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 4px rgb(148 163 184 / 16%);
}

.data-freshness-indicator.is-fresh {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.data-freshness-indicator.is-fresh .data-freshness-light {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgb(22 163 74 / 16%);
}

.data-freshness-indicator.is-stale {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.data-freshness-indicator.is-stale .data-freshness-light {
  background: #dc2626;
  box-shadow: 0 0 0 4px rgb(220 38 38 / 16%);
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 28px 28px;
}

.auth-page-shell {
  max-width: none;
  min-height: 100vh;
  padding: 0;
}

.blank-page {
  min-height: calc(100vh - 120px);
}

.page-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.breadcrumbs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.breadcrumbs-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  white-space: nowrap;
}

.breadcrumbs a,
.breadcrumbs span {
  color: inherit;
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent-strong);
}

.breadcrumbs span:last-child {
  color: var(--text);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.15;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

h2 {
  font-size: 18px;
}

.status-pill {
  border: 1px solid #b7e4d6;
  background: #ecfdf5;
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.work-panel,
.table-panel {
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  box-shadow: var(--panel-raised-shadow);
}

.metric-card {
  padding: 18px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.metric-card p,
.work-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-page {
  display: grid;
  gap: 18px;
}

.dashboard-title {
  align-items: center;
  margin-bottom: 0;
}

.dashboard-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-status span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #94a3b8;
}

.dashboard-status.is-fresh {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.dashboard-status.is-fresh span {
  background: #16a34a;
}

.dashboard-status.is-stale {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.dashboard-status.is-stale span {
  background: #dc2626;
}

.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-metric-card {
  display: grid;
  min-height: 190px;
  min-width: 0;
  align-content: space-between;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.dashboard-metric-card--sales {
  border-top: 4px solid #2563eb;
}

.dashboard-metric-card--shipping {
  border-top: 4px solid #16a34a;
}

.dashboard-metric-card--purchase {
  border-top: 4px solid #d97706;
}

.dashboard-metric-card--receipt {
  border-top: 4px solid #0891b2;
}

.dashboard-metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-metric-primary {
  display: grid;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.dashboard-metric-card strong {
  min-width: 0;
  color: var(--text);
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.dashboard-metric-card small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-metric-primary:hover strong,
.dashboard-metric-total:hover b {
  color: var(--accent-strong);
}

.dashboard-metric-total {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.dashboard-metric-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-metric-total b {
  min-width: 0;
  color: var(--text);
  font-size: clamp(16px, 1.35vw, 18px);
  line-height: 1.15;
  overflow-wrap: normal;
}

.money-value {
  white-space: nowrap;
}

.dashboard-money-panel {
  display: grid;
  grid-template-columns: minmax(260px, .48fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.dashboard-money-head {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-top: 4px solid #0f766e;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.dashboard-money-head strong {
  min-width: 0;
  color: var(--text);
  font-size: clamp(24px, 2.6vw, 34px);
  line-height: 1.08;
}

.dashboard-money-head small,
.dashboard-money-item small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-money-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.dashboard-money-item {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  border-top: 4px solid #cbd5e1;
}

.dashboard-money-item + .dashboard-money-item {
  border-left: 1px solid var(--line);
}

.dashboard-money-item--cash {
  border-top-color: #16a34a;
}

.dashboard-money-item--noncash {
  border-top-color: #0891b2;
}

.dashboard-money-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-money-item b {
  min-width: 0;
  color: var(--text);
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.1;
}

.dashboard-money-item:hover b {
  color: var(--accent-strong);
}

.dashboard-reserve-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .28fr);
  overflow: hidden;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.dashboard-reserve-link {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 18px;
  border-top: 4px solid #dc2626;
  color: inherit;
  text-decoration: none;
}

.dashboard-reserve-link span,
.dashboard-reserve-aside span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-reserve-link strong {
  min-width: 0;
  color: var(--text);
  font-size: clamp(24px, 2.8vw, 36px);
  line-height: 1.08;
}

.dashboard-reserve-link small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-reserve-link:hover strong {
  color: var(--accent-strong);
}

.dashboard-reserve-aside {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
  padding: 18px;
  border-left: 1px solid var(--line);
  border-top: 4px solid #d97706;
  background: #fbfdff;
}

.dashboard-reserve-aside b {
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
}

.dashboard-profit-panel {
  display: grid;
  grid-template-columns: minmax(280px, .72fr) repeat(3, minmax(170px, .34fr));
  overflow: hidden;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.dashboard-profit-main,
.dashboard-profit-cell {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
  padding: 18px;
  border-top: 4px solid #16a34a;
}

.dashboard-profit-cell {
  border-left: 1px solid var(--line);
  border-top-color: #2563eb;
  background: #fbfdff;
}

.dashboard-profit-cell + .dashboard-profit-cell {
  border-top-color: #0891b2;
}

.dashboard-profit-expenses {
  border-top-color: #dc2626;
}

.dashboard-profit-main span,
.dashboard-profit-cell span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-profit-main strong {
  min-width: 0;
  color: var(--text);
  font-size: clamp(24px, 2.8vw, 36px);
  line-height: 1.08;
}

.dashboard-profit-cell b {
  min-width: 0;
  color: var(--text);
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.1;
}

.dashboard-profit-main small,
.dashboard-profit-cell small,
.dashboard-profit-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-profit-link {
  width: fit-content;
  text-decoration: none;
}

.dashboard-profit-link:hover,
.dashboard-profit-link:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
}

.dashboard-report-panel {
  display: grid;
  grid-template-columns: minmax(260px, .36fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.dashboard-report-main {
  display: grid;
  align-content: center;
  gap: 10px;
  min-width: 0;
  padding: 18px;
  border-top: 4px solid #4f46e5;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.dashboard-report-main span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-report-main strong {
  color: var(--text);
  font-size: clamp(20px, 2vw, 27px);
  line-height: 1.08;
}

.dashboard-report-download,
.dashboard-report-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 14px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.dashboard-report-form {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border-top: 4px solid #0f766e;
}

.dashboard-report-recipients {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  min-width: 0;
}

.dashboard-report-recipient {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 9px;
  row-gap: 2px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
}

.dashboard-report-recipient input {
  grid-row: 1 / span 2;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.dashboard-report-recipient span {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-report-recipient small,
.dashboard-report-empty,
.dashboard-report-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-report-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.dashboard-report-actions button:disabled {
  cursor: not-allowed;
  opacity: .62;
}

.dashboard-report-actions span {
  min-width: 0;
  text-align: right;
}

.dashboard-report-actions span.is-progress {
  color: var(--muted);
}

.dashboard-report-actions span.is-success {
  color: #166534;
}

.dashboard-report-actions span.is-error {
  color: #991b1b;
}


.dashboard-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.dashboard-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  min-width: 0;
  border-radius: 6px;
  color: var(--muted);
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.dashboard-tab:hover,
.dashboard-tab:focus-visible {
  color: var(--accent-strong);
  background: #eef6ff;
}

.dashboard-tab.is-active {
  background: var(--accent);
  color: #ffffff;
}

.dashboard-operational-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.dashboard-operational-toolbar > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-operational-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-operational-toolbar strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.1;
}

.dashboard-operational-period {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.dashboard-operational-period a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 6px;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.dashboard-operational-period a:hover,
.dashboard-operational-period a:focus-visible {
  color: var(--accent-strong);
  background: #eef6ff;
}

.dashboard-operational-period a.is-active {
  background: var(--accent);
  color: #ffffff;
}

.trade-reps-page {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.trade-reps-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.trade-reps-heading {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.trade-reps-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
}

.trade-reps-heading span,
.trade-rep-header span,
.trade-rep-kpi span,
.trade-rep-stat span,
.trade-rep-gap-list span,
.trade-rep-group-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trade-reps-period-panel {
  display: grid;
  justify-items: end;
  gap: 9px;
  min-width: 0;
}

.trade-reps-period-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.trade-reps-period-switch a,
.trade-reps-period-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
  color: var(--muted);
  padding: 8px 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.trade-reps-period-switch a.is-active,
.trade-reps-period-form button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.trade-reps-period-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.trade-reps-period-form label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trade-reps-period-form input {
  min-height: 36px;
  max-width: 145px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.trade-reps-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.trade-rep-block {
  display: grid;
  gap: 14px;
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.trade-rep-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 18px 18px 0;
}

.trade-rep-header div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.trade-rep-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}

.trade-rep-header b {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 45%;
  overflow: hidden;
  border-radius: 6px;
  background: color-mix(in srgb, var(--rep-accent) 12%, white);
  color: var(--rep-accent);
  padding: 7px 10px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-rep-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  min-width: 0;
  border-top: 4px solid var(--rep-accent);
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.trade-rep-kpi,
.trade-rep-stat {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  background: #ffffff;
  padding: 14px;
}

.trade-rep-kpi strong {
  min-width: 0;
  color: var(--text);
  font-size: clamp(19px, 2.2vw, 27px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.trade-rep-kpi small,
.trade-rep-stat small,
.trade-rep-group-list small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.trade-rep-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  min-width: 0;
  background: var(--line);
}

.trade-rep-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  background: #fbfdff;
  padding: 16px 18px 18px;
}

.trade-rep-panel h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.15;
}

.trade-rep-panel--assortment,
.trade-rep-panel--focus {
  grid-column: 1 / -1;
}

.trade-rep-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.trade-rep-stat-grid--clients,
.trade-rep-stat-grid--debt {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.trade-rep-stat-grid--assortment {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.trade-rep-stat-grid--focus {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.trade-rep-focus-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.trade-rep-focus-row {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.trade-rep-focus-row h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.trade-rep-stat strong {
  min-width: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.trade-rep-stat--revenue,
.trade-rep-kpi--revenue {
  border-top: 3px solid #2563eb;
}

.trade-rep-stat--profit,
.trade-rep-kpi--profit {
  border-top: 3px solid #16a34a;
}

.trade-rep-stat--margin,
.trade-rep-kpi--margin,
.trade-rep-stat--customer,
.trade-rep-kpi--customer {
  border-top: 3px solid #0f766e;
}

.trade-rep-stat--plan,
.trade-rep-kpi--plan,
.trade-rep-stat--assortment,
.trade-rep-kpi--assortment {
  border-top: 3px solid #d97706;
}

.trade-rep-stat--risk,
.trade-rep-kpi--risk {
  border-top: 3px solid #be123c;
}

.trade-rep-stat--debt,
.trade-rep-kpi--debt {
  border-top: 3px solid #4f46e5;
}

.trade-rep-bar {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.trade-rep-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--rep-accent);
}

.trade-rep-gap-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.trade-rep-gap-list > div,
.trade-rep-gap-list > a {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.trade-rep-gap-list strong {
  color: var(--text);
  font-size: 17px;
  line-height: 1.1;
}

.trade-rep-group-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trade-rep-group-list li {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.trade-rep-group-list div:first-child {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.trade-rep-group-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-rep-group-list b {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.trade-rep-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .trade-rep-kpis,
  .trade-rep-stat-grid,
  .trade-rep-stat-grid--clients,
  .trade-rep-stat-grid--debt,
  .trade-rep-stat-grid--assortment,
  .trade-rep-stat-grid--focus,
  .trade-rep-group-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trade-rep-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dashboard-tabs,
  .dashboard-operational-toolbar,
  .trade-reps-toolbar,
  .trade-rep-header,
  .trade-reps-period-panel,
  .trade-reps-period-switch,
  .trade-reps-period-form {
    width: 100%;
  }

  .dashboard-tabs,
  .dashboard-operational-toolbar,
  .trade-reps-toolbar,
  .trade-rep-header {
    align-items: stretch;
  }

  .dashboard-tabs,
  .dashboard-operational-toolbar,
  .trade-reps-toolbar,
  .trade-rep-header {
    flex-direction: column;
  }

  .dashboard-tab,
  .dashboard-operational-period a,
  .trade-reps-period-switch a,
  .trade-reps-period-form button {
    width: 100%;
  }

  .trade-reps-period-panel,
  .trade-reps-period-switch,
  .trade-reps-period-form {
    justify-items: stretch;
    justify-content: stretch;
  }

  .trade-reps-period-form label,
  .trade-reps-period-form input {
    width: 100%;
    max-width: none;
  }

  .trade-rep-header b {
    max-width: none;
  }

  .trade-rep-kpis,
  .trade-rep-stat-grid,
  .trade-rep-stat-grid--clients,
  .trade-rep-stat-grid--debt,
  .trade-rep-stat-grid--assortment,
  .trade-rep-stat-grid--focus,
  .trade-rep-gap-list,
  .trade-rep-group-list {
    grid-template-columns: 1fr;
  }
}



.trade-reps-settings-link {
  width: fit-content;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.trade-reps-settings-link:hover,
.trade-reps-settings-link:focus-visible {
  text-decoration: underline;
}

.trade-settings-month {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-bottom: 14px;
}

.trade-settings-month a,
.trade-settings-month button,
.trade-settings-plan-form button,
.trade-settings-focus-form button,
.trade-settings-focus-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  padding: 9px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.trade-settings-month a {
  width: 38px;
  padding: 0;
  font-size: 20px;
}

.trade-settings-month label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trade-settings-month input,
.trade-settings-plan-row input,
.trade-settings-focus-form select {
  min-height: 38px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
}

.trade-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .72fr);
  gap: 14px;
  min-width: 0;
}

.trade-settings-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.trade-settings-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.trade-settings-panel-head div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.trade-settings-panel-head span,
.trade-settings-plan-row span,
.trade-settings-plan-row small,
.trade-settings-focus-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trade-settings-panel-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}

.trade-settings-panel-head strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
}

.trade-settings-plan-form,
.trade-settings-focus-form {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.trade-settings-plan-grid {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.trade-settings-plan-row {
  display: grid;
  grid-template-columns: minmax(110px, .7fr) minmax(180px, 1fr) minmax(120px, .45fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  background: #fbfdff;
  padding: 12px;
}

.trade-settings-plan-row span,
.trade-settings-plan-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-settings-plan-row input {
  text-align: right;
}

.trade-settings-focus-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.trade-settings-focus-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.trade-settings-focus-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.trade-settings-focus-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.trade-settings-focus-row strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-settings-focus-row button {
  min-height: 34px;
  background: #f1f5f9;
  color: var(--muted);
}

@media (max-width: 920px) {
  .trade-settings-layout,
  .trade-settings-plan-row,
  .trade-settings-focus-form,
  .trade-settings-focus-row {
    grid-template-columns: 1fr;
  }

  .trade-settings-plan-row input {
    text-align: left;
  }
}


.work-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
}

.primary-link,
.toolbar button {
  border: 0;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 700;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 11px 12px;
  font-size: 15px;
}

.toolbar select {
  min-width: 150px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 0 10px;
}

.document-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, .25fr) minmax(150px, .25fr) auto auto;
  align-items: end;
}

.document-toolbar .document-search {
  width: 100%;
}

.toolbar-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.toolbar-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.toolbar-field input {
  width: 100%;
}

.secondary-link {
  align-items: center;
  align-self: stretch;
  background: #ffffff;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--accent-strong);
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
  text-decoration: none;
  white-space: nowrap;
}

.secondary-link:hover {
  background: #ecfdf5;
}

.products-toolbar {
  align-items: center;
}

.recommendations-toolbar {
  align-items: stretch;
  flex-wrap: wrap;
}

.recommendations-toolbar > input[name="q"] {
  flex: 1 1 260px;
}

.recommendations-toolbar label {
  display: grid;
  min-width: 86px;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.recommendations-toolbar label input {
  min-width: 76px;
  width: 86px;
  padding: 8px 9px;
  font-size: 14px;
}

.recommendations-toolbar .checkbox-field {
  display: inline-flex;
  align-items: center;
  min-width: 150px;
  min-height: 42px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
  text-transform: none;
}

.recommendations-toolbar .checkbox-field input {
  flex: 0 0 auto;
  min-width: 0;
  width: auto;
}

.mode-toggle,
.mode-switch {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.mode-toggle {
  gap: 8px;
  padding: 0 12px;
}

.mode-toggle input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
}

.mode-switch {
  overflow: hidden;
}

.mode-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  color: var(--muted);
  text-decoration: none;
}

.mode-switch a.active {
  background: #ecfdf5;
  color: var(--accent-strong);
}

.table-panel {
  overflow: visible;
}

.analytics-section {
  margin-top: 18px;
}

.finance-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.payments-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(148px, .25fr) minmax(140px, .22fr) repeat(2, minmax(138px, .2fr)) auto auto;
  align-items: end;
}

.payments-toolbar .payments-search {
  width: 100%;
}

.payments-toolbar .secondary-link {
  min-height: 42px;
}

.finance-table-wrap table {
  min-width: 1680px;
}

.finance-table th:nth-child(1),
.finance-table td:nth-child(1) {
  width: 132px;
}

.finance-table th:nth-child(2),
.finance-table td:nth-child(2) {
  min-width: 230px;
  white-space: normal;
}

.finance-table th:nth-child(5),
.finance-table td:nth-child(5),
.finance-table th:nth-child(9),
.finance-table td:nth-child(9) {
  min-width: 260px;
  white-space: normal;
}

.finance-lines-wrap table {
  min-width: 1240px;
}

.finance-lines-table th:nth-child(3),
.finance-lines-table td:nth-child(3),
.finance-lines-table th:nth-child(4),
.finance-lines-table td:nth-child(4),
.finance-lines-table th:nth-child(8),
.finance-lines-table td:nth-child(8) {
  min-width: 260px;
  white-space: normal;
}

.receivables-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.receivables-source-panel {
  margin-bottom: 4px;
}

.receivables-toolbar {
  display: grid;
  grid-template-columns: minmax(290px, 1fr) 160px 190px 88px 118px 118px;
  align-items: stretch;
  gap: 8px;
  margin: 10px 0 12px;
  max-width: 1012px;
}

.receivables-toolbar .logistics-filter-field {
  min-width: 0;
  padding: 6px 10px 7px;
}

.receivables-toolbar .receivables-search-field {
  min-width: 280px;
}

.receivables-toolbar .receivables-days-field {
  min-width: 88px;
}

.receivables-toolbar .logistics-filter-field > span {
  font-size: 9px;
  letter-spacing: 0;
}

.receivables-toolbar .logistics-filter-field select,
.receivables-toolbar .logistics-filter-field input {
  font-size: 14px;
  line-height: 1.15;
}

.receivables-toolbar button {
  min-height: 44px;
  width: 118px;
  padding: 9px 14px;
}

.receivables-check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  width: 118px;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  padding: 0 12px;
  overflow: hidden;
  white-space: nowrap;
}

.receivables-check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.receivables-toolbar .receivables-search-field::before {
  background: #14b8a6;
}

.receivables-toolbar .receivables-search-field input {
  font-weight: 900;
}

.receivables-client .table-summary span:first-child {
  display: grid;
  gap: 4px;
}

.receivables-client .table-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.receivables-table-note {
  border-top: 1px solid var(--line);
  background: #fbfdff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 8px 12px;
}

.receivables-client-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.receivables-client-summary > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
  background: #fbfdff;
}

.receivables-client-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.receivables-client-summary strong {
  color: var(--text);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.receivables-table {
  min-width: 1180px;
}

.receivables-summary-table {
  table-layout: fixed;
  min-width: 1160px;
}

.receivables-summary-table .receivables-col-client {
  width: 185px;
}

.receivables-summary-table .receivables-col-money {
  width: 132px;
}

.receivables-summary-table .receivables-col-money-wide {
  width: 150px;
}

.receivables-summary-table .receivables-col-days {
  width: 104px;
}

.receivables-summary-table .receivables-col-next {
  width: 180px;
}

.receivables-summary-table .receivables-col-count {
  width: 82px;
}

.receivables-summary-table .receivables-col-dynamic {
  width: 40px;
}

.receivables-summary-table th,
.receivables-summary-table td {
  padding-left: 8px;
  padding-right: 8px;
}

.receivables-summary-table .numeric-col {
  width: auto;
  max-width: none;
  overflow-wrap: normal;
}

.receivables-summary-table th.numeric-col {
  white-space: normal;
}

.receivables-summary-table td.numeric-col {
  white-space: nowrap;
}

.receivables-summary-table th:last-child {
  font-size: 11px;
  line-height: 1.05;
}

.receivables-inflow {
  color: #047857;
  font-weight: 900;
}

.receivables-outflow {
  color: #b91c1c;
  font-weight: 900;
}

.receivables-dynamic-head,
.receivables-dynamic-cell {
  width: 40px;
  max-width: 40px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
  white-space: nowrap;
}

.receivables-dynamic {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.receivables-dynamic.is-down {
  background: #dcfce7;
  color: #047857;
}

.receivables-dynamic.is-up {
  background: #fee2e2;
  color: #b91c1c;
}

.receivables-dynamic.is-flat {
  background: #f1f5f9;
  color: #64748b;
  font-size: 16px;
}

.receivables-table-wrap table:not(.receivables-summary-table) .numeric-col {
  width: 112px;
  max-width: 118px;
}

.receivables-table-wrap table:not(.receivables-summary-table) th:nth-child(3),
.receivables-table-wrap table:not(.receivables-summary-table) td:nth-child(3) {
  width: 180px;
  max-width: 180px;
}

.receivables-overdue-row td {
  background: #fff7ed;
}

.detail-table-panel {
  overflow: visible;
}

.analytics-section table {
  table-layout: fixed;
}

.analytics-section th,
.analytics-section td {
  overflow-wrap: anywhere;
}

.analytics-section .numeric-col {
  width: 120px;
  white-space: nowrap;
}

.analytics-section .table-actions {
  width: 190px;
}

.analytics-section > table th:first-child,
.analytics-section > table td:first-child {
  width: 24%;
}

.manager-contract-group table th:nth-child(1),
.manager-contract-group table td:nth-child(1) {
  width: 34%;
}

.manager-contract-group table th:nth-child(2),
.manager-contract-group table td:nth-child(2) {
  width: 22%;
}

.manager-contract-group table th:nth-child(5),
.manager-contract-group table td:nth-child(5),
.manager-contract-group table th:nth-child(6),
.manager-contract-group table td:nth-child(6) {
  width: 112px;
  white-space: nowrap;
}

.wide-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.wide-table-wrap table {
  min-width: 1760px;
}

.wide-table-wrap th,
.wide-table-wrap td {
  white-space: nowrap;
}

.wide-table-wrap td:nth-child(2),
.wide-table-wrap th:nth-child(2) {
  min-width: 340px;
  white-space: normal;
}

.analytics-table-wrap table {
  table-layout: fixed;
  min-width: 0;
  width: 100%;
}

.analytics-table-wrap {
  overflow: visible;
}

.analytics-table-wrap th,
.analytics-table-wrap td {
  box-sizing: border-box;
  max-width: 220px;
  overflow-wrap: anywhere;
  white-space: normal;
  vertical-align: top;
  padding: 10px 12px;
}

.analytics-table-wrap th {
  overflow-wrap: normal;
  white-space: normal;
}

.analytics-table-wrap .numeric-col {
  width: 88px;
  max-width: 96px;
  white-space: nowrap;
}

.analytics-table-wrap th.numeric-col {
  white-space: normal;
}

.analytics-table-wrap .col-date {
  width: 118px;
  max-width: 118px;
  white-space: normal;
}

.analytics-table-wrap .col-code {
  width: 88px;
  max-width: 88px;
  white-space: normal;
}

.analytics-table-wrap .col-doc {
  width: 100px;
  max-width: 100px;
  white-space: nowrap;
}

.analytics-table-wrap .col-group {
  width: 72px;
  max-width: 72px;
  white-space: nowrap;
}

.analytics-table-wrap .col-product {
  width: 330px;
  max-width: 330px;
}

.analytics-table-wrap td strong {
  line-height: 1.25;
}

.analytics-table-missing {
  min-width: 1080px;
}

.analytics-table-profit-check {
  min-width: 1120px;
}

.grouped-profit-table {
  min-width: 1680px;
}

.grouped-profit-table .col-product {
  width: 350px;
  max-width: 350px;
}

.grouped-profit-table .col-status {
  width: 190px;
}

.grouped-profit-table .numeric-col {
  width: 96px;
  max-width: 104px;
}

.analytics-table-price-jump {
  min-width: 1420px;
}

.analytics-filter-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.abc-metrics {
  margin-top: 4px;
}

.abc-method-tabs {
  flex-wrap: wrap;
}

.abc-note-panel {
  margin-bottom: 14px;
}

.analytics-transfer-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px));
  gap: 8px;
}

.transfer-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.transfer-table-wrap {
  max-height: clamp(420px, calc(100vh - 250px), 720px);
  overflow: auto;
  scrollbar-gutter: stable;
}

.transfer-table-wrap table {
  table-layout: fixed;
}

.transfer-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 5;
}

.transfer-driver-table {
  min-width: 1680px;
}

.transfer-doc-table,
.transfer-product-table {
  min-width: 1320px;
}

.transfer-driver-table th,
.transfer-driver-table td,
.transfer-doc-table th,
.transfer-doc-table td,
.transfer-product-table th,
.transfer-product-table td {
  max-width: none;
  white-space: nowrap;
}

.transfer-driver-table th:nth-child(1),
.transfer-driver-table td:nth-child(1) {
  width: 160px;
  white-space: normal;
}

.transfer-driver-table th:nth-child(2),
.transfer-driver-table td:nth-child(2),
.transfer-driver-table th:nth-child(3),
.transfer-driver-table td:nth-child(3) {
  width: 78px;
}

.transfer-driver-table th:nth-child(4),
.transfer-driver-table td:nth-child(4),
.transfer-driver-table th:nth-child(5),
.transfer-driver-table td:nth-child(5),
.transfer-driver-table th:nth-child(6),
.transfer-driver-table td:nth-child(6),
.transfer-driver-table th:nth-child(7),
.transfer-driver-table td:nth-child(7),
.transfer-driver-table th:nth-child(8),
.transfer-driver-table td:nth-child(8),
.transfer-driver-table th:nth-child(9),
.transfer-driver-table td:nth-child(9) {
  width: 118px;
}

.transfer-driver-table th:nth-child(10),
.transfer-driver-table td:nth-child(10) {
  width: 170px;
}

.transfer-driver-table th:nth-child(11),
.transfer-driver-table td:nth-child(11),
.transfer-doc-table th:last-child,
.transfer-doc-table td:last-child {
  width: 330px;
  white-space: normal;
}

.transfer-doc-table th:nth-child(1),
.transfer-doc-table td:nth-child(1) {
  width: 110px;
}

.transfer-doc-table th:nth-child(2),
.transfer-doc-table td:nth-child(2),
.transfer-doc-table th:nth-child(3),
.transfer-doc-table td:nth-child(3) {
  width: 140px;
}

.transfer-product-table {
  min-width: 1520px;
}

.transfer-product-table th:nth-child(1),
.transfer-product-table td:nth-child(1) {
  width: 86px;
}

.transfer-product-table th:nth-child(2),
.transfer-product-table td:nth-child(2) {
  width: 86px;
}

.transfer-product-table th:nth-child(3),
.transfer-product-table td:nth-child(3) {
  width: 420px;
  white-space: normal;
}

.transfer-product-table th:nth-child(4),
.transfer-product-table td:nth-child(4),
.transfer-product-table th:nth-child(8),
.transfer-product-table td:nth-child(8),
.transfer-product-table th:nth-child(9),
.transfer-product-table td:nth-child(9) {
  width: 90px;
}

.transfer-product-table th:nth-child(5),
.transfer-product-table td:nth-child(5),
.transfer-product-table th:nth-child(6),
.transfer-product-table td:nth-child(6),
.transfer-product-table th:nth-child(7),
.transfer-product-table td:nth-child(7),
.transfer-product-table th:nth-child(10),
.transfer-product-table td:nth-child(10),
.transfer-product-table th:nth-child(11),
.transfer-product-table td:nth-child(11) {
  width: 118px;
}

.transfer-recommendation-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
}

.transfer-recommendation-card {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.transfer-recommendation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.transfer-recommendation-head strong,
.transfer-recommendation-head small {
  display: block;
}

.transfer-recommendation-head small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.transfer-recommendation-wrap {
  max-height: none;
  overflow-x: visible;
  overflow-y: visible;
}

.transfer-recommendation-wrap table {
  table-layout: fixed;
  min-width: 0;
}

.transfer-recommendation-wrap th,
.transfer-recommendation-wrap td {
  max-width: none;
}

.transfer-recommendation-table {
  min-width: 0;
  width: 100%;
}

.transfer-recommendation-table th,
.transfer-recommendation-table td {
  max-width: none;
  white-space: nowrap;
}

.transfer-recommendation-table th:nth-child(1),
.transfer-recommendation-table td:nth-child(1) {
  width: 72px;
}

.transfer-recommendation-table th:nth-child(2),
.transfer-recommendation-table td:nth-child(2) {
  width: auto;
  white-space: normal;
}

.transfer-recommendation-table th:nth-child(3),
.transfer-recommendation-table td:nth-child(3),
.transfer-recommendation-table th:nth-child(4),
.transfer-recommendation-table td:nth-child(4),
.transfer-recommendation-table th:nth-child(5),
.transfer-recommendation-table td:nth-child(5),
.transfer-recommendation-table th:nth-child(6),
.transfer-recommendation-table td:nth-child(6),
.transfer-recommendation-table th:nth-child(7),
.transfer-recommendation-table td:nth-child(7) {
  width: 108px;
}

.calc-help {
  cursor: help;
  border-bottom: 1px dotted #64748b;
  outline: none;
}

.calc-help:focus-visible {
  border-radius: 4px;
  outline: 2px solid #bfdbfe;
  outline-offset: 2px;
}

.abc-summary-panel table {
  table-layout: fixed;
}

.abc-table-wrap {
  max-height: clamp(520px, calc(100vh - 235px), 760px);
  overflow: auto;
  scrollbar-gutter: stable;
}

.abc-table-wrap .abc-table {
  min-width: 1220px;
}

.abc-table-wrap th,
.abc-table-wrap td {
  padding: 10px 10px;
}

.abc-table-wrap th {
  top: 0;
  z-index: 12;
}

.abc-table-wrap thead th:first-child {
  z-index: 13;
}

.abc-table-wrap .numeric-col {
  max-width: none;
}

.abc-table-wrap th:nth-child(1),
.abc-table-wrap td:nth-child(1) {
  width: 58px;
}

.abc-table-wrap th:nth-child(2),
.abc-table-wrap td:nth-child(2) {
  width: 62px;
}

.abc-table-wrap th:nth-child(3),
.abc-table-wrap td:nth-child(3) {
  width: 74px;
}

.abc-table-wrap .col-product {
  width: 300px;
  max-width: 300px;
}

.abc-table-wrap th:nth-child(5),
.abc-table-wrap td:nth-child(5) {
  width: 210px;
  max-width: 210px;
}

.abc-table-wrap th:nth-child(6),
.abc-table-wrap td:nth-child(6) {
  width: 136px;
}

.abc-table-wrap th:nth-child(7),
.abc-table-wrap td:nth-child(7) {
  width: 62px;
}

.abc-table-wrap th:nth-child(8),
.abc-table-wrap td:nth-child(8) {
  width: 86px;
}

.abc-table-wrap th:nth-child(9),
.abc-table-wrap td:nth-child(9) {
  width: 72px;
}

.abc-table-wrap th:nth-child(10),
.abc-table-wrap td:nth-child(10) {
  width: 64px;
}

.abc-table-wrap th:nth-child(11),
.abc-table-wrap td:nth-child(11) {
  width: 96px;
}

.abc-table-wrap .abc-matrix-table {
  table-layout: fixed;
  min-width: 0;
  width: 100%;
}

.abc-table-wrap .abc-matrix-table th,
.abc-table-wrap .abc-matrix-table td {
  padding: 9px 9px;
}

.abc-table-wrap .abc-matrix-table th:nth-child(1),
.abc-table-wrap .abc-matrix-table td:nth-child(1) {
  width: 52px;
}

.abc-table-wrap .abc-matrix-table th:nth-child(2),
.abc-table-wrap .abc-matrix-table td:nth-child(2) {
  width: 74px;
}

.abc-matrix-table th:nth-child(3),
.abc-matrix-table td:nth-child(3) {
  width: auto;
  max-width: none;
}

.abc-table-wrap .abc-matrix-table th:nth-child(4),
.abc-table-wrap .abc-matrix-table td:nth-child(4),
.abc-table-wrap .abc-matrix-table th:nth-child(5),
.abc-table-wrap .abc-matrix-table td:nth-child(5),
.abc-table-wrap .abc-matrix-table th:nth-child(6),
.abc-table-wrap .abc-matrix-table td:nth-child(6),
.abc-table-wrap .abc-matrix-table th:nth-child(7),
.abc-table-wrap .abc-matrix-table td:nth-child(7),
.abc-table-wrap .abc-matrix-table th:nth-child(8),
.abc-table-wrap .abc-matrix-table td:nth-child(8) {
  width: 58px;
  text-align: center;
}

.abc-table-wrap .abc-matrix-table th:nth-child(9),
.abc-table-wrap .abc-matrix-table td:nth-child(9) {
  width: 68px;
}

.abc-matrix-table th:nth-child(10),
.abc-matrix-table td:nth-child(10) {
  width: 260px;
  max-width: 260px;
}

.abc-matrix-table td:nth-child(3) strong,
.abc-matrix-table td:nth-child(10) strong {
  overflow-wrap: anywhere;
}

.abc-matrix-table td:nth-child(10) {
  white-space: normal;
}

.abc-matrix-table .abc-class {
  min-width: 30px;
  min-height: 26px;
}

.abc-table-wrap th {
  font-size: 11px;
}

.abc-class {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 26px;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.matrix-stat-help {
  cursor: help;
  outline: none;
}

.abc-class-A {
  background: #047857;
}

.abc-class-B {
  background: #2563eb;
}

.abc-class-C {
  background: #64748b;
}

.abc-class-— {
  background: #cbd5e1;
  color: #475569;
}

.abc-progress {
  display: block;
  width: 100%;
  height: 5px;
  margin-bottom: 5px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #0f766e var(--abc-progress), #e2e8f0 var(--abc-progress));
}

.column-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: help;
  outline: none;
}

.column-help::after {
  content: "?";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #64748b;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.floating-column-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #111827;
  box-shadow: 0 16px 38px rgb(15 23 42 / 22%);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: pre-line;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
}

.floating-column-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.stock-matrix-wrap table {
  min-width: 1900px;
}

.stock-matrix-wrap th.numeric-col,
.stock-matrix-wrap td.numeric-col {
  min-width: 132px;
  vertical-align: middle;
}

.stock-cell {
  display: inline-grid;
  justify-items: end;
  gap: 2px;
}

.stock-cell small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

.table-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel-header-bg);
  padding: 12px 14px;
  border-bottom: 1px solid #dfe7ef;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-summary > span:first-child,
.logistics-queue-title span:first-child {
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 4;
  color: var(--muted);
  background: #f9fbfc;
  font-size: 12px;
  line-height: 1.18;
  text-transform: uppercase;
  vertical-align: bottom;
  box-shadow: inset 0 -1px 0 var(--line);
}

.wide-table-wrap th {
  top: 0;
}

.table-panel thead th:first-child {
  z-index: 5;
}


td a {
  color: inherit;
  text-decoration: none;
}

td a:hover,
.page-title a:hover,
.product-name-link:hover strong {
  color: var(--accent-strong);
}

.photo-col {
  width: 68px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: #fbfefd;
}

.product-thumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgb(15 118 110 / 10%), rgb(8 145 178 / 8%)),
    #f8fafc;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  overflow: visible;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
  background: #fff;
}

.product-thumb:hover {
  z-index: 50;
}

.product-thumb:hover img {
  position: absolute;
  left: 0;
  top: 50%;
  width: min(354px, calc(100vw - 56px));
  height: 288px;
  max-height: calc(100vh - 120px);
  transform: translateY(-50%);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgb(15 23 42 / 22%);
  background: #fff;
}

.product-name-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.product-tree {
  padding: 8px 12px 14px;
}

.product-tree-node {
  border-bottom: 1px solid var(--line);
}

.product-tree-node summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.product-tree-node summary::-webkit-details-marker {
  display: none;
}

.product-tree-node summary::before {
  content: "›";
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  transition: transform .15s ease;
}

.product-tree-node[open] > summary::before {
  transform: rotate(90deg);
}

.product-tree-node summary a {
  color: inherit;
  text-decoration: none;
}

.product-tree-node summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tree-folder-mark {
  width: 22px;
  height: 16px;
  border-radius: 4px;
  background:
    linear-gradient(180deg, #facc15, #f59e0b);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 42%);
}

.product-tree-children {
  margin-left: 28px;
  padding-left: 14px;
  border-left: 1px dashed #d9e0e7;
}

.product-tree-item {
  display: grid;
  grid-template-columns: 42px minmax(260px, 1fr) 100px minmax(120px, .35fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 0;
  color: var(--muted);
  font-size: 13px;
}

.product-tree-item strong {
  color: var(--text);
}

.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.pagination a {
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--accent-strong);
  text-decoration: none;
  border-radius: 6px;
  padding: 9px 12px;
  font-weight: 700;
}

.tabs-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tabs-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.tabs-nav a.active,
.tabs-nav a:hover {
  border-color: #b7e4d6;
  background: #ecfdf5;
  color: var(--accent-strong);
}

.tabs-nav span {
  color: inherit;
  opacity: .7;
}

.check-tabs a {
  align-items: stretch;
  min-height: 46px;
  border-radius: 8px;
  padding: 8px 10px;
}

.check-tab-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 9px;
  align-items: baseline;
}

.check-tab-count {
  grid-row: span 2;
  align-self: center;
  min-width: 32px;
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
}

.check-tab-title {
  color: var(--text);
  font-weight: 900;
  line-height: 1.15;
}

.check-tab-note {
  max-width: 230px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
}

.profit-document-row td {
  padding: 0;
  background: #eef6f5;
  border-bottom-color: #d4e6e3;
  overflow: hidden;
}

.profit-document-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.15fr) minmax(120px, .6fr) minmax(180px, 1fr) minmax(180px, .9fr) minmax(160px, .75fr) minmax(180px, .7fr);
  gap: 12px;
  align-items: center;
  max-width: 100%;
  padding: 10px 14px;
  overflow: hidden;
}

.profit-document-card > div {
  min-width: 0;
}

.profit-document-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profit-document-card strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.profit-document-card .numeric-col {
  justify-self: end;
  max-width: 100%;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
  text-align: right;
  white-space: normal;
}

.profit-document-lines td {
  background: #fff;
}

.profit-line-muted td {
  background: #fbfefd;
  color: #566574;
}

.profit-line-muted td strong {
  color: #26313b;
}

.profit-rule-panel {
  margin-bottom: 14px;
}

.numeric-col {
  text-align: right;
  white-space: nowrap;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.product-detail-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.product-photo-panel,
.detail-section {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}

.product-photo-panel {
  padding: 16px;
}

.product-photo-large {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgb(15 118 110 / 10%), rgb(245 158 11 / 8%)),
    #f8fafc;
  color: var(--accent-strong);
  font-size: 64px;
  font-weight: 900;
  overflow: hidden;
}

.product-photo-large img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.product-photo-panel small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.35;
}

.detail-sections {
  display: grid;
  gap: 14px;
}

.detail-section {
  padding: 18px;
}

.detail-section h2 {
  margin-bottom: 14px;
}

.settings-form {
  display: grid;
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-form button {
  justify-self: start;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  padding: 10px 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-field {
  display: grid;
  gap: 5px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.detail-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-field strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.auth-scene {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 0;
  background:
    radial-gradient(ellipse at 12% 10%, rgb(88 28 135 / 78%), transparent 40%),
    radial-gradient(ellipse at 86% 18%, rgb(8 145 178 / 60%), transparent 38%),
    radial-gradient(ellipse at 48% 100%, rgb(15 118 110 / 50%), transparent 45%),
    linear-gradient(135deg, #040716 0%, #071121 46%, #050b16 100%);
}

.premium-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.premium-backdrop::before,
.premium-backdrop::after {
  content: "";
  position: absolute;
  inset: -18%;
  pointer-events: none;
}

.premium-backdrop::before {
  background:
    linear-gradient(115deg, rgb(124 58 237 / 34%), transparent 32%),
    linear-gradient(245deg, rgb(6 182 212 / 30%), transparent 36%),
    linear-gradient(30deg, transparent 44%, rgb(245 158 11 / 18%) 72%, transparent 100%);
  filter: blur(10px);
}

.premium-backdrop::after {
  background:
    linear-gradient(90deg, rgb(255 255 255 / 4%) 1px, transparent 1px),
    linear-gradient(0deg, rgb(255 255 255 / 3%) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 78%, transparent 100%);
  opacity: .35;
}

.mock-control-panel {
  position: absolute;
  left: 50%;
  top: 53%;
  width: min(1320px, 86vw);
  min-height: 620px;
  padding: 30px;
  transform: translate(-50%, -50%) rotate(-3deg);
  border-radius: 30px;
  color: #e5edf7;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 20%), rgb(255 255 255 / 7%)),
    linear-gradient(135deg, rgb(49 46 129 / 64%), rgb(8 47 73 / 66%) 58%, rgb(6 78 59 / 48%));
  border: 1px solid rgb(255 255 255 / 18%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 22%),
    0 42px 130px rgb(0 0 0 / 58%);
  backdrop-filter: blur(26px) saturate(1.45);
  filter: blur(2.2px);
  opacity: .92;
}

.mock-browser-bar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: 18px;
  background: rgb(2 6 23 / 48%);
  border: 1px solid rgb(255 255 255 / 8%);
}

.mock-browser-bar span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ef4444;
}

.mock-browser-bar span:nth-child(2) { background: #f59e0b; }
.mock-browser-bar span:nth-child(3) { background: #10b981; }

.mock-browser-bar b {
  margin-left: 10px;
  color: rgb(226 232 240 / 80%);
  font-size: 15px;
}

.mock-stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 26px 0;
}

.mock-stats-row div {
  min-height: 110px;
  padding: 22px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 18%), rgb(255 255 255 / 6%)),
    rgb(15 23 42 / 34%);
  border: 1px solid rgb(255 255 255 / 9%);
}

.mock-stats-row b,
.mock-stats-row span {
  display: block;
}

.mock-stats-row b {
  font-size: 36px;
  color: #f8fafc;
  line-height: 1;
}

.mock-stats-row span {
  margin-top: 8px;
  color: rgb(203 213 225 / 78%);
  font-size: 13px;
}

.mock-products-table {
  color: rgb(226 232 240 / 82%);
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.mock-products-table th,
.mock-products-table td {
  border: 0;
  padding: 18px 18px;
  background: rgb(15 23 42 / 42%);
}

.mock-products-table th {
  color: rgb(148 163 184 / 72%);
  background: transparent;
}

.mock-products-table td:first-child {
  width: 56px;
  border-radius: 14px 0 0 14px;
}

.mock-products-table td:last-child {
  border-radius: 0 14px 14px 0;
}

.mock-products-table i {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  box-shadow: 0 0 24px rgb(6 182 212 / 35%);
}

.mock-products-table tr:nth-child(2n) i {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  box-shadow: 0 0 24px rgb(245 158 11 / 30%);
}

.mock-products-table .ok {
  color: #34d399;
  font-weight: 800;
}

.mock-products-table .warn {
  color: #fbbf24;
  font-weight: 800;
}

.auth-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 96px 18px 34px;
}

.auth-card {
  width: min(430px, 100%);
  display: grid;
  gap: 14px;
  border-radius: 26px;
  padding: 30px;
  position: relative;
  overflow: hidden;
}

.glass-card {
  background:
    linear-gradient(145deg, rgb(255 255 255 / 88%), rgb(255 255 255 / 46%)),
    linear-gradient(315deg, rgb(14 116 144 / 28%), rgb(245 158 11 / 18%));
  border: 1px solid rgb(255 255 255 / 84%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 88%),
    inset 0 -1px 0 rgb(15 118 110 / 10%),
    0 42px 120px rgb(0 0 0 / 36%),
    0 0 0 1px rgb(255 255 255 / 30%);
  backdrop-filter: blur(36px) saturate(1.55);
}

.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(120deg, rgb(255 255 255 / 70%) 0%, transparent 28%),
    linear-gradient(280deg, rgb(14 165 233 / 18%), transparent 36%);
  pointer-events: none;
}

.glass-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 25px;
  border: 1px solid rgb(255 255 255 / 44%);
  pointer-events: none;
}

.auth-card > * {
  position: relative;
  z-index: 1;
}

.auth-card h1 {
  font-size: 30px;
  letter-spacing: 0;
  margin-bottom: 4px;
}

.auth-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-card label em {
  color: #ef4444;
  font-style: normal;
}

.optional-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 -2px;
  color: rgb(71 85 105 / 82%);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.optional-divider::before,
.optional-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(71 85 105 / 26%), transparent);
}

.auth-card input {
  width: 100%;
  border: 1px solid rgb(148 163 184 / 32%);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 82%), rgb(255 255 255 / 56%));
  border-radius: 12px;
  padding: 12px 13px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.auth-card input:focus {
  border-color: rgb(15 118 110 / 62%);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 12%);
}

.auth-card button {
  border: 0;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 18%), transparent),
    linear-gradient(135deg, #0f766e, #0891b2 55%, #f59e0b);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  font-family: inherit;
  box-shadow: 0 18px 42px rgb(8 145 178 / 30%);
}

.auth-card a {
  color: var(--accent-strong);
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.form-error {
  margin: 0;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #9f1239;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}

.form-note {
  margin: 0;
  border: 1px solid #bae6fd;
  background: #eff6ff;
  color: #075985;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.35;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.user-badge.approved {
  background: #dcfce7;
  color: #166534;
}

.user-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.table-actions {
  text-align: right;
}

.table-actions form {
  margin: 0;
}

.table-actions button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  padding: 9px 12px;
}

.contract-bind-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.contract-bind-form select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 0 8px;
}

.manager-contract-group {
  border-top: 1px solid var(--line);
}

.manager-contract-group:first-of-type {
  border-top: 0;
}

.manager-contract-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #f8fafc;
  padding: 12px 14px;
}

.manager-contract-heading strong {
  font-size: 15px;
}

.manager-contract-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.secondary-link {
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--accent-strong);
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.logistics-toolbar {
  display: grid;
  grid-template-columns: minmax(138px, .52fr) minmax(240px, 1.2fr) repeat(3, minmax(168px, .82fr));
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}

.logistics-filter-field {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 3px;
  min-width: 0;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 1px 0 rgb(15 23 42 / 3%);
  padding: 7px 10px 8px;
}

.logistics-filter-field::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: #0f766e;
  opacity: .74;
}

.logistics-filter-field:focus-within {
  border-color: rgb(15 118 110 / 62%);
  box-shadow:
    0 0 0 3px rgb(15 118 110 / 10%),
    0 10px 26px rgb(15 23 42 / 7%);
}

.logistics-filter-field > span {
  color: #647282;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.logistics-filter-field select,
.logistics-filter-field input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  outline: none;
  padding: 0;
}

.logistics-run-form select,
.logistics-run-form input,
.logistics-directory-form select,
.logistics-directory-form input {
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 11px 12px;
}

.logistics-filter-field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #647282 50%),
    linear-gradient(135deg, #647282 50%, transparent 50%);
  background-position:
    calc(100% - 10px) 50%,
    calc(100% - 5px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 20px;
}

.logistics-filter-field input[type="date"] {
  min-height: 20px;
}

.logistics-create-panel {
  margin-bottom: 14px;
}

.logistics-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.logistics-metrics .metric-card {
  min-height: 0;
  padding: 9px 12px;
}

.logistics-metrics .metric-card strong {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.logistics-run-form {
  display: grid;
  grid-template-columns: minmax(160px, .8fr) minmax(180px, 1fr) minmax(140px, .7fr) minmax(180px, 1fr) auto;
  gap: 10px;
  padding: 12px 14px 14px;
}

.logistics-directory-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px 14px;
}

.logistics-run-form button,
.logistics-directory-form button,
.logistics-assign-row button,
.logistics-inline-assign-form button,
.route-doc-row button,
.route-doc-tile button,
.route-actions button,
.route-print-link {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  padding: 10px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.route-doc-row button,
.route-doc-tile button {
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--muted);
}

.route-actions button:disabled {
  background: #d1d5db;
  color: #647282;
}

.logistics-board-live {
  display: grid;
  grid-template-columns: minmax(360px, .78fr) minmax(520px, 1.22fr);
  gap: 14px;
  align-items: stretch;
  height: clamp(520px, calc(100vh - 260px), 760px);
  min-height: 0;
}

.logistics-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.logistics-route-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  flex: 0 0 auto;
  gap: 6px;
  padding: 6px;
}

.logistics-route-tab-panel {
  flex: 1;
  overflow: hidden;
}

.logistics-route-tab-panel.active {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.logistics-route-tab-panel .logistics-route-list,
.logistics-route-tab-panel .logistics-address-review,
.logistics-route-tab-panel .logistics-timeline {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.logistics-route-tab-panel .logistics-map-body {
  flex: 1;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(360px, 1fr) auto;
  padding: 10px;
}

.logistics-route-tab-panel .logistics-map-main {
  grid-template-rows: minmax(320px, 1fr) auto;
}

.logistics-route-tab-panel .logistics-map-canvas {
  min-height: 320px;
}

.logistics-route-tab-panel .logistics-map-routes {
  max-height: 150px;
}

.logistics-timeline {
  padding: 10px;
}

.logistics-card-list,
.logistics-route-list {
  display: grid;
  align-content: start;
  flex: 1;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
}

.logistics-map-body {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(300px, .34fr);
  gap: 12px;
  min-height: 0;
  padding: 10px;
}

.logistics-map-panel {
  margin-top: 14px;
}

.logistics-map-main,
.logistics-map-sidebar {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.logistics-map-main {
  grid-template-rows: minmax(420px, 1fr) auto;
}

.logistics-map-canvas {
  position: relative;
  z-index: 0;
  min-height: 420px;
  border: 1px solid #c9d4df;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #e7f4ef 0%, #f8fafc 58%, #eaf2ff 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 82%);
  overflow: hidden;
}

.logistics-map-canvas .leaflet-container,
.logistics-map-canvas.leaflet-container {
  font: inherit;
}

.logistics-map-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 8px 18px rgb(15 23 42 / 22%);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.logistics-map-marker.depot {
  width: 34px;
  height: 34px;
  background: #111827;
  font-size: 14px;
}

.logistics-map-status {
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  padding: 8px 10px;
}

.logistics-map-routes {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.logistics-map-route-item {
  position: relative;
  border: 1px solid #d8e1eb;
  border-left: 5px solid var(--route-color, var(--accent));
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.logistics-map-route-item.is-route-hidden {
  opacity: 0.48;
}

.logistics-map-route-toggle {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  cursor: pointer;
}

.logistics-map-route-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.logistics-map-route-check {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border: 2px solid var(--route-color, var(--accent));
  border-radius: 4px;
  background: var(--route-color, var(--accent));
  box-shadow: inset 0 0 0 3px #ffffff;
}

.logistics-map-route-toggle input:focus-visible + .logistics-map-route-check {
  outline: 2px solid color-mix(in srgb, var(--route-color, var(--accent)) 38%, #ffffff);
  outline-offset: 2px;
}

.logistics-map-route-toggle input:not(:checked) + .logistics-map-route-check {
  background: #ffffff;
  box-shadow: none;
}

.logistics-map-route-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.logistics-map-route-text strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-map-route-text > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.logistics-address-review {
  display: grid;
  gap: 8px;
  min-height: 0;
  padding: 0 10px 10px;
}

.logistics-address-review-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
}

.logistics-address-review-title span {
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 8px;
}

.logistics-address-review-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
}

.logistics-address-review-item {
  display: grid;
  gap: 2px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  padding: 8px 10px;
}

.logistics-address-review-item strong,
.logistics-address-review-item span,
.logistics-address-review-item p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-address-review-item strong {
  color: #7c2d12;
  font-size: 12px;
}

.logistics-address-review-item span,
.logistics-address-review-item p {
  color: #9a3412;
  font-size: 11px;
  margin: 0;
}

.logistics-address-review-item small {
  color: #c2410c;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.logistics-suggest-form {
  margin-left: auto;
}

.logistics-suggest-form button {
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 8px 10px;
}

.logistics-queue-summary {
  align-items: center;
  flex-wrap: wrap;
}

.logistics-queue-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}

.logistics-queue-search {
  flex: 1;
  min-width: min(260px, 100%);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
}

.logistics-doc-card,
.logistics-route-card {
  min-width: 0;
  border: 1px solid #c9d4df;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow:
    0 8px 18px rgb(15 23 42 / 7%),
    inset 3px 0 0 rgb(15 118 110 / 16%);
  padding: 12px;
}

.logistics-doc-card {
  box-shadow:
    0 5px 14px rgb(15 23 42 / 7%),
    inset 3px 0 0 rgb(15 118 110 / 16%);
  padding: 10px;
}

.logistics-doc-card[data-logistics-draggable-card] {
  cursor: grab;
}

.logistics-doc-card.is-dragging {
  cursor: grabbing;
  opacity: .58;
  outline: 2px solid #9bd7c7;
}

body.logistics-dragging {
  cursor: grabbing;
  user-select: none;
}

.logistics-drag-ghost {
  position: fixed;
  z-index: 3000;
  display: grid;
  min-width: 220px;
  max-width: 320px;
  padding: 8px 10px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #ecfdf5;
  box-shadow: 0 18px 42px rgb(15 23 42 / 22%);
  color: var(--text);
  font-weight: 900;
  gap: 2px;
  pointer-events: none;
  transform: translateY(-50%);
}

.logistics-drag-ghost small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-route-card.is-drop-target {
  border-color: var(--accent);
  background: #f0fdfa;
  box-shadow:
    0 0 0 3px rgb(15 118 110 / 10%),
    0 10px 24px rgb(15 23 42 / 10%),
    inset 3px 0 0 rgb(15 118 110 / 36%);
}

.logistics-doc-card p,
.logistics-route-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.logistics-card-top,
.route-card-header,
.route-doc-row,
.route-doc-tile {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.logistics-card-top {
  align-items: center;
  gap: 8px;
}

.logistics-card-top > div,
.route-card-header > div,
.route-doc-row > div,
.route-doc-tile > div {
  min-width: 0;
}

.logistics-doc-card strong,
.logistics-doc-card p,
.empty-note,
.route-doc-row strong,
.route-doc-row span,
.route-doc-tile strong,
.route-doc-tile span,
.route-doc-tile b {
  overflow-wrap: anywhere;
}

.doc-number {
  display: inline-flex;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.logistics-order-number {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.logistics-card-customer {
  min-width: 0;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  white-space: nowrap;
}

.logistics-card-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-card-address {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  line-height: 1.25;
  padding: 6px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-card-address span {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.logistics-card-address.is-uncertain {
  background: #fffbeb;
  color: #92400e;
}

.logistics-card-address.is-missing {
  background: #f1f5f9;
  color: #94a3b8;
}

.zone-badge,
.warning-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 1;
  min-height: 24px;
  max-width: 48%;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.zone-badge {
  background: #eff6ff;
  color: #1d4ed8;
}

.warning-badge {
  margin-top: 9px;
  background: var(--warn-bg);
  color: #92400e;
}

.dimension-warning {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0;
  width: fit-content;
  margin: 0;
  color: #991b1b;
  font-size: 12px;
  font-weight: 800;
  cursor: help;
}

.traffic-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 0 0 3px rgb(220 38 38 / 14%);
}

.dimension-tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: min(360px, calc(100vw - 60px));
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgb(15 23 42 / 18%);
  color: var(--text);
  padding: 10px 12px;
  line-height: 1.35;
}

.dimension-tooltip strong {
  display: block;
  margin-bottom: 7px;
}

.dimension-tooltip div {
  padding: 6px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
  white-space: normal;
}

.dimension-tooltip div:first-of-type {
  border-top: 0;
}

.dimension-warning:hover .dimension-tooltip,
.dimension-warning:focus .dimension-tooltip,
.dimension-warning:focus-within .dimension-tooltip {
  display: block;
}

.traffic-dot:hover + .dimension-tooltip {
  display: block;
}

.logistics-card-meta,
.route-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}

.logistics-doc-card .logistics-card-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.logistics-card-meta span,
.route-stats span {
  border-radius: 6px;
  background: #f7fafc;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  padding: 6px;
}

.logistics-card-meta strong,
.route-stats strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}

.route-stats {
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 10px 0;
}

.route-stats span {
  font-size: 12px;
  line-height: normal;
  padding: 7px 8px;
}

.route-stats strong {
  font-size: 13px;
  line-height: normal;
}

.route-economy {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: -2px 0 8px;
}

.logistics-assign-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.logistics-assign-menu {
  margin-top: 8px;
}

.logistics-assign-menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 9px;
  cursor: pointer;
  user-select: none;
}

.logistics-inline-assign-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

.logistics-inline-assign-form select {
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
}

.empty-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.logistics-route-card.overloaded {
  border-color: #f59e0b;
  box-shadow:
    0 8px 18px rgb(15 23 42 / 7%),
    inset 3px 0 0 rgb(245 158 11 / 42%);
}

.route-card-header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capacity-bar {
  height: 8px;
  margin: 8px 0 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.capacity-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--route-color, var(--accent));
}

.capacity-bar.is-overloaded span {
  background: #dc2626;
}

.route-doc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.route-doc-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 9px 10px;
}

.route-doc-tile {
  position: relative;
  display: block;
  min-width: 0;
  border: 1px solid var(--tile-border, #dfe7ef);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 70%) 0%, var(--tile-bg, #f8fafc) 100%);
  box-shadow: 0 4px 10px rgb(15 23 42 / 5%);
  padding: 9px 34px 9px 10px;
}

.route-doc-tile-tone-0 {
  --tile-bg: #f0fdfa;
  --tile-border: #bae6df;
}

.route-doc-tile-tone-1 {
  --tile-bg: #eff6ff;
  --tile-border: #c7d8f5;
}

.route-doc-tile-tone-2 {
  --tile-bg: #fff7ed;
  --tile-border: #fed7aa;
}

.route-doc-tile-tone-3 {
  --tile-bg: #f8fafc;
  --tile-border: #cbd5e1;
}

.route-doc-tile-tone-4 {
  --tile-bg: #f0fdf4;
  --tile-border: #bbf7d0;
}

.route-doc-tile-tone-5 {
  --tile-bg: #fefce8;
  --tile-border: #fde68a;
}

.route-doc-tile-tone-6 {
  --tile-bg: #f5f3ff;
  --tile-border: #ddd6fe;
}

.route-doc-tile-tone-7 {
  --tile-bg: #fdf2f8;
  --tile-border: #fbcfe8;
}

.route-doc-tile > div {
  display: grid;
  gap: 5px;
}

.route-doc-row strong,
.route-doc-row span,
.route-doc-tile strong,
.route-doc-tile span,
.route-doc-tile b {
  display: block;
}

.route-doc-row span,
.route-doc-tile span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.route-doc-tile strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-doc-customer {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-height: 2.36em;
  line-height: 1.18;
}

.route-doc-address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-doc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.route-doc-footer > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-doc-tile b {
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1.15;
  white-space: nowrap;
}

.route-doc-tile form {
  position: absolute;
  top: 7px;
  right: 7px;
}

.route-doc-tile button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.order-preview-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  cursor: help;
  outline: 0;
}

.route-order-preview {
  display: block;
  width: fit-content;
}

.order-preview-anchor:focus-visible .doc-number,
.order-preview-anchor:focus-visible strong {
  border-radius: 4px;
  outline: 2px solid rgb(15 118 110 / 24%);
  outline-offset: 2px;
}

.order-preview-anchor .order-preview-tooltip {
  display: none;
  position: fixed;
  left: 50%;
  top: 88px;
  z-index: 1000;
  width: min(760px, calc(100vw - 48px));
  max-height: min(620px, calc(100vh - 116px));
  transform: translateX(-50%);
  overflow-y: auto;
  border: 1px solid #bfd0dd;
  border-radius: 8px;
  background: #ffffff;
  box-shadow:
    0 18px 44px rgb(15 23 42 / 20%),
    inset 3px 0 0 rgb(15 118 110 / 24%);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 0;
  padding: 10px;
  pointer-events: none;
  text-align: left;
  white-space: normal;
}

.order-preview-anchor:hover .order-preview-tooltip,
.order-preview-anchor:focus .order-preview-tooltip,
.order-preview-anchor:focus-within .order-preview-tooltip {
  display: grid;
  gap: 8px;
}

.order-preview-title {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

.order-preview-table {
  display: grid;
  gap: 0;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  overflow: hidden;
}

.order-preview-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 74px 92px 74px;
  gap: 12px;
  align-items: center;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 8px 10px;
}

.order-preview-row:first-child {
  border-top: 0;
}

.order-preview-row > span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #334155;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.18;
  margin-top: 0;
}

.order-preview-row > span:not(:first-child) {
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

.order-preview-head {
  background: #f8fafc;
}

.order-preview-head > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-align: right;
  text-transform: uppercase;
}

.order-preview-head > span:first-child {
  text-align: left;
}

.order-preview-more,
.order-preview-empty,
.order-preview-profit {
  display: block;
  margin-top: 0;
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  padding: 7px 8px;
}

.order-preview-profit {
  background: #ecfdf5;
  color: var(--accent-strong);
}

@media (max-width: 640px) {
  .order-preview-anchor .order-preview-tooltip {
    top: 16px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 32px);
  }

  .order-preview-row {
    grid-template-columns: minmax(0, 1fr) 58px 72px 58px;
    gap: 8px;
  }
}

.route-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

.logistics-workspace {
  display: grid;
  gap: 10px;
  min-height: calc(100vh - 126px);
}

.logistics-workspace-top {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 14px;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  background: #ffffff;
}

.logistics-workspace-top h1,
.logistics-workspace-top p {
  margin: 0;
}

.logistics-workspace-top h1 {
  color: var(--text);
  font-size: 22px;
}

.logistics-workspace-top p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.logistics-workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.ghost-button,
.logistics-workspace-actions button,
.workspace-selection-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 8px 10px;
  text-decoration: none;
}

.workspace-selection-bar button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.workspace-selection-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.logistics-workspace-alerts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.logistics-workspace-alerts span {
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 9px;
}

.logistics-workspace-alerts .is-hot {
  background: #fff7ed;
  color: #c2410c;
}

.logistics-workspace-filters {
  display: grid;
  grid-template-columns: 140px repeat(3, minmax(150px, 1fr)) minmax(220px, 1.4fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  background: #ffffff;
}

.logistics-workspace-filters label,
.workspace-selection-bar label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.logistics-workspace-filters span,
.workspace-selection-bar label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.logistics-workspace-filters input,
.logistics-workspace-filters select,
.workspace-selection-bar select {
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 9px;
}

.logistics-workspace-grid {
  display: grid;
  grid-template-columns: minmax(300px, .78fr) minmax(460px, 1.32fr) minmax(300px, .82fr);
  gap: 10px;
  min-height: 0;
  height: clamp(620px, calc(100vh - 260px), 860px);
}

.workspace-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.workspace-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.workspace-panel-head strong {
  color: var(--text);
  font-size: 14px;
}

.workspace-panel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.workspace-queue-list,
.workspace-route-list,
.workspace-route-details,
.workspace-issues,
.workspace-timeline {
  min-height: 0;
  overflow: auto;
}

.workspace-order-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 86px;
  gap: 8px;
  align-items: start;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  padding: 9px 10px;
}

.workspace-order-row:hover,
.workspace-route-row:hover {
  background: #f8fafc;
}

.workspace-order-row.has-warning {
  box-shadow: inset 3px 0 0 #ef4444;
}

.workspace-order-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.workspace-order-main,
.workspace-order-facts {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.workspace-order-main strong,
.workspace-order-main b,
.workspace-order-main small,
.workspace-order-facts b,
.workspace-order-facts small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-order-main strong {
  color: #334155;
  font-size: 12px;
}

.workspace-order-main b {
  color: var(--text);
  font-size: 13px;
}

.workspace-order-main small,
.workspace-order-facts small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.workspace-order-facts {
  justify-items: end;
  text-align: right;
}

.workspace-order-facts b {
  color: var(--text);
  font-size: 12px;
}

.workspace-order-facts .is-warning {
  color: #b45309;
}

.workspace-map {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.workspace-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.workspace-tabs button {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 8px;
}

.workspace-tabs button.active {
  border-color: #99f6e4;
  background: #ecfdf5;
  color: #047857;
}

.workspace-tabs.logistics-route-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
}

.workspace-tabs.logistics-route-tabs button {
  min-width: 0;
  min-height: 32px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1;
  padding: 6px 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-tab-panel {
  display: none;
  min-height: 0;
  padding: 10px;
}

.workspace-tab-panel.active {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
}

.workspace-map-canvas {
  min-height: 0;
}

.workspace-timeline {
  display: grid;
  align-content: start;
  gap: 8px;
}

.workspace-timeline article {
  display: grid;
  gap: 6px;
  border: 1px solid #d8e1eb;
  border-left: 5px solid var(--route-color, var(--accent));
  border-radius: 8px;
  padding: 10px;
}

.workspace-timeline article strong,
.workspace-timeline article span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-timeline article strong {
  color: var(--text);
}

.workspace-timeline article span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workspace-timeline-bar,
.workspace-route-row i {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.workspace-timeline-bar i,
.workspace-route-row i em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--route-color, var(--accent));
}

.workspace-issues {
  display: grid;
  align-content: start;
  gap: 8px;
}

.workspace-issues article {
  display: grid;
  gap: 3px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  padding: 10px;
}

.workspace-issues strong {
  color: #7c2d12;
}

.workspace-issues span,
.workspace-issues small {
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
}

.workspace-routes {
  grid-template-rows: auto minmax(190px, .55fr) minmax(0, 1fr);
}

.workspace-route-row {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  border-left: 5px solid var(--route-color, var(--accent));
  background: #ffffff;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 9px 10px;
  text-align: left;
}

.workspace-route-row.active {
  background: #f0fdfa;
}

.workspace-route-row.is-overloaded i em {
  background: #dc2626;
}

.workspace-route-row span,
.workspace-route-row b,
.workspace-route-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-route-row strong {
  color: var(--text);
  font-size: 13px;
}

.workspace-route-row b {
  color: #334155;
  font-size: 12px;
}

.workspace-route-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.workspace-route-details {
  border-top: 1px solid #e2e8f0;
}

.workspace-route-details section {
  display: none;
  padding: 12px;
}

.workspace-route-details section.active {
  display: grid;
  gap: 8px;
}

.workspace-route-details h2,
.workspace-route-details p {
  margin: 0;
}

.workspace-route-details h2 {
  color: var(--text);
  font-size: 16px;
}

.workspace-route-details p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.workspace-route-details ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 22px;
}

.workspace-route-details li {
  border-bottom: 1px solid #e2e8f0;
  color: var(--text);
  padding: 0 0 6px;
}

.workspace-route-details li strong,
.workspace-route-details li span,
.workspace-route-details li small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-route-details li span,
.workspace-route-details li small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workspace-selection-bar {
  position: sticky;
  bottom: 10px;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, .7fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #f0fdfa;
  box-shadow: 0 16px 34px rgb(15 23 42 / 14%);
}

.workspace-selection-bar > div:first-child {
  display: grid;
  gap: 2px;
}

.workspace-selection-bar strong {
  color: var(--text);
}

.workspace-selection-bar div > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 1180px) {
  .receivables-toolbar {
    grid-template-columns: minmax(260px, 1fr) minmax(160px, .65fr) minmax(190px, .75fr);
  }

  .receivables-toolbar .receivables-days-field,
  .receivables-toolbar button {
    width: 100%;
  }

  .receivables-check-field {
    width: auto;
  }
}

@media (max-width: 760px) {
  .app-header {
    height: auto;
    min-height: 64px;
    padding: 12px 18px;
  }

  .app-header,
  .header-left,
  .header-right,
  .page-title,
  .work-panel,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .user-menu-panel {
    left: 0;
    right: auto;
  }

  .top-nav {
    flex-wrap: wrap;
  }

  .data-freshness-indicator {
    width: 100%;
  }

  .dashboard-metric-grid {
    grid-template-columns: 1fr;
  }

  .document-toolbar {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .page-shell {
    padding: 18px;
  }

  .auth-page-shell {
    padding: 0;
  }

  .auth-scene {
    min-height: 100vh;
    border-radius: 0;
  }

  .mock-control-panel {
    width: 900px;
    min-height: 560px;
    left: 50%;
    top: 48%;
    padding: 18px;
    transform: translate(-50%, -50%) rotate(-4deg);
    filter: blur(2.4px);
    opacity: .78;
  }

  .mock-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-shell {
    min-height: 100vh;
    padding: 96px 14px 28px;
  }

  .auth-card {
    padding: 22px;
  }

  .products-toolbar,
  .page-title,
  .product-detail-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .receivables-toolbar {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .receivables-toolbar .receivables-search-field {
    min-width: 0;
  }

  .mode-toggle,
  .mode-switch {
    justify-content: center;
  }

  .product-tree-item {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .product-tree-item > span {
    display: none;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .logistics-toolbar,
  .logistics-run-form,
  .logistics-directory-form,
  .logistics-board-live,
  .logistics-map-body,
  .logistics-card-meta,
  .route-stats {
    grid-template-columns: 1fr;
  }

  .logistics-board-live,
  .logistics-panel {
    min-height: 0;
  }

  .logistics-board-live {
    height: auto;
  }

  .logistics-panel {
    height: min(620px, 72vh);
  }

  .logistics-map-panel {
    height: auto;
  }

  .logistics-map-main {
    grid-template-rows: minmax(320px, 54vh) auto;
  }

  .logistics-map-canvas {
    min-height: 320px;
  }

}

@media (max-width: 1199px) {
  .logistics-workspace-grid {
    grid-template-columns: minmax(300px, .9fr) minmax(420px, 1.1fr);
    height: auto;
  }

  .workspace-routes {
    grid-column: 1 / -1;
    min-height: 420px;
  }
}

@media (max-width: 760px) {
  .logistics-workspace-top,
  .logistics-workspace-filters,
  .logistics-workspace-grid,
  .workspace-selection-bar {
    grid-template-columns: 1fr;
  }

  .logistics-workspace-actions {
    justify-content: stretch;
  }

  .ghost-button,
  .logistics-workspace-actions form,
  .logistics-workspace-actions button {
    width: 100%;
  }

  .workspace-panel {
    min-height: 420px;
  }

  .workspace-order-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .workspace-order-row input {
    width: 22px;
    height: 22px;
  }

  .workspace-order-facts {
    grid-column: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-items: start;
    text-align: left;
  }

  .workspace-map-canvas {
    min-height: 460px;
  }

  .workspace-selection-bar {
    bottom: 0;
    border-radius: 8px 8px 0 0;
  }
}

body:has(.logistics-board-live) {
  overflow: hidden;
}

body:has(.logistics-board-live) .page-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: calc(100vh - 64px);
  min-height: 0;
  padding: 8px 10px 10px;
}

body:has(.logistics-board-live) .page-title {
  margin-bottom: 8px;
}

.logistics-breadcrumb-aside {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.logistics-work-mode-actions {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 90;
}

.logistics-work-mode-button {
  min-height: 34px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #0f766e;
  box-shadow: 0 14px 30px rgb(15 23 42 / 18%);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 8px 12px;
}

body.logistics-work-mode .app-header,
body.logistics-work-mode .page-title,
body.logistics-work-mode .logistics-toolbar,
body.logistics-work-mode .logistics-metrics {
  display: none;
}

body.logistics-work-mode .page-shell {
  height: 100vh;
}

body.logistics-work-mode .logistics-board-live {
  height: calc(100vh - 58px);
}

.logistics-toolbar {
  flex: 0 0 auto;
  margin-bottom: 6px;
}

.logistics-work-filters {
  display: none;
}

body.logistics-work-mode .logistics-work-filters {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(210px, 280px);
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.logistics-work-filters label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.logistics-work-filters span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.logistics-work-filters input,
.logistics-work-filters select {
  min-width: 0;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 7px;
}

.logistics-metrics {
  flex: 0 0 auto;
  margin-bottom: 8px;
}

.logistics-metrics .metric-card {
  min-height: 38px;
  padding: 8px 10px;
}

.logistics-metrics .metric-card strong {
  font-size: 13px;
}

.logistics-board-live {
  flex: 1;
  grid-template-columns: minmax(300px, .8fr) minmax(430px, 1.2fr);
  height: auto;
  min-height: 0;
}

.logistics-panel .table-summary {
  min-height: 38px;
  padding: 7px 10px;
}

.logistics-card-list,
.logistics-route-list {
  gap: 4px;
  padding: 6px;
}

.logistics-doc-card.logistics-doc-row {
  display: grid;
  grid-template-columns: 22px 56px minmax(0, 1fr) 86px 18px;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  border-radius: 6px;
  box-shadow: none;
  cursor: grab;
  padding: 4px 7px;
}

.logistics-doc-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.logistics-detail-link {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0;
  text-align: left;
}

.logistics-doc-row .doc-number {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 15px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-detail-link:hover {
  text-decoration: underline;
}

.logistics-row-customer,
.logistics-row-weight {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-row-customer {
  color: var(--text);
  font-size: 12px;
  line-height: 1.05;
}

.logistics-row-weight {
  justify-self: end;
  color: #334155;
  font-size: 12px;
  line-height: 1;
}

.logistics-row-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 900;
}

.logistics-bulk-assign {
  display: grid;
  grid-template-columns: minmax(92px, .7fr) minmax(120px, 1fr) auto;
  gap: 6px;
  align-items: center;
  flex: 0 0 auto;
  padding: 7px;
  border-top: 1px solid var(--panel-border);
  background: #f8fafc;
}

.logistics-bulk-assign div:first-child {
  display: grid;
  gap: 1px;
}

.logistics-bulk-assign strong {
  font-size: 12px;
}

.logistics-bulk-assign span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.logistics-bulk-assign select {
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 8px;
}

.logistics-bulk-assign button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 9px;
}

.logistics-bulk-assign button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.logistics-route-card.logistics-route-compact {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(300px, .8fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border-left: 6px solid var(--route-color, var(--accent));
  border-radius: 6px;
  box-shadow: none;
  padding: 6px 10px 6px 12px;
}

.logistics-route-compact .route-card-header {
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.logistics-route-compact h2 {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  line-height: 1.05;
  overflow: hidden;
}

.logistics-route-compact h2 .logistics-detail-link {
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-route-compact h2 small {
  flex: 0 1 auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-compact-line {
  display: grid;
  grid-template-columns: 58px minmax(82px, .8fr) 72px 76px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.route-compact-line > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-route-compact .capacity-bar {
  grid-column: 1 / -1;
  height: 5px;
  margin: 0;
}

.logistics-route-compact .warning-badge,
.logistics-route-compact .route-actions {
  margin-top: 2px;
}

.logistics-route-compact .route-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.logistics-route-compact .route-print-link,
.logistics-route-compact .route-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
  text-decoration: none;
}

.logistics-route-compact .route-print-link:hover,
.logistics-route-compact .route-actions button:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: var(--accent-strong);
}

.logistics-route-compact .route-actions button:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.logistics-route-compact .status-pill {
  min-height: 28px;
  border-radius: 999px;
  font-size: 12px;
  padding: 5px 12px;
  white-space: nowrap;
}

.logistics-approve-all-form button {
  min-height: 32px;
  border: 1px solid #99f6e4;
  border-radius: 7px;
  background: #ecfdf5;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
}

.logistics-release-board {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(320px, 1.1fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.logistics-release-panel,
.logistics-release-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
}

.logistics-release-panel {
  overflow: hidden;
}

.logistics-release-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.logistics-release-summary span {
  border: 1px solid #d8e2ec;
  border-radius: 7px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 8px 10px;
}

.logistics-release-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.logistics-release-actions button,
.logistics-release-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
  text-decoration: none;
}

.logistics-release-actions form:first-child button {
  border-color: #99f6e4;
  background: #ecfdf5;
  color: var(--accent-strong);
}

.logistics-release-list {
  overflow: auto;
}

.logistics-release-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 62px;
  gap: 8px;
  align-items: center;
  border: 1px solid #d8e2ec;
  border-left: 5px solid var(--route-color, var(--accent));
  border-radius: 7px;
  background: #ffffff;
  padding: 8px 10px;
}

.logistics-release-list article.is-approved {
  background: #f0fdfa;
}

.logistics-release-list strong,
.logistics-release-list span,
.logistics-release-list small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-release-list strong {
  color: var(--text);
  font-size: 13px;
}

.logistics-release-list span,
.logistics-release-list small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.logistics-release-list a {
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 8px;
  text-align: center;
  text-decoration: none;
}

.logistics-modal-source {
  display: none;
}

.logistics-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(15 23 42 / 42%);
}

.logistics-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgb(15 23 42 / 28%);
}

.logistics-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
}

.logistics-modal h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.logistics-modal header button {
  width: 34px;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.logistics-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.logistics-modal-body > .logistics-modal-source,
.logistics-detail-grid,
.logistics-detail-address,
.logistics-detail-warning,
.logistics-modal-list,
.logistics-modal-list-row,
.order-preview-content {
  display: grid;
}

.logistics-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.logistics-run-modal-source .logistics-detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.logistics-order-modal-source .logistics-detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.logistics-detail-grid > span,
.logistics-detail-address,
.logistics-detail-warning,
.logistics-modal-list-row {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}

.logistics-run-modal-source .logistics-detail-grid > span {
  display: grid;
  align-content: center;
  min-height: 66px;
  gap: 4px;
  border-color: #d8e2ec;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.logistics-order-modal-source .logistics-detail-grid > span {
  display: grid;
  align-content: start;
  min-height: 62px;
  gap: 5px;
  border-color: #d8e2ec;
  background: #ffffff;
}

.logistics-detail-grid small,
.logistics-detail-address small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.logistics-detail-grid b,
.logistics-detail-address b {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.logistics-run-modal-source .logistics-detail-grid b {
  font-size: 17px;
  line-height: 1.15;
}

.logistics-order-modal-source .logistics-detail-grid b {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.logistics-detail-address,
.logistics-detail-warning,
.order-preview-content,
.logistics-modal-list {
  gap: 6px;
  margin-top: 10px;
}

.logistics-order-modal-source .logistics-detail-address {
  gap: 8px;
  background: #ffffff;
  padding: 12px 14px;
}

.logistics-order-modal-source .logistics-detail-address b {
  font-size: 16px;
}

.logistics-order-modal-source .logistics-detail-warning {
  gap: 8px;
  border-color: #fed7aa;
  background: #fff7ed;
  padding: 12px 14px;
}

.logistics-order-modal-source .logistics-detail-warning strong {
  color: #7c2d12;
  font-size: 15px;
}

.logistics-order-modal-source .logistics-detail-warning span {
  color: #9a3412;
  font-size: 13px;
  line-height: 1.25;
}

.logistics-order-modal-source .order-preview-content {
  gap: 10px;
  margin-top: 14px;
}

.logistics-order-modal-source .order-preview-title {
  font-size: 15px;
}

.logistics-order-modal-source .order-preview-table {
  border-color: #d8e2ec;
  border-radius: 8px;
}

.logistics-order-modal-source .order-preview-row {
  grid-template-columns: minmax(320px, 1fr) 82px 108px 82px;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
}

.logistics-order-modal-source .order-preview-row > span {
  color: #334155;
  font-size: 14px;
  line-height: 1.25;
}

.logistics-order-modal-source .order-preview-row > span:not(:first-child) {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.logistics-order-modal-source .order-preview-profit {
  border-radius: 8px;
  font-size: 14px;
  padding: 11px 14px;
}

.logistics-run-modal-source .logistics-modal-list {
  gap: 8px;
  margin-top: 14px;
}

.logistics-modal-list-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.logistics-detail-address.is-uncertain {
  background: #fffbeb;
}

.logistics-detail-address.is-missing,
.logistics-detail-warning {
  background: #fff7ed;
}

.logistics-detail-warning span {
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
}

.logistics-modal-list-row {
  grid-template-columns: 90px minmax(0, 1fr) minmax(160px, 1.1fr) auto;
  gap: 8px;
  align-items: center;
}

.logistics-run-modal-source .logistics-modal-list-row {
  grid-template-columns: 72px minmax(180px, .85fr) minmax(260px, 1.2fr) 34px;
  min-height: 52px;
  border-color: #d8e2ec;
  background: #ffffff;
  box-shadow: 0 4px 12px rgb(15 23 42 / 5%);
}

.logistics-modal-list-row > * {
  min-width: 0;
}

.logistics-modal-list-row span,
.logistics-modal-list-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-modal-list-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.logistics-run-modal-source .logistics-modal-order-link {
  color: var(--text);
  font-size: 18px;
  text-align: left;
}

.logistics-run-modal-source .logistics-modal-order-link:hover {
  color: var(--accent-strong);
}

.logistics-modal-list-customer {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.logistics-run-modal-source .logistics-modal-list-row small {
  display: flex;
  gap: 7px;
  align-items: center;
}

.logistics-run-modal-source .logistics-modal-list-row small b {
  flex: 0 0 auto;
  color: #334155;
}

.logistics-run-modal-source .logistics-modal-list-row small span {
  min-width: 0;
}

.logistics-modal-list-row button {
  width: 30px;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  font-weight: 900;
}

.logistics-run-modal-source .logistics-modal-list-row button:hover {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.order-preview-anchor .order-preview-tooltip {
  display: none !important;
}

.sales-orders-panel {
  width: calc(100vw - 56px);
  max-width: calc(100vw - 56px);
  margin-left: calc(50% - 50vw + 28px);
  overflow-x: auto;
}

.sales-orders-panel table {
  table-layout: fixed;
  min-width: 1480px;
}

.sales-orders-panel th,
.sales-orders-panel td {
  padding: 10px 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: normal;
}

.sales-orders-panel th:nth-child(1),
.sales-orders-panel td:nth-child(1) {
  width: 92px;
}

.sales-orders-panel th:nth-child(2),
.sales-orders-panel td:nth-child(2) {
  width: 120px;
}

.sales-orders-panel th:nth-child(3),
.sales-orders-panel td:nth-child(3),
.sales-orders-panel th:nth-child(4),
.sales-orders-panel td:nth-child(4) {
  width: 17%;
}

.sales-orders-panel th:nth-child(5),
.sales-orders-panel td:nth-child(5) {
  width: 12%;
}

.sales-orders-panel th:nth-child(6),
.sales-orders-panel td:nth-child(6) {
  width: 13%;
}

.sales-orders-panel th:nth-child(7),
.sales-orders-panel td:nth-child(7) {
  width: 10%;
}

.sales-orders-panel th:nth-child(8),
.sales-orders-panel td:nth-child(8) {
  width: 130px;
}

.sales-orders-panel th:nth-child(9),
.sales-orders-panel td:nth-child(9) {
  width: 96px;
  white-space: nowrap;
}

.sales-orders-panel .money-col {
  white-space: nowrap;
}

.sales-order-link.is-loading {
  color: var(--muted);
}


.purchase-orders-panel {
  width: calc(100vw - 56px);
  max-width: calc(100vw - 56px);
  margin-left: calc(50% - 50vw + 28px);
  overflow: hidden;
}

.purchase-orders-panel table {
  table-layout: fixed;
}

.purchase-orders-panel th,
.purchase-orders-panel td {
  padding: 10px 11px;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.25;
}

.purchase-orders-panel th:nth-child(1),
.purchase-orders-panel td:nth-child(1) {
  width: 96px;
}

.purchase-orders-panel th:nth-child(2),
.purchase-orders-panel td:nth-child(2) {
  width: 118px;
}

.purchase-orders-panel th:nth-child(3),
.purchase-orders-panel td:nth-child(3),
.purchase-orders-panel th:nth-child(4),
.purchase-orders-panel td:nth-child(4) {
  width: 15%;
}

.purchase-orders-panel th:nth-child(5),
.purchase-orders-panel td:nth-child(5) {
  width: 12%;
}

.purchase-orders-panel th:nth-child(6),
.purchase-orders-panel td:nth-child(6) {
  width: 13%;
}

.purchase-orders-panel th:nth-child(7),
.purchase-orders-panel td:nth-child(7) {
  width: 10%;
}

.purchase-orders-panel th:nth-child(8),
.purchase-orders-panel td:nth-child(8) {
  width: 112px;
}

.purchase-orders-panel th:nth-child(9),
.purchase-orders-panel td:nth-child(9) {
  width: 116px;
}

.purchase-orders-panel th:nth-child(10),
.purchase-orders-panel td:nth-child(10) {
  width: 88px;
}

.table-link {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0;
  text-align: left;
  text-decoration: none;
}

.table-link:hover,
.table-link:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
}

.table-link:disabled {
  cursor: wait;
  opacity: .65;
}

.purchase-order-link {
  overflow-wrap: anywhere;
}

.purchase-order-modal {
  width: min(1180px, calc(100vw - 36px));
}

.purchase-order-modal-body {
  padding: 16px;
}

.purchase-order-modal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.purchase-order-modal-summary span {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 58px;
  align-content: start;
  border: 1px solid #d8e2ec;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.purchase-order-modal-summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.purchase-order-modal-summary b {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.purchase-order-comment {
  margin-top: 10px;
  border: 1px solid #d8e2ec;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.purchase-order-lines-wrap {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid #d8e2ec;
  border-radius: 8px;
}

.purchase-order-lines-table {
  table-layout: fixed;
  min-width: 860px;
}

.purchase-order-lines-table th,
.purchase-order-lines-table td {
  padding: 10px 12px;
}

.purchase-order-lines-table th:nth-child(1),
.purchase-order-lines-table td:nth-child(1) {
  width: 44%;
}

.purchase-order-lines-table th:nth-child(2),
.purchase-order-lines-table td:nth-child(2) {
  width: 22%;
}

.purchase-order-lines-table th:nth-child(3),
.purchase-order-lines-table td:nth-child(3),
.purchase-order-lines-table th:nth-child(4),
.purchase-order-lines-table td:nth-child(4),
.purchase-order-lines-table th:nth-child(5),
.purchase-order-lines-table td:nth-child(5) {
  width: 11%;
}


.purchase-order-totals-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid #d8e2ec;
  background: #f8fafc;
}

.purchase-order-totals-row span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
}

.purchase-order-totals-row span + span {
  border-left: 1px solid #d8e2ec;
}

.purchase-order-totals-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.purchase-order-totals-row b {
  color: var(--text);
  font-size: 18px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.purchase-order-line-product strong,
.purchase-order-line-product small,
.purchase-order-line-canceled {
  display: block;
  overflow-wrap: anywhere;
}

.purchase-order-line-product small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.purchase-order-line-canceled {
  margin-top: 5px;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 900px) {
  .purchase-orders-panel {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    margin-left: calc(50% - 50vw + 14px);
    overflow-x: auto;
  }

  .purchase-orders-panel table {
    min-width: 920px;
  }

  .purchase-order-modal-summary,
  .purchase-order-totals-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .purchase-order-modal-summary,
  .purchase-order-totals-row {
    grid-template-columns: 1fr;
  }

  .purchase-order-totals-row span + span {
    border-top: 1px solid #d8e2ec;
    border-left: 0;
  }
}

.dispatch-page {
  display: grid;
  gap: 10px;
  min-height: calc(100vh - 150px);
}

.dispatch-toolbar {
  display: grid;
  grid-template-columns: 180px minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin: 0;
}

.dispatch-toolbar label {
  display: grid;
  gap: 4px;
}

.dispatch-toolbar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dispatch-toolbar input,
.dispatch-toolbar select {
  height: 38px;
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  padding: 7px 10px;
}

.dispatch-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #99f6e4;
  border-radius: 7px;
  background: #ecfdf5;
  color: var(--accent-strong);
  font-weight: 900;
  padding: 7px 12px;
  text-decoration: none;
}

.dispatch-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.dispatch-summary article {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.dispatch-summary strong,
.dispatch-summary span {
  display: block;
}

.dispatch-summary strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.dispatch-summary span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dispatch-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 10px;
  min-height: 0;
}

.dispatch-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #f8fafc;
}

.dispatch-column > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--panel-border);
  background: #ffffff;
  padding: 10px 12px;
}

.dispatch-column > header strong {
  color: var(--text);
}

.dispatch-column > header span {
  color: var(--muted);
  font-weight: 900;
}

.dispatch-column > div {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.dispatch-run-card {
  display: grid;
  gap: 8px;
  border: 1px solid #d8e2ec;
  border-left: 5px solid var(--route-color, var(--accent));
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 5px 14px rgb(15 23 42 / 5%);
  padding: 10px;
}

.dispatch-run-card.is-problem {
  background: #fff7ed;
  border-color: #fed7aa;
}

.dispatch-run-card.is-available {
  background: #f8fafc;
}

.dispatch-run-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.dispatch-run-card strong,
.dispatch-run-card span,
.dispatch-run-card b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-run-card strong {
  display: block;
  color: var(--accent-strong);
  font-size: 13px;
}

.dispatch-run-card header span,
.dispatch-run-timeline span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.dispatch-run-card header b {
  flex: 0 0 auto;
  align-self: start;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: #ecfdf5;
  color: var(--accent-strong);
  font-size: 11px;
  padding: 4px 8px;
}

.dispatch-run-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.dispatch-run-facts span {
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  font-size: 11px;
  font-weight: 900;
  padding: 6px;
  text-align: center;
}

.dispatch-run-timeline {
  display: grid;
  gap: 3px;
}

.dispatch-run-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.dispatch-run-actions form {
  display: contents;
}

.dispatch-run-actions button,
.dispatch-run-actions a {
  min-height: 28px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  padding: 5px 8px;
  text-decoration: none;
}

.dispatch-run-actions .primary {
  border-color: #99f6e4;
  background: #0f766e;
  color: #ffffff;
}

.dispatch-run-actions .danger {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

@media (max-width: 1180px) {
  .dispatch-board {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .dispatch-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.summary-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.access-view-form {
  width: 100%;
  padding: 8px 10px;
}

.access-view-form select {
  width: 100%;
  min-width: 180px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 7px 9px;
}

.access-view-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid #f4c56b;
  border-radius: 8px;
  background: #fff8e6;
  color: #5f3b00;
}

.access-view-banner form {
  margin: 0;
}

.access-view-banner button,
.access-profile-actions button,
.access-group-form button {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}

.access-group-cell {
  min-width: 260px;
}

.access-group-form {
  display: grid;
  gap: 8px;
}

.access-group-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(100px, 1fr));
  gap: 6px 10px;
}

.access-group-options label,
.permission-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text);
}

.access-group-options input,
.permission-check input {
  margin-top: 3px;
}

.access-overview {
  display: grid;
  gap: 18px;
}

.access-profile {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.access-profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--panel-border);
  background: var(--panel-header-bg);
  cursor: pointer;
  list-style: none;
}

.access-profile-header::-webkit-details-marker {
  display: none;
}

.access-profile-header::after {
  content: "";
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.access-profile:not([open]) .access-profile-header {
  border-bottom: 0;
}

.access-profile:not([open]) .access-profile-header::after {
  transform: rotate(-45deg);
}

.access-profile-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.access-profile-header p {
  margin: 0;
  color: var(--muted);
}

.access-profile-header > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: auto;
}

.access-module {
  margin: 0;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--panel-border);
}

.access-module legend {
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px 18px;
  margin-top: 10px;
}

.permission-check span {
  display: grid;
  gap: 2px;
}

.permission-check strong {
  font-size: 14px;
}

.permission-check small {
  color: var(--muted);
  line-height: 1.35;
}

.access-profile-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 18px;
}

.access-profile-actions span {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 900px) {
  .permission-grid,
  .access-group-options {
    grid-template-columns: 1fr;
  }

  .access-view-banner,
  .access-profile-header {
    align-items: stretch;
    flex-direction: column;
  }
}

.user-password-note {
  margin: 0 0 14px;
}

.user-password-cell {
  min-width: 250px;
}

.password-reset-form {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) minmax(78px, 0.85fr) auto;
  gap: 6px;
  align-items: center;
}

.password-reset-form input {
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: 8px 9px;
}

.password-reset-form button {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 8px 10px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .password-reset-form {
    grid-template-columns: 1fr;
  }
}


.inline-admin-form {
  margin-top: 8px;
}

.inline-admin-form button,
.admin-user-actions button,
.access-copy-form button,
.access-scopes-form button,
.admin-panel button,
.table-panel td form button {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 8px 10px;
  white-space: nowrap;
}

.password-reset-form {
  grid-template-columns: minmax(110px, 1fr) minmax(90px, 0.9fr);
}

.compact-check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  grid-column: 1 / -1;
}

.compact-check input {
  margin: 0;
}

.password-reset-form button {
  grid-column: 1 / -1;
}

.user-badge.inactive {
  background: #e9edf3;
  color: #5d6777;
}

.muted-row {
  opacity: 0.72;
}

.effective-access-cell {
  min-width: 220px;
}

.effective-access-cell summary {
  cursor: pointer;
  font-weight: 800;
}

.effective-access-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  max-height: 180px;
  overflow: auto;
}

.effective-access-list span {
  color: var(--muted);
  font-size: 12px;
}

.admin-user-actions {
  display: grid;
  gap: 6px;
}

.access-scopes-form {
  border-top: 1px solid var(--panel-border);
  padding: 16px 18px 0;
}

.access-scopes-form h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.scope-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.scope-grid textarea {
  min-width: 0;
  resize: vertical;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  padding: 9px 10px;
}

.access-copy-form {
  display: flex;
  justify-content: flex-start;
  padding: 0 18px 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.admin-panel {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fff;
  padding: 16px 18px;
}

.admin-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.status-list,
.metric-grid {
  display: grid;
  gap: 10px;
}

.status-list > div,
.metric-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
}

.metric-grid span {
  color: var(--muted);
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.status-pill.ok {
  background: #e8f7ee;
  color: #0f6b38;
}

.status-pill.bad {
  background: #fdecec;
  color: #9b1c1c;
}

@media (max-width: 900px) {
  .scope-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}


.user-create-panel {
  margin: 0 0 16px;
  overflow: visible;
}

.user-create-form {
  display: grid;
  gap: 14px;
}

.user-create-fields {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}

.user-create-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.user-create-field span,
.user-create-groups legend,
.user-create-flags legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.user-create-field input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
}

.user-create-access-row {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(260px, 0.45fr);
  gap: 12px;
}

.user-create-groups,
.user-create-flags {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  margin: 0;
  padding: 10px 12px 12px;
}

.user-create-group-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 8px 14px;
}

.user-create-flags {
  align-content: start;
  display: grid;
  gap: 8px;
}

.user-create-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
}

.user-create-check input {
  flex: 0 0 auto;
  margin: 0;
}

.user-create-check span {
  min-width: 0;
}

.user-create-actions {
  display: flex;
  justify-content: flex-start;
}

.user-create-actions button {
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 14px;
}

@media (max-width: 1180px) {
  .user-create-fields {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .user-create-access-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .user-create-fields,
  .user-create-group-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .dashboard-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payments-toolbar {
    grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(140px, .3fr)) auto;
  }

  .payments-toolbar .toolbar-field,
  .payments-toolbar .secondary-link {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .dashboard-metric-grid,
  .dashboard-money-panel,
  .dashboard-money-grid,
  .dashboard-reserve-panel,
  .dashboard-profit-panel,
  .dashboard-report-panel {
    grid-template-columns: 1fr;
  }

  .dashboard-title {
    align-items: flex-start;
  }

  .dashboard-money-head,
  .dashboard-report-main {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-money-item + .dashboard-money-item {
    border-left: 0;
  }

  .dashboard-reserve-aside {
    border-left: 0;
  }

  .dashboard-profit-cell {
    border-left: 0;
  }
}

@media (max-width: 1180px) {
  .document-toolbar {
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(140px, .35fr)) auto;
  }

  .document-toolbar .secondary-link {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .payments-toolbar {
    grid-template-columns: 1fr;
  }

  .payments-toolbar .toolbar-field,
  .payments-toolbar .secondary-link {
    grid-column: auto;
  }
}


.trade-rep-kpi.is-clickable,
.trade-rep-stat.is-clickable,
.trade-rep-gap-list a,
.trade-rep-group-link {
  color: inherit;
  text-decoration: none;
  transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.trade-rep-kpi.is-clickable:hover,
.trade-rep-kpi.is-clickable:focus-visible,
.trade-rep-stat.is-clickable:hover,
.trade-rep-stat.is-clickable:focus-visible,
.trade-rep-gap-list a:hover,
.trade-rep-gap-list a:focus-visible,
.trade-rep-group-link:hover,
.trade-rep-group-link:focus-visible {
  background: #f8fbff;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rep-accent) 28%, var(--line));
  outline: none;
}

.trade-rep-gap-list a,
.trade-rep-group-link {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.trade-rep-group-link {
  gap: 7px;
}

.trade-rep-group-list li {
  padding: 0;
}

.trade-rep-group-link {
  padding: 11px;
}

.trade-rep-kpi[data-tooltip],
.trade-rep-stat[data-tooltip],
.trade-rep-gap-list a[data-tooltip],
.trade-rep-group-link[data-tooltip] {
  position: relative;
}

.trade-rep-kpi[data-tooltip]:hover,
.trade-rep-stat[data-tooltip]:hover,
.trade-rep-gap-list a[data-tooltip]:hover,
.trade-rep-group-link[data-tooltip]:hover,
.trade-rep-kpi[data-tooltip]:focus-visible,
.trade-rep-stat[data-tooltip]:focus-visible,
.trade-rep-gap-list a[data-tooltip]:focus-visible,
.trade-rep-group-link[data-tooltip]:focus-visible {
  z-index: 120;
}

.trade-rep-kpi[data-tooltip]::before,
.trade-rep-stat[data-tooltip]::before,
.trade-rep-gap-list a[data-tooltip]::before,
.trade-rep-group-link[data-tooltip]::before,
.trade-rep-kpi[data-tooltip]::after,
.trade-rep-stat[data-tooltip]::after,
.trade-rep-gap-list a[data-tooltip]::after,
.trade-rep-group-link[data-tooltip]::after {
  position: absolute;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}

.trade-rep-kpi[data-tooltip]::before,
.trade-rep-stat[data-tooltip]::before,
.trade-rep-gap-list a[data-tooltip]::before,
.trade-rep-group-link[data-tooltip]::before {
  content: "";
  left: 22px;
  top: calc(100% + 2px);
  border: 7px solid transparent;
  border-bottom-color: #111827;
  transform: translateY(-4px);
}

.trade-rep-kpi[data-tooltip]::after,
.trade-rep-stat[data-tooltip]::after,
.trade-rep-gap-list a[data-tooltip]::after,
.trade-rep-group-link[data-tooltip]::after {
  content: attr(data-tooltip);
  left: 10px;
  top: calc(100% + 15px);
  width: min(360px, calc(100vw - 44px));
  max-width: 360px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #111827;
  color: #f8fafc;
  box-shadow: 0 16px 38px rgb(15 23 42 / 22%);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  transform: translateY(-4px);
}

.trade-rep-kpi[data-tooltip]:hover::before,
.trade-rep-stat[data-tooltip]:hover::before,
.trade-rep-gap-list a[data-tooltip]:hover::before,
.trade-rep-group-link[data-tooltip]:hover::before,
.trade-rep-kpi[data-tooltip]:focus-visible::before,
.trade-rep-stat[data-tooltip]:focus-visible::before,
.trade-rep-gap-list a[data-tooltip]:focus-visible::before,
.trade-rep-group-link[data-tooltip]:focus-visible::before,
.trade-rep-kpi[data-tooltip]:hover::after,
.trade-rep-stat[data-tooltip]:hover::after,
.trade-rep-gap-list a[data-tooltip]:hover::after,
.trade-rep-group-link[data-tooltip]:hover::after,
.trade-rep-kpi[data-tooltip]:focus-visible::after,
.trade-rep-stat[data-tooltip]:focus-visible::after,
.trade-rep-gap-list a[data-tooltip]:focus-visible::after,
.trade-rep-group-link[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .trade-rep-kpi[data-tooltip]::after,
  .trade-rep-stat[data-tooltip]::after,
  .trade-rep-gap-list a[data-tooltip]::after,
  .trade-rep-group-link[data-tooltip]::after {
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }
}

.trade-detail-page {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.trade-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--panel-raised-border);
  border-top: 4px solid var(--rep-accent);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.trade-detail-head div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.trade-detail-head h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.12;
}

.trade-detail-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.trade-detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  min-width: 0;
}

.trade-detail-summary div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.trade-detail-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trade-detail-summary strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.trade-detail-table-wrap {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--panel-raised-shadow);
}

.trade-detail-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 13px;
}

.trade-detail-table th,
.trade-detail-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.trade-detail-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.trade-detail-table td {
  color: var(--text);
  font-weight: 700;
}

.trade-detail-table td a {
  color: var(--accent-strong);
  font-weight: 900;
  text-decoration: none;
}

.trade-detail-table tr:hover td {
  background: #fbfdff;
}

@media (max-width: 760px) {
  .trade-detail-head {
    display: grid;
  }

  .trade-detail-table {
    min-width: 720px;
  }
}

/* Dashboard mobile app shell */
.dashboard-body,
.dashboard-body .page-shell,
.dashboard-body .dashboard-page {
  min-width: 0;
}

@media (max-width: 760px) {
  body.dashboard-body {
    width: 100%;
    overflow-x: hidden;
    background: #eef2f7;
  }

  .dashboard-body .app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    gap: 10px;
    padding: 10px 10px 8px;
    background: rgb(255 255 255 / 96%);
    border-bottom: 1px solid #dbe3ec;
    box-shadow: 0 10px 28px rgb(15 23 42 / 10%);
    backdrop-filter: blur(14px) saturate(1.15);
  }

  .dashboard-body .header-left,
  .dashboard-body .header-right,
  .dashboard-body .brand,
  .dashboard-body .top-nav {
    width: 100%;
  }

  .dashboard-body .header-left,
  .dashboard-body .header-right {
    gap: 8px;
  }

  .dashboard-body .brand {
    min-height: 34px;
  }

  .dashboard-body .brand-mark {
    width: 36px;
    height: 30px;
    border-radius: 8px;
  }

  .dashboard-body .brand-name {
    font-size: 16px;
  }

  .dashboard-body .top-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .dashboard-body .nav-group,
  .dashboard-body .user-menu {
    min-width: 0;
  }

  .dashboard-body .top-nav button {
    width: 100%;
    min-height: 36px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 8px 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-body .top-nav button.active,
  .dashboard-body .top-nav button:hover,
  .dashboard-body .top-nav button:focus-visible {
    border-color: #bbf7d0;
    background: #ecfdf5;
  }

  .dashboard-body .nav-menu {
    position: static;
    width: 100%;
    min-width: 0;
    margin-top: 6px;
    border-radius: 8px;
    box-shadow: none;
  }

  .dashboard-body .nav-menu a {
    white-space: normal;
    line-height: 1.2;
  }

  .dashboard-body .header-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .dashboard-body .data-freshness-indicator {
    min-width: 0;
    min-height: 38px;
    justify-content: flex-start;
    overflow: hidden;
    padding: 0 10px;
  }

  .dashboard-body .data-freshness-indicator [data-freshness-text] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-body .user-menu > button {
    width: 100%;
    max-width: 132px;
    min-height: 38px;
    overflow: hidden;
    border-radius: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-body .user-menu-panel {
    right: 0;
    left: auto;
    width: min(270px, calc(100vw - 20px));
    min-width: 0;
  }

  .dashboard-body .page-shell {
    width: 100%;
    max-width: none;
    padding: 10px 10px 18px;
  }

  .dashboard-body .dashboard-page {
    gap: 10px;
  }

  .dashboard-body .dashboard-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    padding: 6px;
    border-radius: 10px;
    box-shadow: 0 8px 22px rgb(15 23 42 / 8%);
  }

  .dashboard-body .dashboard-tab {
    width: 100%;
    min-height: 40px;
    padding: 8px 7px;
    border: 1px solid transparent;
    text-align: center;
    line-height: 1.15;
    white-space: normal;
  }

  .dashboard-body .dashboard-tab.is-active {
    box-shadow: 0 8px 18px rgb(15 118 110 / 18%);
  }

  .dashboard-body .dashboard-metric-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dashboard-body .dashboard-metric-card,
  .dashboard-body .dashboard-operational-toolbar,
  .dashboard-body .dashboard-money-panel,
  .dashboard-body .dashboard-reserve-panel,
  .dashboard-body .dashboard-profit-panel,
  .dashboard-body .trade-reps-toolbar,
  .dashboard-body .trade-rep-block {
    border-radius: 10px;
    box-shadow: 0 8px 22px rgb(15 23 42 / 8%);
  }

  .dashboard-body .dashboard-metric-card {
    min-height: 126px;
    gap: 8px;
    padding: 14px;
  }

  .dashboard-body .dashboard-metric-card strong {
    font-size: 30px;
  }

  .dashboard-body .dashboard-metric-total b,
  .dashboard-body .money-value {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .dashboard-body .dashboard-money-head,
  .dashboard-body .dashboard-money-item,
  .dashboard-body .dashboard-reserve-link,
  .dashboard-body .dashboard-reserve-aside,
  .dashboard-body .dashboard-profit-main,
  .dashboard-body .dashboard-profit-cell {
    padding: 14px;
  }

  .dashboard-body .dashboard-money-head strong,
  .dashboard-body .dashboard-reserve-link strong,
  .dashboard-body .dashboard-profit-main strong {
    font-size: 26px;
  }

  .dashboard-body .dashboard-money-item b,
  .dashboard-body .dashboard-profit-cell b {
    font-size: 20px;
  }

  .dashboard-body .trade-reps-toolbar {
    gap: 12px;
    padding: 14px;
  }

  .dashboard-body .dashboard-operational-toolbar {
    padding: 14px;
  }

  .dashboard-body .dashboard-operational-period {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .dashboard-body .trade-reps-heading h1 {
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  .dashboard-body .trade-reps-settings-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 36px;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    background: #ecfdf5;
    padding: 8px 10px;
    text-align: center;
  }

  .dashboard-body .trade-reps-period-switch,
  .dashboard-body .trade-reps-period-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-body .trade-rep-header {
    gap: 10px;
    padding: 14px 14px 0;
  }

  .dashboard-body .trade-rep-header h2 {
    font-size: 20px;
    overflow-wrap: anywhere;
  }

  .dashboard-body .trade-rep-header b {
    line-height: 1.2;
    white-space: normal;
  }

  .dashboard-body .trade-rep-kpi,
  .dashboard-body .trade-rep-stat {
    padding: 12px;
  }

  .dashboard-body .trade-rep-kpi strong {
    font-size: 22px;
  }

  .dashboard-body .trade-rep-stat strong {
    font-size: 18px;
  }

  .dashboard-body .trade-rep-panel {
    padding: 14px;
  }

  .dashboard-body .trade-rep-group-list span {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (min-width: 380px) and (max-width: 760px) {
  .dashboard-body .top-nav,
  .dashboard-body .dashboard-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-body .dashboard-metric-grid,
  .dashboard-body .trade-rep-kpis,
  .dashboard-body .trade-rep-stat-grid,
  .dashboard-body .trade-rep-stat-grid--clients,
  .dashboard-body .trade-rep-stat-grid--debt,
  .dashboard-body .trade-rep-stat-grid--assortment,
  .dashboard-body .trade-rep-gap-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .dashboard-body .header-right {
    grid-template-columns: 1fr;
  }

  .dashboard-body .user-menu > button {
    max-width: none;
  }
}

/* Mobile table card view */
.page-shell .table-panel,
.page-shell .detail-table-panel,
.page-shell .wide-table-wrap,
.page-shell .analytics-table-wrap,
.page-shell .finance-table-wrap,
.page-shell .receivables-table-wrap,
.page-shell .transfer-table-wrap,
.page-shell .abc-table-wrap {
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 760px) {
  body:not(.auth-body) {
    overflow-x: hidden;
  }

  .page-shell {
    width: 100%;
    max-width: 100%;
  }

  .page-shell .metric-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .page-shell .metric-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
  }

  .page-shell .metric-card strong,
  .page-shell .metric-card p,
  .page-shell .metric-card span {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .page-shell .tabs-nav,
  .page-shell .sub-tabs,
  .page-shell .abc-method-tabs,
  .page-shell .check-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
    width: 100%;
    min-width: 0;
  }

  .page-shell .tabs-nav a {
    flex: 1 1 min(100%, 150px);
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    justify-content: center;
  }

  .page-shell .profit-document-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 10px;
    min-width: 0;
    overflow: visible;
  }

  .page-shell .profit-document-card span,
  .page-shell .profit-document-card strong,
  .page-shell .profit-document-card .numeric-col {
    justify-self: stretch;
    max-width: 100%;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .page-shell .manager-contract-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 4px;
    padding: 10px;
  }

  .page-shell .manager-contract-heading strong,
  .page-shell .manager-contract-heading span {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }


  .page-title,
  .breadcrumbs-row {
    min-width: 0;
  }

  .page-title h1,
  .breadcrumbs-title,
  .status-pill {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .toolbar,
  .document-toolbar,
  .payments-toolbar,
  .receivables-toolbar,
  .analytics-filters,
  .abc-toolbar,
  .transfer-filter-form,
  .marketing-filter-form,
  .stock-filter-form,
  .access-toolbar,
  .admin-toolbar {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr !important;
  }

  .toolbar input,
  .toolbar select,
  .toolbar button,
  .toolbar .secondary-link,
  .document-toolbar input,
  .document-toolbar select,
  .document-toolbar button,
  .document-toolbar .secondary-link,
  .payments-toolbar input,
  .payments-toolbar select,
  .payments-toolbar button,
  .payments-toolbar .secondary-link,
  .receivables-toolbar input,
  .receivables-toolbar select,
  .receivables-toolbar button,
  .analytics-filters input,
  .analytics-filters select,
  .analytics-filters button {
    width: 100%;
    min-width: 0;
  }

  .page-shell .table-panel,
  .page-shell .detail-table-panel {
    overflow: visible;
    padding: 10px;
    border-radius: 10px;
  }

  .page-shell .wide-table-wrap,
  .page-shell .analytics-table-wrap,
  .page-shell .finance-table-wrap,
  .page-shell .receivables-table-wrap,
  .page-shell .transfer-table-wrap,
  .page-shell .abc-table-wrap {
    overflow: visible;
  }

  .table-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 0 2px 10px;
  }

  .page-shell table[data-mobile-table],
  .logistics-modal table[data-mobile-table] {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
  }

  .page-shell table[data-mobile-table] thead,
  .logistics-modal table[data-mobile-table] thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .page-shell table[data-mobile-table] tbody,
  .logistics-modal table[data-mobile-table] tbody {
    display: grid;
    gap: 10px;
    width: 100%;
  }

  .page-shell table[data-mobile-table] tr,
  .logistics-modal table[data-mobile-table] tr {
    display: grid;
    gap: 0;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 7px 18px rgb(15 23 42 / 6%);
  }

  .page-shell table[data-mobile-table] td,
  .page-shell table[data-mobile-table] th,
  .logistics-modal table[data-mobile-table] td,
  .logistics-modal table[data-mobile-table] th {
    position: static;
    display: grid;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    padding: 10px 12px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.28;
    text-align: left !important;
    white-space: normal !important;
    overflow: visible;
    overflow-wrap: anywhere;
    box-shadow: none;
  }

  .page-shell table[data-mobile-table] tr > :last-child,
  .logistics-modal table[data-mobile-table] tr > :last-child {
    border-bottom: 0;
  }

  .page-shell table[data-mobile-table] td::before,
  .page-shell table[data-mobile-table] th::before,
  .logistics-modal table[data-mobile-table] td::before,
  .logistics-modal table[data-mobile-table] th::before {
    content: attr(data-label);
    min-width: 0;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .02em;
    overflow-wrap: anywhere;
  }

  .page-shell table[data-mobile-table] td:not([data-label])::before,
  .page-shell table[data-mobile-table] th:not([data-label])::before,
  .logistics-modal table[data-mobile-table] td:not([data-label])::before,
  .logistics-modal table[data-mobile-table] th:not([data-label])::before {
    display: none;
  }

  .page-shell table[data-mobile-table] .mobile-table-full,
  .page-shell table[data-mobile-table] .empty-state,
  .logistics-modal table[data-mobile-table] .mobile-table-full,
  .logistics-modal table[data-mobile-table] .empty-state {
    display: block;
    grid-template-columns: none;
    text-align: center !important;
  }

  .page-shell table[data-mobile-table] .mobile-table-full::before,
  .page-shell table[data-mobile-table] .empty-state::before,
  .logistics-modal table[data-mobile-table] .mobile-table-full::before,
  .logistics-modal table[data-mobile-table] .empty-state::before {
    display: none;
  }

  .page-shell table[data-mobile-table] .numeric-col,
  .page-shell table[data-mobile-table] .money-col,
  .logistics-modal table[data-mobile-table] .numeric-col,
  .logistics-modal table[data-mobile-table] .money-col {
    text-align: left !important;
    white-space: normal !important;
  }

  .page-shell table[data-mobile-table] strong,
  .page-shell table[data-mobile-table] b,
  .page-shell table[data-mobile-table] a,
  .page-shell table[data-mobile-table] button,
  .logistics-modal table[data-mobile-table] strong,
  .logistics-modal table[data-mobile-table] b,
  .logistics-modal table[data-mobile-table] a,
  .logistics-modal table[data-mobile-table] button {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .page-shell table[data-mobile-table] .table-link,
  .logistics-modal table[data-mobile-table] .table-link {
    justify-content: flex-start;
    width: fit-content;
    max-width: 100%;
    min-height: 32px;
    padding: 0;
    text-align: left;
  }

  .page-shell table[data-mobile-table] .table-actions,
  .logistics-modal table[data-mobile-table] .table-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100% !important;
  }

  .page-shell table[data-mobile-table] .table-actions form,
  .page-shell table[data-mobile-table] .table-actions button,
  .page-shell table[data-mobile-table] .table-actions a,
  .logistics-modal table[data-mobile-table] .table-actions form,
  .logistics-modal table[data-mobile-table] .table-actions button,
  .logistics-modal table[data-mobile-table] .table-actions a {
    width: 100%;
  }

  .pagination {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .pagination a {
    justify-content: center;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 380px) {
  .page-shell table[data-mobile-table] td,
  .page-shell table[data-mobile-table] th,
  .logistics-modal table[data-mobile-table] td,
  .logistics-modal table[data-mobile-table] th {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}


.reserves-toolbar {
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
}

.reserves-toolbar .reserves-search-field {
  min-width: min(520px, 100%);
}

.reserve-filter-buttons {
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  display: inline-flex;
  gap: 2px;
  min-height: 40px;
  padding: 3px;
  white-space: nowrap;
}

.reserve-filter-button {
  align-items: center;
  border-radius: 6px;
  color: #334155;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  min-height: 32px;
  padding: 0 11px;
  text-decoration: none;
}

.reserve-filter-button:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.reserve-filter-button.is-active {
  background: #0f172a;
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.reserves-metrics .metric-card strong {
  white-space: nowrap;
}

.reserves-summary-table .reserve-row-link {
  color: inherit;
  display: block;
  text-decoration: none;
}

.reserves-summary-table tr:hover td {
  background: #f8fafc;
}

.reserves-summary-table td small,
.reserve-lines-table td small {
  color: #64748b;
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.reserve-detail-title {
  align-items: flex-start;
}

.reserve-pdf-link,
.reserve-detail-toolbar .secondary-link {
  align-items: center;
  background: #0f172a;
  border: 1px solid #0f172a;
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
  white-space: nowrap;
}

.reserve-detail-toolbar .secondary-link {
  background: #fff;
  color: #0f172a;
}

.reserve-documents-list {
  display: grid;
  gap: 12px;
}

.reserve-document-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.reserve-document-card summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 1.2fr) minmax(170px, 1fr) minmax(150px, 0.8fr) minmax(150px, auto) auto;
  list-style: none;
  padding: 14px 16px;
}

.reserve-document-card summary::-webkit-details-marker {
  display: none;
}

.reserve-document-main strong,
.reserve-document-main small,
.reserve-document-person strong,
.reserve-document-person small,
.reserve-document-meta span {
  display: block;
}

.reserve-document-main small,
.reserve-document-person small,
.reserve-document-meta span:last-child,
.reserve-document-facts span {
  color: #64748b;
  font-size: 13px;
}

.reserve-document-meta {
  text-align: right;
}

.reserve-people-cell {
  color: #334155;
  font-size: 13px;
  line-height: 1.35;
  max-width: 260px;
}

.reserve-payment-pill {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  justify-self: end;
  padding: 6px 10px;
  white-space: nowrap;
}

.reserve-payment-pill.is-paid {
  background: #dcfce7;
  color: #166534;
}

.reserve-payment-pill.is-partial {
  background: #fef3c7;
  color: #92400e;
}

.reserve-payment-pill.is-unpaid {
  background: #fee2e2;
  color: #991b1b;
}

.reserve-document-body {
  border-top: 1px solid #e5e7eb;
  padding: 12px 16px 16px;
}

.reserve-document-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 10px;
}

.reserve-lines-wrap {
  max-height: none;
}

.reserve-selected-line td {
  background: #fff7ed;
}

@media (max-width: 760px) {
  .reserves-toolbar,
  .reserve-document-card summary {
    grid-template-columns: 1fr;
  }

  .reserve-filter-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .reserve-filter-button {
    justify-content: center;
    padding: 0 8px;
  }

  .reserve-document-meta,
  .reserve-payment-pill {
    justify-self: start;
    text-align: left;
  }

  .reserve-pdf-link,
  .reserve-detail-toolbar .secondary-link {
    justify-content: center;
    width: 100%;
  }
}

/* Compact mobile header menu */
@media (max-width: 760px) {
  body:not(.auth-body) .app-header {
    position: sticky;
    top: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand controls"
      "nav nav";
    align-items: center;
    gap: 7px 10px;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 8px 10px 6px;
    background: rgb(255 255 255 / 96%);
    border-bottom: 1px solid #dbe3ec;
    box-shadow: 0 8px 22px rgb(15 23 42 / 10%);
    backdrop-filter: blur(14px) saturate(1.15);
  }

  body:not(.auth-body) .app-header .header-left {
    display: contents;
  }

  body:not(.auth-body) .app-header .brand {
    grid-area: brand;
    width: auto;
    min-width: 0;
    min-height: 32px;
    gap: 8px;
    align-items: center;
  }

  body:not(.auth-body) .app-header .brand-mark {
    width: 34px;
    height: 30px;
    border-radius: 8px;
    font-size: 13px;
  }

  body:not(.auth-body) .app-header .brand-name {
    font-size: 16px;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.auth-body) .app-header .header-right {
    grid-area: controls;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: auto;
    min-width: 0;
  }

  body:not(.auth-body) .app-header .top-nav {
    grid-area: nav;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 32px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0 0 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  body:not(.auth-body).has-open-header-menu {
    overflow-x: hidden;
  }

  body:not(.auth-body) .app-header .top-nav::-webkit-scrollbar {
    display: none;
  }

  body:not(.auth-body) .app-header .nav-group,
  body:not(.auth-body) .app-header .user-menu {
    position: relative;
    flex: 0 0 auto;
    min-width: 0;
  }

  body:not(.auth-body) .app-header .nav-group.is-open,
  body:not(.auth-body) .app-header .user-menu.is-open {
    z-index: 80;
  }

  body:not(.auth-body) .app-header .top-nav button {
    width: auto;
    min-width: 0;
    max-width: none;
    min-height: 30px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    padding: 6px 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    box-shadow: none;
  }

  body:not(.auth-body) .app-header .top-nav button.active,
  body:not(.auth-body) .app-header .top-nav button:hover,
  body:not(.auth-body) .app-header .top-nav button:focus-visible {
    border-color: #86efac;
    background: #ecfdf5;
    color: var(--accent-strong);
  }

  body:not(.auth-body) .app-header .nav-menu {
    display: none !important;
  }

  body:not(.auth-body) .app-header .nav-menu a {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.2;
    white-space: normal;
  }

  body:not(.auth-body) .app-header .data-freshness-indicator {
    width: auto;
    min-width: 0;
    max-width: 116px;
    min-height: 30px;
    justify-content: flex-start;
    gap: 6px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    overflow: hidden;
  }

  body:not(.auth-body) .app-header .data-freshness-light {
    width: 8px;
    height: 8px;
    box-shadow: 0 0 0 3px rgb(22 163 74 / 14%);
  }

  body:not(.auth-body) .app-header .data-freshness-indicator [data-freshness-text] {
    min-width: 0;
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.auth-body) .app-header .user-menu > button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 30px;
    min-height: 30px;
    max-width: none;
    padding: 0;
    border-radius: 999px;
    font-size: 0;
    color: var(--muted);
    background: #f8fafc;
  }

  body:not(.auth-body) .app-header .user-menu > button::before {
    content: "";
    display: block;
    width: 14px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
  }

  body:not(.auth-body) .app-header .user-menu-panel {
    display: none !important;
  }

  body:not(.auth-body) .app-header .user-menu-panel a,
  body:not(.auth-body) .app-header .user-menu-panel button {
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.2;
  }

  body:not(.auth-body) .app-header .access-view-form select {
    width: 100%;
    min-height: 34px;
    border-radius: 10px;
    padding: 0 8px;
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  body:not(.auth-body) .app-header .data-freshness-indicator {
    max-width: 32px;
    justify-content: center;
    padding: 0;
  }

  body:not(.auth-body) .app-header .data-freshness-indicator [data-freshness-text] {
    display: none;
  }
}


.expense-intake-table-wrap table {
  table-layout: fixed;
  min-width: 1500px;
}

.expense-intake-table th,
.expense-intake-table td {
  min-width: 0;
  vertical-align: top;
}

.expense-intake-table th:nth-child(1),
.expense-intake-table td:nth-child(1) {
  width: 180px;
}

.expense-intake-table th:nth-child(2),
.expense-intake-table td:nth-child(2) {
  width: 190px;
  min-width: 190px;
}

.expense-intake-table th:nth-child(3),
.expense-intake-table td:nth-child(3) {
  width: 160px;
}

.expense-intake-table th:nth-child(4),
.expense-intake-table td:nth-child(4) {
  width: 116px;
}

.expense-intake-table th:nth-child(5),
.expense-intake-table td:nth-child(5) {
  width: 390px;
}

.expense-intake-table th:nth-child(6),
.expense-intake-table td:nth-child(6) {
  width: 360px;
}

.expense-intake-table th:nth-child(7),
.expense-intake-table td:nth-child(7) {
  width: 230px;
}

.expense-intake-table th:nth-child(8),
.expense-intake-table td:nth-child(8) {
  width: 132px;
}

.expense-intake-table th:nth-child(9),
.expense-intake-table td:nth-child(9) {
  width: 110px;
}

.expense-message-cell,
.expense-intake-table td:nth-child(6),
.expense-intake-table td:nth-child(7) {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.expense-message-cell small,
.expense-intake-table td:nth-child(6) strong,
.expense-intake-table td:nth-child(6) small {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.expense-kind-pill {
  display: inline-flex;
  width: fit-content;
}

.expense-intake-empty {
  padding: 28px;
}


.expense-type-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 0 10px;
  margin-bottom: 12px;
}

.expense-type-chip {
  flex: 0 0 190px;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line-color);
  border-radius: 8px;
  background: var(--surface-color);
  color: inherit;
  text-decoration: none;
}

.expense-type-chip.active {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 1px var(--accent-color) inset;
}

.expense-type-chip span,
.expense-type-chip small {
  color: var(--muted-color);
}

.expense-type-chip strong {
  font-size: 17px;
}

.expense-cash-table-wrap table {
  table-layout: fixed;
  min-width: 1690px;
}

.expense-cash-table th:nth-child(1),
.expense-cash-table td:nth-child(1) {
  width: 130px;
}

.expense-cash-table th:nth-child(2),
.expense-cash-table td:nth-child(2) {
  width: 132px;
}

.expense-cash-table th:nth-child(3),
.expense-cash-table td:nth-child(3) {
  width: 158px;
}

.expense-cash-table th:nth-child(4),
.expense-cash-table td:nth-child(4) {
  width: 170px;
}

.expense-cash-table th:nth-child(5),
.expense-cash-table td:nth-child(5) {
  width: 350px;
}

.expense-cash-table th:nth-child(6),
.expense-cash-table td:nth-child(6) {
  width: 390px;
}

.expense-cash-table th:nth-child(7),
.expense-cash-table td:nth-child(7) {
  width: 150px;
}

.expense-cash-table th:nth-child(8),
.expense-cash-table td:nth-child(8) {
  width: 210px;
}

.expense-cash-table td:nth-child(5),
.expense-cash-table td:nth-child(6),
.expense-cash-table td:nth-child(8) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.expense-cash-table td:nth-child(7) {
  white-space: nowrap;
}

.expense-comment-cell {
  white-space: normal;
}

.expense-company-form {
  margin: 0;
}

.expense-include-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 112px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.expense-include-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.expense-include-toggle span {
  color: var(--accent-strong);
}

.expense-include-toggle input:not(:checked) + span {
  color: #b91c1c;
}

.expense-excluded-row td {
  background: #f8fafc;
  color: var(--muted);
}

.expense-excluded-row .numeric-col strong,
.expense-excluded-row a,
.expense-excluded-row small {
  color: var(--muted);
}


.expense-rules-panel {
  margin-bottom: 18px;
}

.expense-rule-form {
  align-items: end;
  grid-template-columns: minmax(170px, 1.1fr) minmax(190px, 1.2fr) minmax(190px, 1.2fr) minmax(130px, .8fr) minmax(150px, .9fr) minmax(190px, 1.1fr) minmax(170px, 1fr) 84px auto;
}

.expense-rule-list {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.expense-rule-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line-color);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-color);
}

.expense-rule-row.is-disabled {
  opacity: .58;
}

.expense-rule-row small,
.expense-intake-meta-panel small,
.expense-matching-rule small {
  display: block;
  color: var(--muted-text);
  overflow-wrap: anywhere;
}

.expense-intake-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, .85fr);
  gap: 18px;
  align-items: start;
}

.expense-file-viewer {
  min-width: 0;
  border: 1px solid var(--line-color);
  border-radius: 8px;
  background: var(--surface-color);
  overflow: hidden;
}

.expense-file-viewer iframe {
  display: block;
  width: 100%;
  height: min(74vh, 860px);
  border: 0;
  background: #fff;
}

.expense-file-viewer img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #fff;
}

.expense-file-viewer > .secondary-link,
.expense-file-viewer > .button-link {
  margin: 12px 14px 14px;
}

.expense-intake-side {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.expense-intake-meta-panel,
.expense-intake-review-panel {
  margin: 0;
}

.detail-list {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 12px;
  padding: 14px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted-text);
}

.detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.expense-review-form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.expense-review-form label,
.expense-rule-create-details {
  display: grid;
  gap: 6px;
  font-size: .92rem;
  color: var(--muted-text);
}

.expense-review-form input,
.expense-review-form select,
.expense-review-form textarea,
.expense-rule-create-details input {
  width: 100%;
}

.expense-rule-create-details {
  border: 1px solid var(--line-color);
  border-radius: 8px;
  padding: 10px;
}

.expense-rule-create-details summary {
  cursor: pointer;
  color: var(--text-color);
  font-weight: 600;
}

.expense-matching-rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--line-color);
}

.expense-matching-rule:first-of-type {
  border-top: 0;
}

@media (max-width: 980px) {
  .expense-intake-detail {
    grid-template-columns: 1fr;
  }

  .expense-rule-form,
  .expense-rule-row {
    grid-template-columns: 1fr;
  }

  .expense-file-viewer iframe {
    height: 70vh;
  }
}

/* Rostov project */
:root {
  --rostov-accent: #be123c;
  --rostov-accent-strong: #9f1239;
  --rostov-accent-soft: #fff1f2;
  --rostov-accent-border: #fecdd3;
}

.top-nav .nav-group-rostov > button {
  color: var(--rostov-accent-strong);
}

.top-nav .nav-group-rostov > button.active,
.top-nav .nav-group-rostov > button:hover {
  background: var(--rostov-accent-soft);
  color: var(--rostov-accent-strong);
}

.top-nav .nav-group-rostov > button::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--rostov-accent);
  vertical-align: 1px;
}

.rostov-page-shell {
  max-width: 1360px;
}

.rostov-title .eyebrow,
.rostov-status-pill {
  color: var(--rostov-accent-strong);
}

.rostov-status-pill {
  border-color: var(--rostov-accent-border);
  background: var(--rostov-accent-soft);
}

.rostov-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rostov-metric-card strong {
  color: var(--rostov-accent-strong);
}

.rostov-layout,
.rostov-detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.rostov-form-panel {
  padding: 16px;
}

.rostov-prospect-form {
  display: grid;
  gap: 13px;
}

.rostov-field {
  display: grid;
  gap: 6px;
}

.rostov-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rostov-field input,
.rostov-field textarea,
.rostov-field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 12px;
}

.rostov-field textarea {
  resize: vertical;
}

.rostov-capture-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rostov-capture-button,
.rostov-form-actions button,
.rostov-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--rostov-accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.rostov-capture-button {
  background: #ffffff;
  color: var(--rostov-accent-strong);
  border: 1px solid var(--rostov-accent-border);
}

.rostov-capture-button:hover,
.rostov-capture-button:focus-visible {
  background: var(--rostov-accent-soft);
}

.rostov-capture-button:disabled,
.rostov-form-actions button:disabled {
  cursor: progress;
  opacity: .68;
}

.rostov-photo-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.rostov-location-state {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px dashed var(--panel-border);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.rostov-location-state.is-ready {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.rostov-location-state.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.rostov-location-state.is-progress,
.rostov-photo-preview.is-loading {
  border-color: var(--rostov-accent-border);
  background: var(--rostov-accent-soft);
  color: var(--rostov-accent-strong);
}

.rostov-photo-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
}

.rostov-photo-preview-item {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.rostov-photo-preview-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.rostov-photo-preview-item span {
  display: block;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rostov-form-actions {
  display: flex;
}

.rostov-form-actions button {
  width: 100%;
}

.rostov-filter-form {
  align-items: stretch;
}

.rostov-prospect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.rostov-prospect-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fffafa 100%);
  box-shadow: var(--panel-raised-shadow);
}

.rostov-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.rostov-card-head strong {
  min-width: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.rostov-card-status {
  padding: 6px 9px;
  font-size: 12px;
}

.rostov-card-body {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.rostov-card-body p,
.rostov-card-body small,
.rostov-card-meta span {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.rostov-card-meta,
.rostov-card-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.rostov-card-flags span {
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rostov-card-flags span.is-ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.rostov-card-link {
  min-height: 40px;
  background: var(--rostov-accent-soft);
  color: var(--rostov-accent-strong);
  border: 1px solid var(--rostov-accent-border);
}

.rostov-detail-panel {
  padding: 16px;
}

.rostov-detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.rostov-detail-list div {
  display: grid;
  gap: 4px;
}

.rostov-detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rostov-detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.rostov-photos-section {
  margin-top: 18px;
}

.rostov-photos-summary {
  margin-bottom: 10px;
}

.rostov-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.rostov-photo-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--panel-raised-shadow);
}

.rostov-photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.rostov-photo-card span {
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.rostov-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--panel-border);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 760px) {
  body:not(.auth-body) .app-header .nav-group-rostov > button,
  body:not(.auth-body) .app-header .nav-group-rostov > button.active,
  body:not(.auth-body) .app-header .nav-group-rostov > button:hover,
  body:not(.auth-body) .app-header .nav-group-rostov > button:focus-visible {
    border-color: var(--rostov-accent-border);
    background: var(--rostov-accent-soft);
    color: var(--rostov-accent-strong);
  }

  .rostov-metrics,
  .rostov-layout,
  .rostov-detail-grid {
    grid-template-columns: 1fr;
  }

  .rostov-form-panel,
  .rostov-detail-panel {
    padding: 12px;
  }

  .rostov-capture-grid,
  .rostov-photo-preview,
  .rostov-photo-grid,
  .rostov-prospect-grid {
    grid-template-columns: 1fr;
  }

  .rostov-field input,
  .rostov-field textarea,
  .rostov-field select {
    min-height: 48px;
  }

  .rostov-form-actions {
    position: sticky;
    bottom: 8px;
    z-index: 10;
    padding-top: 4px;
    background: linear-gradient(180deg, rgb(255 255 255 / 0%), #fff 42%);
  }

  .rostov-card-head {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Rostov polished UI */
body .rostov-page-shell {
  max-width: 1440px;
}

body .top-nav .nav-group-rostov > button,
body .top-nav .nav-group-rostov > button.active,
body .top-nav .nav-group-rostov > button:hover {
  background: #f0fdfa;
  color: #0f766e;
  border-color: #99f6e4;
}

body .top-nav .nav-group-rostov > button::before {
  background: #14b8a6;
}

body .rostov-title {
  align-items: center;
  margin-bottom: 16px;
}

body .rostov-title h1 {
  font-size: 28px;
  line-height: 1.12;
}

body .rostov-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

body .rostov-summary-strip div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 58px;
  padding: 12px 16px;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #fff;
}

body .rostov-summary-strip span {
  color: #647282;
  font-size: 13px;
  font-weight: 800;
}

body .rostov-summary-strip strong {
  color: #18202a;
  font-size: 24px;
  line-height: 1;
}

body .rostov-layout {
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

body .rostov-detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

body .rostov-intake-panel,
body .rostov-list-section,
body .rostov-photos-section {
  min-width: 0;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgb(15 23 42 / 6%);
}

body .rostov-list-section {
  padding: 14px;
}

body .rostov-intake-panel {
  overflow: hidden;
}

body .rostov-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid #e7edf2;
  background: #fbfdff;
}

body .rostov-panel-heading div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

body .rostov-panel-heading strong {
  color: #18202a;
  font-size: 15px;
  line-height: 1.2;
}

body .rostov-panel-heading span {
  color: #647282;
  font-size: 12px;
  font-weight: 800;
}

body .rostov-intake-form {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

body .rostov-field,
body .rostov-field-full {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

body .rostov-field-full {
  grid-column: 1 / -1;
}

body .rostov-field > span {
  display: block;
  color: #647282;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

body .rostov-field input,
body .rostov-field textarea,
body .rostov-field select,
body .rostov-filter-form input,
body .rostov-filter-form select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fff;
  color: #18202a;
  font: inherit;
  font-size: 15px;
  line-height: 1.25;
  padding: 10px 12px;
  box-shadow: none;
}

body .rostov-field textarea {
  resize: vertical;
}

body .rostov-phone-stack {
  display: grid;
  gap: 8px;
}

body .rostov-phone-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: stretch;
}

body .rostov-phone-remove-button,
body .rostov-add-phone-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fff;
  color: #647282;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

body .rostov-phone-remove-button {
  min-width: 44px;
  min-height: 44px;
  font-size: 24px;
  line-height: 1;
}

body .rostov-phone-row:first-child .rostov-phone-remove-button {
  visibility: hidden;
  pointer-events: none;
}

body .rostov-add-phone-button {
  justify-self: start;
  gap: 8px;
  min-height: 40px;
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
  padding: 0 12px;
}

body .rostov-add-phone-button > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #14b8a6;
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

body .rostov-add-phone-button small {
  color: inherit;
  font-size: 13px;
  font-weight: 850;
}

body .rostov-phone-list {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

body .rostov-capture-section {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body .rostov-capture-button {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 4px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #f0fdfa;
  color: #0f766e;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

body .rostov-capture-button span {
  color: inherit;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.1;
}

body .rostov-capture-button small,
body .rostov-capture-button.is-ready small,
body .rostov-capture-button.is-error small,
body .rostov-capture-button.is-progress small {
  color: #647282;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}

body .rostov-capture-button.is-ready {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

body .rostov-capture-button.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

body .rostov-capture-button.is-progress {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

body .rostov-manual-location {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px dashed #fecdd3;
  border-radius: 8px;
  background: #fff7f8;
}

body .rostov-manual-location .rostov-field-full {
  grid-column: 1 / -1;
}

body .rostov-manual-location .rostov-field > span {
  color: #9f1239;
}

body .rostov-photo-button input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body .rostov-photo-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

body .rostov-photo-preview:empty {
  display: none;
}

body .rostov-form-actions {
  display: flex;
}

body .rostov-form-actions button,
body .rostov-filter-form button,
body .rostov-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  padding: 0 14px;
  cursor: pointer;
}

body .rostov-form-actions button {
  width: 100%;
}

body .rostov-filter-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto auto;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}

body .rostov-settlement-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #fff;
}

body .rostov-settlement-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  max-width: 100%;
  border: 1px solid #e7edf2;
  border-radius: 8px;
  background: #fbfdff;
  color: #334155;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.15;
  padding: 8px 10px;
  text-decoration: none;
}

body .rostov-settlement-tabs a.is-active {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

body .rostov-settlement-tabs span {
  min-width: 0;
  overflow-wrap: anywhere;
}

body .rostov-settlement-tabs strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 22px;
  border-radius: 8px;
  background: #e7edf2;
  color: #18202a;
  font-size: 12px;
  line-height: 1;
  padding: 0 7px;
}

body .rostov-settlement-tabs a.is-active strong {
  background: #ccfbf1;
  color: #115e59;
}

body .rostov-prospect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

body .rostov-empty-panel {
  display: grid;
  gap: 6px;
  min-height: 180px;
  place-content: center;
  padding: 22px;
  border: 1px dashed #cfd8e3;
  border-radius: 8px;
  background: #fbfdff;
  color: #647282;
  text-align: center;
}

body .rostov-empty-panel strong {
  color: #18202a;
  font-size: 16px;
}

body .rostov-empty-panel span {
  font-size: 13px;
  font-weight: 750;
}

@media (max-width: 900px) {
  body .rostov-summary-strip,
  body .rostov-layout,
  body .rostov-detail-grid,
  body .rostov-intake-form,
  body .rostov-capture-section,
  body .rostov-manual-location,
  body .rostov-filter-form,
  body .rostov-photo-preview {
    grid-template-columns: 1fr;
  }

  body .rostov-settlement-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 10px;
  }

  body .rostov-settlement-tabs a {
    flex: 0 0 auto;
  }

  body .rostov-title {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  body .rostov-summary-strip div {
    min-height: 48px;
  }

  body .rostov-intake-form {
    padding: 12px;
  }

  body .rostov-field input,
  body .rostov-field textarea,
  body .rostov-field select,
  body .rostov-filter-form input,
  body .rostov-filter-form select,
  body .rostov-form-actions button,
  body .rostov-filter-form button,
  body .rostov-filter-form .secondary-link {
    width: 100%;
  }

  body .rostov-form-actions {
    position: sticky;
    bottom: 8px;
    z-index: 10;
    padding-top: 6px;
    background: linear-gradient(180deg, rgb(255 255 255 / 0%), #fff 48%);
  }
}

/* Rostov menu red accent */
body .top-nav .nav-group-rostov > button,
body .top-nav .nav-group-rostov > button.active,
body .top-nav .nav-group-rostov > button:hover,
body .top-nav .nav-group-rostov > button:focus-visible,
body:not(.auth-body) .app-header .nav-group-rostov > button,
body:not(.auth-body) .app-header .nav-group-rostov > button.active,
body:not(.auth-body) .app-header .nav-group-rostov > button:hover,
body:not(.auth-body) .app-header .nav-group-rostov > button:focus-visible {
  background: #fff1f2;
  color: #9f1239;
  border-color: #fecdd3;
}

body .top-nav .nav-group-rostov > button::before,
body:not(.auth-body) .app-header .nav-group-rostov > button::before {
  background: #e11d48;
  box-shadow: 0 0 0 4px rgb(225 29 72 / 10%);
}

/* Rostov client map */
body .rostov-map-title {
  align-items: center;
}

body .rostov-map-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

body .rostov-map-sidebar,
body .rostov-map-panel {
  min-width: 0;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgb(15 23 42 / 6%);
}

body .rostov-map-sidebar {
  display: grid;
  align-content: start;
  overflow: hidden;
}

body .rostov-map-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid #e7edf2;
  background: #fbfdff;
}

body .rostov-map-counter span {
  color: #647282;
  font-size: 12px;
  font-weight: 850;
}

body .rostov-map-counter strong {
  color: #18202a;
  font-size: 18px;
  line-height: 1;
  white-space: nowrap;
}

body .rostov-map-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  max-height: min(680px, calc(100vh - 230px));
  overflow: auto;
}

body .rostov-map-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
  border: 1px solid #e7edf2;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

body .rostov-map-list-item button {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #18202a;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

body .rostov-map-list-item strong,
body .rostov-map-list-item span,
body .rostov-map-list-item small {
  min-width: 0;
  overflow-wrap: anywhere;
}

body .rostov-map-list-item span,
body .rostov-map-list-item small {
  color: #647282;
  font-size: 12px;
  font-weight: 750;
}

body .rostov-map-list-item a {
  align-self: center;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff1f2;
  color: #9f1239;
  font-size: 12px;
  font-weight: 850;
  padding: 8px 10px;
  text-decoration: none;
  white-space: nowrap;
}

body .rostov-map-panel {
  overflow: hidden;
  padding: 0;
}

body .rostov-client-map {
  width: 100%;
  height: min(680px, calc(100vh - 220px));
  min-height: 560px;
  background: #e5edf7;
}

body .rostov-client-map.is-error {
  display: grid;
  place-items: center;
  padding: 24px;
  color: #991b1b;
  font-weight: 850;
  text-align: center;
}

body .rostov-map-popup {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

body .rostov-map-popup strong {
  color: #18202a;
  font-size: 14px;
}

body .rostov-map-popup span,
body .rostov-map-popup small {
  color: #647282;
  font-size: 12px;
}

body .rostov-map-popup a {
  color: #9f1239;
  font-weight: 850;
  text-decoration: none;
}

body .rostov-map-empty {
  min-height: 220px;
}

@media (max-width: 900px) {
  body .rostov-map-shell {
    grid-template-columns: 1fr;
  }

  body .rostov-map-title {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  body .rostov-map-list {
    max-height: none;
  }

  body .rostov-client-map {
    height: 62vh;
    min-height: 420px;
  }
}

/* Mobile header cleanup */
@media (max-width: 760px) {
  body:not(.auth-body) .app-header {
    grid-template-areas: "brand controls";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 10px;
    padding: 8px 10px;
  }

  body:not(.auth-body) .app-header .top-nav,
  body:not(.auth-body) .app-header .data-freshness-indicator {
    display: none !important;
  }

  body:not(.auth-body) .app-header .header-right {
    gap: 0;
  }

  body:not(.auth-body) .mobile-header-menu-panel {
    padding: 6px;
  }

  body:not(.auth-body) .mobile-header-menu-section {
    display: grid;
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid #e7edf2;
  }

  body:not(.auth-body) .mobile-header-menu-section:last-child {
    border-bottom: 0;
  }

  body:not(.auth-body) .mobile-header-menu-title {
    padding: 4px 4px 2px;
    color: #647282;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    text-transform: uppercase;
  }
}

/* Rostov delete action */
body .rostov-delete-form {
  display: grid;
  padding: 0 16px 16px;
}

body .rostov-delete-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff1f2;
  color: #9f1239;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

body .rostov-delete-form button:hover,
body .rostov-delete-form button:focus-visible {
  background: #ffe4e6;
}

/* Reports */
.reports-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, .22fr) minmax(150px, .22fr) auto;
  align-items: end;
}

.reports-toolbar .reports-search {
  width: 100%;
}

.reports-metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reports-warehouse-tabs {
  flex-wrap: wrap;
  overflow-x: visible;
  row-gap: 8px;
  padding-bottom: 0;
}

.reports-warehouse-tabs a {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.warehouse-movement-table-wrap table {
  min-width: 980px;
}

.warehouse-movement-table-wrap th:nth-child(2),
.warehouse-movement-table-wrap td:nth-child(2) {
  min-width: 340px;
}

@media (max-width: 760px) {
  .reports-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
}



.avito-heading {
  align-items: center;
}

.avito-stats {
  margin-bottom: 18px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
}

.data-tag {
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 5px 10px;
}

.empty-cell {
  color: var(--text-muted);
  text-align: center;
}


.avito-page {
  display: grid;
  gap: 14px;
}

.avito-tabs {
  align-items: stretch;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
}

.avito-tab {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  color: #64748b;
  display: inline-grid;
  gap: 3px 10px;
  grid-template-columns: auto auto;
  min-height: 50px;
  min-width: 156px;
  padding: 8px 14px;
  text-decoration: none;
}

.avito-tab:hover,
.avito-tab:focus-visible {
  border-color: #94a3b8;
  color: #1f2937;
  text-decoration: none;
}

.avito-tab.is-active {
  background: #ecfdf5;
  border-color: #86efac;
  color: #0f766e;
  box-shadow: 0 1px 0 rgb(15 118 110 / 8%);
}

.avito-tab__title {
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.avito-tab__count {
  align-items: center;
  background: #fff;
  border: 1px solid rgb(100 116 139 / 24%);
  border-radius: 999px;
  color: #475569;
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  height: 24px;
  justify-content: center;
  min-width: 34px;
  padding: 0 8px;
}

.avito-tab__sub {
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  grid-column: 1 / -1;
}

.avito-board {
  background: #fff;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  overflow: visible;
}

.avito-board__header {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #e5edf5;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px 18px;
}

.avito-board__header h1 {
  font-size: 26px;
  line-height: 1.1;
  margin: 0;
}

.avito-board__badges,
.avito-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avito-toolbar {
  align-items: end;
  background: #f8fafc;
  border-bottom: 1px solid #e5edf5;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(260px, 1fr) auto auto;
  padding: 12px 18px;
}

.avito-filter-tabs {
  align-items: center;
  background: #e2e8f0;
  border-radius: 8px;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
}

.avito-filter-tab {
  border-radius: 7px;
  color: #475569;
  font-size: 13px;
  font-weight: 850;
  min-height: 34px;
  padding: 8px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.avito-filter-tab:hover,
.avito-filter-tab:focus-visible {
  color: #172033;
  text-decoration: none;
}

.avito-filter-tab.is-active {
  background: #fff;
  color: #0f766e;
  box-shadow: 0 1px 2px rgb(15 23 42 / 9%);
}

.avito-search-field {
  display: grid;
  gap: 5px;
}

.avito-search-field span {
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.avito-search-field input,
.avito-product-search input {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #172033;
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.avito-card-list {
  display: flex;
  flex-direction: column;
}

.avito-card {
  align-items: stretch;
  border-bottom: 1px solid #edf2f7;
  display: grid;
  gap: 16px;
  grid-template-columns: 112px minmax(360px, 1fr) minmax(230px, 300px);
  min-height: 148px;
  padding: 14px 18px;
}

.avito-card:last-child {
  border-bottom: 0;
}

.avito-card.is-linked {
  background: linear-gradient(90deg, rgb(240 253 244 / 70%), #fff 34%);
}

.avito-card__media {
  align-self: start;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: block;
  height: 112px;
  overflow: hidden;
  text-decoration: none;
  width: 112px;
}

.avito-card__media img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.avito-card__media-empty {
  align-items: center;
  color: #94a3b8;
  display: flex;
  font-size: 12px;
  font-weight: 850;
  height: 100%;
  justify-content: center;
  text-align: center;
  width: 100%;
}

.avito-card__main {
  min-width: 0;
}

.avito-card__title {
  color: #172033;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.25;
  max-width: 860px;
}

.avito-card__title a {
  color: inherit;
  text-decoration: none;
}

.avito-card__title a:hover,
.avito-card__title a:focus-visible {
  color: #0f766e;
  text-decoration: underline;
}

.avito-card__meta {
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
  line-height: 1.35;
  margin-top: 7px;
}

.avito-card__meta span + span::before {
  color: #cbd5e1;
  content: '/';
  margin-right: 8px;
}

.avito-card__description {
  color: #475569;
  font-size: 14px;
  line-height: 1.45;
  margin-top: 10px;
  max-width: 860px;
}

.avito-match-panel {
  align-items: start;
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-width: 900px;
}

.avito-match-form {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 280px) auto;
}

.avito-product-search {
  position: relative;
}

.avito-product-results {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 16px 36px rgb(15 23 42 / 16%);
  left: 0;
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
}

.avito-product-option {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: #172033;
  cursor: pointer;
  display: grid;
  gap: 3px;
  padding: 8px;
  text-align: left;
  width: 100%;
}

.avito-product-option:hover,
.avito-product-option:focus-visible {
  background: #f1f5f9;
  outline: none;
}

.avito-product-option strong {
  font-size: 13px;
  line-height: 1.3;
}

.avito-product-option span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.3;
}

.avito-selected-product {
  align-items: center;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  display: flex;
  font-size: 13px;
  font-weight: 750;
  min-height: 38px;
  min-width: 0;
  padding: 8px 10px;
}

.avito-selected-product.is-ready {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.avito-linked-product {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #065f46;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
}

.avito-linked-product__label {
  color: #047857;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.avito-linked-product strong {
  color: #172033;
  font-size: 14px;
  line-height: 1.3;
}

.avito-linked-product span:last-child {
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.avito-description-lines {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: grid;
  gap: 9px;
  margin-top: 4px;
  padding: 10px;
}

.avito-description-lines__header {
  align-items: center;
  color: #172033;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.avito-description-lines__header strong {
  font-size: 13px;
  font-weight: 900;
}

.avito-description-lines__header span {
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
}

.avito-description-line-list {
  display: grid;
  gap: 6px;
}

.avito-description-line {
  align-items: center;
  background: #fff;
  border: 1px solid #e5edf5;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(86px, 120px) minmax(220px, 1fr) auto;
  padding: 8px;
}

.avito-description-line__label,
.avito-description-line__product {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.avito-description-line__label strong,
.avito-description-line__product span {
  color: #172033;
  font-size: 13px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avito-description-line__product small {
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avito-description-line-form {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(72px, 100px) minmax(220px, 1fr) minmax(160px, 240px) minmax(120px, 150px) auto auto;
}

.avito-line-label-input,
.avito-line-unit-input {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #172033;
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.avito-inline-check {
  align-items: center;
  color: #475569;
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  gap: 6px;
  min-height: 38px;
  white-space: nowrap;
}

.avito-card__side {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-start;
  min-width: 0;
}

.avito-card__side-label {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.avito-card__price-box {
  display: grid;
  gap: 4px;
}

.avito-card__price-box--onec {
  background: #f8fafc;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 9px 10px;
  width: 100%;
}

.avito-card__price-box--missing {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 9px 10px;
  width: 100%;
}

.avito-card__price {
  color: #111827;
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.avito-card__price--onec {
  color: #0f766e;
  font-size: 20px;
}

.avito-card__price-missing {
  color: #c2410c;
  font-size: 14px;
  font-weight: 900;
}

.avito-price-delta {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-self: start;
  line-height: 1;
  padding: 5px 8px;
}

.avito-price-delta.is-match {
  background: #ecfdf5;
  color: #047857;
}

.avito-price-delta.is-higher {
  background: #fff7ed;
  color: #c2410c;
}

.avito-price-delta.is-lower {
  background: #eff6ff;
  color: #1d4ed8;
}

.avito-card__date {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 750;
  margin-top: auto;
}

.avito-page .compact {
  min-height: 36px;
  padding: 7px 12px;
}

@media (max-width: 1100px) {
  .avito-toolbar {
    grid-template-columns: 1fr;
  }

  .avito-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .avito-card__media {
    height: 96px;
    width: 96px;
  }

  .avito-card__side {
    grid-column: 2;
  }

  .avito-match-form,
  .avito-description-line-form,
  .avito-description-line {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .avito-tab {
    flex: 0 0 auto;
  }

  .avito-board__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .avito-filter-tabs {
    overflow-x: auto;
    width: 100%;
  }

  .avito-card {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .avito-card__media {
    height: 78px;
    width: 78px;
  }

  .avito-card__title {
    font-size: 15px;
  }

  .avito-card__price {
    font-size: 18px;
  }
}


.avito-extra-toggle {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 850;
  gap: 8px;
  justify-self: start;
  min-height: 36px;
  padding: 7px 10px;
}

.avito-extra-toggle input {
  accent-color: #0f766e;
}

.avito-extra-toggle strong {
  align-items: center;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  color: #047857;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  min-width: 24px;
  padding: 0 7px;
}

.avito-description-lines[hidden] {
  display: none;
}

.avito-description-line-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.avito-description-line-drafts {
  display: grid;
  gap: 8px;
}

.avito-description-line-draft {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(72px, 100px) minmax(220px, 1fr) minmax(160px, 240px) minmax(120px, 150px) auto auto;
}

.avito-description-line-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 1100px) {
  .avito-description-line-draft {
    grid-template-columns: 1fr;
  }
}

/* Avito listing card polish: 20260710 */
.avito-card {
  grid-template-columns: 112px minmax(0, 1fr) minmax(190px, 220px);
  gap: 18px;
}

.avito-card__main {
  display: grid;
  align-content: start;
  min-width: 0;
}

.avito-card__title,
.avito-card__description,
.avito-match-panel,
.avito-description-lines {
  max-width: 760px;
}

.avito-match-panel,
.avito-description-lines {
  width: min(100%, 760px);
}

.avito-linked-product {
  gap: 2px;
  padding: 9px 11px 9px 13px;
  box-shadow: inset 3px 0 0 #10b981;
}

.avito-linked-product__label,
.avito-card__side-label {
  letter-spacing: 0;
}

.avito-linked-product__label {
  font-size: 10px;
}

.avito-linked-product strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.avito-card__side {
  align-items: stretch;
  gap: 8px;
  max-width: 220px;
  width: 100%;
}

.avito-card__side-label {
  font-size: 10px;
  margin-bottom: 2px;
}

.avito-card__price-box--onec,
.avito-card__price-box--missing {
  padding: 8px 9px;
}

.avito-card__price-box--onec {
  background: #f8fffb;
  border-color: #bbf7d0;
}

.avito-card__price {
  font-size: 21px;
}

.avito-card__price--onec {
  font-size: 18px;
}

.avito-price-delta {
  font-size: 11px;
  padding: 4px 7px;
}

.avito-card__chips {
  gap: 6px;
}

.avito-card__date {
  font-size: 11px;
}

.avito-extra-toggle {
  background: #ffffff;
  min-height: 34px;
  padding: 6px 10px;
}

.avito-description-lines {
  padding: 8px;
}

.avito-description-line {
  grid-template-columns: minmax(64px, 90px) minmax(0, 1fr) auto;
  padding: 7px 8px;
}

@media (max-width: 1100px) {
  .avito-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .avito-card__side {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    grid-column: 2;
    max-width: 100%;
  }

  .avito-card__price-box {
    min-width: 132px;
  }

  .avito-card__price-box--onec,
  .avito-card__price-box--missing {
    width: auto;
  }
}

@media (max-width: 620px) {
  .avito-card {
    gap: 12px;
    grid-template-columns: 78px minmax(0, 1fr);
    padding: 12px;
  }

  .avito-card__side {
    grid-column: 1 / -1;
  }

  .avito-card__price {
    font-size: 18px;
  }

  .avito-card__price--onec {
    font-size: 17px;
  }

  .avito-match-panel,
  .avito-description-lines {
    max-width: 100%;
    width: 100%;
  }
}

/* Avito description primary chip polish: 20260710 */
.avito-description-line {
  grid-template-columns: minmax(150px, 170px) minmax(0, 1fr) auto;
}

.avito-description-line__label {
  align-content: start;
}

.avito-description-line__label .status-pill {
  justify-self: start;
  max-width: 100%;
  white-space: nowrap;
}

.avito-description-line__product {
  min-width: 0;
}

.avito-description-line__product small {
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .avito-description-line {
    grid-template-columns: 1fr auto;
  }

  .avito-description-line__label {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    grid-column: 1 / -1;
  }

  .avito-description-line__product {
    grid-column: 1 / -1;
  }
}

/* Avito title copy button: 20260710 */
.avito-card__title-row {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  max-width: 760px;
  min-width: 0;
}

.avito-card__title-row .avito-card__title {
  min-width: 0;
}

.avito-copy-title-button {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font: inherit;
  font-size: 11px;
  font-weight: 850;
  justify-content: center;
  line-height: 1;
  min-height: 26px;
  padding: 6px 8px;
  white-space: nowrap;
}

.avito-copy-title-button:hover,
.avito-copy-title-button:focus-visible {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  outline: none;
}

.avito-copy-title-button.is-copied {
  background: #ecfdf5;
  border-color: #86efac;
  color: #047857;
}

.avito-copy-title-button.is-error {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.avito-copy-title-button:disabled {
  cursor: default;
  opacity: 1;
}

@media (max-width: 620px) {
  .avito-card__title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}



/* Knowledge base */
.knowledge-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.knowledge-summary-strip > div {
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 14px 16px;
}

.knowledge-summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.knowledge-summary-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
  line-height: 1.1;
}

.knowledge-toolbar {
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px) minmax(190px, 260px) auto auto auto;
}

.knowledge-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.knowledge-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  min-height: 158px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fff;
}

.knowledge-thumb,
.knowledge-photo-large {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.knowledge-thumb {
  width: 82px;
  height: 82px;
  border-radius: 8px;
}

.knowledge-thumb img,
.knowledge-photo-large img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.knowledge-card-topline,
.training-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.knowledge-brand,
.knowledge-stock {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.knowledge-brand {
  background: #eef2f7;
  color: #263241;
}

.brand-VIRA {
  background: #fee2e2;
  color: #991b1b;
}

.brand-RAGE,
.brand-RAGE-by-VIRA {
  background: #111827;
  color: #f9fafb;
}

.brand-RAGE-Furious {
  background: #fef3c7;
  color: #92400e;
}

.knowledge-stock.in-stock {
  background: #dcfce7;
  color: #166534;
}

.knowledge-stock.out-stock {
  background: #f1f5f9;
  color: #64748b;
}

.knowledge-card h2,
.training-card h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.knowledge-card h2 a {
  color: var(--text);
  text-decoration: none;
}

.knowledge-card h2 a:hover {
  color: var(--accent-strong);
}

.knowledge-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.knowledge-meta span {
  padding: 3px 7px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #526173;
  font-size: 12px;
  font-weight: 700;
}

.knowledge-card p,
.training-card p,
.knowledge-description,
.knowledge-source-comment {
  color: var(--muted);
  line-height: 1.45;
}

.knowledge-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 13px;
}

.knowledge-detail-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.knowledge-detail-aside {
  display: grid;
  gap: 12px;
}

.knowledge-photo-large {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  font-size: 42px;
}

.knowledge-side-facts {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fff;
}

.knowledge-side-facts a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.knowledge-note-grid,
.knowledge-attributes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.knowledge-attribute {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.knowledge-attribute span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.knowledge-attribute strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.knowledge-source-comment {
  white-space: pre-line;
}

.training-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.training-card {
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fff;
}

.training-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.training-options button {
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.training-options button:hover:not(:disabled) {
  border-color: var(--accent);
  background: #ecfdf5;
}

.training-options button.is-correct {
  border-color: #16a34a;
  background: #dcfce7;
  color: #166534;
}

.training-options button.is-wrong {
  border-color: #dc2626;
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 760px) {
  .knowledge-summary-strip,
  .knowledge-detail-layout {
    grid-template-columns: 1fr;
  }

  .knowledge-toolbar {
    grid-template-columns: 1fr;
  }

  .knowledge-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .knowledge-thumb {
    width: 72px;
    height: 72px;
  }
}

.portal-page-title .summary-link {
  align-self: center;
}
.portal-admin-note {
  margin-bottom: 14px;
}
.portal-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.portal-stat {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--panel-raised-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--panel-raised-shadow);
}
.portal-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.portal-stat strong {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  color: var(--text);
  font-size: 24px;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-admin-panel + .portal-admin-panel {
  margin-top: 18px;
}
.portal-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.portal-table-wrap table {
  min-width: 1320px;
}
.portal-client-table td,
.portal-order-table td {
  vertical-align: top;
}
.portal-client-table input,
.portal-client-table select,
.portal-order-table select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 9px;
}
.portal-client-table small,
.portal-order-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.portal-client-table th:nth-child(1),
.portal-client-table td:nth-child(1) { min-width: 190px; }
.portal-client-table th:nth-child(2),
.portal-client-table td:nth-child(2) { min-width: 180px; }
.portal-client-table th:nth-child(6),
.portal-client-table td:nth-child(6) { min-width: 220px; }
.portal-order-table th:nth-child(7),
.portal-order-table td:nth-child(7) { min-width: 360px; white-space: normal; }
.portal-order-lines summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 850;
}
.portal-order-lines-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.portal-order-lines-list div {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
}
.portal-order-lines-list span,
.portal-order-lines-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}
.portal-order-lines-list strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

@media (max-width: 980px) {
  .portal-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

