:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fd;
  --text: #172033;
  --muted: #667085;
  --muted-light: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --navy: #171a3a;
  --navy-soft: #252952;
  --primary: #6366e7;
  --primary-dark: #4f46c8;
  --primary-soft: #eef0ff;
  --coral: #f26b5e;
  --coral-soft: #fff0ed;
  --teal: #0ca6a0;
  --teal-soft: #e7f9f7;
  --amber: #e99a16;
  --amber-soft: #fff7e6;
  --green: #16845b;
  --green-soft: #e9f8f1;
  --danger: #d33f49;
  --danger-soft: #fff0f1;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 4px 14px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 14px 36px rgba(16, 24, 40, 0.09);
  --shadow-lg: 0 26px 70px rgba(16, 24, 40, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --focus: 0 0 0 4px rgba(99, 102, 231, 0.16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 95% 0%, rgba(99, 102, 231, 0.08), transparent 28rem),
    radial-gradient(circle at 0% 35%, rgba(12, 166, 160, 0.06), transparent 25rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.42; }
svg { display: block; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.16; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Controls */
input, textarea, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  padding: 0.72rem 0.82rem;
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

textarea { min-height: 118px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #a0a8b7; }
input:hover, textarea:hover, select:hover { border-color: #aeb5c2; }
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: var(--focus);
}

label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
  color: #344054;
  font-size: 0.79rem;
  font-weight: 750;
}

.optional {
  color: var(--muted-light);
  font-size: 0.67rem;
  font-weight: 650;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0.64rem 0.92rem;
  font-weight: 760;
  font-size: 0.82rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:focus-visible, .icon-button:focus-visible, .input-action:focus-visible, a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.button-primary {
  color: #fff;
  background: linear-gradient(135deg, #7274ef, var(--primary-dark));
  box-shadow: 0 8px 20px rgba(79, 70, 200, 0.22);
}
.button-primary:hover:not(:disabled) { box-shadow: 0 10px 24px rgba(79, 70, 200, 0.30); }
.button-secondary {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: #dcdfff;
}
.button-secondary:hover:not(:disabled) { background: #e4e6ff; }
.button-ghost {
  color: #344054;
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.button-ghost:hover:not(:disabled) { background: #f9fafb; border-color: #b9c0cc; }
.button-dark {
  color: #fff;
  background: var(--navy);
  box-shadow: 0 8px 20px rgba(23, 26, 58, 0.18);
}
.button-dark:hover:not(:disabled) { background: #23274f; }
.button-add {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 7px 18px rgba(12, 166, 160, 0.20);
}
.button-add:hover:not(:disabled) { background: #078f89; }
.button-full { width: 100%; }
.button-large { min-height: 50px; font-size: 0.9rem; }
.button-small { min-height: 38px; padding: 0.55rem 0.76rem; }
.button-compact { min-height: 38px; padding: 0.55rem 0.75rem; font-size: 0.76rem; }

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
  font-size: 1.35rem;
  line-height: 1;
}
.icon-button:hover { color: var(--text); background: var(--surface-soft); }

.eyebrow {
  margin-bottom: 0.42rem;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.field-error {
  min-height: 1.1rem;
  margin: 0.38rem 0 0;
  color: var(--danger);
  font-size: 0.76rem;
  font-weight: 700;
}

/* Login */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background:
    radial-gradient(circle at 18% 8%, rgba(99, 102, 231, 0.22), transparent 28rem),
    radial-gradient(circle at 92% 92%, rgba(242, 107, 94, 0.18), transparent 25rem),
    #eef1f8;
}

.login-shell {
  width: min(100%, 1040px);
  min-height: 630px;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.login-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: clamp(2rem, 5vw, 4.2rem);
  color: #fff;
  background:
    linear-gradient(155deg, rgba(99, 102, 231, 0.96), rgba(23, 26, 58, 0.98) 64%, #101225);
}

.visual-grid {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255,255,255,0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.25) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.visual-orb { position: absolute; border-radius: 50%; filter: blur(1px); }
.visual-orb-one {
  width: 300px;
  height: 300px;
  top: -85px;
  right: -70px;
  background: linear-gradient(145deg, rgba(242,107,94,0.95), rgba(233,154,22,0.78));
  box-shadow: 0 0 90px rgba(242,107,94,0.35);
}
.visual-orb-two {
  width: 190px;
  height: 190px;
  left: -80px;
  bottom: 90px;
  background: rgba(12,166,160,0.72);
  box-shadow: 0 0 85px rgba(12,166,160,0.35);
}

.visual-content { position: relative; z-index: 1; max-width: 470px; }
.login-brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 2rem;
  border: 1px solid rgba(255,255,255,0.32);
  border-radius: 17px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 800;
}
.visual-kicker {
  margin-bottom: 0.7rem;
  color: #c9cbff;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.visual-content h2 {
  max-width: 450px;
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4vw, 3.1rem);
  letter-spacing: -0.045em;
}
.visual-content > p:not(.visual-kicker) {
  max-width: 430px;
  color: rgba(255,255,255,0.72);
  font-size: 0.94rem;
}
.visual-feature-list { display: grid; gap: 0.7rem; margin-top: 2rem; }
.visual-feature-list span { display: flex; align-items: center; gap: 0.68rem; font-size: 0.8rem; font-weight: 700; }
.visual-feature-list i {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
}
.visual-feature-list i::after { content: ""; width: 6px; height: 3px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translateY(-1px); }

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4.3rem);
}
.login-mobile-brand { display: none; }
.login-panel h1 { margin-bottom: 0.7rem; font-size: clamp(2rem, 4vw, 2.7rem); letter-spacing: -0.045em; }
.login-copy { margin-bottom: 2rem; color: var(--muted); font-size: 0.9rem; }
.login-form { display: grid; gap: 1rem; }
.password-row { position: relative; }
.password-row input { padding-right: 4.5rem; }
.input-action {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  min-width: 54px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 0.72rem;
  font-weight: 800;
}
.security-note {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 1.6rem;
  padding: 0.9rem;
  border: 1px solid #e5e7ff;
  border-radius: 13px;
  background: #f8f8ff;
}
.security-note svg { flex: 0 0 auto; width: 19px; height: 19px; fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.security-note strong, .security-note span { display: block; }
.security-note strong { margin-bottom: 0.15rem; font-size: 0.72rem; }
.security-note span { color: var(--muted); font-size: 0.68rem; line-height: 1.45; }

/* App shell */
.app-shell { min-height: 100vh; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.4rem;
  border-bottom: 1px solid rgba(228,231,236,0.86);
  background: rgba(255,255,255,0.90);
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 12px rgba(16,24,40,0.03);
}
.brand { display: inline-flex; align-items: center; gap: 0.72rem; color: var(--text); text-decoration: none; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--coral), var(--primary));
  box-shadow: 0 8px 20px rgba(99,102,231,0.24);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.86rem;
  font-weight: 850;
}
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 0.9rem; }
.brand-copy small { margin-top: 0.02rem; color: var(--muted); font-size: 0.64rem; }
.header-actions { display: flex; align-items: center; gap: 0.55rem; }

.page-wrap { width: min(100%, 1580px); margin: 0 auto; padding: 1.7rem clamp(1rem, 2.6vw, 2.4rem) 3rem; }
.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.4rem;
}
.intro h1 { margin-bottom: 0.45rem; font-size: clamp(1.75rem, 3vw, 2.45rem); letter-spacing: -0.045em; }
.intro-copy > p:last-child { margin-bottom: 0; color: var(--muted); font-size: 0.9rem; }
.status-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.58rem 0.8rem;
  border: 1px solid #c9eadc;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 0.72rem;
  font-weight: 800;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(22,132,91,0.11); }
.status-pill.is-saving { color: #986108; background: var(--amber-soft); border-color: #f2d9a4; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr); gap: 1.5rem; align-items: start; }
.editor-column { display: grid; gap: 1rem; min-width: 0; }
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }

.editor-actions {
  position: sticky;
  top: 82px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  border-color: #dfe2ea;
  box-shadow: 0 10px 30px rgba(16,24,40,0.08);
}
.action-summary { display: grid; min-width: 120px; padding: 0.15rem 0.6rem; }
.action-summary span { color: var(--muted); font-size: 0.63rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.action-summary strong { margin-top: 0.05rem; color: var(--navy); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }

#quoteForm { display: grid; gap: 1rem; }
.form-section { position: relative; overflow: hidden; padding: clamp(1.15rem, 2.5vw, 1.55rem); }
.form-section::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--section-color, var(--primary)); }
.section-customer { --section-color: var(--primary); --section-soft: var(--primary-soft); }
.section-info { --section-color: var(--coral); --section-soft: var(--coral-soft); }
.section-items { --section-color: var(--teal); --section-soft: var(--teal-soft); }
.section-charges { --section-color: var(--amber); --section-soft: var(--amber-soft); }
.section-notes { --section-color: #8b5cf6; --section-soft: #f4efff; }

.section-heading, .section-heading-main { display: flex; align-items: flex-start; gap: 0.85rem; }
.section-heading { margin-bottom: 1.25rem; }
.section-heading-actions { justify-content: space-between; gap: 1rem; }
.section-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--section-color, var(--primary));
  background: var(--section-soft, var(--primary-soft));
}
.section-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.section-step { margin-bottom: 0.1rem; color: var(--section-color, var(--primary)); font-size: 0.62rem; font-weight: 850; letter-spacing: 0.09em; text-transform: uppercase; }
.section-heading h2 { margin-bottom: 0.23rem; font-size: 1.08rem; letter-spacing: -0.015em; }
.section-heading p:last-child { margin-bottom: 0; color: var(--muted); font-size: 0.76rem; }

