/* DPS ERP Console.
   Every colour, face and measure comes from tokens.css — nothing is invented
   here, so the console and the landing page stay recognisably one product. */

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .h { font-family: var(--font-heading); letter-spacing: var(--tracking-tight); margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

.noscript { max-width: 34rem; margin: var(--space-16) auto; padding: 0 var(--space-6); }

/* ── Field label / eyebrow ─────────────────────────────────────────────── */
.label {
  font-family: var(--font-heading);
  font-size: var(--text-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ── Sign in ──────────────────────────────────────────────────────────── */
.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
}
.signin-card {
  width: 100%;
  max-width: 26rem;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-10);
}
.crest {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: var(--dps-orange);
  color: var(--dps-white);
  display: grid; place-items: center;
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: var(--text-h4);
  letter-spacing: 0;
  margin-bottom: var(--space-6);
}
.signin h1 { font-size: var(--text-h2); line-height: var(--leading-snug); margin-bottom: var(--space-2); }
.signin .sub { color: var(--ink-3); font-size: var(--text-sm); margin: 0 0 var(--space-8); }

.field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-5); }
.field input, .field select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
}
.field input:focus-visible, .field select:focus-visible,
button:focus-visible, a:focus-visible {
  outline: none;
  border-color: var(--dps-orange);
  box-shadow: 0 0 0 var(--ring-width) var(--color-primary-tint);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  font-size: var(--text-sm);
  cursor: pointer;
  background: var(--dps-orange);
  color: var(--dps-white);
}
.btn:hover:not(:disabled) { background: var(--color-primary-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-quiet {
  background: transparent; color: var(--ink-2); border-color: var(--border-strong);
}
.btn-quiet:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); }

.alert {
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
  border: 1px solid;
}
.alert-error { background: var(--status-red-soft); border-color: var(--status-red); color: #7a0210; }
.alert-info  { background: var(--color-primary-tint); border-color: var(--dps-orange); color: var(--dps-orange-dark); }
.alert-ok    { background: var(--status-green-soft); border-color: var(--dps-green); color: var(--dps-green-dark); }

/* ── App shell ────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 var(--space-6);
  display: flex; align-items: center; gap: var(--space-6);
  height: 64px;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand .crest { width: 32px; height: 32px; margin: 0; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.brand-name { font-family: var(--font-heading); font-weight: var(--fw-bold); font-size: var(--text-base); }
.brand-sub { font-size: var(--text-2xs); color: var(--ink-3); letter-spacing: var(--tracking-label); text-transform: uppercase; }

.nav { display: flex; gap: var(--space-1); margin-left: auto; }
.nav button {
  background: none; border: 0; cursor: pointer;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.nav button:hover { background: var(--bg); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--color-primary-tint); color: var(--dps-orange-dark); }

.who { display: flex; align-items: center; gap: var(--space-3); padding-left: var(--space-4); border-left: 1px solid var(--border-soft); }
.who-email { font-size: var(--text-sm); color: var(--ink-2); }
.who-role { font-size: var(--text-2xs); color: var(--ink-3); }

main { padding: var(--space-8) var(--space-6) var(--space-16); }
.container { max-width: var(--container-max); margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.page-head h2 { font-size: var(--text-h2); }
.page-head p { margin: var(--space-1) 0 0; color: var(--ink-3); font-size: var(--text-sm); max-width: 60ch; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel + .panel { margin-top: var(--space-6); }
.panel-head { padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.panel-head h3 { font-size: var(--text-h3); }
.panel-body { padding: var(--space-6); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { text-align: left; padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--border-soft); vertical-align: top; }
th {
  font-family: var(--font-heading);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  background: var(--bg);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbf9; }
.mono { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: var(--text-xs); }

.pill {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: var(--fw-semibold);
  font-family: var(--font-heading);
  letter-spacing: .04em;
  white-space: nowrap;
}
.pill-ok    { background: var(--status-green-soft); color: var(--dps-green-dark); }
.pill-deny  { background: var(--status-red-soft);   color: #7a0210; }
.pill-warn  { background: var(--status-yellow-soft); color: #8a5a00; }
.pill-quiet { background: var(--bg); color: var(--ink-3); border: 1px solid var(--border-soft); }
.pill-brand { background: var(--color-primary-tint); color: var(--dps-orange-dark); }

.perm-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.grid-2 { display: grid; gap: var(--space-4); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.checks { display: grid; gap: var(--space-2); max-height: 18rem; overflow-y: auto; padding-right: var(--space-2); }
.check { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.check:hover { background: var(--bg); }
.check input { margin-top: 3px; accent-color: var(--dps-orange); }
.check-label { font-size: var(--text-sm); font-weight: var(--fw-medium); }
.check-desc { font-size: var(--text-xs); color: var(--ink-3); }

.empty { padding: var(--space-12) var(--space-6); text-align: center; color: var(--ink-3); }
.empty p { margin: var(--space-2) 0 0; font-size: var(--text-sm); }

.filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.filters .field { margin: 0; min-width: 9rem; }

.muted { color: var(--ink-3); font-size: var(--text-sm); }
.stack { display: grid; gap: var(--space-6); }

.retention-note {
  font-size: var(--text-xs);
  color: var(--ink-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
}

/* ── Platform dashboard ───────────────────────────────────────────────── */
.stats { display: grid; gap: var(--space-4); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px)  { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1040px) { .stats { grid-template-columns: repeat(6, 1fr); } }

.stat {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.stat-value {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: 1.9rem;
  line-height: 1.1;
  letter-spacing: var(--tracking-tight);
  margin-top: var(--space-2);
  font-variant-numeric: tabular-nums;
}
/* Semantic, and separate from the brand accent — a number is not "on brand"
   or "off brand", it is fine or it is not. Green stays reserved for positive
   status exactly as the guideline requires. */
.stat-value.good { color: var(--dps-green-dark); }
.stat-value.warn { color: #8a5a00; }
.stat-value.bad  { color: var(--status-red); }
.stat-hint { font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--space-1); }

td.num, .num { font-variant-numeric: tabular-nums; }
