:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --surface: #f6f8fb;
  --surface-strong: #eef4ff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe4f0;
  --good: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow: 0 22px 54px rgba(15, 23, 42, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(37, 99, 235, 0.13), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--surface) 42%, #edf4ff 100%);
}

body.authLoading .appShell,
body.authLoading .authPortal,
body.loggedOut .appShell,
body.loggedIn .authPortal,
body.passwordChange .appShell,
body.passwordChange #loginPortal,
body.loggedOut #passwordPortal {
  display: none;
}

body.loggedOut #loginPortal,
body.passwordChange #passwordPortal {
  display: grid;
}

body.loggedIn .appShell {
  display: block;
}

.authPortal {
  min-height: 100vh;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 48px 28px;
  background:
    linear-gradient(90deg, rgba(0, 78, 159, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0, 78, 159, 0.05) 1px, transparent 1px),
    radial-gradient(85% 70% at 15% 12%, rgba(0, 102, 204, 0.18), transparent 64%),
    radial-gradient(80% 70% at 90% 88%, rgba(13, 148, 136, 0.12), transparent 66%),
    linear-gradient(135deg, #ffffff 0%, #f7fbff 46%, #edf6ff 100%);
  background-size: 46px 46px, 46px 46px, auto, auto, auto;
}

.authPortal::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.34) 42%, rgba(255, 255, 255, 0.78) 100%),
    linear-gradient(135deg, rgba(0, 78, 159, 0.08), rgba(14, 165, 233, 0.04) 52%, rgba(13, 148, 136, 0.05));
}

.authScene {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.56fr) minmax(390px, 0.44fr);
  align-items: stretch;
  gap: 22px;
  width: min(1080px, 100%);
  min-height: min(610px, calc(100vh - 96px));
}

.authSceneCompact {
  min-height: min(560px, calc(100vh - 96px));
}

.authBrandPanel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: clamp(34px, 4vw, 52px);
}

.authBrandLogo {
  width: min(184px, 52vw);
  height: auto;
  object-fit: contain;
}

.authKicker {
  margin: 34px 0 14px;
  color: #004e9f;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.authBrandPanel h1 {
  max-width: 620px;
  margin: 0;
  color: #0b1220;
  font-size: clamp(31px, 3.2vw, 46px);
  line-height: 1.12;
  font-weight: 950;
}

.authBrandPanel h1 span {
  display: inline-block;
  background: linear-gradient(135deg, #004e9f 0%, #0066cc 56%, #0d9488 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.authLead {
  max-width: 580px;
  margin: 18px 0 0;
  color: #414753;
  font-size: clamp(14px, 1.05vw, 15.5px);
  line-height: 1.68;
  font-weight: 650;
}

.authProofGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 600px;
  margin-top: 28px;
}

.authProofGrid div {
  min-height: auto;
  border-left: 2px solid rgba(0, 78, 159, 0.28);
  padding: 2px 0 2px 12px;
}

.authProofGrid strong,
.authProofGrid span {
  display: block;
}

.authProofGrid strong {
  color: #004e9f;
  font-size: 17px;
  font-weight: 950;
}

.authProofGrid span {
  margin-top: 7px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 750;
}

.authTrustLine {
  align-self: flex-start;
  margin-top: 24px;
  border-left: 3px solid #0066cc;
  color: #003462;
  padding: 2px 0 2px 12px;
  font-size: 13px;
  font-weight: 900;
}

.loginCard {
  display: grid;
  align-self: center;
  width: 100%;
  position: relative;
  overflow: hidden;
  gap: 15px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 32px 90px rgba(0, 78, 159, 0.18);
  backdrop-filter: blur(18px);
  padding: clamp(30px, 3.4vw, 44px);
}

.loginCard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, #004e9f 0%, #0066cc 58%, #0d9488 100%);
}

.loginHead {
  margin-bottom: 10px;
}

.loginHead h2 {
  margin: 2px 0 8px;
  color: #0b1220;
  font-size: 30px;
  line-height: 1.18;
  font-weight: 950;
}

.loginHead p:not(.eyebrow) {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.65;
  font-weight: 650;
}

.loginCard label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 850;
}

.loginCard input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 14px;
  background: #fff;
  color: #0b1220;
  padding: 13px 14px;
  outline: none;
}

.loginCard input:focus {
  border-color: #0066cc;
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.12);
}

.authSubmit {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, #004e9f 0%, #0066cc 100%);
  box-shadow: 0 18px 36px rgba(0, 78, 159, 0.24);
  font-size: 16px;
}

