/* ==========================================================================
   Assessed Intelligence Brand Kit — Application Styles
   Grounded in Brand Guidelines v2.0
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@300;400;500;600;700&family=Lato:wght@300;400;700;900&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Primary palette */
  --rhino: #2E3F62;
  --mirage: #0E1426;
  --desert-storm: #F7F7F7;
  --ash-grey: #B9BBBD;

  /* Secondary */
  --iridium: #3D3C3A;
  --thunder: #33292F;

  /* Accents */
  --turquoise: #00E6E4;
  --radical-red: #FF4B6F;

  /* Derived */
  --ink: var(--mirage);
  --paper: var(--desert-storm);
  --rule: rgba(14, 20, 38, 0.14);
  --rule-light: rgba(255, 255, 255, 0.18);

  /* Type scale */
  --display: 'Oswald', 'Rift', sans-serif;
  --text: 'Lato', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--text);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ─── Typography primitives ────────────────────────────────────────────── */

.display {
  font-family: var(--display);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 0.98;
  color: var(--mirage);
}

.eyebrow {
  font-family: var(--text);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rhino);
}

.slide-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 48px;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--mirage);
  margin: 0;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.body {
  font-family: var(--text);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  color: var(--iridium);
}

.small {
  font-family: var(--text);
  font-size: 14px;
  line-height: 1.5;
  color: var(--iridium);
}

/* ─── Frame system ─────────────────────────────────────────────────────── */

.frame {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rhino);
  padding: 32px 40px;
  margin: 24px 0;
}

.frame::before,
.frame::after,
.frame > .tick-br,
.frame > .tick-bl {
  content: '';
  position: absolute;
  background: var(--rhino);
}

.frame::before {
  top: -1px; left: -1px;
  width: 14px; height: 1px;
}
.frame::after {
  top: -1px; left: -1px;
  width: 1px; height: 14px;
}

.frame-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}

.frame-header .mono {
  color: var(--rhino);
}

/* ─── Top navigation ───────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--mirage);
  color: var(--desert-storm);
  padding: 18px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar .brand-lockup {
  display: inline-flex;
  flex-direction: column;
  font-family: var(--display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1;
}
.topbar .brand-lockup .rule {
  height: 1px; background: currentColor;
  margin: 4px 0;
}
.topbar .brand-lockup .bot {
  font-size: 0.68em;
  font-weight: 400;
  letter-spacing: 0.26em;
}

.topbar nav {
  display: flex;
  gap: 28px;
  align-items: center;
}

.topbar nav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.15s;
  padding: 8px 0;
  border-bottom: 1px solid transparent;
}
.topbar nav a:hover { color: var(--desert-storm); }
.topbar nav a.active {
  color: var(--turquoise);
  border-bottom-color: var(--turquoise);
}

.topbar .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--text);
  font-size: 13px;
  color: var(--desert-storm);
}
.topbar .user-chip .role-badge {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--turquoise);
  color: var(--turquoise);
}
.topbar .user-chip .role-badge.admin { border-color: var(--radical-red); color: var(--radical-red); }
.topbar .user-chip .role-badge.partner { border-color: var(--ash-grey); color: var(--ash-grey); }

/* ─── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: stretch;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--text);
  font-style: italic;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  background: transparent;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.btn-primary { background: var(--mirage); color: white; }
.btn-secondary { background: var(--rhino); color: white; }
.btn-ghost {
  background: transparent;
  border-color: var(--rhino);
  color: var(--mirage);
}

.btn .btn-label {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: 160px;
  font-size: 14px;
}

.btn .btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  background: white;
  color: var(--mirage);
  border-left: 2px solid rgba(255, 255, 255, 0.25);
}
.btn-ghost .btn-icon { background: var(--mirage); color: white; }

.btn:hover { opacity: 0.92; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--rhino);
  color: var(--rhino);
  cursor: pointer;
  font-style: normal;
  font-weight: 500;
}
.btn-inline:hover { background: var(--rhino); color: var(--desert-storm); }
.btn-inline.danger { border-color: var(--radical-red); color: var(--radical-red); }
.btn-inline.danger:hover { background: var(--radical-red); color: white; }

/* ─── Cards ────────────────────────────────────────────────────────────── */

