/* NHI-R Reconciliation Workbench – layout on top of SAP Horizon (UI5 Web Components).
   Colours come from the theme variables; the fallbacks are the Horizon values. */

@font-face { font-family: "72"; font-weight: 400; src: url("/static/fonts/72-Regular.woff2") format("woff2"); }
@font-face { font-family: "72"; font-weight: 600; src: url("/static/fonts/72-Semibold.woff2") format("woff2"); }
@font-face { font-family: "72"; font-weight: 700; src: url("/static/fonts/72-Bold.woff2") format("woff2"); }
@font-face { font-family: "72-SemiboldDuplex"; src: url("/static/fonts/72-SemiboldDuplex.woff2") format("woff2"); }
@font-face { font-family: "72-Bold"; src: url("/static/fonts/72-Bold.woff2") format("woff2"); }

:root {
  --bg: var(--sapBackgroundColor, #f5f6f7);
  --surface: var(--sapGroup_ContentBackground, #fff);
  --ink: var(--sapTextColor, #1d2d3e);
  --ink2: var(--sapContent_LabelColor, #556b82);
  --line: var(--sapList_BorderColor, #e5e5e5);
  --line2: var(--sapGroup_TitleBorderColor, #a8b3bd);
  --brand: var(--sapBrandColor, #0070f2);
  --good: #256f3a; --good-bg: #f5fae5; --good-mark: #30914c;
  --bad: #aa0808; --bad-bg: #ffeaf4; --bad-mark: #f53232;
  --warn: #a8540a; --warn-bg: #fff8d6; --warn-mark: #c87b00;
  --neutral: #475e75; --neutral-bg: #eff1f2; --neutral-mark: #758ca4;
  --info-bg: #e1f4ff;
  --s1: #0070f2; --s2: #c87b00; --s3: #8b47d7;
  --radius: 0.75rem;
  --shadow: 0 0 0.125rem rgba(34,53,72,.2), 0 0.125rem 0.25rem rgba(34,53,72,.2);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: "72", "72full", Arial, Helvetica, sans-serif; font-size: 0.875rem; }
#app { height: 100%; }
.boot { padding: 2rem; color: var(--ink2); }
a { color: var(--brand); }

/* ---------- shell ---------- */
.shell { height: 100%; display: flex; flex-direction: column; }
.shell ui5-navigation-layout { flex: 1; min-height: 0; }
.main { height: 100%; display: flex; flex-direction: column; min-width: 0; }
.page { flex: 1; overflow: auto; padding: 1rem 2rem 2rem; }
.footer { flex: none; display: flex; gap: 1.5rem; align-items: center; padding: 0.375rem 2rem; font-size: 0.75rem;
  color: var(--ink2); background: var(--surface); border-top: 1px solid var(--line); }
.footer .spacer { flex: 1; }
.logo { height: 2rem; }

.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: 0.25rem 0 1rem; }
.page-head h1 { font-family: "72-Bold", "72", Arial, sans-serif; font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--ink2); margin-top: 0.25rem; }
.page-head .grow { flex: 1; }
.page-head .actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ---------- cards / panels ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; min-width: 0; }
.card > h2, .card-title, .zone-head h2 { font-size: 1rem; font-weight: 700; margin: 0 0 0.25rem; font-family: "72-Bold", "72", Arial, sans-serif; }
.card .hint, .hint { color: var(--ink2); font-size: 0.8125rem; }
.card .hint { margin: 0 0 0.75rem; }
.grid { display: grid; gap: 1rem; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
@media (max-width: 1200px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.grow { flex: 1; }
.mt { margin-top: 1rem; }
.mono { font-family: "72Mono", ui-monospace, Consolas, monospace; font-size: 0.8125rem; }
.muted { color: var(--ink2); }
.nowrap { white-space: nowrap; }

/* stat tile */
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.875rem 1rem; }
.kpi .label { color: var(--ink2); font-size: 0.8125rem; }
.kpi .value { font-size: 1.75rem; font-weight: 600; margin-top: 0.25rem; line-height: 1.1; }
.kpi .note { color: var(--ink2); font-size: 0.75rem; margin-top: 0.25rem; }
.kpi.good .value { color: var(--good); } .kpi.bad .value { color: var(--bad); } .kpi.warn .value { color: var(--warn); }

/* filter bar */
.filterbar { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.75rem 1rem;
  display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 9rem; }
.field > label, .field > span.l { font-size: 0.8125rem; color: var(--ink2); }
input[type=date], input[type=text].native, select.native {
  height: 2.25rem; padding: 0 0.625rem; border: none; border-radius: 0.25rem; font: inherit; color: var(--ink);
  background: var(--sapField_Background, #fff); box-shadow: inset 0 0 0 1px rgba(85,107,129,.25), inset 0 -1px 0 0 #556b81; }
input[type=date]:focus, select.native:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

/* chips */
.chips { display: flex; gap: 0.375rem; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line2); background: var(--surface); color: var(--ink); border-radius: 1rem; padding: 0.25rem 0.625rem;
  font: inherit; font-size: 0.8125rem; cursor: pointer; display: inline-flex; gap: 0.375rem; align-items: center; }
.chip:hover { border-color: var(--brand); }
.chip.on { background: #edf6ff; border-color: var(--brand); color: #0064d9; font-weight: 600; }
.chip .n { color: var(--ink2); font-weight: 400; }
.chip:focus-visible, button.link:focus-visible, .drop:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* status */
.st { display: inline-flex; align-items: center; gap: 0.3rem; border-radius: 0.5rem; padding: 0.0625rem 0.5rem; font-size: 0.75rem;
  font-weight: 600; white-space: nowrap; }
.st::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; }
.st.PASS, .st.good { color: var(--good); background: var(--good-bg); }
.st.FAIL, .st.bad { color: var(--bad); background: var(--bad-bg); }
.st.REVIEW_REQUIRED, .st.warn { color: var(--warn); background: var(--warn-bg); }
.st.NOT_ASSESSABLE, .st.neutral { color: var(--neutral); background: var(--neutral-bg); }
.st.info { color: #0064d9; background: var(--info-bg); }

/* traffic light */
.light { width: 0.875rem; height: 0.875rem; border-radius: 50%; display: inline-block; flex: none; background: #c9d2dc;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.light.ok, .light.done { background: var(--good-mark); }
.light.warn { background: var(--warn-mark); }
.light.error, .light.failed { background: var(--bad-mark); }
.light.running { background: var(--brand); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .light.running { animation: none; } }

/* drop zones */
.drop { border: 1.5px dashed var(--line2); border-radius: var(--radius); padding: 1rem; text-align: center; color: var(--ink2);
  background: #fafbfc; cursor: pointer; transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: #edf6ff; color: var(--ink); }
.drop .lead { color: var(--ink); display: block; margin-bottom: 0.125rem; font-weight: normal; }
.drop .lead b { font-family: "72-Bold", "72", Arial, sans-serif; font-weight: 700; }
.files { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.file { border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.5rem 0.625rem; }
.file .head { display: flex; gap: 0.5rem; align-items: center; }
.file .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file .msg { font-size: 0.8125rem; margin: 0.25rem 0 0 1.375rem; color: var(--ink2); }
.file.error .msg { color: var(--bad); }
.facts { display: flex; gap: 0.25rem 1rem; flex-wrap: wrap; margin: 0.375rem 0 0 1.375rem; font-size: 0.8125rem; }
.facts span b { font-weight: 600; }

/* steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.steps li { display: flex; gap: 0.625rem; align-items: baseline; }
.steps li .light { position: relative; top: 0.125rem; }
.steps .d { color: var(--ink2); font-size: 0.8125rem; }
.steps ul { list-style: none; margin: 0.375rem 0 0.25rem; padding: 0 0 0 0.25rem; display: flex; flex-direction: column; gap: 0.3rem; }

/* tables */
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--surface); }
table.t { border-collapse: collapse; width: 100%; font-size: 0.8125rem; }
table.t th { position: sticky; top: 0; z-index: 1; background: #f5f6f7; text-align: left; font-weight: 600; color: var(--ink2);
  padding: 0.5rem 0.625rem; border-bottom: 1px solid var(--line2); white-space: nowrap; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--ink); }
table.t td { padding: 0.4375rem 0.625rem; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
table.t tr:last-child td { border-bottom: none; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover, table.t tbody tr.sel { background: #edf6ff; }
table.t tr.group td { background: #f5f6f7; font-weight: 600; cursor: pointer; }
table.t tr.group.l1 td:first-child { padding-left: 1.5rem; }
table.t tr.group.l2 td:first-child { padding-left: 2.5rem; }
table.t tr.total td { font-weight: 700; border-top: 2px solid var(--line2); background: #f5f6f7; position: sticky; bottom: 0; }
table.t .caret { display: inline-block; width: 1rem; color: var(--ink2); }
table.t td.wrap { white-space: normal; min-width: 16rem; }
.kv dd, .dlg table.t td { white-space: normal; }
.empty { padding: 2rem; text-align: center; color: var(--ink2); }
button.link { background: none; border: none; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }

/* workbench split */
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(22rem, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1250px) { .split { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; font-size: 0.8125rem; margin: 0; }
.kv dt { color: var(--ink2); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.section-title { font-weight: 700; margin: 1rem 0 0.375rem; font-size: 0.875rem; }
.callout { border-radius: 0.5rem; padding: 0.625rem 0.75rem; font-size: 0.8125rem; border: 1px solid transparent; }
.callout.bad { background: var(--bad-bg); border-color: #f9c1d2; color: var(--bad); }
.callout.good { background: var(--good-bg); border-color: #c6e0a0; color: var(--good); }
.callout.warn { background: var(--warn-bg); border-color: #f0d68a; color: var(--warn); }
.callout.info { background: var(--info-bg); border-color: #b5dcff; color: #0a4a8f; }

/* charts */
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--ink2); margin-bottom: 0.5rem; }
.legend i { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 2px; margin-right: 0.3rem; vertical-align: -1px; }
.legend i.line { height: 2px; vertical-align: 3px; border-radius: 1px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; font-size: 11px; fill: var(--ink2); }
.chart text.val { fill: var(--ink); font-weight: 600; }
.chart .gridline { stroke: #e5e8eb; stroke-width: 1; }
.chart .mark { transition: opacity .1s; }
.chart .hit:hover + .mark, .chart .mark:hover { opacity: .8; }
.hbars { display: grid; grid-template-columns: max-content 1fr max-content; gap: 0.375rem 0.625rem; align-items: center; font-size: 0.8125rem; }
.hbars .track { height: 0.875rem; }
.hbars .bar { height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); min-width: 1px; }
.hbars .bar.seg { display: flex; background: none; gap: 2px; border-radius: 0; }
.hbars .bar.seg span { height: 100%; } .hbars .bar.seg span:last-child { border-radius: 0 4px 4px 0; }
.hbars .v { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.hbars .lab { color: var(--ink); max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars.clickable .lab, .hbars.clickable .track { cursor: pointer; }
.segbar { display: flex; gap: 2px; height: 1.75rem; }
.segbar span { border-radius: 4px; color: #fff; font-size: 0.75rem; font-weight: 600; display: flex; align-items: center; padding-left: 0.375rem;
  overflow: hidden; white-space: nowrap; min-width: 3px; }
table.heat { border-collapse: separate; border-spacing: 2px; width: 100%; font-size: 0.8125rem; }
table.heat th { font-weight: 400; color: var(--ink2); padding: 0.25rem 0.375rem; text-align: center; white-space: nowrap; }
table.heat th.r { text-align: left; color: var(--ink); }
table.heat td { text-align: center; padding: 0.4375rem 0.25rem; border-radius: 4px; font-variant-numeric: tabular-nums; cursor: pointer; }
table.heat td:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.tooltip { position: fixed; z-index: 1000; pointer-events: none; background: #1d2d3e; color: #fff; padding: 0.375rem 0.5rem; border-radius: 0.375rem;
  font-size: 0.75rem; box-shadow: var(--shadow); max-width: 20rem; }
.tooltip b { font-size: 0.8125rem; } .tooltip .k { opacity: .8; }
.tooltip.wide { max-width: 27rem; }
.tooltip .p { margin: 0.375rem 0; line-height: 1.45; font-size: 0.8125rem; }
.tooltip i { display: inline-block; width: 0.625rem; height: 2px; margin-right: 0.3rem; vertical-align: middle; }

/* login */
.login { height: 100%; display: flex; align-items: center; justify-content: center; }
.login .card { width: 24rem; padding: 2rem; }
.login img { height: 3rem; display: block; margin-bottom: 1rem; }
.login h1 { font-size: 1.25rem; margin: 0 0 0.25rem; font-family: "72-Bold", "72", Arial, sans-serif; }
.form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.form ui5-input, .form ui5-select, .form ui5-textarea { width: 100%; }

/* guide */
.guide { max-width: 56rem; line-height: 1.55; }
.guide h2 { font-size: 1.125rem; margin: 1.5rem 0 0.375rem; font-family: "72-Bold", "72", Arial, sans-serif; }
.guide h3 { font-size: 0.9375rem; margin: 1rem 0 0.25rem; }
.guide li { margin: 0.2rem 0; }
.guide code { background: #eff1f2; padding: 0.05rem 0.3rem; border-radius: 0.25rem; font-size: 0.8125rem; }
.guide table { border-collapse: collapse; margin: 0.5rem 0; font-size: 0.8125rem; }
.guide td, .guide th { border: 1px solid var(--line); padding: 0.3rem 0.5rem; text-align: left; vertical-align: top; }
.guide th { background: #f5f6f7; }
.toc { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }

ui5-dialog .dlg { display: flex; flex-direction: column; gap: 0.75rem; min-width: min(30rem, 80vw); padding: 0.25rem 0; }
ui5-dialog .dlg-foot { display: flex; gap: 0.5rem; justify-content: flex-end; width: 100%; padding: 0.25rem 0; }
.pw { font-family: ui-monospace, Consolas, monospace; font-size: 1.125rem; background: #eff1f2; padding: 0.5rem 0.75rem; border-radius: 0.375rem;
  user-select: all; letter-spacing: 0.03em; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8125rem; }
.checks li { display: flex; gap: 0.5rem; align-items: baseline; }
.checks .light { width: 0.625rem; height: 0.625rem; position: relative; top: 0.0625rem; }
.inv-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem 0.75rem; }
.inv-form .field { min-width: 0; } .inv-form ui5-input { width: 100%; }
.inv-form .unsure ui5-input { outline: 2px solid var(--warn-mark); border-radius: 0.25rem; }
@media (max-width: 1100px) { .inv-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* side navigation with the system version at the bottom (as in the wireframes) */
.side { height: 100%; display: flex; flex-direction: column; background: var(--surface); }
.side ui5-side-navigation { flex: 1; min-height: 0; box-shadow: none; }
.side-foot { flex: none; padding: 0.75rem 1.25rem; font-size: 0.75rem; color: var(--ink2); border-top: 1px solid var(--line); line-height: 1.5; }

/* Analyse › LMRA deliveries */
.light.info { background: var(--brand); }
.checks li.click { cursor: pointer; border-radius: 0.25rem; }
.checks li.click:hover { background: #edf6ff; }
.tag { display: inline-block; padding: 0 0.4rem; border: 1px solid; border-left-width: 0.25rem; border-radius: 0.25rem; font-size: 0.75rem; white-space: nowrap; }

/* Page change: the new page fades in instead of appearing at once */
.page.fade-in, #inv-tab.fade-in { animation: page-in 240ms ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page.fade-in, #inv-tab.fade-in { animation: page-in-plain 160ms linear; } }
@keyframes page-in-plain { from { opacity: 0; } to { opacity: 1; } }

/* Ingest: checks while dropping LMRA files */
.zone-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.zone-head h2 { margin: 0; white-space: nowrap; }
.checkbar { flex: 1; height: 0.5rem; background: #e5e9ee; border-radius: 1rem; overflow: hidden; min-width: 6rem; }
.checkbar span { display: block; height: 100%; background: var(--good-mark); border-radius: 1rem; transition: width 120ms linear; }
.lmra-checks { margin-top: 0.25rem; }
.lmra-checks li { cursor: default; }
.lmra-checks li.appear { animation: page-in 260ms ease-out; }
.light.pending { background: #dfe4ea; }
.light.reveal { animation: light-in 420ms ease-out; }
@keyframes light-in { from { transform: scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lmra-checks li.appear, .light.reveal { animation: none; } .checkbar span { transition: none; } }

/* Ingest: the list of LMRA files keeps a fixed height and scrolls, so SoA and invoice stay in view */
.files.scroll { max-height: 16rem; overflow-y: scroll; padding-right: 0.375rem; scrollbar-gutter: stable;
  scrollbar-width: thin; scrollbar-color: #a8b3bd #eef1f4; }
.files.scroll::-webkit-scrollbar { width: 0.5rem; }
.files.scroll::-webkit-scrollbar-track { background: #eef1f4; border-radius: 1rem; }
.files.scroll::-webkit-scrollbar-thumb { background: #a8b3bd; border-radius: 1rem; }
.files.scroll::-webkit-scrollbar-thumb:hover { background: #758ca4; }
.facts .explained { cursor: help; border-bottom: 1px dotted var(--line2); }
.checks-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; width: 100%; margin-top: 0.75rem;
  padding: 0.5rem 0.625rem; border: 1px solid var(--line); border-radius: 0.5rem; background: #fafbfc; font: inherit;
  font-size: 0.8125rem; color: var(--ink); text-align: left; cursor: pointer; }
.checks-summary:hover { background: #edf6ff; border-color: var(--brand); }
.checks-summary > span { display: inline-flex; align-items: center; gap: 0.375rem; }
.checks-summary .light { width: 0.625rem; height: 0.625rem; }
.checks-summary .link { margin-left: auto; color: var(--brand); }
