:root {
  color-scheme: light;
  --canvas: #f3f6f5;
  --surface: #ffffff;
  --surface-subtle: #f8faf9;
  --ink: #142629;
  --muted: #607174;
  --line: #dce5e2;
  --line-strong: #cbd8d4;
  --accent: #0f766e;
  --accent-strong: #0a5c56;
  --accent-soft: #e4f3ef;
  --accent-ink: #ffffff;
  --pass: #19733d;
  --pass-bg: #e7f4eb;
  --warn: #7b540d;
  --warn-bg: #fbf1d8;
  --review: #a33e35;
  --review-bg: #fae9e6;
  --info: #315e7d;
  --info-bg: #e8f1f7;
  --dim: #4f5e61;
  --dim-bg: #edf1f0;
  --shadow-sm: 0 1px 2px rgba(20, 38, 41, .05);
  --shadow-md: 0 14px 40px rgba(20, 38, 41, .08);
  --radius-md: 16px;
  --radius-lg: 22px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: #0f1718;
    --surface: #172123;
    --surface-subtle: #1b2729;
    --ink: #e8f0ef;
    --muted: #9babad;
    --line: #2c3b3d;
    --line-strong: #3a4c4f;
    --accent: #66d1c4;
    --accent-strong: #8be0d6;
    --accent-soft: #183b38;
    --accent-ink: #082f2c;
    --pass: #79d69a;
    --pass-bg: #1b3828;
    --warn: #e8c568;
    --warn-bg: #3b321b;
    --review: #f09388;
    --review-bg: #422522;
    --info: #8fc3e8;
    --info-bg: #203545;
    --dim: #9aa7a8;
    --dim-bg: #263133;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-md: 0 18px 44px rgba(0, 0, 0, .28);
  }
}

