/* ============================================================
   Mission Control — shared styles
   Single source of truth for look & feel. Built from the
   PMM Camp Design System tokens. Every screen uses these.
   Rules from the brief: black text everywhere, no dark blocks,
   no Eggshell, cards white with 12px corners + 1.5px aqua-light
   border and no shadow, buttons pill-shaped, sidebar aqua-light.
   ============================================================ */

/* New Spirit — page titles only. Poppins — everything else. */
@font-face {
  font-family: "New Spirit";
  src: url("./assets/fonts/NewSpirit-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand colours */
  --aqua: #4A8B86;
  --aqua-light: #D9E9E8;
  --moss: #8EB79D;
  --moss-light: #E8F1EC;
  --melon: #F9AFA0;
  --melon-light: #FDEFEE;
  --forest: #56726F;
  --forest-light: #DBE5E3;
  --golden: #F7B861;
  --golden-light: #FAF2E1;
  --white: #FFFFFF;
  --grey: #828282;
  --grey-light: #F7F7F7;
  /* Note: Eggshell exists in the brand but is intentionally not used here. */

  /* Semantic */
  --text: #000000;            /* black text everywhere, per brief */
  --text-muted: #828282;
  --page-bg: #FFFFFF;
  --sidebar-bg: #D9E9E8;
  --card-bg: #FFFFFF;
  --card-border: #D9E9E8;
  --border-hairline: rgba(0,0,0,.10);
  --focus-ring: #F7B861;

  /* Mode colours (for module icons etc.) */
  --mode-strategist: #8EB79D;
  --mode-operator: #F9AFA0;
  --mode-activator: #56726F;
  --mode-connector: #F7B861;
  --mode-architect: #4A8B86;

  /* Type */
  --font-display: "New Spirit", "Iowan Old Style", Georgia, serif;
  --font-body: "Poppins", "Helvetica Neue", Arial, sans-serif;

  /* Spacing scale */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px;

  /* Radii */
  --radius-sm: 6px; --radius-md: 12px; --radius-lg: 20px; --radius-pill: 999px;

  --sidebar-w: 260px;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--page-bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--aqua); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- Typography ---------- */
.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 36px;
  line-height: 1.1;
}
.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* Section heading with a thin aqua-light rule underneath */
.section-head {
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1.5px solid var(--card-border);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.muted { color: var(--text-muted); }

/* ---------- Buttons (pill, Title Case) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--card-border);
  background: var(--white);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { color: var(--text); border-color: var(--aqua); }
.btn-primary {
  background: var(--aqua);
  border-color: var(--aqua);
  color: var(--white);
}
.btn-primary:hover { color: var(--white); background: var(--forest); border-color: var(--forest); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}

/* ---------- App shell ---------- */
.mc { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar-bg);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.sidebar-brand { display: flex; flex-direction: column; gap: 10px; padding: 0 8px; }
.sidebar-brand img { width: 92px; height: auto; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-pill);
  color: var(--text); font-size: 14px;
}
.nav-item.active { background: var(--white); font-weight: 600; }
.nav-group-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 18px 12px 6px;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.sidebar-user {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-top: 1.5px solid var(--border-hairline); margin-top: 8px;
}
.avatar {
  width: 36px; height: 36px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex: none; overflow: hidden;
}

.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 40px 56px; display: flex; flex-direction: column; gap: 28px; }

/* Key-number cards row */
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.num-card {
  background: var(--card-bg); border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.num-card .num-value { font-size: 32px; font-weight: 600; line-height: 1.15; }

/* Five-colour bar — fixed order: moss, melon, forest, golden, aqua */
.color-bar { display: flex; height: 10px; }
.color-bar > span { flex: 1; }
.color-bar .c-moss   { background: var(--moss); }
.color-bar .c-melon  { background: var(--melon); }
.color-bar .c-forest { background: var(--forest); }
.color-bar .c-golden { background: var(--golden); }
.color-bar .c-aqua   { background: var(--aqua); }

/* Module cards grid */
.mods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.mod-card {
  background: var(--card-bg); border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md); padding: 16px;
  color: var(--text); display: flex; align-items: center; gap: 14px; min-width: 0;
}
.mod-card:hover { color: var(--text); border-color: var(--aqua); }
.mod-icon {
  flex: none; width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.mod-name { font-size: 15px; font-weight: 700; }
.mod-desc { font-size: 13px; }

/* Generic responsive grids used on auth / settings screens */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; }
.tablewrap { overflow-x: auto; }

/* ---------- Centered auth layout (login, invite, no-access) ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--white);
  border: 1.5px solid var(--card-border); border-radius: var(--radius-lg);
  padding: 44px 40px 40px; display: flex; flex-direction: column;
  align-items: center; gap: 28px; text-align: center;
}
.auth-card img.logo { width: 110px; height: auto; }

/* ---------- Loading / empty / error states ---------- */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 56px 24px; color: var(--text-muted);
}
.spinner {
  width: 28px; height: 28px; border-radius: 999px;
  border: 3px solid var(--aqua-light); border-top-color: var(--aqua);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Out-of-date / stale data banner */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--golden-light); border: 1.5px solid var(--golden);
  font-size: 14px;
}

/* ---------- Mobile: sidebar becomes a top bar ---------- */
.mobile-topbar { display: none; }

@media (max-width: 860px) {
  .mc { grid-template-columns: 1fr; }
  .sidebar { display: none; }           /* replaced by the top bar + drawer */
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 18px; background: var(--sidebar-bg);
  }
  .content { padding: 24px 18px; }
  .nums { grid-template-columns: repeat(2, 1fr); }
  .mods, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
