/* ══════════════════════════════════════════════════════════════════
   AXON Data Room — Design System (Phase 1)
   Notion/DocSend-grade B2B primitives. Tokens + components only.
   Every page is built from these; no ad-hoc styles on pages.
   ══════════════════════════════════════════════════════════════════ */

/* ─────────────────────────── TOKENS ─────────────────────────────── */
:root {
  /* Brand */
  --navy:        #111e44;
  --navy-700:    #1b2a56;
  --navy-600:    #26386b;
  --mint:        #00d999;
  --mint-600:    #00c489;
  --mint-050:    #e6faf4;

  /* Neutral gray scale (surfaces / borders / text) */
  --gray-25:     #fbfcfd;
  --gray-50:     #f6f8fa;
  --gray-100:    #eef1f5;
  --gray-200:    #e2e7ee;
  --gray-300:    #cdd5e0;
  --gray-400:    #9aa5b6;
  --gray-500:    #6b7688;
  --gray-600:    #4d5666;
  --gray-700:    #363d4a;
  --gray-800:    #232936;
  --gray-900:    #141922;

  /* Semantic surfaces / text */
  --bg:          #ffffff;
  --surface:     #ffffff;
  --surface-2:   var(--gray-50);
  --border:      var(--gray-200);
  --border-strong: var(--gray-300);
  --text:        var(--gray-900);
  --text-2:      var(--gray-600);
  --text-3:      var(--gray-500);
  --text-inv:    #ffffff;

  /* Status */
  --success:     #0f9d63;
  --success-bg:  #e6f7ef;
  --warning:     #b7791f;
  --warning-bg:  #fef6e7;
  --danger:      #c02b2b;
  --danger-bg:   #fdeaea;
  --info:        #2f6fed;
  --info-bg:     #eaf1ff;

  /* Typography */
  --font-head: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --fs-page:    28px;  --lh-page:   1.2;   --fw-page:   700;
  --fs-section: 19px;  --lh-section:1.3;   --fw-section:600;
  --fs-card:    15px;  --lh-card:   1.35;  --fw-card:   600;
  --fs-body:    14px;  --lh-body:   1.55;  --fw-body:   400;
  --fs-small:   13px;  --lh-small:  1.5;
  --fs-caption: 12px;  --lh-caption:1.45;

  /* Spacing scale (4px base) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  /* Radius */
  --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;

  /* Shadow */
  --sh-xs: 0 1px 2px rgba(17,30,68,0.06);
  --sh-sm: 0 1px 3px rgba(17,30,68,0.08), 0 1px 2px rgba(17,30,68,0.04);
  --sh-md: 0 4px 12px rgba(17,30,68,0.08), 0 2px 4px rgba(17,30,68,0.04);
  --sh-lg: 0 12px 32px rgba(17,30,68,0.12);
  --sh-xl: 0 24px 60px rgba(17,30,68,0.18);
  --ring:  0 0 0 3px rgba(0,217,153,0.28);
  --ring-danger: 0 0 0 3px rgba(192,43,43,0.22);

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --container: 1200px;
}

/* ─────────────────────────── RESET ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* The [hidden] attribute must win over any display rule (e.g. .app /
   .fullscreen set display:grid, which would otherwise keep them shown). */
