:root {
  --bg: #eef2f3;
  --panel: #ffffff;
  --ink: #081a28;
  --muted: #5d6b75;
  --line: #d8dfe3;
  --blue: #123a52;
  --green: #147b68;
  --amber: #c69a55;
  --brand-gold: #c69a55;
  --red: #c43d3d;
  --teal: #00afa5;
  --lime: #c8ff4d;
  --silver: #e8eef2;
  --warm: #f7f5ef;
  --sidebar: #081a28;
  --content-max: 1440px;
}

.inventory-search-box {
  display: grid;
  grid-template-columns: minmax(240px, 360px) auto;
  gap: 8px;
  align-items: center;
}

.inventory-search-box .search {
  width: 100%;
  max-width: none;
}

.inventory-search-results {
  margin: 0 0 12px;
  border: 1px solid #c9d7e4;
  border-radius: 6px;
  background: #fff;
}

.inventory-search-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid #dbe4ec;
  background: #f6f9fb;
}

.inventory-search-result-head span {
  color: var(--muted);
  font-size: 12px;
}

.inventory-product-cell {
  display: flex;
  min-width: 190px;
  align-items: center;
  gap: 8px;
}

.inventory-product-cell > span:last-child {
  min-width: 0;
}

.inventory-product-thumb,
.inventory-photo-placeholder {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f9fb;
}

.inventory-product-thumb {
  display: block;
  object-fit: contain;
}

.inventory-photo-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.material-product-image-editor {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7fafb;
}

.material-product-image-box {
  display: grid;
  width: 132px;
  height: 104px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.material-product-image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.material-product-image-box [hidden] {
  display: none;
}

.material-product-image-controls {
  display: grid;
  gap: 7px;
}

.material-product-image-controls small {
  color: var(--muted);
}

@media (max-width: 560px) {
  .material-product-image-editor {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .inventory-search-box {
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  .inventory-search-result-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

.finance-account-filter {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto 1fr;
  gap: 10px;
  align-items: end;
  margin: 10px 0 12px;
}

.finance-account-filter label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: #23364a;
}

.finance-account-filter select {
  min-height: 86px;
  padding: 8px;
}

.finance-account-filter span {
  color: #425466;
  font-size: 13px;
}

.sync-notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #081a28;
  color: #fff;
  box-shadow: 0 12px 32px rgba(8, 26, 40, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.sync-notice.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 720px) {
  .finance-account-filter {
    grid-template-columns: 1fr auto;
  }

  .finance-account-filter span {
    grid-column: 1 / -1;
  }
}

[hidden] {
  display: none !important;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #e9ecef;
}

.auth-panel {
  width: min(390px, 100%);
  padding: 24px;
  border: 1px solid #cbd8df;
  border-top: 4px solid var(--brand-gold);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 38, 54, 0.14);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -24px -24px 22px;
  padding: 18px 24px;
  color: #fff;
  background: var(--sidebar);
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand strong {
  font-size: 19px;
}

.auth-brand small {
  margin-top: 3px;
  color: var(--brand-gold);
  font-family: Poppins, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.auth-brand-logo {
  display: block;
  width: 72px;
  height: 86px;
  flex: 0 0 72px;
  object-fit: contain;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form h2,
.auth-form p {
  margin: 0;
}

.auth-form label {
  display: grid;
  gap: 5px;
  font-weight: 700;
}

.auth-form button {
  min-height: 40px;
  margin-top: 4px;
}

.auth-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: #b42318;
  font-size: 13px;
}

body.auth-required .app-shell {
  visibility: hidden;
}

.invoice-filter-grid {
  display: grid;
  grid-template-columns: 140px 160px 150px minmax(220px, 1fr);
  gap: 8px;
  align-items: end;
}

.invoice-summary {
  margin: 10px 0 14px;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

#financeInvoices h4 {
  margin: 14px 0 6px;
}

.link.danger {
  color: #b42318;
  border-color: #f0b4ad;
}

.voided-orders-panel tbody tr {
  color: #667085;
}

@media (max-width: 900px) {
  .invoice-filter-grid,
  .invoice-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #fff;
  background: var(--sidebar);
  padding: 18px 14px;
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  padding: 0;
  border: 0;
  background: transparent;
}

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

.sale-customer-picker {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
}

.sale-customer-picker > input {
  min-width: 0;
  border-radius: 4px 0 0 4px;
}

.customer-dropdown-button {
  min-width: 34px;
  padding: 0;
  color: #081a28;
  background: #f7f5ef;
  border: 1px solid #c7d2da;
  border-left: 0;
  border-radius: 0 4px 4px 0;
  font-size: 18px;
  line-height: 1;
}

.customer-dropdown-button:hover,
.customer-dropdown-button[aria-expanded="true"] {
  color: #081a28;
  background: #eadcc5;
  border-color: #c69a55;
}

.sale-customer-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  z-index: 120;
  width: min(430px, calc(100vw - 42px));
  max-height: 280px;
  overflow: auto;
  padding: 4px;
  background: #fff;
  border: 1px solid #c69a55;
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(8, 26, 40, 0.18);
}

.sale-customer-dropdown button {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 110px;
  gap: 2px 10px;
  width: 100%;
  padding: 8px 9px;
  text-align: left;
  color: #081a28;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #e5e9ec;
  border-radius: 0;
}

.sale-customer-dropdown button:hover {
  background: #f7f5ef;
}

.sale-customer-dropdown button span {
  text-align: right;
  color: #52636f;
}

.sale-customer-dropdown button small {
  grid-column: 1 / -1;
  overflow: hidden;
  color: #687985;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-dropdown-empty {
  display: block;
  padding: 10px;
  color: #687985;
}

.product-drawing-block {
  margin-top: 10px;
}

.product-drawing-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) auto minmax(250px, 1.2fr) auto;
  gap: 8px;
  align-items: end;
}

.product-drawing-controls label {
  min-width: 0;
}

.product-drawing-file input {
  min-height: 36px;
  padding: 5px;
}

.product-drawing-summary {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin: 8px 0 5px;
}

.product-drawing-summary span {
  color: #647581;
  font-size: 12px;
}

.product-attachment-list article {
  border-left: 3px solid #c69a55;
}

@media (max-width: 900px) {
  .product-drawing-controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .product-drawing-file {
    grid-column: 1 / 2;
  }

  .sale-customer-dropdown {
    width: min(360px, calc(100vw - 32px));
  }
}

.brand h1 {
  margin: 0;
  font-size: 17px;
}

.brand-english {
  display: block;
  margin-top: 2px;
  color: var(--brand-gold);
  font-family: Poppins, "Segoe UI", Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 0;
}

.brand p,
.sidebar-note span {
  margin: 4px 0 0;
  color: #b7c6d7;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 42px;
  text-align: left;
  color: #dbe7f5;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 12px;
}

.main {
  min-width: 0;
  padding: 16px;
}

.main-inner {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}

.topbar,
.top-actions,
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.topbar {
  margin-bottom: 18px;
}

.global-date-filter > summary {
  display: none;
}

.global-date-fields {
  display: grid;
  grid-template-columns: 132px 132px auto;
  gap: 6px;
  align-items: end;
}

.global-date-fields label {
  gap: 2px;
  font-size: 11px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

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

h2 {
  margin-bottom: 0;
  font-size: 26px;
}

h3 {
  margin-bottom: 5px;
  font-size: 17px;
}

h4 {
  margin: 18px 0 8px;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.sub-title {
  margin: 18px 0 8px;
  color: var(--ink);
  font-size: 15px;
}

.small-setting {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.small-setting input {
  width: 72px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  font-weight: 700;
}

.small-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.small-check input {
  width: 16px;
  height: 16px;
}

.sub-panel-head {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sub-form-block {
  margin-top: 14px;
  padding-top: 2px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segmented button {
  min-height: 36px;
  padding: 0 13px;
  color: var(--muted);
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  color: #fff;
  background: var(--blue);
}

.primary,
.ghost,
.link,
.icon-btn {
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 13px;
}

.primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.ghost,
.link,
.icon-btn {
  color: var(--ink);
  background: #fff;
}

.link {
  color: var(--blue);
  min-height: 30px;
  padding: 0 8px;
}

.icon-btn {
  width: 36px;
  padding: 0;
  font-size: 22px;
}

.view {
  display: none;
}

.view,
.panel {
  min-width: 0;
  max-width: 100%;
}

.view.active {
  display: grid;
  gap: 16px;
}

#masterData,
#masterData .panel {
  min-width: 0;
  max-width: 100%;
}

.entry-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 128px;
  padding: 22px;
  color: #fff;
  background: linear-gradient(135deg, #17476f 0%, #1b6d69 100%);
  border-radius: 8px;
}

.entry-hero h3 {
  margin-bottom: 0;
  font-size: 26px;
}

.entry-hero .eyebrow {
  color: #bfece9;
}

.entry-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 10px;
}

.entry-summary span {
  display: grid;
  min-width: 78px;
  min-height: 70px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #d7f0f3;
  font-size: 13px;
}

.entry-summary strong {
  color: #fff;
  font-size: 22px;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

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

.entry-group {
  display: grid;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.entry-group h3,
.form-title {
  margin: 0;
  font-size: 15px;
}

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

.entry-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  min-height: 54px;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.entry-card:hover {
  border-color: #97b5e9;
  box-shadow: 0 8px 22px rgba(35, 104, 216, 0.13);
}

.entry-card strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.entry-card small {
  display: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.entry-copy {
  min-width: 0;
}

.entry-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: #eaf2ff;
  color: var(--blue);
  font-style: normal;
  font-size: 14px;
  font-weight: 800;
}

.primary-entry {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.primary-entry small {
  color: #dbe7ff;
}

.primary-entry .entry-icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
}

.finance-cards {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 21px;
  line-height: 1.05;
}

.inventory-action-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  margin-top: 12px;
}

.inventory-value-grid {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  margin: 0 0 12px;
}

.metric-action {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.metric-action:hover,
.metric-action:focus-visible {
  border-color: var(--brand-gold);
  box-shadow: 0 4px 14px rgba(8, 26, 40, 0.09);
  transform: translateY(-1px);
}

.panel {
  padding: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 240px));
  gap: 8px;
  justify-content: start;
  margin-top: 10px;
}

.compact-form {
  grid-template-columns: repeat(auto-fit, minmax(170px, 220px));
  width: 100%;
}

.field-inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: stretch;
}

.field-inline-control .icon-btn {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 20px;
}

.modal-action-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 12px;
  max-width: 760px;
}

.modal-action-form .wide-field,
.modal-action-form .modal-form-actions,
.modal-action-form .form-error,
.modal-action-form .error-notice {
  grid-column: 1 / -1;
}

.modal-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.action-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.action-summary-grid article {
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.action-summary-grid span,
.action-summary-grid strong {
  display: block;
}

.action-summary-grid span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.error-notice {
  color: #9f2d20;
  border-color: #efb4ac;
  background: #fff6f4;
}

@media (max-width: 720px) {
  .modal-action-form,
  .action-summary-grid {
    grid-template-columns: 1fr;
  }
}

.module-tools {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.module-tools button,
.compact-admin-action {
  min-height: 32px;
  padding: 5px 10px;
}

.purchase-form-grid {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

.purchase-form-grid .line-items-field,
.purchase-form-grid .form-submit,
#bomForm .bom-material-editor {
  grid-column: 1 / -1;
}

.rebook-form-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  max-width: 1180px;
}

.rebook-note-field {
  grid-column: span 2;
}

.rebook-form-grid .form-submit {
  min-height: 34px;
}

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

.chart-panel {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.business-chart {
  min-height: 190px;
  padding-top: 8px;
}

.chart-legend {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 2px;
  background: var(--teal);
}

.chart-legend .legend-second::before { background: var(--amber); }

.chart-bars {
  display: grid;
  grid-template-columns: repeat(6, minmax(38px, 1fr));
  gap: 8px;
  height: 155px;
  margin-top: 8px;
  border-bottom: 1px solid var(--line);
}

.chart-bar-pair {
  display: grid;
  grid-template-rows: 1fr 20px;
  gap: 4px;
  min-width: 0;
}

.bar-columns {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
}

.bar-columns i {
  display: block;
  width: min(16px, 38%);
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--teal);
}

.bar-columns .bar-second { background: var(--amber); }
.chart-bar-pair > strong { overflow: hidden; color: var(--muted); font-size: 11px; text-align: center; white-space: nowrap; }

.horizontal-bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 130px) 1fr 90px;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  font-size: 12px;
}

.horizontal-bar-row > div { height: 10px; overflow: hidden; border-radius: 3px; background: var(--silver); }
.horizontal-bar-row i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.horizontal-bar-row strong { text-align: right; }

.bom-product-browser { border-left: 4px solid var(--teal); }
.bom-product-search-row { display: flex; gap: 8px; align-items: end; max-width: 620px; }
.bom-product-search-row label { flex: 1; }
.bom-finished-search-field { position: relative; }
.bom-finished-search-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(8, 26, 40, 0.18);
}
.bom-finished-search-results[hidden] { display: none; }
.bom-finished-search-result {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.bom-finished-search-result:last-child { border-bottom: 0; }
.bom-finished-search-result:hover,
.bom-finished-search-result.active { background: #eaf6f5; }
.bom-finished-search-result span { color: var(--muted); font-size: 12px; }
.bom-finished-search-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; }
.bom-selected-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 10px; padding: 9px 10px; background: var(--silver); border-radius: 6px; }
.bom-selected-summary span { color: var(--muted); font-size: 12px; }

