/* ============================================================
   MERIDIAN CONSOLE — Design System (fresh direction)
   Calm, precise, data-first. Dark nav + light content.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,400;0,500;0,600;0,700;0,800&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  /* ---- Neutrals (cool slate) ---- */
  --bg: #f4f6f8;
  --bg-rule: #eceff3;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f6f8fa;
  --border: #e6e9ee;
  --border-2: #dfe3e9;
  --border-strong: #cdd3dc;

  --ink-900: #0d1622;
  --ink-800: #1b2533;
  --ink-700: #2c3848;
  --ink-600: #46525f;
  --ink-500: #65707e; /* secondary text */
  --ink-400: #8a93a1; /* muted */
  --ink-300: #aeb6c1; /* faint */
  --ink-200: #c9cfd8;

  /* ---- Dark navigation ---- */
  --nav-bg: #0e151d;
  --nav-bg-grad: linear-gradient(180deg, #111a23 0%, #0c1218 100%);
  --nav-border: rgba(255, 255, 255, 0.08);
  --nav-section: #5c6b78;
  --nav-text: #9aa6b2;
  --nav-text-hi: #f1f5f8;
  --nav-hover: rgba(255, 255, 255, 0.05);
  --nav-active: rgba(20, 184, 166, 0.14);
  --nav-active-bd: rgba(45, 212, 191, 0.55);
  --nav-active-tx: #ffffff;

  /* ---- Brand teal ---- */
  --teal-50: #e9f7f4;
  --teal-100: #cdeee8;
  --teal-200: #9fdcd2;
  --teal-300: #5fc4b6;
  --teal-400: #23a594;
  --teal-500: #0e9384; /* PRIMARY */
  --teal-600: #0b7b6f;
  --teal-700: #0a635a;
  --teal-ink: #063b35;

  /* ---- Semantic ---- */
  --green-50: #e8f6ec;
  --green-500: #1a9b4e;
  --green-600: #157d3f;
  --green-ink: #0c4f28;
  --amber-50: #fdf3e0;
  --amber-500: #e09400;
  --amber-600: #bd7c00;
  --amber-ink: #7a4f00;
  --red-50: #fdecec;
  --red-500: #e0484d;
  --red-600: #c63a3f;
  --red-ink: #8f2528;
  --blue-50: #eaf0fe;
  --blue-500: #3e63dd;
  --blue-600: #3251bd;
  --blue-ink: #1f3382;
  --violet-50: #f1edfd;
  --violet-500: #7c5cdf;
  --violet-600: #6446c4;

  /* ---- Health ramp ---- */
  --h-crit: #e0484d;
  --h-warn: #e09400;
  --h-good: #1a9b4e;

  /* ---- Type ---- */
  --font: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ---- Radius ---- */
  --r-xs: 5px;
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-pill: 999px;

  /* ---- Shadow ---- */
  --sh-xs: 0 1px 2px rgba(13, 22, 34, 0.05);
  --sh-sm: 0 1px 2px rgba(13, 22, 34, 0.06), 0 1px 1px rgba(13, 22, 34, 0.04);
  --sh-md:
    0 4px 12px -2px rgba(13, 22, 34, 0.1), 0 2px 4px -2px rgba(13, 22, 34, 0.06);
  --sh-lg:
    0 12px 32px -8px rgba(13, 22, 34, 0.16),
    0 4px 8px -4px rgba(13, 22, 34, 0.08);
  --sh-pop: 0 16px 40px -10px rgba(13, 22, 34, 0.22);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font);
  color: var(--ink-800);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.tnum {
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.nav {
  background: var(--nav-bg-grad);
  border-right: 1px solid var(--nav-border);
  display: flex;
  flex-direction: column;
  color: var(--nav-text);
  position: relative;
}
.nav-brand {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.nav-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--teal-400), var(--teal-600));
  flex: none;
  box-shadow:
    0 2px 8px rgba(14, 147, 132, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.nav-mark svg {
  width: 17px;
  height: 17px;
}
.nav-brandtext {
  line-height: 1.1;
}
.nav-brandtext .nm {
  color: var(--nav-text-hi);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 0.2px;
}
.nav-brandtext .sub {
  color: var(--nav-section);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 2px;
}

.nav-search {
  margin: 4px 14px 10px;
  position: relative;
}
.nav-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  color: var(--nav-text-hi);
  font-family: var(--font);
  font-size: 12.5px;
  padding: 8px 10px 8px 30px;
  outline: none;
}
.nav-search input::placeholder {
  color: #6b7a87;
}
.nav-search svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #6b7a87;
}
.nav-search kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 10px;
  color: #6b7a87;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 1px 5px;
}

.nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 12px;
}
.nav-section {
  padding: 14px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--nav-section);
}
.nav-group {
  padding: 0 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--nav-text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
  transition:
    background 0.12s,
    color 0.12s;
}
.nav-item svg {
  width: 17px;
  height: 17px;
  flex: none;
  opacity: 0.85;
}
.nav-item:hover {
  background: var(--nav-hover);
  color: var(--nav-text-hi);
}
.nav-item.active {
  background: var(--nav-active);
  color: var(--nav-active-tx);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--teal-400);
}
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--nav-section);
  font-family: var(--mono);
}
.nav-item.active .count {
  color: var(--teal-300);
}
.nav-item .dot {
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.nav-foot {
  border-top: 1px solid var(--nav-border);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-ava {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--teal-400), var(--teal-600));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  flex: none;
}
.nav-who {
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.nav-who .n {
  color: var(--nav-text-hi);
  font-size: 12.5px;
  font-weight: 600;
}
.nav-who .r {
  color: var(--nav-section);
  font-size: 11px;
}
.nav-foot .gear {
  color: var(--nav-section);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ---- Main column ---- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-400);
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar > div:first-child {
  flex: 1;
  min-width: 0;
}
.crumb b {
  color: var(--ink-800);
  font-weight: 600;
}
.crumb svg {
  width: 13px;
  height: 13px;
}
.topbar .title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.topbar .sub {
  font-size: 12.5px;
  color: var(--ink-400);
  margin-top: 1px;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px 60px;
}
.content-wide {
  max-width: 1320px;
  margin: 0 auto;
}

/* ============================================================
   CONTROLS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-700);
  transition: 0.12s;
  white-space: nowrap;
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn:hover {
  background: var(--surface-3);
  border-color: var(--ink-200);
}
.btn.primary {
  background: var(--teal-500);
  border-color: var(--teal-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(11, 123, 111, 0.3);
}
.btn.primary:hover {
  background: var(--teal-600);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-500);
}
.btn.ghost:hover {
  background: var(--surface-3);
  color: var(--ink-800);
}
.btn.sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}
.btn.icon {
  width: 34px;
  padding: 0;
  justify-content: center;
}

.seg {
  display: inline-flex;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
}
.seg button {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
  padding: 5px 11px;
  border-radius: 5px;
  cursor: pointer;
}
.seg button.on {
  background: var(--surface);
  color: var(--ink-900);
  box-shadow: var(--sh-xs);
}

/* Filter chips (replacing bare dropdown rows) */
.filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border-2);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-600);
  cursor: pointer;
}
.chip:hover {
  border-color: var(--ink-200);
  background: var(--surface-3);
}
.chip .k {
  color: var(--ink-400);
  font-weight: 600;
}
.chip .v {
  color: var(--ink-800);
  font-weight: 600;
}
.chip.active {
  border-color: var(--teal-300);
  background: var(--teal-50);
  color: var(--teal-700);
}
.chip.active .v {
  color: var(--teal-700);
}
.chip svg {
  width: 13px;
  height: 13px;
  opacity: 0.6;
}
.chip.add {
  border-style: dashed;
  color: var(--ink-400);
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.card-h h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}
.card-h .hint {
  font-size: 12px;
  color: var(--ink-400);
}
.card-b {
  padding: 18px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 15px 17px;
  box-shadow: var(--sh-sm);
}
.stat .lab {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-400);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.stat .val {
  font-size: 27px;
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  margin-top: 7px;
  line-height: 1;
}
.stat .val small {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-300);
}
.stat .meta {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 6px;
}

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.badge .d {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.b-green {
  background: var(--green-50);
  color: var(--green-ink);
}
.b-green .d {
  background: var(--green-500);
}
.b-amber {
  background: var(--amber-50);
  color: var(--amber-ink);
}
.b-amber .d {
  background: var(--amber-500);
}
.b-red {
  background: var(--red-50);
  color: var(--red-ink);
}
.b-red .d {
  background: var(--red-500);
}
.b-blue {
  background: var(--blue-50);
  color: var(--blue-ink);
}
.b-blue .d {
  background: var(--blue-500);
}
.b-violet {
  background: var(--violet-50);
  color: var(--violet-600);
}
.b-violet .d {
  background: var(--violet-500);
}
.b-gray {
  background: var(--surface-3);
  color: var(--ink-500);
}
.b-gray .d {
  background: var(--ink-400);
}
.b-teal {
  background: var(--teal-50);
  color: var(--teal-700);
}
.b-teal .d {
  background: var(--teal-500);
}

/* Health score chip with dot */
.health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.health .d {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.health.crit {
  color: var(--red-600);
}
.health.crit .d {
  background: var(--h-crit);
}
.health.warn {
  color: var(--amber-600);
}
.health.warn .d {
  background: var(--h-warn);
}
.health.good {
  color: var(--green-600);
}
.health.good .d {
  background: var(--h-good);
}

/* ============================================================
   TABLE
   ============================================================ */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-400);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
.tbl tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--bg-rule);
  color: var(--ink-700);
  vertical-align: middle;
}
.tbl tbody tr:hover {
  background: var(--surface-3);
}
.tbl tbody tr:last-child td {
  border-bottom: none;
}
.tbl .strong {
  font-weight: 600;
  color: var(--ink-900);
}
.tbl .ref {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--teal-600);
  font-weight: 600;
  white-space: nowrap;
}
.ref {
  white-space: nowrap;
}
.tbl .muted {
  color: var(--ink-400);
}
.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* mini progress bar */
.bar {
  height: 6px;
  border-radius: 4px;
  background: var(--bg-rule);
  overflow: hidden;
  min-width: 54px;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 4px;
}

/* health meter ring */
.ring {
  --p: 50;
  --c: var(--h-warn);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg-rule) 0);
  position: relative;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--surface);
}
.ring span {
  position: relative;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-900);
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
::-webkit-scrollbar-thumb {
  background: #cdd3dc;
  border-radius: 6px;
  border: 3px solid var(--bg);
}
.nav-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
}
::-webkit-scrollbar-track {
  background: transparent;
}
