:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #eef3f2;
  --text: #17212b;
  --muted: #66737f;
  --line: #d9e1e5;
  --nav: #16251f;
  --nav-hover: #20362e;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(20, 35, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--nav);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.top-nav {
  max-width: 1240px;
  min-height: 68px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav-user-label {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.nav-inline-form {
  margin: 0;
}

.nav-link-button {
  appearance: none;
}

.nav-context {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 16px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  color: rgba(255, 255, 255, 0.92);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.nav-link:hover,
.nav-link:focus {
  color: #fff;
  background: var(--nav-hover);
  outline: none;
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 24px 56px;
}

section {
  margin-bottom: 32px;
}

h1,
h2,
h3 {
  margin: 0 0 14px;
  line-height: 1.18;
  color: var(--text);
}

h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  letter-spacing: 0;
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin-top: 0;
}

.page-hero {
  padding: 16px 0 8px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent-hover);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
}

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

.module-card {
  min-height: 300px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.module-card p:not(.eyebrow) {
  color: var(--muted);
}

.module-link-card {
  color: inherit;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.module-link-card:hover,
.module-link-card:focus {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 18px 42px rgba(20, 35, 45, 0.12);
  outline: none;
}

.module-entry {
  display: inline-flex;
  width: fit-content;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.home-hero {
  max-width: 760px;
}

.home-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.home-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  border-radius: 8px;
  padding: 16px 22px;
  color: #fff;
  background: var(--accent);
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.18);
}

.home-cta:hover,
.home-cta:focus {
  background: var(--accent-hover);
  outline: none;
}
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(20, 35, 45, 0.04);
}

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

th {
  background: var(--surface-muted);
  color: #2d3a45;
  font-size: 0.9rem;
}

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

form {
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 6px 18px rgba(20, 35, 45, 0.04);
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 750;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-bottom: 16px;
  border: 1px solid #c8d2d8;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

textarea {
  min-height: 90px;
  min-width: 320px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
  outline: none;
}

.error {
  color: var(--danger);
  font-weight: 800;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
button:focus,
.button:hover,
.button:focus {
  background: var(--accent-hover);
  outline: none;
}

.button.secondary {
  background: #53636f;
}

.button.secondary:hover,
.button.secondary:focus {
  background: #3f4d57;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 0;
}

.summary div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  box-shadow: 0 4px 14px rgba(20, 35, 45, 0.035);
}

.summary dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.summary dd {
  margin: 6px 0 0;
  font-weight: 650;
}

.auth-shell {
  display: flex;
  justify-content: center;
  padding-top: 20px;
}

.auth-card {
  width: min(100%, 520px);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

@media (max-width: 820px) {
  .top-nav {
    min-height: auto;
    padding: 14px 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    align-items: stretch;
  }

  .nav-user-area {
    width: 100%;
    justify-content: space-between;
  }

  .nav-link,
  .nav-trigger {
    width: 100%;
    justify-content: space-between;
  }

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

  main {
    padding: 28px 18px 44px;
  }
}
.success {
  color: #0f766e;
  font-weight: 800;
}

.filter-form,
.wide-form {
  max-width: none;
}

.form-actions {
  margin-top: 16px;
}

.status-pill {
  display: inline-flex;
  min-width: 86px;
  justify-content: center;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.84rem;
  font-weight: 800;
}

.status-red {
  color: #fff;
  background: #b42318;
}

.status-yellow {
  color: #17212b;
  background: #f4c430;
}

.status-green {
  color: #fff;
  background: #0f766e;
}

.status-incomplete {
  color: #53636f;
  background: #e6ecef;
}

.status-draft {
  color: #fff;
  background: #53636f;
}

.status-issued {
  color: #17212b;
  background: #d7dee3;
}

.status-incomplete {
  color: #3b2400;
  background: #ffd57a;
}

.status-closed {
  color: #fff;
  background: #17212b;
}
.filter-form input[type="checkbox"] {
  display: inline-block;
  width: auto;
  max-width: none;
  margin: 0 8px 0 0;
}

.wide-form table input {
  max-width: 140px;
  margin-bottom: 0;
}

.module-card-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.inventory-nav-section {
  margin-top: 20px;
}

.inventory-nav-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.inventory-nav-card {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: inherit;
  background: var(--surface);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(20, 35, 45, 0.04);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.inventory-nav-card:hover,
.inventory-nav-card:focus {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 14px 32px rgba(20, 35, 45, 0.1);
  outline: none;
}

.inventory-nav-card-active {
  border-color: rgba(15, 118, 110, 0.55);
  background: rgba(15, 118, 110, 0.06);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.12);
}

.inventory-nav-card-body {
  display: grid;
  gap: 8px;
}

.inventory-nav-card-label {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.inventory-nav-card-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.inventory-nav-card-link {
  display: inline-flex;
  width: fit-content;
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  background: var(--accent);
  font-size: 0.92rem;
  font-weight: 800;
}

.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.po-print-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.po-print-page {
  background: #f4f7f5;
}

.po-print-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
}

.po-print-header,
.po-print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.po-print-meta,
.po-print-footer {
  text-align: right;
}

.po-print-grid {
  margin: 24px 0;
}

@media print {
  .print-hide,
  .site-header,
  .site-nav,
  .actions {
    display: none !important;
  }

  .po-print-sheet {
    border: 0;
    padding: 0;
  }
}

.po-order-line input,
#po-lines-body input {
  max-width: none;
  margin-bottom: 0;
}

.lookup-cell {
  min-width: 220px;
}

.muted-inline {
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.audit-filter-form {
  max-width: none;
}

.audit-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 16px;
}

.audit-filter-grid input,
.audit-filter-grid select {
  max-width: none;
  margin-bottom: 0;
}

.audit-pagination-bar {
  justify-content: space-between;
}

.pagination-links {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.audit-payload {
  margin: 0;
  min-height: 120px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(20, 35, 45, 0.04);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
}

.kpi-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.kpi-grid-vertical {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 360px;
}

.kpi-grid-horizontal {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.kpi-card-compact {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(20, 35, 45, 0.04);
}

.kpi-card-value {
  margin: 0;
  font-size: 1.45rem;
}

.kpi-card-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.report-split,
.chart-grid,
.sales-activity-grid {
  display: grid;
  gap: 20px;
}

.report-split,
.chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}

.report-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 6px 18px rgba(20, 35, 45, 0.04);
}

.report-panel form {
  max-width: none;
  margin: 0;
  border: 0;
  padding: 0;
  box-shadow: none;
}

.report-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.chart-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(20, 35, 45, 0.04);
}