.saved-order-confirmation { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; padding: 10px 12px; border-left: 4px solid var(--green); background: #edf8f3; }
.saved-order-confirmation span { color: var(--muted); }

.import-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.import-choice-grid section { border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.import-choice-grid p { color: var(--muted); font-size: 13px; line-height: 1.6; }

.sku-compact-form {
  grid-template-columns: minmax(190px, 1.5fr) repeat(4, minmax(94px, 0.72fr)) minmax(118px, 0.85fr);
  gap: 7px 9px;
  margin-top: 8px;
  align-items: end;
}

.sku-compact-form label {
  font-size: 12px;
}

.sku-compact-form input,
.sku-compact-form select {
  min-height: 33px;
  padding: 5px 8px;
}

.sku-compact-form .sku-parent-field {
  grid-column: span 1;
}

.sku-form-actions {
  display: flex;
  align-items: end;
  gap: 6px;
}

.sku-form-actions .form-submit {
  flex: 1;
  min-height: 33px;
  padding: 5px 10px;
}

.sku-list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.sku-list-tools input {
  width: 220px;
  min-height: 32px;
  padding: 5px 8px;
}

.sku-list-table {
  width: 100%;
  margin-top: 6px;
  max-height: 260px;
  overflow: auto;
}

.sku-list-table table {
  min-width: 820px;
}

.sku-list-table th,
.sku-list-table td {
  padding: 7px 8px;
  white-space: nowrap;
}

.sale-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-width: 1180px;
  margin: 12px auto 0;
  align-items: start;
}

.sale-form-section,
.sale-line-items {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(232, 238, 242, 0.58) 100%);
  border: 1px solid #d6dde4;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  padding: 10px;
}

.sale-compact-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sale-compact-grid > *,
.compact-money-grid > * {
  min-width: 0;
}

