:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f9fafb; --border: #e4e7ec; --border-strong: #d0d5dd;
  --text: #101828; --muted: #667085; --faint: #98a2b3; --accent: #1f2937; --accent-text: #ffffff;
  --gold: #60a036; --ok: #12b76a; --ok-bg: #ecfdf3; --err: #d92d20; --err-bg: #fef3f2; --info-bg: #f2f4f7;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, sans-serif; }
h1 { font-size: 40px; font-weight: 500; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 18px; font-weight: 600; margin: 0; }
h3 { font-size: 16px; font-weight: 600; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.caps, .small-caps { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.num { text-align: right; }
[hidden] { display: none !important; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.brand-mark { color: var(--gold); }
.topbar-right { display: flex; gap: 12px; align-items: center; }

.page { max-width: 1280px; margin: 0 auto; padding: 32px 24px 64px; }
.lead { color: var(--muted); max-width: 640px; font-size: 15px; margin-bottom: 28px; }
.layout { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 28px; align-items: start; }
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; } h1 { font-size: 30px; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.analyze { padding: 22px; position: sticky; top: 76px; }
@media (max-width: 920px) { .analyze { position: static; } }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.label { display: block; font-weight: 500; margin: 14px 0 6px; color: var(--th-info-text, #344054); }
.label.caps { color: var(--muted); }

.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--th-line-2, #98a2b3); box-shadow: 0 0 0 3px rgba(152, 162, 179, .2); }
.input.sm { height: 34px; padding: 0 10px; }
select.input { appearance: none; padding-right: 30px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E") no-repeat right 10px center; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { opacity: .4; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn { height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--btn-fill, linear-gradient(135deg, #c7dd4a, #96cc76)); color: var(--btn-ink, #1d2f10); border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--btn-fill-hover, linear-gradient(135deg, #d3e66b, #a7d68a)); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; height: 44px; margin-top: 20px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn { border: 1px solid transparent; background: transparent; border-radius: var(--radius-sm); width: 34px; height: 34px;
  display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--info-bg); color: var(--text); }

.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
  min-height: 250px; display: grid; cursor: pointer; position: relative; overflow: hidden; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--th-line-2, #98a2b3); background: var(--th-paper-2, #f2f4f7); }
.dz-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--th-info-text, #344054); padding: 20px; text-align: center; }
.dz-empty svg { color: var(--muted); margin-bottom: 4px; }
.dz-empty .muted { font-size: 12px; }
.dz-preview { display: flex; flex-direction: column; }
.dz-preview img { max-height: 280px; width: 100%; object-fit: contain; background: var(--th-paper, #fff); padding: 8px; }
.dz-pdf { height: 200px; display: grid; place-items: center; font-weight: 700; font-size: 28px; color: var(--err); }
.dz-clear { position: absolute; top: 8px; right: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.dz-name { padding: 8px 12px; border-top: 1px solid var(--border); font-size: 13px; background: var(--surface);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ok { color: var(--ok); }

.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0 10px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-error { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--err-bg); color: var(--err); font-size: 13px; }

/* results */
.empty-results { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 48px 24px; text-align: center; background: var(--surface); }
.job { margin-bottom: 10px; }
.job-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.job-head:hover { background: var(--surface-2); }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--info-bg); flex: none;
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--err); border: 1px solid var(--border); }
.job-meta { flex: 1; min-width: 0; }
.job-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-sub.err { color: var(--err); }
.badge { font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 6px; background: var(--info-bg); border: 1px solid var(--border); }
.badge.done { background: var(--ok-bg); color: var(--th-ok-text, #027a48); border-color: var(--th-ok-line, #abefc6); }
.badge.failed { background: var(--err-bg); color: var(--err); border-color: var(--th-danger-line, #fecdca); }
.badge.running { display: inline-flex; gap: 6px; align-items: center; }
.spinner { width: 12px; height: 12px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dur { font-size: 12px; color: var(--faint); min-width: 28px; text-align: right; }
.job-toggle { display: flex; justify-content: flex-end; margin: 6px 0; }

.quote { padding: 0; overflow: hidden; margin: 8px 0 16px; position: relative; }
.quote.busy::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .45); cursor: progress; }
.q-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; padding: 22px 24px; align-items: start; }
.q-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.q-title h2 { font-size: 21px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.q-id { font-size: 12px; padding: 2px 6px; background: var(--info-bg); border-radius: 4px; color: var(--muted); }
.q-line { display: flex; gap: 8px; align-items: center; margin-top: 6px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; color: var(--th-info-text, #475467); background: var(--surface); }
.chip.src { font-size: 11px; padding: 1px 6px; color: var(--muted); background: var(--surface-2); }
.q-total { text-align: right; }
.q-total .caps { color: var(--muted); }
.q-total .amount { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.q-desc { padding: 0 24px 18px; color: var(--muted); font-size: 13px; }
.q-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.q-actions .btn { height: 30px; font-size: 12px; padding: 0 12px; }
.q-total .amount { font-size: 28px; white-space: nowrap; }
.q-total { min-width: 0; }
.job-head { transition: background .2s; }
.job:has(.job-body:empty) .job-head:hover { background: var(--surface-2); }


.section { padding: 22px 24px; border-top: 1px solid var(--border); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.section-head .amt { font-weight: 600; }
.box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }

.metal-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 14px; padding: 14px 16px; align-items: end; }
.metal-row + .metal-row { border-top: 1px solid var(--border); }
.metal-row .caps { color: var(--muted); margin-bottom: 6px; display: block; }
.metal-row .val { font-weight: 500; height: 34px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comp-label { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--th-info-text, #344054); margin-bottom: -6px; }
.unit-input { display: flex; align-items: center; gap: 6px; }
.unit-input .input { text-align: right; max-width: 110px; }
.weights { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.weights b { color: var(--text); font-weight: 500; }
@media (max-width: 640px) { .metal-row { grid-template-columns: 1fr 1fr; } }

.stones { overflow-x: auto; }
.stone-grid { display: grid; grid-template-columns: minmax(150px, 1.6fr) 80px 90px minmax(120px, 1.1fr) minmax(100px, 1fr) 36px; gap: 12px; align-items: center; min-width: 640px; }
.stone-head { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.stone-row { padding: 12px 16px; }
.stone-row + .stone-row { border-top: 1px solid var(--border); }
.stone-row .input { height: 34px; }
.stone-row .center { text-align: center; }
.stone-meta { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.stone-cost { text-align: right; font-weight: 600; }
.stone-cost .small { display: block; font-weight: 400; color: var(--muted); }
.del { color: var(--faint); }
.del:hover { color: var(--err); background: var(--err-bg); }
.add-stone { margin-top: 12px; }
.empty-stones { padding: 18px 16px; color: var(--muted); }

.labor-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.money-input { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding-left: 10px; background: var(--surface); }
.money-input .input { border: 0; height: 34px; width: 120px; text-align: right; box-shadow: none; }
.breakdown { margin-top: 12px; font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.breakdown div { display: flex; justify-content: space-between; gap: 12px; max-width: 520px; }

.confidence { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.bar { width: 160px; height: 8px; background: var(--info-bg); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
details.notes { margin-top: 14px; font-size: 13px; }
details.notes summary { cursor: pointer; color: var(--th-info-text, #344054); font-weight: 500; }
details.notes ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.notice { margin-top: 10px; padding: 8px 12px; background: var(--th-gold-tint, #fffaeb); border: 1px solid var(--th-gold-line, #fedf89); color: var(--th-warn-text, #93370d); border-radius: var(--radius-sm); font-size: 12px; }
.snapshots { margin-top: 10px; display: grid; gap: 6px; }
.snap { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; width: min(920px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 40px rgba(16, 24, 40, .18); }
.modal-head { display: flex; justify-content: space-between; gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.modal-head p { margin-top: 4px; }
.modal-body { padding: 20px 24px 24px; }
.modal-body > .tab-panel > .muted { margin: 14px 0 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; padding: 8px 14px; border-radius: var(--radius-sm); font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; }
.tab.active { background: var(--info-bg); color: var(--text); }
.table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tr { padding: 10px 16px; align-items: center; }
.tr + .tr, #inv-rows .tr, #labor-rows .tr { border-top: 1px solid var(--border); }
.th { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; background: var(--surface-2); }
.inv-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr 120px 36px; gap: 12px; }
.labor-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr 36px; gap: 12px; }
.inv-grid-add { grid-template-columns: 1.2fr 1fr 1fr 120px auto; }
.labor-grid-add { grid-template-columns: 1.2fr 1fr 1fr 1fr auto; }
.add-row { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.add-row .input.num { text-align: right; }
.table-empty { padding: 26px; text-align: center; color: var(--muted); border-top: 1px solid var(--border); }
.labor-grid .input { height: 34px; text-align: right; }
@media (max-width: 680px) { .inv-grid, .labor-grid, .inv-grid-add, .labor-grid-add { grid-template-columns: 1fr 1fr; } }
.pref { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; cursor: pointer; }
.pref p { font-size: 13px; }
.toggle { appearance: none; width: 44px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--th-paper, #fff); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle:checked { background: var(--accent); }
.toggle:checked::after { transform: translateX(20px); }
.rates { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.rate { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; }
.rate b { display: block; font-size: 13px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--th-on-fill, #fff); padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 60; box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.toast.err { background: var(--err); }

/* confidence */
.bar.sm { width: 110px; height: 6px; }
.bar > i.lvl-high { background: var(--ok); }
.bar > i.lvl-mid, .bar > i.lvl-medium { background: #f79009; }
.bar > i.lvl-low { background: var(--err); }
.lvl-chip-high { background: var(--ok-bg); color: var(--th-ok-text, #027a48); border-color: var(--th-ok-line, #abefc6); }
.lvl-chip-medium { background: var(--th-gold-tint, #fffaeb); color: var(--th-warn-text, #b54708); border-color: var(--th-gold-line, #fedf89); }
.lvl-chip-low { background: var(--err-bg); color: var(--err); border-color: var(--th-danger-line, #fecdca); }
.confidence { flex-wrap: wrap; }
.cf-grid { display: grid; gap: 8px; margin-top: 10px; }
.cf-row { display: grid; grid-template-columns: minmax(150px, 220px) 110px 40px 1fr; gap: 10px; align-items: center; font-size: 12px; }
.cf-pct { font-family: "JetBrains Mono", monospace; text-align: right; }
.cf-note { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .cf-row { grid-template-columns: 1fr 80px 40px; } .cf-note { grid-column: 1 / -1; } }
.cf-tips-title { margin-top: 12px; font-weight: 500; color: var(--th-info-text, #344054); }
.cf-tips li { color: var(--th-info-text, #344054); }
.verify-line { display: flex; gap: 6px; align-items: center; margin-top: 4px; grid-column: 1 / -1; flex-wrap: wrap; }
.verify { display: inline-flex; gap: 5px; align-items: center; font-size: 11px; color: var(--muted); cursor: pointer; }
.verify input { margin: 0; accent-color: var(--accent); }

/* provenance & ranges */
.prov { display: inline-block; font-size: 10px; line-height: 1; padding: 3px 6px; border-radius: 999px; border: 1px solid var(--border); text-transform: lowercase; white-space: nowrap; }
.prov-declared { background: var(--th-ok-bg, #ecfdf3); color: var(--th-ok-text, #027a48); border-color: var(--th-ok-line, #abefc6); }
.prov-observed { background: var(--th-info-bg, #eff8ff); color: var(--th-info-text, #175cd3); border-color: var(--th-line, #b2ddff); }
.prov-computed { background: var(--th-paper-2, #f4f3ff); color: #5925dc; border-color: var(--th-line, #d9d6fe); }
.prov-inferred { background: var(--th-gold-tint, #fffaeb); color: var(--th-warn-text, #b54708); border-color: var(--th-gold-line, #fedf89); }
.prov-unknown { background: var(--err-bg); color: var(--err); border-color: var(--th-danger-line, #fecdca); }
.row-meta { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; min-height: 16px; }
.row-meta.center { justify-content: center; }
.trace { grid-column: 1 / -1; font-size: 11px; color: var(--faint); }
.span-all { grid-column: 1 / -1; }
.stone-cost .small + .small { margin-top: 2px; }
.q-range { font-size: 13px; color: var(--th-info-text, #344054); margin: 2px 0 4px; font-weight: 500; }
.status-firm { background: var(--ok-bg); color: var(--th-ok-text, #027a48); border-color: var(--th-ok-line, #abefc6); }
.status-indicative { background: var(--th-gold-tint, #fffaeb); color: var(--th-warn-text, #b54708); border-color: var(--th-gold-line, #fedf89); }
.blockers { margin: 0 24px 18px; padding: 12px 14px; border: 1px solid var(--th-gold-line, #fedf89); background: var(--th-gold-tint, #fffaeb); border-radius: var(--radius-sm); font-size: 13px; }
.blockers ul { margin: 8px 0 6px; padding-left: 18px; display: grid; gap: 6px; }
.blockers li span { display: block; }
.assumptions { display: grid; gap: 8px; font-size: 13px; }
.as-row { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.dir { margin-left: 6px; font-size: 12px; }
.dir-up { color: var(--err); } .dir-down { color: var(--th-ok-text, #027a48); }
.lb-comp, .lb-item { display: flex; justify-content: space-between; gap: 12px; max-width: 560px; }
.lb-item { padding-left: 14px; color: var(--faint); }
.metal-row { align-items: start; }

/* Design Finder look: gold palette, Outfit + Manrope */
:root {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f4f9ef; --border: #e3e9cb; --border-strong: #b4d089;
  --text: #20261a; --muted: #6a7462; --faint: #8f9e84; --accent: #6f9f4a; --accent-text: #305318;
  --gold: #6f9f4a; --info-bg: #f4f9ef; --radius: 18px; --radius-sm: 10px;
  --shadow: 0 14px 34px -22px rgba(50, 80, 31, .28);
  --serif: Outfit, Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
body { font: 14.5px/1.55 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font: 400 34px/1.1 var(--serif); letter-spacing: -.02em; }
h2, h3, .q-title h2 { font-family: var(--serif); font-weight: 500; }
.eyebrow { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 0 0 4px; }
.page { padding: 24px 24px 80px; }
.btn { border-radius: 999px; }
.btn.primary { background: var(--btn-fill, linear-gradient(135deg, #c7dd4a, #96cc76)); color: var(--btn-ink, #1d2f10); border-color: var(--accent); font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: var(--btn-fill-hover, linear-gradient(135deg, #d3e66b, #a7d68a)); }
.btn:hover:not(:disabled) { background: var(--th-gold-tint, #e9f2c2); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111, 159, 74, .18); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--th-gold-tint, #e9f2c2); }
.bar > i, .toggle:checked { background: var(--accent); }
.toast { background: #305318; }
.q-total .amount { font-family: var(--serif); font-weight: 500; }
/* phone widths: columns may shrink below their content; wide tables scroll inside their box */
.layout > *, .results, .job, .card, .quote, .section, .box { min-width: 0; }
.job-name, .job-sub { min-width: 0; }
@media (max-width: 600px) {
  .page { padding: 18px 16px 64px; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .analyze { padding: 16px; }
  .dropzone { min-height: 180px; }
  .q-head, .section { padding-left: 16px; padding-right: 16px; }
  .q-desc { padding: 0 16px 14px; }
  .blockers { margin: 0 16px 14px; }
  .q-total { text-align: left; }
  .metal-row { grid-template-columns: 1fr 1fr; padding: 12px; }
  .labor-line .money-input .input { width: 96px; }
  .breakdown div, .lb-comp, .lb-item { max-width: none; }
  .modal-body, .modal-head { padding-left: 16px; padding-right: 16px; }
}
.mine { margin-top: 14px; }
/* accessibility: readable small text, visible keyboard focus, quiet motion */
:root { --faint: #66705e; }
.eyebrow { color: var(--th-gold-text, #497929) !important; }
.dur, .trace, .lb-item, .stone-meta, .row-meta { color: var(--muted); }
:focus-visible { outline: 2px solid #497929; outline-offset: 2px; border-radius: 6px; }
.input:focus-visible { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
/* the form in three steps */
.step { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font: 600 15px/1.3 var(--serif); margin: 22px 0 8px; padding-top: 16px; border-top: 1px solid var(--border); }
form > .step:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.step > span { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--th-gold-tint-2, #d4e57a); color: var(--th-gold-text, #305318); font-size: 12px; font-weight: 700; }
.step small { font: 500 12px/1.3 Manrope, system-ui, sans-serif; color: var(--muted); }
.gen-bar { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }   /* the main button: in place, at the end of the form */
.gen-bar .btn.block { margin-top: 6px; }
.gen-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
#submit-btn:not(:disabled) + .gen-hint { display: none; }
/* quote summary line: the whole line is one button */
.job-head { padding: 0; gap: 0; }
.job-open { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 10px 12px; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: var(--radius); }
.job-open:disabled { cursor: default; }
.job-head .del { margin-right: 8px; }
.oc { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.hint-line { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.type-fields > div:not([hidden]) { grid-column: 1 / -1; }
.detect-note { margin: 14px 0 0; padding: 9px 12px; border-radius: 10px; background: var(--th-paper-2, #f3f6fc); border: 1px solid var(--th-line, #d7e0f0); color: var(--th-info-text, #2c4466); font-size: 12.5px; }
.detect-note.warn { background: var(--th-gold-tint, #fff6e8); border-color: var(--th-gold-line, #f2d5a0); color: var(--th-gold-text, #7a4b0c); }
.detect-note b { font-weight: 700; }
.prefill-note { margin: 14px 0 0; padding: 9px 12px; border-radius: 10px; background: var(--th-paper-2, #eef7ef); border: 1px solid var(--th-ok-line, #cfe6d2); color: var(--th-ok-text, #2f5f37); font-size: 12.5px; }
.known-stones { display: grid; gap: 8px; }
.ks-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 64px minmax(0, 1fr) 70px 30px; gap: 6px; align-items: center; }
.ks-row .input { height: 36px; padding: 0 8px; font-size: 13px; }
#add-known-stone { margin-top: 8px; }
.ks-head { font-size: 10.5px; color: var(--muted); margin-bottom: 4px; }
.ks-head:has(+ .known-stones:empty) { display: none; }
.measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.measure-grid .caps { color: var(--muted); display: block; margin-bottom: 6px; }
.measure-grid .input { height: 36px; }
@media (max-width: 600px) { .ks-row { grid-template-columns: minmax(0, 1fr) 56px 64px 30px; } .ks-row .ks-shape { display: none; }
  .known-stones .ks-row .ks-shape { display: none; } }   /* beats dropdowns.css "select:not([multiple]):not([size]) { display: inline-flex }" */
.piece-note { margin: 12px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--th-gold-tint, #f4f9ef); border: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.q-pic { flex: none; width: 88px; height: 88px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--th-paper-2, #f6f9f4); }
.q-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.q-main { flex: 1; min-width: 0; }
@media (max-width: 900px) { .q-head { grid-template-columns: auto minmax(0, 1fr); } .q-total { grid-column: 1 / -1; text-align: left; } }
@media (max-width: 600px) { .q-pic { width: 64px; height: 64px; } }
.q-pic.noimg { display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; }   /* picture didn't load (offline) */
.mine-list { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.mine-list button { flex: none; width: 64px; height: 64px; padding: 0; border-radius: 12px; border: 1.5px solid var(--border); background: var(--th-paper, #fff); overflow: hidden; cursor: pointer; }
.mine-list button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111, 159, 74, .25); }
.mine-list img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* phones: headings scale with the screen (320px → 720px) instead of staying at one size;
   form fields at 16px so iPhones don't zoom the page when one is tapped */
@media (max-width: 720px) {
  body h1 { font-size: clamp(20px, 16.8px + 1vw, 24px) !important; }   /* body: outranks ai-theme.css's fixed h1 */
  .q-title h2 { font-size: clamp(18px, 15.6px + .75vw, 21px); }
  .q-total .amount { font-size: clamp(22px, 17.2px + 1.5vw, 28px); }
  .dp-head h2 { font-size: clamp(17px, 15.4px + .5vw, 19px); }
  input, select, textarea { font-size: 16px; }
  html body :is(input, select, textarea, .input) { font-size: 16px; }   /* outranks ai-theme.css's field size */
}
/* phones: "1. Picture" as one full-width "Upload picture" button, like Social post's, instead of the big dashed box;
   "Pick one of your AI designs" full width under it (2026-11-18). Phones only. Tap, drag & drop and a chosen
   picture's preview work as before. html body … !important: outranks ui/ai-theme.css, which loads after this file. */
@media (max-width: 720px) {
  html body .dropzone:has(> .dz-empty:not([hidden])) { min-height: 0; border: 1px solid var(--line-strong, var(--border-strong)) !important;
    border-radius: 10px !important; background: var(--th-paper, #fff) !important; }
  html body .dropzone.drag:has(> .dz-empty:not([hidden])) { border: 1.5px dashed var(--gold, var(--accent)) !important; background: var(--gold-tint, var(--th-gold-tint, #e9f2c2)) !important; }
  html body .dz-empty { flex-direction: row; gap: 8px; padding: 10px 8px; color: var(--ink, var(--text)); }
  html body .dz-empty svg { width: 18px; height: 18px; margin: 0; color: currentColor; }
  html body .dz-empty strong, html body .dz-empty .muted { display: none; }
  html body .dz-empty::after { content: "Upload picture"; font-size: 13.5px; font-weight: 600; }
  html body .mine { margin-top: 8px; }
  html body .mine .dp-open { display: flex; width: 100%; justify-content: center; margin-top: 0; height: auto; padding: 9px 8px; font-size: 13px; }
}
/* phones: "Quotation settings" opens as a full settings page instead of a box over a dimmed page (2026-11-18). Phones only.
   A header bar (title + close) stays at the top while the settings scroll under it; the tabs are an underlined strip.
   html body … !important: outranks ui/ai-theme.css, which loads after this file. */
@media (max-width: 720px) {
  html body #settings-modal { padding: 0; place-items: stretch; background: var(--th-paper, var(--surface, #fff)); backdrop-filter: none; -webkit-backdrop-filter: none; }
  html body #settings-modal > .modal { width: 100%; height: 100%; max-height: none; border: 0 !important; border-radius: 0; box-shadow: none !important; overflow-y: auto; overscroll-behavior: contain; }
  html body #settings-modal .modal-head { position: sticky; top: 0; z-index: 2; align-items: center; gap: 10px; padding: 10px 12px; background: var(--th-paper, var(--surface, #fff)); }
  html body #settings-modal .modal-head h2 { font-size: 16px; margin: 0; }
  html body #settings-modal .modal-head p { font-size: 11.5px; margin-top: 2px; line-height: 1.4; }
  html body #settings-modal #close-settings { flex: none; width: 34px; height: 34px; }
  html body #settings-modal .modal-body { padding: 0 12px 24px; }
  html body #settings-modal .tabs { flex-wrap: nowrap; gap: 0; margin: 0 -12px 4px; padding: 0 12px; overflow-x: auto; scrollbar-width: none;
    background: var(--th-paper, var(--surface, #fff)); border-bottom: 1px solid var(--line, var(--border)); }
  html body #settings-modal .tabs::-webkit-scrollbar { display: none; }
  html body #settings-modal .tab { flex: 1 0 auto; padding: 11px 10px 10px; border-radius: 0 !important; border: 0 !important; border-bottom: 2px solid transparent !important;
    background: none !important; box-shadow: none !important; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
  html body #settings-modal .tab[aria-selected="true"] { color: var(--accent-ink, var(--text)) !important; border-bottom-color: var(--gold, var(--accent)) !important; }
  html body #settings-modal .modal-body > .tab-panel > .muted { font-size: 11.5px; margin: 10px 0 8px; }
}
/* "Creations" / "My creations" (2026-11-18, every width, like the other AI tools): one quotation list, shown per tab.
   Creations: only the quotation made in this visit (.job.current), else the empty preview card. My creations: all of them. */
.pane-out:has(#outTabNew[aria-selected="true"]) .results .job:not(.current),
.pane-out:has(#outTabNew[aria-selected="true"]) #empty-results { display: none !important; }
.pane-out:has(#outTabNew[aria-selected="true"]):not(:has(.job.current)) > .results { display: none; }
.pane-out:has(.job.current) > #outNew { display: none; }
/* phones: Quotation settings: an empty Gemstone inventory / Labour rates table (only its "No … yet" line) is not shown;
   it appears with its column names once the first row is added (2026-11-18). Phones only. */
@media (max-width: 720px) {
  html body #settings-modal .table:has(.table-empty) { display: none; }
}
/* phones: placeholders and the chosen value in drop-downs at 14px, closer to the small field names above them
   (they were 16px and looked oversized next to the labels), 2026-11-19. Typed text stays 16px. Phones only. */
@media (max-width: 720px) {
  html body :is(input, select, textarea) { font-family: inherit; }   /* fields in the page font, not the browser default */
  html body :is(input, textarea)::placeholder { font-size: min(14px, 1em); }
  html body select:not([multiple]) { font-size: 14px; }
}
