/* Consently dashboard - dark, gradient-accented design system
   inspired by the Vision UI Dashboard reference. Single committed
   dark world (this is the brand, not a mode toggle). */

:root {
  --bg: #121325;
  --bg-2: #1a1c36;
  --surface: #1e2545;
  --surface-glass: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --ink: #ede8da;
  --ink-soft: #c9c2ab;
  --ink-faint: #8f886f;

  --accent: #e3a544;
  --accent-2: #39a67f;
  --accent-grad: linear-gradient(135deg, #e3a544 0%, #39a67f 100%);
  --cyan: #5cc79e;

  --success: #39a67f;
  --success-soft: rgba(57, 166, 127, 0.14);
  --warning: #fbbf5a;
  --warning-soft: rgba(251, 191, 90, 0.14);
  --danger: #d65a4a;
  --danger-soft: rgba(214, 90, 74, 0.14);
  --on-accent: #241a08; /* text/icon color on solid accent-grad fills - ochre is too light for white */

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;

  --shadow-card: 0 20px 40px -26px rgba(0, 0, 0, 0.65);
  --sidebar-w: 250px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image: radial-gradient(circle at 12% -10%, rgba(227, 165, 68, 0.14), transparent 46%),
    radial-gradient(circle at 100% 0%, rgba(57, 166, 127, 0.12), transparent 40%);
  background-attachment: fixed;
}

.mono {
  font-family: "Space Mono", ui-monospace, "SF Mono", monospace;
  font-variant-numeric: tabular-nums;
}

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

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--ink);
}

/* ---------- shell ---------- */

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

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-mark svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.92rem;
}
.nav-item:hover {
  background: var(--surface-glass);
  color: var(--ink);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-grad);
  color: var(--on-accent);
  box-shadow: 0 10px 24px -12px rgba(227, 165, 68, 0.7);
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-card {
  border: 1px solid var(--border);
  background: var(--surface-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-card .who {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-card .role {
  font-size: 0.76rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sidebar-link {
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding: 2px 12px;
}
.sidebar-link:hover {
  color: var(--ink);
}
.logout-link {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--ink-soft);
  padding: 2px 12px;
  background: none;
  box-shadow: none;
  text-align: left;
}
.logout-link:hover {
  color: var(--danger);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 34px 60px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar-sub {
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.topbar-links {
  display: flex;
  gap: 16px;
  font-size: 0.86rem;
}

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px;
  margin-bottom: 22px;
}
.card-title {
  font-weight: 700;
  font-size: 0.98rem;
  margin: 0 0 14px;
  color: var(--ink);
}

/* ---------- stat row ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--accent-grad);
  color: var(--on-accent);
}
.stat-icon svg {
  width: 20px;
  height: 20px;
}
.stat-icon.cyan {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--accent) 100%);
}
.stat-icon.danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--accent-2) 100%);
}
.stat-label {
  font-size: 0.76rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-family: "Space Mono", monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
}

/* ---------- sparkline ---------- */

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 64px;
}
.sparkline .bar {
  flex: 1;
  min-width: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--accent-grad);
  opacity: 0.85;
}
.sparkline .bar:last-child {
  opacity: 1;
  box-shadow: 0 0 14px rgba(227, 165, 68, 0.6);
}

/* ---------- messages ---------- */

.alert {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}
.alert-success {
  background: var(--success-soft);
  border-color: rgba(57, 166, 127, 0.35);
  color: var(--success);
}
.alert-error {
  background: var(--danger-soft);
  border-color: rgba(214, 90, 74, 0.35);
  color: var(--danger);
}
.alert-warning {
  background: var(--warning-soft);
  border-color: rgba(251, 191, 90, 0.35);
  color: var(--warning);
}

/* ---------- forms ---------- */

.form p {
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="date"],
.form input[type="number"],
.form textarea,
.form select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
}
.form input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(227, 165, 68, 0.22);
}
.form .helptext {
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.form ul.errorlist {
  list-style: none;
  margin: 0;
  padding: 8px 10px;
  background: var(--danger-soft);
  border: 1px solid rgba(214, 90, 74, 0.35);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.82rem;
}

button,
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  background: var(--accent-grad);
  color: var(--on-accent);
  box-shadow: 0 10px 24px -12px rgba(227, 165, 68, 0.7);
}
button:hover,
.btn:hover {
  filter: brightness(1.08);
  text-decoration: none;
}
.btn-ghost {
  background: var(--surface-glass);
  color: var(--ink);
  box-shadow: none;
  border: 1px solid var(--border);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.filter-bar input,
.filter-bar select {
  min-width: 0;
}

/* ---------- tables ---------- */

.table-wrap,
#results-wrapper {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  font-weight: 600;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.9rem;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover td {
  background: var(--surface-glass);
}
tfoot td {
  padding: 14px;
  color: var(--ink-soft);
  font-size: 0.84rem;
}
tfoot a {
  font-weight: 600;
}

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.76rem;
  font-weight: 700;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge-success {
  background: var(--success-soft);
  color: var(--success);
}
.badge-success::before {
  background: var(--success);
}
.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge-warning::before {
  background: var(--warning);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge-danger::before {
  background: var(--danger);
}

/* ---------- auth pages (login / staff setup) ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 34px 30px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.auth-card h1 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}
.auth-card .lede {
  color: var(--ink-soft);
  font-size: 0.86rem;
  margin: 0 0 20px;
}
.auth-card button {
  width: 100%;
  margin-top: 4px;
}

/* ---------- misc content pages ---------- */

.qr-frame {
  display: inline-block;
  background: #fff;
  padding: 20px;
  border-radius: var(--radius-md);
}
.qr-frame img {
  display: block;
  width: 260px;
  height: 260px;
}
.qr-fallback-code {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.qr-fallback-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.qr-fallback-digits {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--ink);
}
.key-reveal {
  display: inline-block;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--cyan);
  word-break: break-all;
}
.checklist label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.checklist label:last-of-type {
  border-bottom: none;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* ---------- responsive ---------- */

@media (max-width: 880px) {
  .shell {
    flex-direction: column;
  }
  .sidebar {
    position: static;
    height: auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 14px 16px;
  }
  .nav {
    flex-direction: row;
  }
  .sidebar-footer {
    margin-top: 0;
    margin-left: auto;
    flex-direction: row;
    align-items: center;
  }
  .user-card {
    display: none;
  }
  .main {
    padding: 20px;
  }
}

/* ---------- compliance report ---------- */

.report-meta {
  border-collapse: collapse;
}
.report-meta th {
  text-align: left;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 5px 18px 5px 0;
  vertical-align: top;
}
.report-meta td {
  padding: 5px 0;
}
.report-footer {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

@media print {
  .sidebar,
  .no-print {
    display: none !important;
  }
  .main {
    margin: 0;
    padding: 0;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
  body {
    background: #fff;
    color: #000;
  }
}
