/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Body ───────────────────────────────────────────────────── */
html, body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--g800);
  background-image:
    radial-gradient(ellipse 900px 500px at 110% -5%, rgba(255,255,255,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 700px 450px at -8% 105%, rgba(255,255,255,0.05) 0%, transparent 58%),
    radial-gradient(ellipse 500px 300px at 50% 60%, rgba(42, 143, 116, 0.08) 0%, transparent 70%),
    linear-gradient(148deg, #227760 0%, #155443 50%, #0a2e24 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ── App Layout (Sidebar + Main) ────────────────────────────── */
#app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
#app-nav {
  width: var(--nav-width);
  flex-shrink: 0;
  background: var(--surface-nav);
  border-right: 1px solid var(--border-soft);
  box-shadow: var(--shadow-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition-slow), width var(--transition-slow);
}

/* ── Main Content ───────────────────────────────────────────── */
#app-main {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

/* ── Page Container ─────────────────────────────────────────── */
.page {
  padding: 28px 32px 60px;
  max-width: 1200px;
}

.page-full {
  padding: 28px 32px 60px;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--white);
  line-height: 1.15;
  text-shadow: 0 2px 16px rgba(6, 24, 18, 0.3);
}

.page-subtitle {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 0.92rem;
  font-weight: 400;
}

/* ── Login Layout ───────────────────────────────────────────── */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ── Overlay Backdrop (for mobile nav) ──────────────────────── */
#nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--radius-pill);
}

/* ── Links ──────────────────────────────────────────────────── */
a {
  color: var(--g100);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}
a:hover { color: var(--white); text-decoration: underline; text-underline-offset: 2px; }

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #app-nav {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 200;
  }
  #app-nav.open {
    transform: translateX(0);
  }
  #nav-overlay.visible {
    display: block;
  }
  .page, .page-full {
    padding: 16px 16px 60px;
  }
}

@media (min-width: 769px) {
  #app-layout {
    /* sidebar always visible */
  }
}
