/* ============================================================
   FINANCIAL INTELLIGENCE PLATFORM — App Shell
   Same palette/type system as the portfolio site, distinct
   "application" structure: persistent sidebar, dense topbar,
   view-switched main panel (SPA, no reload).
   ============================================================ */

:root {
  --navy-950: #080D16;
  --navy-900: #0C131F;
  --navy-850: #101828;
  --navy-800: #141E2E;
  --navy-700: #1B2738;
  --slate-600: #3A4658;
  --slate-500: #5C6A80;
  --slate-400: #8592A6;
  --border: #212D3F;
  --border-soft: #182233;

  --ink: #F2F4F8;
  --ink-muted: #A7B0C0;
  --ink-faint: #5C6A80;

  --accent: #53D7A6;
  --accent-bright: #6EE7BE;
  --accent-dim: #3FB88F;
  --accent-soft: rgba(83, 215, 166, 0.12);
  --accent-line: rgba(83, 215, 166, 0.28);

  --gold: #C9A15A;

  --font-display: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --sidebar-w: 240px;
  --topbar-h: 76px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

html, body { height: 100%; margin: 0; }

body {
  background: var(--navy-950);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 2000;
  background: var(--navy-800); color: var(--ink); padding: 10px 16px;
  border-radius: 0 0 8px 0; border: 1px solid var(--border);
}
.skip-link:focus { left: 0; }

::selection { background: var(--accent-soft); color: var(--accent-bright); }

/* ============================================================
   APP SHELL LAYOUT
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--navy-900);
  border-right: 1px solid var(--border-soft);
  padding: 20px 16px 20px;
}

.app-sidebar-top { display: flex; flex-direction: column; gap: 22px; }

.app-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  font-size: 0.78rem;
  color: var(--ink-faint);
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}
.app-back:hover { color: var(--ink); background: rgba(255,255,255,0.05); }

.app-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.app-brand-mark {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-dim) 100%);
  box-shadow: 0 0 0 1px rgba(83,215,166,0.25), 0 4px 14px rgba(83,215,166,0.22);
}
.app-brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.app-brand-name { font-size: 0.92rem; font-weight: 600; color: var(--ink); line-height: 1.2; }
.app-brand-sub { font-size: 0.68rem; color: var(--accent); letter-spacing: 0.03em; text-transform: uppercase; }

.app-nav-list { display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; padding: 0; }

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-muted);
  transition: color 0.18s ease, background 0.18s ease;
}
.app-nav-link svg { flex-shrink: 0; opacity: 0.8; transition: opacity 0.18s ease; }
.app-nav-link:hover { color: var(--ink); background: rgba(255,255,255,0.045); }
.app-nav-link:hover svg { opacity: 1; }

.app-nav-link.is-active {
  color: var(--accent-bright);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.app-nav-link.is-active svg { opacity: 1; }

.app-sidebar-bottom { padding: 0 6px; }
.app-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  color: var(--ink-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px 6px 10px;
}
.app-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
}

/* ---------- Content column ---------- */
.app-content { display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
  height: var(--topbar-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 40px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(8,13,22,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.app-topbar-title { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.app-topbar-sub { font-size: 0.85rem; color: var(--ink-faint); margin: 0; }

.app-main { flex: 1; padding: 40px; }

.app-view { animation: appViewIn 0.25s ease; }
@keyframes appViewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .app-view { animation: none; } }

/* ---------- Placeholder state (used by every view for now) ---------- */
.app-placeholder {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  max-width: 560px;
  padding: 40px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
}
.app-placeholder-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.app-placeholder-text { color: var(--ink-muted); font-size: 0.98rem; line-height: 1.6; margin: 0; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
  }
  .app-sidebar-top { flex-direction: row; align-items: center; gap: 14px; }
  .app-back span { display: none; }
  .app-nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--navy-900); border-top: 1px solid var(--border-soft); padding: 6px 8px; }
  .app-nav-list { flex-direction: row; justify-content: space-between; }
  .app-nav-link { flex-direction: column; gap: 4px; font-size: 0.66rem; padding: 6px 4px; }
  .app-sidebar-bottom { display: none; }
  .app-main { padding: 24px; padding-bottom: 96px; }
  .app-topbar { padding: 0 24px; }
}
