:root {
  --ink: #17202a;
  --muted: #637083;
  --line: #d7dde5;
  --page: #f5f7fa;
  --panel: #ffffff;
  --brand: #126c68;
  --brand-2: #0f8a7c;
  --warn: #b25b00;
  --danger: #b3261e;
  --ok: #1b7f42;
  --blue: #2466b8;
  --shadow: 0 10px 30px rgba(25, 38, 52, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover { border-color: var(--brand); }
.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.danger { color: var(--danger); border-color: #e4b7b3; }
.ghost { background: transparent; }
.small { padding: 5px 8px; font-size: 12px; }
.hidden { display: none !important; }

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

textarea { min-height: 80px; resize: vertical; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field-title {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(18,108,104,.14), transparent 45%),
    linear-gradient(300deg, rgba(36,102,184,.12), transparent 40%),
    var(--page);
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 28px;
}
.login-card h1 { margin: 0 0 8px; font-size: 26px; }
.login-card p { margin: 0 0 24px; color: var(--muted); }
.login-card form { display: grid; gap: 16px; }
.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.password-field button {
  height: 38px;
  min-width: 58px;
}
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.check-line {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  cursor: pointer;
}
.check-line input {
  width: auto;
  margin: 0;
}
.login-tip {
  margin-top: 18px;
  padding: 12px;
  background: #eef7f5;
  border: 1px solid #c8e7df;
  border-radius: 6px;
  font-size: 13px;
  color: #24534f;
}

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #142334;
  color: #fff;
  display: flex;
  flex-direction: column;
}
.brand {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand strong { display: block; font-size: 18px; }
.brand span { color: rgba(255,255,255,.65); font-size: 12px; }
.nav {
  padding: 12px;
  display: grid;
  gap: 6px;
}
.nav button {
  text-align: left;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.78);
  padding: 10px 12px;
}
.nav button.active, .nav button:hover {
  background: rgba(255,255,255,.11);
  color: #fff;
}
.sidebar-foot {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.12);
  display: grid;
  gap: 10px;
  color: rgba(255,255,255,.72);
  font-size: 13px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar h2 { margin: 0; font-size: 22px; }
.topbar .meta { color: var(--muted); font-size: 13px; }
.content { padding: 22px; overflow: auto; }

.grid {
  display: grid;
  gap: 14px;
}
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.panel h3 { margin: 0 0 12px; font-size: 17px; }
.stat {
  min-height: 96px;
  display: grid;
  align-content: center;
}
.stat b { font-size: 28px; }
.stat span { color: var(--muted); }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.toolbar .left, .toolbar .right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { max-width: 280px; }
.detail-meta {
  display: flex;
  gap: 10px 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--muted);
}
.quote-detail-panel {
  margin-top: 14px;
}
.doc-tabs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.doc-tabs-row .left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-tabs-row .tabs { margin-bottom: 0; }
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.document-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.document-home-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 16px;
  text-align: left;
  align-content: center;
  border-color: #cbd7e2;
  background: #f8fafc;
}
.document-home-card strong {
  font-size: 18px;
}
.document-home-card span {
  color: var(--muted);
  line-height: 1.5;
}

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; }
th { background: #eef2f6; font-size: 13px; color: #3a4654; white-space: nowrap; }
td.actions { white-space: nowrap; }
.hardware-template-panel {
  display: grid;
  gap: 16px;
}
.hardware-template-panel .section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.hardware-template-panel .section-title h3 {
  margin-bottom: 8px;
}
.hardware-template-panel .section-title .muted {
  line-height: 1.6;
}
.hardware-template-panel .section-title button {
  flex: 0 0 auto;
  margin-top: 2px;
}
.hardware-template-panel .table-wrap {
  margin-top: 2px;
}
.hardware-template-panel table {
  min-width: 1180px;
}
.commission-plan-table {
  min-width: 1800px;
}
.my-commission-table {
  min-width: 1180px;
}
.commission-plan-table th:first-child,
.commission-plan-table td:first-child {
  min-width: 260px;
}
.commission-address {
  white-space: normal;
  line-height: 1.45;
}
.commission-plan-table th:nth-child(5),
.commission-plan-table td:nth-child(5),
.commission-plan-table th:nth-child(10),
.commission-plan-table td:nth-child(10) {
  width: 88px;
  min-width: 88px;
}
.customer-help {
  margin: -4px 0 12px;
}
.customer-table {
  min-width: 1080px;
}
.customer-address-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.customer-address-pill {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344256;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-payment-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  line-height: 1.7;
}
.customer-payment-summary strong {
  color: var(--danger);
}
.customer-payment-summary .referral-commission {
  color: #7042a3;
  font-weight: 700;
}
.draft-scheme-list {
  display: grid;
  gap: 8px;
  min-width: 560px;
  margin-top: 10px;
}
.draft-scheme-details {
  min-width: 620px;
}
.draft-scheme-details > summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
  user-select: none;
}
.draft-scheme-item {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.draft-scheme-main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  line-height: 1.5;
}
.draft-scheme-main strong {
  color: var(--primary);
}
.draft-scheme-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.void-reason-editor {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 6px;
  width: 100%;
  min-width: 360px;
  margin-top: 8px;
}
.percent-input {
  display: grid;
  grid-template-columns: minmax(52px, 70px) auto;
  gap: 4px;
  align-items: center;
}
.commission-small-input {
  max-width: 82px;
}
.commission-deductions {
  display: grid;
  gap: 8px;
  min-width: 560px;
}
.commission-deduction-row {
  display: grid;
  grid-template-columns: minmax(110px, 140px) 86px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.commission-deduction-row input,
.commission-deduction-row select {
  min-width: 0;
}
.my-commission-role-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 240px;
}
.my-commission-role-picker label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.my-commission-role-picker input {
  width: auto;
  min-width: 0;
}
.material-stat-list,
.material-color-list {
  display: grid;
  gap: 10px;
}
.material-brand-group,
.material-color-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.material-brand-group > summary,
.material-color-group > summary {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  background: #f8fafc;
}
.material-color-group > summary {
  background: #fff;
}
.material-brand-group > summary span,
.material-color-group > summary span {
  color: var(--muted);
  font-size: 13px;
}
.material-color-list {
  padding: 10px;
  background: #fbfdff;
}
.material-color-group .table-wrap {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}
.brand-board-list {
  display: grid;
  gap: 14px;
}
.brand-board-group {
  display: grid;
  gap: 8px;
}
.brand-board-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.brand-board-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.brand-board-title::before {
  content: "▶";
  color: var(--muted);
}
.brand-board-title.open::before {
  content: "▼";
}
.brand-board-title strong {
  flex: 1;
}
.brand-board-title span {
  color: var(--muted);
  font-size: 13px;
}
.brand-board-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.muted { color: var(--muted); }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}
.badge.ok { color: var(--ok); background: #edf8f1; border-color: #b8e0c6; }
.badge.warn { color: var(--warn); background: #fff4e7; border-color: #f2d0a8; }
.badge.danger { color: var(--danger); background: #fff0ef; border-color: #e8bab6; }
.badge.source-direct { color: #17625b; background: #e8f6f3; border-color: #acd8d0; }
.badge.source-channel { color: #7a4d00; background: #fff4d6; border-color: #efd08a; }
.badge.source-referral { color: #7042a3; background: #f1e8ff; border-color: #d1b7f0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.quote-customer-grid {
  grid-template-columns: minmax(82px, .75fr) minmax(86px, .75fr) minmax(130px, 1.08fr) minmax(112px, .95fr) minmax(70px, .55fr) minmax(86px, .72fr) minmax(70px, .55fr) minmax(78px, .65fr);
  align-items: end;
}
.full { grid-column: 1 / -1; }
.permission-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.permission-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.permission-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.actions-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.section-heading-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-heading-actions h3 {
  margin: 0;
}

.hardware-manager {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
}
.catalog-block {
  display: grid;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.catalog-block:first-of-type { border-top: 0; padding-top: 0; }
.catalog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
}
.catalog-list {
  display: grid;
  gap: 8px;
}
.catalog-list button {
  text-align: left;
}
.catalog-list button.active {
  background: #e8f5f2;
  border-color: var(--brand);
  color: var(--brand);
}
.catalog-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hardware-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}
.link-button {
  width: auto;
  border: 0;
  padding: 0;
  color: var(--brand);
  background: transparent;
}
.drill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}
.drill-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.drill-open {
  min-height: 64px;
  text-align: left;
  font-size: 17px;
  font-weight: 700;
  border-color: #cbd7e2;
  background: #f8fafc;
}
.drill-actions {
  display: flex;
  gap: 8px;
}

.line-editor {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
#lineRows {
  overflow-x: auto;
  padding-bottom: 4px;
}
#cabinetExtraRows,
#extraRows {
  overflow-x: auto;
  padding-bottom: 4px;
}
#hardwareRows {
  overflow-x: auto;
  padding-bottom: 4px;
}
.quote-line {
  grid-template-columns:
    minmax(76px, 86px)
    minmax(88px, 104px)
    minmax(112px, 132px)
    minmax(230px, 260px)
    minmax(230px, 260px)
    minmax(230px, 260px)
    minmax(64px, 72px)
    minmax(64px, 72px)
    minmax(76px, 86px)
    minmax(76px, 86px)
    minmax(82px, 92px)
    minmax(198px, 214px);
  min-width: 1545px;
  align-items: end;
}
.quote-line label {
  min-width: 0;
}
.quote-line button {
  height: 36px;
}
.row-actions {
  display: flex;
  align-items: end;
  gap: 6px;
  min-width: 0;
}
.row-actions .small {
  height: 36px;
  padding: 0 9px;
  white-space: nowrap;
}
.line-row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(48px, 1fr));
  gap: 5px;
  align-self: end;
}
.line-row-actions .small {
  height: 30px;
  padding: 3px 6px;
  white-space: nowrap;
}
.line-row-actions .insert-production-board,
.line-row-actions .insert-production-hardware {
  color: var(--primary);
  border-color: #99f6e4;
  background: #f0fdfa;
}
.quote-total-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}
.quote-total-bar input[readonly] {
  font-weight: 700;
  color: var(--primary);
  background: #fff;
}
.quote-payment-bar {
  display: grid;
  grid-template-columns:
    minmax(130px, 1fr)
    minmax(110px, 1fr)
    minmax(110px, 1fr)
    minmax(130px, 1fr)
    minmax(140px, .8fr)
    minmax(135px, .8fr)
    minmax(180px, 1.3fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  align-items: end;
}
.quote-payment-bar input[readonly] {
  font-weight: 700;
  color: var(--primary);
  background: #fff;
}
.payment-meta-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 240px));
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.payment-add-row {
  display: grid;
  grid-template-columns: minmax(150px, 170px) minmax(130px, 150px) minmax(140px, 160px) minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}
