* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.component-options {
  border-top: 1px solid #d5deea;
  margin-top: 16px;
  padding-top: 12px;
}

.component-options > label,
.component-options [data-order-brackets-fields],
.component-options [data-order-fasteners-fields] > label {
  margin-bottom: 12px;
}

.order-total {
  border-top: 1px solid #d5deea;
  font-size: 20px;
  margin: 18px 0;
  padding-top: 14px;
  text-align: right;
}

body {
  margin: 0;
  background: #f4f5f7;
  color: #1f2933;
  font-family: Arial, sans-serif;
}

header {
  align-items: center;
  background: #111827;
  color: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 14px 24px;
  position: relative;
}

header strong {
  display: block;
  font-size: 18px;
}

header span {
  color: #cbd5e1;
  font-size: 14px;
}

nav {
  align-items: center;
  display: flex;
  gap: 16px;
}

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

.tabs {
  display: flex;
  gap: 18px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.tabs a {
  color: #cbd5e1;
  font-weight: 700;
  text-decoration: none;
}

.tabs a.active {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

a {
  color: #2563eb;
}

nav a {
  color: #fff;
}

main {
  margin: 0 auto;
  max-width: 1500px;
  padding: 24px;
}

main:has(.orders-section) {
  max-width: 1440px;
}

@media (max-width: 900px) {
  header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .header-right {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .tabs {
    position: static;
    transform: none;
  }
}

.layout {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(360px, 0.75fr) minmax(600px, 1.25fr);
}

.single-column {
  max-width: 980px;
}

.orders-column {
  width: 100%;
}

.orders-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.order-modal {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 20px 60px #1118274d;
  height: min(900px, calc(100vh - 40px));
  max-height: calc(100vh - 40px);
  max-width: calc(100vw - 32px);
  padding: 0;
  position: fixed;
  width: min(1120px, calc(100vw - 32px));
}

.order-modal::backdrop {
  background: #11182799;
}

.order-modal iframe {
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

.order-modal-close {
  align-items: center;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  display: flex;
  font-size: 26px;
  height: 38px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 16px;
  top: 14px;
  width: 38px;
  z-index: 1;
}

.modal-body {
  background: #fff;
}

.modal-body main {
  max-width: none;
  padding: 64px 20px 20px;
}

.modal-body .order-form-section {
  border: 0;
  margin: 0;
  max-width: none;
  padding: 0;
}

.order-form-section {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  font-size: 18px;
}

.order-form-section h2 {
  font-size: 23px;
}

.order-form-section h3 {
  font-size: 18px;
}

.order-form-section label {
  font-size: 15px;
}

.customer-search-field {
  position: relative;
}

.customer-suggestions {
  background: #fff;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  box-shadow: 0 12px 28px #11182726;
  left: 0;
  max-height: 260px;
  overflow-y: auto;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 10;
}

.customer-suggestions[hidden],
.customer-selection[hidden] {
  display: none;
}

.customer-suggestion {
  background: #fff;
  border: 0;
  border-radius: 0;
  color: #1f2933;
  display: block;
  font-size: 15px;
  font-weight: 400;
  min-height: 42px;
  padding: 8px 12px;
  text-align: left;
  width: 100%;
}

.customer-suggestion:hover,
.customer-suggestion:focus {
  background: #eff6ff;
}

.customer-selection {
  align-items: center;
  color: #166534;
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 12px;
}

.customer-selection-clear {
  background: transparent;
  color: #2563eb;
  font-size: 14px;
  min-height: 0;
  padding: 0;
  text-decoration: underline;
}

.order-form-section input,
.order-form-section select {
  font-size: 18px;
}

.order-form-section .source-hint {
  font-size: 15px;
}

.orders-section {
  width: 100%;
}

.order-common,
.order-item {
  background: #fff;
  border: 1px solid #e5e9f0;
  border-radius: 8px;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 16px;
}

.order-items {
  display: grid;
  gap: 16px;
}

.order-item-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.order-item-header h3 {
  margin: 0;
}

.order-plan-line + .order-plan-line {
  border-top: 1px solid #e5e9f0;
  margin-top: 8px;
  padding-top: 8px;
}

.order-plan-line {
  border-left: 4px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  white-space: normal;
}

.order-plan-line-ready {
  background: #ecfdf5;
  border-left-color: #16a34a;
}

.order-plan-line-missing {
  background: #fef2f2;
  border-left-color: #dc2626;
}

.availability-badge,
.shipment-ready-label {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  margin-top: 5px;
  padding: 3px 8px;
  white-space: normal;
}

.availability-ready {
  background: #bbf7d0;
  color: #14532d;
}

.availability-missing {
  background: #fecaca;
  color: #7f1d1d;
}

.shipment-ready-label {
  background: #16a34a;
  color: #fff;
  margin: 0 0 8px;
}

section,
.login {
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  margin-bottom: 24px;
  padding: 20px;
}

.order-common,
.order-item {
  border-color: #e5e9f0;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 16px;
}

h1,
h2 {
  margin: 0 0 16px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
  margin: 18px 0 12px;
}

.nested-section {
  border: 0;
  margin: 18px 0 0;
  padding: 0;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid #e5e9f0;
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  font-size: 13px;
  color: #475569;
}

.num {
  text-align: right;
}

.finished-table th,
.finished-table td {
  border: 1px solid #111827;
}

.finished-table {
  table-layout: fixed;
}

.finished-table th {
  color: #111827;
  text-align: center;
}

.finished-table th:first-child,
.finished-table td:first-child {
  min-width: 300px;
  width: 300px;
}

.finished-table th:not(:first-child),
.finished-table td:not(:first-child) {
  width: 118px;
}

.finished-table th.potential,
.finished-table td.potential {
  width: 150px;
}

.orders-table {
  font-size: 14px;
  table-layout: fixed;
  width: 100%;
}

.orders-table th,
.orders-table td {
  border-right: 1px solid #d8dee8;
  overflow-wrap: anywhere;
  vertical-align: top;
  white-space: normal;
}

.orders-table th:last-child,
.orders-table td:last-child {
  border-right: 0;
}

.orders-table > thead > tr > th:nth-child(1) { width: 10%; }
.orders-table > thead > tr > th:nth-child(2) { width: 16%; }
.orders-table > thead > tr > th:nth-child(3) { width: 10%; }
.orders-table > thead > tr > th:nth-child(4) { width: 14%; }
.orders-table > thead > tr > th:nth-child(5) { width: 10%; }
.orders-table > thead > tr > th:nth-child(6) { width: 20%; }
.orders-table > thead > tr > th:nth-child(7) { width: 12%; }
.orders-table > thead > tr > th:nth-child(8) { width: 8%; }

.orders-table .order-summary-row td {
  padding: 12px 10px;
}

.order-cell-sub {
  color: #64748b;
  display: block;
  font-size: 12px;
  margin-top: 5px;
}

.orders-table .order-composition,
.orders-table .order-client-name {
  line-height: 1.35;
}

.order-expand {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #166534;
  font-size: 13px;
  min-height: 34px;
  padding: 6px 7px;
  width: 100%;
}

.order-expand::before {
  content: '▸';
  display: inline-block;
  margin-right: 4px;
}

.order-expand[aria-expanded='true']::before {
  transform: rotate(90deg);
}

.orders-table .order-detail-row > td {
  background: #f8fafc;
  padding: 16px;
}

.order-detail-content {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}

.order-detail-meta {
  color: #475569;
  margin-bottom: 10px;
}

.order-items-table {
  table-layout: fixed;
  width: 100%;
}

.order-items-table th,
.order-items-table td {
  border: 1px solid #d8dee8;
  padding: 8px;
  white-space: normal;
}

.order-items-table th:nth-child(1) { width: 5%; }
.order-items-table th:nth-child(2) { width: 35%; }
.order-items-table th:nth-child(3) { width: 9%; }
.order-items-table th:nth-child(4) { width: 12%; }
.order-items-table th:nth-child(5) { width: 18%; }
.order-items-table th:nth-child(6) { width: 21%; }

.order-items-table .order-item-name {
  overflow-wrap: anywhere;
}

.order-detail-sidebar {
  min-width: 0;
}

.order-detail-sidebar .production-plan-form {
  max-width: 100%;
  min-width: 0;
}

.order-payment-form {
  margin-bottom: 16px;
}

.orders-table tr.order-row-ready-ship td {
  background: #f0fdf4;
}

.orders-table tr.order-row-active td {
  background: #fffbea;
}

.orders-table tr.order-row-active td:first-child {
  border-left: 5px solid #f59e0b;
}

.orders-table tr.order-row-ready-ship td:first-child {
  border-left-color: #16a34a;
}

.orders-table tr.order-row-ready-ship td:first-child {
  border-left: 5px solid #16a34a;
}

.journal-table .wrap {
  max-width: 360px;
  white-space: normal;
}

.muted {
  color: #64748b;
  font-size: 12px;
  margin-top: 4px;
  white-space: normal;
}

.diameter-row td {
  background: #f4f700;
  font-weight: 700;
  text-align: center;
}

.zinc {
  background: #f8fafc;
}

.ral-6005 {
  background: #114232;
  color: #fff;
}

.finished-table th.ral-6005,
.finished-table th.ral-8017,
.finished-table th.ral-7024 {
  color: #fff;
}

.ral-8017 {
  background: #44322d;
  color: #fff;
}

.ral-7024 {
  background: #474a50;
  color: #fff;
}

.defect {
  background: #fecaca;
  color: #7f1d1d;
}

.potential {
  background: #e0f2fe;
  color: #0c4a6e;
  font-weight: 700;
}

form {
  display: grid;
  gap: 14px;
}

.inline-form {
  display: inline-grid;
  margin: 0 0 14px;
  min-width: 260px;
}

.login {
  margin: 60px auto;
  max-width: 420px;
}

label {
  color: #475569;
  display: grid;
  font-size: 13px;
  gap: 6px;
}

.checkbox-label {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.checkbox-label input {
  min-height: auto;
}

input,
select {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
}

button {
  background: #166534;
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 14px;
}

button:disabled {
  background: #64748b;
  cursor: wait;
}

button.small {
  font-size: 12px;
  min-height: 30px;
  padding: 6px 9px;
}

button.secondary {
  background: #64748b;
}

.button-link {
  align-items: center;
  background: #166534;
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  text-decoration: none;
}

.button-link.small {
  font-size: 12px;
  min-height: 30px;
  padding: 6px 9px;
}

.button-link.secondary {
  background: #64748b;
}

.compact-form {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  min-width: 130px;
}

.compact-form input {
  min-height: 30px;
  padding: 5px 7px;
}

.actions {
  display: grid;
  gap: 6px;
  min-width: 120px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.proposal-send {
  min-width: 210px;
}

.proposal-send summary {
  color: #166534;
  cursor: pointer;
  font-weight: 700;
}

.proposal-send form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.proposal-send input {
  width: 100%;
}

.clients-section,
.client-card {
  margin-left: auto;
  margin-right: auto;
  max-width: 1100px;
}

.clients-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.clients-header h2 {
  margin: 0;
}

.client-create-form {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.production-plan-form {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  gap: 8px;
  max-width: 360px;
  min-width: 300px;
  padding: 8px;
}

.production-plan-title {
  color: #1f2933;
  font-size: 12px;
  font-weight: 700;
  white-space: normal;
}

.production-plan-option {
  align-items: start;
  color: #1f2933;
  display: grid;
  gap: 7px;
  grid-template-columns: auto 1fr;
  line-height: 1.25;
}

.production-plan-option input {
  margin-top: 2px;
  min-height: auto;
}

.action-row {
  display: flex;
  gap: 6px;
}

.is-submitting {
  opacity: 0.82;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.source-box {
  background: #f8fafc;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.source-box[hidden] {
  display: none;
}

.source-hint {
  color: #475569;
  font-size: 13px;
}

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

.option-card {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #1f2933;
  cursor: pointer;
  display: grid;
  gap: 4px;
  grid-template-columns: auto 1fr;
  padding: 10px;
}

.option-card input {
  grid-row: 1 / span 3;
  min-height: auto;
  margin: 3px 4px 0 0;
}

.option-card.selected {
  border-color: #166534;
  box-shadow: inset 0 0 0 1px #166534;
}

.option-card.disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

.success,
.error {
  border-radius: 8px;
  margin: 0 0 16px;
  padding: 12px 14px;
}

.success {
  background: #dcfce7;
  color: #14532d;
}

.error {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 980px) {
  header,
  nav,
  .header-right,
  .tabs {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout,
  .grid {
    grid-template-columns: 1fr;
  }

  main {
    padding: 14px;
  }
}

.print-body {
  background: #e5e7eb;
}

.print-page-wrap {
  max-width: 210mm;
  padding: 24px 0;
}

.print-document {
  background: #fff;
  color: #111827;
  font-family: "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.25;
  margin: 0 auto;
  min-height: 297mm;
  padding: 22mm 18mm;
  position: relative;
  width: 210mm;
}

.print-toolbar {
  display: flex;
  font-family: system-ui, sans-serif;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.print-document h1 {
  font-size: 18px;
  margin: 18px 0 4px;
  text-align: center;
}

.print-document h2 {
  font-size: 15px;
  margin: 8px 0 18px;
  text-align: center;
}

.kp-header {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  margin: 28px 0 26px;
}

.kp-date {
  color: #555;
  font-size: 11px;
}

.kp-labels,
.kp-values {
  display: grid;
  grid-template-rows: repeat(5, auto);
  row-gap: 5px;
}

.kp-labels {
  color: #555;
  font-size: 12px;
}

.kp-values {
  font-size: 15px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.commercial-proposal h1 {
  font-family: Arial, sans-serif;
  font-size: 25px;
  margin-top: 26px;
}

.print-table {
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 14px;
  max-width: 100%;
  table-layout: fixed;
  width: 100%;
}

.print-table th,
.print-table td {
  border: 1px solid #111;
  padding: 4px 6px;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

.print-table th {
  font-weight: 700;
  text-align: center;
}

.print-table th:first-child,
.print-table td:first-child {
  width: 34px;
}

.print-table th:nth-child(3),
.print-table td:nth-child(3) {
  width: 80px;
}

.print-table th:nth-child(4),
.print-table td:nth-child(4) {
  width: 52px;
}

.print-table th:nth-child(2),
.print-table td:nth-child(2) {
  width: auto;
}

.commercial-proposal .print-table th:nth-child(3),
.commercial-proposal .print-table td:nth-child(3) {
  width: 52px;
}

.commercial-proposal .print-table th:nth-child(5),
.commercial-proposal .print-table td:nth-child(5),
.commercial-proposal .print-table th:nth-child(6),
.commercial-proposal .print-table td:nth-child(6) {
  width: 68px;
}

.print-total {
  font-size: 15px;
  font-weight: 700;
  margin-top: 16px;
  text-align: right;
}

.kp-totals {
  border-collapse: collapse;
  font-size: 13px;
  margin: 0 0 0 auto;
}

.kp-totals th,
.kp-totals td {
  border: 1px solid #111;
  padding: 4px 6px;
  white-space: nowrap;
}

.kp-totals th {
  font-weight: 400;
  text-align: right;
}

.kp-totals td {
  min-width: 92px;
  text-align: right;
}

.kp-totals tr:last-child {
  font-weight: 700;
}

.kp-summary {
  margin: 24px 0 30px;
}

.kp-signature {
  align-items: end;
  display: grid;
  gap: 20px;
  grid-template-columns: max-content minmax(80px, 1fr) max-content;
}

.kp-signature-line {
  border-bottom: 1px solid #111;
  height: 1em;
}

.daily-inventory-link {
  margin: 0 0 16px;
}

.daily-inventory-history {
  max-width: 1100px;
  margin: 0 auto;
}

.daily-inventory-heading {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
}

.daily-inventory-filter {
  align-items: end;
  display: flex;
  gap: 12px;
  margin: 18px 0;
}

@media (max-width: 1000px) {
  .orders-table,
  .orders-table tbody {
    display: block;
    width: 100%;
  }

  .orders-table > thead {
    display: none;
  }

  .orders-table .order-summary-row {
    border: 1px solid #d8dee8;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
  }

  .orders-table .order-summary-row td {
    border-bottom: 1px solid #d8dee8;
    border-right: 0;
  }

  .orders-table .order-summary-row td::before {
    color: #64748b;
    content: attr(data-label);
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
  }

  .orders-table .order-summary-row td:last-child::before {
    display: none;
  }

  .orders-table .order-detail-row,
  .orders-table .order-detail-row > td {
    display: block;
    width: 100%;
  }

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

  .order-items-table {
    min-width: 720px;
  }
}

@media (max-width: 600px) {
  .orders-table .order-summary-row {
    grid-template-columns: 1fr;
  }
}

.work-order-document {
  padding-top: 32mm;
}

.work-order-color {
  font-size: 26px;
  position: absolute;
  right: 28mm;
  top: 10mm;
}

.work-order-table {
  margin: 20px auto 0;
  width: 170mm;
}

.work-order-signatures {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(3, max-content);
  margin: 28px 0 0 24mm;
}

@page {
  margin: 0;
  size: A4;
}

@media print {
  body,
  .print-body {
    background: #fff;
  }

  .print-page-wrap {
    margin: 0;
    max-width: none;
    padding: 0;
  }

  .print-document {
    box-shadow: none;
    margin: 0;
    min-height: 297mm;
    width: 210mm;
  }

  .print-toolbar {
    display: none;
  }
}
