@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --bg: #07080f;
  --bg-elevated: #0e1019;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --glass: rgba(14, 16, 25, 0.72);
  --text: #eef0f6;
  --muted: #8b93a7;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #7c6cff;
  --accent-2: #38bdf8;
  --accent-3: #f472b6;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --sidebar-w: 248px;
  --sidebar-collapsed-w: 76px;
  --sidebar-current-w: var(--sidebar-w);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(124, 108, 255, 0.28), transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 0%, rgba(56, 189, 248, 0.18), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(244, 114, 182, 0.12), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  /* First track follows sidebar width so main content reflows on collapse */
  grid-template-columns: var(--sidebar-current-w, var(--sidebar-w)) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}

.shell:has(.shell-sidebar.collapsed) {
  --sidebar-current-w: var(--sidebar-collapsed-w, 76px);
}

.shell.sidebar-collapsed {
  --sidebar-current-w: var(--sidebar-collapsed-w, 76px);
}

.shell-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  box-sizing: border-box;
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: width .2s ease, min-width .2s ease, max-width .2s ease, padding .2s ease;
  overflow: hidden;
}

.shell-sidebar.collapsed {
  --sidebar-collapsed-w: 76px;
  width: var(--sidebar-collapsed-w);
  min-width: var(--sidebar-collapsed-w);
  max-width: var(--sidebar-collapsed-w);
  padding: 1rem .65rem;
}
.shell-sidebar.collapsed .nav-label,
.shell-sidebar.collapsed .brand-text,
.shell-sidebar.collapsed .nav-section-label,
.shell-sidebar.collapsed .sidebar-user-name { display: none; }
.shell-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: .7rem;
  gap: 0;
}
.shell-sidebar.collapsed .sidebar-logout {
  justify-content: center;
  padding: .65rem;
}
.shell-sidebar.collapsed .sidebar-user { justify-content: center; }
.shell-sidebar.collapsed .sidebar-nav { align-items: stretch; }

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .35rem .25rem .35rem .5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

.shell-sidebar.collapsed .brand-logo {
  height: 28px;
  max-width: 40px;
  object-fit: cover;
  object-position: left center;
}

.login-card .brand {
  margin-bottom: 1.5rem;
}

.login-card .brand-logo {
  height: 36px;
  max-width: 140px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-size: .85rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 8px 24px rgba(124, 108, 255, 0.35);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: .15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,.35) transparent;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .75rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(124, 108, 255, 0.22), rgba(124, 108, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(124, 108, 255, 0.25);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: inline-grid;
  place-items: center;
  opacity: .9;
  color: #94a3b8;
}
.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { color: #e2e8f0; opacity: 1; }
.nav-item.active .nav-icon { color: #7dd3fc; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .15rem .35rem .35rem;
  min-height: 36px;
}
.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 700;
  color: #e2e8f0;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  flex: 0 0 28px;
}
.sidebar-user-name {
  font-size: .8rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .75rem;
  justify-content: flex-start;
  padding: .65rem .85rem;
  border-radius: var(--radius-sm);
  color: #94a3b8;
}
.sidebar-logout:hover { color: #e2e8f0; background: var(--surface-hover); }
.sidebar-logout .nav-label { font-size: .88rem; font-weight: 500; }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.shell-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 15, 0.65);
  backdrop-filter: blur(16px);
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.topbar-spacer { flex: 1; }

.topbar-aws {
  white-space: nowrap;
}

.dashboard-head-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.kpi-card--aws.is-near {
  border-color: rgba(245, 158, 11, 0.45);
}

.kpi-card--aws.is-over {
  border-color: rgba(239, 68, 68, 0.55);
}

