/* ============================= BUILDER CHROME ============================= */
:root {
  --bg: #EDEFF3;
  --surface: #FFFFFF;
  --surface-2: #F5F6F9;
  --ink: #14171C;
  --ink-muted: #5C616B;
  --ink-faint: #8A8F99;
  --border: #DDE1E8;
  --border-2: #E9ECF1;
  --accent: #155E52;
  --accent-ink: #FFFFFF;
  --accent-soft: #E2EEEC;
  --accent-hover: #0F4A40;
  --money: #B0702B;
  --money-soft: #F5E9DA;
  --danger: #B23B2B;
  --danger-soft: #F7E6E2;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-1: 0 1px 2px rgba(20, 23, 28, .05), 0 1px 1px rgba(20, 23, 28, .04);
  --shadow-2: 0 10px 30px -14px rgba(20, 23, 28, .35);
  --font-ui: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-mark: 'Fraunces', serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161A;
    --surface: #1B1E23;
    --surface-2: #20242A;
    --ink: #EDEFF3;
    --ink-muted: #A4AAB4;
    --ink-faint: #6D7280;
    --border: #2C3038;
    --border-2: #252932;
    --accent: #4FA094;
    --accent-ink: #07110E;
    --accent-soft: #1E2C29;
    --accent-hover: #63B5A8;
    --money: #D79A5B;
    --money-soft: #2C2318;
    --danger: #E08874;
    --danger-soft: #2E1D1A;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 10px 30px -14px rgba(0, 0, 0, .6);
  }
}

:root[data-theme="dark"] {
  --bg: #14161A;
  --surface: #1B1E23;
  --surface-2: #20242A;
  --ink: #EDEFF3;
  --ink-muted: #A4AAB4;
  --ink-faint: #6D7280;
  --border: #2C3038;
  --border-2: #252932;
  --accent: #4FA094;
  --accent-ink: #07110E;
  --accent-soft: #1E2C29;
  --accent-hover: #63B5A8;
  --money: #D79A5B;
  --money-soft: #2C2318;
  --danger: #E08874;
  --danger-soft: #2E1D1A;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 10px 30px -14px rgba(0, 0, 0, .6);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

button {
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.qf-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- rail ---- */
.qf-rail {
  width: 220px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.qf-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px;
}

.qf-brand .mark {
  font-family: var(--font-mark);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.01em;
}

.qf-brand .mark em {
  font-style: normal;
  color: var(--money);
}

.qf-brand .sub {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.qf-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qf-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s, color .12s;
}

.qf-nav button svg {
  width: 16px;
  height: 16px;
  flex: none;
  opacity: .85;
}

.qf-nav button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.qf-nav button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.qf-nav .cnt {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 20px;
}

.qf-nav button.active .cnt {
  color: var(--accent);
  background: rgba(0, 0, 0, .04);
}

.qf-rail-foot {
  margin-top: auto;
  padding: 10px 8px;
  border-top: 1px solid var(--border-2);
  font-size: 11px;
  color: var(--ink-faint);
}

.qf-rail-foot .status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4C9A6A;
  margin-right: 6px;
}

/* ---- main ---- */
.qf-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.qf-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}

.qf-topbar h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}

.qf-topbar .hint {
  font-size: 12px;
  color: var(--ink-faint);
}

.qf-topbar .spacer {
  flex: 1;
}

.qf-topbar .btn {
  margin-left: 0;
}

.qf-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.qf-form-col {
  width: 44%;
  max-width: 620px;
  min-width: 380px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 22px 24px 80px;
}

.qf-preview-col {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--surface-2);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- form kit ---- */
.field-group {
  margin-bottom: 18px;
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row>* {
  flex: 1;
}

label.f-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

input.f-input,
textarea.f-input,
select.f-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--ink);
}

input.f-input:disabled {
  background: var(--surface-2);
  color: var(--ink-faint);
}

textarea.f-input {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}

input.f-input:focus,
textarea.f-input:focus,
select.f-input:focus {
  border-color: var(--accent);
}

.f-note {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 5px;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.section-card>.sc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-card>.sc-head h3 {
  font-size: 12.5px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-muted);
  font-weight: 600;
}