.authSubmit:hover {
  background: linear-gradient(135deg, #003f82 0%, #0059b1 100%);
}

.authSecondary {
  width: 100%;
  min-height: 46px;
  border-radius: 999px;
}

.loginError {
  min-height: 20px;
  margin: 0;
  color: var(--bad);
  font-size: 13px;
  font-weight: 800;
}

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

button {
  cursor: pointer;
}

.appShell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.heroPanel,
.panel,
.tabs {
  border: 1px solid rgba(219, 228, 240, 0.9);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: 28px;
  padding: 18px 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brandLogo {
  width: 150px;
  height: 38px;
  object-fit: contain;
}

.brand h1,
.heroPanel h2,
.panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow.blue {
  color: var(--primary);
}

.topActions,
.panelHead,
.tabs,
.switchRow,
.legend,
.formActions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topActions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.userBadge {
  border-radius: 999px;
  background: #eef4ff;
  color: #1d4ed8;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
}

.saveState {
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}

.primaryBtn,
.ghostBtn,
.textBtn {
  border: 0;
  border-radius: 13px;
  font-weight: 850;
}

.primaryBtn {
  background: var(--primary);
  color: #fff;
  padding: 11px 16px;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.primaryBtn:hover {
  background: var(--primary-dark);
}

.ghostBtn {
  border: 1px solid var(--line);
  background: #fff;
  color: #1e293b;
  padding: 10px 14px;
}

.textBtn {
  background: transparent;
  color: var(--primary);
  padding: 8px;
}

.heroPanel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 28px;
  margin-top: 18px;
  border-radius: 32px;
  padding: 32px;
  overflow: hidden;
}

.heroPanel h2 {
  max-width: 780px;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.heroPanel p {
  max-width: 820px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

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

.heroMetrics div,
.summaryGrid div,
.customerCard {
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 20px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  padding: 18px;
}

.heroMetrics strong,
.summaryGrid strong {
  display: block;
  margin-top: 4px;
  color: var(--primary);
  font-size: 28px;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.heroMetrics span,
.summaryGrid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tabs {
  position: sticky;
  top: 12px;
  z-index: 20;
  justify-content: center;
  margin: 18px 0;
  border-radius: 18px;
  padding: 8px;
}

.tabs button {
  min-width: 130px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  padding: 11px 18px;
  font-weight: 900;
}

.tabs button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#quoteView.active {
  display: grid;
  gap: 18px;
}

.quoteLayout {
  display: contents;
}

.inputPanel {
  order: 1;
}

.detailPanel {
  order: 2;
}

.resultPanel {
  order: 3;
}

.panel {
  border-radius: 28px;
  padding: 24px;
}

.panelHead {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel h3 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

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

label span,
.fieldLabel {
  display: block;
  margin-bottom: 7px;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 12px 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.7);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.multiSelect {
  position: relative;
}

.multiSelectBtn {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
  text-align: left;
}

.multiSelectBtn span {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiSelectBtn b {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 12px;
}

.multiSelect.disabled .multiSelectBtn {
  cursor: not-allowed;
  background: #f1f5f9;
  color: #94a3b8;
}

.choiceGrid {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  display: none;
  width: min(520px, 100%);
  max-height: 310px;
  overflow: auto;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
  padding: 10px;
}

.multiSelect.open .choiceGrid {
  display: grid;
}

.choiceItem {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 9px 10px;
  min-height: 50px;
}

.choiceItem:hover {
  background: #f8fbff;
}

.choiceItem input {
  width: auto;
}

.choiceItem span {
  flex: 1 1 auto;
  margin: 0;
  color: #1e293b;
  font-size: 13px;
  font-weight: 800;
}

.algorithmUserInput {
  flex: 0 0 118px;
  max-width: 118px;
  margin-left: auto;
  padding: 8px 10px;
  text-align: right;
}

.switchRow {
  flex-wrap: wrap;
  margin-top: 18px;
}

.checkItem {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
}

.checkItem input {
  width: auto;
}

.checkItem span {
  margin: 0;
}

.field-disabled {
  opacity: 0.45;
}

.field-disabled input,
.field-disabled select {
  cursor: not-allowed;
  background: #f1f5f9;
  color: #94a3b8;
}

.visuallyHidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.requirementPanel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.requirementGroup {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbff;
  padding: 18px;
}

.requirementGroup h4 {
  margin: 0 0 14px;
  font-size: 17px;
}

.requirementSection {
  display: grid;
  gap: 10px;
}

.requirementSection + .requirementSection {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.requirementTitle {
  color: #334155;
  font-size: 13px;
  font-weight: 950;
}

.radioGrid,
.radioLine {
  display: grid;
  gap: 10px;
}

.radioLine {
  grid-template-columns: 1fr;
  align-items: start;
}

.radioGrid label,
.radioLine label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1e293b;
  font-size: 13px;
  line-height: 1.5;
}

.radioGrid label.option-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.radioGrid input,
.radioLine input {
  flex: 0 0 auto;
  width: auto;
}

.radioGrid span,
.radioLine span {
  margin: 0;
}

.deploymentPointsSection {
  max-width: 320px;
  margin-top: 2px;
}

.deploymentPointsSection label {
  display: block;
}

.opsModeDetail {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
}

.opsModeDetail label,
.opsModeDetail div {
  display: grid;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.opsModeDetail label {
  grid-template-columns: auto 96px;
}

.opsModeDetail div {
  grid-template-columns: auto auto;
}

.opsModeDetail span,
.opsModeDetail strong {
  margin: 0;
  font-size: 13px;
}

.opsModeDetail span {
  color: var(--muted);
  font-weight: 850;
}

.opsModeDetail strong {
  color: var(--primary);
  font-weight: 950;
  white-space: nowrap;
}

.opsModeDetail input {
  min-width: 0;
  padding: 9px 10px;
}

.opsMonthlyDetail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
}

.opsMonthlyDetail label {
  display: block;
}

.opsMonthlyDetail input {
  padding: 10px 12px;
}

.radioLine > span {
  color: #475569;
  font-size: 12px;
  font-weight: 850;
}

.otherRequirement {
  display: block;
}

.resultPanel {
  align-self: start;
}

.riskBadge {
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 900;
}

.riskBadge.ok {
  background: #ecfdf5;
  color: var(--good);
}

.riskBadge.warn {
  background: #fffbeb;
  color: var(--warn);
}

.riskBadge.bad {
  background: #fef2f2;
  color: var(--bad);
}

.summaryGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.summaryGrid .highlight {
  grid-column: auto;
  border-color: rgba(37, 99, 235, 0.28);
  background: linear-gradient(135deg, #eff6ff, #fff);
}

.summaryGrid .highlight strong {
  font-size: 38px;
}

.summaryGrid .finalTotal {
  border-color: rgba(5, 150, 105, 0.32);
  background: linear-gradient(135deg, #ecfdf5, #fff);
}

.summaryGrid .finalTotal strong {
  color: #065f46;
  font-size: 38px;
}

.quoteNotes {
  display: block;
  margin-top: 12px;
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  background: #eef2ff;
  color: #3730a3;
  padding: 10px 13px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.5;
}

.quoteNotes p {
  margin: 0;
}

.taxNote {
  margin-top: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.5;
}

.summaryRequirements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.summaryRequirements section {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbff;
  padding: 14px;
}

.summaryRequirements h4 {
  margin: 0 0 10px;
  color: #0f172a;
  font-size: 15px;
}

.summaryRequirements dl {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 7px 10px;
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.summaryRequirements dt {
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

.summaryRequirements dd {
  margin: 0;
  font-weight: 800;
}

.paymentPlan {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbff;
  padding: 16px;
}

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

.paymentPlanHead h4 {
  margin: 0;
  font-size: 16px;
}

.paymentPlanHead > span {
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.bondRule {
  display: grid;
  gap: 4px;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}

.bondRule span {
  color: var(--muted);
}

.paymentSteps {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.paymentStep {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.paymentStep strong,
.paymentStep span {
  display: block;
}

.paymentStep span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.paymentStep b {
  color: var(--primary);
  font-size: 16px;
  white-space: nowrap;
}

.paymentStep b.refund {
  color: var(--good);
}

.note {
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #eff6ff;
  color: #1e40af;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.note.warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.customerCard {
  margin-top: 16px;
}

.customerCard p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.customerCard h4 {
  margin: 0;
  color: #1e293b;
  font-size: 16px;
  font-weight: 760;
  line-height: 1.75;
  white-space: pre-line;
}

.detailPanel {
  margin-top: 0;
}

.lineTools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 120px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbff;
  padding: 14px;
}

.legend {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legend span {
  border-radius: 999px;
  background: var(--surface-strong);
  padding: 7px 10px;
}

.tableWrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

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

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

th {
  background: #f8fbff;
  color: #475569;
  font-size: 12px;
  font-weight: 950;
}

td {
  color: #1e293b;
  font-size: 13px;
  line-height: 1.55;
}

th,
td,
td input {
  white-space: nowrap;
}

.idColumn {
  display: none;
}

.orderCell {
  width: 58px;
  text-align: center;
}

.dragHandle {
  display: inline-flex;
  width: 40px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--primary);
  cursor: grab;
  font-size: 12px;
  font-weight: 950;
}

.dragHandle:active {
  cursor: grabbing;
}

#productRules tr.dragging td {
  opacity: 0.55;
}

#productRules tr.dragOver td {
  background: #eaf2ff;
}

#productRules .ruleActions {
  flex-wrap: nowrap;
}

#productRules td,
#productRules input {
  white-space: nowrap;
}

.configInput {
  min-width: 300px;
}

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

#quoteLines tr:nth-child(odd) td {
  background: #ffffff;
}

#quoteLines tr:nth-child(even) td {
  background: #f8fbff;
}

#quoteLines tr:hover td {
  background: #eef4ff;
}

.lineIndexCell {
  width: 52px;
  min-width: 52px;
  color: #64748b;
  font-weight: 900;
  text-align: center;
}

.lineOrderCell {
  width: 56px;
  min-width: 56px;
  text-align: center;
}

.lineDragHandle {
  display: inline-grid;
  width: 34px;
  height: 32px;
  place-items: center;
  gap: 3px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--primary);
  cursor: grab;
  padding: 7px 8px;
}

.lineDragHandle span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.lineDragHandle:active {
  cursor: grabbing;
}

#quoteLines tr.dragging td {
  opacity: 0.52;
}

#quoteLines tr.dragOver td {
  box-shadow: inset 0 3px 0 #2563eb;
}

#quoteLines tr.dragOverAfter td {
  box-shadow: inset 0 -3px 0 #2563eb;
}

#quoteLines .lineSectionRow td {
  border-top: 2px solid #c7d2fe;
  border-bottom: 1px solid #dbe4f0;
  background: #eef4ff;
  color: var(--primary);
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 0;
}