.spend-meter {
  margin-top: 0.55rem;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.spend-meter-fill {
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fb923c, #f97316);
}

.kpi-card--aws.is-near .spend-meter-fill {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.kpi-card--aws.is-over .spend-meter-fill {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.config-hint {
  margin: 1rem 0 0;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.page {
  padding: 1.5rem 1.75rem 3rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  letter-spacing: -0.03em;
}

.page-head .lede {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.search-pill {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 220px;
  padding: .55rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.search-pill input {
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  width: 100%;
  outline: none;
}

.search-pill input::placeholder { color: var(--muted); }

.view-toggle {
  display: inline-flex;
  padding: .2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.view-toggle button,
.view-toggle a {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: .45rem .85rem;
  border-radius: 999px;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.view-toggle button.active,
.view-toggle a.active {
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.35), rgba(56, 189, 248, 0.2));
  color: var(--text);
}

.users-kanban {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.1rem;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}

.btn:hover { background: var(--surface-hover); transform: translateY(-1px); }

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #5b4fe8);
  box-shadow: 0 10px 30px rgba(124, 108, 255, 0.35);
}

.btn.primary:hover {
  box-shadow: 0 14px 36px rgba(124, 108, 255, 0.45);
}

.btn.ghost {
  background: transparent;
}

.btn.danger { color: var(--danger); border-color: rgba(251, 113, 133, 0.35); }

button.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-2);
  cursor: pointer;
  font: inherit;
}

.card, .glass-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

/* Bento dashboard */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.bento-stat {
  grid-column: span 2;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.bento-stat::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: hsl(var(--hue, 260) 80% 60% / 0.18);
  filter: blur(8px);
}

.bento-stat .value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.bento-stat .label {
  margin-top: .5rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
}

.bento-wide { grid-column: span 8; }
.bento-tall { grid-column: span 4; grid-row: span 2; }
.bento-half { grid-column: span 6; }

/* Dashboard */
.dashboard-head {
  align-items: center;
  margin-bottom: 1rem;
}

.dashboard-head h1 {
  margin: 0;
  font-size: 1.15rem;
}

.timeframe-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.timeframe-pill {
  padding: .4rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}

.timeframe-pill:hover {
  border-color: rgba(124, 108, 255, 0.35);
  color: var(--text);
}

.timeframe-pill.active {
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.35), rgba(56, 189, 248, 0.2));
  border-color: rgba(124, 108, 255, 0.45);
  color: var(--text);
}

.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 1.15rem 1.25rem;
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -50% auto;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: hsl(var(--hue, 260) 80% 60% / 0.16);
  filter: blur(10px);
}

.kpi-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.kpi-timeframe {
  margin-top: .2rem;
  font-size: .72rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: .02em;
}

.kpi-value {
  margin-top: .45rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-family: var(--mono);
  line-height: 1.2;
}

.kpi-sub {
  margin-top: .35rem;
  font-size: .78rem;
  color: var(--muted);
}

.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-panel {
  grid-column: span 4;
  padding: 1.15rem 1.25rem;
}

.chart-panel.chart-wide {
  grid-column: span 8;
}

.chart-panel h2 {
  margin: 0 0 1rem;
  font-size: .95rem;
  font-weight: 600;
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.chart-wrap.chart-failed::after {
  content: "Chart unavailable";
  display: grid;
}

.chart-wrap.chart-ready::after {
  display: none;
}

.chart-wrap-donut {
  height: 240px;
}

.dashboard-lower {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1rem;
}

.dashboard-lower h2 {
  margin: 0 0 1rem;
  font-size: .95rem;
  font-weight: 600;
}

.pipeline-bars {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.pipeline-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 2rem;
  align-items: center;
  gap: .75rem;
}

.pipeline-label {
  font-size: .82rem;
  color: var(--muted);
}

.pipeline-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.pipeline-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(var(--hue, 260) 70% 50%), hsl(var(--hue, 260) 80% 62%));
  min-width: 2px;
  transition: width .4s ease;
}

.pipeline-count {
  font-family: var(--mono);
  font-size: .82rem;
  text-align: right;
}

@media (max-width: 1200px) {
  .dashboard-kpis { grid-template-columns: repeat(3, 1fr); }
  .chart-panel.chart-wide { grid-column: span 12; }
  .chart-panel { grid-column: span 6; }
}

@media (max-width: 768px) {
  .dashboard-kpis { grid-template-columns: repeat(2, 1fr); }
  .chart-panel { grid-column: span 12; }
  .dashboard-lower { grid-template-columns: 1fr; }
  .bento-stat { grid-column: span 4; }
}

