:root {
  --navy-950: #101f31;
  --navy-900: #17314d;
  --navy-800: #214665;
  --blue-700: #23628a;
  --blue-100: #eaf3f8;
  --red-700: #a83232;
  --red-100: #fbeaea;
  --amber-700: #8a5b13;
  --amber-100: #fff2d6;
  --green-700: #27633f;
  --green-100: #e4f3e9;
  --gray-950: #15202b;
  --gray-800: #2d3a45;
  --gray-700: #465663;
  --gray-600: #5d6b76;
  --gray-400: #aeb8c0;
  --gray-300: #cad2d8;
  --gray-200: #dde3e7;
  --gray-100: #eef2f4;
  --gray-50: #f7f9fa;
  --white: #ffffff;
  --shadow: 0 1px 2px rgb(16 31 49 / 8%), 0 8px 26px rgb(16 31 49 / 6%);
  --radius: 8px;
  --content-width: 1500px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--gray-950);
  background: var(--gray-50);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--gray-50);
  color: var(--gray-950);
  font-size: 15px;
  line-height: 1.45;
}

a { color: var(--blue-700); text-underline-offset: 2px; }
a:hover { color: var(--navy-900); }

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 9px 14px;
  border-radius: 4px;
  background: var(--white);
  color: var(--navy-950);
  box-shadow: var(--shadow);
}
.skip-link:focus { transform: translateY(0); }

.app-header { background: var(--navy-950); color: var(--white); }
.header-inner {
  width: min(calc(100% - 40px), var(--content-width));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--white); text-decoration: none; }
