:root {
  --ink: #16191d;
  --muted: #6b7280;
  --line: #e3e6ea;
  --bg: #f6f7f9;
  --card: #fff;
  --accent: #1f5eff;
  --good: #0a7c42;
  --good-bg: #eaf6ef;
  --warn: #8a5a00;
  --warn-bg: #fdf4e3;
  --bad: #b3261e;
  --bad-bg: #fdeceb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

main { max-width: 960px; margin: 0 auto; padding: 24px 20px 64px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px; margin-bottom: 18px;
}
.card.narrow { max-width: 420px; margin: 60px auto; }

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 18px 0; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.ok { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
code { background: #f0f1f3; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 18px;
  font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.steps li { padding: 4px 12px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); }
.steps li.now { background: var(--ink); color: #fff; border-color: var(--ink); }

label { display: block; font-weight: 550; margin: 14px 0 5px; }
input[type=text], input[type=tel], input[type=search], select, input[type=file] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 7px; font: inherit; background: #fff;
}
.field { margin-bottom: 6px; }
button, .primary {
  display: inline-block; margin-top: 14px; padding: 9px 16px;
  background: var(--ink); color: #fff; border: 0; border-radius: 7px;
  font: inherit; font-weight: 550; cursor: pointer; text-decoration: none;
}
button:hover { opacity: .9; }
button:disabled { opacity: .5; cursor: default; }
button.danger { background: var(--bad); }
button.link, .link {
  background: none; color: var(--accent); padding: 0; margin-left: 12px;
  font-weight: 450; text-decoration: none;
}

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.error, .note.error { background: var(--bad-bg); color: var(--bad); }
.flash.ok { background: var(--good-bg); color: var(--good); }
.note { padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-size: 14px; }
.note.warning, .note.warn { background: var(--warn-bg); color: var(--warn); }
.note.info { background: #eef2fb; color: #2c4a86; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px 8px 0;
  border-bottom: 1px solid var(--line); }
td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line);
  vertical-align: middle; }
.scroll { overflow-x: auto; }
.preview td { white-space: nowrap; max-width: 260px; overflow: hidden;
  text-overflow: ellipsis; }

.mapping tr.attention td { background: var(--warn-bg); }
.mapping .req { font-size: 11px; color: var(--bad); text-transform: uppercase; }
.mapping .why { font-size: 13px; }

.tallies { display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.tally { flex: 1; min-width: 120px; padding: 14px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--line); }
.tally strong { display: block; font-size: 26px; line-height: 1.1; }
.tally span { font-size: 13px; color: var(--muted); }
.tally.good { background: var(--good-bg); border-color: #cbe7d7; }
.tally.bad { background: var(--bad-bg); border-color: #f3cfcd; }

.group { border: 1px solid var(--line); border-radius: 8px; padding: 14px;
  margin: 12px 0; }
.group-head { display: flex; justify-content: space-between; gap: 12px;
  align-items: baseline; flex-wrap: wrap; }
.group .query { font-size: 16px; }
.resolve { display: flex; gap: 8px; align-items: center; margin-top: 10px;
  flex-wrap: wrap; }
.resolve select { flex: 2; min-width: 260px; }
.resolve .finder { flex: 1; min-width: 160px; }
.resolve button { margin-top: 0; white-space: nowrap; }
.inline-edit { display: flex; gap: 6px; }
.inline-edit input { min-width: 130px; }
.inline-edit button { margin-top: 0; padding: 5px 10px; font-size: 13px; }
.fixes td { font-size: 13px; }

.commit-statement {
  font-size: 17px; line-height: 1.5; padding: 16px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--line); margin: 12px 0;
}
.commit-statement .company-name { border-bottom: 2px solid var(--accent); }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px;
  margin: 14px 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.canonical { background: #12151a; color: #d7dde5; padding: 14px;
  border-radius: 8px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; }

.status { font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); }
.status.committed { background: var(--good-bg); color: var(--good); border-color: #cbe7d7; }
.status.failed, .status.unknown, .status.partial {
  background: var(--bad-bg); color: var(--bad); border-color: #f3cfcd; }

.companies { list-style: none; padding: 0; }
.companies li { margin-bottom: 8px; }
.company-pick { display: block; width: 100%; text-align: left; margin: 0;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  padding: 14px 16px; }
.company-pick:hover { border-color: var(--accent); }
.company-pick strong { display: block; }
.company-pick .muted { font-size: 13px; font-weight: 400; }

/* --- Shell: logo bar, sidebar, content ------------------------------------
   The company is in the top bar on every screen because uploads cannot be
   undone and posting into the wrong one is the worst realistic mistake. */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); font-weight: 650; }
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.topbar .company {
  display: flex; flex-direction: column; line-height: 1.25;
  padding: 3px 14px; border-left: 3px solid var(--accent);
}
.topbar .company .label { font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px;
  font-size: 13.5px; }