* { box-sizing: border-box; }
html { min-width: 0; overflow-x: clip; background: var(--canvas); scroll-behavior: smooth; }
body {
  min-width: 0;
  margin: 0;
  overflow-x: clip;
  background: var(--canvas);
  color: var(--ink);
  font: 14.5px/1.55 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select, input, textarea { min-height: 44px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
button:disabled, input:disabled, select:disabled, textarea:disabled {
  opacity: .5; cursor: not-allowed;
}
.skip-link {
  min-height: 44px;
  position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px;
  transform: translateY(-150%); border-radius: 8px; background: var(--ink);
  color: var(--surface); text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.app-header {
  position: sticky; z-index: 20; top: 0; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(18px);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  max-width: 1440px; min-width: 0; margin: 0 auto; padding: 13px 28px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-logo { display: block; width: 38px; height: 38px; flex: 0 0 38px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: -.01em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.tabs-nav { display: flex; min-width: 0; gap: 5px; }
.nav-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 0; padding: 0 15px; border: 1px solid transparent; border-radius: 11px;
  background: transparent; color: var(--muted); cursor: pointer; font-weight: 620;
}
.nav-tab:hover { background: var(--surface-subtle); color: var(--ink); }
.nav-tab.on {
  border-color: var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.app-main { width: 100%; max-width: 1280px; min-width: 0; margin: 0 auto; padding: 48px 28px 80px; }
.tab { min-width: 0; }
.tab:not(.on) { display: none; }
.page-heading {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 36px;
  min-width: 0; margin-bottom: 28px;
}
.page-heading > div { min-width: 0; }
.page-heading.compact { align-items: center; }
.page-heading h1 { max-width: 760px; margin: 0; font-size: clamp(26px, 4vw, 40px); line-height: 1.12; letter-spacing: -.04em; }
.page-heading.compact h1 { font-size: clamp(25px, 3vw, 34px); }
.page-heading p { max-width: 700px; margin: 11px 0 0; color: var(--muted); font-size: 15px; }
.scope-notice {
  max-width: none; margin: 10px 0 0; padding: 9px 12px; border-left: 3px solid var(--info);
  border-radius: 0 8px 8px 0; background: var(--info-bg); color: var(--info);
  font-size: 12.5px;
}
.page-heading .scope-notice { max-width: 700px; color: var(--info); font-size: 12.5px; }
.upload-card, .surface {
  min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.upload-card { padding: 8px; box-shadow: var(--shadow-md); }
.drop {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  width: 100%; min-width: 0; padding: 38px; border: 1.5px dashed var(--line-strong);
  border-radius: 16px; background: var(--surface-subtle); color: var(--muted);
  text-align: left; cursor: pointer; transition: border-color .18s, background .18s, transform .18s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop:active { transform: scale(.997); }
.drop:disabled { transform: none; }
.upload-icon { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 15px; background: var(--accent-soft); color: var(--accent); font-size: 26px; }
.drop-copy { min-width: 0; }
.drop-copy strong, .drop-copy span { display: block; }
.drop-copy strong { color: var(--ink); font-size: 18px; letter-spacing: -.02em; }
.drop-copy span { margin-top: 3px; }
.upload-meta { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 11px 14px 3px; color: var(--muted); font-size: 11px; }
.upload-meta > span { padding: 3px 8px; border: 1px solid var(--line); border-radius: 99px; }
.upload-meta small { margin-left: auto; }
.result-region { min-width: 0; margin-top: 28px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 16px; border: 1px solid transparent;
  border-radius: 11px; cursor: pointer; font-weight: 680; text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.secondary { border-color: var(--line-strong); background: var(--surface); color: var(--accent); }
.btn.secondary:hover, .btn.quiet:hover { background: var(--accent-soft); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { border-color: color-mix(in srgb, var(--review) 30%, var(--line)); background: transparent; color: var(--review); }
.btn.danger:hover { background: var(--review-bg); }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.saved-alias {
  display: inline-flex; max-width: 100%; align-items: center; gap: 6px;
  padding: 5px 6px 5px 9px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 11px;
}
.saved-alias > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alias-remove {
  display: grid; width: 22px; height: 22px; flex: 0 0 22px; padding: 0;
  place-items: center; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1;
}
.alias-remove:hover { background: var(--review-bg); color: var(--review); }
#manual-supplier-dialog .field, #manual-product-dialog .field { margin-bottom: 12px; }
.status-line { min-height: 22px; margin: -14px 0 12px; color: var(--accent); font-size: 12px; }
.preview-card { margin-bottom: 18px; padding: 22px; border-radius: var(--radius-md); }
.preview-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.preview-metadata, .reference-evidence {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  margin: 0 0 14px; overflow: hidden; border: 1px solid var(--line);
  border-radius: 12px; background: var(--line);
}
.preview-metadata > div, .reference-evidence > div {
  min-width: 0; padding: 10px 12px; background: var(--surface-subtle);
}
.reference-evidence > :only-child { grid-column: 1 / -1; }
.preview-metadata dt, .reference-evidence dt {
  color: var(--muted); font-size: 10px; font-weight: 760; letter-spacing: .07em;
  text-transform: uppercase;
}
.preview-metadata dd, .reference-evidence dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.preview-metadata .hash-evidence, .reference-evidence .hash-evidence { grid-column: span 2; }
code { overflow-wrap: anywhere; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.diff-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.diff-summary span { padding: 7px 10px; border-radius: 9px; background: var(--dim-bg); color: var(--dim); }
.diff-summary .diff-added { background: var(--info-bg); color: var(--info); }
.diff-summary .diff-changed { background: var(--warn-bg); color: var(--warn); }
.diff-summary .diff-removed { background: var(--review-bg); color: var(--review); }
.preview-warning { padding: 10px 12px; border-radius: 9px; background: var(--review-bg); color: var(--review); }
.preview-table { margin-top: 12px; }
.preview-table td > .muted { display: block; margin-top: 3px; }

.toolbar-card { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 18px; padding: 18px; }
.supplier-remove { margin-left: auto; color: var(--review); }
.supplier-remove:hover:not(:disabled) { background: var(--review-bg); }
.history-toolbar {
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(190px, 260px) auto;
  align-items: end; gap: 14px; margin-bottom: 18px; padding: 16px;
}
.history-count { min-width: 110px; margin: 0; justify-content: flex-end; color: var(--muted); }
.supplier-field { min-width: min(340px, 100%); }
.toolbar-summary { display: flex; align-items: baseline; gap: 12px; min-width: 0; padding-bottom: 9px; }
.toolbar-summary span { color: var(--ink); font-weight: 720; white-space: nowrap; }
.toolbar-summary small { color: var(--muted); }
.field { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
input, select, textarea {
  max-width: 100%; min-width: 0; padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: var(--surface); color: var(--ink);
}
textarea { min-height: 72px; padding-top: 10px; padding-bottom: 10px; resize: vertical; }
input::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-heading h2, .section-heading h3 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.empty-state { padding: 54px 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--surface-subtle); color: var(--muted); text-align: center; }
.empty-state > span { display: grid; width: 48px; height: 48px; margin: 0 auto 14px; place-items: center; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 22px; }
.empty-state h2 { margin: 0; color: var(--ink); font-size: 18px; }
.empty-state p { max-width: 480px; margin: 7px auto 17px; }

.tablewrap { max-width: 100%; min-width: 0; contain: layout inline-size paint; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); scrollbar-width: thin; }
table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 13px; }
#price-table { min-width: 560px; table-layout: fixed; }
#price-table th:nth-child(2), #price-table td:nth-child(2) { width: 156px; }
#price-table th:last-child, #price-table td:last-child {
  position: sticky; right: 0; z-index: 1; width: 126px; min-width: 126px;
  background: var(--surface); box-shadow: -8px 0 14px color-mix(in srgb, var(--ink) 7%, transparent);
  text-align: right; white-space: nowrap;
}
#price-table th:last-child { z-index: 2; background: var(--surface-subtle); }
#price-table td:last-child .table-action {
  display: inline-flex; align-items: flex-start; justify-content: flex-end; padding-top: 0;
}
#price-table tbody tr:hover > td:last-child {
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
}
#history-table { min-width: 680px; }
.report-table { min-width: 720px; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-subtle); color: var(--muted); font-size: 10.5px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover > td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
td.n, th.n { text-align: right; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
#tab-prices.over .toolbar-card { outline: 2px dashed var(--accent); outline-offset: 3px; }
.table-action, .linkish, .history-toggle {
  min-height: 32px; padding: 3px 7px; border: 0; border-radius: 7px; background: transparent;
  color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 650;
}
.table-action:hover, .linkish:hover, .history-toggle:hover { background: var(--accent-soft); }
.table-action.danger { color: var(--review); }
.inactive-row { opacity: .55; }
.price-edit-dialog {
  width: min(640px, calc(100% - 28px)); max-height: calc(100dvh - 28px);
  padding: 0; overflow: auto; border: 1px solid var(--line-strong);
  border-radius: 16px; background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 80px color-mix(in srgb, var(--ink) 28%, transparent);
}
.price-edit-dialog::backdrop { background: color-mix(in srgb, var(--ink) 44%, transparent); }
.price-edit-dialog form { display: grid; gap: 14px; padding: 22px; }
.product-action-shell { display: grid; gap: 14px; padding: 22px; }
.price-edit-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.price-edit-heading h2, .price-edit-preview h3 { margin: 0; font-size: 19px; }
.price-edit-identity {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
  min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--line);
  border-radius: 10px; background: var(--line);
}
.price-edit-identity > div { min-width: 0; padding: 9px; background: var(--surface-subtle); }
.price-edit-identity > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.price-edit-identity dt {
  color: var(--muted); font-size: 9px; font-weight: 760; letter-spacing: .05em;
  text-transform: uppercase;
}
.price-edit-identity dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.price-edit-fields { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(220px, 1.3fr); gap: 12px; }
.price-edit-fields > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.price-edit-error {
  margin: 0; padding: 9px 10px; border-radius: 8px;
  background: var(--review-bg); color: var(--review); font-weight: 650;
}
.price-edit-status { min-height: 18px; margin: 0; color: var(--muted); font-size: 11px; }
.price-edit-preview {
  display: grid; gap: 10px; padding: 13px; border: 1px solid var(--line);
  border-radius: 11px; background: var(--surface-subtle);
}
.price-edit-preview[hidden] { display: none; }
.price-edit-preview p { margin: 0; color: var(--muted); }
.price-edit-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 0; }
.price-edit-diff > div { min-width: 0; }
.price-edit-diff dt { color: var(--muted); font-size: 10px; font-weight: 700; }
.price-edit-diff dd { margin: 3px 0 0; }
.price-edit-diff strong { display: block; padding: 7px 9px; border-radius: 8px; background: var(--surface); font-size: 16px; }
.price-edit-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.product-action-list { display: grid; gap: 8px; }
.product-action-choice {
  display: flex; width: 100%; min-height: 62px; align-items: center;
  justify-content: space-between; gap: 16px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  color: var(--ink); cursor: pointer; text-align: left;
}
.product-action-choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.product-action-choice > span:first-child { display: grid; min-width: 0; gap: 3px; }
.product-action-choice strong { font-size: 13px; }
.product-action-choice small { color: var(--muted); font-size: 10.5px; }
.product-action-choice > span:last-child { color: var(--muted); font-size: 20px; }
.product-action-remove { color: var(--review); }
.product-action-remove:hover { border-color: var(--review); background: var(--review-bg); }
#product-action-workflow { display: grid; gap: 13px; }
#product-action-workflow[hidden] { display: none; }
.product-action-back { width: fit-content; margin: -5px 0 -2px; }
.product-action-copy h3 { margin: 0; font-size: 17px; }
.product-action-copy p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; }
#product-merge-picker { display: grid; gap: 8px; }
#product-merge-picker[hidden] { display: none; }
.merge-candidate-list {
  display: grid; max-height: 290px; gap: 6px; overflow-y: auto;
  padding: 2px; overscroll-behavior: contain;
}
.merge-candidate {
  display: flex; width: 100%; min-width: 0; align-items: center;
  justify-content: space-between; gap: 12px; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink); cursor: pointer; text-align: left;
}
.merge-candidate:hover, .merge-candidate.is-selected {
  border-color: var(--accent); background: var(--accent-soft);
}
.merge-candidate > span { display: grid; min-width: 0; gap: 3px; }
.merge-candidate > span strong { overflow-wrap: anywhere; font-size: 11.5px; }
.merge-candidate small { color: var(--muted); font-size: 10px; }
.merge-candidate > strong { flex: 0 0 auto; color: var(--accent); font-size: 11.5px; }
.product-action-preview {
  padding: 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface-subtle);
}
.product-action-preview[hidden] { display: none; }
.product-action-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.product-action-preview-grid > div, .removal-preview {
  display: grid; min-width: 0; gap: 4px; padding: 10px;
  border-radius: 9px; background: var(--surface);
}
.product-action-preview-grid span, .removal-preview span {
  color: var(--muted); font-size: 9.5px; font-weight: 700;
}
.product-action-preview-grid strong, .removal-preview strong { overflow-wrap: anywhere; }
.product-action-preview-grid small { color: var(--accent); font-weight: 700; }
.history-row { cursor: pointer; }
.history-toggle { display: inline-flex; align-items: center; gap: 5px; }
.chev { display: inline-block; width: 12px; color: var(--muted); transition: transform .16s; }
.history-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.cell-note {
  display: block; color: var(--muted); font-size: 10.5px; white-space: normal;
}
tr.detail > td { padding: 16px; background: var(--canvas); }

.loading-card, .error-card { display: flex; align-items: center; gap: 13px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.error-card { border-color: color-mix(in srgb, var(--review) 28%, var(--line)); background: var(--review-bg); color: var(--review); }
.spin { width: 22px; height: 22px; flex: 0 0 auto; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.report-card { min-width: 0; margin-top: 18px; }
.document-context {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 10px; padding: 15px 18px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface-subtle);
}
.document-context > div { min-width: 0; }
.document-context h2 { margin: 0; overflow-wrap: anywhere; font-size: 17px; letter-spacing: -.02em; }
.document-context p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.decision-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 15px;
  padding: 20px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.decision-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 13px; font-size: 20px; font-weight: 800; }
.decision-copy { min-width: 0; }
.decision-copy h3 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.decision-copy > p { max-width: 820px; margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.decision-PRICE_OK { border-color: color-mix(in srgb, var(--pass) 26%, var(--line)); }
.decision-PRICE_OK .decision-icon { background: var(--pass-bg); color: var(--pass); }
.decision-PRICE_DIFFERENCE {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--line));
  background: color-mix(in srgb, var(--warn-bg) 45%, var(--surface));
}
.decision-PRICE_DIFFERENCE .decision-icon { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.decision-PRICE_DIFFERENCE h3 { color: var(--warn); }
/* a pending review is calmer than a verified price difference: the price
   warning is the loudest signal in this product */
.decision-REVIEW { border-color: color-mix(in srgb, var(--info) 26%, var(--line)); }
.decision-REVIEW .decision-icon { background: var(--info-bg); color: var(--info); }
.decision-NON_BINDING { border-color: color-mix(in srgb, var(--dim) 26%, var(--line)); }
.decision-NON_BINDING .decision-icon { background: var(--dim-bg); color: var(--dim); }
.reason-list { margin: 10px 0 16px; padding: 12px 16px 12px 34px; border-radius: 12px; background: var(--surface-subtle); color: var(--muted); font-size: 13px; }
.reason-list:empty { display: none; }
.line-review { margin-top: 20px; }
.report-table td:first-child { min-width: 250px; }
.quote-item { color: var(--ink); font-weight: 650; }
.line-action { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.price-delta { color: var(--warn); font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.price-delta.under { color: var(--info); }
tr[data-st="PRICE_DIFF"] > td,
tbody tr[data-st="PRICE_DIFF"]:hover > td {
  background: color-mix(in srgb, var(--warn-bg) 42%, transparent);
}
.decision-PRICE_DIFFERENCE .decision-copy > p {
  color: var(--ink); font-size: 13px; font-weight: 640;
}
.field-help { margin: 0; color: var(--muted); font-size: 11px; }
.st { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 760; white-space: nowrap; }
.st.MATCH, .st.COMPLIANT, .st.PRICE_OK { background: var(--pass-bg); color: var(--pass); }
.st.PRICE_DIFF, .st.MISMATCH, .st.PRICE_DIFFERENCE,
.st.diff-CHANGED { background: var(--warn-bg); color: var(--warn); }
.st.PRICE_DIFF { box-shadow: inset 0 0 0 1.5px var(--warn); }
.st.AMBIGUOUS, .st.CURRENCY_UNVERIFIED,
.st.PRODUCT_UNVERIFIED, .st.PRICE_UNVERIFIED,
.st.REVIEW, .st.diff-REMOVED { background: var(--review-bg); color: var(--review); }
.st.SERVICE { background: var(--info-bg); color: var(--info); }
.st.diff-ADDED { background: var(--info-bg); color: var(--info); }
.st.NO_AGREEMENT, .st.REVIEWED_OUTSIDE, .st.SKIPPED, .st.UNSUPPORTED,
.st.NON_BINDING, .st.ALL,
.st.diff-UNCHANGED { background: var(--dim-bg); color: var(--dim); }
.st.ATTENTION { background: var(--review-bg); color: var(--review); }
.muted { color: var(--muted); }
.clip .tail { display: none; }
.clip.open .tail { display: inline; }
.more { min-height: 28px; padding: 2px 5px; border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 11px; }
.more::before { content: "… devamı"; }
.clip.open .more::before { content: " · kısalt"; }
.candbox { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.cand { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pickwrap { display: inline-flex; max-width: 100%; align-items: center; gap: 7px; }
.pickwrap select { max-width: min(430px, 100%); }
.mini { min-height: 32px; padding: 3px 10px; border: 1px solid var(--accent); border-radius: 99px; background: transparent; color: var(--accent); cursor: pointer; font-size: 11px; font-weight: 720; }
.matched-name, .price-product > small, .revision-issues {
  display: block; margin-top: 4px; color: var(--muted); font-size: 10.5px;
}
.all-clear { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--pass-bg); color: var(--pass); font-weight: 700; }
.matched-group, .audit-details, .entry-details {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
}
.matched-group > summary, .audit-details > summary, .entry-details > summary {
  padding: 10px 12px; color: var(--muted); cursor: pointer; font-size: 12px;
  font-weight: 700;
}
.matched-group .tablewrap { border-width: 1px 0 0; border-radius: 0 0 12px 12px; box-shadow: none; }
.audit-details-body { padding: 0 12px 12px; }
.audit-details .reference-evidence { margin: 10px 0 0; }
.supplier-resolution {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px;
  padding: 12px 14px; border: 1px solid var(--warn); border-radius: 12px;
  background: var(--warn-bg);
}
.supplier-resolution-slot, .revision-supplier-slot {
  display: flex; min-width: min(100%, 320px); align-items: center; flex-wrap: wrap; gap: 7px;
}
.candidate-choice {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 5px 10px; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface);
}
.candidate-copy { display: grid; min-width: 0; gap: 3px; }
.candidate-name { color: var(--ink); overflow-wrap: anywhere; }
.match-state {
  display: inline-flex; width: fit-content; align-items: center; gap: 5px; margin-top: 5px;
  padding: 3px 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn);
  font-size: 9.5px; font-weight: 780; letter-spacing: .025em;
}
.match-state::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.candidate-decision { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: max-content; }
.candidate-unit-price { min-width: max-content; color: var(--ink); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.candidate-warning { color: var(--review); font-size: 10.5px; font-weight: 720; }
.candidate-tools, .revision-suggestions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.candidate-secondary { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; }
.candidate-alternatives { margin: 0; }
.candidate-alternatives > summary {
  width: fit-content; padding: 3px 5px; border-radius: 6px; color: var(--muted);
  cursor: pointer; font-size: 10.5px; font-weight: 650;
}
.candidate-alternatives > summary:hover { background: var(--accent-soft); color: var(--accent); }
.candidate-alternatives .candidate-tools { margin-top: 6px; }
.candidate-match { padding-inline: 14px; background: var(--accent); color: var(--accent-ink); }
.candidate-match:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.price-product { font-weight: 680; }
.entry-details { margin-top: 7px; border: 0; background: transparent; }
.entry-details > summary {
  display: flex; width: fit-content; min-height: 32px; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 8px; list-style: none; font-size: 10.5px;
}
.entry-details > summary::-webkit-details-marker { display: none; }
.entry-details > summary::before {
  content: "›"; color: var(--muted); font-size: 17px; line-height: 1;
  transition: transform .16s ease;
}
.entry-details[open] > summary::before { transform: rotate(90deg); }
.entry-details > summary:hover { background: var(--accent-soft); }
.alias-count {
  display: grid; min-width: 20px; height: 20px; padding-inline: 5px; place-items: center;
  border-radius: 999px; background: var(--dim-bg); color: var(--muted); font-size: 10px;
}
.entry-details[open] { padding-bottom: 8px; }
.alias-manager {
  display: grid; max-width: 620px; gap: 9px; margin: 4px 0 0 8px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-subtle);
}
.alias-list { display: flex; flex-wrap: wrap; gap: 6px; }
.alias-empty { color: var(--muted); font-size: 11px; }
.alias-add-form { display: flex; align-items: center; gap: 7px; }
.alias-add-form input { min-width: 0; flex: 1; }
.alias-add-form .btn { min-height: 38px; padding-inline: 12px; white-space: nowrap; }
.alias-help { margin: -2px 0 0; color: var(--muted); font-size: 10.5px; }
.alias-error { margin: 0; color: var(--review); font-size: 11px; font-weight: 650; }
.revision-summary, .revision-partition > header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.revision-summary { margin-bottom: 12px; }
.revision-partition {
  margin-top: 12px; padding: 14px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface-subtle);
}
.revision-partition > header > div { display: grid; gap: 2px; }
.revision-partition > header span { color: var(--muted); font-size: 11px; }
.revision-new-supplier { display: grid; gap: 4px; }
.revision-new-label {
  width: fit-content; padding: 2px 7px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn) !important; font-weight: 750;
}
.revision-new-supplier details { margin-top: 2px; }
.revision-new-supplier summary {
  width: fit-content; color: var(--muted); cursor: pointer; font-size: 11px;
}
.revision-new-supplier .revision-supplier-slot { margin-top: 7px; }
.revision-partition .tablewrap { margin-top: 12px; }
.revision-table { min-width: 680px; }
.revision-issues { color: var(--review); }
.revision-apply {
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(260px, 420px) auto;
  align-items: end; gap: 8px 14px; margin-top: 12px;
}
.revision-apply .field { width: min(100%, 420px); }
.revision-decision-help { margin: 0; align-self: center; }
.revision-decision-actions { display: flex; align-items: center; gap: 8px; }
.revision-block-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 12px;
}
.error-inline { color: var(--review); font-size: 12px; font-weight: 650; }
.st.READY, .st.READY_UPDATE, .st.READY_ADD {
  background: var(--pass-bg); color: var(--pass);
}
.st.BLOCK, .st.PENDING_FUTURE { background: var(--review-bg); color: var(--review); }
.st.HISTORY_ONLY, .st.UNCHANGED { background: var(--dim-bg); color: var(--dim); }