.chart-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.report-chart,
.pie-chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart-note,
.chart-empty {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chart-empty-visible {
  display: block;
}

.line-chart-legend,
.pie-chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.line-chart-legend span,
.pie-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chart-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.chart-swatch-net {
  background: #0f766e;
}

.chart-swatch-cogs {
  background: #b45309;
}

.chart-swatch-profit {
  background: #1d4ed8;
}

.summary-comparison-table {
  table-layout: fixed;
}

.summary-comparison-table th:first-child,
.summary-comparison-table td:first-child {
  width: 28%;
}

.summary-comparison-table th {
  text-align: center;
}

.summary-comparison-table th[scope="row"] {
  text-align: left;
  color: var(--text);
  background: #fff;
}

.summary-comparison-table td {
  text-align: right;
  white-space: nowrap;
}

.pie-chart-legend-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.pie-chart-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.pie-chart-legend-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.pie-chart-circular {
  max-width: 260px;
  margin: 0 auto;
}

.pareto-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.84rem;
  font-weight: 800;
}

.pareto-a {
  color: #fff;
  background: #0f766e;
}

.pareto-b {
  color: #17212b;
  background: #f4c430;
}

.pareto-c {
  color: #fff;
  background: #b42318;
}

.pareto-metric-a {
  color: #0f766e;
}

.pareto-metric-b {
  color: #8a6b00;
}

.pareto-metric-c {
  color: #b42318;
}

.pareto-card {
  color: inherit;
}

.pareto-card-a {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.35);
}

.pareto-card-b {
  background: rgba(244, 196, 48, 0.16);
  border-color: rgba(244, 196, 48, 0.45);
}

.pareto-card-c {
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.35);
}

.help-abbr {
  border-bottom: 1px dotted rgba(23, 33, 43, 0.45);
  cursor: help;
}

.inline-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.lookup-reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 16px;
  margin: 8px 0 12px;
}

.lookup-reference-grid p {
  margin: 0;
}

.lookup-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px;
}

.lookup-result-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.lookup-result-button:hover,
.lookup-result-button:focus {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.18);
  outline: none;
}

.lookup-result-button strong {
  color: var(--text);
}

.lookup-result-button span {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 1040px) {
  .inventory-nav-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-comparison-table {
    min-width: 640px;
  }
}

@media (max-width: 680px) {
  .inventory-nav-grid {
    grid-template-columns: 1fr;
  }

  .audit-detail-grid {
    grid-template-columns: 1fr;
  }
}