[hidden] { display: none !important; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

/* ─────────────────────── TYPOGRAPHY ─────────────────────────────── */
.t-page    { font-family: var(--font-head); font-size: var(--fs-page); line-height: var(--lh-page); font-weight: var(--fw-page); letter-spacing: -0.02em; margin: 0; }
.t-section { font-family: var(--font-head); font-size: var(--fs-section); line-height: var(--lh-section); font-weight: var(--fw-section); letter-spacing: -0.01em; margin: 0; }
.t-card    { font-family: var(--font-head); font-size: var(--fs-card); line-height: var(--lh-card); font-weight: var(--fw-card); margin: 0; }
.t-body    { font-size: var(--fs-body); line-height: var(--lh-body); }
.t-small   { font-size: var(--fs-small); line-height: var(--lh-small); }
.t-caption { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.t-muted   { color: var(--text-2); }
.t-faint   { color: var(--text-3); }

/* ───────────────────────── BUTTONS ──────────────────────────────── */
.btn {
  --btn-bg: var(--navy); --btn-fg: #fff; --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 38px; padding: 0 var(--sp-4);
  font-size: var(--fs-body); font-weight: 600; line-height: 1;
  border: 1px solid var(--btn-bd); border-radius: var(--r-sm);
  background: var(--btn-bg); color: var(--btn-fg);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), opacity var(--dur-1);
}
.btn:hover   { filter: brightness(1.06); }
.btn:active  { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--ring); }
.btn[disabled], .btn.is-loading { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn--primary   { --btn-bg: var(--mint); --btn-fg: var(--navy); }
.btn--primary:hover { --btn-bg: var(--mint-600); filter: none; }
.btn--secondary { --btn-bg: #fff; --btn-fg: var(--text); --btn-bd: var(--border-strong); }
.btn--secondary:hover { --btn-bg: var(--gray-50); filter: none; }
.btn--ghost     { --btn-bg: transparent; --btn-fg: var(--text-2); --btn-bd: transparent; }
.btn--ghost:hover { --btn-bg: var(--gray-100); filter: none; }
.btn--danger    { --btn-bg: #fff; --btn-fg: var(--danger); --btn-bd: #f0c4c4; }
.btn--danger:hover { --btn-bg: var(--danger-bg); filter: none; }
.btn--danger.btn--solid { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; }

.btn--sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-small); }
.btn--lg { height: 46px; padding: 0 var(--sp-6); font-size: 15px; }
.btn--icon { width: 38px; padding: 0; }
.btn--icon.btn--sm { width: 30px; }
.btn--block { width: 100%; }

/* loading spinner inside button */
.btn.is-loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite; margin-right: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────────────────── INPUTS ───────────────────────────────── */
.field { display: block; margin-bottom: var(--sp-4); }
.field > .label { display: block; font-size: var(--fs-small); font-weight: 600; color: var(--text-2); margin-bottom: var(--sp-2); }
.field > .hint  { font-size: var(--fs-caption); color: var(--text-3); margin-top: var(--sp-2); text-transform: none; letter-spacing: 0; font-weight: 400; }
.field.has-error > .hint { color: var(--danger); }

.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 var(--sp-3);
  font-family: inherit; font-size: var(--fs-body); color: var(--text);
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.textarea { height: auto; min-height: 96px; padding: var(--sp-3); resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--gray-400); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--gray-400); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--mint); box-shadow: 0 0 0 2px rgba(0,217,153,0.18); outline: none; }
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--danger); }
.has-error .input:focus { box-shadow: var(--ring-danger); }
.input:disabled, .select:disabled { background: var(--gray-50); color: var(--text-3); cursor: not-allowed; }

/* Some legacy modals hand-roll bare <input>/<label class="field"> without
   the .input class. Normalize any bare input/select/textarea inside a
   modal so it matches the design system (and gets the clean focus ring,
   not the browser default glow). */
.modal input:not(.input):not([type=checkbox]):not([type=radio]),
.modal select:not(.select),
.modal textarea:not(.textarea) {
  width: 100%; height: 40px; padding: 0 var(--sp-3); margin-top: var(--sp-1);
  font-family: inherit; font-size: var(--fs-body); color: var(--text);
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.modal textarea:not(.textarea) { height: auto; min-height: 90px; padding: var(--sp-3); }
.modal input:not(.input):not([type=checkbox]):not([type=radio]):focus,
.modal select:not(.select):focus,
.modal textarea:not(.textarea):focus {
  border-color: var(--mint); box-shadow: 0 0 0 2px rgba(0,217,153,0.18); outline: none;
}
/* .field used as a bare label in legacy modals → make it a proper label. */
.modal label.field { display: block; font-size: var(--fs-small); font-weight: 600; color: var(--text-2); margin: 0 0 2px; }
.modal label.field + input, .modal label.field + select { margin-top: 0; }

.select {
  appearance: none; padding-right: var(--sp-8); cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236b7688' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4.5l3 3 3-3'/></svg>");
  background-repeat: no-repeat; background-position: right var(--sp-3) center;
}

/* input with leading icon */
.input-wrap { position: relative; }
.input-wrap > svg { position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--gray-400); pointer-events: none; }
.input-wrap > .input { padding-left: var(--sp-8); }