.payment-locked-note {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}
.quote-work-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  gap: 14px;
  align-items: start;
}
.quote-work-layout > .panel {
  min-width: 0;
}
.quote-work-layout .quote-line {
  grid-template-columns:
    minmax(110px, 130px)
    minmax(110px, 130px)
    minmax(120px, 150px)
    minmax(74px, 84px)
    minmax(74px, 84px)
    minmax(92px, 104px)
    minmax(86px, 96px)
    minmax(90px, 100px)
    minmax(198px, 214px);
  min-width: 1085px;
}
.table-money-input {
  width: 110px;
  min-width: 100px;
}
.table-date-input {
  width: 140px;
  min-width: 130px;
}
.table-method-input {
  width: 120px;
  min-width: 110px;
}
.cabinet-extra-line,
.extra-line {
  grid-template-columns:
    minmax(110px, 120px)
    minmax(130px, 150px)
    minmax(180px, 220px)
    minmax(90px, 100px)
    minmax(80px, 90px)
    minmax(100px, 110px)
    minmax(100px, 110px)
    minmax(160px, 200px)
    minmax(198px, 214px);
  min-width: 1385px;
  align-items: end;
}
.work-extra-line {
  grid-template-columns:
    minmax(130px, 150px)
    minmax(180px, 240px)
    minmax(90px, 100px)
    minmax(80px, 90px)
    minmax(100px, 110px)
    minmax(100px, 110px)
    minmax(160px, 1fr)
    minmax(198px, 214px);
  min-width: 1185px;
}
.cabinet-extra-line label,
.extra-line label {
  min-width: 0;
}
.cabinet-extra-line button,
.extra-line button {
  height: 36px;
}
.hardware-line {
  grid-template-columns:
    minmax(130px, 150px)
    minmax(260px, 320px)
    minmax(90px, 100px)
    minmax(80px, 90px)
    minmax(100px, 110px)
    minmax(100px, 110px)
    minmax(160px, 200px)
    minmax(64px, 70px);
  min-width: 1260px;
  align-items: end;
}
.hardware-line label {
  min-width: 0;
}
.hardware-line button {
  height: 36px;
}
.production-board-line {
  grid-template-columns:
    minmax(110px, 140px)
    minmax(180px, 1fr)
    minmax(100px, 120px)
    minmax(80px, 95px)
    minmax(120px, 145px)
    minmax(70px, 84px)
    minmax(88px, 104px)
    minmax(140px, 180px)
    minmax(238px, 260px);
  min-width: 1210px;
  align-items: end;
}
.production-board-line label {
  min-width: 0;
}
.production-board-line button {
  height: 36px;
}
.production-board-line .line-row-actions {
  grid-template-columns: repeat(4, minmax(48px, 1fr));
  gap: 6px;
}
.production-board-line .line-row-actions .small {
  height: 36px;
  padding: 0 8px;
}
.production-hardware-line {
  grid-template-columns:
    minmax(260px, 320px)
    minmax(90px, 110px)
    minmax(80px, 90px)
    minmax(180px, 240px)
    minmax(150px, 180px);
  min-width: 820px;
  align-items: end;
}
.production-hardware-line label {
  min-width: 0;
}
.production-hardware-line button {
  height: 30px;
  padding: 3px 6px;
}
.production-hardware-line.hardware-size-enabled {
  grid-template-columns:
    minmax(260px, 320px)
    minmax(90px, 110px)
    minmax(80px, 90px)
    minmax(440px, 560px)
    minmax(160px, 220px)
    minmax(150px, 180px);
  min-width: 1330px;
}
.hardware-size-box {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: start;
  gap: 6px;
  align-self: end;
  max-width: 560px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow-x: auto;
}
.hardware-size-title {
  font-size: 12px;
  color: var(--muted);
  line-height: 30px;
  white-space: nowrap;
}
.hardware-size-rows {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.hardware-size-row {
  display: grid;
  grid-template-columns: 118px 70px 38px;
  gap: 6px;
  align-items: end;
  flex: 0 0 auto;
}
.hardware-size-row label {
  display: grid;
  gap: 3px;
  font-size: 12px;
}
.hardware-size-box .add-hardware-size-row,
.hardware-size-row .remove-hardware-size-row {
  height: 30px;
}
.hardware-size-box .add-hardware-size-row {
  min-width: 72px;
}
.hardware-size-row .remove-hardware-size-row {
  width: 38px;
  min-width: 38px;
  padding: 3px 4px;
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.formula-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  padding-left: 2px;
}
.production-hardware-sections {
  display: grid;
  gap: 12px;
}
.production-hardware-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}
.production-hardware-section .section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}
.production-hardware-section .section-title::-webkit-details-marker {
  display: none;
}
.production-hardware-section .section-title::before {
  content: "▶";
  color: var(--muted);
  font-size: 12px;
}
.production-hardware-section[open] .section-title::before {
  content: "▼";
}
.section-title-main {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}
.section-title-main em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.production-hardware-category-rows {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding: 0 10px 10px;
}
.template-row-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.template-row-actions .small {
  padding: 3px 6px;
}
.calc-board-rows {
  display: grid;
  gap: 12px;
}
.calc-board-line {
  grid-template-columns: minmax(0, 1fr) minmax(76px, 86px) 52px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  align-items: end;
}
.calc-board-line label:first-child {
  grid-column: auto;
}
.calc-board-line button {
  width: 52px;
  height: 36px;
  padding: 5px 8px;
}
.work-calc-panel {
  position: sticky;
  top: 14px;
}
.calc-result {
  background: #f1f7f6;
  border: 1px solid #c7e2dd;
  padding: 12px;
  border-radius: 6px;
  display: grid;
  gap: 6px;
}
.print-area {
  background: #fff;
}
.signature {
  height: 76px;
  border-bottom: 1px solid var(--ink);
  margin-top: 18px;
}
.quote-print-sheet {
  display: none;
}
.quote-print-sheet.active {
  display: block;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.production-print-sheet {
  display: none;
  margin-top: 18px;
}
.production-print-sheet.active {
  display: block;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.delivery-remark-box {
  min-height: 72px;
  margin-top: 14px;
  border: 1px solid #333;
  padding: 10px;
  font-size: 12px;
  line-height: 1.6;
}
.delivery-notice {
  margin-top: 12px;
  color: #000;
  font-weight: 700;
  font-size: 14px;
}
.print-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 28px;
}
.print-meta {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.8fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 12px;
}
.delivery-print-meta {
  grid-template-columns: 2fr 1fr 1fr;
}
.print-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 10px;
  table-layout: fixed;
}
.print-table th,
.print-table td {
  border: 1px solid #333;
  padding: 4px 5px;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}
