@import "tokens.css";
@import "../../shared/css/brand.css";

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-shell);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- shell: vertical menu, as the load board's admin theme lays it out ---- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  letter-spacing: -.2px;
}
.brand strong { color: var(--text-strong); font-weight: 700; }
.brand span { color: var(--accent); font-weight: 700; }
.brand .stage {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: 1px 5px;
}

.nav { padding: 10px 0; flex: 1; }
.nav-title {
  padding: 12px 18px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.nav a {
  display: block;
  padding: 8px 18px;
  color: var(--text);
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--bg-muted); text-decoration: none; }
.nav a[aria-current="page"] {
  border-left-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-dark);
  font-weight: 600;
}

.sidebar-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-faint);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 52px;
}
.topbar h1 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-strong); }
.topbar .who { margin-left: auto; font-size: 12px; color: var(--text-muted); }

.content { padding: 24px; flex: 1; }
.content > section { margin-bottom: 28px; }

/* ---- cards and tables ---- */

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-strong); }
.card-head .hint { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.tile .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.5px;
}
.tile .label { font-size: 12px; color: var(--text-muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 700;
  background: var(--bg-muted);
  white-space: nowrap;
}
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-muted); }

/* ---- outcome badges ----
   CC-PROD-003 is explicit: UNKNOWN and NO DATA must stay visually distinct from
   a negative or fraud finding. Grey is therefore its own state, never a pale red,
   and colour is never the only signal — each badge carries its own word. */

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.pass { background: var(--green-wash); color: var(--green-dark); border-color: var(--green); }
.badge.conditions { background: var(--green-wash); color: var(--green-dark); border-color: var(--green-dark); }
.badge.review { background: var(--yellow-wash); color: var(--yellow-dark); border-color: var(--yellow); }
.badge.block { background: var(--red-wash); color: var(--red-dark); border-color: var(--red); }
.badge.unknown { background: var(--bg-muted); color: var(--text-muted); border-color: var(--border-strong); }
.badge.unavailable {
  background: var(--bg-muted);
  color: var(--text-muted);
  border-style: dashed;
  border-color: var(--border-strong);
}

/* ---- forms and buttons ---- */

label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 7px 10px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.field { margin-bottom: 14px; }

button, .btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 7px 16px;
}
button:hover, .btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
}
button.secondary:hover { background: var(--bg-muted); }
button[disabled] { opacity: .55; cursor: not-allowed; }

.note {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-left: 3px solid var(--border-strong);
  padding: 8px 12px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.note.warn { border-left-color: var(--yellow); background: var(--yellow-wash); color: var(--yellow-dark); }
.error {
  color: var(--red-dark);
  background: var(--red-wash);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
}
.empty { padding: 28px 16px; text-align: center; color: var(--text-faint); }
code, .mono { font-family: var(--font-mono); font-size: 12px; }

/* ---- sign-in ---- */

.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin .card { width: 100%; max-width: 380px; }
.signin .brand { border-bottom: 0; padding-bottom: 4px; }

[hidden] { display: none !important; }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav { display: flex; flex-wrap: wrap; padding: 6px; }
  .nav-title { display: none; }
  .nav a { border-left: 0; border-bottom: 3px solid transparent; }
  .nav a[aria-current="page"] { border-left: 0; border-bottom-color: var(--accent); }
  .content { padding: 16px; }
}

/* Skip link, same contract as the public site: a keyboard user must be able to
   leave the navigation without tabbing through all of it. */
.skip {
  position: absolute; left: 50%; transform: translate(-50%, -150%);
  background: var(--text-strong, #2c303c); color: #fff; padding: 10px 18px;
  border-radius: 0 0 4px 4px; z-index: 100; transition: transform .15s;
}
.skip:focus { transform: translate(-50%, 0); }