@media (max-width: 980px) {
  .page-heading { align-items: flex-start; flex-direction: column; gap: 20px; }
  .page-actions { justify-content: flex-start; }
  .preview-metadata, .reference-evidence { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-toolbar { grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px); }
  .history-count { justify-content: flex-start; }
  .report-table { min-width: 0; table-layout: fixed; }
  .report-table th:first-child, .report-table td:first-child { width: 30%; min-width: 0; }
  .report-table th:nth-child(2), .report-table td:nth-child(2),
  .report-table th:nth-child(3), .report-table td:nth-child(3) { width: 14%; }
  .report-table th:last-child, .report-table td:last-child { width: 42%; }
  .report-table td { padding: 9px 10px; }
  .candidate-choice { grid-template-columns: minmax(0, 1fr); }
  .candidate-decision { width: 100%; min-width: 0; justify-content: space-between; }
}

@media (max-width: 680px) {
  .header-inner { align-items: stretch; flex-direction: column; gap: 11px; padding: 10px 14px 8px; }
  .brand { align-self: flex-start; }
  .brand { min-height: 44px; }
  .brand-logo { width: 34px; height: 34px; flex-basis: 34px; }
  .brand small { display: none; }
  .tabs-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .nav-tab { min-height: 44px; padding: 0 7px; font-size: 11.5px; line-height: 1.2; }
  .nav-tab > span { display: none; }
  .app-main { padding: 28px 14px 60px; }
  .page-heading { margin-bottom: 21px; }
  .page-heading h1 { font-size: 28px; }
  .page-heading p { font-size: 14px; }
  .drop { grid-template-columns: 1fr; justify-items: center; padding: 30px 18px; text-align: center; }
  .drop .btn { width: 100%; }
  .upload-meta { flex-wrap: wrap; justify-content: center; }
  .upload-meta small { width: 100%; margin: 3px 0 0; text-align: center; }
  .page-actions { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .page-actions .btn:last-child { grid-column: auto; }
  .toolbar-card { align-items: stretch; flex-direction: column; gap: 8px; padding: 15px; }
  .history-toolbar { grid-template-columns: 1fr 1fr; }
  .history-count { grid-column: 1 / -1; }
  .supplier-field { width: 100%; min-width: 0; }
  .toolbar-summary { align-items: flex-start; flex-direction: column; gap: 2px; padding: 0; }
  .preview-card { padding: 17px 14px; }
  .preview-actions { align-items: stretch; flex-direction: column-reverse; }
  .preview-metadata, .reference-evidence { grid-template-columns: 1fr; }
  .preview-metadata .hash-evidence, .reference-evidence .hash-evidence { grid-column: auto; }
  .document-context { align-items: flex-start; flex-direction: column; }
  .decision-card { grid-template-columns: auto minmax(0, 1fr); padding: 15px; }
  .report-table-wrap { contain: none; overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .report-table { display: block; min-width: 0; }
  .report-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .report-table tbody { display: grid; gap: 8px; }
  .report-table tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden; border: 1px solid var(--line); border-radius: 11px;
    background: var(--surface); box-shadow: var(--shadow-sm);
  }
  .report-table td {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px;
    width: 100% !important; min-width: 0 !important; border-bottom: 1px solid var(--line);
    text-align: left; white-space: normal;
  }
  .report-table td::before {
    content: attr(data-label); color: var(--muted); font-size: 9px; font-weight: 760;
    letter-spacing: .055em; text-transform: uppercase;
  }
  .report-table tr > td:first-child, .report-table tr > td:last-child { grid-column: 1 / -1; }
  .report-table tr > td:last-child { border-bottom: 0; }
  .report-table tr[data-agreement-empty="true"] > td:first-child {
    grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  }
  .report-table tr[data-agreement-empty="true"] > td:first-child .match-state {
    grid-column: 3; margin-top: 0; white-space: nowrap;
  }
  .report-table tr[data-agreement-empty="true"] > td:nth-child(2) { grid-column: 1 / -1; }
  .report-table tr[data-agreement-empty="true"] > td:nth-child(3) { display: none; }
  .report-table .candidate-choice { grid-template-columns: minmax(0, 1fr) auto; }
  .report-table .candidate-decision { width: auto; min-width: max-content; }
  #history-table-wrap { contain: none; overflow: visible; border: 0; background: transparent; box-shadow: none; }
  #history-table { display: block; min-width: 0; }
  #history-table > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  #history-table > tbody { display: grid; gap: 10px; }
  #history-table > tbody > tr.history-row {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden; border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface); box-shadow: var(--shadow-sm);
  }
  #history-table > tbody > tr.history-row > td { display: block; min-width: 0; border-bottom: 1px solid var(--line); }
  #history-table > tbody > tr.history-row > td::before {
    display: block; margin-bottom: 3px; content: attr(data-label); color: var(--muted);
    font-size: 9.5px; font-weight: 760; letter-spacing: .06em; text-transform: uppercase;
  }
  #history-table > tbody > tr.detail { display: block; min-width: 0; }
  #history-table > tbody > tr.detail > td { display: block; width: 100%; min-width: 0; padding: 0; border: 0; }
  .tablewrap { border-radius: 11px; }
  th, td { padding: 10px; }
  #price-table { min-width: 0; }
  #price-table th:nth-child(2), #price-table td:nth-child(2) {
    width: 96px; padding-right: 6px; padding-left: 6px;
  }
  #price-table th:last-child, #price-table td:last-child {
    position: static; width: 82px; min-width: 82px; padding-right: 8px; padding-left: 8px;
    box-shadow: none;
  }
  .table-action, .linkish, .history-toggle, .mini, .more { min-height: 44px; min-width: 44px; }
  .cand { align-items: stretch; flex-direction: column; }
  .cand > * { max-width: 100%; }
  .pickwrap select { width: 100%; }
  .candidate-option { grid-template-columns: minmax(0, 1fr); }
  .candidate-decision { justify-content: space-between; width: 100%; min-width: 0; }
  .candidate-unit-price { justify-items: start; }
  .candidate-match { min-width: 120px; }
  .candidate-picker { align-items: stretch; flex-direction: column; }
  .supplier-resolution-slot, .revision-supplier-slot { align-items: stretch; flex-direction: column; }
  .supplier-resolution-slot > *, .revision-supplier-slot > * { width: 100%; }
  .revision-partition { padding: 11px; }
  .revision-partition > header { align-items: stretch; flex-direction: column; }
  .revision-apply { grid-template-columns: 1fr; align-items: stretch; }
  .revision-apply .field, .revision-apply .btn { width: 100%; }
  .revision-decision-actions { flex-direction: column-reverse; align-items: stretch; }
  .revision-block-actions { align-items: stretch; flex-direction: column; }
  .alias-manager { max-width: none; margin-left: 0; }
  .alias-add-form { align-items: stretch; flex-direction: column; }
  .alias-add-form .btn { width: 100%; }
  .price-edit-dialog form { padding: 17px 14px; }
  .product-action-shell { padding: 17px 14px; }
  .product-action-preview-grid { grid-template-columns: 1fr; }
  .merge-candidate { align-items: flex-start; flex-direction: column; }
  .price-edit-fields, .price-edit-identity { grid-template-columns: 1fr; }
  .price-edit-actions { align-items: stretch; flex-direction: column-reverse; }
  .price-edit-actions .btn { width: 100%; }
  tr.detail > td { padding: 10px 0; }
}