.section-card>.sc-head .sc-desc {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.qf-h2 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qf-h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* repeatable rows */
.rep-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.rep-row .rr-fields {
  flex: 1;
  display: flex;
  gap: 8px;
}

.rep-row .rr-fields.stacked {
  flex-direction: column;
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--danger);
  border-color: var(--danger-soft);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.logo-placeholder-icon {
  color: var(--ink-faint);
  display: flex;
}

.logo-placeholder-icon svg {
  width: 22px;
  height: 22px;
}

.add-row-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px dashed transparent;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.add-row-btn:hover {
  filter: brightness(0.97);
}

.add-row-btn svg {
  width: 14px;
  height: 14px;
}

/* items table (quotation) */
.items-table {
  width: 100%;
  font-size: 12.5px;
}

/* each item is two lines: the description across the full width, then the
   numeric fields — so long product names (e.g. from an Excel import) and
   larger quantities both stay readable in the narrow form column */
.items-table,
.items-table thead,
.items-table tbody {
  display: block;
}

.items-table tr {
  display: grid;
  grid-template-columns: 70px 54px 64px minmax(0, 1fr) minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: center;
}

.items-table .col-desc,
.items-table tbody td:first-child {
  grid-column: 1 / -1;
}

.items-table tbody tr {
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border-2);
}

.items-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-faint);
  padding: 0 0 2px;
  font-weight: 600;
}

.items-table td {
  padding: 0;
  min-width: 0;
}

.items-table input {
  padding: 6px 7px;
  font-size: 12.5px;
  width: 100%;
  min-width: 0;
}

.items-table input[type=number] {
  -moz-appearance: textfield;
}

.items-table input[type=number]::-webkit-inner-spin-button,
.items-table input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}







.calc-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.calc-summary .cs-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--ink-muted);
}

.calc-summary .cs-row.total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 9px;
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
  border-top: none;
  margin-top: 0;
  padding-top: 4px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 4px;
}

.checkbox-row input {
  width: 15px;
  height: 15px;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn svg {
  width: 14px;
  height: 14px;
}

.btn:hover {
  background: var(--surface-2);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* .btn:hover would otherwise win and swap in the grey surface color */
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}

.btn-ghost {
  border-color: transparent;
  background: none;
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* preview toolbar */
.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.preview-toolbar .grp {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-name {
  font-size: 12.5px;
  font-weight: 600;
}

.spacer {
  flex: 1;
}

/* doc render surface wrapper */
.doc-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  overflow: auto;
  flex: 1;
  display: flex;
  justify-content: center;
}

.doc-scale-wrap {
  transform-origin: top center;
}

/* history */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.history-item .hi-swatch {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex: none;
}

.history-item .hi-main {
  flex: 1;
  min-width: 0;
}

.history-item .hi-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .hi-sub {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

.history-item .hi-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--money);
  font-size: 13px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-faint);
}

.empty-state svg {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  opacity: .5;
}

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  box-shadow: var(--shadow-2);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn .18s ease-out;
}

.toast.err {
  background: var(--danger);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--ink-muted);
}

/* ---- saved extra bank accounts / GSTINs ---- */
.saved-extra {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.saved-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 0 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
}

.saved-head:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* ---- excel import ---- */
.import-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.import-confirm {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.import-confirm .ic-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- onboarding ---- */
.qf-help-link {
  margin-top: auto;
  align-self: flex-start;
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.qf-help-link:hover {
  background: var(--accent-soft);
}

.qf-help-link + .qf-rail-foot {
  margin-top: 0;
}

.qf-onboard {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 23, 28, .55);
  animation: toastIn .2s ease-out;
}

.qf-onboard[hidden] {
  display: none;
}

.qf-onboard-card {
  width: min(960px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qf-onboard-head h2 {
  margin: 0 0 4px;
  font-family: var(--font-mark);
  font-weight: 600;
  font-size: 24px;
}

.qf-onboard-head h2 em {
  font-style: normal;
  color: var(--money);
}

.qf-onboard-head p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.qf-onboard-demo {
  display: block;
  align-self: center;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 290px);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.qf-onboard-warn {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--money-soft);
  color: var(--money);
  font-size: 12.5px;
  font-weight: 500;
}

.qf-onboard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .qf-rail {
    display: none;
  }

  .qf-body {
    flex-direction: column;
  }

  .qf-form-col {
    width: 100%;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}