/* ─────────────────────────── CARDS ──────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card--flat { box-shadow: none; }
.card--interactive { transition: box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); cursor: pointer; }
.card--interactive:hover { box-shadow: var(--sh-md); border-color: var(--gray-300); transform: translateY(-1px); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) 0; }
.card__body { padding: var(--sp-5); }
.card__foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); background: var(--gray-25); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* Metric / KPI card */
.metric { padding: var(--sp-5); }
.metric__label { font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 600; }
.metric__value { font-family: var(--font-head); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin-top: var(--sp-2); line-height: 1; }
.metric__delta { font-size: var(--fs-small); margin-top: var(--sp-2); display: inline-flex; align-items: center; gap: 4px; }
.metric__delta.up { color: var(--success); }
.metric__delta.down { color: var(--danger); }
.metric__icon { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--mint-050); color: var(--mint-600); float: right; }
.metric__icon svg { width: 20px; height: 20px; }

/* ─────────────────────────── TABLE ──────────────────────────────── */
.table-wrap { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: auto; background: #fff; box-shadow: var(--sh-sm); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.table thead th {
  position: sticky; top: 0; z-index: 1; text-align: left;
  padding: var(--sp-3) var(--sp-4); background: var(--gray-25);
  font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3); font-weight: 600; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table thead th.sortable { cursor: pointer; user-select: none; }
.table thead th.sortable:hover { color: var(--text); }
.table thead th .sort-ind { opacity: 0.4; margin-left: 4px; }
.table thead th[aria-sort] .sort-ind { opacity: 1; color: var(--mint-600); }
.table tbody td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-1); }
.table tbody tr:hover { background: var(--gray-25); }
.table tbody tr.is-clickable { cursor: pointer; }
.table .cell-right { text-align: right; }
.table .cell-num { font-variant-numeric: tabular-nums; }