.print-table td:nth-child(2) {
  text-align: center;
  line-height: 1.55;
}
.print-table th:nth-child(1), .print-table td:nth-child(1) { width: 13%; }
.print-table th:nth-child(2), .print-table td:nth-child(2) { width: 27%; }
.print-table th:nth-child(3), .print-table td:nth-child(3),
.print-table th:nth-child(4), .print-table td:nth-child(4) { width: 8%; }
.print-table th:nth-child(5), .print-table td:nth-child(5) { width: 8%; }
.print-table th:nth-child(6), .print-table td:nth-child(6) { width: 7%; }
.print-table th:nth-child(7), .print-table td:nth-child(7) { width: 8%; }
.print-table th:nth-child(8), .print-table td:nth-child(8) { width: 9%; }
.print-table th:nth-child(9), .print-table td:nth-child(9) { width: 12%; }
.print-table th {
  background: #f1f1f1;
}
.quote-summary-table.has-print-remarks th:nth-child(1),
.quote-summary-table.has-print-remarks td:nth-child(1) { width: 13%; }
.quote-summary-table.has-print-remarks th:nth-child(2),
.quote-summary-table.has-print-remarks td:nth-child(2) { width: 24%; }
.quote-summary-table.has-print-remarks th:nth-child(3),
.quote-summary-table.has-print-remarks td:nth-child(3) { width: 8%; }
.print-remark-head,
.print-remark-col {
  background: #fff;
}
.print-remark-col {
  font-size: 9px;
  line-height: 1.35;
  color: #000;
  text-align: center;
  word-break: break-word;
}
.delivery-print-table th:nth-child(1), .delivery-print-table td:nth-child(1) { width: 24%; }
.delivery-print-table th:nth-child(2), .delivery-print-table td:nth-child(2) { width: 12%; }
.delivery-print-table th:nth-child(3), .delivery-print-table td:nth-child(3) { width: 18%; }
.delivery-print-table th:nth-child(4), .delivery-print-table td:nth-child(4) { width: 18%; }
.delivery-print-table th:nth-child(5), .delivery-print-table td:nth-child(5),
.delivery-print-table th:nth-child(6), .delivery-print-table td:nth-child(6) { width: 14%; }
.handoff-board-table th:nth-child(1), .handoff-board-table td:nth-child(1) { width: 16%; }
.handoff-board-table th:nth-child(2), .handoff-board-table td:nth-child(2) { width: 42%; }
.handoff-board-table th:nth-child(3), .handoff-board-table td:nth-child(3),
.handoff-board-table th:nth-child(4), .handoff-board-table td:nth-child(4) { width: 12%; }
.handoff-board-table th:nth-child(5), .handoff-board-table td:nth-child(5) { width: 18%; }
.handoff-hardware-table th:nth-child(1), .handoff-hardware-table td:nth-child(1) { width: 44%; }
.handoff-hardware-table th:nth-child(2), .handoff-hardware-table td:nth-child(2) { width: 14%; }
.handoff-hardware-table th:nth-child(3), .handoff-hardware-table td:nth-child(3) { width: 14%; }
.handoff-hardware-table th:nth-child(4), .handoff-hardware-table td:nth-child(4) { width: 28%; }
.print-merge-cell {
  font-size: 13px;
  font-weight: 700;
  vertical-align: middle !important;
}
.print-total {
  margin-top: 12px;
  text-align: right;
  font-size: 16px;
  font-weight: 700;
}
.print-disclaimer {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.7;
}
.print-disclaimer p {
  margin: 6px 0 0;
}
.print-sign-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  margin-top: 34px;
  font-size: 14px;
}
.quote-footer-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  table-layout: fixed;
  color: #000;
  font-size: 12px;
  page-break-inside: avoid;
}
.budget-print-notice {
  margin-top: 14px;
  padding: 14px 18px;
  border: 2px solid #111;
  color: #000;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  line-height: 1.8;
  page-break-inside: avoid;
}
.quote-footer-table td {
  border: 1px solid #222;
  padding: 4px 6px;
  vertical-align: middle;
}
.quote-footer-table p {
  margin: 0 0 2px;
  line-height: 1.35;
}
.quote-footer-table p:last-child {
  margin-bottom: 0;
}
.footer-amount {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}
.footer-area {
  font-size: 13px;
  font-weight: 700;
  text-align: center !important;
  padding: 6px 10px !important;
}
.footer-cash {
  width: 18%;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  padding: 0 !important;
}
.footer-cash > div {
  padding: 3px 5px;
}
.print-original-price {
  text-decoration: line-through;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #222;
}
.print-discount-price {
  font-weight: 700;
}

