/* TAI Reconcile — app layout (desktop first, works down to 360px). */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar .brand { min-width: 0; }
.topbar .brand .name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 380px; }
.steps { display: flex; gap: 4px; margin: 0 auto; }
.step {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text-2); font: 500 15px inherit; font-family: inherit; cursor: pointer;
}
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; border: 1px solid var(--line-strong); }
.step[aria-current="step"] { color: var(--text); background: var(--surface-2); }
.step[aria-current="step"] .n { background: var(--action); color: var(--action-text); border-color: var(--action); }
.step:disabled { opacity: .45; cursor: default; }
.step:not(:disabled):not([aria-current="step"]):hover { background: var(--surface-2); }
.tools { display: flex; align-items: center; gap: 4px; }
.lang-select { width: auto; min-width: 76px; }

main { max-width: 1320px; margin: 0 auto; padding: 24px; }
.view { display: grid; gap: 20px; }
.view-head { display: grid; gap: 6px; }
.view-head.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sample { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.accent { color: var(--accent-text); font-weight: 600; }

/* file side */
.side { display: grid; gap: 16px; align-content: start; min-height: 300px; }
.side-head { display: flex; align-items: center; gap: 12px; }
.side-letter { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); color: var(--product); flex: none; }
.side-head label.field { flex: 1; }
.drop {
  display: grid; place-items: center; gap: 10px; text-align: center; padding: 28px 16px; min-height: 180px;
  border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); color: var(--text-2);
}
.drop.over { border-color: var(--action); background: var(--surface-3); color: var(--text); }
.drop svg { width: 36px; height: 36px; color: var(--product); }
.drop input[type=file] { display: none; }
.loaded { display: grid; gap: 12px; }
.fileline { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.fileline svg { width: 28px; height: 28px; color: var(--ok); flex: none; }
.fileline .meta { flex: 1; min-width: 0; }
.fileline .fname { font-weight: 600; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-3); }
.sheetpick { display: grid; grid-template-columns: 1fr 140px; gap: 12px; }

/* mapping */
.mapcard { display: grid; gap: 16px; align-content: start; min-width: 0; }
.mapcard h2 { display: flex; align-items: center; gap: 10px; }
.mapgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.preview { overflow: auto; border: 1px solid var(--line); border-radius: 10px; max-height: 230px; }
.preview table { border-collapse: collapse; font-size: 13px; width: max-content; min-width: 100%; }
.preview th, .preview td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.preview th { position: sticky; top: 0; background: var(--surface-3); font-weight: 600; color: var(--text-2); }
.preview th.on { color: var(--action-text); background: var(--action); }
.preview td.on { background: var(--surface-2); color: var(--text); }
.preview .role { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.rules { display: grid; gap: 16px; }
.rules-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; align-items: end; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.recent { min-width: 320px; }

/* results */
.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; text-align: left; cursor: pointer; font-family: inherit; color: var(--text); }
.stat:hover { border-color: var(--line-strong); }
.stat[aria-pressed="true"] { border-color: var(--action); box-shadow: inset 0 0 0 1px var(--action); }
.stat .label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.stat .label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--text-3)); flex: none; }
.stat .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.stat.ok { --dot: var(--ok); } .stat.info { --dot: var(--info); } .stat.warn { --dot: var(--warn); } .stat.bad { --dot: var(--bad); }
#resNotes { display: grid; gap: 8px; }
#resNotes:empty { display: none; }
.tablecard { padding: 0; overflow: hidden; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 340px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow: auto; max-height: calc(100vh - 360px); min-height: 280px; }
table.res { width: 100%; border-collapse: collapse; font-size: 14px; }
table.res th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2); font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.res th.grp { text-align: center; color: var(--product); border-bottom: 0; padding-bottom: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
table.res td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.res td.sep, table.res th.sep { border-left: 1px solid var(--line); }
table.res tbody tr:hover td { background: var(--surface-2); }
table.res .ref { max-width: 320px; overflow-wrap: anywhere; }
table.res .lines > div + div { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
table.res .empty { color: var(--text-3); }
table.res .neg { color: var(--bad); }
.nothing { padding: 40px 16px; text-align: center; color: var(--text-2); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager > div { display: flex; align-items: center; gap: 12px; }

.busy { position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: center; gap: 16px; background: rgba(10, 11, 14, .55); color: #F4F5F7; font-weight: 600; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .2); border-top-color: #C6F432; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: spin 2.4s linear infinite !important; } }

@media (max-width: 1100px) {
  .rules-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar .brand .name small { display: none; }
}
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
  .steps { order: 3; width: 100%; overflow-x: auto; }
  .tools { margin-left: auto; }
  main { padding: 16px; }
  .two, .checks { grid-template-columns: minmax(0, 1fr); }
  .rules-grid, .mapgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recent { min-width: 0; width: 100%; }
}

/* grid children must be allowed to shrink (selects/tables otherwise overflow the card) */
.mapgrid > *, .mapcard > *, .rules-grid > *, .two > *, .sheetpick > * { min-width: 0; }
.mapgrid select { text-overflow: ellipsis; }
h1[tabindex="-1"]:focus { outline: none; }
.preview.mini { max-height: 170px; }
.preview.mini td, .preview.mini th { max-width: 180px; }

/* v1.1.0 — several files per side */
.side.over { outline: 2px dashed var(--product); outline-offset: 4px; }
.loaded .part + .part { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.add-more { margin-top: 12px; position: relative; }
.add-more input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.stack-note { margin-top: 10px; }

/* v1.2.1 */
.res .src { display: block; font-size: 12px; color: var(--text-3); }
@media (max-width: 760px), (pointer: coarse) { .btn.small, .chip { min-height: 44px; } }
@media (max-width: 760px) { .topbar { position: static; } }   /* 3-row header on phones: scrolls away instead of covering ~20 % of the screen */