#quoteLines .lineSectionRow:hover td {
  background: #eef4ff;
}

.resourceCell {
  max-width: none;
  min-width: 420px;
  overflow: visible;
  color: #334155;
  line-height: 1.55;
  text-overflow: clip;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.printResourceCell {
  color: #334155;
  line-height: 1.35;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  word-break: normal;
  overflow-wrap: normal;
}

#quoteLines tr:not(.lineSectionRow):not(.lineTotalRow) td {
  padding-top: 16px;
  padding-bottom: 16px;
  vertical-align: middle;
}

#quoteLines .lineTotalRow td {
  border-top: 2px solid #dbe4f0;
  background: linear-gradient(90deg, #f8fbff 0%, #ffffff 100%);
  padding: 14px 16px;
  font-weight: 950;
  vertical-align: bottom;
}

#quoteLines .lineTotalRow:hover td {
  background: linear-gradient(90deg, #f8fbff 0%, #ffffff 100%);
}

#quoteLines .lineMarketFormula {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  align-content: flex-end;
  justify-content: flex-end;
  gap: 12px;
  color: #475569;
  font-size: 14px;
  line-height: 1.4;
  white-space: normal;
}

#quoteLines .lineMarketFormula span,
#quoteLines .lineMarketFormula b {
  white-space: nowrap;
}

#quoteLines .lineMarketFormula b {
  color: #94a3b8;
  font-size: 18px;
}

#quoteLines .lineMarketFormula strong {
  color: #0f172a;
  font-size: 18px;
}

#quoteLines .lineMarketTotal {
  color: var(--primary);
}

