.qt { padding: 22px 0 10px; }
.qt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 22px; align-items: start; }
.qt label, .qt .qt-lbl { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.qt input, .qt select, .qt textarea { width: 100%; font: inherit; font-size: 15px; border: 1px solid #ddd6cb; border-radius: 10px; padding: 8px 10px; background: #fff; color: var(--text); min-height: 42px; box-sizing: border-box; }
.qt textarea { min-height: 64px; resize: vertical; }
.qt input:focus, .qt select:focus, .qt textarea:focus { outline: 3px solid rgba(245, 158, 11, .35); border-color: var(--gold); }
.qt input[type=color] { padding: 3px; height: 42px; }
.qt input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: #d97706; }
.qt-sec { border: 1px solid var(--line); border-radius: 14px; background: var(--card); margin-bottom: 12px; padding: 0 16px; }
.qt-sec > summary { cursor: pointer; font-weight: 800; padding: 14px 0; display: flex; align-items: center; gap: 10px; list-style: none; }
.qt-sec > summary::-webkit-details-marker { display: none; }
.qt-sec > summary .qt-n { width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #1f1d1a; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.qt-sec > summary .qt-s { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.qt-sec > summary::after { content: "▾"; color: var(--muted); }
.qt-sec[open] > summary::after { content: "▴"; }
.qt-in { padding: 0 0 16px; }
.qt-g2, .qt-g3, .qt-g4 { display: grid; gap: 10px; }
.qt-g2 { grid-template-columns: 1fr 1fr; }
.qt-g3 { grid-template-columns: repeat(3, 1fr); }
.qt-g4 { grid-template-columns: repeat(4, 1fr); }
.qt-g2 > *, .qt-g3 > *, .qt-g4 > * { min-width: 0; }
.qt-mt { margin-top: 10px; }
.qt-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.qt-tpls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.qt-tpls button { border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 6px; cursor: pointer; font: inherit; font-weight: 800; font-size: 12px; text-align: center; min-width: 0; }
.qt-tpls button[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 6px 16px rgba(245, 158, 11, .25); }
.qt-tpls i { display: block; height: 40px; border-radius: 6px; margin-bottom: 5px; border: 1px solid #eee; }
.qt-tpls .qt-i1 { background: linear-gradient(#fff 0 8px, #111 8px 10px, #fff 10px 18px, #111 18px 23px, #fff 23px 28px, #f3f4f6 28px); }
.qt-tpls .qt-i2 { background: linear-gradient(var(--acc, #4338ca) 0 13px, #fff 13px 30px, var(--acc, #4338ca) 30px); }
.qt-tpls .qt-i3 { background: linear-gradient(90deg, var(--acc, #0f766e) 0 30%, #fff 30%); }
.qt-tpls .qt-i4 { background: repeating-linear-gradient(#fff 0 9px, #e5e7eb 9px 10px); }
.qt-tpls .qt-i5 { background: linear-gradient(135deg, #f59e0b, #ea580c) 0 0 / 100% 14px no-repeat, linear-gradient(#fff, #fff); }
.qt-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.qt-toggles label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); font-weight: 600; margin: 0; cursor: pointer; }
.qt-rows { display: flex; flex-direction: column; gap: 8px; }
/* item on two lines: the name gets the full width · qty, unit, rate, amount, optional, ↑, ✕ below */
.qt-row { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, .9fr) minmax(0, 1fr) minmax(0, 1.1fr) auto 36px 36px; gap: 6px; align-items: center; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.qt-row .qt-nm { grid-column: 1 / -1; grid-row: 1; }
.qt-row.qt-ro { background: #fff7ed; border-radius: 10px; padding: 6px; }
.qt-row.qt-rh { border-bottom: 0; padding-bottom: 0; }
.qt-row.qt-rh .qt-nm { grid-column: 1; }
.qt-row.qt-rh { grid-template-columns: minmax(0, 1fr) auto 36px 36px; }
.qt-row.qt-rh .qt-nm { font-weight: 800; background: #f6f3ee; }
.qt-rtag { font-size: 12px; font-weight: 800; color: var(--muted); padding: 0 6px; }
.qt-amt { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt .qt-optbox { display: flex; align-items: center; gap: 5px; margin: 0; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.qt-x { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--muted); font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.qt-x:hover { color: #b42318; border-color: #f0c4be; }
.qt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.qt-chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.qt-chips button:hover { border-color: var(--gold); color: var(--text); }
.qt-upl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qt-upl img { width: 42px; height: 42px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qt-upl .qt-ph { width: 42px; height: 42px; border: 1px dashed #cfc6b8; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #a9a196; font-size: 12px; flex: none; }
.qt .qt-upbtn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid #ddd6cb; border-radius: 10px; background: var(--soft); font-weight: 700; font-size: 14px; color: var(--text); cursor: pointer; margin: 0; white-space: nowrap; font-family: inherit; }
.qt .qt-upbtn[hidden], .qt [hidden] { display: none !important; }
.qt-side { position: sticky; top: 12px; }
.qt-pv { background: #e9e6e0; border-radius: 16px; padding: 14px; }
.qt-pvbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 12.5px; font-weight: 800; color: var(--muted); letter-spacing: .4px; }
.qt-pvwrap { overflow: hidden; border-radius: 4px; }
.qt-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.qt-acts .btn { padding: 10px 14px; font-size: 14px; }
.qt-acts .btn.soft { color: var(--text); }
.qt-acts .qt-inv { border: 2px solid #4338ca; color: #312e81; background: #eef2ff; }
.qt-msg { min-height: 20px; font-size: 13px; font-weight: 700; color: var(--ok); margin-top: 8px; white-space: pre-line; }
.qt-msg.qt-err { color: #b42318; }
.qt-saved { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 12px 14px; }
.qt-saved .qt-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 240px; overflow: auto; }
.qt-saved .qt-it { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; font-size: 13.5px; }
.qt-saved .qt-it span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-saved .qt-it button { border: 1px solid var(--line); background: var(--soft); border-radius: 8px; padding: 4px 9px; font: inherit; font-size: 12.5px; cursor: pointer; }
.qt-empty { color: var(--muted); font-size: 13px; }
.qt-mbar { display: none; }

/* ===== the quotation paper ===== */
.qt-paper { --acc: #4338ca; width: 816px; min-height: 1056px; background: #fff; color: #1f2937; font: 13px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; padding: 44px 48px 36px; position: relative; transform-origin: top left; box-shadow: 0 1px 3px rgba(0,0,0,.08); box-sizing: border-box; }
.qt-paper.qt-a4 { width: 794px; min-height: 1123px; }
.qt-paper * { box-sizing: border-box; }
.qt-paper table { width: 100%; border-collapse: collapse; }
.qt-paper td, .qt-paper th { padding: 6px 8px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.qt-paper .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qt-paper .mu { color: #6b7280; }
.qt-paper .ad { font-size: 12px; color: #6b7280; white-space: pre-line; overflow-wrap: anywhere; }
.qt-co { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.qt-co img { max-width: 110px; max-height: 60px; object-fit: contain; }
.qt-co .nm { font-size: 19px; font-weight: 900; line-height: 1.2; overflow-wrap: anywhere; }
.qt-to { min-width: 0; overflow-wrap: anywhere; }
.qt-to .lb { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: #6b7280; font-weight: 700; margin-bottom: 2px; }
.qt-to b { font-size: 14px; }
.qt-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 18px 0; }
.qt-two > * { min-width: 0; }
.qt-kv { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.qt-kv div { display: flex; gap: 8px; font-size: 12.5px; max-width: 100%; }
.qt-kv span { color: #6b7280; flex: none; }
.qt-kv b { overflow-wrap: anywhere; text-align: right; }
.qt-subj { font-weight: 800; font-size: 14px; margin: 0 0 10px; overflow-wrap: anywhere; }
.qt-items th { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.qt-items .qt-sechead td { font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; padding-top: 12px; }
.qt-items .qt-isopt td { color: #6b7280; }
.qt-opt { display: inline-block; border: 1px solid #fed7aa; background: #fff7ed; color: #c2410c; border-radius: 999px; padding: 0 7px; font-size: 9.5px; font-weight: 800; letter-spacing: .4px; vertical-align: 1px; }
.qt-tot { width: 55% !important; margin: 10px 0 0 auto; }
.qt-tot td { padding: 4px 8px; }
.qt-tot .qt-grand td { border-top: 2px solid #111; font-size: 15px; font-weight: 900; padding-top: 7px; }
.qt-tot .qt-optrow td { color: #c2410c; font-size: 12px; font-style: italic; }
.qt-big { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; font-weight: 900; font-size: 17px; }
.qt-terms { margin-top: 20px; font-size: 12px; }
.qt-terms div { white-space: pre-line; color: #374151; overflow-wrap: anywhere; }
.qt-notes { margin-top: 12px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 9px 12px; font-size: 12px; white-space: pre-line; overflow-wrap: anywhere; }
.qt-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 34px; }
.qt-sign > div { font-size: 11px; color: #6b7280; min-width: 0; }
.qt-sign .qt-sl { border-bottom: 1px solid #9ca3af; min-height: 26px; color: #1f2937; font-size: 12.5px; font-weight: 700; padding-bottom: 3px; margin-bottom: 4px; overflow-wrap: anywhere; }
.qt-foot { margin-top: 26px; text-align: center; font-size: 10.5px; color: #9ca3af; }

/* A — classic */
.qt-t-classic .qt-top { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 12px; }
.qt-t-classic .qt-tt { font-size: 23px; font-weight: 900; letter-spacing: 2px; text-align: right; flex: none; }
.qt-t-classic .qt-tt small { display: block; font-size: 12px; letter-spacing: 0; color: #6b7280; font-weight: 600; }
.qt-t-classic .qt-items th { background: #111; color: #fff; }
.qt-t-classic .qt-items tbody tr:nth-child(even) td { background: #f3f4f6; }
.qt-t-classic .qt-items .qt-sechead td { background: #fff !important; border-bottom: 1px solid #111; }
/* B — modern */
.qt-t-modern { padding-top: 0; }
.qt-t-modern .qt-head { margin: 0 -48px; padding: 24px 48px; background: var(--acc); color: var(--acc-ink, #fff); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.qt-t-modern .qt-head .qt-tt { font-size: 24px; font-weight: 900; letter-spacing: 1px; flex: none; }
.qt-t-modern .qt-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0 0; }
.qt-t-modern .qt-chips div { background: var(--acc-tint, #eef2ff); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.qt-t-modern .qt-chips small { display: block; color: var(--acc-txt, #4338ca); font-weight: 800; font-size: 10px; text-transform: uppercase; }
.qt-t-modern .qt-chips b { overflow-wrap: anywhere; }
.qt-t-modern .qt-chips .qt-valid { background: #fef3c7; }
.qt-t-modern .qt-chips .qt-valid small { color: #92400e; }
.qt-t-modern .qt-from { text-align: right; }
.qt-t-modern .qt-items th { color: var(--acc-txt, #4338ca); border-bottom: 2px solid var(--acc-line, #c7d2fe); }
.qt-t-modern .qt-items td { border-bottom: 1px solid #e5e7eb; }
.qt-t-modern .qt-items .qt-sechead td { color: var(--acc-txt, #4338ca); }
.qt-t-modern .qt-big { background: var(--acc); color: var(--acc-ink, #fff); border-radius: 12px; padding: 14px 18px; }
/* C — side bar */
.qt-t-sidebar { padding: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); }
.qt-t-sidebar .qt-sbar { background: var(--acc); color: var(--acc-ink, #fff); padding: 34px 18px; font-size: 12px; overflow-wrap: anywhere; }
.qt-t-sidebar .qt-sbar img { max-width: 120px; max-height: 64px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; margin-bottom: 10px; display: block; }
.qt-t-sidebar .qt-sbar .nm { font-weight: 900; font-size: 16px; margin-bottom: 6px; }
.qt-t-sidebar .qt-sbar small { display: block; text-transform: uppercase; font-size: 9.5px; letter-spacing: 1px; color: var(--acc-ink2, rgba(255,255,255,.85)); margin-top: 12px; font-weight: 700; }
.qt-t-sidebar .qt-sbar div { white-space: pre-line; }
.qt-t-sidebar .qt-main { padding: 34px 32px 30px; min-width: 0; }
.qt-t-sidebar .qt-tt { font-size: 26px; font-weight: 900; color: var(--acc-txt, #0f766e); margin-bottom: 4px; }
.qt-t-sidebar .qt-to { margin: 12px 0 16px; }
.qt-t-sidebar .qt-items th { background: var(--acc-tint, #f0fdfa); color: var(--acc-txt, #0f766e); }
.qt-t-sidebar .qt-items td { border-bottom: 1px dashed #d1d5db; }
.qt-t-sidebar .qt-tot { width: 65% !important; }
.qt-t-sidebar .qt-tot .qt-grand td { background: var(--acc); color: var(--acc-ink, #fff); border-top: 0; }
/* D — minimal */
.qt-t-minimal { padding: 54px 56px 40px; }
.qt-t-minimal .qt-mlogo { max-width: 120px; max-height: 54px; object-fit: contain; display: block; margin-bottom: 14px; }
.qt-t-minimal .qt-tt { font-size: 32px; font-weight: 300; letter-spacing: 7px; }
.qt-t-minimal .qt-no { color: #9ca3af; margin-bottom: 26px; }
.qt-t-minimal .qt-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 22px; }
.qt-t-minimal .qt-three > div { min-width: 0; overflow-wrap: anywhere; }
.qt-t-minimal .qt-three small { display: block; color: #9ca3af; text-transform: uppercase; font-size: 9.5px; letter-spacing: 1.5px; margin-bottom: 3px; }
.qt-t-minimal .qt-items th { color: #9ca3af; font-weight: 600; letter-spacing: 1px; border-bottom: 1px solid #e5e7eb; }
.qt-t-minimal .qt-items td { border-bottom: 1px solid #f3f4f6; }
.qt-t-minimal .qt-big { display: block; text-align: right; font-weight: 300; }
.qt-t-minimal .qt-big small { color: #9ca3af; text-transform: uppercase; letter-spacing: 1.5px; font-size: 10px; font-weight: 600; }
.qt-t-minimal .qt-big div { font-size: 30px; }
/* E — proposal */
.qt-t-proposal { padding-top: 0; }
.qt-t-proposal .qt-cover { margin: 0 -48px 6px; padding: 26px 48px; background: var(--acc); color: var(--acc-ink, #fff); }
.qt-t-proposal .qt-cover .qt-tt { font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--acc-ink2, rgba(255,255,255,.88)); font-weight: 800; }
.qt-t-proposal .qt-cover h2 { margin: 4px 0 2px; font-size: 23px; line-height: 1.25; overflow-wrap: anywhere; }
.qt-t-proposal .qt-co .nm { font-size: 15px; }
.qt-t-proposal .qt-lines { border-top: 2px solid var(--acc-line, #fed7aa); }
.qt-t-proposal .qt-sec { font-weight: 900; color: var(--acc-txt, #c2410c); text-transform: uppercase; font-size: 11px; letter-spacing: 1px; margin: 14px 0 4px; }
.qt-t-proposal .qt-li { display: grid; grid-template-columns: minmax(0, 1fr) auto 110px; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--acc-tint, #ffedd5); }
.qt-t-proposal .qt-li > span:first-child { overflow-wrap: anywhere; }
.qt-t-proposal .qt-big { border: 2px solid var(--acc); color: var(--acc-txt, #c2410c); border-radius: 12px; padding: 12px 16px; }

@media (max-width: 960px) {
  .qt-grid { grid-template-columns: minmax(0, 1fr); }
  .qt-side { position: static; }
  .qt-mbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #1f1d1a; color: #fff; padding: 10px 16px; align-items: center; gap: 12px; box-shadow: 0 -6px 20px rgba(0,0,0,.2); }
  .qt-mbar small { opacity: .75; display: block; font-size: 11.5px; }
  .qt-mbar b { font-size: 18px; color: var(--gold-hi); }
  .qt-mbar .btn { margin-left: auto; padding: 9px 14px; font-size: 14px; }
  body { padding-bottom: 64px; }
}
@media (max-width: 640px) {
  .qt-g3, .qt-g4 { grid-template-columns: 1fr 1fr; }
  .qt-tpls { grid-template-columns: repeat(3, 1fr); }
  .qt-toggles { grid-template-columns: 1fr; }
  .qt-sec { padding: 0 12px; }
  /* item: name on top · qty, unit, rate, ↑, ✕ · amount and Optional below */
  .qt-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 36px 36px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
  .qt-row .qt-nm { grid-column: 1 / -1; grid-row: 1; }
  .qt-row [data-f="q"] { grid-column: 1; grid-row: 2; }
  .qt-row [data-f="u"] { grid-column: 2; grid-row: 2; }
  .qt-row [data-f="r"] { grid-column: 3; grid-row: 2; }
  .qt-row [data-up] { grid-column: 4; grid-row: 2; }
  .qt-row [data-del] { grid-column: 5; grid-row: 2; }
  .qt-row .qt-amt { grid-column: 1 / 3; grid-row: 3; text-align: left; }
  .qt-row .qt-optbox { grid-column: 3 / -1; grid-row: 3; justify-content: flex-end; }
  .qt-row.qt-rh .qt-nm { grid-column: 1; }
  .qt-row.qt-rh [data-up] { grid-column: 2; grid-row: 1; }
  .qt-row.qt-rh [data-del] { grid-column: 3; grid-row: 1; }
  .qt-row.qt-rh { grid-template-columns: minmax(0, 1fr) 36px 36px; }
  .qt-row.qt-rh .qt-rtag { display: none; }
  }
@media print {
  @page { margin: 0; }
  body { padding: 0 !important; background: #fff; }
  body > *:not(main), main > *:not(.qt), .qt-form, .qt-pvbar, .qt-acts, .qt-msg, .qt-saved, .qt-mbar, .pagehead { display: none !important; }
  .qt, .qt-grid, .qt-side, .qt-pv, .qt-pvwrap { display: block !important; padding: 0 !important; margin: 0 !important; background: #fff !important; overflow: visible !important; height: auto !important; }
  .qt-paper { transform: none !important; box-shadow: none; margin: 0 auto; }
  .qt-paper, .qt-paper * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* html2canvas measures text with a hidden div on <body>; site.css makes img a block */
body > div[style*="hidden"] > img { display: inline !important; }