.sale-address-field {
  grid-column: span 2;
}

.sale-basic-section,
.sale-money-section {
  min-height: 0;
}

.sale-form-grid > .sale-line-items {
  grid-column: 1 / -1;
}

.source-field {
  align-self: start;
}

.order-total-grid {
  background: #f7f5ef;
  border: 1px solid #d6dde4;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  padding: 10px;
}

.compact-money-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
}

.compact-money-grid .form-submit {
  grid-column: 4;
}

#saleForm input,
#saleForm select,
#saleForm .line-total,
#saleForm .line-spec {
  min-height: 34px;
}

.order-total-grid label {
  color: #123a52;
  font-size: 14px;
  font-weight: 700;
}

.order-total-grid input {
  border-color: #cbd5e1;
  font-size: 15px;
  font-weight: 700;
}

.order-total-grid select {
  border-color: #cbd5e1;
  font-weight: 700;
}

#saleAmount,
#saleDebt {
  background: #e8eef2;
  color: #123a52;
  font-size: 18px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 34px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.mobile-more > summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  list-style: none;
}

.mobile-more > summary::-webkit-details-marker {
  display: none;
}

.mobile-quick-nav {
  display: none;
}

.mobile-ledger-cards {
  margin-top: 10px;
}

.mobile-ledger-list table {
  min-width: 680px;
}

.search {
  max-width: 280px;
}

.order-filter-bar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(140px, 0.8fr) auto;
  gap: 8px;
  align-items: end;
  width: min(760px, 100%);
}

.order-filter-bar label {
  gap: 3px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.order-filter-bar .search,
.order-filter-bar select {
  width: 100%;
  max-width: none;
}

.order-filter-bar button {
  min-height: 38px;
  white-space: nowrap;
}

.form-submit {
  align-self: end;
}

.sale-money-section .form-submit {
  min-height: 38px;
}

.receipt-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.receipt-account-select {
  width: 124px;
  min-height: 30px;
  border-color: #cbd5e1;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 14px;
}

.table-pager {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
}

.table-pager[hidden] {
  display: none;
}

.table-page-status {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.table-pager button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

th,
td {
  min-height: 42px;
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #f8fafc;
}

tfoot td {
  color: #0f3b66;
  background: #edf6ff;
  font-size: 14px;
  font-weight: 700;
}

.strong-money {
  color: #0f3b66;
  font-size: 15px;
  font-weight: 700;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 260px;
}

.pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}

.pill.ok {
  color: #106242;
  background: #eaf7f1;
  border-color: #b8e5d0;
}

.pill.warn {
  color: #7a4300;
  background: #fff4df;
  border-color: #efd39e;
}

.pill.info {
  color: #1b5fbf;
  background: #edf4ff;
  border-color: #bdd4ff;
}

.good {
  color: var(--green);
  font-weight: 700;
}

.bad {
  color: var(--red);
  font-weight: 700;
}

.todo-list {
  display: grid;
  margin-top: 10px;
}

.home-todo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 136px);
  justify-content: start;
  gap: 12px;
}

.home-todo-card {
  display: grid;
  width: 136px;
  min-height: 128px;
  justify-items: center;
  align-content: center;
  gap: 7px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 10px;
}

.home-todo-card:hover {
  border-color: #97b5e9;
  box-shadow: 0 8px 22px rgba(35, 104, 216, 0.12);
}

.home-todo-card strong {
  font-size: 26px;
  line-height: 1;
}

.home-todo-card span {
  font-weight: 700;
}

.home-todo-card small {
  color: var(--muted);
  font-size: 12px;
}

.home-todo-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  border-radius: 10px;
  font-style: normal;
  font-size: 18px;
  font-weight: 800;
}

.home-todo-icon.money {
  background: #0f766e;
}

.home-todo-icon.invoice {
  background: #2563eb;
}

.home-todo-icon.ship {
  background: #7c3aed;
}

.home-todo-icon.stock {
  background: #c2410c;
}

.todo-row {
  display: grid;
  grid-template-columns: 42px 110px 1fr 1.2fr 120px;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border-top: 1px solid var(--line);
}

.todo-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: var(--teal);
  border-radius: 8px;
  font-style: normal;
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.todo-icon.money {
  background: #0f766e;
}

.todo-icon.invoice {
  background: #2563eb;
}

.todo-icon.ship {
  background: #7c3aed;
}

.todo-icon.stock {
  background: #c2410c;
}

.todo-icon.default {
  background: #475569;
}

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

.chart {
  min-height: 220px;
  display: flex;
  align-items: end;
  gap: 8px;
  overflow-x: auto;
  margin-top: 14px;
  padding: 8px 4px 2px;
}

.bar-pair {
  min-width: 44px;
  display: grid;
  justify-items: center;
  gap: 7px;
}

.bars {
  height: 160px;
  display: flex;
  align-items: end;
  gap: 4px;
}

.bars i,
.bars b {
  display: block;
  width: 13px;
  border-radius: 4px 4px 0 0;
}

.bars i {
  background: var(--blue);
}

.bars b {
  background: var(--green);
}

.bar-pair span {
  color: var(--muted);
  font-size: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.finance-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.finance-form-grid .form-submit {
  grid-column: 1 / -1;
}

.connector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.connector-grid article {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.connector-grid strong,
.connector-grid span {
  display: block;
}

.connector-grid span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(12, 24, 38, 0.45);
  padding: 24px;
}

.bom-material-editor {
  grid-column: 1 / -1;
}

.bom-editor-head,
.bom-material-line {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(140px, 1fr) 40px;
  gap: 10px;
  align-items: end;
}

.bom-editor-head {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 10px;
}

.bom-material-lines {
  display: grid;
  gap: 8px;
}

.bom-remove {
  margin-bottom: 1px;
}

.bom-edit-form,
.bom-rule-edit-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bom-rule-edit-form .wide-field {
  grid-column: 1 / -1;
}

.bom-edit-actions {
  grid-column: 1 / -1;
  align-self: end;
  margin-top: 2px;
}

.report-dimension-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 260px));
  gap: 8px;
  align-items: end;
  margin: 10px 0;
}

.report-dimension-filters label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.executive-cards {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 10px;
}

.executive-cards .metric-card {
  position: relative;
  min-height: 76px;
  overflow: hidden;
  border-top: 3px solid var(--brand-gold);
}

.executive-cards .metric-card.good-card {
  border-top-color: var(--green);
}

.executive-cards .metric-card.warn-card {
  border-top-color: #d27d2d;
}

.executive-cards .metric-card.bad-card {
  border-top-color: var(--red);
}

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

.executive-wide-chart {
  grid-column: 1 / -1;
}

.category-matrix {
  display: grid;
  gap: 10px;
  min-height: 120px;
}

.category-matrix-row {
  display: grid;
  grid-template-columns: minmax(90px, 150px) minmax(240px, 1fr) minmax(90px, auto);
  gap: 10px;
  align-items: center;
}

.category-matrix-row > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-segments {
  display: flex;
  height: 22px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cfd9df;
  border-radius: 4px;
  background: #edf2f4;
}

.category-segments i {
  display: block;
  min-width: 3px;
  height: 100%;
}

