/* ---------- Theme tokens ---------- */
:root {
  --bg: #e9ecf0;
  --card: #eceff3;
  --ink: #12142b;
  --muted: #6b7280;
  --track: #c9ced6;
  --light: #ffffff;
  --shadow: #c5cad3;
  --control: #d3d7de;
  --accent-1: #ff7a3d;
  --accent-2: #e8283a;
  --ok: #2f9e57;
  --navy: #1b3a6b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1f26;
    --card: #20242c;
    --ink: #eef0f5;
    --muted: #9aa1b0;
    --track: #3a3f4b;
    --light: #2a2f39;
    --shadow: #14161b;
    --control: #2f3440;
    --navy: #6fa0ff;
  }
}

:root[data-theme="dark"] {
  --bg: #1c1f26;
  --card: #20242c;
  --ink: #eef0f5;
  --muted: #9aa1b0;
  --track: #3a3f4b;
  --light: #2a2f39;
  --shadow: #14161b;
  --control: #2f3440;
  --navy: #6fa0ff;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Poppins", system-ui, sans-serif;
}

h1 { font-size: 20px; font-weight: 500; margin: 0; }
h2 { font-size: 21px; font-weight: 600; margin: 0 0 6px; }

.muted { color: var(--muted); font-size: 14px; }

/* Soft "raised" look used by every card */
.raised {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 8px 8px 18px var(--shadow), -8px -8px 18px var(--light);
}

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: 100vh;
}

main {
  padding: 22px 26px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.lower {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

.card { padding: 20px; }

/* ---------- Sidebar ---------- */
.sidebar {
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 0 24px 24px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 19px;
  margin: 0 8px 18px;
}

.logo b {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #000;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
}

#nav { display: contents; }

.nav-item {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink);
}

/* Hover: the item lifts out of the card and slides in slightly */
.nav-item { transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease; }

.nav-item:hover:not([aria-current="true"]) {
  transform: translateX(3px);
  box-shadow: 4px 4px 10px var(--shadow), -4px -4px 10px var(--light);
}

.nav-item:hover svg,
.nav-item[aria-current="true"] svg { stroke: var(--accent-2); }

.nav-item[aria-current="true"] {
  border-left: 3px solid var(--accent-2);
  box-shadow: inset 4px 4px 9px var(--shadow), inset -4px -4px 9px var(--light);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  transition: stroke 0.2s ease;
}

/* Visible keyboard focus */
.nav-item:focus-visible,
.seg button:focus-visible,
.bar:focus-visible,
.topbar button:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search {
  flex: 1;
  max-width: 260px;
  border: 0;
  border-radius: 20px;
  padding: 12px 18px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  box-shadow: inset 3px 3px 7px var(--shadow), inset -3px -3px 7px var(--light);
}

.topbar button {
  all: unset;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- KPI cards ---------- */
.big { font-size: 32px; font-weight: 600; }

.status {
  font-size: 26px;
  font-weight: 600;
  color: var(--ok);
  margin-top: 14px;
}

.split { display: flex; gap: 26px; margin-top: 6px; }

.tick { display: flex; gap: 10px; }
.tick i { width: 4px; border-radius: 2px; background: var(--ok); }
.tick.off i { background: var(--accent-2); }
.tick b { display: block; font-size: 26px; font-weight: 600; line-height: 1.1; }

/* ---------- Statistic chart ---------- */
.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--control);
}

.seg button {
  all: unset;
  cursor: pointer;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--muted);
}

.seg button[aria-pressed="true"] {
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  color: #fff;
}

.summary { display: flex; gap: 22px; flex-wrap: wrap; margin: 14px 0 6px; }
.summary b { display: block; font-size: 20px; font-weight: 600; }

.chart { display: flex; gap: 8px; height: 230px; margin-top: 10px; }

.y-axis {
  width: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 24px;
  font-size: 12px;
}

.columns {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
}

.column { display: flex; flex-direction: column; align-items: center; min-width: 0; }

.bar {
  all: unset;
  cursor: pointer;
  flex: 1;
  width: min(14px, 100%);
  border-radius: 7px;
  background: var(--track);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.bar span {
  display: block;
  width: 100%;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
  transition: height 0.5s;
}

.bar.selected { outline: 2px solid var(--ink); outline-offset: 1px; }

.month { font-size: 11.5px; margin-top: 6px; height: 18px; }

/* ---------- CPU rings ---------- */
.rings { display: flex; gap: 14px; justify-content: space-between; margin-top: 10px; }
.ring { flex: 1; text-align: center; font-size: 12px; }
.ring svg { width: 84px; height: 84px; }
.ring b { display: block; font-size: 17px; font-weight: 600; }

/* ---------- Company ---------- */
.company p { font-size: 11px; color: var(--muted); max-width: 260px; margin: 0; }
.company h2 { margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  main { padding: 16px; }
  .grid-3, .lower { grid-template-columns: 1fr; }

  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
    border-radius: 0;
  }
  .logo { display: none; }
  .nav-item { white-space: nowrap; padding: 10px 12px; }
  .nav-item[aria-current="true"] { border-left: 0; border-bottom: 3px solid var(--accent-2); }
}

@media (prefers-reduced-motion: reduce) {
  .bar span { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-item, .nav-item svg { transition: none; }
  .nav-item:hover:not([aria-current="true"]) { transform: none; }
}