:root {
  font-family: Inter, Geist, "Segoe UI", system-ui, sans-serif;
  color: #182b3a;
  background: #f3f5f6;
  font-size: 16px;
  line-height: 1.5;
  --ink: #182b3a;
  --navy: #102637;
  --muted: #536675;
  --line: #dbe3e8;
  --surface: #fff;
  --accent: #ffbe5b;
  --focus: #0c71a4;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.22; }

.topbar { background: var(--navy); color: #f5f8fa; }
.topbar__inner {
  width: min(1360px, calc(100% - 96px));
  min-height: 66px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.brand { display: flex; gap: 11px; align-items: center; font-size: 1.1rem; font-weight: 750; letter-spacing: -.02em; }
.brand__mark {
  width: 26px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent);
  position: relative;
}
.brand__mark::before {
  content: "";
  position: absolute;
  inset: 7px 6px 7px 6px;
  background: repeating-linear-gradient(to bottom, var(--navy) 0 2px, transparent 2px 6px);
}
.local-indicator { color: #d9e6eb; font-size: .84rem; display: flex; gap: 8px; align-items: center; }
.local-indicator > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #82d5a4;
  box-shadow: 0 0 0 3px #82d5a42b;
}
.topbar__actions { display: flex; align-items: center; gap: 18px; }
.topbar__logout { color: #f5f8fa; background: transparent; border: 1px solid #8ba3b2; border-radius: 7px; padding: 7px 11px; font-size: .82rem; font-weight: 650; }
.topbar__logout:hover:not(:disabled) { background: #ffffff18; }
.topbar__logout:disabled { opacity: .65; }

.workspace { width: min(1360px, calc(100% - 96px)); margin: 42px auto 56px; }
.page-heading { display: flex; gap: 22px; align-items: flex-end; justify-content: space-between; margin-bottom: 25px; }
.page-heading h1 { font-size: clamp(1.9rem, 3.2vw, 2.65rem); letter-spacing: -.049em; font-weight: 750; }
.page-heading p { font-size: .98rem; color: var(--muted); margin-top: 8px; }
.workspace-grid { display: grid; grid-template-columns: minmax(200px, 245px) minmax(0, 1fr); gap: 18px; align-items: start; }
.workspace-grid--developer { grid-template-columns: minmax(200px, 245px) minmax(230px, 280px) minmax(0, 1fr); }
.work-steps { display: grid; gap: 16px; min-width: 0; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 6px #142f4207;
  min-width: 0;
}
.step { padding: 20px; }
.step h2, .results-heading h2 { font-size: 1.09rem; font-weight: 750; letter-spacing: -.02em; }
.step-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; justify-content: space-between; }
.step__description { color: var(--muted); font-size: .89rem; margin: 10px 0 16px; }
.ai-step > button { width: 100%; }
.small-note { margin-top: 8px; color: var(--muted); font-size: .78rem; line-height: 1.5; overflow-wrap: anywhere; }
.report-panel__header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px; }
.report-panel__header .small-note { margin-top: 3px; }
.report-panel__header .button { padding-inline: 9px; }
.report-panel__notice { margin-top: 10px; }
.report-list { display: grid; gap: 7px; max-height: min(65vh, 680px); overflow: auto; margin: 14px -4px 0; padding: 2px 4px; }
.report-list:empty { margin-top: 0; }
.report-list__message { color: var(--muted); font-size: .78rem; margin-top: 12px; }
.report-card { border: 1px solid var(--line); border-radius: 9px; background: #fff; overflow: hidden; }
.report-card.is-selected { border-color: #4d809c; background: #f3f9fb; box-shadow: inset 3px 0 #397999; }
.report-card__select { display: grid; width: 100%; gap: 3px; padding: 10px; border: 0; background: transparent; text-align: left; color: var(--ink); }
.report-card__select:hover { background: #f1f7f9; }
.report-card__title { font-size: .83rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.report-card__subtitle, .report-card__status { color: var(--muted); font-size: .73rem; line-height: 1.35; overflow-wrap: anywhere; }
.report-card__timestamps { display: grid; gap: 1px; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.report-card__status.is-error { color: #9e3029; }
.report-card progress { display: block; width: 100%; height: 6px; margin-top: 3px; accent-color: #327f9a; }
.report-card__resume { margin: 0 10px 10px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 14px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: .86rem;
  font-weight: 680;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .16s, border-color .16s;
}
.button--accent { background: var(--accent); color: #202936; min-height: 45px; padding-inline: 15px; }
.button--accent:not(:disabled):hover { background: #ffad37; }
.button--secondary { background: #fff; color: var(--ink); border-color: #cbd7df; }
.button--secondary:not(:disabled):hover { background: #f4f8fa; border-color: #a9bcc9; }
.button--dark { background: var(--navy); color: #fff; }
.button--dark:not(:disabled):hover { background: #23435b; }
.button:disabled { background: #e9eef1; color: #5d6f7c; border-color: #e1e8ec; }
.button--small { min-height: 32px; font-size: .76rem; padding: 6px 9px; }
.download-icon { position: relative; width: 13px; height: 14px; border-bottom: 1.6px solid currentColor; }
.download-icon::before { content: ""; position: absolute; top: 1px; left: 6px; width: 1.5px; height: 8px; background: currentColor; }
.download-icon::after { content: ""; position: absolute; top: 4px; left: 3.5px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }

.droparea {
  margin-top: 15px;
  padding: 19px 10px 16px;
  border: 1px dashed #aabcc7;
  background: #f7fafb;
  border-radius: 10px;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 5px;
  transition: background-color .16s, border-color .16s;
}
.droparea.is-dragging { background: #e6f3f9; border-color: #2a7496; }
.droparea > p:first-of-type { font-weight: 700; font-size: .91rem; }
.droparea__hint { font-size: .75rem; color: var(--muted); }
.droparea .button { margin-top: 8px; }
.file-icon {
  display: block;
  width: 28px;
  height: 34px;
  border: 1.5px solid #7f9aab;
  background: #fff;
  border-radius: 5px;
  position: relative;
  margin: 0 0 4px;
}
.file-icon::before { content: ""; position: absolute; inset: 16px 6px 5px; background: repeating-linear-gradient(to bottom, #99afbc 0 1.5px, transparent 1.5px 5px); }
.file-icon::after { content: ""; position: absolute; right: 4px; top: 5px; width: 7px; height: 5px; border-bottom: 1px solid #99afbc; border-left: 1px solid #99afbc; }
.file-summary { display: flex; gap: 10px; align-items: center; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.file-type { color: #426174; background: #eaf1f5; border-radius: 6px; padding: 6px; font-size: .65rem; font-weight: 780; }
.file-summary__text { display: grid; min-width: 0; }
.file-summary__text strong { font-size: .83rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-summary__text span { color: var(--muted); font-size: .74rem; }

.pill { display: inline-flex; justify-content: center; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: .71rem; line-height: 1.2; font-weight: 690; white-space: nowrap; }
.pill--neutral { color: #476072; background: #edf3f6; }
.pill--ok { color: #216144; background: #e8f5ed; }
.pill--warn { color: #744b05; background: #fff2d8; }
.pill--danger { color: #9e3029; background: #fbeae8; }
.ai-progress { display: grid; gap: 5px; margin: 0 0 13px; font-size: .78rem; color: var(--muted); }
.ai-progress progress { width: 100%; height: 9px; accent-color: #327f9a; }

.results { overflow: hidden; }
.results-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.results-heading p { margin-top: 3px; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.results-heading > div:first-child { min-width: 0; }
.extraction-progress { flex: 1 1 260px; max-width: 420px; min-width: 150px; margin: 0 12px; }
.extraction-progress__label { color: #344f60; font-size: .75rem; font-weight: 700; line-height: 1.3; }
.extraction-progress progress { display: block; width: 100%; height: 8px; margin-top: 5px; accent-color: #327f9a; }
.results-heading .extraction-progress__note { margin-top: 4px; color: var(--muted); font-size: .73rem; line-height: 1.35; }
.notice { margin: 15px 20px 0; padding: 9px 12px; border-radius: 7px; font-size: .84rem; color: #22506a; background: #edf5fa; overflow-wrap: anywhere; }
.notice--error { color: #8b2b24; background: #fbeceb; }
.placeholder { display: grid; justify-items: center; align-content: center; min-height: 375px; padding: 42px 24px; text-align: center; }
.placeholder h3 { font-size: 1.07rem; margin: 22px 0 7px; }
.placeholder p { color: var(--muted); font-size: .86rem; max-width: 345px; }
.placeholder-visual {
  display: grid;
  align-content: center;
  gap: 9px;
  height: 90px;
  width: 75px;
  border: 1px solid #b7cad4;
  border-radius: 8px;
  background: #f4f8fa;
  box-shadow: 7px 7px 0 #e5edf2;
  padding: 14px;
}
.placeholder-visual span { height: 5px; border-radius: 3px; background: #c7d9e2; }
.placeholder-visual span:first-child { width: 60%; background: #81a6bc; }
.placeholder-visual span:last-child { width: 77%; }
.placeholder.is-loading .placeholder-visual { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 22px; margin: 16px 0 3px; }
.stat { padding: 9px 12px 13px; border-right: 1px solid var(--line); display: flex; flex-direction: column-reverse; gap: 1px; }
.stat:first-child { padding-left: 0; }
.stat:last-child { border: 0; }
.stat dt { color: var(--muted); font-size: .77rem; }
.stat dd { font-size: 1.45rem; font-weight: 760; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tabs { display: flex; overflow-x: auto; padding: 0 14px; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 8px; }
.tab { color: var(--muted); font-weight: 650; font-size: .82rem; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 12px 9px 10px; white-space: nowrap; }
.tab:hover, .tab[aria-current] { color: var(--ink); }
.tab[aria-current] { border-bottom-color: #2f6785; }
.tab:focus-visible { outline-offset: -2px; }
.result-content { padding: 14px 20px 20px; min-height: 220px; }
.result-content__empty { color: var(--muted); font-size: .88rem; padding: 12px 1px; }
.table-toolbar { padding: 12px 20px 0; display: grid; gap: 3px; }
.table-toolbar label { color: var(--muted); font-size: .78rem; font-weight: 650; }
.table-toolbar input { max-width: 370px; }
.table-wrap { overflow: auto; max-height: 57vh; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
th { position: sticky; top: 0; z-index: 1; background: #f1f6f8; color: #3c5362; font-size: .73rem; font-weight: 700; text-align: left; }
th, td { padding: 8px 9px; border-bottom: 1px solid #e5ebef; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #f9fbfc; }
td:last-child { text-align: left; }
.keep-together { white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.status-cell { display: flex; gap: 5px; align-items: center; }
.info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; padding: 0 0 15px; }
.info-list > div { border-bottom: 1px solid var(--line); padding: 8px 0; min-width: 0; }
.info-list dt { font-size: .73rem; color: var(--muted); }
.info-list dd { font-size: .88rem; font-weight: 650; overflow-wrap: anywhere; }
.metadata-origin { display: block; margin-top: 2px; color: var(--muted); font-size: .76rem; font-weight: 470; }
.metadata-candidates { padding: 0 0 0 16px; margin: 5px 0 7px; color: var(--muted); font-size: .76rem; font-weight: 470; }
.metadata-candidates li { margin-bottom: 2px; }
.content-heading { margin: 5px 0 9px; font-size: .94rem; }
.review-list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.review-item { border: 1px solid var(--line); padding: 10px 12px; border-radius: 7px; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.review-item__main { min-width: 0; }
.review-item strong { font-size: .82rem; }
.review-item p { font-size: .79rem; color: #4a6170; margin: 1px 0 0; overflow-wrap: anywhere; }
.review-item__page { color: var(--muted); font-size: .71rem; margin-bottom: 3px; overflow-wrap: anywhere; }
.review-item__values {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 2px 8px;
  margin-top: 6px;
  font-size: .76rem;
}
.review-item__values dt { color: var(--muted); }
.review-item__values dd { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.review-item .review-item__source { margin-top: 5px; font-size: .72rem; }
.review-item__actions { flex-shrink: 0; }
.review-history { margin-top: 14px; }
.review-history > summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.review-history .review-list { margin-top: 8px; }
.measurements-table { min-width: 605px; }
.text-wrap { min-width: 165px; overflow-wrap: anywhere; }

dialog {
  border: 1px solid #b9cbd5;
  border-radius: 13px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  width: min(462px, calc(100% - 32px));
  max-height: 88vh;
  box-shadow: 0 12px 45px #0d263d45;
}
dialog::backdrop { background: #10263791; }
.dialog--wide { width: min(1100px, calc(100% - 32px)); }
.dialog__header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 14px 18px; gap: 12px; }
.dialog__header h2 { font-size: 1rem; }
.dialog__body { padding: 15px 18px; font-size: .9rem; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.crop-preview img { display: block; width: auto; max-width: 100%; max-height: 63vh; object-fit: contain; margin: 4px auto; border: 1px solid var(--line); }
#crop-image { width: 100%; }
.review-detail { margin-bottom: 12px; padding: 10px 12px; background: #f4f8fa; border-radius: 7px; overflow-wrap: anywhere; }
.review-detail p { font-size: .82rem; }
.review-evidence { margin: 0 0 14px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafb; }
.review-evidence figcaption { font-size: .78rem; font-weight: 690; color: #3d5566; }
.review-evidence img { display: block; width: auto; max-width: 100%; max-height: 45vh; margin: 7px auto 0; object-fit: contain; border: 1px solid var(--line); }
#edit-image { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form-field { display: grid; gap: 3px; min-width: 0; }
.form-field--wide { grid-column: 1 / -1; }
.form-field > label { color: #3d5566; font-size: .78rem; font-weight: 690; }
.field-candidates { display: grid; gap: 5px; list-style: none; padding: 0; margin: 6px 0 0; }
.field-candidates li { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 5px 9px; padding: 7px; border: 1px solid var(--line); border-radius: 6px; }
.field-candidates__text { min-width: 0; display: grid; line-height: 1.3; overflow-wrap: anywhere; }
.field-candidates__text strong { font-size: .84rem; }
.field-candidates__text span { color: var(--muted); font-size: .75rem; }
input[type="text"], input[type="search"], textarea, select { min-width: 0; width: 100%; padding: 7px 9px; color: var(--ink); background: #fff; border: 1px solid #b9cbd5; border-radius: 6px; font-size: .86rem; }
textarea { min-height: 91px; resize: vertical; }
.form-error { margin-top: 9px; color: #8b2b24; font-size: .82rem; }
#edit-context { margin: 0 0 10px; }

@media (max-width: 1050px) {
  .workspace-grid { grid-template-columns: minmax(170px, 22%) minmax(0, 1fr); gap: 12px; }
  .workspace-grid--developer { grid-template-columns: minmax(170px, 22%) minmax(190px, 25%) minmax(0, 1fr); }
  .results-heading { flex-wrap: wrap; }
  .results-heading > div:first-child { flex: 1; }
  .results-heading #record-state { order: 2; }
  .extraction-progress { order: 3; flex-basis: 100%; max-width: none; margin: 7px 0 0; }
}
@media (max-width: 890px) {
  .workspace, .topbar__inner { width: calc(100% - 40px); }
  .step { padding: 14px; }
  .results-heading { padding: 15px; }
  .result-content { padding-inline: 12px; }
  .stats { padding-inline: 15px; }
  .tabs { padding-inline: 8px; }
}
@media (max-width: 690px) {
  .workspace, .topbar__inner { width: calc(100% - 28px); }
  .workspace { margin-top: 25px; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; gap: 11px; }
  .workspace-grid, .workspace-grid--developer { grid-template-columns: minmax(0, 1fr); }
  .work-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .report-list { max-height: 240px; }
  .placeholder { min-height: 255px; padding: 24px 18px; }
  .results-heading { padding: 14px; }
}
@media (max-width: 440px) {
  .work-steps { grid-template-columns: minmax(0, 1fr); }
  .topbar__inner { min-height: 54px; }
  .local-indicator { font-size: .73rem; }
  .topbar__actions { gap: 8px; }
  .droparea { padding: 13px 6px; }
  .page-heading h1 { font-size: 1.75rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .info-list { grid-template-columns: minmax(0, 1fr); }
  .review-item { flex-wrap: wrap; }
  .review-item__main { width: 100%; }
  .stats { gap: 4px; }
  .stat { padding-inline: 5px; }
  .stat dt { font-size: .69rem; }
  .stat dd { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.legal-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; padding: 24px; color: #496273; font-size: .8rem; }
.legal-footer a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.legal-footer a:focus-visible { outline: 3px solid #0079b5; outline-offset: 3px; }
