/* ====== Theme tokens (keep your existing colors) ====== */
:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #141824;
  --panel-2: #101320;
  --text: #e6e8ee;
  --muted: #aab0c0;
  --border: #232a3b;
  --link: #8ab4f8;

  --radius: 12px;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --gap: 18px;

  --header-h: 64px;
  --sidebar-w: 260px;

  /* how wide the “centered page” can get */
  --page-max: 1200px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.45;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ====== Centered “page” wrapper (adds gutters) ====== */
.page {
  max-width: var(--page-max);
  margin: 0 auto;

  /* gutters shrink on small screens */
  padding-inline: clamp(12px, 3vw, 28px);
}

/* ====== Grid Shell: header, sidebar, main ====== */
.app {
  min-height: 100vh; /* full viewport height baseline */ /* MDN cookbook notes 100vh for full-page layouts */
  display: grid;

  grid-template-columns: minmax(220px, var(--sidebar-w)) 1fr;
  grid-template-rows: var(--header-h) 1fr;

  grid-template-areas:
    "header header"
    "sidebar main";

  /* space between sidebar and main; header stays flush */
  column-gap: var(--gap);
  row-gap: var(--gap);

  padding-block: var(--gap);
}

/* Header */
.app-header {
  grid-area: header;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);

  height: var(--header-h);
  padding: 0 20px;

  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: baseline; gap: 12px; }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: 0.2px; }
.brand .subtitle { color: var(--muted); font-size: 13px; }

/* Sidebar fills the entire left column height */
.app-sidebar {
  grid-area: sidebar;
  align-self: stretch;
}

/* Make the nav card stretch top-to-bottom in the sidebar */
.nav-card {
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);

  display: flex;
  flex-direction: column;

  padding: 12px;
}

.nav-title {
  margin: 6px 10px 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Nav list */
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 10px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.nav a:hover {
  background: rgba(138, 180, 248, 0.10);
  text-decoration: none;
}
.nav a.active {
  background: rgba(138, 180, 248, 0.18);
  border: 1px solid rgba(138, 180, 248, 0.25);
}

/* Main content area */
.app-main {
  grid-area: main;
}

/* Center the content “card” inside the main column */
.content-card {
  max-width: 980px;
  margin-inline: auto;

  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.content-card h2 { margin: 0 0 8px; font-size: 18px; }
.content-card p { margin: 0; color: var(--muted); }

/* ====== Mobile: single column, nav at top ====== */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) auto 1fr;

    grid-template-areas:
      "header"
      "sidebar"
      "main";
  }

  .nav-card { height: auto; }
}
