:root {
  color-scheme: light;
  --canvas: #f4f6fa;
  --paper: #fff;
  --ink: #192238;
  --muted: #54627a;
  --line: #dce3ee;
  --accent: #314eca;
  --accent-dark: #243ca1;
  --accent-light: #eef2ff;
  --radius: 18px;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; }

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner, .workspace { width: min(1280px, calc(100% - 88px)); margin-inline: auto; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 74px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 11px;
  background: var(--ink);
  color: white;
  font-size: 23px;
  line-height: 1;
  font-weight: 750;
}
.brand strong, #business-city { display: block; }
.brand strong { letter-spacing: -.02em; }
#business-city { color: var(--muted); font-size: .79rem; }
.connection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: .79rem;
  font-weight: 650;
  color: var(--muted);
}
.connection::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: #b48a35; }
.connection[data-connected="true"] { color: #1c634e; }
.connection[data-connected="true"]::before { background: #2d956e; }

.workspace { padding-block: 37px 60px; }
h1 { font-size: clamp(2.3rem, 4vw, 3.2rem); line-height: 1.1; letter-spacing: -.055em; font-weight: 740; }
.desk { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 22px; align-items: stretch; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 10px #19223808; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 23px; min-height: 68px; border-bottom: 1px solid var(--line); }
h2 { font-size: 1.13rem; letter-spacing: -.025em; }
form { padding: 22px 23px 20px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
label { display: block; font-size: .88rem; font-weight: 650; }
.required { color: var(--accent); }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  min-height: 43px;
  border: 1px solid #cdd6e6;
  border-radius: 8px;
  background: #fcfdff;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 400;
}
input::placeholder, textarea::placeholder { color: #66738a; }
.description { margin-top: 17px; }
textarea { min-height: 112px; resize: vertical; }
:where(input, select, textarea, button, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; align-items: center; }
.button { border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-size: .87rem; font-weight: 650; }
.button:disabled { opacity: .63; cursor: default; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 18px; min-height: 44px; padding: 9px 15px; background: var(--accent); color: white; }
.primary:not(:disabled):hover { background: var(--accent-dark); }
.primary span { font-size: 1.08rem; line-height: 1; }
.secondary, .quiet { padding: 7px 11px; min-height: 34px; }
.secondary { color: var(--accent-dark); border-color: #dbe3fd; background: var(--accent-light); }
.secondary:not(:disabled):hover { background: #e0e8ff; }
.quiet { color: var(--muted); background: transparent; }
.quiet:not(:disabled):hover { background: var(--canvas); color: var(--ink); }
.message:not(:empty) { margin-top: 10px; color: var(--muted); font-size: .85rem; }
.message[data-error="true"] { color: #9d2b2b; }

.preview-panel { display: flex; flex-direction: column; overflow: hidden; }
.preview-body {
  display: grid;
  align-items: center;
  flex: 1;
  min-height: 360px;
  background: radial-gradient(circle, #d4dfef 1px, transparent 1px) 0 0 / 18px 18px, #f8faff;
  padding: 20px;
}
.empty-state { text-align: center; padding: 28px 10px; }
.empty-state p { font-weight: 700; letter-spacing: -.02em; font-size: 1.04rem; }
.empty-state small { display: block; max-width: 32ch; margin: 6px auto 0; color: var(--muted); font-size: .86rem; }
.paper-art {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 88px;
  height: 110px;
  margin: 0 auto 24px;
  padding: 18px 13px;
  border: 1px solid #d6e0f5;
  border-radius: 9px;
  background: white;
  box-shadow: 7px 7px 0 #e1e8fc, 0 8px 20px #283a6b0a;
  transform: rotate(-6deg);
}
.paper-art span { display: block; height: 4px; border-radius: 4px; background: #e5ebf6; }
.paper-art .paper-title { width: 40%; height: 6px; margin-bottom: 4px; background: #99aef4; }
.paper-art .paper-total { width: 42%; margin-top: 5px; margin-left: auto; background: #99aef4; }

.quote { align-self: start; min-width: 0; padding: 24px; background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 20px #1922380a; overflow-wrap: anywhere; }
.quote-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding-bottom: 16px; border-bottom: 2px solid var(--accent); }
.quote-header h3 { font-size: 1.4rem; line-height: 1.2; letter-spacing: -.04em; }
.quote-contact, .quote-meta p, .quote-meta dl, .acceptance { color: var(--muted); font-size: .8rem; }
.quote-contact { margin-top: 5px; }
.quote-id { text-align: right; font-variant-numeric: tabular-nums; }
.quote-id span, .meta-label { display: block; color: var(--accent-dark); font-size: .69rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.quote-id strong { white-space: nowrap; font-size: .88rem; }
.quote-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; margin: 15px 0 19px; }
.quote-meta dl div { display: flex; justify-content: space-between; gap: 12px; }
.quote-meta dd { color: var(--ink); white-space: nowrap; }
.quote h4 { font-size: .9rem; margin-bottom: 4px; }
.quote-scope p, .quote-notes p { font-size: .87rem; white-space: pre-line; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: .81rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
thead { background: var(--canvas); color: var(--muted); }
th:nth-child(n+2), td:nth-child(n+2), tfoot th { text-align: right; white-space: nowrap; }
tfoot th { font-weight: 550; color: var(--muted); }
tfoot .total { background: var(--accent-light); color: var(--accent-dark); font-size: .95rem; font-weight: 700; }
tfoot .total th { color: inherit; font-weight: inherit; }
.quote-notes { margin-top: 14px; padding: 10px 12px; background: #fff7e7; border: 1px solid #f2dbab; border-radius: 8px; color: #754a0e; }
.acceptance { margin-top: 14px; }

@media (max-width: 1000px) {
  .topbar-inner, .workspace { width: calc(100% - 48px); }
  .desk { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
  .panel-header, form { padding-inline: 16px; }
  .preview-body { padding: 12px; }
  .quote { padding: 16px; }
}

@media (max-width: 790px) {
  .desk { grid-template-columns: 1fr; }
  .preview-body { min-height: 270px; }
}

@media (max-width: 420px) {
  .topbar-inner, .workspace { width: calc(100% - 28px); }
  .topbar-inner { min-height: 62px; }
  .workspace { padding-top: 24px; }
  .brand-mark { width: 34px; height: 34px; }
  .field-grid { grid-template-columns: 1fr; }
  .quote-meta { grid-template-columns: 1fr; }
  .quote-meta dl { max-width: 13rem; }
}

.account-actions { display: flex; align-items: center; gap: 12px; }
.sign-in { width: min(460px, calc(100% - 32px)); padding-top: clamp(35px, 10vh, 110px); }
.sign-in-heading { padding: 24px 25px 0; }
.sign-in-heading p { margin-top: 7px; color: var(--muted); }
.sign-in form { padding: 22px 25px 26px; }
.sign-in label + label { margin-top: 15px; }
.sign-in .primary { margin-top: 20px; width: 100%; }
.workspace-nav { display: flex; gap: 5px; margin-bottom: 18px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.nav-button { border: 0; border-radius: 8px; padding: 8px 14px; background: transparent; color: var(--muted); cursor: pointer; font-size: .92rem; font-weight: 650; }
.nav-button:hover, .nav-button[aria-current="page"] { background: var(--accent-light); color: var(--accent-dark); }
.nav-button:disabled { opacity: .6; cursor: default; }
.panel-header h1 { font-size: 1.24rem; letter-spacing: -.028em; }
.code-label, .rate-code { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 650; }
.rate-code { display: block; margin-top: 2px; font-size: .72rem; }

.edit-desk { grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr); align-items: start; }
.editor-panel textarea { min-height: 82px; }
.editor-lines-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.editor-line { min-width: 0; margin: 0; padding: 12px 0 9px; border: 0; border-bottom: 1px solid var(--line); }
.line-title { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.line-title .button { margin-bottom: 4px; }
.line-fields { display: grid; grid-template-columns: .85fr minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px; margin-top: 9px; }
.line-fields input, .line-fields select { padding-inline: 8px; }
.line-billing { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 12px; margin-top: 9px; }
.line-billing label { flex: 0 1 11rem; }
.line-fields select:disabled { opacity: 1; background: var(--canvas); color: var(--muted); }
.line-amount { display: block; margin-top: 6px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; }
.add-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin-top: 12px; }
.add-item button { min-height: 43px; }
.editor-panel .form-actions { flex-wrap: wrap; }

.catalogue-desk { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; gap: 20px; }
#rate-form > label + label, #rate-form .field-grid, #rate-form .checkbox { margin-top: 14px; }
#rate-form .primary { margin-top: 16px; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: 17px; min-height: 0; height: 17px; margin: 0; accent-color: var(--accent); }
.list-message:not(:empty) { margin: 14px 23px; color: var(--muted); }
.list-message[data-error="true"] { color: #9d2b2b; }
.rates-table, .history-table { margin: 0 23px 18px; }
.rates-table table, .history-table table { font-size: .87rem; }
.rates-table td, .rates-table th, .history-table td, .history-table th { padding-inline: 10px; }
.history-table td:nth-child(2), .history-table th:nth-child(2) { text-align: left; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 860px) {
  .catalogue-desk { grid-template-columns: 1fr; gap: 14px; }
  .rates-table, .history-table { margin-inline: 16px; }
}
@media (max-width: 790px) {
  .edit-desk { grid-template-columns: 1fr; }
}
@media (max-width: 470px) {
  .workspace-nav { margin-bottom: 12px; }
  .account-actions { gap: 5px; }
  .account-actions .button { padding-inline: 6px; }
  .connection { gap: 5px; padding-inline: 7px; font-size: .72rem; }
  .line-fields { grid-template-columns: minmax(0, .8fr) minmax(0, 1.15fr) minmax(0, 1fr); }
  .line-fields label { font-size: .78rem; }
  .line-fields input, .line-fields select { padding-inline: 5px; }
}

@page { size: A4; margin: 17mm; }
.sign-in { width: min(1020px, calc(100% - 64px)); display: grid; align-items: center; grid-template-columns: 1.2fr 1fr; gap: clamp(30px, 6vw, 80px); }
.welcome h1 { max-width: 11ch; font-size: clamp(2.8rem, 6vw, 5.3rem); }
.welcome > p:not(.welcome-brand) { max-width: 36ch; margin-top: 15px; color: var(--muted); }
.welcome-brand { margin-bottom: 13px; color: var(--accent-dark); font-size: .76rem; font-weight: 750; letter-spacing: .12em; }
.welcome ul { list-style: none; padding: 0; margin: 26px 0 0; color: var(--muted); }
.welcome li { margin-top: 6px; }
.welcome li::before { content: "✓"; display: inline-block; width: 22px; color: var(--accent-dark); font-weight: 700; }
.sign-in-heading h1 { font-size: 1.8rem; }
.sign-in form { padding-bottom: 13px; }
.auth-switch { padding: 0 24px 19px; }
.auth-switch .button { padding-left: 0; }
.workspace-nav { overflow-x: auto; }
.trial-usage { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; padding: 10px 13px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 9px; background: #eef4fe; font-size: .88rem; }
.trial-usage span { color: var(--muted); }
.billing-view { max-width: 640px; }
.billing-view h2 { margin-top: 0; }
.billing-view .panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.customer-table small { display: block; color: var(--muted); margin-top: 4px; }
.customer-table td:last-child { white-space: nowrap; }
.customer-page { padding: 0 24px; }
.account-session { padding: 0 24px 16px; }
#payment-terms summary, #payment-history summary { cursor: pointer; margin-bottom: 12px; }
.quote-response { margin-top: 24px; padding: 16px 0 0; border-top: 1px solid var(--line); }
.quote-response h4 { margin: 0 0 12px; }
.quote-response .form-actions { margin-top: 12px; }
.data-notice { padding: clamp(20px, 4vw, 42px); max-width: 760px; margin: auto; }
.data-notice h1 { margin-block: 16px; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.data-notice h2 { margin-top: 20px; }
.data-notice p { margin-top: 8px; }
.nav-button { white-space: nowrap; }
.voice-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.voice-file { display: inline-flex; align-items: center; cursor: pointer; }
.voice-file input { width: 1px; min-height: 1px; height: 1px; padding: 0; opacity: 0; margin: 0; }
.voice-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-panel { max-width: 850px; }
.password-form { border-top: 1px solid var(--line); }
.password-form .field-grid { margin-top: 12px; }
.admin-stats { display: flex; flex-wrap: wrap; gap: 16px 38px; padding: 24px; }
.admin-stats dt { color: var(--muted); }
.admin-stats dd { font-size: 1.9rem; font-weight: 750; }
.help-text { color: var(--muted); font-size: .88rem; }
#invoice-form .field-grid { margin-top: 14px; }
#import-form, #logo-form, #payment-instructions-form { border-top: 1px solid var(--line); }
#payment-instructions-form .help-text { margin: 6px 0 14px; }
#invoice-notes:not(:empty) { margin-block: 7px 12px; }
.invoice-row { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; padding: 12px; }
.invoice-row .help-text { margin: 5px 0 10px; overflow-wrap: anywhere; }
.invoice-row .price-review { color: #93401b; font-weight: 650; }
.quote { --quote-accent: var(--accent); }
.quote .quote-header { border-color: var(--quote-accent); }
.quote .quote-id span, .quote .meta-label, .quote tfoot .total { color: var(--quote-accent); }
.quote tfoot .total { background: color-mix(in srgb, var(--quote-accent) 9%, white); }
.quote-logo { display: block; max-width: 150px; max-height: 64px; margin-bottom: 10px; object-fit: contain; object-position: left; }
.profile-logo { margin: 10px 0; }
.compact-quote { padding: 16px; }
.compact-quote th, .compact-quote td { padding-block: 5px; }
.quote-terms { margin-top: 14px; }
.quote-terms p { font-size: .83rem; white-space: pre-line; }
.share-options { border-top: 1px solid var(--line); margin-top: 13px; padding-top: 12px; }
.share-options a { text-decoration: none; }
.share-workspace { max-width: 810px; }
.share-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-bottom: 12px; }
.share-toolbar a { text-decoration: none; }
.share-workspace .quote h1 { font-size: 1.55rem; }
.quote-payment { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.quote-payment dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 8px 14px; margin-top: 8px; }
.quote-payment dt, .quote-payment small { color: var(--muted); font-size: .8rem; }
.quote-payment dd { margin: 0; overflow-wrap: anywhere; }
.quote-payment-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 14px; overflow-wrap: anywhere; }
.quote-payment-link a { text-decoration: none; }
@media (max-width: 720px) {
  .sign-in { grid-template-columns: 1fr; gap: 24px; padding-top: 34px; }
  .welcome h1 { max-width: 16ch; font-size: 2.7rem; }
  .welcome ul { display: none; }
}
@media print {
  .share-toolbar { display: none !important; }
}
@media print {
  :root { background: white; }
  .topbar, .workspace-nav, .trial-usage, #new-view, #quotes-view, #rates-view, .editor-panel, .preview-header { display: none !important; }
  .workspace, .desk, .preview-panel, .preview-body, .quote { display: block; width: 100%; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: white; overflow: visible; }
  .table-wrap { overflow: visible; }
  .quote { print-color-adjust: exact; }
  .quote-header, .quote-meta, tr, .quote-notes { break-inside: avoid; }
  thead { display: table-header-group; }
  tfoot { display: table-row-group; }
}
