/* =============================================================================
   Portal app shell + auth layouts. Token-only. Desktop-first, degrades to tablet.
   ========================================================================== */

/* ---------- Shell grid ---------- */
.shell { display: grid; grid-template-columns: 264px 1fr; grid-template-rows: 56px 1fr; height: 100vh; }
.shell[data-panel="open"] { grid-template-columns: 264px 1fr; }
.shell__nav { grid-row: 1 / 3; background: var(--paper-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.shell__top { grid-column: 2; border-bottom: 1px solid var(--line); background: var(--paper-2); display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-6); }
.shell__main { grid-column: 2; grid-row: 2; overflow: auto; min-height: 0; }
.shell__content { max-width: var(--content-max); margin: 0 auto; padding: var(--gutter); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 0 1fr; }
  .shell__nav { position: fixed; z-index: 50; width: 264px; height: 100vh; transform: translateX(-100%); transition: transform var(--motion-base) var(--ease-out); }
  .shell__nav[data-open="true"] { transform: none; box-shadow: var(--elev-3); }
}

/* ---------- Brand block ---------- */
.brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-4); border-bottom: 1px solid var(--line); }
.brand__word { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; line-height: 1; }
.brand__word span { color: var(--aegis); }
.brand__sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3); margin-top: 4px; }

/* ---------- Container-tree nav ---------- */
.nav { flex: 1; overflow-y: auto; padding: var(--space-4) var(--space-3); }
.nav__group-label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); padding: var(--space-3) var(--space-3) 6px; }
.nav__item { display: flex; align-items: center; gap: var(--space-3); padding: 8px var(--space-3); border-radius: var(--radius-sm); color: var(--text-2); font-size: 14px; cursor: pointer; text-decoration: none;
  transition: background var(--motion-micro) var(--ease-out), color var(--motion-micro) var(--ease-out); }
.nav__item:hover { background: var(--sev-0-tint); color: var(--text); }
.nav__item.active { background: var(--sev-0-tint); color: var(--aegis-deep); font-weight: 600; }
.nav__item i { font-size: 17px; width: 20px; text-align: center; flex: 0 0 auto; }
.nav__item .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

/* Container tree (scoped person/place hierarchy) */
.tree__node { display: flex; align-items: center; gap: 8px; padding: 6px var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-small); color: var(--text-2); cursor: pointer; }
.tree__node:hover { background: var(--sev-0-tint); }
.tree__node.active { background: var(--sev-0-tint); color: var(--aegis-deep); font-weight: 600; }
.tree__node i { font-size: 15px; color: var(--text-3); }
.tree__toggle { border: none; background: none; cursor: pointer; color: var(--text-3); display: inline-flex; padding: 0; width: 16px; }

/* ---------- Top bar ---------- */
.top__menu { display: none; }
@media (max-width: 900px) { .top__menu { display: inline-flex; } }
.top__scope { display: inline-flex; align-items: center; gap: var(--space-2); height: 34px; padding: 0 var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: var(--text-small); color: var(--text); }
.top__scope:hover { border-color: var(--action); }
.top__scope .seg { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--aegis-deep); }
.top__search { flex: 1; max-width: 420px; }
.top__icons { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.top__icon-btn { position: relative; width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid transparent; background: none; cursor: pointer; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; }
.top__icon-btn:hover { background: var(--sev-0-tint); color: var(--action); }
.top__icon-btn i { font-size: 18px; }
.top__badge-dot { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--sev-3); border: 1.5px solid var(--paper-2); }
.top__id { display: inline-flex; align-items: center; gap: var(--space-2); height: 34px; padding: 0 6px 0 var(--space-2); border-radius: var(--radius-pill); cursor: pointer; }
.top__id:hover { background: var(--sev-0-tint); }

/* ---------- Breadcrumbs ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); padding-bottom: var(--space-4); flex-wrap: wrap; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--action); }
.crumbs .sep { color: var(--line-strong); }
.crumbs .current { color: var(--text); font-weight: 600; }

/* ---------- Right detail panel ---------- */
.detail { position: fixed; top: 0; right: 0; height: 100vh; width: 420px; max-width: 92vw; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--elev-3); z-index: 55; display: flex; flex-direction: column; animation: detail-in var(--motion-enter) var(--ease-out); }
.detail__head { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-6); border-bottom: 1px solid var(--line); }
.detail__body { padding: var(--space-6); overflow-y: auto; flex: 1; }
.detail__close { margin-left: auto; }
@keyframes detail-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Data pair rows in detail panels / reports */
.pair { display: grid; grid-template-columns: 130px 1fr; gap: var(--space-3); padding: 10px 0; border-bottom: 1px solid var(--line); font-size: var(--text-small); }
.pair__k { color: var(--text-3); font-family: var(--font-mono); font-size: 12px; }
.pair__v { color: var(--text); }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.page-head__eyebrow { font-family: var(--font-mono); font-size: var(--text-overline); letter-spacing: 0.16em; text-transform: uppercase; color: var(--aegis); margin-bottom: 8px; }
.page-head__sub { color: var(--text-3); font-size: var(--text-small); margin-top: 6px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }

/* ---------- Auth layout ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth__aside { display: none; } }
.auth__aside { background: var(--ink); color: var(--paper-2); padding: var(--space-16) var(--space-12); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth__aside::after { content: ""; position: absolute; right: -120px; top: -100px; width: 420px; height: 420px; background: radial-gradient(circle, rgba(116,199,192,.28), transparent 68%); }
.auth__aside-quote { font-family: var(--font-display); font-size: 26px; line-height: 1.4; max-width: 22ch; position: relative; }
.auth__aside-quote b { color: var(--aegis-glow); }
.auth__main { display: flex; align-items: center; justify-content: center; padding: var(--space-12) var(--space-6); }
.auth__card { width: 100%; max-width: 400px; }
.auth__providers { display: flex; flex-direction: column; gap: var(--space-3); }
.provider { display: flex; align-items: center; gap: var(--space-3); height: 46px; padding: 0 var(--space-4); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; width: 100%; transition: border-color var(--motion-micro) var(--ease-out); }
.provider:hover:not(:disabled) { border-color: var(--action); }
.provider:disabled { opacity: .5; cursor: not-allowed; }
.provider__logo { width: 20px; height: 20px; flex: 0 0 auto; }
.provider__meta { margin-left: auto; font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.auth__divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-6) 0; color: var(--text-3); font-size: 12px; }
.auth__divider::before, .auth__divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* Onboarding stepper */
.stepper { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-8); }
.stepper__step { display: flex; align-items: center; gap: var(--space-2); font-size: 12.5px; color: var(--text-3); }
.stepper__num { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12px; }
.stepper__step.done .stepper__num, .stepper__step.current .stepper__num { background: var(--action); color: var(--on-accent); border-color: var(--action); }
.stepper__step.current { color: var(--text); font-weight: 600; }
.stepper__bar { flex: 1; height: 1px; background: var(--line); }
