/* RegDesk — stylesheet
   Design note: this is a compliance ledger, not a marketing page.
   Dense, legible, quiet. Colour is reserved for urgency only. */

:root {
  --ink:        #14181f;
  --ink-2:      #414d5e;
  --ink-3:      #6b7787;
  --paper:      #f6f7f8;
  --surface:    #ffffff;
  --rule:       #dfe3e8;
  --rule-soft:  #edf0f3;
  --accent:     #1f6feb;
  --accent-dim: #e8f0fe;

  --ok:        #067647;
  --ok-bg:     #e7f6ee;
  --warning:   #92400e;
  --warning-bg:#fdf3e3;
  --critical:  #b54708;
  --critical-bg:#fdeadb;
  --overdue:   #b42318;
  --overdue-bg:#fdeceb;
  --none:      #6b7787;
  --none-bg:   #eff1f4;

  --radius: 6px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-size: 15px;
}
.brand span { color: var(--ink-3); font-weight: 400; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 6px 11px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-weight: 500;
}
.nav a:hover { background: var(--rule-soft); text-decoration: none; }
.nav a.active { background: var(--accent-dim); color: var(--accent); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-3);
  font-size: 13px;
}

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

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.page-head .sub { color: var(--ink-3); font-size: 13px; }
.page-head .spacer { margin-left: auto; }

/* ---------- Banner ---------- */
.banner {
  background: var(--warning-bg);
  border-bottom: 1px solid #f0dcc0;
  color: var(--warning);
  padding: 8px 20px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.banner strong { font-weight: 650; }

/* ---------- Flash ---------- */
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid;
}
.flash-ok    { background: var(--ok-bg);      color: var(--ok);      border-color: #bfe5d1; }
.flash-error { background: var(--overdue-bg); color: var(--overdue); border-color: #f3c9c5; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-soft);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card-body { padding: 16px; }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
table.data tbody tr:hover { background: #fbfcfd; }
table.data tbody tr:last-child td { border-bottom: none; }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }

/* ---------- Pills ---------- */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-ok       { background: var(--ok-bg);       color: var(--ok); }
.pill-warning  { background: var(--warning-bg);  color: var(--warning); }
.pill-critical { background: var(--critical-bg); color: var(--critical); }
.pill-overdue  { background: var(--overdue-bg);  color: var(--overdue); }
.pill-none     { background: var(--none-bg);     color: var(--none); }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field .lbl {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 5px;
}

input[type=text], input[type=email], input[type=password],
input[type=date], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.btn {
  display: inline-block;
  padding: 8px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
}
.btn:hover { background: var(--paper); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #1a5fd0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box { width: 100%; max-width: 360px; }
.login-box .brand { font-size: 22px; display: block; margin-bottom: 4px; }
.login-box .tag { color: var(--ink-3); font-size: 13px; margin-bottom: 22px; }
.login-box .card-body { padding: 20px; }
.login-box .btn { width: 100%; text-align: center; }
.login-foot { text-align: center; margin-top: 16px; font-size: 12px; color: var(--ink-3); }

@media (max-width: 640px) {
  .wrap { padding: 16px 12px 40px; }
  .nav a { padding: 6px 8px; }
  table.data th, table.data td { padding: 9px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Filter bar ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
.filters select,
.filters input[type=text] { width: auto; min-width: 140px; }
.filters .filter-search { min-width: 230px; flex: 1 1 230px; max-width: 320px; }

/* ---------- Validity bar ----------
   The signature element: time remaining shown as a track that fills up.
   Colour comes from urgency(), so it matches the pill beside it. */
.validity { display: flex; flex-direction: column; gap: 5px; }

.validity-bar {
  height: 5px;
  background: var(--rule-soft);
  border-radius: 100px;
  overflow: hidden;
}
.validity-fill {
  display: block;
  height: 100%;
  border-radius: 100px;
}
.fill-ok       { background: var(--ok); }
.fill-warning  { background: var(--warning); }
.fill-critical { background: var(--critical); }
.fill-overdue  { background: var(--overdue); }
.fill-none     { background: var(--none); }

.validity-text {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}