.topbar-right a { color: var(--muted); text-decoration: none; }
.topbar-right a:hover { color: var(--ink); }
.topbar-right .who { color: var(--ink); font-weight: 550; }
.env { font-size: 11px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 9px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn); }

.body { display: flex; align-items: flex-start; }
.body.no-chrome { justify-content: center; }
.sidebar { width: 208px; flex: none; padding: 22px 12px; position: sticky; top: 0; }
.side-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 14px 10px 6px; font-weight: 650; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin-bottom: 1px; }
.sidebar a, .sidebar .soon {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 7px; text-decoration: none;
  color: var(--ink); font-size: 14px;
}
.sidebar a:hover { background: #eceef1; }
.sidebar a.on { background: var(--ink); color: #fff; font-weight: 550; }
.sidebar .soon { color: #a3a9b3; cursor: default; }
.sidebar .soon em { font-style: normal; font-size: 10px; text-transform: uppercase;
  letter-spacing: .05em; background: var(--bg); border: 1px solid var(--line);
  color: var(--muted); padding: 1px 6px; border-radius: 999px; }

main { flex: 1; max-width: 900px; padding: 22px 24px 72px; }
.body.no-chrome main { max-width: 460px; }

.login-logo { width: 44px; height: 44px; border-radius: 10px; margin-bottom: 10px; }
.env-line { margin: 8px 0 0; }

/* --- Review: their file as a table ----------------------------------------
   The point of this screen is that a person recognises their own spreadsheet
   and can see, at a glance, which cells we could not make sense of. Status is
   carried by colour AND a mark, never colour alone. */
.lead { font-size: 15px; color: #444b55; margin: 6px 0 14px; max-width: 62ch; }
.primary.big { font-size: 15.5px; padding: 11px 20px; }
button.secondary, .secondary { background: var(--card); color: var(--ink);
  border: 1px solid var(--line); }
.review-head { display: flex; justify-content: space-between; gap: 24px;
  align-items: flex-start; flex-wrap: wrap; }
.tallies.compact { margin: 0; gap: 8px; }
.tallies.compact .tally { min-width: 104px; padding: 10px 14px; }
.tallies.compact .tally strong { font-size: 21px; }

.fixes summary { cursor: pointer; font-size: 15px; }
.fix-list { list-style: none; margin: 12px 0 0; padding: 0; }
.fix-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0;
  border-top: 1px solid var(--line); font-size: 14px; }
.fix-what { flex: 1; min-width: 0; }
.fix-what .kind { display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.fix-why { flex: 1; }
.fix-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.fix-go { text-decoration: none; color: var(--accent); font-weight: 550;
  white-space: nowrap; }

.table-card { padding: 16px 0 0; }
.table-controls { display: flex; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding: 0 18px 14px; }
.views, .filters { display: flex; gap: 2px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.views a, .filters a { padding: 5px 11px; border-radius: 6px; font-size: 13px;
  color: var(--muted); text-decoration: none; white-space: nowrap; }
.views a.on, .filters a.on { background: var(--card); color: var(--ink);
  font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.grid-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
table.grid { border-collapse: separate; border-spacing: 0; font-size: 13.5px;
  min-width: 100%; }
table.grid th { padding: 8px 12px; background: var(--bg); text-align: left;
  border-bottom: 1px solid var(--line); white-space: nowrap;
  font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--ink);
  font-weight: 600; vertical-align: top; }
table.grid th em { display: block; font-style: normal; font-size: 10.5px;
  color: var(--muted); font-weight: 400; text-transform: uppercase;
  letter-spacing: .05em; margin-top: 1px; }
table.grid th.not-uploaded { color: #a3a9b3; }
table.grid th .req { color: var(--bad); margin-left: 2px; }
table.grid th .col-note { color: var(--bad); font-weight: 700; margin-left: 4px; }
table.grid td { padding: 0; border-bottom: 1px solid var(--line);
  max-width: 260px; }
table.grid td .txt { display: block; padding: 8px 12px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.c-num { color: var(--muted); font-variant-numeric: tabular-nums;
  text-align: right; padding: 8px 6px 8px 14px !important; width: 1%; }
.c-state { width: 1%; padding: 0 6px !important; text-align: center; }
.pill { display: inline-block; width: 18px; height: 18px; line-height: 18px;
  border-radius: 50%; font-size: 11px; font-weight: 700; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

tr.row-error td { background: #fffafa; }
tr.row-error .c-num { color: var(--bad); font-weight: 600; }
tr.just-fixed td { background: var(--good-bg); }
td.cell.ignored { background: #fbfbfc; color: #b3b8c0; }
td.cell.empty .txt { color: #c2c7cf; }
td.cell.error { background: var(--bad-bg); }
td.cell.warning { background: var(--warn-bg); }
td.cell.edited { box-shadow: inset 3px 0 0 var(--accent); }
td.cell.focus { outline: 2px solid var(--accent); outline-offset: -2px; }
td.cell .was { display: block; padding: 0 12px 6px; font-style: normal;
  font-size: 11px; color: var(--muted); }

.cell-fix { display: flex; align-items: center; gap: 6px; width: 100%;
  margin: 0; padding: 0; background: none; border: 0; border-radius: 0;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cell-fix:hover { background: rgba(0,0,0,.04); }
.cell-fix .mark { margin-left: auto; padding-right: 10px; font-weight: 700;
  font-size: 11px; }
td.cell.error .cell-fix .mark { color: var(--bad); }
td.cell.warning .cell-fix .mark { color: var(--warn); }

tr.row-note td { padding: 4px 12px 8px; font-size: 12.5px; background: inherit; }
tr.row-note .warning { color: var(--warn); }
tr.row-note .error { color: var(--bad); }

.pager { display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 12px 18px; flex-wrap: wrap; font-size: 13.5px; }
.pager .pages { display: flex; gap: 14px; align-items: center; }
.pager a { color: var(--accent); text-decoration: none; }

.reload { display: flex; align-items: center; gap: 12px; margin: -4px 0 24px 2px; }
.reload button { margin-top: 0; }
.reload .hint { margin: 0; }

/* The fix panel — one in the page, moved beside whichever cell was clicked. */
.panel { position: absolute; z-index: 40; width: 400px; max-width: calc(100vw - 32px);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.16); padding: 16px 18px 18px; }
.panel-close { position: absolute; top: 8px; right: 10px; margin: 0; padding: 2px 8px;
  background: none; color: var(--muted); font-size: 18px; line-height: 1; }
.panel-kind { margin: 0; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.panel-value { margin: 2px 0 4px; font-size: 17px; word-break: break-word; }
.panel-why { margin: 0 0 12px; font-size: 13.5px; color: var(--bad); }
.panel .choices { list-style: none; margin: 0 0 10px; padding: 0;
  max-height: 220px; overflow-y: auto; }
.panel .choices li + li { margin-top: 5px; }
.panel .choices label { display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
  cursor: pointer; font-size: 13.5px; }
.panel .choices label:hover { border-color: var(--accent); }
.panel .choices label:has(input:checked) { border-color: var(--accent);
  background: #f5f8ff; }
.panel .choices .name { flex: 1; }
.panel .choices .none { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.panel .tag { font-size: 10.5px; color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.panel .score { font-size: 11.5px; color: var(--good); font-weight: 600; }
.panel input[type=text], .panel input[type=search] { width: 100%; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 10px; }
.panel-actions button { margin-top: 0; font-size: 13.5px; }
.panel-actions .hint { margin: 0; flex-basis: 100%; }
.panel .revert { margin-top: 10px; border-top: 1px solid var(--line);
  padding-top: 10px; }
.panel .revert button { margin: 0; font-size: 13px; }
.do-this { background: var(--warn-bg); color: #6d4a06; border-radius: 8px;
  padding: 11px 13px; font-size: 13.5px; margin: 0 0 10px; }
.clash td { padding: 5px 10px 5px 0; font-size: 13.5px; }