.category-matrix-row small {
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.report-detail-head {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.executive-risk-table td {
  white-space: nowrap;
}

.risk-badge,
.data-state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 7px;
  border-radius: 12px;
  border: 1px solid #d7c3a2;
  color: #76531e;
  background: #fff8e8;
  font-size: 12px;
  font-weight: 700;
}

.risk-badge.high,
.data-state-badge.missing {
  border-color: #e7a2a2;
  color: #9f2f2f;
  background: #fff1f1;
}

.data-state-badge.ready {
  border-color: #a9d8cd;
  color: #0f695b;
  background: #edf9f5;
}

.dashboard-executive-panel {
  border-top: 3px solid var(--brand-gold);
}

.dashboard-executive-cards {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.dashboard-executive-charts .business-chart {
  min-height: 160px;
}

@media (max-width: 980px) {
  .executive-cards,
  .dashboard-executive-cards {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .report-dimension-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .executive-chart-grid,
  .report-dimension-filters {
    grid-template-columns: 1fr;
  }

  .executive-wide-chart {
    grid-column: auto;
  }

  .category-matrix-row {
    grid-template-columns: minmax(80px, 110px) minmax(150px, 1fr);
  }

  .category-matrix-row small {
    grid-column: 2;
    text-align: left;
  }
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(860px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  padding: 16px;
}

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

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

.detail-grid article {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong {
  display: block;
  margin-top: 6px;
  line-height: 1.45;
}

.order-detail-lines {
  margin-top: 12px;
}

.order-detail-lines table {
  min-width: 0;
  table-layout: fixed;
}

.order-detail-lines th,
.order-detail-lines td {
  padding: 8px;
  white-space: normal;
}

.order-detail-lines th:first-child,
.order-detail-lines td:first-child {
  width: 34%;
}

.order-detail-lines td strong,
.order-detail-lines td small {
  display: block;
}

.order-detail-lines td small {
  color: var(--muted);
  margin-top: 3px;
}

.mini-list {
  display: grid;
  gap: 6px;
}

.mini-list p {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  color: var(--muted);
}

.empty {
  color: var(--muted);
  padding: 14px 0;
}

.line-items-field {
  background: #f8fbff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-column: span 2;
  padding: 10px;
}

.sale-line-items {
  gap: 6px;
  padding: 8px;
}

.sale-line-items .line-items {
  gap: 5px;
}

.sale-line-items .product-line {
  gap: 5px;
  padding: 5px 7px;
  border-radius: 6px;
}

.sale-line-items .line-image,
.sale-line-items .line-spec,
.sale-line-items .line-total {
  min-height: 34px;
  height: 34px;
}

.sale-line-items .line-note-field textarea {
  min-height: 34px;
  height: 34px;
  padding: 6px 8px;
}

.field-title {
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 700;
}

.line-items {
  display: grid;
  gap: 8px;
}

.product-line {
  align-items: end;
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  overflow: visible;
  padding: 8px;
  position: relative;
}

.sale-line {
  grid-template-columns: 54px minmax(140px, 1fr) minmax(150px, 1.05fr) minmax(74px, 0.5fr) 62px 78px 84px minmax(210px, 1.5fr) 38px;
}

.sale-line-head {
  display: grid;
  grid-template-columns: 54px minmax(140px, 1fr) minmax(150px, 1.05fr) minmax(74px, 0.5fr) 62px 78px 84px minmax(210px, 1.5fr) 38px;
  gap: 8px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.line-image {
  display: grid;
  width: 54px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 10px;
}

.line-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.line-note-field {
  grid-column: auto;
}

.line-note-field textarea {
  line-height: 1.35;
  max-height: 110px;
  min-width: 0;
  min-height: 38px;
  overflow: auto;
  padding: 8px 10px;
  resize: vertical;
  width: 100%;
}

.line-resizable-field {
  min-width: 0;
}

.line-resize-box {
  box-sizing: border-box;
  display: block;
  height: 38px;
  max-width: 440px;
  min-width: 140px;
  overflow: hidden;
  resize: horizontal;
  width: 100%;
}

.line-resize-box input,
.line-resize-box select {
  height: 100%;
  width: 100%;
}

.line-resize-box:hover {
  outline: 1px dashed rgba(20, 67, 90, 0.35);
  outline-offset: 2px;
}

.fabric-option-field .line-sku-title {
  color: #8a4b08;
  font-weight: 700;
}

.fabric-option-field select {
  background: #fffaf0;
  border-color: #c69a55;
  box-shadow: 0 0 0 1px rgba(198, 154, 85, 0.14);
  font-weight: 700;
}

.fabric-option-picker {
  background: #fffdf8;
  border: 1px solid #d7bd8a;
  border-radius: 6px;
  padding: 8px;
}

.fabric-option-picker[hidden] {
  display: none;
}

.fabric-option-head strong,
.fabric-option-row > strong {
  color: var(--ink);
}

.fabric-option-head small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.fabric-option-rows {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}

.fabric-option-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 130px 1fr;
}

.fabric-option-grid {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(5, minmax(105px, 1fr));
}

.fabric-option {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  color: var(--ink);
  cursor: pointer;
  min-height: 40px;
  padding: 4px 8px;
  text-align: left;
}

.fabric-option strong,
.fabric-option small {
  display: block;
}

.fabric-option small {
  color: var(--muted);
  font-size: 10px;
  margin-top: 2px;
}

.fabric-option.selected {
  background: #eaf7f5;
  border-color: #008a8a;
  box-shadow: inset 0 0 0 1px #008a8a;
}

.manufacturing-option-picker {
  background: #f8fbfc;
  border: 1px solid #b8d8dc;
  border-radius: 6px;
  padding: 8px;
}

.manufacturing-option-picker[hidden] {
  display: none;
}

.manufacturing-option-head small,
.manufacturing-option-note {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.manufacturing-option-rows {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}

.manufacturing-option-row {
  align-items: start;
  background: #fff;
  border: 1px solid #d7e0e8;
  border-radius: 5px;
  display: grid;
  gap: 7px;
  grid-template-columns: 150px minmax(0, 1fr);
  padding: 7px;
}

.manufacturing-option-row-title strong,
.manufacturing-option-row-title small,
.manufacturing-option strong,
.manufacturing-option small {
  display: block;
}

.manufacturing-option-row-title small,
.manufacturing-option small {
  color: var(--muted);
  font-size: 10px;
}

.manufacturing-option-group {
  display: grid;
  gap: 4px;
}

.manufacturing-option-group > span {
  font-size: 12px;
  font-weight: 700;
}

.manufacturing-option-grid {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
}

.manufacturing-option {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  color: var(--ink);
  cursor: pointer;
  min-height: 38px;
  padding: 4px 7px;
  text-align: left;
}

.manufacturing-option.selected {
  background: #eaf7f5;
  border-color: #008a8a;
  box-shadow: inset 0 0 0 1px #008a8a;
}

.manufacturing-number-option {
  align-items: center;
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr 90px;
}

.manufacturing-number-option span small {
  color: var(--muted);
  display: block;
  font-size: 10px;
}

@media (max-width: 900px) {
  .fabric-option-row {
    grid-template-columns: 1fr;
  }

  .fabric-option-grid {
    grid-template-columns: repeat(2, minmax(115px, 1fr));
  }

  .manufacturing-option-row {
    grid-template-columns: 1fr;
  }
}

.sale-attachment-section {
  background: #f4faf9;
  border: 1px solid #b8d8dc;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  grid-column: 1 / -1;
  padding: 10px 12px;
}

.attachment-section-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.document-link-group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.document-link-group .ghost {
  align-items: center;
  display: inline-flex;
  font-size: 13px;
  min-height: 32px;
  text-decoration: none;
  white-space: nowrap;
}

.attachment-section-head small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.attachment-upload-row,
.attachment-toolbar {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 120px minmax(180px, 1fr) auto;
}

.sale-attachment-section .attachment-upload-row {
  grid-template-columns: 150px minmax(260px, 1fr);
}

.attachment-file-field input[type="file"]::file-selector-button {
  background: #123a52;
  border: 0;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  margin-right: 10px;
  padding: 7px 12px;
}

.attachment-upload-row > button,
.attachment-toolbar > button {
  min-width: 112px;
  white-space: nowrap;
}

.attachment-file-field input[type="file"],
.attachment-toolbar input[type="file"] {
  padding: 6px;
}

.attachment-draft-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
}

.attachment-draft-list span {
  background: #eef6f7;
  border: 1px solid #b8d8dc;
  border-radius: 5px;
  padding: 5px 8px;
}

.field-hint,
.readonly-note {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.attachment-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.attachment-list article {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 8px 0;
}

.attachment-list article span,
.attachment-list article small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.attachment-download {
  display: inline-flex;
  text-decoration: none;
}

.sales-contract {
  background: linear-gradient(180deg, #ffffff 0, #ffffff 160px, #f7f8f9 100%);
  border: 1px solid #d8dde3;
  color: #081a28;
  font-size: 14px;
  padding: 0 0 18px;
}

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

.contract-vi-header {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.75fr);
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 18px 22px;
  background: #081a28;
  color: #f8fafc;
  border-bottom: 4px solid #c69a55;
}

.contract-brand-block {
  display: flex;
  align-items: center;
}

.contract-brand-logo {
  display: block;
  width: 112px;
  height: auto;
  max-height: 136px;
  object-fit: contain;
}

.contract-brand-block strong,
.contract-brand-block small,
.contract-brand-block em,
.contract-title-block span,
.contract-title-block b {
  display: block;
}

.contract-brand-block strong {
  color: #f5d7a2;
  font-size: 22px;
  letter-spacing: 0;
  line-height: 1.2;
}

.contract-brand-block small {
  color: #c69a55;
  font-weight: 700;
  letter-spacing: 1px;
}

.contract-brand-block em {
  color: #dce3ea;
  font-style: normal;
  font-size: 12px;
}

.contract-title-block {
  text-align: right;
}

.contract-title-block span {
  color: #ffffff;
  font-size: 28px;
  font-weight: 800;
}

.contract-title-block b {
  color: #c69a55;
  font-size: 13px;
  margin-top: 6px;
}

.contract-vi-ribbon {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 22px;
  background: #f3f4f6;
  border-bottom: 1px solid #d8dde3;
  color: #5f6b76;
  font-size: 12px;
}

.contract-parties,
.sales-contract h4,
.sales-contract table,
.contract-summary,
.contract-terms,
.contract-company-info,
.contract-signatures {
  margin-left: 22px;
  margin-right: 22px;
}

.contract-parties {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #d8dde3;
  border-left: 4px solid #00afa5;
  background: #ffffff;
}

.sales-contract table {
  margin: 14px 22px;
  min-width: 0;
}

.sales-contract h4 {
  margin: 16px 22px 8px;
  color: #081a28;
  font-size: 15px;
}

.sales-contract h4::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 14px;
  margin-right: 7px;
  vertical-align: -2px;
  background: #c69a55;
}

.contract-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 10px 22px 14px;
}

.contract-summary p,
.contract-company-info p {
  margin: 0;
}

.contract-terms {
  margin: 10px 22px 14px;
  padding-left: 22px;
  line-height: 1.7;
}

.contract-special-note {
  background: #f7f2e8;
  border-left: 3px solid #c69a55;
  color: #081a28;
  line-height: 1.65;
  margin: 12px 22px;
  padding: 9px 12px;
}

.contract-company-info {
  display: grid;
  gap: 6px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d8dde3;
  border-top: 3px solid #c69a55;
  border-radius: 6px;
  background: #ffffff;
}

.contract-company-info h4 {
  grid-column: 1 / -1;
  margin: 0 0 4px;
}

.contract-signatures {
  border-top: 1px solid #d8dde3;
  margin-top: 24px;
  padding-top: 18px;
}

.workshop-product {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
}

.workshop-product img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.shipment-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.shipment-progress span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.shipment-progress strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 18px;
}

.shipment-form {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

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

.shipment-line-grid {
  display: grid;
  gap: 5px;
  margin: 8px 0 10px;
}

.shipment-line-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) repeat(3, minmax(76px, 0.6fr)) minmax(110px, 0.7fr);
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.shipment-line-row span,
.shipment-line-row strong,
.shipment-line-row small {
  display: block;
}

.shipment-line-row small {
  color: var(--muted);
}

.shipment-line-row input {
  min-width: 0;
  border-color: #d97706;
  font-weight: 700;
}

.shipment-remaining {
  color: #b45309;
  font-weight: 700;
}

.tracking-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 3px 0 0 6px;
  padding: 3px 8px;
  border: 1px solid #0f766e;
  border-radius: 4px;
  color: #0f766e;
  background: #f0fdfa;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.tracking-link:hover {
  background: #ccfbf1;
}

@media (max-width: 720px) {
  .shipment-progress {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shipment-line-row {
    grid-template-columns: 1fr 1fr;
  }

  .shipment-line-row > span:first-child,
  .shipment-line-row input {
    grid-column: 1 / -1;
  }
}

.production-item-list {
  display: grid;
  gap: 4px;
  min-width: 260px;
}

.production-item-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  padding: 5px 7px;
  border: 1px solid #dbe5ef;
  border-radius: 5px;
  background: #f8fafc;
}

.production-item-row > b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #143d53;
  color: #fff;
  font-size: 12px;
}

.production-item-row img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
}