@media (max-width: 420px) {
  .history-toolbar { grid-template-columns: 1fr; padding: 13px; }
  .history-count { grid-column: auto; }
  #history-table > tbody > tr.history-row { grid-template-columns: 1fr; }
  .decision-card { grid-template-columns: 1fr; }
  .decision-icon { width: 38px; height: 38px; }
  .report-table tbody tr { grid-template-columns: 1fr; }
  .report-table td { grid-column: 1 / -1; grid-template-columns: 1fr; gap: 4px; }
  .report-table td::before { margin-bottom: 2px; }
  .report-table .candidate-choice { grid-template-columns: minmax(0, 1fr); }
  .report-table .candidate-decision { width: 100%; min-width: 0; }
}

@media (max-width: 320px) {
  .header-inner { padding-right: 10px; padding-left: 10px; }
  .app-main { padding: 22px 10px 48px; }
  .nav-tab { padding: 0 4px; font-size: 10.5px; }
  .page-heading h1 { font-size: 25px; }
  .drop { padding: 24px 12px; }
  .document-context, .decision-card { padding-right: 12px; padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
.status-line.err { color: var(--review); font-weight: 650; }
#fatal-banner {
  position: sticky; top: 0; z-index: 99; padding: 10px 16px;
  background: var(--review-bg); color: var(--review);
  font-size: 13px; font-weight: 700; text-align: center;
}
.candidate-hint { display: block; margin-top: 2px; font-size: 10.5px; }

/* ── giriş (paylaşımlı sunucu) ── */
.login-body { display: flex; min-height: 100vh; flex-direction: column; }
.login-main { display: flex; flex: 1; align-items: center; justify-content: center; padding: 48px 20px; }
.login-card {
  display: flex; width: 100%; max-width: 380px; flex-direction: column; gap: 16px;
  padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-md);
}
.login-brand { margin-bottom: 4px; }
.login-card h1 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.login-help { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
.login-error {
  margin: 0; padding: 10px 12px; border-radius: 11px;
  background: var(--review-bg); color: var(--review); font-size: 13px; font-weight: 650;
}
.login-submit { margin-top: 4px; }
.session-bar { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); font-size: 12.5px; }
.session-bar span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
