/* ============================================================
   Advanced Monkey — Ops Hub
   Styling follows the advanced-monkey-brand skill. Tokens only;
   terracotta spent sparingly (the monkey, active nav, and the one
   "Constraint" attention status). Status differentiation otherwise
   rides an ink→faint intensity ramp + dot style, not extra hues.
   ============================================================ */

:root {
  --ink:    #111010;
  --paper:  #F4F1EA;
  --warm:   #EDE9E0;
  --accent: #C94F1A;
  --mid:    #6E6860;
  --faint:  #D9D4CA;

  --font-head: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  --sidebar-w: 264px;
  --shadow: 0 2px 20px rgba(0, 0, 0, .06);
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.12;
  margin: 0;
}

.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 14px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 30px 22px;
  background: var(--ink);
  color: var(--paper);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  text-decoration: none;
  color: var(--paper);
}
.brand-mark { display: inline-flex; }
.brand-mark svg { display: block; color: var(--paper); } /* "advanced" = paper on dark */
.brand-tag {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mid);
}

.nav {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.nav-item {
  display: block;
  padding: 12px 14px;
  border-radius: 5px;
  text-decoration: none;
  color: var(--paper);
  border-left: 2px solid transparent;
  transition: background .16s ease, border-color .16s ease;
}
.nav-item:hover { background: rgba(244, 241, 234, .06); }
.nav-item.is-active {
  background: rgba(244, 241, 234, .07);
  border-left-color: var(--accent);
}
.nav-label {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.nav-blurb {
  display: block;
  font-size: 12px;
  color: var(--mid);
  line-height: 1.45;
  margin-top: 3px;
}

.sidebar-foot { margin-top: 20px; }
.monkey-accent { display: block; }
.monkey-accent svg { display: block; }
.foot-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--mid);
  line-height: 1.5;
}

/* ---- Mobile top bar ----------------------------------------------------- */
.topbar { display: none; }
.nav-toggle {
  width: 40px; height: 40px;
  display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  background: transparent; border: 1px solid var(--faint); border-radius: 5px;
  cursor: pointer; padding: 0 9px;
}
.nav-toggle span { height: 2px; background: var(--ink); border-radius: 2px; }

/* ---- Content ------------------------------------------------------------ */
.content {
  padding: 56px clamp(24px, 5vw, 72px) 88px;
  outline: none;
  max-width: 1180px;
}

.view-loading, .view-error {
  color: var(--mid);
  font-size: 15px;
  padding: 40px 0;
}
.view-error h2 { color: var(--ink); margin-bottom: 8px; }

/* ---- Estate view -------------------------------------------------------- */
.estate-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.estate h1 { font-size: clamp(32px, 4.5vw, 52px); }
.estate-updated {
  font-size: 12px;
  color: var(--mid);
  white-space: nowrap;
}
.estate-sub {
  margin: 12px 0 0;
  font-size: 17px;
  color: var(--mid);
  max-width: 60ch;
}
.estate-note {
  margin: 26px 0 0;
  padding: 18px 22px;
  background: var(--warm);
  border-radius: 5px;
  border-left: 2px solid var(--faint);
  font-size: 14px;
  color: var(--mid);
  line-height: 1.65;
  max-width: 86ch;
}

/* ---- Filter ------------------------------------------------------------- */
.filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 30px 0 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--mid);
  background: var(--paper);
  border: 1px solid var(--faint);
  border-radius: 5px;
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.chip:hover { border-color: var(--mid); }
.chip.is-active { color: var(--ink); border-color: var(--ink); background: var(--warm); }
.chip-all.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dot, var(--mid));
  border: var(--dot-border, none);
  flex: none;
}
.chip-count {
  font-size: 11px;
  color: var(--mid);
  font-variant-numeric: tabular-nums;
}
.chip.is-active .chip-count { color: inherit; opacity: .7; }

/* ---- Sections ----------------------------------------------------------- */
.sections { margin-top: 30px; display: flex; flex-direction: column; gap: 38px; }
.estate-section[hidden] { display: none; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--faint);
}
.section-head h2 { font-size: 19px; font-weight: 700; }
.src {
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--mid);
}
.src-live { color: var(--accent); }

.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--faint);
}
.row:last-child { border-bottom: none; }
.row[hidden] { display: none; }

.row-main { min-width: 0; flex: 1; }
.row-name {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.row-what {
  display: block;
  font-size: 13.5px;
  color: var(--mid);
  line-height: 1.5;
  margin-top: 2px;
}
.row-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
  text-align: right;
}
.row-where {
  font-size: 12.5px;
  color: var(--mid);
  max-width: 30ch;
  line-height: 1.4;
}

/* ---- Status pills -------------------------------------------------------
   One colour rule: terracotta is reserved for "constraint" (the attention
   status). Everything else differentiates on an ink→faint dot ramp + style.
   Each pill class sets --dot (+ optional --dot-border) consumed by the dot. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--mid);
  background: var(--warm);
  border: 1px solid var(--faint);
  border-radius: 4px;
  padding: 4px 10px;
  white-space: nowrap;
}
.pill-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dot, var(--mid));
  border: var(--dot-border, none);
  flex: none;
}

/* live — present / strong */
.pill--live    { --dot: var(--ink); color: var(--ink); }
/* building — in progress */
.pill--building{ --dot: var(--mid); }
/* planned — scoped, not started (hollow) */
.pill--planned { --dot: transparent; --dot-border: 1.5px solid var(--mid); }
/* legacy — phasing out (faded) */
.pill--legacy  { --dot: var(--faint); --dot-border: 1px solid var(--mid); color: var(--mid); }
/* constraint — the one accent: do not touch */
.pill--constraint { --dot: var(--accent); color: var(--accent); border-color: var(--accent); background: rgba(201, 79, 26, .06); }
/* tbc — uncertain (dashed) */
.pill--tbc     { --dot: transparent; --dot-border: 1.5px dashed var(--mid); }
/* unknown status key — neutral fallback */
.pill--unknown { --dot: var(--faint); }

/* Filter chips reuse the same dot mapping via .pill--{key} on the chip. */

/* ---- Empty state -------------------------------------------------------- */
.estate-empty {
  text-align: center;
  padding: 60px 0;
  color: var(--mid);
}
.estate-empty svg { display: block; margin: 0 auto 14px; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--faint);
    position: sticky; top: 0; z-index: 20;
    background: var(--paper);
  }
  .topbar-brand svg { display: block; color: var(--ink); }
  .sidebar {
    position: fixed;
    z-index: 30;
    left: 0; top: 0; bottom: 0;
    width: min(82vw, var(--sidebar-w));
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow); }
  .content { padding: 28px 20px 64px; }
  .row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .row-meta { flex-direction: row-reverse; justify-content: flex-start; text-align: left; width: 100%; }
  .row-where { max-width: none; }
}