/* Entity cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.entity-card {
  padding: 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: .85rem;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.entity-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 108, 255, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.entity-card-main {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  color: inherit;
  text-decoration: none;
}

.entity-actions {
  display: flex;
  gap: .75rem;
  padding-top: .65rem;
  border-top: 1px solid var(--line);
  font-size: .82rem;
  font-weight: 600;
}

.entity-actions a {
  color: var(--accent);
  text-decoration: none;
}

.entity-actions a.danger,
.entity-actions.inline a.danger {
  color: var(--danger);
}

.entity-actions.inline {
  border-top: none;
  padding-top: 0;
  gap: .75rem;
}

.entity-head {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  background: linear-gradient(135deg, hsl(var(--hue, 260) 70% 55%), hsl(calc(var(--hue, 260) + 40) 70% 50%));
  color: #fff;
  flex-shrink: 0;
}

.entity-meta {
  min-width: 0;
}

.entity-meta .title {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-meta .sub {
  color: var(--muted);
  font-size: .82rem;
  margin-top: .15rem;
}

.entity-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.chip {
  font-size: .72rem;
  font-weight: 600;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: hsl(var(--hue, 220) 60% 50% / 0.15);
  color: hsl(var(--hue, 220) 80% 75%);
  border: 1px solid hsl(var(--hue, 220) 60% 50% / 0.25);
}

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: .5rem;
}

.kanban-col {
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.kanban-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem .85rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.kanban-count {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
}

.kanban-card-wrap {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.kanban-card {
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  transition: transform .15s, border-color .15s;
  color: inherit;
  text-decoration: none;
  display: block;
}

.kanban-actions {
  padding: 0 .25rem .25rem;
  border-top: none;
}

.kanban-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 108, 255, 0.35);
}

.kanban-card .amount {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  margin: .5rem 0;
}

/* Monitors — ops list view */
.mon-head .page-sub { margin: .35rem 0 0; color: var(--muted); font-size: .9rem; }
.mon-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin: 0 0 1rem;
}
.mon-kpi {
  padding: .85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.mon-kpi-k {
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.mon-kpi-v {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
}
.mon-kpi.is-up .mon-kpi-v { color: #34d399; }
.mon-kpi.is-down .mon-kpi-v { color: #f87171; }
.mon-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0 0 1rem;
}
.mon-filter {
  padding: .4rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255,255,255,0.02);
}
.mon-filter:hover { color: var(--text); border-color: rgba(148,163,184,.45); }
.mon-filter.is-on {
  color: #0b1220;
  background: #7dd3fc;
  border-color: transparent;
}
.mon-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.mon-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(140px, .7fr) minmax(140px, .55fr) auto;
  gap: 1rem;
  padding: 0 .35rem .35rem .85rem;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.mon-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(140px, .7fr) minmax(140px, .55fr) auto;
  gap: 1rem;
  align-items: center;
  padding: .85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, hsl(var(--hue, 142) 70% 55% / 0.12), rgba(15, 23, 42, 0.35) 28%);
  transition: border-color .15s, transform .15s;
}
.mon-row:hover {
  border-color: rgba(125, 211, 252, 0.35);
  transform: translateY(-1px);
}
.mon-row.is-down {
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.16), rgba(15, 23, 42, 0.35) 32%);
}
.mon-row-main {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  min-width: 0;
}
.mon-row-meta { min-width: 0; }
.mon-row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .55rem;
  margin-bottom: .2rem;
}
.mon-row-title strong {
  font-size: .98rem;
  font-weight: 650;
  color: var(--text);
}
.mon-status-pill {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .15rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.mon-status-pill.is-up { color: #6ee7b7; border-color: rgba(52, 211, 153, .35); background: rgba(16, 185, 129, .1); }
.mon-status-pill.is-down { color: #fca5a5; border-color: rgba(248, 113, 113, .4); background: rgba(239, 68, 68, .12); }
.mon-status-pill.is-unknown { color: #cbd5e1; }
.mon-status-pill.is-paused { color: #fbbf24; border-color: rgba(251, 191, 36, .35); }
.mon-row-url {
  display: block;
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mon-row-url:hover { color: #7dd3fc; }
.mon-row-latency {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
}
.mon-lat-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}
.mon-lat-fill {
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #34d399, #38bdf8);
}
.mon-row.is-down .mon-lat-fill { background: #f87171; }
.mon-lat-val {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text);
}
.mon-lat-val.is-na { color: var(--muted); }
.mon-row-checked {
  font-size: .78rem;
  color: var(--muted);
}
.mon-row-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  font-size: .82rem;
}
.mon-row-actions a { color: #7dd3fc; text-decoration: none; }
.mon-row-actions a.danger { color: #f87171; }
.mon-empty { padding: 1.5rem; text-align: center; }
@media (max-width: 900px) {
  .mon-kpis { grid-template-columns: repeat(2, 1fr); }
  .mon-list-head { display: none; }
  .mon-row {
    grid-template-columns: 1fr;
    gap: .65rem;
  }
  .mon-row-actions { justify-content: flex-start; }
}

/* legacy pulse (shared) */
.monitor-grid { display: none; }
.monitor-card { display: none; }

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: hsl(var(--hue, 142) 70% 55%);
  box-shadow: 0 0 0 0 hsl(var(--hue, 142) 70% 55% / 0.5);
  animation: pulse 2s infinite;
}

.pulse.down { animation: none; background: var(--danger); }
.pulse.unknown { animation: none; background: var(--muted); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 hsl(var(--hue, 142) 70% 55% / 0.45); }
  70% { box-shadow: 0 0 0 10px hsl(var(--hue, 142) 70% 55% / 0); }
  100% { box-shadow: 0 0 0 0 hsl(var(--hue, 142) 70% 55% / 0); }
}

/* Activity stream */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.activity-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .85rem;
  align-items: center;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: background .15s;
}

.activity-item:hover { background: var(--surface-hover); }

.activity-item .when {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
}

/* Forms */
.form-shell {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.25rem;
  align-items: start;
}

.form-panel { padding: 1.5rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-row.full { grid-column: 1 / -1; }

.form-row label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.input {
  width: 100%;
  padding: .7rem .85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  font: inherit;
}

.input:focus {
  outline: none;
  border-color: rgba(124, 108, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.15);
}

.input.textarea { min-height: 110px; resize: vertical; }

.side-panel {
  padding: 1.25rem;
  position: sticky;
  top: 5rem;
}

.side-panel h3 {
  margin: 0 0 1rem;
  font-size: .95rem;
}

.line-items {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.line-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: .5rem;
  margin-bottom: .5rem;
  align-items: end;
}

.form-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
}

.field-error { color: var(--danger); font-size: .82rem; }

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.messages li {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
  font-size: .88rem;
  border: 1px solid var(--line);
}

.messages .success { background: rgba(52, 211, 153, 0.12); color: var(--success); }
.messages .error { background: rgba(251, 113, 133, 0.12); color: var(--danger); }

.raw-key {
  font-family: var(--mono);
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.35);
  border: 1px dashed var(--line);
  word-break: break-all;
  cursor: pointer;
}

.raw-key.copied { border-color: var(--success); color: var(--success); }

.empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}

.pagination {
  display: flex;
  gap: .5rem;
  margin-top: 1.25rem;
  font-size: .85rem;
  color: var(--muted);
}

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

.login-hero {
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.login-hero h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.04em;
  margin: 0 0 .75rem;
  max-width: 10ch;
}

.login-app-name {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  max-width: 32ch;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.login-hero .mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(124,108,255,0.45), transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(56,189,248,0.3), transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(244,114,182,0.25), transparent 40%);
}

.login-form-side {
  display: grid;
  place-items: center;
  padding: 2rem;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(20px);
}

.login-card {
  width: min(400px, 100%);
  padding: 2rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: .88rem;
}

.data-table th {
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

@media (max-width: 1100px) {
  .bento-stat { grid-column: span 4; }
  .bento-wide, .bento-half { grid-column: span 12; }
  .bento-tall { grid-column: span 12; grid-row: auto; }
  .kanban { grid-template-columns: repeat(5, minmax(200px, 1fr)); }
  .users-kanban { grid-template-columns: repeat(4, minmax(200px, 1fr)); }
  .form-shell { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    --sidebar-current-w: 0px;
  }
  .shell:has(.shell-sidebar.collapsed) {
    --sidebar-current-w: 0px;
  }
  .shell-sidebar {
    position: fixed;
    z-index: 20;
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    transform: translateX(-100%);
  }
  .shell-sidebar.collapsed {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    max-width: var(--sidebar-w);
  }
  .shell-sidebar.open { transform: translateX(0); }
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { min-height: 40vh; }
  .form-grid { grid-template-columns: 1fr; }
  .line-row { grid-template-columns: 1fr; }
  .bento-stat { grid-column: span 6; }
}

@media (max-width: 520px) {
  .bento-stat { grid-column: span 12; }
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.detail-panel h2 {
  margin: 0 0 .75rem;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.detail-panel.highlight {
  border-color: rgba(124, 108, 255, 0.35);
  background: linear-gradient(180deg, rgba(124, 108, 255, 0.12), rgba(255,255,255,0.02));
}

.detail-stat {
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}

.detail-stat span { font-size: .9rem; color: var(--muted); }
.detail-sub { color: var(--muted); font-size: .85rem; margin: .35rem 0 0; }

.bill-to-radios {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.bill-to-radios label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
}

.line-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.line-items-head h2 {
  margin: 0;
  font-size: 1rem;
}

.line-items-table {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.line-items-row {
  display: grid;
  grid-template-columns: 2fr .75fr 1fr .65fr auto;
  gap: .5rem;
  align-items: center;
}

.line-currency {
  padding-left: .35rem;
  padding-right: .35rem;
  font-size: .82rem;
}

.client-logo-sm {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
}

.client-logo-lg {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px;
}

.client-head {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-preview {
  margin-top: .5rem;
  max-height: 64px;
  max-width: 160px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
}

.fx-rate {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
}

.line-items-header {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding-bottom: .35rem;
}

.line-items-row .form-row { margin: 0; }
.line-items-row .form-row label { display: none; }
.line-remove label { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; }

.invoice-brand {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.invoice-brand img { max-width: 100%; height: auto; }

.invoice-totals {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: .9rem;
}

.invoice-totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .25rem 0;
}

.invoice-totals dt { color: var(--muted); font-weight: 500; }
.invoice-totals dd { margin: 0; text-align: right; }
.invoice-totals .total {
  margin-top: .35rem;
  padding-top: .5rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .line-items-row { grid-template-columns: 1fr; }
  .line-items-header { display: none; }
  .config-tests { grid-template-columns: 1fr; }
}

.config-section {
  margin-bottom: 1rem;
}

.config-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.config-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.config-section .toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--muted);
}

.config-tests {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}

.config-tests h2 {
  margin: 0 0 1rem;
  font-size: .95rem;
}

.config-tests .form-row {
  margin-bottom: .75rem;
}

/* Control-plane shell — dark theme for readable titles */
.nav-section-label {
  margin: 1.1rem 0.75rem 0.4rem;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
}
.nav-section-label:first-child { margin-top: 0.15rem; }
.fleet-status-strip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 1rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}
.fleet-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  animation: fleetPulse 2.4s ease-in-out infinite;
}
.fleet-status-strip.is-up .fleet-dot { background: #10b981; }
.fleet-status-strip.is-down .fleet-dot { background: #ef4444; animation: none; }
.fleet-status-strip.is-degraded .fleet-dot { background: #f59e0b; }
@keyframes fleetPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
.shell-sidebar {
  background: linear-gradient(180deg, #0b1220 0%, #111827 55%, #0f172a 100%);
}
.shell-sidebar .nav-label,
.shell-sidebar .nav-section-label,
.shell-sidebar .nav-icon {
  color: #e2e8f0;
}
.shell-sidebar .nav-item {
  color: #94a3b8;
}
.shell-sidebar .nav-item:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #e2e8f0;
}
.shell-sidebar .nav-item.active {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  box-shadow: inset 3px 0 0 #38bdf8;
}
.shell-sidebar .nav-section-label {
  color: #64748b;
}
.shell-main {
  background:
    radial-gradient(ellipse 70% 40% at 10% -10%, rgba(56, 189, 248, 0.08), transparent),
    radial-gradient(ellipse 50% 30% at 100% 0%, rgba(124, 108, 255, 0.08), transparent),
    var(--bg);
  color: var(--text);
}
.shell-main .topbar-title,
.shell-main .page-head h1,
.shell-main .dashboard-head h1,
.shell-main h1,
.shell-main h2,
.shell-main h3,
.shell-main .card strong,
.shell-main table th {
  color: var(--text);
}
.shell-main .topbar {
  background: rgba(7, 8, 15, 0.85);
}

.page-lead {
  color: var(--muted);
  margin: .35rem 0 0;
  max-width: 52rem;
  line-height: 1.45;
}
.muted-link {
  color: var(--muted);
  text-decoration: none;
  font-size: .85rem;
}
.muted-link:hover { color: var(--text); }
.chip.is-on, .chip-row .chip.is-on {
  background: rgba(124, 108, 255, 0.22);
  color: #ddd6fe;
}
.idea-progress-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}
.idea-progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #7c6cff, #38bdf8);
}
.idea-check-list { padding: 1.1rem 1.25rem; }
.idea-check-list h2 { margin: 0 0 .35rem; }
.check-rows { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .75rem; }
.check-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .75rem;
  align-items: start;
  padding: .85rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.check-row.is-done { opacity: .72; }
.check-row.is-test { border-color: rgba(56, 189, 248, 0.28); }
.check-toggle button {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}
.check-row.is-done .check-toggle button {
  background: rgba(52, 211, 153, 0.18);
  color: #34d399;
  border-color: transparent;
}
.check-title { font-weight: 600; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.check-meta { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.notes-form { margin-top: .65rem; display: grid; gap: .5rem; }
.check-row.is-done .check-title { text-decoration: line-through; }

.stat-row {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.stat-pill {
  font-size: .8rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: .25rem .7rem;
  background: var(--surface);
}
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.role-card .perm-list {
  list-style: none;
  margin: .85rem 0 0;
  padding: 0;
  display: grid;
  gap: .45rem;
}
.role-card .perm-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .88rem;
  color: var(--muted);
}
.role-card .perm-list strong { color: var(--text); font-weight: 600; }
.inline-grant { display: inline; }
.inline-grant button { font-size: .82rem; }
