:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --surface-active: #edf8f1;
  --border: #dfe5ec;
  --border-soft: #ebeff3;
  --text: #142033;
  --text-muted: #667085;
  --text-soft: #98a2b3;
  --green: #099250;
  --green-dark: #087443;
  --green-soft: #e7f6ed;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --amber: #f79009;
  --amber-soft: #fff3e0;
  --red: #f04438;
  --red-soft: #fff1f1;
  --shadow: 0 14px 42px rgba(19, 34, 56, 0.08);
  --radius: 8px;
  --sidebar-width: 224px;
  --mobile-nav-height: 60px;
  --mobile-nav-stack-gap: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  background: var(--bg);
  overflow-x: clip;
}

body {
  margin: 0;
  min-width: 320px;
  max-width: 100%;
  min-height: 100vh;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  background: var(--bg);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
select,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: clip;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  min-width: 0;
  padding: 18px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 8px 10px;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 2px solid #141a23;
  border-radius: 7px;
  transform: rotate(45deg);
}

.brand-mark span {
  width: 9px;
  height: 9px;
  border: 2px solid #141a23;
  border-radius: 3px;
}

.brand-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
}

.brand-copy small {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.nav {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-item,
.subnav button,
.collapse-button,
.toolbar-button,
.icon-button,
.link-button,
.table-action {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: #344054;
  text-align: left;
  border-radius: var(--radius);
}

.nav-item:hover {
  background: var(--surface-muted);
}

.nav-item.is-active {
  color: var(--green-dark);
  background: linear-gradient(90deg, rgba(9, 146, 80, 0.14), rgba(9, 146, 80, 0.04));
}

.nav-item.is-active::before {
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  content: "";
  background: var(--green);
  border-radius: 0 999px 999px 0;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.nav-label {
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge,
.counter {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  background: var(--red);
  border-radius: 999px;
}

.subnav {
  display: grid;
  gap: 3px;
  margin: -2px 0 10px 31px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.nav-item:not(.is-active) + .subnav {
  display: none;
}

.subnav button {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  color: #475467;
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  border-radius: var(--radius);
}

.subnav button.is-active {
  color: var(--green-dark);
  background: var(--surface-active);
}

.account-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 24px;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: #fff;
}

.account-avatar,
.person {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  color: #5f5144;
  font-size: 12px;
  font-weight: 800;
  background: #f1e8df;
  border-radius: 999px;
}

.account-card strong,
.account-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card strong {
  font-size: 13px;
}

.account-card span {
  color: var(--text-muted);
  font-size: 12px;
}

.account-card button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.collapse-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
  color: #475467;
  font-size: 13px;
  font-weight: 650;
  border-radius: var(--radius);
}

.collapse-button:hover {
  background: var(--surface-muted);
}

.page {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 28px 28px;
  overflow-x: clip;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 88px;
  padding: 18px 0 16px;
  background: rgba(247, 248, 250, 0.92);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
}

.title-block {
  min-width: 190px;
}

.title-block p {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.title-block h1 {
  margin: 0;
  color: #14233d;
  font-size: 24px;
  font-weight: 820;
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.app-shell[data-active-screen="supply-suppliers"] .topbar .freshness-pill,
.app-shell[data-active-screen="supply-suppliers"] .topbar .period-control {
  display: none;
}

.mobile-menu-button {
  display: none;
}

.freshness-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.freshness-pill strong,
.freshness-pill span {
  display: block;
  line-height: 1.1;
}

.freshness-pill strong {
  font-size: 12px;
  font-weight: 750;
}

.freshness-pill span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.dot,
.risk-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.dot.is-ok,
.risk-dot.is-ok {
  background: var(--green);
}

.risk-dot.is-danger {
  background: var(--red);
}

.risk-dot.is-warning {
  background: var(--amber);
}

.select-control {
  display: grid;
  grid-template-columns: auto minmax(96px, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 10px;
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.select-control span {
  font-size: 12px;
  font-weight: 650;
}

.select-control select {
  min-width: 104px;
  color: var(--text);
  font-weight: 650;
  border: 0;
  outline: 0;
  background: transparent;
}

.toolbar-button,
.icon-button {
  min-height: 42px;
  padding: 0 13px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.toolbar-button:hover,
.icon-button:hover {
  border-color: var(--border);
  background: var(--surface-muted);
}

.icon-button {
  min-width: 42px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.view-settings {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.view-settings[hidden] {
  display: none;
}

.view-settings div {
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.view-settings strong {
  font-size: 13px;
}

.view-settings span {
  color: var(--text-muted);
  font-size: 12px;
}

.view-settings label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.screen {
  display: none;
  min-width: 0;
  max-width: 100%;
}

.screen.is-active {
  display: block;
}

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

.module-tabs-row {
  margin: 16px 0 14px;
}

.module-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.module-tabs button {
  min-height: 34px;
  padding: 0 12px;
  color: #475467;
  font-size: 13px;
  font-weight: 720;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.module-tabs button.is-active {
  color: var(--green-dark);
  background: var(--green-soft);
}

.module-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.table-controls .search-control {
  flex: 1 1 auto;
}

.search-control {
  display: grid;
  grid-template-columns: auto minmax(180px, 260px);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 10px;
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-control span {
  font-size: 12px;
  font-weight: 650;
}

.search-control input {
  min-width: 0;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
}

.search-control input::placeholder {
  color: var(--text-soft);
}

.select-control.compact {
  grid-template-columns: auto minmax(108px, 1fr);
  min-width: 180px;
}

.status-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.rail-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.rail-item.is-ok .step-marker {
  background: var(--green);
}

.rail-item.is-warning .step-marker {
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid rgba(247, 144, 9, 0.28);
}

.rail-item.is-danger .step-marker {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(240, 68, 56, 0.28);
}

.rail-item strong,
.rail-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.rail-item strong {
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.rail-item div span {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-timeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 16px 0 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(19, 34, 56, 0.04);
}

.timeline-step {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.timeline-step:not(:last-child)::after {
  position: absolute;
  top: 17px;
  right: 16px;
  width: 38%;
  max-width: 120px;
  height: 1px;
  content: "";
  background: #cbd5e1;
}

.step-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  border-radius: 999px;
}

.timeline-step.is-ok .step-marker {
  background: var(--green);
}

.timeline-step.is-warning .step-marker {
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid rgba(247, 144, 9, 0.28);
}

.timeline-step.is-danger .step-marker {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(240, 68, 56, 0.28);
}

.timeline-step strong,
.timeline-step span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-step strong {
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.timeline-step span {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card,
.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(19, 34, 56, 0.035);
}

.metric-card {
  position: relative;
  min-height: 122px;
  padding: 14px;
  overflow: hidden;
}

.metric-card span,
.metric-card small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.metric-card > span {
  color: #344054;
  font-size: 13px;
  font-weight: 680;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 22px;
  font-weight: 790;
  line-height: 1;
}

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

.supplier-metrics {
  grid-template-columns: 1.1fr repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.supplier-metric-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 96px;
  padding: 12px 13px;
}

.supplier-metric-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--border);
}

.supplier-metric-card.is-up::before {
  background: var(--green);
}

.supplier-metric-card.is-down::before {
  background: var(--red);
}

.supplier-metric-card.is-warning::before {
  background: var(--amber);
}

.supplier-metric-card.is-neutral::before {
  background: #d0d5dd;
}

.supplier-metric-mark {
  display: block;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(9, 146, 80, 0.18);
  border-radius: 8px;
  background: var(--green-soft);
}

.supplier-metric-card.is-down .supplier-metric-mark {
  border-color: rgba(240, 68, 56, 0.22);
  background: var(--red-soft);
}

.supplier-metric-card.is-warning .supplier-metric-mark {
  border-color: rgba(247, 144, 9, 0.24);
  background: var(--amber-soft);
}

.supplier-metric-card.is-neutral .supplier-metric-mark {
  border-color: #d0d5dd;
  background: #f2f4f7;
}

.supplier-metric-copy {
  min-width: 0;
}

.supplier-metric-copy > span {
  display: block;
  color: #344054;
  font-size: 12px;
  font-weight: 720;
  overflow-wrap: anywhere;
}

.supplier-metric-copy strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  line-height: 1;
}

.supplier-metric-copy small {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 14px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.module-grid.supplier-module-grid {
  grid-template-columns: minmax(760px, 1fr) clamp(500px, 28vw, 580px);
  gap: 16px;
  align-items: stretch;
}

.module-grid.supplier-module-grid:has(.supplier-detail-panel.is-editing) {
  grid-template-columns: minmax(720px, 1fr) clamp(580px, 34vw, 680px);
}

.data-panel {
  min-width: 0;
}

.data-panel .table-wrap {
  max-height: calc(100vh - 220px);
  overflow: auto;
  overscroll-behavior: contain;
}

.supplier-data-panel,
.supplier-detail-panel {
  height: calc(100vh - 300px);
  min-height: 560px;
  max-height: none;
}

.supplier-data-panel {
  display: flex;
  flex-direction: column;
}

.supplier-data-panel .panel-header,
.supplier-detail-panel .detail-heading {
  min-height: 68px;
  padding-top: 13px;
  padding-bottom: 13px;
}

.supplier-data-panel .table-controls,
.supplier-data-panel .panel-header {
  flex: 0 0 auto;
}

.supplier-data-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.data-table {
  min-width: 1120px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fbfcfd;
  background-clip: padding-box;
}

.data-table th,
.data-table td {
  vertical-align: middle;
}

.data-table tbody tr[data-row-id] {
  cursor: pointer;
}

.data-table tbody tr[data-row-id]:hover {
  background: #f8fbf9;
}

.data-table tbody tr[data-row-id]:hover td:first-child {
  background: #f8fbf9;
}

.data-table th:first-child,
.data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 180px;
  max-width: 220px;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border-soft);
}

.data-table th:first-child {
  z-index: 6;
  background: #fbfcfd;
}

.data-table tr.is-selected {
  background: #f3faf6;
}

.data-table tr.is-selected td:first-child {
  background: #f3faf6;
}

.supplier-table th,
.supplier-table td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.supplier-table tbody tr.is-selected {
  box-shadow: inset 3px 0 0 var(--green);
}

.supplier-table tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--green), 1px 0 0 var(--border-soft);
}

.table-subtext {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.badge.is-muted {
  color: #475467;
  background: #eef2f6;
}

.detail-panel {
  position: sticky;
  top: 104px;
  padding: 0;
  overflow: hidden;
}

.supplier-detail-panel {
  align-self: stretch;
  overflow: auto;
}

.detail-panel.is-editing {
  overflow: visible;
}

.supplier-detail-panel.is-editing {
  overflow: auto;
}

.detail-panel.is-editing .detail-heading {
  position: sticky;
  top: 88px;
  z-index: 20;
  box-shadow: 0 8px 18px rgba(19, 34, 56, 0.06);
}

.supplier-detail-panel.is-editing .detail-heading {
  top: 0;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}

.detail-heading p,
.detail-heading h2 {
  margin: 0;
}

.detail-heading p {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-heading h2 {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 820;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.detail-actions,
.panel-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button,
.secondary-button {
  min-height: 32px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 760;
  border-radius: var(--radius);
  cursor: pointer;
}

.primary-button {
  color: #fff;
  border: 1px solid var(--green);
  background: var(--green);
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.secondary-button {
  color: #344054;
  border: 1px solid var(--border);
  background: var(--surface);
}

.detail-note {
  margin: 14px 16px 0;
  padding: 11px 12px;
  color: #344054;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.source-note {
  margin-bottom: 14px;
  padding: 10px 12px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  border: 1px solid rgba(240, 68, 56, 0.2);
  border-radius: var(--radius);
  background: var(--red-soft);
}

.detail-panel .source-note {
  margin: 14px 16px 0;
}

.supplier-form {
  display: grid;
  gap: 14px;
  padding: 14px 16px 92px;
}

.form-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.form-section h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 790;
}

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

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

.form-field.is-wide {
  grid-column: 1 / -1;
}

.form-field > span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 720;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.form-field .required-mark {
  color: var(--red);
  white-space: nowrap;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 8px 9px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.form-field textarea {
  min-height: 76px;
  resize: vertical;
}

.form-field input:disabled,
.form-field select:disabled {
  color: var(--text-soft);
  background: var(--surface-muted);
}

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

.kv-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: #fff;
}

.kv-grid dt {
  margin: 0 0 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 720;
}

.kv-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.25;
}

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

.mini-kv-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: #fff;
}

.mini-kv-grid dt {
  margin: 0 0 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 720;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.mini-kv-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.detail-section {
  margin: 14px 16px 16px;
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 790;
}

.detail-section p {
  margin: 0;
  color: #475467;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.supplier-detail-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.supplier-detail-body .detail-note,
.supplier-detail-body .kv-grid,
.supplier-detail-body .detail-section {
  margin: 0;
}

.supplier-inspector-note {
  border-color: #d9eadf;
  background: #f6fbf8;
}

.supplier-kv-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.supplier-kv-grid div {
  padding: 11px;
}

.supplier-detail-section {
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: #fff;
}

.supplier-detail-section h3 {
  margin-bottom: 6px;
}

.chain-card {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  padding: 10px 11px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.chain-card span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 720;
}

.chain-card strong {
  font-size: 13px;
  font-weight: 780;
  line-height: 1.35;
}

.delta {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.delta.is-up {
  color: var(--green);
}

.delta.is-down {
  color: var(--red);
}

.sparkline {
  position: absolute;
  right: 13px;
  bottom: 14px;
  width: 72px;
  height: 34px;
}

.sparkline::before {
  position: absolute;
  inset: 0;
  content: "";
  clip-path: var(--points);
  border-bottom: 2px solid currentColor;
  background: currentColor;
  opacity: 0.14;
}

.sparkline::after {
  position: absolute;
  inset: 0;
  content: "";
  clip-path: var(--points);
  border-bottom: 2px solid currentColor;
}

.sparkline.is-green {
  color: var(--green);
}

.sparkline.is-blue {
  color: var(--blue);
}

.sparkline.is-red {
  color: var(--red);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  margin-bottom: 14px;
}

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

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 14px;
}

.panel {
  padding: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.panel-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 780;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.legend i {
  display: inline-block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
}

.line-green {
  background: var(--green);
}

.line-blue {
  background: var(--blue);
}

.line-red {
  background: var(--red);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

th,
td {
  min-height: 42px;
  padding: 11px 14px;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
}

th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 720;
  background: #fbfcfd;
}

td {
  color: #344054;
  font-weight: 560;
}

td:first-child {
  color: var(--text);
  font-weight: 650;
}

tbody tr:hover {
  background: #fbfcfd;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.risk-dot {
  margin-right: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 730;
  border-radius: 6px;
}

.badge.is-danger {
  color: var(--red);
  background: var(--red-soft);
}

.badge.is-warning {
  color: #b54708;
  background: var(--amber-soft);
}

.badge.is-warning-soft {
  color: #b54708;
  background: #fff7e8;
}

.badge.is-ok,
.badge.is-low {
  color: var(--green-dark);
  background: var(--green-soft);
}

.person {
  width: 26px;
  height: 26px;
  margin-right: 7px;
  color: #475467;
  font-size: 10px;
  background: #eef2f6;
}

.link-button {
  color: var(--blue);
  font-size: 12px;
  font-weight: 720;
}

.panel > .link-button {
  margin: 12px 14px 14px;
}

.table-action {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.chart-panel {
  min-height: 260px;
}

.chart {
  position: relative;
  height: 224px;
  padding: 10px 14px 30px;
}

.chart svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 176px;
}

.grid-line {
  position: absolute;
  left: 14px;
  right: 14px;
  height: 1px;
  background: #e5eaf0;
}

.grid-line:nth-child(1) {
  top: 52px;
}

.grid-line:nth-child(2) {
  top: 104px;
}

.grid-line:nth-child(3) {
  top: 156px;
}

.chart-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line.green {
  stroke: var(--green);
}

.chart-line.blue {
  stroke: var(--blue);
}

.chart-line.red {
  stroke: var(--red);
}

.chart-line {
  fill: none;
}

.dots.green {
  fill: var(--green);
}

.dots.blue {
  fill: var(--blue);
}

.bars rect {
  fill: var(--red);
  rx: 3;
}

.axis {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  font-size: 11px;
}

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  max-width: 360px;
  padding: 12px 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius);
  background: #101828;
  box-shadow: var(--shadow);
}

.app-shell.is-collapsed {
  --sidebar-width: 76px;
}

.app-shell.is-collapsed .brand-copy,
.app-shell.is-collapsed .nav-label,
.app-shell.is-collapsed .nav-badge,
.app-shell.is-collapsed .subnav,
.app-shell.is-collapsed .account-card div,
.app-shell.is-collapsed .account-card button,
.app-shell.is-collapsed .collapse-button span:last-child {
  display: none;
}

.app-shell.is-collapsed .brand,
.app-shell.is-collapsed .nav-item,
.app-shell.is-collapsed .collapse-button {
  justify-content: center;
}

.app-shell.is-collapsed .nav-item {
  grid-template-columns: 28px;
}

.app-shell.is-collapsed .account-card {
  grid-template-columns: 42px;
  justify-content: center;
}

.app-shell[data-density="dense"] .metric-card {
  min-height: 104px;
  padding: 12px;
}

.app-shell[data-density="dense"] th,
.app-shell[data-density="dense"] td {
  padding-top: 8px;
  padding-bottom: 8px;
}

.app-shell[data-density="dense"] .panel-header {
  min-height: 44px;
  padding: 10px 14px;
}

.app-shell.hide-charts [data-chart-section],
.app-shell.hide-tables [data-table-section] {
  display: none;
}

@media (max-width: 1840px) {
  .module-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 1500px) {
  .module-grid.supplier-module-grid,
  .module-grid.supplier-module-grid:has(.supplier-detail-panel.is-editing) {
    grid-template-columns: 1fr;
  }

  .supplier-data-panel,
  .supplier-detail-panel {
    height: auto;
  }

  .supplier-detail-panel {
    position: static;
    overflow: hidden;
  }

  .supplier-detail-panel.is-editing {
    overflow: visible;
  }
}

@media (max-width: 1240px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-panel:last-child {
    grid-column: 1 / -1;
  }

  .status-timeline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 16px;
  }

  .timeline-step:not(:last-child)::after {
    display: none;
  }

  .status-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding-bottom: calc(
      var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px) + 18px
    );
  }

  .sidebar {
    display: none;
  }

  .page {
    padding: 0 14px 18px;
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
  }

  .topbar {
    position: static;
    display: grid;
    grid-template-columns: 38px 1fr 38px;
    align-items: start;
    min-height: auto;
    padding: 16px 0 12px;
  }

  .mobile-menu-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--text);
    font-size: 22px;
    font-weight: 760;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
  }

  .title-block p {
    display: none;
  }

  .title-block h1 {
    font-size: 18px;
    line-height: 38px;
  }

  .topbar-actions {
    display: contents;
  }

  .freshness-pill {
    grid-column: 1 / -1;
    order: 2;
    margin-top: 12px;
  }

  .select-control {
    grid-column: 1 / -1;
    order: 3;
    margin-top: 10px;
  }

  .toolbar-button {
    display: none;
  }

  .icon-button {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    justify-self: end;
    width: 38px;
    min-width: 38px;
    min-height: 38px;
  }

  .status-timeline {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 12px;
    padding: 0;
    overflow-x: auto;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .timeline-step {
    grid-template-columns: 1fr;
    min-height: 86px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .step-marker {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .timeline-step strong {
    font-size: 12px;
  }

  .timeline-step span {
    font-size: 11px;
  }

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

  .metric-card {
    min-height: 112px;
    padding: 12px;
  }

  .metric-card strong {
    font-size: 18px;
  }

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

  .supplier-metric-card {
    grid-template-columns: 1fr;
    min-height: 112px;
  }

  .supplier-metric-mark {
    width: 30px;
    height: 30px;
  }

  .work-grid,
  .charts-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .chart-panel:last-child {
    grid-column: auto;
  }

  .panel-header {
    min-height: 46px;
    padding: 12px;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
  }

  table {
    min-width: 560px;
  }

  .panel-risks table,
  .panel-actions table {
    min-width: 0;
  }

  .panel-risks th:nth-child(2),
  .panel-risks td:nth-child(2),
  .panel-actions th:nth-child(1),
  .panel-actions td:nth-child(1),
  .panel-actions th:nth-child(3),
  .panel-actions td:nth-child(3),
  .panel-actions th:nth-child(5),
  .panel-actions td:nth-child(5) {
    display: none;
  }

  th,
  td {
    padding: 10px 12px;
  }

  .axis {
    font-size: 10px;
  }

  .view-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .view-settings div {
    grid-column: 1 / -1;
  }

  .module-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .module-tabs,
  .module-controls,
  .table-controls {
    width: 100%;
  }

  .module-tabs {
    overflow-x: auto;
  }

  .module-tabs button {
    flex: 1 0 auto;
  }

  .module-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .table-controls {
    align-items: stretch;
    flex-direction: column;
    padding: 0 12px 12px;
  }

  .search-control,
  .select-control.compact {
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
  }

  .status-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rail-item {
    grid-template-columns: 1fr;
    min-height: 104px;
  }

  .rail-item strong {
    white-space: normal;
  }

  .data-table {
    min-width: 920px;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    min-width: 164px;
    max-width: 188px;
    white-space: normal;
  }

  .supplier-data-panel .table-wrap {
    max-height: calc(100vh - 220px);
  }

  .supplier-detail-body {
    padding: 12px;
  }

  .detail-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-actions,
  .panel-actions {
    justify-content: flex-start;
  }

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

  .form-grid.is-mobile-paired {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid.is-mobile-paired .form-field > span {
    min-height: 30px;
  }

  .form-grid.is-mobile-paired .form-field.is-wide {
    grid-column: 1 / -1;
  }

  .form-grid.is-mobile-paired .form-field.is-wide > span {
    min-height: 0;
  }

  .form-field input,
  .form-field select,
  .form-field textarea,
  .search-control input,
  .select-control select {
    font-size: 16px;
  }

  .detail-panel.is-editing .detail-heading {
    position: static;
    box-shadow: none;
  }

  .detail-panel.is-editing .detail-actions {
    position: fixed;
    left: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
    bottom: calc(
      var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px) + var(--mobile-nav-stack-gap)
    );
    z-index: 80;
    justify-content: space-between;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 38px rgba(16, 24, 40, 0.16);
    backdrop-filter: blur(18px);
  }

  .detail-panel.is-editing .detail-actions .primary-button,
  .detail-panel.is-editing .detail-actions .secondary-button {
    flex: 1;
    min-height: 42px;
  }

  .toast {
    bottom: calc(
      var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px) + 20px
    );
  }

  .kv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    min-height: var(--mobile-nav-height);
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -10px 30px rgba(16, 24, 40, 0.12);
    backdrop-filter: blur(18px);
  }

  .mobile-nav button {
    min-width: 0;
    min-height: 42px;
    padding: 7px 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
  }

  .mobile-nav button.is-active {
    color: var(--green-dark);
    background: var(--green-soft);
  }

  .app-shell.is-keyboard-active {
    padding-bottom: 18px;
  }

  .app-shell.is-keyboard-active .mobile-nav,
  .app-shell.is-keyboard-active .detail-panel.is-editing .detail-actions {
    display: none;
  }

  .app-shell.is-keyboard-active .supplier-form {
    padding-bottom: 18px;
  }
}

@media (max-width: 360px) {
  .form-grid.is-mobile-paired,
  .kv-grid,
  .mini-kv-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.is-mobile-paired .form-field > span {
    min-height: 0;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 13px;
  }

  .page {
    padding: 0 10px 18px;
  }

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

  .freshness-pill,
  .select-control,
  .metric-card,
  .panel,
  .timeline-step {
    border-radius: var(--radius);
  }

  .metric-card {
    min-height: 104px;
  }

  .metric-card > span,
  .panel-header h2 {
    font-size: 12px;
  }

  .metric-card strong {
    font-size: 17px;
  }

  .sparkline {
    width: 58px;
  }

  .chart {
    height: 206px;
    padding-bottom: 26px;
  }

  .chart svg {
    height: 158px;
  }

  .bottom-grid {
    margin-bottom: 8px;
  }

  .toast {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}