.production-item-row span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
}

.production-item-row strong,
.production-item-row em {
  font-style: normal;
  line-height: 22px;
}

.production-item-row small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.line-spec {
  display: flex;
  min-height: 38px;
  align-items: center;
  overflow: hidden;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.current-user-control {
  min-width: 190px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}

.current-user-control select {
  min-height: 36px;
}

.purchase-line {
  grid-template-columns: minmax(150px, 0.8fr) minmax(170px, 1fr) minmax(190px, 1fr) 86px 108px 96px 44px;
}

.purchase-total-strip {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 6px 8px;
}

.purchase-total-strip span {
  color: var(--muted);
  font-size: 13px;
}

.purchase-total-strip strong {
  color: var(--ink);
  margin-left: 4px;
}

.purchase-total-strip .is-advance {
  color: #047857;
}

.warehouse-receiving-panel .table-wrap {
  max-height: 430px;
}

.warehouse-receiving-panel table {
  min-width: 1120px;
}

.purchase-receiving-item td {
  vertical-align: middle;
}

.purchase-receiving-item small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.purchase-receive-qty {
  min-width: 76px;
  width: 88px;
}

.purchase-pay-account {
  margin-right: 6px;
  min-height: 34px;
  min-width: 112px;
  width: auto;
}

.product-line label {
  margin: 0;
}

.product-line-picker {
  position: relative;
}

.product-line-dropdown {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(8, 26, 40, 0.18);
  left: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
}

.product-line-dropdown[hidden] {
  display: none;
}

.product-line-dropdown button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.product-line-dropdown button:hover,
.product-line-dropdown button:focus {
  background: var(--soft);
  outline: none;
}

.product-line-dropdown strong {
  font-size: 13px;
  font-weight: 700;
}

.product-line-dropdown small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.line-total {
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  font-weight: 700;
  min-height: 38px;
  padding: 0 10px;
}

.small-btn,
.icon-btn {
  min-height: 36px;
  padding: 0 12px;
}

.add-line-btn {
  justify-self: start;
}

.star-option-picker {
  margin-top: 5px;
  padding: 7px 8px;
  border: 1px solid #b8d6de;
  border-radius: 6px;
  background: #f6fbfc;
}

.star-option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.star-option-head input {
  width: min(280px, 55%);
  min-width: 0;
}

.star-lamp-choice,
.star-variant-choice {
  display: grid;
  grid-template-columns: auto minmax(110px, 160px) minmax(110px, 160px) 1fr;
  align-items: center;
  gap: 5px;
  margin: 4px 0;
  padding: 4px 6px;
  border: 1px solid #9db5c4;
  background: #f1f7f8;
}

.star-lamp-choice button,
.star-variant-choice button {
  min-height: 34px;
  border: 2px solid #7e98aa;
  background: #fff;
  color: #173d50;
  font-weight: 800;
}

.star-lamp-choice button.active,
.star-variant-choice button.active {
  border-color: #0b6f75;
  background: #9fd523;
  color: #102b35;
  box-shadow: inset 0 0 0 1px #6fa91d;
}

.star-lamp-choice button.active::before,
.star-variant-choice button.active::before {
  content: "已选 ";
}

.star-lamp-choice small,
.star-variant-choice small {
  color: #526b79;
}

.star-craft-choice #starCraftOtherNote {
  min-width: 150px;
}

