/* Dashboard V2 mockup — styles. Light, business-like theme. CSS-only. */

:root {
  --green: #2e9e4f;
  --yellow: #e0a800;
  --red: #d64541;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e6ec;
  --text: #1f2a37;
  --text-muted: #66707d;
  --accent: #2563eb;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.08), 0 1px 2px rgba(20, 30, 50, 0.04);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

h2, h3, h4 {
  margin: 0 0 8px;
  font-weight: 600;
}

/* ---------- Header / breadcrumbs ---------- */

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

#breadcrumbs {
  font-size: 14px;
  color: var(--text-muted);
}

#breadcrumbs a {
  color: var(--accent);
  text-decoration: none;
}

#breadcrumbs a:hover {
  text-decoration: underline;
}

#breadcrumbs span {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Layout ---------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

section {
  margin-bottom: 24px;
}

/* ---------- Pulse colors ---------- */

.pulse--green .pulse__score { color: var(--green); }
.pulse--yellow .pulse__score { color: var(--yellow); }
.pulse--red .pulse__score { color: var(--red); }

/* ---------- Compact pulse plate (default for non-company nodes) ---------- */

.zone-pulse {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}

.pulse__score {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.pulse__summary {
  margin: 12px 0 0;
  color: var(--text-muted);
  max-width: 760px;
}

/* ---------- Large gauge at the root (company) ---------- */

.zone-pulse--company {
  padding: 32px;
  text-align: center;
}

.zone-pulse--company .pulse {
  position: relative;
  display: inline-block;
  padding-top: 12px;
}

/* CSS-only semicircle arc behind the big score */
.zone-pulse--company .pulse__score {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  width: 220px;
  height: 130px;
  padding-bottom: 12px;
  font-size: 56px;
  font-weight: 800;
}

/* Filled arc is data-driven: score% of the visible semicircle.
   The semicircle = top half of the circle = 0%..50% sweep from 270deg,
   so score (0..100) maps to calc(var(--score) * 0.5%) of the full circle. */
.zone-pulse--company .pulse--green  { --gauge-fill: var(--green); }
.zone-pulse--company .pulse--yellow { --gauge-fill: var(--yellow); }
.zone-pulse--company .pulse--red    { --gauge-fill: var(--red); }

.zone-pulse--company .pulse__score {
  background:
    radial-gradient(circle at 50% 100%, var(--surface) 56%, transparent 57%),
    conic-gradient(from 270deg,
      var(--gauge-fill, var(--green)) 0 calc(var(--score, 0) * 0.5%),
      var(--border) calc(var(--score, 0) * 0.5%) 100%);
}

.zone-pulse--company .pulse__score {
  border-radius: 110px 110px 0 0;
}

.zone-pulse--company .pulse__summary {
  margin: 16px auto 0;
}

/* ---------- Insight ---------- */

.insight {
  background: #fff8e6;
  border: 1px solid #f0e0b0;
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: #6b5800;
}

/* ---------- Child cards grid ---------- */

#zone-children {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(20, 30, 50, 0.12);
}

.card--green { border-left-color: var(--green); }
.card--yellow { border-left-color: var(--yellow); }
.card--red { border-left-color: var(--red); }

.card__title {
  font-weight: 600;
  font-size: 16px;
}

.card__pulse {
  margin-top: 4px;
  font-weight: 600;
}

.card__stats {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.card__summary {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text);
}

/* ---------- Leaf: pillars ---------- */

.pillars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pillar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.pillar h3 {
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.pillar ul {
  margin: 0;
  padding-left: 18px;
}

.pillar li {
  margin-bottom: 10px;
  font-size: 14px;
}

.vio--warning b { color: var(--yellow); }
.vio--critical b { color: var(--red); }

.metric--green { border-left: 3px solid var(--green); }
.metric--yellow { border-left: 3px solid var(--yellow); }
.metric--red { border-left: 3px solid var(--red); }

.metric {
  list-style: none;
  margin-left: -18px;
  padding-left: 12px;
}

.metric__gap {
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .pillars { grid-template-columns: 1fr; }
}

/* ---------- Detail panel ---------- */

#detail-panel {
  display: none;
}

#detail-panel.detail-panel--open {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

#detail-panel h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.case__block {
  margin-bottom: 16px;
}

.case__block h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.case__block p {
  margin: 0;
}

.case__rec {
  background: #eef6ef;
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 0;
}

.case__rec h4 {
  color: var(--green);
}

/* Narrow screens: panel stacks below children (default flow, gated by --open) */
@media (max-width: 899px) {
  #detail-panel.detail-panel--open {
    margin: 0 24px 24px;
  }
}

/* Wide screens: panel fixed on the right */
@media (min-width: 900px) {
  #detail-panel.detail-panel--open {
    position: fixed;
    top: 80px;
    right: 24px;
    bottom: 24px;
    width: 360px;
    overflow-y: auto;
    z-index: 5;
  }

  /* leave room so fixed panel does not cover content */
  main {
    padding-right: 24px;
  }
}