/* ────────────────────── BADGES / TAGS ───────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: var(--fs-caption); font-weight: 600; line-height: 1.5;
  letter-spacing: 0.01em; white-space: nowrap;
  background: var(--gray-100); color: var(--text-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--neutral  { background: var(--gray-100); color: var(--gray-600); }
.badge--success  { background: var(--success-bg); color: var(--success); }
.badge--warning  { background: var(--warning-bg); color: var(--warning); }
.badge--danger   { background: var(--danger-bg); color: var(--danger); }
.badge--info     { background: var(--info-bg); color: var(--info); }
.badge--mint     { background: var(--mint-050); color: var(--mint-600); }
/* semantic aliases */
.badge--role       { background: var(--navy); color: #fff; }
.badge--view       { background: var(--info-bg); color: var(--info); }
.badge--download   { background: var(--mint-050); color: var(--mint-600); }
.badge--perm       { background: var(--gray-100); color: var(--gray-600); font-family: var(--font-body); }

/* ────────────────────────── AVATAR ──────────────────────────────── */
.avatar {
  width: 34px; height: 34px; border-radius: var(--r-full); flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  color: #fff; background: var(--navy-600); text-transform: uppercase;
  font-family: var(--font-head);
}
.avatar--sm { width: 26px; height: 26px; font-size: 11px; }
.avatar--lg { width: 44px; height: 44px; font-size: 16px; }
/* deterministic tint variants (assigned by JS) */
.avatar.c1 { background: #3f5bd9; } .avatar.c2 { background: #2f9e8f; }
.avatar.c3 { background: #b7692f; } .avatar.c4 { background: #8a51c4; }
.avatar.c5 { background: #c44f78; } .avatar.c6 { background: #2f7fb0; }

/* ──────────────────────── BREADCRUMB ────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: var(--sp-1); flex-wrap: wrap; font-size: var(--fs-small); color: var(--text-3); }
.breadcrumb a, .breadcrumb .crumb { color: var(--text-2); text-decoration: none; padding: 2px 6px; border-radius: var(--r-xs); cursor: pointer; }
.breadcrumb a:hover, .breadcrumb .crumb:hover { background: var(--gray-100); color: var(--text); }
.breadcrumb .sep { color: var(--gray-300); }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ─────────────────────────── MODAL ──────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: var(--sp-5);
  background: rgba(17,30,68,0.45); backdrop-filter: blur(3px);
  animation: overlayIn var(--dur-2) var(--ease);
}
.modal-overlay.is-open { display: flex; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(520px, 100%); background: #fff; border-radius: var(--r-xl);
  box-shadow: var(--sh-xl); overflow: hidden; animation: modalIn var(--dur-3) var(--ease);
}
@keyframes modalIn { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal--lg { width: min(760px, 100%); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border); }
.modal__title { font-family: var(--font-head); font-size: var(--fs-section); font-weight: 600; margin: 0; }
.modal__body { padding: var(--sp-6); max-height: 70vh; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border); background: var(--gray-25); }

/* ─────────────────────────── TOAST ──────────────────────────────── */
.toast-region { position: fixed; bottom: var(--sp-6); left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: var(--sp-2); align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  min-width: 260px; max-width: 440px; padding: var(--sp-3) var(--sp-4);
  background: var(--navy); color: #fff; border-radius: var(--r-md);
  box-shadow: var(--sh-lg); font-size: var(--fs-small);
  transform: translateY(16px); opacity: 0; transition: all var(--dur-2) var(--ease); pointer-events: auto;
}
.toast.is-show { transform: none; opacity: 1; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast--success { background: #10331f; } .toast--success svg { color: var(--mint); }
.toast--error   { background: #3a1414; } .toast--error svg { color: #ff8080; }

/* ─────────────────────── EMPTY STATE ────────────────────────────── */
.empty { text-align: center; padding: var(--sp-12) var(--sp-6); color: var(--text-2); }
.empty__icon { width: 52px; height: 52px; margin: 0 auto var(--sp-4); border-radius: var(--r-lg); display: grid; place-items: center; background: var(--gray-100); color: var(--gray-400); }
.empty__icon svg { width: 26px; height: 26px; }
.empty__title { font-family: var(--font-head); font-size: var(--fs-card); font-weight: 600; color: var(--text); margin: 0 0 var(--sp-2); }
.empty__text { font-size: var(--fs-small); color: var(--text-3); margin: 0 auto var(--sp-5); max-width: 340px; }

/* ─────────────────────── SKELETON ───────────────────────────────── */
.skeleton { position: relative; overflow: hidden; background: var(--gray-100); border-radius: var(--r-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton--text { height: 12px; margin: 6px 0; }
.skeleton--title { height: 20px; width: 40%; }
.skeleton--line { height: 12px; }
.skeleton--block { height: 96px; border-radius: var(--r-md); }
.skeleton--avatar { width: 34px; height: 34px; border-radius: var(--r-full); }

/* ─────────────────────── UTILITIES ──────────────────────────────── */
.stack   { display: flex; flex-direction: column; }
.row     { display: flex; align-items: center; }
.gap-1{gap:var(--sp-1)} .gap-2{gap:var(--sp-2)} .gap-3{gap:var(--sp-3)} .gap-4{gap:var(--sp-4)} .gap-5{gap:var(--sp-5)}
.grow    { flex: 1; }
.wrap    { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-2{margin-top:var(--sp-2)} .mt-4{margin-top:var(--sp-4)} .mt-6{margin-top:var(--sp-6)}
.hidden  { display: none !important; }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--sp-5) 0; }

/* Icon sizing helper (Lucide inline SVGs) */
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; stroke-width: 2; }
.icon--sm { width: 15px; height: 15px; }
.icon--lg { width: 22px; height: 22px; }

/* ─────────────────────── BRANDED LOADER ─────────────────────────────
   Same pulsing-wordmark-in-spinning-ring loader as axon.inc, adapted
   for the data room: pairs the mark with a line about what's on the
   other side of the gate (the investor's access to AXON's information),
   rather than a generic "loading" message. */
.axon-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-5);
  background: #fff;
  opacity: 1;
  transition: opacity 500ms ease;
}
.axon-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.axon-loader-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 132px;
  height: 132px;
}
.axon-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 217, 153, 0.16);
  border-top-color: var(--mint);
  animation: axon-spin 0.9s linear infinite;
}
.axon-loader-logo {
  width: 96px;
  height: auto;
  animation: axon-pulse 1.6s ease-in-out infinite;
}
.axon-loader-caption {
  font-size: var(--fs-small);
  color: var(--text-2);
  text-align: center;
  max-width: 320px;
  line-height: 1.5;
}
@keyframes axon-spin {
  to { transform: rotate(360deg); }
}
@keyframes axon-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.97); }
  50%      { opacity: 1;    transform: scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .axon-loader-ring { animation-duration: 1.8s; }
  .axon-loader-logo { animation: none; opacity: 1; }
}