.line-qty-field.star-area-required {
  color: #8d2e13;
  font-weight: 800;
}

.line-qty-field.star-option-qty-required {
  color: #8d2e13;
  font-weight: 800;
}

.star-area-required .line-qty {
  border: 2px solid #d24d2f;
  background: #fff8d9;
  color: #172f3d;
  font-size: 16px;
  font-weight: 800;
  appearance: textfield;
}

.star-option-qty-required .line-qty {
  border: 2px solid #d88921;
  background: #fff8d9;
  color: #172f3d;
  font-size: 16px;
  font-weight: 800;
  appearance: textfield;
}

.star-area-required .line-qty::-webkit-inner-spin-button,
.star-area-required .line-qty::-webkit-outer-spin-button,
.star-option-qty-required .line-qty::-webkit-inner-spin-button,
.star-option-qty-required .line-qty::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.star-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 5px;
}

.star-option {
  min-height: 38px;
  padding: 3px 6px;
  border: 1px solid #c8d8df;
  border-radius: 5px;
  background: #fff;
  color: #123a52;
  text-align: left;
}

.star-option:hover {
  border-color: #00a892;
  background: #eefaf8;
}

.star-option.selected {
  color: #0b2433;
  background: var(--lime);
  border-color: #7abf24;
  box-shadow: inset 0 0 0 1px #7abf24;
}

.star-option.selected::before {
  content: "已选";
  float: right;
  padding: 2px 5px;
  color: #ffffff;
  background: var(--blue);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.star-option strong,
.star-option small {
  display: block;
}

.star-option small {
  margin-top: 1px;
  color: #5d7180;
}

.field-label-row {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  min-width: 0;
}

.customer-advance-hint {
  color: #087a67;
}

#saleCustomerAdvanceHint,
#purchaseSupplierAdvanceHint {
  color: #087a67;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .rebook-form-grid {
    grid-template-columns: 1fr;
  }

  .rebook-note-field {
    grid-column: auto;
  }
}

.binary-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.binary-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  min-height: 38px;
  padding: 3px;
  gap: 3px;
  border: 1px solid #b9c9d8;
  background: #edf3f7;
}

.binary-choice-button {
  min-width: 0;
  border: 1px solid transparent;
  background: transparent;
  color: #304657;
  font-weight: 700;
}

.binary-choice-button.active {
  border-color: #0b6f75;
  background: #0b6f75;
  color: #fff;
  box-shadow: 0 1px 3px rgba(7, 50, 59, 0.22);
}

.binary-choice-button:focus-visible {
  outline: 2px solid #9fd523;
  outline-offset: 1px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: repeat(4, 1fr);
  }

  .metric-grid,
  .finance-cards,
  .connector-grid,
  .entry-grid,
  .entry-section-grid,
  .compact-entry-grid,
  .finance-form-grid,
  .two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .compact-form,
  .product-line,
  .order-total-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .sale-form-section,
  .sale-line-items {
    grid-column: 1 / -1;
  }

  .sale-compact-grid,
  .compact-money-grid {
    grid-template-columns: repeat(var(--mobile-nav-count, 4), minmax(0, 1fr));
  }

  .sku-compact-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sale-line-items {
    grid-column: 1 / -1;
  }

  .sale-line,
  .sale-line-head {
    grid-template-columns: 48px minmax(130px, 1fr) minmax(140px, 1fr) minmax(74px, 0.5fr) 62px 78px 84px minmax(180px, 1.3fr) 38px;
  }
}

@media (max-width: 720px) {
  .star-lamp-choice,
  .star-variant-choice {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .star-lamp-choice strong,
  .star-lamp-choice small,
  .star-variant-choice strong,
  .star-variant-choice small {
    grid-column: 1 / -1;
  }

  body {
    padding-bottom: 66px;
  }

  .business-chart-grid,
  .import-choice-grid {
    grid-template-columns: 1fr;
  }

  .bom-product-search-row {
    align-items: stretch;
    flex-direction: column;
  }

  .horizontal-bar-row {
    grid-template-columns: 80px 1fr 74px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    gap: 0;
    padding: 8px 12px;
  }

  .brand {
    padding: 0;
    border-bottom: 0;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand h1 {
    font-size: 15px;
  }

  .brand p,
  .brand-english,
  .nav-list,
  .sidebar-note {
    display: none;
  }

  .main {
    padding: 10px;
  }

  .topbar {
    margin-bottom: 8px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .topbar .eyebrow,
  .top-actions > button {
    display: none;
  }

  .global-date-filter > summary {
    display: block;
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
  }

  .global-date-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 6px;
  }

  .global-date-fields button {
    grid-column: 1 / -1;
  }

  .current-user-control {
    max-width: 220px;
  }

  .panel {
    padding: 9px;
  }

  .panel + .panel {
    margin-top: 8px;
  }

  .topbar,
  .top-actions,
  .panel-head,
  .entry-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .order-filter-bar {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .finance-cards,
  .connector-grid,
  .entry-grid,
  .entry-section-grid,
  .compact-entry-grid,
  .entry-summary,
  .finance-form-grid,
  .two-col,
  .form-grid,
  .compact-form,
  .sale-form-grid,
  .detail-grid,
  .order-total-grid:not(.compact-money-grid) {
    grid-template-columns: 1fr;
  }

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

  .sale-compact-grid label:nth-child(2),
  .sale-address-field,
  .compact-money-grid .form-submit {
    grid-column: 1 / -1;
  }

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

  .sku-list-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .sku-list-tools input {
    width: 100%;
  }

  .sale-line-head {
    display: none;
  }

  .line-items-field {
    grid-column: span 1;
  }

  .sale-address-field {
    grid-column: 1 / -1;
  }

  .product-line {
    grid-template-columns: 1fr;
  }

  .product-line.sale-line {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 7px;
  }

  .sale-line .line-image,
  .sale-line .line-spec {
    display: none;
  }

  .sale-line .line-search-field,
  .sale-line .line-note-field {
    grid-column: 1 / -1;
  }

  .line-resize-box {
    max-width: 100%;
    min-width: 0;
    resize: none;
  }

  .attachment-upload-row,
  .attachment-toolbar,
  .contract-parties,
  .contract-signatures {
    grid-template-columns: 1fr;
  }

  .sale-attachment-section .attachment-upload-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .attachment-section-head,
  .document-link-group {
    align-items: stretch;
    flex-direction: column;
  }

  .attachment-file-field,
  .attachment-file-field input[type="file"] {
    min-width: 0;
    max-width: 100%;
  }

  .attachment-list article {
    align-items: stretch;
    flex-direction: column;
  }

  .todo-row {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 9px 0;
  }

  .search {
    max-width: none;
  }

  .sale-form-grid {
    gap: 7px;
    margin-top: 8px;
  }

  .sale-form-section,
  .sale-line-items {
    border-left-width: 3px;
    padding: 8px;
  }

  .mobile-more > summary {
    display: flex;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
  }

  .mobile-more > summary::after {
    content: "+";
    font-size: 20px;
    font-weight: 400;
  }

  .mobile-more[open] > summary::after {
    content: "−";
  }

  .mobile-more > .field-title {
    margin-top: 8px;
  }

  .mobile-quick-nav {
    position: fixed;
    z-index: 90;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 60px;
    padding: 5px max(8px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: #ffffff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 18px rgba(17, 24, 39, 0.12);
  }

  .mobile-nav-item {
    display: grid;
    min-width: 0;
    min-height: 50px;
    place-items: center;
    gap: 1px;
    color: var(--muted);
    background: transparent;
    border: 0;
  }

  .mobile-nav-item span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: #ffffff;
    background: var(--blue);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
  }

  .mobile-nav-item small {
    font-size: 11px;
  }

  .mobile-nav-item.active {
    color: var(--blue);
    font-weight: 700;
  }

  .mobile-nav-item.active span {
    color: var(--ink);
    background: var(--lime);
  }

  body[data-mobile-workflow="sales"] .global-date-filter,
  body[data-mobile-workflow="sales"] #importOrdersButton,
  body[data-mobile-workflow="sales"] .sale-attachment-section,
  body[data-mobile-workflow="workshop"] .global-date-filter,
  body[data-mobile-workflow="workshop"] [data-workshop-print],
  body[data-mobile-workflow="workshop"] [data-workshop-drawing],
  body[data-mobile-workflow="workshop"] #manufacturingStockPanel {
    display: none !important;
  }

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

  .mobile-ledger-cards .metric-card {
    padding: 10px;
  }

  .table-pager {
    position: sticky;
    left: 0;
    justify-content: space-between;
  }

  .table-pager .small-btn {
    min-height: 32px;
    padding: 0 9px;
  }

  body[data-user-role="销售"] #orders > .panel:not(:first-child),
  body[data-user-role="销售"] #stockForm {
    display: none;
  }
}

@media (min-width: 721px) {
  .mobile-more > summary {
    display: none;
  }

  .mobile-more:not([open]) > :not(summary) {
    display: block;
  }
}

.production-status-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.report-period-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 10px;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.report-shortcuts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
}

