:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #dfe3ea;
  --accent: #e5a325;
  --accent-dark: #b67900;
  --navy: #172033;
  --success: #16794d;
  --danger: #b42318;
  --soft: #f8fafc;
  --selected: #fff4da;
  --shadow: 0 8px 30px rgba(23, 32, 51, .07);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 12px max(18px, env(safe-area-inset-left)) 12px max(18px, env(safe-area-inset-right));
  background: rgba(23, 32, 51, .97);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.09);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent); color: #111827; font-weight: 900; letter-spacing: -.04em;
}
.brand-name { font-weight: 800; line-height: 1.1; }
.brand-sub { font-size: 12px; color: #b8c1d1; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; }
.shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0 80px; }
.hero {
  display: grid; grid-template-columns: 1.5fr .7fr; gap: 24px; align-items: stretch;
  padding: 20px 4px 26px;
}
.eyebrow { color: var(--accent-dark); font-weight: 900; font-size: 12px; letter-spacing: .1em; }
h1 { font-size: clamp(30px, 5vw, 54px); line-height: 1.02; letter-spacing: -.04em; margin: 8px 0 14px; max-width: 870px; }
.hero p { margin: 0; max-width: 800px; color: var(--muted); font-size: 17px; line-height: 1.55; }
.privacy-card { background: var(--navy); color: white; border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 8px; justify-content: center; box-shadow: var(--shadow); }
.privacy-card strong { color: #ffd983; }
.privacy-card span { color: #d6dce7; font-size: 14px; line-height: 1.5; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin: 18px 0; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.split-heading { justify-content: space-between; }
.heading-left { display: flex; gap: 14px; }
.panel h2 { margin: 0 0 5px; font-size: 22px; letter-spacing: -.02em; }
.panel-heading p { margin: 0; color: var(--muted); line-height: 1.45; }
.step { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: flex; flex-direction: column; gap: 7px; color: #344054; font-weight: 700; font-size: 13px; }
label small { color: var(--muted); font-weight: 500; line-height: 1.35; }
input, textarea, select {
  width: 100%; border: 1px solid #cfd5df; background: white; color: var(--ink); border-radius: 10px; padding: 11px 12px; outline: none; font-weight: 500;
}
textarea { resize: vertical; min-height: 82px; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(229, 163, 37, .16); }
input[readonly] { background: var(--soft); color: #475467; }
.block-label { margin-top: 16px; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 800; transition: .15s ease; }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: #26324b; }
.btn.secondary { background: #eef1f5; color: var(--ink); }
.btn.secondary:hover { background: #e3e7ed; }
.btn.success { background: var(--success); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.22); color: #fff; }
.panel .btn.ghost { border-color: var(--line); color: var(--ink); }
.btn.danger-ghost { color: #ffd8d4; }
.inline-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.inline-actions.wrap { flex-wrap: wrap; }
.status-text { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
.mapping { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; }
.chip { background: #f2f4f7; border: 1px solid #e4e7ec; border-radius: 999px; padding: 6px 9px; font-size: 12px; color: #475467; }
.counter-block { display: flex; flex-direction: column; align-items: flex-end; min-width: 92px; }
.counter-block strong { font-size: 28px; line-height: 1; }
.counter-block span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 150px; padding: 25px; border: 2px dashed #c7ced9; border-radius: 14px; background: #fbfcfd; text-align: center; overflow: hidden; }
.dropzone.dragging { border-color: var(--accent); background: #fff9eb; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-size: 24px; margin-bottom: 8px; }
.dropzone span { color: var(--muted); font-size: 13px; margin-top: 4px; }
.photo-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0 12px; }
.segmented { display: inline-flex; background: #eef1f5; border-radius: 10px; padding: 3px; }
.seg { border: 0; background: transparent; color: #667085; padding: 7px 10px; border-radius: 8px; font-size: 12px; font-weight: 800; }
.seg.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.selection-text { color: var(--muted); font-size: 13px; }
.photo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; min-height: 140px; }
.photo-grid.empty-grid { display: block; }
.photo-card { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; border: 3px solid transparent; background: #e8ebf0; cursor: pointer; user-select: none; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(229,163,37,.25); }
.photo-card.assigned { opacity: .58; }
.photo-badge { position: absolute; top: 7px; right: 7px; min-width: 24px; height: 24px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; background: rgba(23,32,51,.88); color: #fff; font-size: 11px; font-weight: 900; }
.photo-card.selected .photo-badge { background: var(--accent); color: #172033; }
.photo-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 7px 6px; color: #fff; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: linear-gradient(transparent, rgba(0,0,0,.72)); }
.empty-state { min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); text-align: center; }
.empty-state.bordered { border: 1px dashed var(--line); border-radius: 12px; }
.empty-state strong { color: #475467; }
.selected-preview { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.preview-thumb { flex: 0 0 68px; width: 68px; height: 68px; border-radius: 9px; object-fit: cover; border: 2px solid var(--accent); }
.chat-box { position: relative; }
.chat-box textarea { padding-right: 54px; min-height: 115px; }
.mic-btn { position: absolute; right: 10px; bottom: 10px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #fff; display: grid; place-items: center; }
.mic-btn.listening { background: #fee4e2; border-color: #fda29b; }
.draft-editor { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 20px; }
.draft-title-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.mini-label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.confidence { align-self: flex-start; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 5px 8px; background: #f2f4f7; color: #475467; }
.dynamic-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-top: 14px; }
.dynamic-fields label.wide { grid-column: 1 / -1; }
.dynamic-fields textarea { min-height: 78px; }
.warnings { margin-top: 14px; padding: 12px; border-radius: 10px; background: #fffaeb; border: 1px solid #fedf89; color: #7a2e0e; font-size: 13px; line-height: 1.4; }
.sticky-actions { margin-top: 18px; }
.snag-cards { display: grid; gap: 10px; }
.snag-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.snag-ref { min-width: 54px; border-radius: 9px; background: var(--navy); color: #fff; padding: 8px; text-align: center; font-weight: 900; font-size: 12px; }
.snag-main strong { display: block; margin-bottom: 3px; }
.snag-main span { color: var(--muted); font-size: 13px; }
.snag-path { margin-top: 6px; color: #475467; font-size: 12px; word-break: break-word; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 8px; color: var(--danger); font-weight: 800; }
.export-panel { border-top: 4px solid var(--accent); }
.export-actions { margin-top: 18px; }
.table-wrap { overflow-x: auto; margin-top: 20px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 12px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; vertical-align: top; white-space: pre-wrap; }
th { position: sticky; top: 0; background: #f8fafc; color: #344054; font-weight: 900; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { border-right: 0; }
.export-note { margin-top: 16px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: #f8fafc; border-radius: 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.export-note strong { color: var(--ink); white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); padding: 11px 15px; border-radius: 10px; background: #101828; color: white; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.22); opacity: 0; pointer-events: none; transition: .2s ease; z-index: 50; max-width: min(90vw, 520px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 850px) {
  .hero { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .topbar { min-height: 66px; }
  .brand-sub { display: none; }
  .top-actions .btn { padding: 8px 9px; font-size: 12px; }
  .shell { width: min(100% - 18px, 1180px); padding-top: 14px; }
  .hero { padding: 10px 3px 14px; gap: 14px; }
  h1 { font-size: 34px; }
  .hero p { font-size: 15px; }
  .panel { padding: 16px; border-radius: 14px; margin: 10px 0; }
  .panel-heading { margin-bottom: 16px; }
  .panel-heading p { font-size: 13px; }
  .panel h2 { font-size: 19px; }
  .form-grid.two, .dynamic-fields { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
  .photo-card { border-width: 2px; border-radius: 9px; }
  .snag-card { grid-template-columns: auto 1fr; }
  .snag-card .icon-btn { grid-column: 2; justify-self: end; }
  .export-note { flex-direction: column; gap: 3px; }
  .privacy-card { padding: 16px; }
}
