/* Styled after Smarter Advertising's own report PDFs: navy title band, grey section bars,
   light-blue label cells, green / pink / amber status cells, plain Lato. */
:root {
  --navy: #1f3864;
  --navy-2: #2f4a7a;
  --label: #dce6f1;
  --section: #d0d0d0;
  --line: #9aa6b8;
  --ok: #8fdc8a;
  --bad: #f6c9c6;
  --bad-ink: #c00000;
  --warn: #fde3c0;
  --paper: #ffffff;
  --page: #eef0f3;
  --ink: #1b1b1b;
  --muted: #555b66;
  --link: #1f5fbf;
  --lock: #7a7f88;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body { font: 13px/1.45 "Lato", Calibri, "Segoe UI", Arial, sans-serif; }
a { color: var(--link); }
button { font: inherit; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); display: grid; gap: 18px; }

/* Title band, as on the reports */
.band { background: var(--navy); color: #fff; text-align: center; padding: 18px 16px 14px; border: 1px solid #14264a; }
.band h1 { margin: 0; font-size: clamp(22px, 3.4vw, 32px); font-weight: 700; letter-spacing: .2px; }
.band .sub { font-weight: 700; margin-top: 4px; }
.band .tag { font-style: italic; opacity: .85; margin-top: 2px; }
.strip { background: var(--label); border: 1px solid var(--line); border-top: 0; text-align: center; padding: 8px 12px; }
.strip b { color: var(--navy); }
.strip .who { color: var(--muted); margin-top: 2px; }
.strip a { margin-left: 6px; }

/* A numbered section box */
.box { background: var(--paper); border: 1px solid var(--line); }
.box > h2 { margin: 0; background: var(--section); padding: 7px 10px; font-size: 15px; color: var(--navy); border-bottom: 1px solid var(--line); }
.box > .lede { margin: 0; padding: 7px 10px; font-weight: 700; border-bottom: 1px solid var(--line); background: #f7f7f7; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th { background: var(--navy); color: #fff; text-align: left; font-weight: 700; padding: 6px 8px; border: 1px solid var(--line); white-space: nowrap; font-size: 12px; }
td { padding: 6px 8px; border: 1px solid var(--line); vertical-align: top; }
td.label { background: var(--label); font-weight: 700; color: var(--navy); white-space: nowrap; }
td.ok { background: var(--ok); }
td.bad { background: var(--bad); }
td.warn { background: var(--warn); }
td.num { text-align: right; }
.red { color: var(--bad-ink); }
.big { font-size: 22px; font-weight: 700; color: var(--navy); }
.small { font-size: 11px; color: var(--muted); }

/* Pipeline figures */
.figs td { text-align: center; }
.figs td .small { display: block; }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2e9e3e; margin-right: 6px; vertical-align: middle; }
@media (prefers-reduced-motion: no-preference) { .live { animation: blink 1.6s ease-in-out infinite; } @keyframes blink { 50% { opacity: .25; } } }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f7f7f7; }
.controls label { display: flex; gap: 6px; align-items: center; }
select, input[type=search], input[type=email], input[type=password], input[type=text], textarea {
  font: inherit; border: 1px solid #7f8a9c; background: #fff; padding: 4px 6px; border-radius: 0; color: var(--ink);
}
input[type=search] { flex: 1 1 220px; min-width: 0; }
.btn { border: 1px solid #5a6b88; background: linear-gradient(#fdfdfd, #dfe4ec); padding: 3px 10px; cursor: pointer; color: var(--ink); white-space: nowrap; }
.btn:hover { background: linear-gradient(#fff, #cfd8e6); }
.btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.btn.primary { background: linear-gradient(#3b5a91, var(--navy)); color: #fff; border-color: #14264a; }
.btn.locked { color: var(--lock); }
.btn[disabled] { opacity: .6; cursor: default; }
.trade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); border-left: 1px solid var(--line); }
.trade-cell { all: unset; box-sizing: border-box; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; padding: 4px 8px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; background: var(--paper); }
.trade-cell:hover { background: var(--label); }
.trade-cell:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.trade-cell[aria-pressed=true] { background: var(--label); font-weight: 700; }
.trade-link { color: var(--link); text-decoration: underline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-cell[aria-pressed=true] .trade-link { color: var(--navy); text-decoration: none; }
.trade-n { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Lead table */
.leads td.pri { text-align: center; font-weight: 700; width: 1%; }
.leads td.pri.A { background: var(--bad); color: var(--bad-ink); }
.leads td.pri.B { background: var(--warn); }
.leads td.pri.C { background: var(--label); }
.leads td.name { font-weight: 700; min-width: 180px; }
.leads td.name .small { font-weight: 400; display: block; }
.leads td.issues { min-width: 260px; }
.leads td.issues ul { margin: 0; padding-left: 16px; }
.leads td.act { white-space: nowrap; }
.leads td.act .btn + .btn { margin-left: 4px; }
.leads-box { max-height: 70vh; overflow: auto; }
.leads-box th { position: sticky; top: 0; z-index: 1; }
.foot { padding: 7px 10px; color: var(--muted); border-top: 1px solid var(--line); }

/* Locked features */
.lockcell { color: var(--lock); white-space: nowrap; }
.lockcell svg { vertical-align: -2px; margin-right: 4px; }

/* Dialogs */
dialog { border: 1px solid #14264a; padding: 0; width: min(920px, 96vw); max-height: 92vh; background: var(--paper); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(20, 30, 50, .45); }
.dlg-bar { background: var(--navy); color: #fff; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 2; }
.dlg-bar b { font-size: 14px; }
.dlg-body { padding: 14px; display: grid; gap: 14px; overflow: auto; }
.mail-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 10px; align-items: center; }
.mail-grid textarea { width: 100%; min-height: 300px; resize: vertical; line-height: 1.5; }
.mail-grid input { width: 100%; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.note { background: var(--warn); border: 1px solid #d9b77a; padding: 8px 10px; }

/* Login */
.login { max-width: 460px; margin: 8vh auto 0; }
.login form { display: grid; gap: 10px; padding: 14px; }
.login label { display: grid; gap: 4px; font-weight: 700; color: var(--navy); }
.login .err { background: var(--bad); color: var(--bad-ink); padding: 6px 10px; border: 1px solid #e59a95; }

@media (max-width: 720px) { .hide-sm { display: none; } }
@media print {
  body { background: #fff; }
  .wrap > :not(dialog), .dlg-bar .btn, .no-print { display: none !important; }
  dialog { position: static; box-shadow: none; border: 0; width: 100%; max-height: none; }
  dialog::backdrop { display: none; }
  .dlg-bar { position: static; }
}
