:root {
  --orange: #ef6b22;
  --ink: #151515;
  --muted: #77736c;
  --paper: #fbfaf7;
  --soft: #f0eee8;
  --line: #d8d4cc;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input { font: inherit; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--paper);
}
.login-screen[hidden] { display: none; }
.login-card { width: min(100%, 430px); padding: 42px; border: 1px solid var(--line); border-top: 6px solid var(--orange); border-radius: 20px; background: #fff; box-shadow: 0 20px 70px rgba(32, 27, 20, .08); }
.login-card .brand { margin-bottom: 34px; }
.login-card h1 { margin: 12px 0 8px; font-size: 36px; font-weight: 400; letter-spacing: -.04em; }
.login-card > p:not(.eyebrow):not(.status) { margin: 0 0 30px; color: var(--muted); }
.login-card label { display: block; }
.login-card .primary { width: 100%; margin-top: 18px; }

.topbar {
  height: 82px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 7px solid var(--orange);
  border-bottom: 1px solid #e3e0d9;
  background: rgba(251, 250, 247, .94);
}
.brand { font-size: 34px; font-weight: 800; letter-spacing: -2px; }
.internal { color: var(--muted); font-size: 12px; letter-spacing: .11em; }

.page-shell { width: min(100% - 40px, 1180px); margin: 0 auto; padding: 74px 0 100px; }
.intro { max-width: 720px; margin-bottom: 46px; }
.eyebrow { color: var(--orange) !important; font-size: 12px !important; font-weight: 700; letter-spacing: .14em; }
.intro h1 { margin: 15px 0 12px; font-size: clamp(38px, 5vw, 68px); font-weight: 400; letter-spacing: -.04em; }
.intro p { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.7; }

.card { border: 1px solid var(--line); border-radius: 24px; padding: 38px; background: #fff; box-shadow: 0 14px 50px rgba(32, 27, 20, .04); }
.result-card { margin-top: 28px; }
.section-title { display: flex; gap: 18px; align-items: center; margin-bottom: 30px; }
.section-title > span { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid var(--line); border-radius: 50%; font-size: 14px; }
.section-title h2 { margin: 0 0 5px; font-size: 25px; font-weight: 600; }
.section-title p { margin: 0; color: var(--muted); font-size: 14px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
label > span, legend { display: block; margin: 0 0 9px; font-size: 14px; font-weight: 700; }
input { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 14px 16px; color: var(--ink); outline: none; }
input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239, 107, 34, .11); }
fieldset { margin: 0; padding: 0; border: 0; }
.radio-option { display: inline-flex; align-items: center; gap: 10px; margin: 0 18px 8px 0; cursor: pointer; }
.radio-option input { width: 18px; height: 18px; accent-color: var(--orange); }
.radio-option span { display: flex; flex-direction: column; gap: 2px; }
.radio-option b { font-size: 14px; }
.radio-option small { color: var(--muted); font-size: 11px; }
.items-field { grid-column: 1 / -1; }
.items-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.items-heading label { font-size: 14px; font-weight: 700; }
.items-heading span { color: var(--muted); font-size: 12px; }
.item-entry-box {
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.item-entry-box:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239, 107, 34, .11); }
.item-chips { display: flex; flex-wrap: wrap; gap: 9px; }
.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 9px 9px 9px 13px;
  border: 1px solid #d4d0c8;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .035em;
  box-shadow: 0 2px 6px rgba(30, 25, 18, .035);
}
.item-chip button {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border-radius: 6px;
  background: var(--soft);
  color: #77736c;
  font-size: 19px;
  line-height: 1;
}
.item-chip button:hover { color: #fff; background: var(--orange); transform: none; }
#item-entry { min-width: 220px; margin-top: 10px; padding: 9px 3px 5px; border: 0; border-radius: 0; background: transparent; text-transform: uppercase; box-shadow: none; }
.field-help { margin: 8px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

button { border: 0; border-radius: 12px; padding: 15px 22px; cursor: pointer; transition: transform .15s, opacity .15s; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.primary { color: white; background: var(--ink); box-shadow: inset 0 -4px 0 var(--orange); }
.secondary { color: var(--ink); background: var(--soft); }
.form-card > .primary { width: 100%; margin-top: 25px; }
.status { min-height: 22px; margin: 13px 0 0; color: var(--muted); font-size: 14px; }
.status.error { color: #b43c19; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
th { padding: 15px 14px; color: #fff; background: var(--ink); text-align: left; font-size: 13px; font-weight: 500; }
td { padding: 18px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
td.price { font-size: 17px; font-weight: 700; white-space: nowrap; }
td.missing-price { color: #b43c19; }
.messages { margin-top: 18px; }
.notice { margin: 8px 0; padding: 12px 15px; border-left: 4px solid var(--orange); background: #fff3ea; color: #9a3c14; font-size: 14px; }
.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 26px; }

.print-sheet { display: none; }
.quote-page { color: #151515; background: #fbfaf7; padding: 12mm 13mm; min-height: 272mm; }
.quote-top-line { height: 4px; margin: -12mm -13mm 12mm; background: var(--orange); }
.quote-header, .quote-title-row, .quote-footer { display: flex; justify-content: space-between; gap: 20px; }
.quote-logo { font-size: 28px; font-weight: 800; letter-spacing: -1.5px; }
.quote-contact { text-align: right; color: #5d5952; font-size: 9px; line-height: 1.6; }
.quote-title-row { align-items: flex-end; margin-top: 15mm; }
.quote-title { font-size: 36px; font-weight: 400; letter-spacing: -.03em; }
.quote-title small { display: block; margin-top: 4px; font-size: 17px; }
.quote-meta { color: #5d5952; text-align: right; font-size: 10px; line-height: 1.8; }
.quote-customer { margin-top: 10mm; padding: 7mm; background: var(--soft); display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; }
.quote-customer label { color: var(--muted); font-size: 9px; }
.quote-customer strong { display: block; margin-top: 3mm; font-size: 16px; font-weight: 500; }
.quote-table { width: 100%; min-width: 0; margin-top: 10mm; }
.quote-table th { padding: 4mm 3mm; font-size: 9px; }
.quote-table td { padding: 5mm 3mm; font-size: 10px; }
.quote-note { margin-top: 9mm; color: #69655f; font-size: 9px; line-height: 1.8; }
.quote-footer { position: absolute; left: 13mm; right: 13mm; bottom: 12mm; padding-top: 5mm; border-top: 1px solid #222; color: #66615a; font-size: 8px; }

@media (max-width: 720px) {
  .login-card { padding: 32px 22px; }
  .topbar { height: 68px; padding-inline: 20px; }
  .brand { font-size: 27px; }
  .internal { max-width: 140px; text-align: right; font-size: 9px; }
  .page-shell { width: min(100% - 24px, 1180px); padding: 44px 0 70px; }
  .intro { margin-bottom: 28px; }
  .intro h1 { font-size: 39px; }
  .intro p { font-size: 15px; }
  .card { padding: 22px 18px; border-radius: 18px; }
  .section-title { margin-bottom: 24px; }
  .section-title > span { width: 44px; height: 44px; }
  .section-title h2 { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; gap: 22px; }
  .items-field { grid-column: auto; }
  .item-entry-box { min-height: 126px; }
  .item-chip { width: 100%; justify-content: space-between; padding-left: 14px; }
  #item-entry { min-width: 0; font-size: 16px; }
  .radio-option { display: flex; padding: 10px 0; margin: 0; border-bottom: 1px solid #e7e3dc; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .result-card .table-wrap { overflow: visible; border: 0; border-radius: 0; }
  .result-card table { min-width: 0; display: block; }
  .result-card thead { display: none; }
  .result-card tbody { display: grid; gap: 12px; }
  .result-card tr { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
  .result-card td { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 10px 13px; border-bottom: 1px solid #e8e4dd; font-size: 13px; text-align: right; }
  .result-card td::before { content: attr(data-label); color: var(--muted); font-weight: 400; text-align: left; }
  .result-card td:last-child { border-bottom: 0; }
  .result-card td.price { font-size: 15px; }
}

@media print {
  @page { size: A4 portrait; margin: 0; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block; }
  .quote-page { position: relative; width: 210mm; height: 297mm; overflow: hidden; }
}
