/* ══════════════════════════════════════════════════════════════════
   AXON Data Room — Admin app shell (Phase 2)
   Navy sidebar + topbar + content area. Built on design-system.css.
   ══════════════════════════════════════════════════════════════════ */

/* ---- App layout ---- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh;
  transition: grid-template-columns var(--dur-2) var(--ease); }
/* Desktop collapse: the hamburger shrinks the sidebar track to zero and
   the sidebar slides out of view. */
.app.nav-collapsed { grid-template-columns: 0 1fr; }
.app.nav-collapsed .sidebar { transform: translateX(-100%); }

/* The scrim (mobile overlay) must NOT occupy a grid track — it's hidden
   on desktop and position:fixed on mobile. */
.scrim { display: none; }

/* ---- Sidebar (navy) ---- */
.sidebar {
  background: var(--navy); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
  overflow: hidden; transition: transform var(--dur-2) var(--ease);
}
.sidebar__brand {
  display: flex; align-items: center; gap: var(--sp-2);
  height: var(--topbar-h); padding: 0 var(--sp-5);
  border-bottom: 1px solid rgba(255,255,255,0.08); flex-shrink: 0;
}
.sidebar__brand a { display: flex; align-items: center; gap: var(--sp-2); text-decoration: none; color: #fff; }
.sidebar__brand .logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.sidebar__brand .word { font-family: var(--font-head); font-weight: 700; letter-spacing: .02em; font-size: 16px; }
.sidebar__brand .word .mint { color: var(--mint); }
.sidebar__brand .sub { font-size: 11px; color: rgba(255,255,255,0.5); font-weight: 500; }

.nav { padding: var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav__label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,0.4); font-weight: 600; padding: var(--sp-3) var(--sp-3) var(--sp-2); }
.nav__item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3); border-radius: var(--r-sm);
  color: rgba(255,255,255,0.72); font-size: var(--fs-body); font-weight: 500;
  cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left;
  transition: background var(--dur-1), color var(--dur-1);
}
.nav__item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav__item.is-active { background: rgba(0,217,153,0.12); color: #fff; }
.nav__item.is-active .icon { color: var(--mint); }
.nav__item .icon { width: 18px; height: 18px; flex-shrink: 0; color: rgba(255,255,255,0.55); }
.nav__item.is-active { position: relative; }
.nav__item.is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--mint); }
.nav__item .count { margin-left: auto; font-size: 11px; background: rgba(255,255,255,0.12); padding: 1px 7px; border-radius: var(--r-full); }

.sidebar__foot { padding: var(--sp-4); border-top: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.sidebar__user { display: flex; align-items: center; gap: var(--sp-3); }
.sidebar__user .meta { min-width: 0; flex: 1; }
.sidebar__user .email { font-size: var(--fs-small); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user .role { font-size: 11px; color: rgba(255,255,255,0.5); }

/* ---- Main column ---- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-6);
  position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-family: var(--font-head); font-weight: 600; font-size: var(--fs-section); }
.topbar__spacer { flex: 1; }
/* The hamburger toggles the sidebar on ALL sizes now (desktop collapse +
   mobile off-canvas). Keep it visible; the specificity here beats the
   generic .btn display rule from admin.css. */
.topbar .topbar__hamburger { display: inline-flex; }
/* Animated hero donut, blended into the white topbar (source has a white
   bg, so multiply drops it to just the mark). */
.topbar__anim { height: 34px; width: auto; display: block; mix-blend-mode: multiply; pointer-events: none; }

.content { padding: var(--sp-8); max-width: var(--container); width: 100%; margin: 0 auto; }

/* ---- Page section ---- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap; }
.page-head__text .t-page { margin-bottom: var(--sp-1); }
.page-head__sub { color: var(--text-2); font-size: var(--fs-small); }
/* This page's subtitle is the single most important instruction on the
   Groups & Grants screen (it's what tells an admin their change here
   controls investor visibility), so it gets its own larger, highlighted
   treatment instead of the generic muted page subtitle style. */
.page-head__sub--callout {
  font-size: var(--fs-body); font-weight: 600; color: var(--navy);
  background: var(--mint-050); border: 1px solid var(--mint);
  border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); margin-top: var(--sp-2);
  display: inline-block;
}
.page-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---- Dashboard ---- */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--sp-5); align-items: start; }

