:root {
  color-scheme: light;
  --bg: #edf2f7;
  --paper: #fff;
  --ink: #182d43;
  --muted: #496177;
  --line: #cedbe7;
  --blue: #245d96;
  --wash: #e7f0fa;
  font: 15px/1.55 "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  accent-color: var(--blue);
  caret-color: var(--blue);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
::selection { background: #cadff4; color: var(--ink); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.wrap { width: min(calc(100% - 80px), 1240px); margin-inline: auto; }
.topbar { background: var(--blue); color: #fff; }
.topbar-inner { min-height: 61px; display: flex; align-items: center; gap: 16px; font-size: 16px; font-weight: 700; }
.topbar img { display: block; width: 100px; height: auto; }
.topbar-account { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.environment { font-size: 13px; font-weight: 600; white-space: nowrap; }
.account-button { min-height: 34px; padding: 5px 9px; background: transparent; border: 1px solid #a4c4e1; border-radius: 6px; color: white; font-size: 12px; white-space: nowrap; }
.account-button:focus-visible { outline-color: #fff; }
.workspace { padding: 35px 0 26px; }
.signin-panel { max-width: 420px; margin: 38px auto; display: grid; gap: 16px; }
.signin-panel p { color: var(--muted); font-size: 13px; }
.signin-panel .status[data-error] { color: #95322d; }
.view-switch { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.view-switch button { background: none; border: 0; border-bottom: 2px solid transparent; min-height: 44px; padding: 0 3px; font-weight: 700; color: var(--muted); }
.view-switch button[aria-pressed="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 23px; }
#editor .page-heading { align-items: flex-start; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-inline-start: auto; }
#new-quote { white-space: nowrap; }
.quote-meta-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; margin-top: 6px; }
.quote-meta { color: var(--muted); font-size: 13px; }
.text-action { background: none; border: 0; padding: 4px 0; color: var(--blue); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.quote-tools { display: flex; flex-wrap: wrap; gap: 9px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); margin-bottom: 18px; }
.quote-tools .secondary { min-height: 38px; }
#edit-quote { background: var(--wash); }
#edit-quote:hover:not(:disabled) { background: #dcecf9; }
h1, h2, p, dl { margin: 0; }
h1 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.25; letter-spacing: -.03em; }
h2 { font-size: 17px; line-height: 1.35; }
.quote-layout { display: grid; grid-template-columns: minmax(0, 1fr) 315px; gap: 24px; align-items: start; }
.entry { min-width: 0; display: grid; gap: 23px; }
.section { padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.section h2 { margin-bottom: 16px; }
.customer-grid, .extra-grid { display: grid; gap: 14px 16px; }
.customer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.extra-grid { grid-template-columns: minmax(100px, .5fr) minmax(0, 1.5fr); }
label { min-width: 0; display: block; font-size: 13px; font-weight: 650; }
label small { font-weight: 400; margin-left: 3px; }
.suggest-field { position: relative; min-width: 0; }
.suggest-field:has(.suggestions:not([hidden])) { z-index: 4; }
.suggestions {
  position: absolute; top: calc(100% + 4px); inset-inline: 0; z-index: 1; max-height: 220px; overflow: auto;
  padding: 4px; border: 1px solid #b7cbe0; border-radius: 8px; background: var(--paper);
  box-shadow: 0 8px 20px #152e4c22; overscroll-behavior: contain;
}
.suggestions [role="option"] {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 40px; padding: 6px 8px; border-radius: 5px; cursor: pointer; overflow-wrap: anywhere;
}
.suggestions [role="option"]:hover, .suggestions [aria-selected="true"] { background: var(--wash); color: var(--blue); }
.suggestions small { flex: 0 1 auto; text-align: right; }
small { color: var(--muted); font-size: 12px; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type="checkbox"]), select, textarea {
  width: 100%; min-width: 0; min-height: 42px; display: block; margin-top: 6px; padding: 8px 10px;
  border: 1px solid #becdda; border-radius: 7px; background: var(--paper); font-size: 15px; font-weight: 400;
}
input[type="date"] { appearance: auto; min-inline-size: 0; }
input[type="date"]::-webkit-date-and-time-value { margin: 0; text-align: left; }
.date-control { display: block; min-inline-size: 0; }
input::placeholder, textarea::placeholder { color: #52687c; opacity: 1; }
textarea { resize: vertical; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .54; }
.secondary, .primary {
  min-height: 42px; display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 7px; font-weight: 700; font-size: 14px;
}
.secondary { color: var(--blue); background: var(--paper); border: 1px solid #a9bfd6; }
.secondary:hover:not(:disabled) { background: var(--wash); }
.line-grid { display: grid; grid-template-columns: minmax(115px, 2.7fr) minmax(48px, .6fr) minmax(48px, .7fr) minmax(60px, .9fr) minmax(60px, .9fr) 55px 30px; align-items: center; gap: 8px; }
.line-head { padding: 8px 10px; color: var(--blue); background: var(--wash); border-radius: 7px; font-size: 12px; font-weight: 700; }
.line-head > :nth-child(5) { text-align: right; }
.line-head > :nth-child(6) { text-align: center; }
.mobile-field-heading, .remove-in-note { display: none; }
.product { position: relative; border-bottom: 1px solid var(--line); padding: 9px 10px; }
.product input, .field-product textarea { margin: 0; }
.field-product textarea { height: 42px; resize: none; overflow: hidden; white-space: pre; }
.field-caption {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.field-amount { border-radius: 7px; text-align: right; overflow-wrap: anywhere; }
output, .breakdown dd { font-variant-numeric: tabular-nums; }
.field-amount output { font-size: 17px; font-weight: 750; }
.remove { padding: 0; width: 30px; min-height: 34px; border: 0; background: transparent; border-radius: 6px; display: grid; place-items: center; color: #51666a; }
.remove:not(:disabled):hover { background: #f9e9e6; color: #973b2d; }
.note-toggle { min-height: 36px; padding: 4px; color: var(--blue); background: white; border: 1px solid #b7cbe0; border-radius: 6px; font-size: 12px; }
.note-toggle:hover, .note-toggle[aria-expanded="true"] { background: var(--wash); }
.note-toggle[data-has-note] { background: var(--wash); font-weight: 700; }
.note-label-short { display: none; }
.line-note { position: absolute; top: calc(100% - 3px); right: 39px; z-index: 3; display: flex; gap: 8px; align-items: end; padding: 12px; width: min(345px, calc(100% - 42px)); background: var(--paper); border: 1px solid #b7cbe0; border-radius: 9px; box-shadow: 0 8px 20px #152e4c22; }
.line-note label { flex: 1; }
.line-note input { margin-top: 4px; }
.add-line { margin-top: 14px; }
.export { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; position: sticky; top: 18px; }
.total { background: var(--blue); color: white; padding: 20px 22px 18px; }
.total h2 { color: #e5eff9; font-size: 14px; }
.total-amount { margin-top: 6px; font-size: 35px; font-weight: 700; line-height: 1.15; letter-spacing: -.025em; overflow-wrap: anywhere; }
.total-amount span { font-size: .6em; }
.export-body { padding: 17px 20px 20px; }
.breakdown { display: grid; gap: 7px; }
.breakdown div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.breakdown dt { color: var(--muted); }
.breakdown dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.export-note { margin: 15px 0; padding: 11px 0; border-block: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.seal-option { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 34px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; }
#seal-tools { margin-top: 4px; }
#seal-tools small { display: block; margin: 6px 0; }
#seal-preview img { display: block; max-height: 79px; max-width: 100%; padding: 4px; border: 1px solid var(--line); border-radius: 5px; }
.primary { width: 100%; background: var(--blue); color: white; border: 1px solid transparent; min-height: 45px; }
.primary:not(:disabled):hover { background: #1a4c80; }
.quote-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quote-actions .secondary { flex: 1 1 auto; }
.entry[data-readonly] input, .entry[data-readonly] textarea, .entry[data-readonly] select {
  background: #f7f9fc;
  opacity: 1;
}
.status { font-size: 13px; margin-top: 9px; color: #12584b; }
.status[data-error] { color: #95322d; }
.draft-status { min-height: 20px; margin-top: 13px; font-size: 12px; color: var(--muted); }
.history-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, .25fr); gap: 15px; }
.history-status { color: var(--muted); font-size: 13px; margin-top: 14px; }
.history-list { display: grid; gap: 9px; list-style: none; margin: 10px 0 0; padding: 0; }
.history-card { display: flex; gap: 14px; justify-content: space-between; width: 100%; padding: 13px; text-align: left; background: #f7fafc; border: 1px solid var(--line); border-radius: 9px; }
.history-card:hover { background: var(--wash); }
.history-main, .history-side { display: grid; gap: 3px; min-width: 0; }
.history-main { overflow-wrap: anywhere; }
.history-side { text-align: right; align-content: start; justify-items: end; font-variant-numeric: tabular-nums; }
.history-number, .history-products { color: var(--muted); font-size: 13px; }
.state-pill { font-size: 12px; font-weight: 650; border-radius: 5px; padding: 2px 7px; white-space: nowrap; }
.state-pill[data-status="draft"] { background: #fff1d4; color: #754600; }
.state-pill[data-status="submitted"] { background: #e1f2e8; color: #205b40; }
dialog { width: min(640px, calc(100% - 24px)); max-height: 85dvh; padding: 20px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
dialog::backdrop { background: #172e4a74; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.revision-row { border-top: 1px solid var(--line); padding: 11px 2px; overflow-wrap: anywhere; }
.revision-row summary { cursor: pointer; font-weight: 650; }
.revision-row p, .revision-row li { margin-top: 5px; }
@media (max-width: 1040px) {
  .wrap { width: calc(100% - 42px); }
  .quote-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
  .section { padding: 18px; }
  .line-grid { grid-template-columns: minmax(100px, 2.7fr) minmax(42px, .6fr) minmax(42px, .7fr) minmax(54px, .9fr) minmax(56px, .85fr) 50px 28px; gap: 6px; }
}
@media (max-width: 810px) {
  .quote-layout { grid-template-columns: minmax(0, 1fr); }
  .export { position: static; }
}
@media (max-width: 530px) {
  .wrap { width: calc(100% - 28px); }
  .topbar-inner { min-height: 52px; gap: 9px; font-size: 14px; }
  .topbar img { width: 70px; }
  .environment { font-size: 11px; }
  .account-button { padding-inline: 5px; }
  .workspace { padding-top: 19px; }
  .page-heading { margin-bottom: 14px; }
  #editor .page-heading { gap: 8px; }
  .topbar-account { gap: 5px; }
  .section { padding: 15px; }
  .entry { gap: 18px; }
  .section h2 { margin-bottom: 13px; }
  .customer-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .date-control { margin-top: 6px; max-inline-size: 100%; overflow: hidden; border: 1px solid #becdda; border-radius: 7px; }
  .date-control:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
  .date-control input[type="date"] {
    -webkit-appearance: none; appearance: none; max-inline-size: 100%; min-inline-size: 0; margin: 0; border: 0;
  }
  .date-control input[type="date"]:focus-visible { outline: 0; }
  .shipping-notes { padding-block: 11px; }
  .shipping-notes h2 { margin-bottom: 8px; }
  .extra-grid { grid-template-columns: 1fr; gap: 7px; }
  .extra-grid :is(input, textarea) { margin-top: 4px; }
  .extra-grid textarea { padding-block: 6px; line-height: 1.35; }
  .products { padding-inline: 10px; }
  .products h2 { padding-inline: 4px; }
  .products .line-grid {
    grid-template-columns: minmax(0, 1fr) clamp(27px, 7.5vw, 32px) 30px clamp(47px, 13vw, 56px) 70px 30px;
    gap: 4px;
    align-items: start;
  }
  .line-head { padding: 7px 4px; }
  .line-head > :nth-child(n+2):nth-child(-n+4) { text-align: right; }
  .desktop-field-heading { display: none; }
  .mobile-field-heading { display: inline; }
  .product { padding: 8px 4px; }
  .product .line-grid input, .field-product textarea { min-height: 44px; padding-inline: 3px; background: #f7fafc; }
  .product .line-grid input { text-align: right; font-variant-numeric: tabular-nums; }
  .field-product textarea { padding-block: 10px; line-height: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .field-product textarea::placeholder { font-size: 14px; }
  .product .line-grid :focus-visible { outline-offset: 1px; }
  .field-product .suggestions { inset-inline-end: auto; width: min(240px, calc(100vw - 62px)); }
  .suggestions [role="option"] { min-height: 44px; }
  .field-amount { min-width: 0; }
  .field-amount output { display: block; padding-block: 12px; color: var(--blue); line-height: 20px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
  .note-toggle { min-height: 44px; padding-inline: 0; }
  .note-label { display: none; }
  .note-label-short { display: inline; }
  .product .remove { display: none; }
  input:not([type="checkbox"]), select, textarea, .line-note input { font-size: 16px; }
  .line-note { right: 4px; width: min(345px, calc(100% - 8px)); flex-wrap: wrap; }
  .line-note label { flex-basis: 100%; }
  .remove-in-note { display: inline-flex; margin-inline-end: auto; color: #973b2d; }
  .add-line { margin-top: 10px; }
  .total { padding: 15px 18px; }
  .total-amount { font-size: 31px; }
}
