/* Bid Engine design system — values copied verbatim from the approved mockups. */
:root {
  --bg: #f2f3f3;
  --navy: #1B3A5C;
  --link: #1A6BB5;
  --tint: #EAF5FC;
  --undo: #5BB8F5;
  --nav-muted: #A9C7E4;
  --ink: #16191f;
  --ink2: #545b64;
  --ink3: #879196;
  --green: #037f0c;
  --red: #d13212;
  --green-bg: #eaf5ec;
  --red-bg: #fdf0ee;
  --grey-bg: #eceef1;
  --rule: #eff1f2;
  --rule2: #e9ebed;
  --head: #fafbfc;
  --border: #aab7b8;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--link); text-decoration: none; cursor: pointer; }
a:hover { color: var(--link); text-decoration: underline; }
strong { font-weight: 600; }
button { font-family: inherit; }

/* ---------- top bar ---------- */
.topbar { background: var(--navy); }
.topbar-inner {
  max-width: 1280px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; padding: 0 24px; height: 48px; gap: 16px; flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand-mark { height: 20px; display: block; }
.brand-wordmark {
  height: 20px; display: flex; align-items: center; color: #ffffff;
  font-size: 14px; font-weight: 600; letter-spacing: 0.14em;
}
.topbar-divider { width: 1px; height: 18px; background: rgba(255, 255, 255, 0.25); }
.app-title { font-size: 15px; font-weight: 600; color: #ffffff; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.brand-switch { display: flex; align-items: center; gap: 6px; }
.brand-switch select { font-size: 13px; color: #ffffff; }
.user-name { font-size: 13px; color: var(--nav-muted); }
.user-name a { color: var(--nav-muted); }

/* selects styled as plain text, so the mockup chrome stays exact */
select.bare {
  appearance: none; -webkit-appearance: none; border: none; background: transparent;
  font-family: inherit; font-size: 13px; color: inherit; padding: 0; margin: 0; cursor: pointer;
}
select.bare option { color: var(--ink); background: #ffffff; }

/* ---------- tabs ---------- */
.tabs { background: #ffffff; border-bottom: 1px solid var(--rule2); }
.tabs-inner {
  max-width: 1280px; margin: 0 auto; display: flex; align-items: center;
  padding: 0 24px; gap: 28px; height: 44px; flex-wrap: wrap;
}
.tab { font-size: 14px; color: var(--ink2); height: 44px; display: flex; align-items: center; }
a.tab, a.tab:hover { text-decoration: none; color: var(--ink2); }
.tab.active, a.tab.active { font-size: 14px; font-weight: 600; color: var(--link); border-bottom: 2px solid var(--link); }
.tab-badge {
  background: var(--grey-bg); color: var(--ink2); font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 8px; margin-left: 6px;
}
.tab.active .tab-badge { background: var(--tint); color: var(--link); }

/* ---------- page shell ---------- */
.page { max-width: 1280px; margin: 0 auto; }
.content { padding: 20px 24px 32px 24px; display: flex; flex-direction: column; gap: 12px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.h1 { font-size: 20px; font-weight: 600; color: var(--ink); }
.sub { font-size: 13px; color: var(--ink2); }
.footnote { font-size: 12px; color: var(--ink3); }

/* ---------- pill buttons ---------- */
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border-radius: 16px; padding: 5px 16px; font-size: 13px; font-weight: 600;
  background: #ffffff; color: var(--ink); border: 1px solid var(--ink2); cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-danger { background: var(--red); color: #ffffff; border: 1px solid var(--red); }
.btn-danger-outline { background: #ffffff; color: var(--red); border: 1px solid var(--red); }
.btn[hidden] { display: none; }

/* ---------- filter pills ---------- */
.filters { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filters-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  display: flex; align-items: center; gap: 8px; background: #ffffff;
  border: 1px solid var(--border); border-radius: 16px; padding: 4px 12px;
}
.pill-wide { padding: 4px 14px; gap: 8px; }
.pill-on { display: flex; align-items: center; gap: 6px; background: var(--tint); border: 1px solid var(--link); border-radius: 16px; padding: 4px 12px; }
.pill-text { font-size: 13px; color: var(--ink); }
.pill input.search {
  border: none; outline: none; background: transparent; font-family: inherit;
  font-size: 13px; color: var(--ink); width: 190px; padding: 0;
}
.pill input.search::placeholder { color: var(--ink3); }
.pill-x { display: flex; align-items: center; cursor: pointer; }
.link-13 { font-size: 13px; font-weight: 600; }

/* ---------- table card ---------- */
.card { background: #ffffff; border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.grid, .grid-head, .grid-totals {
  display: grid; grid-template-columns: 24px repeat(28, minmax(0, 1fr));
  align-items: center; min-width: 1232px;
}
.grid-head { padding: 10px 20px; border-bottom: 2px solid var(--rule2); background: var(--head); }
.grid { padding: 11px 20px; border-bottom: 1px solid var(--rule); }
.grid:hover { background: var(--tint); }
.grid.selected { background: var(--tint); border-left: 3px solid var(--link); }
.grid-totals { padding: 11px 20px; background: var(--head); min-width: 1232px; }
.th { font-size: 12px; font-weight: 600; color: var(--ink2); }
.right { text-align: right; }
.th.right { display: flex; justify-content: flex-end; align-items: center; gap: 3px; }
.t14 { font-size: 14px; color: var(--ink); }
.t13 { font-size: 13px; color: var(--ink); }
.t12 { font-size: 12px; color: var(--ink2); }
.dim { color: var(--ink3); }
.mute { color: var(--ink2); }
.green { color: var(--green); }
.red { color: var(--red); }
.strike { text-decoration: line-through; }
.s1 { grid-column: span 1; } .s2 { grid-column: span 2; } .s3 { grid-column: span 3; }
.s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s14 { grid-column: span 14; }
.hold-grid { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); align-items: center; min-width: 1232px; }
.hold-head { padding: 10px 20px; border-bottom: 2px solid var(--rule2); background: var(--head); }
.hold-row { padding: 12px 20px; border-bottom: 1px solid var(--rule); }
.hold-row.last { border-bottom: none; }
.hold-row.alert { background: var(--red-bg); }

/* ---------- chips ---------- */
.chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 10px; display: inline-block; }
.chip-raise { background: var(--green-bg); color: var(--green); }
.chip-cut { background: var(--red-bg); color: var(--red); }
.chip-kill { background: var(--red); color: #ffffff; }
.chip-rev { background: var(--grey-bg); color: var(--ink2); }
.chip-frozen { background: var(--grey-bg); color: var(--ink2); font-size: 11px; font-weight: 400; padding: 2px 9px; border-radius: 10px; }
.chip-alert { background: var(--red); color: #ffffff; }

/* ---------- checkboxes ---------- */
input.cb {
  appearance: none; -webkit-appearance: none; margin: 0; width: 14px; height: 14px;
  border: 2px solid var(--ink3); border-radius: 2px; background: #ffffff; cursor: pointer;
  background-repeat: no-repeat; background-position: center;
}
input.cb:checked {
  background-color: var(--link); border-color: var(--link);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 16 16" fill="none"><path d="M3.5 8.5l3 3 6-7" stroke="%23ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}
input.cb:indeterminate {
  background-color: var(--link); border-color: var(--link);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 16 16" fill="none"><path d="M4 8h8" stroke="%23ffffff" stroke-width="2" stroke-linecap="round"/></svg>');
}
input.cb:disabled { border-color: #d5dbdb; background-color: var(--bg); cursor: default; }

/* ---------- drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: transparent; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 440px; max-width: 100%;
  background: #ffffff; box-shadow: -2px 0 12px rgba(0, 0, 0, 0.10);
  display: flex; flex-direction: column; padding: 24px; gap: 24px; overflow-y: auto;
}
.drawer-head { display: flex; flex-direction: column; gap: 8px; }
.drawer-top { display: flex; align-items: center; justify-content: space-between; }
.drawer-x { cursor: pointer; display: flex; }
.drawer-title { font-size: 20px; font-weight: 600; color: var(--ink); }
.audit-line { background: var(--head); border-radius: 8px; padding: 12px 16px; font-size: 13px; color: var(--ink2); }
.figure-row { display: flex; align-items: baseline; gap: 12px; }
.figure { font-size: 28px; font-weight: 600; color: var(--ink); }
.figure-delta { font-size: 15px; }
.block { display: flex; flex-direction: column; gap: 8px; }
.block-label { font-size: 13px; font-weight: 600; color: var(--ink2); }
.why { font-size: 14px; color: var(--ink); line-height: 1.6; }
.why-sub { font-size: 13px; color: var(--ink2); line-height: 1.5; }
.facts { background: var(--head); border-radius: 8px; padding: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fact-k { font-size: 12px; color: var(--ink3); }
.fact-v { font-size: 14px; color: var(--ink); }
.hist-row { display: flex; justify-content: space-between; gap: 12px; }
.drawer-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.btn-wide { border-radius: 16px; padding: 8px 16px; font-size: 14px; font-weight: 600; text-align: center; width: 100%; cursor: pointer; }

/* ---------- dialogs ---------- */
.scrim { position: fixed; inset: 0; background: rgba(22, 25, 31, 0.45); display: flex; align-items: center; justify-content: center; padding: 32px; z-index: 20; }
.dialog { width: 480px; max-width: 100%; background: #ffffff; border-radius: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog.narrow { width: 460px; }
.dialog-title { font-size: 20px; font-weight: 600; color: var(--ink); }
.dialog-body { font-size: 14px; color: var(--ink); line-height: 1.5; }
.dialog-note { font-size: 13px; color: var(--ink2); }
.dialog-warn { background: var(--red-bg); border-radius: 8px; padding: 12px 16px; font-size: 13px; color: var(--ink); line-height: 1.5; }
.preview { background: var(--head); border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.preview-row { display: flex; justify-content: space-between; gap: 16px; }
.confirm-input { background: #ffffff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px; font-size: 14px; color: var(--ink); font-family: inherit; width: 100%; }
.dialog-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.cancel { font-size: 14px; font-weight: 600; color: var(--ink2); padding: 8px 16px; background: none; border: none; cursor: pointer; }
.confirm { background: var(--red); border: none; border-radius: 16px; padding: 8px 24px; font-size: 14px; font-weight: 600; color: #ffffff; cursor: pointer; }
.confirm:disabled { background: var(--rule2); color: var(--ink3); cursor: default; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 24px; bottom: 24px; background: var(--navy); border-radius: 8px;
  padding: 10px 16px; display: flex; align-items: center; gap: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); z-index: 30;
}
.toast-text { font-size: 13px; color: #ffffff; }
.toast-undo { font-size: 13px; font-weight: 600; color: var(--undo); background: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }

/* ---------- lookup ---------- */
.answer { background: #ffffff; border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); padding: 20px 24px; max-width: 760px; display: flex; flex-direction: column; gap: 12px; }
.answer-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.answer-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.answer-body { font-size: 14px; color: var(--ink); line-height: 1.6; }
.search-form { max-width: 320px; }
.pill.focus { border-color: var(--link); }

/* ---------- admin ---------- */
.admin-card { background: #ffffff; border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); overflow: hidden; }
.admin-head { padding: 12px 20px; border-bottom: 2px solid var(--rule2); background: var(--head); font-size: 13px; font-weight: 600; color: var(--ink2); }
.admin-row { padding: 11px 20px; border-bottom: 1px solid var(--rule); display: grid; align-items: center; gap: 16px; }
.admin-row.last { border-bottom: none; }
.r-users { grid-template-columns: 3fr 2fr 2fr 3fr; }
.r-brands { grid-template-columns: 2fr 2fr 2fr 3fr; }
.r-runs { grid-template-columns: 3fr 2fr 2fr 2fr; }
.admin-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px; }
.input {
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px;
  font-size: 13px; font-family: inherit; color: var(--ink); background: #ffffff;
}
.select-box { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; background: #ffffff; }
.select-box select { font-size: 13px; }
.status-line { font-size: 13px; color: var(--ink2); padding: 0 20px 12px 20px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: 420px; max-width: 100%; background: #ffffff; border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); overflow: hidden; }
.login-panel { background: var(--navy); padding: 24px; display: flex; align-items: center; gap: 12px; }
.login-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.btn-google { border-radius: 16px; padding: 8px 20px; font-size: 14px; font-weight: 600; background: #ffffff; color: var(--ink); border: 1px solid var(--ink2); cursor: pointer; text-decoration: none; }

@media (max-width: 640px) {
  .content { padding: 16px 12px 24px 12px; }
  .topbar-inner, .tabs-inner { padding: 0 12px; }
  .drawer { width: 100%; }
}
