:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #132349;   /* WillsWay Deep Navy */
  --crimson: #EE1C2E;  /* WillsWay Crimson */
  --orange: #FF7A1E;   /* WillsWay Sunset Orange */
  --ok: #15803d;
  --bad: #EE1C2E;
  --warn: #B04014;     /* WillsWay Rust */
}

* { box-sizing: border-box; }

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

body.centred { display: grid; place-items: center; min-height: 100vh; padding: 24px; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: Montserrat, "Segoe UI", system-ui, sans-serif;
  font-weight: 800; font-size: 18px; text-decoration: none;
  color: var(--accent); letter-spacing: -0.03em; white-space: nowrap;
}
.brand img { flex: none; }
.brand em { font-style: normal; color: var(--crimson); }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 13px; }

.tabs {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.tabs a {
  padding: 10px 12px; text-decoration: none; color: var(--muted);
  border-bottom: 2px solid transparent; font-size: 14px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .range { padding: 6px 0; }

main { padding: 20px; max-width: 1400px; margin: 0 auto; }

h1 { font-size: 22px; margin: 4px 0 2px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.note { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

select, input[type="search"], input[type="text"], button {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--panel); color: var(--ink);
}
button { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }

.btn {
  display: inline-block; padding: 7px 12px; border-radius: 6px; text-decoration: none;
  background: var(--accent); color: #fff; font-size: 14px; border: 1px solid var(--accent);
}
.btn.ghost { background: var(--panel); color: var(--accent); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile.warn { border-color: var(--orange); background: #fff7ed; }
.tile .k { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.tile .v { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.tile .n { font-size: 12px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 20px; }
.card.narrow { max-width: 520px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid rgba(0,0,0,0.12); }

.bar { display: flex; height: 30px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.bar .seg { display: grid; place-items: center; font-size: 12px; font-weight: 700; min-width: 2px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--line); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
table.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
table.grid tr:hover td { filter: brightness(0.97); }
table.calls td { white-space: nowrap; }
table.full { display: block; overflow-x: auto; }

table.heat { border-collapse: collapse; font-size: 11px; }
table.heat th { padding: 3px 5px; color: var(--muted); font-weight: 500; }
table.heat td { width: 26px; height: 24px; text-align: center; border: 1px solid var(--line); color: #fff; font-weight: 600; }

.empty { color: var(--muted); padding: 16px; text-align: center; }
.empty.good { color: var(--ok); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 14px; color: var(--muted); font-size: 14px; }

.status { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status.active { background: #dcfce7; color: #14532d; }
.status.pending { background: #fef3c7; color: #78350f; }
.status.revoked, .status.suspended { background: #fee2e2; color: #7f1d1d; }

.linkbox { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.foot { padding: 20px; text-align: center; color: var(--muted); font-size: 12px; }

@media (max-width: 640px) {
  main { padding: 12px; }
  .tabs { padding: 0 12px; }
  .topbar { padding: 10px 12px; }
}

/* --- top bar navigation and sign out ------------------------------------ */
.toplinks { display: flex; gap: 14px; }
.toplinks a {
  font-size: 13px; text-decoration: none; color: var(--muted);
  padding: 4px 0; border-bottom: 2px solid transparent;
}
.toplinks a:hover { color: var(--ink); }
.toplinks a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.signout {
  font-size: 13px; color: var(--muted); text-decoration: none;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px;
}
.signout:hover { color: var(--ink); border-color: var(--line); }

/* --- access management -------------------------------------------------- */
button.danger {
  background: var(--panel); color: var(--bad);
  border-color: var(--line); font-size: 12px; padding: 4px 10px;
}
button.danger:hover { background: #fee2e2; border-color: var(--bad); }

.grantchip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 4px 3px 11px; font-size: 12.5px;
  white-space: nowrap;
}
.grantchip em {
  font-style: normal; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.grantchip button {
  background: transparent; color: var(--muted); border: 0;
  font-size: 15px; line-height: 1; padding: 2px 7px; cursor: pointer;
  border-radius: 999px;
}
.grantchip button:hover { background: #fee2e2; color: var(--bad); }

a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 2px;
}

/* --- schedule form ------------------------------------------------------- */
.fieldrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.fieldrow.stack { align-items: flex-start; }
.fieldrow > label { font-size: 13px; color: var(--muted); }
.fieldrow > label.check {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink); font-size: 14px; cursor: pointer;
}
.fieldrow input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
button.secondary { background: var(--panel); color: var(--accent); }
button.secondary:hover { background: var(--panel-2, #eef1f6); }
