/* RollCall - compliance tooling for security companies.
   Deliberately plain: this is read on a laptop in an ops office, often by
   someone in a hurry, and the status colours have to be the loudest thing on
   the page. */

:root {
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --brand: #14532d;
  --brand-ink: #ffffff;

  --red: #b91c1c;
  --red-bg: #fef2f2;
  --amber: #c2410c;
  --amber-bg: #fff7ed;
  --yellow: #a16207;
  --green: #15803d;
  --green-bg: #f0fdf4;
}

* { box-sizing: border-box; }

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

a { color: #1d4ed8; }
a:hover { color: #1e40af; }

/* ── Chrome ─────────────────────────────────────────────────────────────── */

header.top {
  background: var(--brand);
  color: var(--brand-ink);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
header.top .brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.2px;
  padding: 14px 0;
  color: #fff;
  text-decoration: none;
}
header.top .brand span { opacity: 0.72; font-weight: 400; font-size: 13px; margin-left: 8px; }
header.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
header.top nav a {
  color: #d7e5dc;
  text-decoration: none;
  padding: 15px 12px;
  font-size: 14px;
  border-bottom: 3px solid transparent;
}
header.top nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
header.top nav a.on { color: #fff; border-bottom-color: #86efac; font-weight: 600; }
header.top .who { font-size: 13px; opacity: 0.85; display: flex; align-items: center; gap: 10px; }
header.top .who form { display: inline; }
header.top .who button {
  background: rgba(255,255,255,0.14); color: #fff; border: 0;
  padding: 6px 12px; border-radius: 5px; cursor: pointer; font-size: 13px;
}
header.top .who button:hover { background: rgba(255,255,255,0.24); }

.acting-bar {
  background: #78350f; color: #fff; padding: 8px 20px; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
}
.acting-bar button {
  background: #fff; color: #78350f; border: 0; padding: 4px 10px;
  border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600;
}

main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }

h1 { font-size: 23px; margin: 0 0 4px; letter-spacing: -0.3px; }
h2 { font-size: 17px; margin: 30px 0 10px; }
h3 { font-size: 14px; margin: 20px 0 8px; text-transform: uppercase;
     letter-spacing: 0.6px; color: var(--muted); }
p.sub { color: var(--muted); margin: 0 0 20px; }

/* ── Panels ─────────────────────────────────────────────────────────────── */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel.tight { padding: 0; overflow: hidden; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }

.msg {
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af;
  padding: 11px 14px; border-radius: 7px; margin-bottom: 18px; font-size: 14px;
}
.msg.warn { background: var(--amber-bg); border-color: #fed7aa; color: var(--amber); }
.msg.bad  { background: var(--red-bg);   border-color: #fecaca; color: var(--red); }

/* The headline. If nothing else on the page is read, this must be. */
.redline {
  border-radius: 8px; padding: 20px 22px; margin-bottom: 20px;
  border: 1px solid transparent; display: flex; gap: 18px; align-items: center;
}
.redline.bad  { background: var(--red-bg);   border-color: #fecaca; }
.redline.good { background: var(--green-bg); border-color: #bbf7d0; }
.redline .n { font-size: 42px; font-weight: 800; line-height: 1; }
.redline.bad .n  { color: var(--red); }
.redline.good .n { color: var(--green); }
.redline .t { font-size: 17px; font-weight: 700; }
.redline.bad .t  { color: var(--red); }
.redline.good .t { color: var(--green); }
.redline .d { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* ── Stats ──────────────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px;
}
.stat .v { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.stat.red .v { color: var(--red); }
.stat.amber .v { color: var(--amber); }
.stat.green .v { color: var(--green); }

/* ── Tables ─────────────────────────────────────────────────────────────── */

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 600; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid #f1f3f5; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap, th.nowrap { white-space: nowrap; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ── Status pills ───────────────────────────────────────────────────────── */

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap;
}
.pill.finding, .pill.expired,
.pill.window_missed                     { background: var(--red-bg); color: var(--red); }
.pill.critical                          { background: var(--amber-bg); color: var(--amber); }
.pill.warning                           { background: #fefce8; color: var(--yellow); }
.pill.notice, .pill.inactive            { background: #f3f4f6; color: var(--muted); }
.pill.valid, .pill.compliant            { background: var(--green-bg); color: var(--green); }
.pill.no_records                        { background: var(--amber-bg); color: var(--amber); }

.reason { color: var(--red); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 6px;
  font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #bfdbfe; outline-offset: -1px; border-color: #60a5fa;
}
textarea { min-height: 90px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.field { margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.check label { margin: 0; font-weight: 400; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

button, .btn {
  display: inline-block; background: var(--brand); color: #fff; border: 0;
  padding: 9px 16px; border-radius: 6px; font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: #166534; color: #fff; }
button.ghost, .btn.ghost {
  background: #fff; color: var(--ink); border: 1px solid #cbd5e1; font-weight: 500;
}
button.ghost:hover, .btn.ghost:hover { background: #f8fafc; color: var(--ink); }
button.danger { background: var(--red); }
button.danger:hover { background: #991b1b; }
button.sm, .btn.sm { padding: 5px 10px; font-size: 12.5px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .field { margin: 0; }
.spacer { flex: 1; }

/* ── Auth pages ─────────────────────────────────────────────────────────── */

.auth { max-width: 420px; margin: 8vh auto; padding: 0 20px; }
.auth .logo { font-size: 26px; font-weight: 800; color: var(--brand); margin-bottom: 4px; }
.auth .tag { color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.auth .panel { padding: 24px; }
.auth .alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }

.legal {
  color: var(--muted); font-size: 12px; line-height: 1.6;
  border-top: 1px solid var(--line); margin-top: 36px; padding-top: 14px;
}

@media (max-width: 720px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }

  /* On a phone the default wrap turned the header into a ragged block that ate
     half the screen before any content. Re-order it into two rows instead:
     brand + sign-out on the first, the section nav scrolling sideways on the
     second. Ordering the existing elements avoids a hamburger, which would need
     JavaScript and hide the one tab (Officers) people actually reach for. */
  header.top { flex-wrap: wrap; gap: 0; padding: 0 14px; align-items: center; }
  header.top .brand { order: 1; flex: 1 1 auto; padding: 11px 0; font-size: 17px; }
  header.top .who   { order: 2; flex: 0 0 auto; }
  header.top .who span { display: none; }          /* the name is not worth a row */
  header.top nav {
    order: 3;
    flex: 1 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }
  header.top nav::-webkit-scrollbar { display: none; }
  header.top nav a { padding: 11px 10px; font-size: 13.5px; white-space: nowrap; }

  main { padding: 18px 14px 48px; }
  h1 { font-size: 20px; }
  /* The label wraps to three lines on a phone, so centring leaves the number
     stranded halfway down with nothing beside it. Top-align it against the
     heading instead, with a nudge to sit on the cap height. */
  .redline { padding: 16px; gap: 14px; align-items: flex-start; }
  .redline .n { font-size: 34px; padding-top: 2px; }
  .redline .t { font-size: 15px; }
  .stats { grid-template-columns: 1fr 1fr; }

  /* Touch targets: a 5px-tall link in a table row is unusable with a thumb. */
  button, .btn { padding: 11px 16px; }
  button.sm, .btn.sm { padding: 8px 12px; }
  .toolbar { gap: 8px; }
}