.report-shortcuts > span {
  font-weight: 700;
}

.report-period-toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.report-period-toolbar input {
  min-width: 145px;
}

.report-period-toolbar > strong {
  margin-left: auto;
  padding-bottom: 8px;
  color: var(--blue);
}

.inventory-report-charts {
  margin-top: 12px;
}

.donut-layout {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 230px;
}

.donut-chart {
  position: relative;
  width: min(100%, 190px);
  aspect-ratio: 1;
  margin: auto;
  background: conic-gradient(var(--donut-segments));
  border-radius: 50%;
}

.donut-chart::after {
  position: absolute;
  inset: 24%;
  content: "";
  background: #ffffff;
  border-radius: 50%;
}

.donut-chart > span {
  position: absolute;
  z-index: 1;
  inset: 30%;
  display: grid;
  place-content: center;
  text-align: center;
}

.donut-chart strong,
.donut-chart small {
  display: block;
}

.donut-chart strong {
  font-size: 18px;
}

.donut-chart small {
  color: var(--muted);
  font-size: 11px;
}

.donut-legend {
  display: grid;
  gap: 7px;
}

.donut-legend > div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.donut-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.donut-legend span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-status-card {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.production-status-card i {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  color: #ffffff;
  background: var(--blue);
  border-radius: 6px;
  font-style: normal;
  font-weight: 700;
}

.production-status-card span,
.production-status-card strong,
.production-status-card small {
  display: block;
}

.production-status-card strong {
  color: var(--ink);
  font-size: 20px;
}

.production-status-card small {
  color: var(--muted);
}

.production-status-card.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.production-status-card.active i {
  color: var(--ink);
  background: var(--lime);
}

.manufacturing-stock-panel {
  margin: 12px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.manufacturing-stock-panel .panel-head {
  margin-bottom: 8px;
}

.manufacturing-record-table {
  max-height: 240px;
  margin-top: 10px;
}

.completion-upload-panel {
  display: grid;
  gap: 14px;
}

.completion-photo-picker {
  display: grid;
  gap: 7px;
  padding: 14px;
  background: #f7fbfc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.completion-photo-picker span {
  font-weight: 700;
}

.completion-photo-picker input {
  width: 100%;
}

.workshop-print-sheet {
  color: #111827;
  background: #ffffff;
}

.workshop-print-sheet header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 2px solid #111827;
}

.workshop-print-sheet header div,
.workshop-print-sheet header strong,
.workshop-print-sheet header span {
  display: block;
}

.workshop-print-sheet header strong {
  font-size: 22px;
}

.workshop-print-sheet header span {
  margin-top: 3px;
  font-size: 16px;
}

.workshop-print-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  padding: 14px 0;
}

.workshop-print-meta .wide {
  grid-column: 1 / -1;
}

.workshop-print-sheet table {
  width: 100%;
  border-collapse: collapse;
}

.workshop-print-sheet th,
.workshop-print-sheet td {
  padding: 9px;
  border: 1px solid #6b7280;
  text-align: left;
}

.workshop-print-sheet td small {
  display: block;
  color: #4b5563;
}

.workshop-print-sheet footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 32px;
}

.workshop-print-actions {
  margin-top: 16px;
}

.workshop-queue-number {
  display: inline-grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--brand-navy);
}

.workshop-payment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 30px;
  padding: 3px 8px;
  border: 1px solid;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 700;
}

.workshop-payment.full {
  color: #08705c;
  border-color: #7acdb9;
  background: #eaf9f4;
}

.workshop-payment.deposit {
  color: #9a5a00;
  border-color: #edbf6a;
  background: #fff7e6;
}

.workshop-payment.debt {
  color: #b42318;
  border-color: #ee9b96;
  background: #fff0ef;
}

.ledger-attachment-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px solid var(--brand-gold);
}

.ledger-attachment-head {
  margin-bottom: 8px;
}

