/* Cause List admin — the app's own tokens, on a desktop surface.
   Same Manrope, same navy, same hairlines, so this reads as part of the
   product rather than a bolted-on tool.

   The palette itself now lives in tokens.css, loaded before this file by
   index.html. Do not redefine a colour here — change it in tokens.css and both
   web surfaces follow. If every colour on the page looks grey, tokens.css did
   not get uploaded. */

* { box-sizing: border-box; }

/* Every panel here is shown and hidden with the HTML `hidden` attribute
   (`el.hidden = true`). The browser's own `[hidden] { display: none }` is the
   weakest rule there is, so any `display:` we set on the same element — and we
   set one on #bar, #login and .drawer — silently overrides it and the panel
   stays on screen. This puts `hidden` back in charge, once, for all of them. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
.muted { color: var(--slate); }
.error { color: var(--danger); font-weight: 600; }
.num { text-align: right; }

/* ---------- top bar ---------- */
header#bar {
  display: flex;
  align-items: center;
  gap: 22px;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  padding: 0 20px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; }
.brand .mark {
  background: var(--navy); color: #fff;
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center;
  font-size: 11px; letter-spacing: 0.5px;
}
header nav { display: flex; gap: 4px; }
.tab {
  background: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--slate);
  padding: 8px 12px; border-radius: 7px;
}
.tab:hover { background: var(--grey-tint); }
.tab.on { background: var(--navy-tint); color: var(--navy); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--slate); font-size: 13px; }

main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }

/* ---------- sign in ---------- */
#login { display: grid; place-items: center; min-height: 78vh; }
#loginForm {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 28px;
  width: min(390px, 92vw);
  display: flex; flex-direction: column; gap: 13px;
}
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 12.5px; color: var(--slate); }
input, select {
  font: inherit;
  padding: 10px 11px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--navy-tint); border-color: var(--navy); }

button { font: inherit; cursor: pointer; }
button.primary {
  background: var(--navy); color: #fff; border: 0;
  padding: 11px 16px; border-radius: 8px; font-weight: 700;
}
button.primary:disabled { opacity: 0.55; cursor: default; }
button.ghost {
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--hairline); padding: 8px 12px;
  border-radius: 8px; font-weight: 600;
}
button.ghost:hover { background: var(--grey-tint); }
button.danger { color: var(--danger); border-color: #F0CFCE; }
button.go { color: var(--navy); border-color: #C9D6EF; }

/* ---------- section heads ---------- */
.head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.head .actions { margin-left: auto; display: flex; gap: 8px; }
.count { color: var(--slate); font-weight: 600; font-size: 14px; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 11px 15px; min-width: 128px;
}
.stat b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.stat span { font-size: 11px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; color: var(--slate); }

/* ---------- tables ---------- */
.tablewrap {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th {
  text-align: left;
  font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--slate);
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FCFCFD; }
td.acct b { font-weight: 700; }
td.acct small { display: block; color: var(--slate); font-size: 11.5px; }
td .rowact { display: flex; gap: 6px; justify-content: flex-end; }

.pill {
  display: inline-block;
  font-size: 11px; font-weight: 800; letter-spacing: 0.4px;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.pill.on { background: var(--navy-tint); color: var(--navy); }
.pill.free { background: var(--grey-tint); color: var(--grey); }
.pill.active { background: var(--success-tint); color: var(--success); }
.pill.expired { background: var(--amber-tint); color: var(--amber); }
.pill.banned { background: var(--danger-tint); color: var(--danger); }
.pill.pending { background: var(--amber-tint); color: var(--amber); }
.pill.approved { background: var(--success-tint); color: var(--success); }
.pill.rejected { background: var(--danger-tint); color: var(--danger); }

.empty { padding: 34px; text-align: center; color: var(--slate); }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; inset: 0; background: rgba(16, 20, 30, 0.34);
  display: flex; justify-content: flex-end; z-index: 20;
}
.drawer-inner {
  background: var(--mist); width: min(560px, 96vw); height: 100%;
  overflow-y: auto; padding: 20px; border-left: 1px solid var(--hairline);
}
.drawer-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.drawer-head button { margin-left: auto; }
.panel {
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: 11px; padding: 15px; margin-bottom: 12px;
}
.panel h4 {
  margin: 0 0 10px; font-size: 10.5px; font-weight: 800;
  letter-spacing: 1.3px; text-transform: uppercase; color: var(--slate);
}
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; font-size: 13px; }
.kv span { color: var(--slate); }
.grantrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.caselist { max-height: 260px; overflow-y: auto; }
.caserow { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--hairline); font-size: 13px; }
.caserow:last-child { border-bottom: 0; }
.danger-zone { border-color: #F0CFCE; }
.danger-zone p { margin: 0 0 10px; font-size: 12.5px; color: var(--slate); line-height: 1.5; }

/* ---------- scrape health ----------
   The first thing on the screen, because a scraper that quietly stopped is the
   only failure in this product that costs somebody a hearing. Three states and
   they must never look alike: running normally, something to look at, and not
   running at all. No green — a working scraper is the expected case, not an
   achievement, and green here would be the first crack in "green means a
   posted result". */
.health {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 15px 17px;
  margin-bottom: 14px;
  display: flex;
  gap: 26px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.health.attention { background: var(--amber-tint); border-color: var(--amber-line); }
.health.stopped   { background: var(--danger-tint); border-color: var(--danger-line); }

.health-main { flex: 1 1 340px; min-width: 0; }
.health-top { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.health-top h3 { font-size: 15px; font-weight: 800; }
.health .big {
  display: block;
  font-size: 27px; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.15;
}
.health p { margin: 2px 0 0; font-size: 13px; color: var(--slate); line-height: 1.5; }
.health .note { margin-top: 9px; font-weight: 700; color: var(--amber); }
.health.stopped .note { color: var(--danger); }
.health .srcs { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.health .src { font-size: 12.5px; color: var(--slate); }
.health .src b { color: var(--ink); font-weight: 700; }

.health-spark { flex: 0 0 auto; margin: 0; }
.health-spark svg { display: block; }
.health-spark figcaption {
  display: flex; justify-content: space-between; gap: 14px;
  font-size: 11px; font-weight: 600; color: var(--slate); margin-top: 5px;
}

@media (max-width: 640px) {
  header#bar { gap: 12px; padding: 0 12px; }
  .who span { display: none; }
  main { padding: 16px 12px 50px; }
}