.form-grid { display: grid; gap: 1rem; }
.form-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { min-width: 0; }
.input-suffix {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-xs);
}
.input-suffix:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.input-suffix input { border: 0; border-radius: 0; box-shadow: none !important; }
.input-suffix span { padding: 0 0.8rem; color: var(--muted); font-size: 0.75rem; font-weight: 750; }
.calculated-note {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
  padding: 0.72rem 0.85rem;
  border: 1px solid #ffe1db;
  border-radius: 11px;
  color: #8f4039;
  background: var(--coral-soft);
  font-size: 0.75rem;
}
.calculated-note svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Editor tables */
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.editor-table { width: 100%; min-width: 690px; border-collapse: collapse; table-layout: fixed; }
.editor-table th, .editor-table td { padding: 0.68rem 0.58rem; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: middle; }
.editor-table th { color: var(--muted); background: #f8f9fb; font-size: 0.63rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.editor-table tbody tr:last-child td { border-bottom: 0; }
.editor-table tbody tr:hover { background: #fbfcff; }
.editor-table th:first-child, .editor-table td:first-child { width: 42px; text-align: center; color: var(--muted); font-size: 0.75rem; font-weight: 800; }
.editor-table th:nth-child(3), .editor-table td:nth-child(3) { width: 78px; }
.editor-table th:nth-child(4), .editor-table td:nth-child(4) { width: 126px; }
.editor-table th:nth-child(5), .editor-table td:nth-child(5) { width: 122px; text-align: right; }
.editor-table th:last-child, .editor-table td:last-child { width: 50px; text-align: center; }
.editor-table input { min-height: 40px; padding: 0.55rem 0.62rem; border-color: #dde1e8; box-shadow: none; }
.line-total { color: var(--navy); font-size: 0.82rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.remove-row-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #ffd9dc;
  border-radius: 9px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}
.remove-row-button:hover:not(:disabled) { background: #ffe0e3; border-color: #ffbdc3; }
.charges-table { min-width: 510px; }
.charges-table th:first-child, .charges-table td:first-child { width: auto; text-align: left; }
.charges-table th:nth-child(2), .charges-table td:nth-child(2) { width: 155px; text-align: left; }
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1.15rem;
  border: 1px dashed #d5dae3;
  border-radius: 14px;
  color: var(--muted);
  background: #fafbfc;
}
.empty-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--amber); background: var(--amber-soft); font-size: 1.1rem; font-weight: 900; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 0.08rem; color: #475467; font-size: 0.78rem; }
.empty-state div > span { font-size: 0.7rem; }

.limitations { overflow: hidden; border-radius: 16px; box-shadow: none; }
.limitations summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  color: #475467;
  cursor: pointer;
  list-style: none;
  font-size: 0.76rem;
  font-weight: 780;
}
.limitations summary::-webkit-details-marker { display: none; }
.limitations summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform 150ms ease; }
.limitations[open] summary svg { transform: rotate(180deg); }
.limitations-content { padding: 0 1rem 1rem; color: var(--muted); font-size: 0.72rem; }
.limitations-content p { margin-bottom: 0.5rem; }
.limitations-content p:last-child { margin-bottom: 0; }