.ledger-attachment-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.ledger-attachment-search label {
  display: grid;
  flex: 1 1 260px;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ledger-attachment-form {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7fafb;
}

.ledger-attachment-list {
  display: grid;
  gap: 8px;
}

.ledger-attachment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.ledger-attachment-card strong,
.ledger-attachment-card small {
  display: block;
}

.ledger-attachment-card p {
  margin: 4px 0;
}

@media (max-width: 720px) {
  .ledger-attachment-card {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .production-status-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .production-status-card {
    min-height: 56px;
    padding: 8px;
  }

  .production-status-card i {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .report-period-toolbar {
    align-items: stretch;
  }

  .report-period-toolbar .segmented,
  .report-period-toolbar label,
  .report-period-toolbar input {
    width: 100%;
  }

  .report-period-toolbar > strong {
    margin-left: 0;
    padding: 0;
  }

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

.supplier-material-picker {
  margin: 6px 0 12px;
  padding: 10px;
  border: 1px solid #cbd8e6;
  background: #f7fafc;
}

.network-lead-panel {
  grid-column: 1 / -1;
}

.supplier-material-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 6px;
  max-height: 210px;
  overflow: auto;
}

.supplier-material-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #d6e0ea;
  background: #fff;
}

.supplier-material-option input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.supplier-material-option span,
.supplier-material-option strong,
.supplier-material-option small {
  display: block;
  min-width: 0;
}

.supplier-material-option strong,
.supplier-material-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-assistant {
  bottom: 22px;
  position: fixed;
  right: 24px;
  z-index: 80;
}

.ai-toggle {
  background: #0f3e56;
  border: 1px solid #0a3144;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(15, 62, 86, 0.26);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 16px;
}

.ai-panel {
  background: #fff;
  border: 1px solid #b8cfdd;
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(15, 35, 55, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(620px, calc(100vh - 110px));
  overflow: hidden;
  padding: 12px;
  width: min(520px, calc(100vw - 32px));
}

.ai-panel header {
  align-items: flex-start;
  border-bottom: 1px solid #d9e4ec;
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
}

#aiDragHandle {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#aiDragHandle.dragging {
  cursor: grabbing;
}

.ai-panel header strong,
.ai-panel header span {
  display: block;
}

.ai-panel header span {
  color: #536779;
  font-size: 12px;
  margin-top: 2px;
}

.ai-quick {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-quick button {
  background: #eef6fb;
  border: 1px solid #c8dce8;
  border-radius: 6px;
  color: #12354c;
  cursor: pointer;
  font-weight: 700;
  min-height: 34px;
}

.ai-messages {
  background: #f8fbfd;
  border: 1px solid #d8e4ec;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
}

.ai-message {
  border-radius: 6px;
  line-height: 1.55;
  padding: 8px 10px;
}

.ai-message.user {
  align-self: flex-end;
  background: #0f3e56;
  color: #fff;
  max-width: 88%;
}

.ai-message.system {
  background: #fff;
  border: 1px solid #dce7ef;
  color: #102536;
}

.ai-message strong {
  display: block;
  margin-bottom: 4px;
}

.ai-message ul {
  margin: 0;
  padding-left: 18px;
}

.ai-message li + li {
  margin-top: 3px;
}

.ai-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.ai-form input {
  border: 1px solid #cbd8e6;
  border-radius: 6px;
  min-height: 36px;
  padding: 0 10px;
}

.counterparty-cash-card {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid #C69A55;
  border-radius: 12px;
  background: #fff;
  color: #081A28;
}

.counterparty-cash-head,
.counterparty-cash-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.counterparty-cash-head small {
  display: block;
  color: #60717d;
}

.counterparty-cash-metrics span {
  min-width: 150px;
}

.counterparty-cash-metrics strong {
  display: block;
}

.counterparty-cash-metrics .counterparty-final {
  padding: 8px 10px;
  border-radius: 8px;
  background: #DDF4F1;
  color: #081A28;
}

.allocation-section {
  border: 1px solid #d7e1ea;
  border-radius: 10px;
  background: #f8fbfd;
  padding: 10px;
}

.allocation-section-head,
.allocation-account-row,
.allocation-company-row,
.allocation-document-row,
.allocation-total-strip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.allocation-section-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.allocation-rows {
  display: grid;
  gap: 7px;
}

.allocation-account-row select,
.allocation-company-row select {
  flex: 1 1 220px;
}

.allocation-account-row input,
.allocation-company-row input,
.allocation-document-row input[type="number"] {
  flex: 0 1 150px;
}

.allocation-document-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) 120px 140px;
  border-bottom: 1px solid #e4ebf0;
  padding: 6px 0;
}

.allocation-document-row small {
  color: #60717d;
}

.allocation-total-strip {
  flex-wrap: wrap;
  border-radius: 8px;
  background: #eef7f6;
  padding: 8px 10px;
  color: #36515f;
}

.allocation-total-strip strong {
  color: #081A28;
}

.allocation-total-strip .allocation-difference-error {
  color: #b42318;
}

.allocation-delete {
  min-width: 40px;
}

@media (max-width: 760px) {
  .allocation-document-row {
    grid-template-columns: auto 1fr;
  }

  .allocation-document-row input[type="number"],
  .allocation-document-row small {
    grid-column: 2;
  }

  .counterparty-cash-metrics span {
    min-width: 100%;
  }

  .ai-assistant {
    bottom: 76px;
    right: 12px;
  }

  .ai-panel {
    width: calc(100vw - 24px);
  }

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

@page workshopLandscape {
  size: A4 landscape;
  margin: 8mm;
}

@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  body * {
    visibility: hidden !important;
  }

  #printableSalesContract,
  #printableSalesContract * {
    visibility: visible !important;
  }

  #printableSalesContract {
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
  }

  body.printing-workshop * {
    visibility: hidden !important;
  }

  body.printing-workshop {
    overflow: visible !important;
    background: #ffffff !important;
  }

  body.printing-workshop > *:not(#modalBackdrop) {
    display: none !important;
  }

  body.printing-workshop #modalBackdrop {
    display: block !important;
    position: static !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  body.printing-workshop #modalBackdrop > .modal {
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.printing-workshop #modalBackdrop > .modal > header,
  body.printing-workshop .workshop-print-actions {
    display: none !important;
  }

  body.printing-workshop #printableWorkshopOrder,
  body.printing-workshop #printableWorkshopOrder * {
    visibility: visible !important;
  }

  body.printing-workshop #printableWorkshopOrder {
    page: workshopLandscape;
    position: static;
    width: 100%;
  }

  body.printing-workshop .workshop-print-sheet {
    break-inside: auto;
    page-break-inside: auto;
    font-size: 10pt;
  }

  body.printing-workshop .workshop-print-sheet tr,
  body.printing-workshop .workshop-print-sheet footer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.printing-workshop .workshop-print-sheet thead {
    display: table-header-group;
  }

  body.printing-view * {
    visibility: visible !important;
  }

  body.printing-view .sidebar,
  body.printing-view .topbar,
  body.printing-view .mobile-quick-nav,
  body.printing-view .ai-assistant,
  body.printing-view .table-pager,
  body.printing-view button,
  body.printing-view input,
  body.printing-view select {
    display: none !important;
  }

  body.printing-view .app-shell,
  body.printing-view .main {
    display: block;
    width: 100%;
    padding: 0;
  }

  body.printing-view .view:not(.active) {
    display: none !important;
  }

  body.printing-view .table-wrap {
    max-height: none;
    overflow: visible;
  }

  body.printing-view table {
    min-width: 0 !important;
    font-size: 10px;
  }
}

/* Production notifications: keep the entry visible on the existing mobile topbar. */
.top-actions > #productionNotificationsButton:not([hidden]) { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
.production-notice-badge { background:#ac2828; color:#fff; border-radius:20px; min-width:20px; padding:2px 6px; font-size:12px; }
.production-notice-dialog { width:min(560px,calc(100vw - 24px)); max-height:85dvh; padding:20px; border:1px solid #cbd5e1; border-radius:14px; color:#081A28; background:#fff; box-sizing:border-box; }
.production-notice-dialog::backdrop { background:rgba(8,26,40,.5); }
.production-notice-dialog header,.production-notice-dialog footer { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.production-notice-dialog h3 { margin:4px 0; }
.production-notice-dialog p { font-size:14px; line-height:1.65; }
.production-notice-device { background:#f2f7fa; padding:12px; border:1px solid #d6e1e7; border-radius:10px; }
.production-notice-device .inline-actions { display:flex; gap:8px; flex-wrap:wrap; }
.production-notice-feedback { min-height:22px; color:#8b3e10; }
.production-notice-list { display:grid; gap:10px; margin:10px 0 18px; }
.production-notice-row { display:grid; text-align:left; gap:7px; width:100%; padding:14px; background:#fff; color:#081A28; border:1px solid #d6e1e7; border-radius:9px; overflow-wrap:anywhere; }
.production-notice-row.unread { border-left:4px solid #C69A55; background:#fffcf6; }
.production-notice-row small { font-size:12px; color:#526977; }
.production-notice-dialog button { min-height:40px; cursor:pointer; }
.production-notice-dialog [hidden] { display:none!important; }
@media(max-width:600px) { .production-notice-dialog { padding:16px; } .production-notice-dialog footer { flex-wrap:wrap; } }
