:root {
  --bg: #0f1419;
  --panel: #1a212b;
  --panel-2: #222c38;
  --line: #2c3848;
  --ink: #e8edf2;
  --muted: #93a1b3;
  --accent: #4f9dff;
  --accent-2: #6ee7b7;
  --warn: #f6b73c;
  --bad: #ef6b73;
  --good: #34d399;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #16202c 0%, var(--bg) 60%);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.45;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(15,20,25,.6);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 30px; color: var(--accent);
  background: var(--panel); border: 1px solid var(--line);
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center;
}
.brand h1 { font-size: 19px; margin: 0; letter-spacing: .2px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.tab:hover { color: var(--ink); background: var(--panel); }
.tab.active { color: var(--ink); background: var(--panel); border-color: var(--line); }

main { max-width: 1120px; margin: 0 auto; padding: 26px 20px 60px; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity:1; transform:none; } }

/* Cards / grid */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.span-2 { grid-column: 1 / -1; }
@media (max-width: 820px){ .grid { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }

.eyebrow {
  display: block; text-transform: uppercase; letter-spacing: .12em;
  font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 12px;
}
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* Level card */
.level-card { display: flex; flex-direction: column; gap: 18px; }
.level-head h2 { margin: 4px 0 6px; font-size: 28px; }
.tagline { margin: 0; color: var(--muted); font-size: 14px; }

.gauge-track {
  position: relative; height: 16px; border-radius: 99px;
  background: linear-gradient(90deg, #ef6b73 0%, #f6b73c 45%, #34d399 100%);
  overflow: visible;
}
.gauge-fill {
  position: absolute; inset: 0; right: auto; border-radius: 99px;
  background: rgba(0,0,0,.35); width: 0; transition: width .6s ease;
}
.gauge-marker {
  position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--bg); transform: translate(-50%,-50%);
  box-shadow: 0 2px 8px rgba(0,0,0,.5); transition: left .6s ease; left: 0;
}
.gauge-scale { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }

.score-row { display: flex; align-items: center; justify-content: space-between; }
.big { font-size: 40px; font-weight: 800; }
.momentum { font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); }
.momentum.up { color: var(--good); border-color: rgba(52,211,153,.4); }
.momentum.down { color: var(--bad); border-color: rgba(239,107,115,.4); }
.momentum.flat { color: var(--muted); }

/* Chart */
.chart { width: 100%; height: 180px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }

/* Analysis */
.analysis { display: flex; flex-direction: column; gap: 12px; }
.insight {
  display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.insight .ic { font-size: 18px; line-height: 1.3; }
.insight h4 { margin: 0 0 2px; font-size: 14px; }
.insight p { margin: 0; font-size: 13.5px; color: var(--muted); }
.insight.good { border-left: 3px solid var(--good); }
.insight.warn { border-left: 3px solid var(--warn); }
.insight.bad { border-left: 3px solid var(--bad); }
.insight.info { border-left: 3px solid var(--accent); }

/* Rich recommendation layout */
.insight .why { margin: 8px 0 4px; font-size: 13px; color: var(--ink); opacity: .85; }

/* Dedicated recommendations section with team / leader split */
.recs-section { margin-top: 16px; }
.recs-heading {
  font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--ink);
  padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.rec-block {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; margin-bottom: 14px;
}
.rec-block-head { font-size: 15px; margin-bottom: 6px; }
.rec-block .why { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.recs-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px){ .recs-split { grid-template-columns: 1fr; } }
.rec-col {
  border-radius: 10px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line);
}
.team-col { border-top: 3px solid var(--accent); }
.leader-col { border-top: 3px solid var(--accent-2); }
.rec-label {
  display: block; font-size: 12px; font-weight: 800; letter-spacing: .04em;
  color: var(--ink); margin-bottom: 8px;
}
.rec-actions { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.rec-actions li { font-size: 13px; color: var(--muted); line-height: 1.45; }
.rec-actions li b { color: var(--ink); }
.rec-block .watch { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); font-style: italic; }
.rec-block .watch b { font-style: normal; color: var(--ink); }

/* Category bars */
.catbars { display: flex; flex-direction: column; gap: 12px; }
.catbar-row { display: grid; grid-template-columns: 180px 1fr 44px; align-items: center; gap: 12px; font-size: 13px; }
.catbar-track { background: var(--panel-2); border-radius: 99px; height: 10px; overflow: hidden; }
.catbar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s ease; }
.catbar-row .val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width:560px){ .catbar-row { grid-template-columns: 120px 1fr 40px; } }

/* Ladder */
.ladder { display: flex; flex-direction: column; gap: 8px; }
.rung {
  display: grid; grid-template-columns: 30px 1fr; gap: 14px; align-items: center;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  opacity: .55;
}
.rung.current { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.rung .num { font-weight: 800; color: var(--muted); text-align: center; }
.rung.current .num { color: var(--accent); }
.rung h4 { margin: 0; font-size: 14.5px; }
.rung p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

/* Forms */
.form-card { max-width: 760px; }
form { margin-top: 14px; display: flex; flex-direction: column; gap: 16px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width:560px){ .row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  padding: 11px 12px; border-radius: 10px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.impact-preview { font-size: 13.5px; color: var(--muted); min-height: 20px; }
.impact-preview b { color: var(--ink); }
.form-actions { display: flex; gap: 10px; }

.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  padding: 11px 18px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 700;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #07121f; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost.danger:hover { border-color: var(--bad); color: var(--bad); }

/* History table */
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.history-tools { display: flex; gap: 8px; }
.events-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.events-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.events-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.events-table tr:hover td { background: var(--panel-2); }
.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.pill.h { background: rgba(239,107,115,.15); color: #ffb3b8; }
.pill.m { background: rgba(246,183,60,.15); color: #ffd98a; }
.pill.l { background: rgba(110,231,183,.13); color: #a7f3d0; }
.delta { font-weight: 800; font-variant-numeric: tabular-nums; }
.delta.pos { color: var(--good); }
.delta.neg { color: var(--bad); }
.rmv { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.rmv:hover { color: var(--bad); }
.empty { padding: 24px 4px; text-align: center; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; border-top: 1px solid var(--line); }

/* Floating action button */
.fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  background: var(--accent); color: #07121f; border: none;
  padding: 14px 20px; border-radius: 99px; font-size: 15px; font-weight: 800;
  cursor: pointer; box-shadow: 0 8px 24px rgba(79,157,255,.45);
}
.fab:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* Modal / prompt window */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(7,12,20,.62); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .18s ease;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: min(640px, 100%); max-height: 90vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-x { background: transparent; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-x:hover { color: var(--ink); }
.modal-actions { justify-content: flex-end; }