/* Preview */
.preview-column { position: sticky; top: 84px; min-width: 0; }
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.72rem;
  padding: 0.68rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}
.preview-toolbar-title { display: flex; align-items: center; gap: 0.65rem; }
.preview-toolbar-title span, .preview-toolbar-title strong { display: block; }
.preview-toolbar-title div > span { color: var(--muted); font-size: 0.62rem; }
.preview-toolbar-title strong { font-size: 0.8rem; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px rgba(12,166,160,0.12); }
.quote-sheet {
  position: relative;
  overflow: hidden;
  min-height: 790px;
  display: flex;
  flex-direction: column;
  border: 1px solid #dfe3ea;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-md);
}
.quote-accent-bar { height: 7px; background: linear-gradient(90deg, var(--coral) 0 34%, var(--amber) 34% 54%, var(--teal) 54% 74%, var(--primary) 74%); }
.quote-header {
  min-height: 148px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.35rem, 3.2vw, 2rem);
  color: #fff;
  background:
    radial-gradient(circle at 16% 10%, rgba(99,102,231,0.38), transparent 14rem),
    linear-gradient(135deg, #171a3a, #222750 75%, #2b2d60);
}
.quote-brand-block { display: flex; align-items: flex-start; gap: 0.8rem; min-width: 0; }
.quote-logo { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.24); border-radius: 12px; background: rgba(255,255,255,0.10); font-family: Georgia, "Times New Roman", serif; font-size: 0.78rem; font-weight: 800; }
.quote-brand-name { margin-bottom: 0.42rem; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.35rem, 3.2vw, 1.85rem); font-weight: 700; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.quote-brand-contact { display: grid; gap: 0.08rem; color: rgba(255,255,255,0.67); font-size: 0.66rem; }
.quote-title-block { flex: 0 0 auto; text-align: right; }
.quote-title-block h2 { margin: 0.43rem 0 0.1rem; font-size: clamp(1.7rem, 4vw, 2.35rem); letter-spacing: 0.1em; }
.quote-title-block > div:last-child { color: rgba(255,255,255,0.70); font-size: 0.75rem; font-weight: 800; }
.draft-badge { display: inline-block; padding: 0.27rem 0.5rem; border: 1px solid rgba(255,255,255,0.20); border-radius: 999px; color: #ffe1a8; background: rgba(255,255,255,0.08); font-size: 0.56rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.quote-body { flex: 1; padding: clamp(1.3rem, 3.2vw, 2rem); }
.quote-meta-grid { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 1.5rem; margin-bottom: 1.6rem; }
.prepared-for { display: grid; justify-items: start; gap: 0.14rem; }
.quote-label { margin-bottom: 0.5rem; color: var(--primary); font-size: 0.58rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.prepared-for strong { margin-bottom: 0.12rem; color: var(--navy); font-size: 1rem; }
.prepared-for span:not(.quote-label) { color: var(--muted); font-size: 0.69rem; overflow-wrap: anywhere; }
.is-placeholder { color: #a0a8b7 !important; }
.date-list { display: grid; gap: 0.58rem; margin: 0; }
.date-list div { display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.65rem 0.72rem; border: 1px solid #eceef3; border-radius: 10px; background: #fafbfc; }
.date-list dt { color: var(--muted); font-size: 0.62rem; }
.date-list dd { margin: 0; color: #344054; font-size: 0.65rem; font-weight: 820; text-align: right; }
.quote-table-wrap { overflow-x: auto; border: 1px solid #e6e9ef; border-radius: 12px; }
.quote-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.quote-table th, .quote-table td { padding: 0.72rem 0.55rem; border-bottom: 1px solid #eceef2; vertical-align: top; }
.quote-table th { color: #667085; background: #f7f8fa; font-size: 0.56rem; font-weight: 820; letter-spacing: 0.075em; text-transform: uppercase; text-align: left; }
.quote-table th:first-child, .quote-table td:first-child { width: 49%; }
.quote-table th:not(:first-child), .quote-table td:not(:first-child) { text-align: right; }
.quote-table td { color: #344054; font-size: 0.67rem; overflow-wrap: anywhere; }
.quote-table td:first-child { color: #253047; font-weight: 740; }
.quote-table tbody:last-child tr:last-child td { border-bottom: 0; }
.adjustment-rows tr:first-child td { border-top: 2px solid #dde1e8; }
.adjustment-rows td { color: #8c5c08; background: #fffaf0; }
.adjustment-label { display: inline-flex; align-items: center; gap: 0.35rem; }
.adjustment-label::before { content: "Adjust"; padding: 0.15rem 0.3rem; border-radius: 999px; color: #9a6507; background: #fff0c9; font-size: 0.43rem; font-weight: 850; letter-spacing: 0.05em; text-transform: uppercase; }
.totals-panel { width: min(100%, 315px); margin: 1.2rem 0 1.6rem auto; padding: 0.95rem 1rem; border: 1px solid #e5e7ee; border-radius: 14px; background: #f8f9fb; }
.totals-panel dl { display: grid; gap: 0.48rem; margin: 0; }
.totals-panel dl > div { display: flex; justify-content: space-between; gap: 1rem; }
.totals-panel dt, .totals-panel dd { font-size: 0.68rem; }
.totals-panel dt { color: var(--muted); }
.totals-panel dd { margin: 0; color: #344054; font-weight: 820; font-variant-numeric: tabular-nums; }
.totals-panel .grand-total-row { align-items: center; margin: 0.25rem -0.35rem -0.35rem; padding: 0.8rem 0.35rem 0.35rem; border-top: 1px solid #dfe3ea; }
.totals-panel .grand-total-row dt { color: var(--navy); font-weight: 850; }
.totals-panel .grand-total-row dd { color: var(--primary-dark); font-size: 1.2rem; font-weight: 900; }
.quote-text-section { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e7eaf0; }
.quote-text-section h3 { margin-bottom: 0.4rem; color: var(--navy); font-size: 0.66rem; font-weight: 850; letter-spacing: 0.09em; text-transform: uppercase; }
.quote-text-section p { margin-bottom: 0; color: var(--muted); font-size: 0.67rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.quote-footer { padding: 1rem 1.5rem; border-top: 1px solid #e7eaf0; color: #697386; background: #fafbfc; text-align: center; font-family: Georgia, "Times New Roman", serif; font-size: 0.72rem; }

/* Modal and toast */
.settings-dialog { width: min(94vw, 760px); max-height: 90vh; padding: 0; border: 0; border-radius: 22px; background: #fff; box-shadow: 0 32px 90px rgba(16,24,40,0.28); }
.settings-dialog::backdrop { background: rgba(16,24,40,0.66); backdrop-filter: blur(5px); }
.settings-dialog form { display: flex; flex-direction: column; max-height: 90vh; }
.modal-header, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.3rem; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-title-wrap { display: flex; align-items: center; gap: 0.8rem; }
.modal-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--primary); background: var(--primary-soft); }
.modal-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.modal-header h2 { margin-bottom: 0; font-size: 1.15rem; }
.modal-header .eyebrow { margin-bottom: 0.13rem; }
.modal-body { display: grid; gap: 1rem; padding: 1.2rem 1.3rem; overflow-y: auto; background: #fbfcfd; }
.settings-group, .password-fieldset { display: grid; gap: 1rem; margin: 0; padding: 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.settings-group-heading h3 { margin-bottom: 0.18rem; font-size: 0.9rem; }
.settings-group-heading p { margin-bottom: 0; color: var(--muted); font-size: 0.72rem; }
.password-fieldset legend { padding: 0 0.35rem; color: var(--text); font-size: 0.9rem; font-weight: 820; }
.password-fieldset > p:not(.field-error) { margin-bottom: 0; color: var(--muted); font-size: 0.71rem; }
.modal-actions { justify-content: flex-end; border-top: 1px solid var(--line); background: #fff; }
.toast { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; width: min(calc(100vw - 2rem), 390px); padding: 0.9rem 1rem; border-radius: 12px; color: #fff; background: var(--navy); box-shadow: 0 18px 50px rgba(16,24,40,0.28); font-size: 0.78rem; font-weight: 720; }
.toast.is-error { background: #a52d36; }

/* Responsive */
@media (max-width: 1240px) {
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(390px, 0.82fr); }
  .form-grid-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1020px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-column { position: static; }
  .quote-sheet { min-height: 0; }
  .editor-actions { top: 78px; }
}

@media (max-width: 760px) {
  .login-shell { min-height: 0; grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { padding: 2rem 1.35rem; }
  .login-mobile-brand { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 2rem; }
  .login-mobile-brand strong, .login-mobile-brand small { display: block; }
  .login-mobile-brand strong { font-size: 0.88rem; }
  .login-mobile-brand small { color: var(--muted); font-size: 0.62rem; }

  .app-header { height: 62px; padding: 0 0.85rem; }
  .brand-copy small { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .header-actions .button { min-height: 36px; padding: 0.5rem 0.65rem; }
  .header-actions .button svg { width: 15px; height: 15px; }
  .page-wrap { padding: 1.2rem 0.85rem 2.5rem; }
  .intro { align-items: flex-start; }
  .intro h1 { font-size: 1.7rem; }
  .intro-copy > p:last-child { font-size: 0.8rem; }
  .status-pill { margin-top: 0.2rem; }
  .editor-actions { position: static; display: grid; gap: 0.65rem; }
  .action-summary { display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0.2rem; }
  .action-summary strong { font-size: 1.1rem; }
  .action-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-buttons .button { width: 100%; }
  .form-grid-two, .form-grid-four, .quote-meta-grid { grid-template-columns: 1fr; }
  .notes-grid { grid-template-columns: 1fr; }
  .section-heading-actions { align-items: flex-start; }
  .section-heading-actions > .button { flex: 0 0 auto; }
  .quote-header { padding: 1.25rem; }
  .quote-body { padding: 1.15rem; }
  .date-list { max-width: 100%; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .date-list div { display: grid; gap: 0.2rem; }
  .date-list dd { text-align: left; }
}

@media (max-width: 680px) {
  .intro { display: grid; gap: 0.75rem; }
  .status-pill { justify-self: start; }
  .section-heading-actions { display: grid; }
  .section-heading-actions > .button { justify-self: start; }
  .table-scroll { overflow: visible; border: 0; background: transparent; }
  .editor-table, .editor-table tbody { display: block; min-width: 0; width: 100%; }
  .editor-table thead { display: none; }
  .editor-table tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 2.6rem 0.85rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-xs);
  }
  .editor-table tr:last-child { margin-bottom: 0; }
  .editor-table td { display: block; width: auto !important; padding: 0; border: 0; text-align: left !important; }
  .editor-table td::before { display: block; margin-bottom: 0.3rem; color: var(--muted); font-size: 0.6rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
  .items-table td:nth-child(1) { position: absolute; top: 0.8rem; left: 0.85rem; display: grid; place-items: center; width: 25px !important; height: 25px; border-radius: 7px; color: var(--teal); background: var(--teal-soft); font-size: 0.67rem; }
  .items-table td:nth-child(2) { grid-column: 1 / -1; }
  .items-table td:nth-child(2)::before { content: "Item or service"; }
  .items-table td:nth-child(3)::before { content: "Quantity"; }
  .items-table td:nth-child(4)::before { content: "Unit price"; }
  .items-table td:nth-child(5) { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding-top: 0.7rem; border-top: 1px solid #edf0f4; }
  .items-table td:nth-child(5)::before { content: "Line total"; margin: 0; }
  .items-table td:nth-child(6) { position: absolute; top: 0.65rem; right: 0.7rem; }
  .charges-table tr { padding-top: 0.85rem; }
  .charges-table td:nth-child(1) { grid-column: 1 / -1; }
  .charges-table td:nth-child(1)::before { content: "Description"; }
  .charges-table td:nth-child(2) { grid-column: 1 / -1; }
  .charges-table td:nth-child(2)::before { content: "Amount"; }
  .charges-table td:nth-child(3) { position: absolute; top: 0.65rem; right: 0.7rem; }
  .charges-table td:nth-child(1) input { padding-right: 2.8rem; }
}

@media (max-width: 480px) {
  .header-actions .button span { display: none; }
  .header-actions .button { width: 36px; padding: 0; }
  .brand-copy strong { font-size: 0.82rem; }
  .intro h1 { font-size: 1.55rem; }
  .form-section { padding: 1rem; border-radius: 17px; }
  .section-icon { width: 38px; height: 38px; }
  .section-heading h2 { font-size: 1rem; }
  .section-heading p:last-child { font-size: 0.7rem; }
  .button-add { width: 100%; }
  .preview-toolbar { align-items: center; }
  .preview-toolbar .button span { display: none; }
  .preview-toolbar .button { width: 38px; padding: 0; }
  .quote-header { gap: 0.8rem; }
  .quote-logo { display: none; }
  .quote-brand-name { font-size: 1.22rem; }
  .quote-title-block h2 { font-size: 1.55rem; }
  .quote-table th, .quote-table td { padding: 0.62rem 0.35rem; }
  .quote-table th { font-size: 0.48rem; }
  .quote-table td { font-size: 0.58rem; }
  .quote-table th:first-child, .quote-table td:first-child { width: 44%; }
  .date-list { grid-template-columns: 1fr 1fr; }
  .totals-panel { width: 100%; }
  .settings-dialog { width: 96vw; border-radius: 18px; }
  .modal-header, .modal-actions { padding: 1rem; }
  .modal-body { padding: 1rem; }
}

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .no-print, .login-view, .toast, dialog { display: none !important; }
  .app-shell, .page-wrap, .workspace, .preview-column { display: block !important; width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .quote-sheet { width: 210mm; min-height: 297mm; border: 0; border-radius: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .quote-accent-bar, .quote-header, .quote-table th, .quote-footer, .totals-panel, .adjustment-rows td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