/* Activity feed */
.feed { display: flex; flex-direction: column; }
.feed__item { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.feed__item:last-child { border-bottom: 0; }
.feed__icon { width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; flex-shrink: 0; }
.feed__icon svg { width: 16px; height: 16px; }
.feed__icon.good { background: var(--success-bg); color: var(--success); }
.feed__icon.info { background: var(--info-bg); color: var(--info); }
.feed__icon.warn { background: var(--danger-bg); color: var(--danger); }
.feed__body { min-width: 0; flex: 1; }
.feed__text { font-size: var(--fs-small); color: var(--text); }
.feed__text b { font-weight: 600; }
.feed__meta { font-size: var(--fs-caption); color: var(--text-3); margin-top: 2px; text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Quick actions */
.quick { display: flex; flex-direction: column; gap: var(--sp-2); }
.quick__btn {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md);
  background: #fff; cursor: pointer; text-align: left; transition: all var(--dur-1) var(--ease);
}
.quick__btn:hover { border-color: var(--mint); background: var(--mint-050); }
.quick__btn .ic { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--navy); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.quick__btn .ic svg { width: 17px; height: 17px; }
.quick__btn .lbl { font-weight: 600; font-size: var(--fs-small); }
.quick__btn .desc { font-size: var(--fs-caption); color: var(--text-3); text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ---- Section pages share the content area; only one visible ---- */
.section { display: none; }
.section.is-active { display: block; }

/* ---- Analytics ---- */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button { appearance: none; border: 0; background: #fff; color: var(--text-2); padding: 7px 14px; font-size: var(--fs-small); font-weight: 600; cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--gray-50); }
.seg button.is-active { background: var(--mint-050); color: #0a7f5c; }
.chart-box { position: relative; height: 300px; }
.chart-box--donut { height: 260px; max-width: 320px; margin: 0 auto; }
.an-2up { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
@media (max-width: 900px){ .an-2up { grid-template-columns: 1fr; } }
/* engagement heat bar in the investor table */
.heatbar { width: 92px; height: 8px; border-radius: 999px; background: var(--gray-100); overflow: hidden; display: inline-block; vertical-align: middle; }
.heatbar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--mint), var(--mint-600)); }

/* ---- Per-group access editor (replaces the wide matrix) ---- */
.matrix-wrap { padding: 0; }
.acc-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); background: var(--gray-25); }
/* Scroll-shadow cue instead of a styled native scrollbar — macOS forces
   auto-hide/overlay scrollbars at the OS level (System Settings > "Show
   scroll bars: Automatically"), which silently overrides scrollbar-width
   and ::-webkit-scrollbar styling in both Safari and Chrome, so a custom
   scrollbar can't be relied on to actually show. This trick instead fades
   in a shadow at the bottom edge whenever there's more content below the
   fold (via two background-attachment:local gradients), and the shadow
   disappears once you've scrolled to the true end — visible regardless
   of the OS's scrollbar setting. */
.acc-list {
  padding: var(--sp-2) 0; max-height: 520px; overflow-y: auto;
  background:
    linear-gradient(var(--white, #fff) 30%, rgba(255,255,255,0)) local,
    linear-gradient(rgba(255,255,255,0), var(--white, #fff) 70%) 0 100% local,
    radial-gradient(farthest-side at 50% 0, rgba(17,30,68,0.12), rgba(17,30,68,0)) 0 0,
    radial-gradient(farthest-side at 50% 100%, rgba(17,30,68,0.12), rgba(17,30,68,0)) 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 40px, 100% 40px, 100% 10px, 100% 10px;
  background-attachment: local, local, scroll, scroll;
}
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: 10px var(--sp-5) 10px 12px; border-bottom: 1px solid var(--gray-100); }
.acc-row:last-child { border-bottom: 0; }
.acc-row:hover { background: var(--gray-25); }
.acc-folder { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); min-width: 0; }
.acc-folder > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-folder svg { color: var(--gray-400); flex-shrink: 0; }
.acc-select { width: 150px; height: 34px; flex-shrink: 0; }

/* ---- Deny / loading full-screen ---- */
.fullscreen { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-6); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  /* Mobile: sidebar is off-canvas by default; .is-open slides it in over
     the content. .nav-collapsed is a no-op here (desktop-only). */
  .app, .app.nav-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform var(--dur-2) var(--ease); box-shadow: var(--sh-xl); }
  .sidebar.is-open, .app.nav-collapsed .sidebar.is-open { transform: none; }
  .app.nav-collapsed .sidebar:not(.is-open) { transform: translateX(-100%); }
  .topbar .topbar__hamburger { display: inline-flex; }
  .dash-grid { grid-template-columns: 1fr; }
  .content { padding: var(--sp-5); }
  .scrim { position: fixed; inset: 0; background: rgba(17,30,68,0.4); z-index: 39; display: none; }
  .scrim.is-open { display: block; }
}
