:root {
  --red: #c8102e; --red-deep: #9b0c23; --ink: #1d1d1f; --muted: #6b6f76; --line: #e3e5e8;
  --bg: #f5f6f7; --card: #fff;
  --pending: #6b6f76; --overdue: #b42318; --review: #b54708; --matched: #067647; --void: #98a2b3; --denied: #6941c6;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--red-deep); }
.top { display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: #fff; border-bottom: 3px solid var(--red); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { display: block; width: auto; }
/* The two wordmarks have different proportions (Kost 4.3:1, Big E 2.8:1);
   these heights give them the same visual weight. */
.brand img.kost { height: 34px; }
.brand img.bige { height: 44px; }
.brand .rule { width: 1px; height: 34px; background: var(--line); }
.app { font-weight: 600; font-size: 17px; }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { font-weight: 500; }
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 17px; margin: 0 0 6px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .warn { color: var(--overdue); }
.bar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 520px; margin: 40px auto; }
.btn { display: inline-block; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--red-deep); }
.btn.danger { color: var(--overdue); border-color: #f1b8b3; }
.flash { background: #ecfdf3; border: 1px solid #abefc6; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.errors { background: #fef3f2; border: 1px solid #fecdca; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.errors ul { margin: 4px 0 0; padding-left: 20px; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: 10px; }

.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab b { font-weight: 600; margin-left: 2px; }
select, input, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd3d8; border-radius: 7px; background: #fff; width: 100%; }
.filters select { width: auto; }
.filters input[type=checkbox] { width: auto; }

.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
table.list { width: 100%; border-collapse: collapse; }
.list th, .list td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafafa; }
.list tbody tr { cursor: pointer; } .list tbody tr:hover { background: #fafbfc; }
.list.compact { margin-top: 12px; } .list.compact tbody tr { cursor: default; }
.r { text-align: right !important; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: #fff; }
.pill.pending { background: var(--pending); } .pill.overdue { background: var(--overdue); }
.pill.review { background: var(--review); } .pill.matched { background: var(--matched); } .pill.void { background: var(--void); } .pill.denied { background: var(--denied); }
.card.status { border-left: 5px solid var(--pending); }
.card.status.overdue { border-left-color: var(--overdue); } .card.status.review { border-left-color: var(--review); }
.card.status.matched { border-left-color: var(--matched); } .card.status.void { border-left-color: var(--void); }
.card.status.denied { border-left-color: var(--denied); }

.form label { display: block; font-weight: 600; margin-bottom: 14px; }
.form label > input, .form label > select, .form label > textarea { margin-top: 4px; font-weight: 400; }
.form #vsearch { margin-bottom: 6px; }
.hint { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 3px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 4px; }
table.lines { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.lines th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 2px 4px; }
.lines td { padding: 3px 4px; }
.lines .n { max-width: 110px; }
.lines .x { border: 0; background: none; font-size: 20px; color: var(--muted); cursor: pointer; }
.actions { display: flex; gap: 12px; align-items: center; }
.actions form { margin: 0; }

dl.facts { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; }
.pre { white-space: pre-wrap; }

@media (max-width: 640px) {
  .row2 { grid-template-columns: 1fr; }
  dl.facts { grid-template-columns: 1fr; } dl.facts dd { margin-bottom: 6px; }
  .lines thead { display: none; } .lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .lines .n { max-width: none; }
  .top nav { margin-left: 0; width: 100%; }
  .brand img.kost { height: 26px; } .brand img.bige { height: 34px; } .brand .rule { height: 26px; }
}

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history li:last-child { border-bottom: 0; }
.history .when { color: var(--muted); font-size: 13px; }
.history .what b { font-weight: 600; }
.history .chg { color: var(--muted); font-size: 13px; }
.radio { display: block; font-weight: 400 !important; margin: 4px 0 !important; }
.radio input { width: auto; margin-right: 8px; }
.btn.deny { color: var(--denied); border-color: #d9d0f5; }
.conflict { background: #fef3f2; border: 1px solid #fecdca; border-radius: 8px; padding: 10px 14px; margin-top: 10px; }
@media (max-width: 640px) { .history li { grid-template-columns: 1fr; gap: 2px; } }

/* Sign-in page */
.signin { max-width: 460px; margin: 48px auto; text-align: center; padding: 36px 32px; }
.signin .logos { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 22px; }
.signin .logos img.kost { height: 44px; } .signin .logos img.bige { height: 58px; }
.signin .logos .rule { width: 1px; height: 46px; background: var(--line); }
.signin h1 { justify-content: center; font-size: 24px; margin-bottom: 4px; }
.signin p { margin: 0 0 22px; }
.btn.ms { display: inline-flex; align-items: center; gap: 10px; padding: 11px 20px; font-weight: 600; background: #fff; border: 1px solid #8c8c8c; color: #1f1f1f; }
.btn.ms:hover { background: #f3f3f3; }
.btn.ms svg { width: 20px; height: 20px; }
.signin .fine { margin: 22px 0 0; font-size: 13px; }
.top.bare { justify-content: center; }

/* Audit */
.navlink { font-weight: 600; text-decoration: none; color: var(--ink); padding: 6px 10px; border-radius: 7px; }
.navlink:hover { background: var(--bg); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--pending);
        border-radius: 10px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.tile b { font-size: 26px; line-height: 1.1; } .tile span { font-weight: 600; font-size: 14px; } .tile small { color: var(--muted); font-size: 12px; }
.tile.warn { border-left-color: var(--review); } .tile.bad { border-left-color: var(--overdue); }
.tile.ok { border-left-color: var(--matched); } .tile.denied { border-left-color: var(--denied); }
.tile:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.list.plain tbody tr { cursor: default; }
.card h2 { margin-bottom: 10px; }
.auditbox { border: 2px solid #d9d0f5; }
.auditbox h2 { display: flex; align-items: center; gap: 8px; }
.tag-audit { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--denied);
             border: 1px solid #d9d0f5; border-radius: 4px; padding: 1px 6px; }
.cands { width: 100%; border-collapse: collapse; margin: 6px 0 4px; font-size: 14px; }
.cands td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cands form { display: inline; margin: 0; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.ok { background: var(--matched); border-color: var(--matched); color: #fff; }
.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 8px 0; }
.inline input, .inline textarea { width: auto; flex: 1; min-width: 160px; }
.evid td, .evid th { padding: 5px 8px; font-size: 14px; border-bottom: 1px solid var(--line); text-align: left; }
.evid { border-collapse: collapse; width: 100%; margin: 6px 0 12px; }
.vcpill { font-weight: 600; } .vcpill.applied { color: var(--matched); } .vcpill.open { color: var(--overdue); } .vcpill.partial { color: var(--review); }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

/* Unaccounted parts */
.filters .sitepick { font-weight: 600; min-width: 220px; }
.list tr.tot td { font-weight: 700; border-top: 2px solid var(--ink); }
.list.parts tbody tr { cursor: default; }
.list.parts td { vertical-align: top; font-size: 14px; }
.list.parts td.wrap { white-space: normal; min-width: 220px; }
.list.parts tr.grp td { background: var(--ink); color: #fff; font-weight: 600; font-size: 13px; letter-spacing: .03em; }
.list.parts tr.m-found td:first-child { box-shadow: inset 4px 0 var(--matched); }
.list.parts tr.m-needs_return td:first-child { box-shadow: inset 4px 0 var(--review); }
.list.parts tr.m-missing td:first-child { box-shadow: inset 4px 0 var(--overdue); }
.markform { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin: 0; max-width: 330px; }
.markform .note { width: 100%; padding: 4px 8px; font-size: 13px; }
.btn.mk.on.found { background: var(--matched); border-color: var(--matched); color: #fff; }
.btn.mk.on.needs_return { background: var(--review); border-color: var(--review); color: #fff; }
.btn.mk.on.missing { background: var(--overdue); border-color: var(--overdue); color: #fff; }
.btn.mk.clear { color: var(--muted); }
main:has(.list.parts) { max-width: 1320px; }
.list.parts th, .list.parts td { padding: 8px 9px; }
.list.parts td.markcell { min-width: 330px; }