.customer-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
}

.customer-edit-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.customer-edit-panel .toolbar {
  margin-bottom: 12px;
}

.customer-edit-panel .form-grid {
  grid-template-columns: 1.2fr .8fr 1fr;
  align-items: end;
}

.customer-payment-form {
  margin-top: 12px;
  align-items: end;
}

.quote-history-delete {
  align-self: end;
  height: 36px;
}
.history-suggest-menu {
  position: absolute;
  z-index: 1000;
  max-height: 360px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, .16);
}
.history-suggest-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 4px;
}
.history-suggest-text {
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-suggest-text:hover {
  background: #f1f5f9;
}
.customer-suggest-menu .history-suggest-text {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.customer-suggest-menu .history-suggest-text span {
  color: var(--muted);
  font-size: 12px;
}
.board-suggest-menu {
  max-height: 320px;
}
.board-suggest-menu .history-suggest-text {
  display: block;
  width: 100%;
  text-align: left;
  line-height: 1.45;
}
.history-suggest-remove {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  color: #111827 !important;
  background: transparent !important;
  font-size: 11px !important;
  line-height: 18px !important;
  font-weight: 600 !important;
  opacity: 0 !important;
  transition: opacity .12s ease, background .12s ease;
}
.history-suggest-item:hover .history-suggest-remove {
  opacity: 1 !important;
}
.history-suggest-remove:hover {
  background: #eef2f6 !important;
  border: 0 !important;
}
.history-suggest-empty {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
}
.autosave-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
}
.autosave-notice.muted {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: var(--muted);
}
.autosave-notice button {
  flex: 0 0 auto;
}
.print-settings {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 4px;
}
.print-settings label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.print-settings select {
  width: 120px;
  height: 34px;
}
.drill-actions,
.brand-board-actions,
td.actions {
  gap: 4px;
}
.footer-payment-methods {
  white-space: normal;
}
.footer-payment-methods span {
  display: inline-block;
  margin: 0 18px 0 0;
}
.print-payment-summary-row td,
.print-payment-method-row td {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  line-height: 1.5;
}
.footer-side-title {
  width: 70px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}
.footer-tips {
  font-size: 12px;
}
.footer-delivery-options {
  width: 140px;
  line-height: 1.45;
}
.footer-signatures td {
  height: 42px;
  font-size: 13px;
  font-weight: 700;
  vertical-align: top;
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hardware-manager, .drill-grid, .cols-2, .cols-3, .cols-4, .form-grid, .permission-list, .quote-work-layout { grid-template-columns: 1fr; }
  .calc-board-line { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }
  body { background: #fff; }
  .sidebar, .topbar, .toolbar, .tabs, .doc-tabs-row, .print-area > h3, .no-print, .actions-row, .autosave-notice, .print-settings { display: none !important; }
  .shell, .main { display: block; }
  .content { padding: 0; }
  .panel { border: 0; box-shadow: none; padding: 0; }
  table { min-width: 0; }
  #quoteForm, #productionForm { display: none !important; }
  .quote-print-sheet {
    display: block;
    color: #000;
  }
  .production-print-sheet.active {
    display: block;
    color: #000;
    border-top: 0;
    padding-top: 0;
  }
  .quote-print-sheet h4 {
    margin: 0 0 8px;
    font-size: 13px;
  }
  .print-title {
    font-size: 22px;
    margin: 0 0 26px;
  }
  .print-meta {
    margin-bottom: 14px;
  }
  .print-total {
    margin-top: 8px;
    font-size: 14px;
  }
  .quote-footer-table {
    font-size: 11px;
  }
  .quote-footer-table td {
    padding: 3px 5px;
  }
  .footer-amount,
  .footer-cash {
    font-size: 13px;
  }
  .print-area {
    width: 100%;
  }
}