#quoteLines .lineMarketTotal strong {
  color: var(--primary);
  font-size: 24px;
  letter-spacing: 0;
  white-space: nowrap;
}

.rulesLeaveDialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.32);
  padding: 24px;
}

.rulesLeaveDialog.open {
  display: flex;
}

.rulesLeaveDialog > div {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 24px;
}

.rulesLeaveDialog strong {
  display: block;
  color: var(--text);
  font-size: 20px;
  font-weight: 950;
}

.rulesLeaveDialog p {
  margin: 10px 0 20px;
  color: var(--muted);
  line-height: 1.7;
}

.rulesLeaveDialog > div > div {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.money {
  color: var(--primary);
  font-weight: 950;
  white-space: nowrap;
}

.incrementInput {
  display: block;
  width: 92px;
  min-width: 92px;
  height: 30px;
  margin: 0;
  padding: 4px 9px;
  text-align: right;
  line-height: 20px;
  appearance: textfield;
  -moz-appearance: textfield;
}

.incrementInput::-webkit-outer-spin-button,
.incrementInput::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.iconBtn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #475569;
  padding: 7px 9px;
  font-weight: 900;
}

.iconBtn.danger {
  border-color: #fecaca;
  color: var(--bad);
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

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

.settingsGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.settingsUsersPanel {
  overflow: hidden;
}

.panelSub {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.settingsCardBody {
  display: grid;
  gap: 10px;
}

.settingRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e2e8f0;
  padding: 9px 0;
  font-size: 13px;
}

.settingRow:last-child {
  border-bottom: 0;
}

.settingRow span {
  color: #64748b;
  font-weight: 800;
}

.settingRow strong {
  color: #0f172a;
  font-weight: 900;
  text-align: right;
}

.widePanel {
  grid-column: auto;
}

.collapsiblePanel {
  transition: padding 0.16s ease;
}

.collapsiblePanel.collapsed .panelHead {
  margin-bottom: 0;
}

.collapsiblePanel.collapsed .collapsibleBody {
  display: none;
}

.collapseBtn {
  min-width: 74px;
}

.stackFields {
  display: block;
}

.ruleRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 12px;
}

.ruleRow .wide {
  grid-column: 1 / -1;
}

.compactTable table {
  min-width: 780px;
}

.compactTable th,
.compactTable td {
  padding: 10px 12px;
  vertical-align: middle;
}

.compactTable input {
  min-width: 120px;
  padding: 9px 10px;
  border-radius: 10px;
}

.coefficientTable td:nth-child(1),
.coefficientTable td:nth-child(2),
.coefficientTable td:nth-child(4) {
  white-space: nowrap;
}

.coefficientTable td:nth-child(4) input {
  max-width: 130px;
  text-align: right;
}

.strategyPriceTable {
  margin-top: 14px;
}

.coefficientLab {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  padding: 16px;
}

.labHead,
.labActions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.labHead h4 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 950;
}

.labHead p,
.labActions span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

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

.labSummaryCard {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
}

.labSummaryCard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.labSummaryCard strong {
  display: block;
  margin-top: 4px;
  color: var(--primary);
  font-size: 18px;
  font-weight: 950;
}

.labSummaryCard em {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
  line-height: 1.5;
}

.labCompareTable {
  grid-column: 1 / -1;
}

.labCompareTable table {
  min-width: 980px;
}

.labCompareTable tr.selected td {
  background: #eef5ff;
}

.labCompareTable td,
.labCompareTable th {
  white-space: nowrap;
}

.warnText {
  color: var(--warn) !important;
}

.okText {
  color: #047857 !important;
}

.inputWithUnit {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.inputWithUnit input {
  min-width: 90px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.inputWithUnit span {
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.algorithmRule {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.algorithmRule .wide {
  grid-column: 1 / -1;
}

.factorList {
  display: grid;
  gap: 8px;
}

.factorRow {
  display: grid;
  grid-template-columns: 1fr 90px 90px 36px;
  gap: 8px;
  align-items: center;
}

.ruleActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.algorithmLibrary {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}

.algorithmRow {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) 112px 116px 70px minmax(150px, 1fr) minmax(120px, 0.8fr) 70px 122px;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.algorithmRow:last-child {
  border-bottom: 0;
}

.algorithmRow.header {
  background: #f8fbff;
  color: #475569;
  font-size: 12px;
  font-weight: 950;
}

.algorithmName strong {
  display: block;
  font-size: 14px;
}

.algorithmName span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.algorithmTierText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
}

.statusPill {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
}

.statusPill.off {
  background: #f1f5f9;
  color: #64748b;
}

.drawerOverlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.drawerOverlay.open {
  display: block;
}

.drawerMask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
}

.drawerPanel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  width: min(720px, 100%);
  height: 100%;
  flex-direction: column;
  background: #f8fbff;
  box-shadow: -28px 0 60px rgba(15, 23, 42, 0.16);
}

.drawerHead,
.drawerFoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 18px 20px;
}

.drawerHead h3 {
  margin: 0;
  font-size: 22px;
}

.drawerBody {
  display: grid;
  gap: 16px;
  overflow: auto;
  padding: 20px;
}

.drawerFoot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.drawerBlock {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 16px;
}

.drawerBlock h4 {
  margin: 0 0 12px;
  font-size: 15px;
}

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

.drawerGrid .wide {
  grid-column: 1 / -1;
}

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

.drawerFactorHead h4 {
  margin: 0;
}

.drawerFactorActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.factorLabels {
  display: grid;
  grid-template-columns: 1fr 90px 90px 36px;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.fullBtn {
  width: 100%;
  margin-top: 14px;
}

.settingsLead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.settingsLead p {
  margin: 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
}

.settingsTools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.settingsSummary {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.userCreateForm {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.userCreateForm label,
.initialPasswordHint {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.initialPasswordHint {
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  padding: 10px 12px;
}

.initialPasswordHint strong {
  color: #1d4ed8;
  font-size: 18px;
  line-height: 1;
}

.initialPasswordHint em {
  color: #64748b;
  font-style: normal;
  font-size: 11px;
}

.userList {
  display: block;
}

.userTableWrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow-x: auto;
}

.userTable {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.userTable th,
.userTable td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 12px;
  vertical-align: middle;
  text-align: left;
  font-size: 13px;
}

.userTable th {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

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

.userTable input,
.userTable select {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  color: #0f172a;
  font: inherit;
}

.userTable input[readonly],
.userTable select:disabled {
  background: #f8fafc;
  color: #64748b;
}

.seqCol {
  width: 58px;
  text-align: center !important;
  color: #64748b;
  font-weight: 900;
}

.actionCol {
  width: 170px;
  text-align: right !important;
}

.dateCol {
  color: #64748b;
  font-size: 12px !important;
  white-space: nowrap;
}

.userSubText {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.userEnabled {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  padding: 6px 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 900;
}

.userEnabled input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.userActions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.dangerText {
  color: #dc2626;
}

.ghostBtn:disabled,
.primaryBtn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.historyList {
  display: grid;
  gap: 12px;
}

.historyItem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 16px;
}

.historyItem.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.historyItem h4 {
  margin: 0 0 6px;
}

.historyItem p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.historyItem strong {
  color: var(--primary);
  font-size: 18px;
}

.historyItemSide {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 136px;
}

.historyItemSide .ghostBtn,
.historyItemSide .textBtn {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 12px;
  white-space: nowrap;
}

.historyDetail {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  border: 1px solid #cfe0f5;
  border-radius: 18px;
  background: #fff;
  padding: 18px;
}

.historyDetailHead,
.historyDetailSummary,
.historyDetailGrid {
  display: grid;
  gap: 14px;
}

.historyDetailHead {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.historyDetailHead h3,
.historyDetailGrid h4 {
  margin: 0;
}

.historyDetailHead p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.historyDetailActions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.historyDetailSummary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.historyDetailSummary div {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
  padding: 12px;
}

.historyDetailSummary span,
.historyDetailGrid dt,
.historyDetailGrid em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.historyDetailSummary strong {
  display: block;
  margin-top: 6px;
  color: #0f172a;
  font-size: 18px;
}

.historyDetailGrid {
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
}

.historyDetailGrid section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  padding: 14px;
}

.historyDetailGrid dl {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 12px 0 0;
}

.historyDetailGrid dd {
  margin: 0;
  color: #0f172a;
  font-weight: 850;
}

.historyDetailGrid ul {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.historyDetailGrid li {
  display: grid;
  grid-template-columns: 92px 112px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.historyDetailGrid li strong {
  color: #0f172a;
  font-size: 14px;
}

.historyDetailTableWrap {
  overflow-x: auto;
}

.historyDetailTable {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 12px;
}

.historyDetailTable th,
.historyDetailTable td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.historyDetailTable th {
  color: #475569;
  font-weight: 900;
}

.historyDetailTable td:nth-child(1),
.historyDetailTable td:nth-child(4) {
  text-align: center;
}

.historyDetailTable td:nth-child(5),
.historyDetailTable td:nth-child(6),
.historyDetailTable td:nth-child(7) {
  text-align: right;
  white-space: nowrap;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  padding: 30px;
  text-align: center;
}

.printQuote {
  display: none;
}

.printPreview {
  background: #e5edf7;
}

.printPreview #printMount {
  width: min(1120px, calc(100% - 32px));
  margin: 20px auto;
}

.printPageActions {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 12px;
  margin: 16px auto 0;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.printPageActions span {
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.printBackBtn {
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  font-weight: 850;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.printPreview .printQuote {
  display: block;
  min-height: 720px;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
}

.printPreview .printHeader {
  display: block;
  border-bottom: 2px solid #2563eb;
  padding-bottom: 28px;
}

.printPreview .printLogo {
  width: 160px;
  height: auto;
  object-fit: contain;
}

.printPreview .printTitleBlock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 0.46fr);
  align-items: start;
  gap: 44px;
}

.printPreview .printTitleLeft {
  display: grid;
  align-content: start;
  min-height: 176px;
  padding-top: 50px;
}

.printPreview .printTitleRight {
  display: grid;
  align-self: start;
  gap: 7px;
  justify-items: end;
  text-align: right;
}

.printPreview .printBrandPanel {
  min-height: 176px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.86), #eaf4ff 58%, #ddebff 100%);
  padding: 24px 28px 20px;
}

.printPreview .printHeaderBrandLogo {
  width: 136px;
  height: auto;
  object-fit: contain;
}

.printPreview .printTitleBlock h1 {
  margin: 0;
  color: #0f172a;
  font-size: 34px;
  font-weight: 950;
  line-height: 1.12;
}

.printPreview .printTitleBlock #printQuoteTitle {
  margin-top: 12px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.printPreview .printTitleBlock #printHeaderSlogan {
  margin-top: 8px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 950;
  line-height: 1.32;
  white-space: nowrap;
}

.printPreview .printTitleRight em {
  color: #2563eb;
  font-size: 16px;
  font-style: normal;
  font-weight: 950;
  line-height: 1.32;
}

.printPreview .printMeta {
  display: flex;
  flex-wrap: nowrap;
  gap: 22px;
  width: max-content;
  max-width: 100%;
  margin-top: 16px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  justify-content: flex-start;
  line-height: 1.2;
}

.printPreview #printQuoteValidUntil {
  white-space: nowrap;
}

.printPreview .printSummarySection,
.printPreview .printDetailSection {
  margin-top: 24px;
}

.printPreview .printSectionTitle {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #1d4ed8;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 950;
}

.printPreview .printSummaryGrid,
.printPreview .printInfoGrid {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.printPreview .printSummaryGrid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.printPreview .printInfoGrid {
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.printPreview #printProjectMeta {
  grid-template-columns: 78px minmax(0, 1fr) 64px minmax(0, 1fr);
}

.printPreview #printProjectMeta dt {
  white-space: nowrap;
}

.printPreview #printProjectMeta dt:first-child + dd {
  grid-column: 2 / -1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.printPreview .printSummaryGrid div,
.printPreview .printInfoBox {
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 12px;
}

.printPreview .printSummaryGrid span,
.printPreview .printInfoBox dt,
.printPreview .printPaymentPlan span,
.printPreview .printPaymentPlan em,
.printPreview .printQuoteNotes {
  color: #64748b;
}

.printPreview .printSummaryGrid strong {
  display: block;
  margin-top: 4px;
  color: #1d4ed8;
  font-size: 20px;
  font-weight: 950;
}

.printPreview .printTaxNote {
  margin-top: 8px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.45;
}

.printPreview .printSummaryGrid .printFinalTotal {
  border-color: rgba(5, 150, 105, 0.32);
  background: #ecfdf5;
}

.printPreview .printSummaryGrid .printFinalTotal strong {
  color: #065f46;
}

.printPreview .printInfoBox h2 {
  margin: 0 0 8px;
  font-size: 13px;
}

.printPreview .printInfoBox dl {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 5px 8px;
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.printPreview .printInfoBox dd {
  margin: 0;
  font-weight: 800;
}

.printPreview .printPaymentPlan {
  display: grid;
  gap: 6px;
}

.printPreview .printPaymentPlan div {
  display: grid;
  grid-template-columns: 74px 90px minmax(0, 1fr);
  gap: 8px;
  border-bottom: 1px solid #e5edf7;
  padding-bottom: 5px;
  font-size: 11px;
}

.printPreview .printTable {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 6px;
  border-collapse: collapse;
  table-layout: fixed;
  color: #1e293b;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 11px;
}

.printPreview .printTable thead {
  display: table-row-group;
}

.printPreview .printTable th,
.printPreview .printTable td {
  border: 1px solid #cbd5e1;
  padding: 6px 5px;
  vertical-align: middle;
  line-height: 1.32;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.printPreview .printTable th {
  background: #eef4f8;
  color: #334155;
  font-size: 10.6px;
  font-weight: 850;
  text-align: left;
  white-space: normal;
}

.printPreview .printTable tbody tr:nth-child(odd) td {
  background: #ffffff;
}

.printPreview .printTable tbody tr:nth-child(even) td {
  background: #f8fbff;
}

.printPreview .printTable th:nth-child(1) { width: 4%; }
.printPreview .printTable th:nth-child(2) { width: 16%; }
.printPreview .printTable th:nth-child(3) { width: 8%; }
.printPreview .printTable th:nth-child(4) { width: 5%; }
.printPreview .printTable th:nth-child(5) { width: 13%; }
.printPreview .printTable th:nth-child(6) { width: 10%; }
.printPreview .printTable th:nth-child(7) { width: 12%; }
.printPreview .printTable th:nth-child(8) { width: 32%; }

.printPreview .printTable td:nth-child(1) {
  color: #475569;
  font-size: 10.5px;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.printPreview .printTable td:nth-child(2) {
  white-space: normal;
  word-break: break-word;
}

.printPreview .printTable td:nth-child(3) {
  color: #1e293b;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.printPreview .printTable td:nth-child(2) strong {
  color: #0f172a;
  font-size: 11px;
  font-weight: 850;
}

.printPreview .printTable td:nth-child(4) {
  color: #1e293b;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.printPreview .printTable td:nth-child(5),
.printPreview .printTable td:nth-child(6),
.printPreview .printTable td:nth-child(7) {
  white-space: nowrap;
  color: #0f172a;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.printPreview .printTable .printResourceCell {
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
  color: #475569;
  font-size: 10.2px;
  letter-spacing: 0;
  line-height: 1.3;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.printPreview .printQuoteNotes {
  margin-top: 8px;
  font-size: 11px;
}

.printPreview .printBrandPage {
  display: grid;
  min-height: 230px;
  align-content: center;
  justify-items: start;
  margin-top: 20px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(0, 91, 170, 0.1), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  padding: 28px 36px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.printPreview .printBrandLogo {
  width: 132px;
  height: auto;
  object-fit: contain;
}

.printPreview .printBrandEyebrow {
  margin: 18px 0 8px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.22em;
}

.printPreview .printBrandPage h2 {
  max-width: 820px;
  margin: 0;
  color: #005baa;
  font-size: 28px;
  line-height: 1.12;
  font-weight: 950;
}

.printPreview .printBrandPage h3 {
  margin: 10px 0 0;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.printPreview .printBrandDesc {
  max-width: 760px;
  margin: 14px 0 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
  font-weight: 650;
}

.printPreview .printBrandMessage {
  max-width: 860px;
  margin-top: 16px;
  border-left: 4px solid #2563eb;
  background: rgba(255, 255, 255, 0.72);
  color: #1e293b;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.65;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .authPortal {
    padding: 28px 18px;
  }

  .authScene,
  .authSceneCompact {
    min-height: auto;
  }

  .authBrandPanel {
    padding: 30px;
  }

  .authBrandPanel h1 {
    font-size: clamp(32px, 4vw, 42px);
  }

  .authBrandLogo {
    width: 170px;
  }

  .authKicker {
    margin-top: 26px;
  }

  .authProofGrid {
    margin-top: 22px;
  }

  .heroPanel,
  .quoteLayout,
  .adminGrid,
  .settingsGrid,
  .requirementPanel {
    grid-template-columns: 1fr;
  }

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

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

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

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

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

  .settingsLead {
    align-items: flex-start;
    flex-direction: column;
  }

  .algorithmRow.header {
    display: none;
  }
}

@media (max-width: 720px) {
  .authPortal {
    padding: 16px;
  }

  .authScene,
  .authSceneCompact {
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
  }

  .authBrandPanel,
  .loginCard {
    border-radius: 22px;
    padding: 18px;
  }

  .authBrandLogo {
    width: 142px;
  }

  .authKicker {
    margin: 18px 0 10px;
    font-size: 11px;
  }

  .authBrandPanel h1 {
    font-size: 25px;
    line-height: 1.16;
  }

  .authLead {
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.58;
  }

  .authProofGrid {
    display: none;
  }

  .authTrustLine {
    margin-top: 16px;
    padding: 8px 11px;
    font-size: 12px;
  }

  .loginHead h2 {
    font-size: 23px;
  }

  .loginHead p:not(.eyebrow) {
    font-size: 13px;
    line-height: 1.5;
  }

  .loginCard {
    gap: 12px;
  }

  .loginCard input {
    padding: 11px 12px;
  }

  .authSubmit,
  .authSecondary {
    min-height: 44px;
  }

  .appShell {
    width: min(100% - 24px, 1440px);
    padding-top: 14px;
  }

  .topbar,
  .panelHead {
    align-items: flex-start;
    flex-direction: column;
  }

  .topActions,
  .tabs {
    width: 100%;
  }

  .tabs {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .heroPanel,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .fieldGrid,
  .summaryGrid,
  .summaryRequirements,
  .opsMonthlyDetail,
  .lineTools,
  .radioLine,
  .algorithmRule,
  .userCreateForm {
    grid-template-columns: 1fr;
  }

  .settingsTools {
    width: 100%;
    justify-content: space-between;
  }

  .drawerGrid,
  .factorLabels,
  .factorRow {
    grid-template-columns: 1fr;
  }
}

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

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html,
  body {
    background: #fff;
    color: #111827;
  }

  body {
    min-height: auto;
  }

  .topbar,
  .heroPanel,
  .tabs,
  .quoteLayout,
  .detailPanel,
  .inputPanel,
  .topActions,
  .printPageActions,
  .printBackBtn,
  #adminView,
  #historyView,
  .resultPanel {
    display: none !important;
  }

  .appShell {
    width: 100%;
    padding: 0;
    margin: 0;
  }

  .printQuote {
    display: block;
    min-height: 210mm;
    padding: 10mm 12mm;
    background: #fff;
  }

  .printHeader {
    display: block;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 7mm;
  }

  .printLogo {
    display: none;
  }

  .printTitleBlock {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(72mm, 0.46fr);
    align-items: start;
    gap: 10mm;
  }

  .printTitleLeft {
    display: grid;
    align-content: start;
    min-height: 36mm;
    padding-top: 10mm;
  }

  .printTitleRight {
    display: grid;
    align-self: start;
    gap: 1.6mm;
    justify-items: end;
    text-align: right;
  }

  .printBrandPanel {
    min-height: 36mm;
    border-radius: 4mm;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.86), #eaf4ff 58%, #ddebff 100%);
    padding: 5mm 6mm 4.5mm;
  }

  .printHeaderBrandLogo {
    width: 30mm;
    height: auto;
    object-fit: contain;
  }

  .printTitleBlock h1 {
    margin: 0;
    color: #0f172a;
    font-size: 31px;
    font-weight: 950;
    letter-spacing: 0;
    line-height: 1.12;
  }

  .printTitleBlock #printQuoteTitle {
    margin-top: 3mm;
    color: #0f172a;
    font-size: 17px;
    font-weight: 900;
    line-height: 1.2;
    white-space: nowrap;
  }

  .printTitleBlock #printHeaderSlogan {
    margin-top: 2mm;
    color: #0f172a;
    font-size: 15px;
    font-weight: 950;
    line-height: 1.3;
    white-space: nowrap;
  }

  .printTitleRight em {
    color: #2563eb;
    font-size: 12px;
    font-style: normal;
    font-weight: 950;
    line-height: 1.3;
  }

  .printMeta {
    display: flex;
    flex-wrap: nowrap;
    gap: 5mm;
    width: max-content;
    max-width: 100%;
    margin-top: 4mm;
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    justify-content: flex-start;
    line-height: 1.2;
  }

  #printQuoteValidUntil {
    white-space: nowrap;
  }

  .printSummarySection,
  .printDetailSection {
    margin-top: 8mm;
  }

  .printSectionTitle {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    background: #eaf2ff;
    color: #1d4ed8;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 950;
  }

  .printSummaryGrid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .printSummaryGrid div,
  .printInfoBox {
    border: 1px solid #dbe4f0;
    border-radius: 8px;
    background: #f8fbff;
  }

  .printSummaryGrid div {
    padding: 10px 12px;
  }

  .printSummaryGrid span {
    display: block;
    color: #64748b;
    font-size: 10px;
    font-weight: 850;
  }

  .printSummaryGrid strong {
    display: block;
    margin-top: 4px;
    color: #1d4ed8;
    font-size: 20px;
    font-weight: 950;
  }

  .printTaxNote {
    margin-top: 8px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 850;
    line-height: 1.45;
  }

  .printSummaryGrid .printHighlight {
    border-color: #2563eb;
    background: #eef4ff;
  }

  .printSummaryGrid .printHighlight strong {
    color: #0f172a;
  }

  .printSummaryGrid .printFinalTotal {
    border-color: rgba(5, 150, 105, 0.32);
    background: #ecfdf5;
  }

  .printSummaryGrid .printFinalTotal strong {
    color: #065f46;
  }

  .printInfoGrid {
    display: grid;
    align-items: stretch;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .printInfoBox {
    padding: 10px 12px;
  }

  .printInfoBox h2 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 13px;
  }

  .printInfoBox dl {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 5px 8px;
    margin: 0;
    font-size: 11px;
    line-height: 1.45;
  }

  #printProjectMeta {
    grid-template-columns: 78px minmax(0, 1fr) 64px minmax(0, 1fr);
  }

  #printProjectMeta dt {
    white-space: nowrap;
  }

  #printProjectMeta dt:first-child + dd {
    grid-column: 2 / -1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .printInfoBox dt {
    color: #64748b;
    font-weight: 850;
  }

  .printInfoBox dd {
    margin: 0;
    color: #0f172a;
    font-weight: 800;
  }

  .printPaymentPlan {
    display: grid;
    gap: 6px;
  }

  .printPaymentPlan div {
    display: grid;
    grid-template-columns: 74px 90px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    border-bottom: 1px solid #e5edf7;
    padding-bottom: 5px;
    font-size: 11px;
  }

  .printPaymentPlan div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .printPaymentPlan span {
    color: #475569;
    font-weight: 850;
  }

  .printPaymentPlan strong {
    color: #0f172a;
    font-weight: 950;
  }

  .printPaymentPlan em {
    color: #475569;
    font-style: normal;
    line-height: 1.45;
  }

  .printTable {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 6px;
    border-collapse: collapse;
    table-layout: fixed;
    color: #1e293b;
    font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 11px;
  }

  .printTable thead {
    display: table-row-group;
  }

  .printTable th,
  .printTable td {
    border: 1px solid #cbd5e1;
    padding: 6px 5px;
    vertical-align: middle;
    line-height: 1.32;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .printTable th {
    background: #eef4f8;
    color: #334155;
    font-size: 10.6px;
    font-weight: 850;
    text-align: left;
    white-space: normal;
  }

  .printTable tbody tr:nth-child(odd) td {
    background: #ffffff;
  }

  .printTable tbody tr:nth-child(even) td {
    background: #f8fbff;
  }

  .printTable th:nth-child(1) { width: 4%; }
  .printTable th:nth-child(2) { width: 16%; }
  .printTable th:nth-child(3) { width: 8%; }
  .printTable th:nth-child(4) { width: 5%; }
  .printTable th:nth-child(5) { width: 13%; }
  .printTable th:nth-child(6) { width: 10%; }
  .printTable th:nth-child(7) { width: 12%; }
  .printTable th:nth-child(8) { width: 32%; }

  .printTable td:nth-child(1) {
    color: #475569;
    font-size: 10.5px;
    font-weight: 850;
    text-align: center;
    white-space: nowrap;
  }

  .printTable td:nth-child(2) {
    white-space: normal;
    word-break: break-word;
  }

  .printTable td:nth-child(3) {
    color: #1e293b;
    font-size: 11px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
  }

  .printTable td:nth-child(2) strong {
    color: #0f172a;
    font-size: 11px;
    font-weight: 850;
  }

  .printTable td:nth-child(4) {
    color: #1e293b;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
  }

  .printTable td:nth-child(5),
  .printTable td:nth-child(6),
  .printTable td:nth-child(7) {
    white-space: nowrap;
    color: #0f172a;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    text-align: right;
  }

  .printTable .printResourceCell {
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    color: #475569;
    font-size: 10.2px;
    letter-spacing: 0;
    line-height: 1.3;
    word-break: break-all;
    overflow-wrap: anywhere;
  }

  .printQuoteNotes {
    display: grid;
    gap: 3px;
    margin-top: 7px;
    color: #475569;
    font-size: 10.5px;
    line-height: 1.5;
  }

  .printQuoteNotes p {
    margin: 0;
  }

  .printBrandPage {
    display: grid;
    min-height: 48mm;
    align-content: center;
    justify-items: start;
    margin-top: 6mm;
    border-radius: 0;
    background:
      linear-gradient(135deg, rgba(0, 91, 170, 0.1), transparent 38%),
      linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    padding: 9mm 12mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .printBrandLogo {
    width: 118px;
    height: auto;
    object-fit: contain;
  }

  .printBrandEyebrow {
    margin: 8px 0 5px;
    color: #2563eb;
    font-size: 9.5px;
    font-weight: 950;
    letter-spacing: 0.22em;
  }

  .printBrandPage h2 {
    max-width: 820px;
    margin: 0;
    color: #005baa;
    font-size: 22px;
    line-height: 1.12;
    font-weight: 950;
  }

  .printBrandPage h3 {
    margin: 6px 0 0;
    color: #0f172a;
    font-size: 15px;
    line-height: 1.25;
    font-weight: 900;
  }

  .printBrandDesc {
    max-width: 760px;
    margin: 8px 0 0;
    color: #475569;
    font-size: 10.5px;
    line-height: 1.55;
    font-weight: 650;
  }

  .printBrandMessage {
    max-width: 860px;
    margin-top: 8px;
    border-left: 3px solid #2563eb;
    background: rgba(255, 255, 255, 0.72);
    color: #1e293b;
    padding: 7px 10px;
    font-size: 10.5px;
    line-height: 1.5;
    font-weight: 800;
  }
}