.card {
  background: white;
  border: 1px solid rgba(185, 187, 189, 0.5);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.15s ease;
}
.card:hover {
  box-shadow: 0 10px 30px rgba(14, 20, 38, 0.08);
}
.card .card-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rhino);
}
.card .card-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mirage);
  line-height: 1.1;
}
.card .card-desc {
  font-family: var(--text);
  font-size: 14px;
  line-height: 1.55;
  color: var(--iridium);
}
.card .card-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.card .card-meta .mono { font-size: 10px; color: var(--ash-grey); letter-spacing: 0.2em; }

.card.metric {
  border-top: 4px solid var(--radical-red);
}
.card.metric .big-number {
  font-family: var(--display);
  font-weight: 600;
  font-size: 48px;
  line-height: 0.95;
  color: var(--mirage);
}

/* ─── Layout ───────────────────────────────────────────────────────────── */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 40px;
}

.grid {
  display: grid;
  gap: 24px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 32px 24px; }
  .topbar { padding: 14px 20px; flex-wrap: wrap; gap: 12px; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ─── Section headers ──────────────────────────────────────────────────── */

.section-header {
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}
.section-header .title-stack .eyebrow { margin-bottom: 10px; display: block; }

/* ─── Status dots (audit log, badges) ──────────────────────────────────── */

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-turquoise { background: var(--turquoise); }
.dot-red { background: var(--radical-red); }
.dot-grey { background: var(--ash-grey); }

/* ─── Forms ────────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.field label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rhino);
  font-weight: 500;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="url"],
.field textarea,
.field select {
  font-family: var(--text);
  font-size: 15px;
  line-height: 1.4;
  color: var(--mirage);
  background: white;
  border: 1px solid var(--ash-grey);
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--rhino);
}
.field .hint {
  font-family: var(--text);
  font-size: 12px;
  color: var(--ash-grey);
}

/* ─── Tables ───────────────────────────────────────────────────────────── */

table.data {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--text);
  font-size: 14px;
  background: white;
}
table.data thead th {
  text-align: left;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rhino);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
table.data tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  color: var(--iridium);
}
table.data tbody tr:hover { background: rgba(46, 63, 98, 0.03); }

/* ─── Modal ────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 20, 38, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: white;
  max-width: 560px;
  width: 100%;
  padding: 36px 40px;
  position: relative;
  border-top: 4px solid var(--radical-red);
}
.modal .close {
  position: absolute;
  top: 12px; right: 16px;
  background: transparent; border: 0;
  font-family: var(--mono);
  font-size: 18px;
  color: var(--ash-grey);
  cursor: pointer;
}

/* ─── Toast ────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--mirage);
  color: var(--desert-storm);
  padding: 14px 20px;
  font-family: var(--text);
  font-size: 14px;
  border-left: 3px solid var(--turquoise);
  max-width: 420px;
  box-shadow: 0 14px 40px rgba(14, 20, 38, 0.35);
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: var(--radical-red); }

/* ─── Partner-type chips ───────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--rhino);
}
.chip.staff { border-color: var(--rhino); background: var(--rhino); color: var(--desert-storm); }
.chip.admin { border-color: var(--radical-red); background: var(--radical-red); color: white; }
.chip.partner { border-color: var(--turquoise); }

/* ─── Utilities ────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.spacer-sm { height: 12px; }
.spacer-md { height: 24px; }
.spacer-lg { height: 48px; }

.rule {
  display: block;
  height: 1px;
  background: var(--rule);
  margin: 24px 0;
}

.red-dot-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.red-dot-list li {
  padding: 8px 0 8px 22px;
  position: relative;
  font-family: var(--text);
  font-size: 14px;
  color: var(--iridium);
}
.red-dot-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 14px;
  width: 6px; height: 6px;
  background: var(--radical-red);
}

/* ─── Loading spinner ──────────────────────────────────────────────────── */

.loader {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--ash-grey);
  border-top-color: var(--rhino);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 14px;
  color: var(--iridium);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ─── Footer (brand tagline stack) ─────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 40px;
  text-align: center;
  background: var(--paper);
}
.site-footer .line {
  font-family: var(--text);
  font-style: italic;
  font-size: 14px;
  color: var(--rhino);
  line-height: 1.6;
}
.site-footer .line.mono {
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--rhino);
  margin-top: 6px;
}