.brand:hover { color: var(--white); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid rgb(255 255 255 / 75%);
  border-radius: 50%;
  font-weight: 800;
  font-size: 20px;
}
.brand strong { display: block; font-size: 19px; line-height: 1; text-transform: uppercase; letter-spacing: .07em; }
.brand small { display: block; margin-top: 4px; color: #cedbe4; font-size: 12px; letter-spacing: .025em; }
.environment-label { padding: 4px 8px; border: 1px solid #668198; border-radius: 4px; color: #e3edf3; font-size: 12px; }
.user-label { margin-left: auto; color: #d2dde5; font-size: 13px; }

.main-nav {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  display: flex;
  gap: 2px;
  overflow-x: auto;
}
.main-nav a {
  flex: 0 0 auto;
  padding: 12px 16px 11px;
  border-bottom: 3px solid transparent;
  color: #d7e2ea;
  text-decoration: none;
  font-weight: 650;
  font-size: 14px;
}
.main-nav a:hover { background: rgb(255 255 255 / 7%); color: var(--white); }
.main-nav a.active { border-bottom-color: #85c3e1; color: var(--white); background: rgb(255 255 255 / 8%); }

.page-shell { width: min(calc(100% - 40px), var(--content-width)); margin: 0 auto; padding: 34px 0 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 25px; }
.page-heading h1 { margin: 2px 0 6px; color: var(--navy-950); font-size: clamp(26px, 3vw, 38px); line-height: 1.12; letter-spacing: -.025em; }
.page-heading p { max-width: 820px; margin: 0; color: var(--gray-600); }
.eyebrow { margin: 0 0 4px !important; color: var(--blue-700) !important; font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.heading-actions, .button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.heading-actions form { margin: 0; }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.2;
}
.button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible, .icon-button:focus-visible, .segmented a:focus-visible {
  outline: 3px solid #7ac4eb;
  outline-offset: 2px;
}
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-primary { background: var(--navy-800); color: var(--white); border-color: var(--navy-800); }
.button-primary:hover { background: var(--navy-950); color: var(--white); }
.button-secondary { background: var(--white); color: var(--navy-900); border-color: #92a8b8; }
.button-secondary:hover { background: var(--blue-100); color: var(--navy-950); }
.button-ghost { background: transparent; color: var(--navy-900); border-color: var(--gray-300); }
.button-ghost:hover { background: var(--gray-100); }
.button-danger-outline { background: var(--white); color: var(--red-700); border-color: #d9a1a1; }
.button-danger-outline:hover { background: var(--red-100); }

.panel {
  margin-bottom: 22px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-heading { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 17px 20px; border-bottom: 1px solid var(--gray-200); }
.panel-heading h2 { margin: 0; color: var(--navy-950); font-size: 18px; }
.panel-heading p { margin: 3px 0 0; color: var(--gray-600); font-size: 13px; }
.panel-heading > a { font-weight: 700; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.content-grid .panel { margin: 0; }
.stack { display: grid; gap: 22px; }

.status-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 13px; margin-bottom: 25px; }
.status-card { min-height: 132px; display: flex; flex-direction: column; padding: 17px; border: 1px solid var(--gray-200); border-top: 4px solid var(--navy-800); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.status-card > span { color: var(--gray-600); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .045em; }
.status-card > strong { margin: 8px 0 5px; color: var(--navy-950); font-size: 25px; line-height: 1.1; }
.status-card > small { margin-top: auto; color: var(--gray-600); }
.status-card-danger { border-top-color: var(--red-700); background: #fffafa; }
.status-card-danger > strong { color: var(--red-700); }

.meta-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 1px; margin-bottom: 22px; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; background: var(--gray-200); box-shadow: var(--shadow); }
.meta-grid > div { min-height: 90px; padding: 14px 16px; background: var(--white); }
.meta-grid span { display: block; color: var(--gray-600); font-size: 12px; font-weight: 700; }
.meta-grid strong { display: block; margin-top: 8px; color: var(--navy-950); overflow-wrap: anywhere; }

.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--gray-200); text-align: left; vertical-align: top; }
th { background: var(--navy-900); color: var(--white); font-size: 12px; font-weight: 750; letter-spacing: .025em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7fafc; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.monospace, code { font-family: "Cascadia Mono", Consolas, monospace; font-size: .9em; }
.compact-data { max-width: 310px; color: var(--gray-700); font-size: 12px; overflow-wrap: anywhere; }
.component-summary { margin: 7px 0 0; padding-left: 17px; }
.component-summary li + li { margin-top: 4px; }
.cell-note { display: block; margin-top: 3px; color: var(--gray-600); }

.status { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border-radius: 999px; background: var(--gray-100); color: var(--gray-800); font-size: 11px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.status-active, .status-approved, .status-production_lists_created { background: var(--green-100); color: var(--green-700); }
.status-diff_ready, .status-ready_for_approval, .status-needs_review { background: var(--blue-100); color: var(--blue-700); }
.status-validation_failed, .status-rejected, .status-failed { background: var(--red-100); color: var(--red-700); }
.status-import_profile_required, .status-revalidation_required, .status-uploaded { background: var(--amber-100); color: var(--amber-700); }
.status-duplicate, .status-superseded { background: var(--gray-100); color: var(--gray-700); }

.empty-state { padding: 42px 24px; text-align: center; }
.empty-state h2, .empty-state h3 { margin: 0 0 7px; color: var(--navy-950); }
.empty-state p { max-width: 620px; margin: 0 auto 17px; color: var(--gray-600); }

.alert { display: flex; gap: 9px 16px; align-items: baseline; margin-bottom: 20px; padding: 13px 16px; border: 1px solid; border-radius: 5px; }
.alert-info { border-color: #9dc6db; background: var(--blue-100); color: var(--navy-900); }
.alert-warning { border-color: #dec178; background: var(--amber-100); color: #63400a; }
.alert-error { border-color: #d8a0a0; background: var(--red-100); color: var(--red-700); }
.alert-success { border-color: #99c9a8; background: var(--green-100); color: var(--green-700); }

.upload-panel { display: grid; grid-template-columns: minmax(240px, .65fr) minmax(360px, 1.35fr); gap: 30px; padding: 22px; }
.upload-panel h2 { margin: 0 0 5px; }
.upload-panel p { margin: 0; color: var(--gray-600); }
.upload-form { display: flex; align-items: flex-end; gap: 12px; }
.file-control { flex: 1; display: grid; gap: 6px; }
.file-control > span, label > span { color: var(--gray-800); font-size: 13px; font-weight: 700; }
.file-control small, .form-help { color: var(--gray-600); font-size: 12px; }

input, textarea, select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #aab7c0;
  border-radius: 4px;
  background: var(--white);
  color: var(--gray-950);
}
textarea { min-height: 70px; resize: vertical; }
input:disabled, textarea:disabled { background: var(--gray-100); }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; padding: 0; }
input[type="file"] { padding: 7px; }

.form-section { overflow: visible; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; padding: 20px; }
.form-grid label { display: grid; align-content: start; gap: 6px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.form-message { min-height: 24px; color: var(--red-700); font-weight: 650; }
.form-help-error { color: var(--red-700); }

.order-lines { display: grid; gap: 8px; padding: 18px 20px 22px; }
.order-line { display: grid; grid-template-columns: 42px minmax(190px, 1fr) 150px auto; align-items: end; gap: 12px; padding: 13px; border: 1px solid var(--gray-200); border-radius: 5px; background: var(--gray-50); }
.order-line label { display: grid; gap: 5px; }
.line-number { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 4px; border-radius: 50%; background: var(--navy-900); color: var(--white); font-weight: 800; }
.icon-button { min-height: 40px; padding: 8px 11px; border: 1px solid #d5a4a4; border-radius: 4px; background: var(--white); color: var(--red-700); cursor: pointer; }
.icon-button:hover { background: var(--red-100); }

.toolbar { display: flex; justify-content: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.search-control { width: min(420px, 100%); display: grid; gap: 5px; }
.filter-empty { padding: 25px; text-align: center; color: var(--gray-600); }
.inline-details { margin-top: 7px; }
.inline-details summary { width: fit-content; cursor: pointer; color: var(--blue-700); font-size: 12px; font-weight: 700; }
.cut-list { margin: 8px 0 0; padding-left: 20px; color: var(--gray-700); font-size: 12px; }
.yes-no { display: inline-block; min-width: 42px; padding: 3px 7px; border-radius: 4px; text-align: center; font-size: 12px; font-weight: 800; }
.yes-no.yes { background: var(--green-100); color: var(--green-700); }
.yes-no.no { background: var(--gray-100); color: var(--gray-700); }

.issue-list { display: grid; gap: 8px; padding: 15px 18px 18px; }
.issue { display: flex; justify-content: space-between; gap: 20px; padding: 12px 14px; border-left: 4px solid; border-radius: 3px; }
.issue strong { font-size: 13px; }
.issue p { margin: 3px 0 0; }
.issue-error { border-color: var(--red-700); background: var(--red-100); color: #712626; }
.issue-warning { border-color: #d09938; background: var(--amber-100); color: #61420d; }
.issue-source { flex: 0 0 auto; color: inherit; font-size: 12px; }

.diff-summary { display: flex; gap: 1px; background: var(--gray-200); border-bottom: 1px solid var(--gray-200); }
.diff-summary span { flex: 1; padding: 13px 16px; background: var(--gray-50); color: var(--gray-700); }
.diff-summary strong { display: block; color: var(--navy-950); font-size: 19px; }
.diff-section { padding: 18px; border-bottom: 1px solid var(--gray-200); }
.diff-section:last-child { border-bottom: 0; }
.diff-section h3 { margin: 0 0 12px; }

.position-list { display: grid; gap: 10px; padding: 17px; }
.position-card { border: 1px solid var(--gray-200); border-radius: 5px; overflow: hidden; }
.position-card > summary { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px 16px; cursor: pointer; background: var(--gray-50); }
.position-card > summary:hover { background: var(--blue-100); }
.position-card > summary small, .position-card > summary strong { display: block; }
.position-card > summary small { margin-bottom: 3px; color: var(--gray-600); }
.position-quantity { flex: 0 0 auto; font-weight: 800; }
.position-content { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, .8fr); gap: 22px; padding: 17px; border-top: 1px solid var(--gray-200); }
.position-content h3 { margin: 0 0 10px; font-size: 14px; }
.compact-table th, .compact-table td { padding: 8px 10px; }
.requirement-list { margin: 0; }
.requirement-list div { display: grid; grid-template-columns: 105px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--gray-200); }
.requirement-list dt { color: var(--gray-600); font-weight: 700; }
.requirement-list dd { margin: 0; }
.missing-value { color: var(--red-700); font-weight: 700; }

.approval-panel, .production-links { padding-bottom: 20px; }
.approval-form { display: grid; gap: 10px; padding: 17px 20px 0; }
.approval-form label { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.approval-form .button { width: fit-content; margin-top: 8px; }
.production-links { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px; }
.production-links h2 { margin: 0 0 4px; }
.production-links p { margin: 0; color: var(--gray-600); }

.print-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 2px solid var(--navy-950); }
.print-header h1 { margin: 0; font-size: 30px; }
.print-header dl { display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); gap: 7px 18px; margin: 0; }
.print-header dl div { display: grid; grid-template-columns: auto 1fr; gap: 5px; }
.print-header dt { color: var(--gray-600); font-size: 11px; font-weight: 700; }
.print-header dd { margin: 0; font-size: 12px; font-weight: 800; }
.print-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.segmented { display: inline-flex; border: 1px solid var(--gray-300); border-radius: 5px; overflow: hidden; }
.segmented a { padding: 8px 13px; border-right: 1px solid var(--gray-300); color: var(--navy-900); text-decoration: none; font-weight: 700; }
.segmented a:last-child { border-right: 0; }
.segmented a.active { background: var(--navy-900); color: var(--white); }
.production-sheet { min-height: 350px; border: 1px solid var(--gray-300); background: var(--white); }
.production-table th { background: var(--navy-950); }
.production-table td { height: 42px; vertical-align: middle; }
.production-table .total-cell { font-size: 17px; font-weight: 850; }
.address-group > h2 { margin: 0; padding: 13px 15px; border-bottom: 1px solid var(--gray-300); background: var(--blue-100); font-size: 16px; }
.address-group + .address-group { margin-top: 28px; border-top: 2px solid var(--navy-950); }
.print-document-footer { display: flex; justify-content: space-between; gap: 14px; margin-top: 12px; color: var(--gray-600); font-size: 11px; }

.error-page { max-width: 700px; padding: 55px 0; }
.error-page h1 { margin: 3px 0 12px; font-size: 38px; }
.error-page > p:not(.eyebrow) { margin-bottom: 22px; color: var(--gray-600); font-size: 17px; }

.app-footer { width: min(calc(100% - 40px), var(--content-width)); margin: 0 auto; padding: 18px 0 24px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--gray-200); color: var(--gray-600); font-size: 12px; }

@media (max-width: 1100px) {
  .status-grid { grid-template-columns: repeat(3, 1fr); }
  .meta-grid { grid-template-columns: repeat(3, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .header-inner, .main-nav, .page-shell, .app-footer { width: min(calc(100% - 24px), var(--content-width)); }
  .header-inner { min-height: 62px; gap: 12px; }
  .environment-label { display: none; }
  .user-label { font-size: 0; }
  .user-label::after { content: "Stefan"; font-size: 12px; }
  .main-nav a { padding-inline: 11px; }
  .page-shell { padding-top: 23px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; }
  .status-grid, .meta-grid { grid-template-columns: repeat(2, 1fr); }
  .upload-panel { grid-template-columns: 1fr; }
  .upload-form { align-items: stretch; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .order-line { grid-template-columns: 36px 1fr 90px; }
  .order-line .icon-button { grid-column: 2 / -1; justify-self: start; }
  .position-content { grid-template-columns: 1fr; }
  .production-links, .print-header, .print-toolbar { align-items: stretch; flex-direction: column; }
  .print-header dl { grid-template-columns: 1fr 1fr; }
  .segmented { width: 100%; }
  .segmented a { flex: 1; text-align: center; }
}

@media (max-width: 460px) {
  .brand small { display: none; }
  .status-grid, .meta-grid { grid-template-columns: 1fr; }
  .status-card { min-height: 108px; }
  .main-nav { gap: 0; }
  .main-nav a { font-size: 12px; }
  .order-line { grid-template-columns: 32px 1fr; }
  .order-line label:nth-of-type(2), .order-line .icon-button { grid-column: 2; }
  .print-header dl { grid-template-columns: 1fr; }
}

@page { size: A4 landscape; margin: 12mm; }

@media print {
  :root { background: white; }
  body { min-height: auto; background: white; color: black; font-size: 9.5pt; }
  .no-print, .app-header, .app-footer, .alert { display: none !important; }
  .page-shell { width: 100%; margin: 0; padding: 0; }
  .print-header { margin-bottom: 5mm; padding-bottom: 3mm; border-color: #000; }
  .print-header h1 { color: #000; font-size: 18pt; }
  .print-header .eyebrow { color: #000 !important; }
  .production-sheet { min-height: 0; border-color: #000; }
  .production-table { break-inside: auto; }
  .production-table thead { display: table-header-group; }
  .production-table tr { break-inside: avoid; break-after: auto; }
  .production-table th { background: #e8e8e8 !important; color: #000; border: 1px solid #555; }
  .production-table td { height: 9mm; padding: 2mm 2.5mm; border: 1px solid #777; }
  .production-table .total-cell { font-size: 12pt; }
  .address-group { break-inside: avoid-page; }
  .address-group > h2 { background: #eee !important; color: #000; border-color: #555; }
  .print-document-footer { position: fixed; right: 0; bottom: -7mm; left: 0; color: #333; }
  a { color: inherit; text-decoration: none; }
}
