/* ─────────────────────────────────────────────────────────────────────────────
   ES Monitor – Dashboard Styles
   Matches the CoreFleet design aesthetic
───────────────────────────────────────────────────────────────────────────── */

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange:        #F97316;
  --orange-dark:   #EA580C;
  --orange-light:  #FFF7ED;
  --orange-mid:    #FED7AA;

  --bg:            #F3F4F6;
  --white:         #FFFFFF;
  --border:        #E5E7EB;
  --border-light:  #F3F4F6;

  --text-h:        #111827;
  --text-b:        #374151;
  --text-s:        #6B7280;
  --text-xs:       #9CA3AF;

  --critical:      #EF4444;
  --critical-bg:   #FEF2F2;
  --error:         #F97316;
  --error-bg:      #FFF7ED;
  --warning:       #EAB308;
  --warning-bg:    #FEFCE8;
  --info:          #3B82F6;
  --info-bg:       #EFF6FF;
  --success:       #10B981;
  --success-bg:    #ECFDF5;

  --strip-w:       60px;
  --sidebar-w:     240px;
  --radius:        14px;
  --radius-sm:     8px;
  --shadow:        0 1px 4px rgba(0,0,0,.06), 0 2px 12px rgba(0,0,0,.04);
  --shadow-md:     0 4px 24px rgba(0,0,0,.10);

  --font:          'Inter', system-ui, -apple-system, sans-serif;
  --transition:    150ms ease;
}

/* Dark theme */
body.dark {
  --bg:            #0F172A;
  --white:         #1E293B;
  --border:        #334155;
  --border-light:  #1E293B;
  --text-h:        #F1F5F9;
  --text-b:        #CBD5E1;
  --text-s:        #94A3B8;
  --text-xs:       #64748B;
  --shadow:        0 1px 4px rgba(0,0,0,.3);
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-b);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; font-family: var(--font); }
input, select { font-family: var(--font); }

/* ── App shell ────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Strip ────────────────────────────────────────────────────────────────── */
.strip {
  width: var(--strip-w);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 8px;
  z-index: 20;
}
.strip-top, .strip-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.strip-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  color: var(--text-s);
  transition: var(--transition);
}
.strip-icon svg { width: 18px; height: 18px; }
.strip-icon:hover { background: var(--border); color: var(--text-b); }
.strip-icon--active { background: var(--orange); color: #fff; }
.strip-icon--active:hover { background: var(--orange-dark); }
.strip-icon--purple { background: #EDE9FE; color: #7C3AED; }
.strip-icon--slate  { background: #F1F5F9; color: #475569; }
.strip-icon--teal   { background: #CCFBF1; color: #0D9488; }
.strip-icon--add    { background: var(--border); color: var(--text-s); font-size: 16px; }
.strip-icon--theme  { background: transparent; color: var(--text-s); font-size: 14px; border: 1px solid var(--border); }
.strip-icon--theme:hover { border-color: var(--orange); color: var(--orange); }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.brand-logo {
  width: 34px; height: 34px;
  background: var(--orange);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-logo svg { width: 18px; height: 18px; stroke: #fff; }
.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-h);
  flex: 1;
}
.sidebar-collapse-btn {
  border: none; background: none;
  color: var(--text-s); font-size: 14px;
  padding: 4px;
  border-radius: 6px;
}
.sidebar-collapse-btn:hover { background: var(--bg); color: var(--text-b); }

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 14px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.sidebar-search i { color: var(--text-xs); font-size: 13px; }
.sidebar-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-b);
  font-size: 13px;
  outline: none;
}
.sidebar-search input::placeholder { color: var(--text-xs); }
.sidebar-search kbd {
  font-size: 11px;
  color: var(--text-xs);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 5px;
  font-family: var(--font);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 12px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 14px 8px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-s);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.nav-link i:first-child {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}
.nav-link span { flex: 1; }
.nav-link:hover { background: var(--bg); color: var(--text-b); }
.nav-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.nav-link.active {
  background: var(--orange-light);
  color: var(--orange);
  font-weight: 600;
}
.nav-link.active i:first-child { color: var(--orange); }

.nav-chevron {
  font-size: 11px;
  color: var(--text-xs);
  transition: transform var(--transition);
}
.has-children.open > .nav-link .nav-chevron { transform: rotate(0deg); }
.has-children:not(.open) > .nav-link .nav-chevron { transform: rotate(-90deg); }

.nav-children {
  margin-left: 28px;
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
}
.has-children.open .nav-children { max-height: 200px; }
#nav-projects-parent.open .nav-children { max-height: 320px; }

/* Project nav children */
.nav-project-link { display: flex !important; align-items: center; gap: 4px; }

.nav-child-count {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  background: var(--error-bg);
  color: var(--error);
  border-radius: 10px;
  padding: 1px 6px;
}
.nav-child-count.is-critical { background: var(--critical-bg); color: var(--critical); }

.nav-child--loading { color: var(--text-xs); font-size: 12px; }

.nav-child--viewall {
  font-size: 12px !important;
  color: var(--text-xs) !important;
  border-top: 1px solid var(--border);
  margin-top: 2px;
  padding-top: 8px !important;
}
.nav-child--viewall:hover { color: var(--orange) !important; background: transparent !important; }
.nav-child--viewall i { font-size: 10px; margin-right: 2px; }

.nav-child {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-s);
  transition: var(--transition);
}
.nav-child:hover { background: var(--bg); color: var(--text-b); }
.nav-child.active { color: var(--orange); font-weight: 600; }

.nav-project-link { display: flex; align-items: center; gap: 7px; }
.nav-project-avatar {
  width: 20px; height: 20px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* User profile at bottom */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
}
.user-avatar-placeholder {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-name  { font-size: 13px; font-weight: 600; color: var(--text-h); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11.5px; color: var(--text-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-more  { border: none; background: none; color: var(--text-xs); font-size: 11px; padding: 4px; }

/* ── Content area ─────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 64px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-h);
  flex-shrink: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}
.live-text { font-size: 12px; color: var(--success); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-b);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:hover { background: var(--bg); border-color: #D1D5DB; }

.btn-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }

.btn-icon {
  padding: 8px 10px;
  position: relative;
}
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--critical);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  padding: 0 3px;
}

/* ── Topbar dropdowns ─────────────────────────────────────────────────────── */
.topbar-dropdown-wrap {
  position: relative;
}
.topbar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  display: none;
  min-width: 280px;
}
.topbar-dropdown.open { display: block; }

/* ── Notification dropdown ────────────────────────────────────────────────── */
.notif-dropdown { min-width: 340px; overflow: hidden; }
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.notif-dropdown-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-h);
}
.notif-mark-all {
  border: none;
  background: none;
  font-size: 12px;
  color: var(--orange);
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}
.notif-mark-all:hover { color: var(--orange-dark); }
.notif-dropdown-body {
  max-height: 360px;
  overflow-y: auto;
}
.notif-empty {
  padding: 28px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-xs);
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--orange-light); }
.notif-item.unread:hover { background: var(--orange-mid); background: #fff3e8; }
.notif-icon-wrap {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}
.notif-icon-wrap.critical { background: var(--critical-bg); color: var(--critical); }
.notif-icon-wrap.error    { background: var(--error-bg);    color: var(--error); }
.notif-icon-wrap.warning  { background: var(--warning-bg);  color: var(--warning); }
.notif-icon-wrap.info     { background: var(--info-bg);     color: var(--info); }
.notif-body { flex: 1; min-width: 0; }
.notif-msg {
  font-size: 13px;
  color: var(--text-b);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-meta {
  font-size: 11px;
  color: var(--text-xs);
  margin-top: 2px;
}
.notif-time {
  font-size: 11px;
  color: var(--text-xs);
  flex-shrink: 0;
  margin-top: 3px;
}

/* Dark mode toggle */
.btn-dark-toggle { transition: var(--transition); }
.btn-dark-toggle:hover { color: var(--orange); border-color: var(--orange); }

/* ── Dashboard scroll area ────────────────────────────────────────────────── */
.dashboard {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Stat cards row ───────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  position: relative;
  border: 1px solid var(--border);
  overflow: hidden;
}
.stat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-s);
}
.stat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.stat-icon--orange { background: var(--orange-light); color: var(--orange); }

.stat-value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-h);
  line-height: 1;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
.stat-badge::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 10px;
}
.stat-badge--up   { background: #DCFCE7; color: #16A34A; }
.stat-badge--up::before   { content: '\f062'; }
.stat-badge--down { background: #FEE2E2; color: #DC2626; }
.stat-badge--down::before { content: '\f063'; }
.stat-badge--neutral { background: var(--bg); color: var(--text-s); }

.stat-sub {
  font-size: 12px;
  color: var(--text-xs);
}
.stat-link {
  position: absolute;
  top: 18px; right: 18px;
  font-size: 13px;
  color: var(--text-xs);
  transition: var(--transition);
}
.stat-link:hover { color: var(--orange); }

/* ── Main grid ────────────────────────────────────────────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}
.col-left, .col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}
.card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title-icon { color: var(--text-s); font-size: 15px; }
.card-title-icon--orange { color: var(--orange); }
.card-title { font-size: 15px; font-weight: 600; color: var(--text-h); }
.card-info  { color: var(--text-xs); font-size: 13px; cursor: help; }

/* ── Stat label group (label + info icon) ─────────────────────────────────── */
.stat-label-group { display: flex; align-items: center; gap: 5px; }

/* ── Global tooltip (fixed, not clipped by overflow:hidden) ───────────────── */
#esm-tooltip {
  position: fixed;
  z-index: 9999;
  background: #1E293B;
  color: #F1F5F9;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  max-width: 230px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  transform: translateY(calc(-100% - 8px));
  word-wrap: break-word;
}
#esm-tooltip.visible { opacity: 1; }
body.dark #esm-tooltip { background: #0F172A; box-shadow: 0 4px 16px rgba(0,0,0,.5); }

.card-more {
  border: none; background: none;
  color: var(--text-s); font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
}
.card-more:hover { background: var(--bg); color: var(--text-b); }

.card-body-pad { padding: 16px 20px 20px; }

/* ── Error chart card ─────────────────────────────────────────────────────── */
.chart-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 20px 0;
}
.chart-big-num {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-h);
  line-height: 1;
}
.chart-period-label { font-size: 12px; color: var(--text-xs); }

.chart-wrap {
  padding: 12px 12px 16px;
  height: 260px;
  position: relative;
}
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

/* ── Recent errors table card ─────────────────────────────────────────────── */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  animation: slideDown .15s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bulk-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--orange);
  margin-right: 4px;
}
.bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.bulk-btn--resolve { background: #d1fae5; color: #065f46; }
.bulk-btn--resolve:hover { background: #a7f3d0; }
.bulk-btn--ignore  { background: #e0e7ff; color: #3730a3; }
.bulk-btn--ignore:hover  { background: #c7d2fe; }
.bulk-btn--clear   { background: var(--bg); color: var(--text-s); margin-left: auto; }
.bulk-btn--clear:hover   { background: var(--border); }

.errors-filter-row {
  display: flex;
  gap: 8px;
  padding: 14px 20px 0;
}
.filter-input, .filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-b);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.filter-input { flex: 1; }
.filter-select { cursor: pointer; }
.filter-input:focus, .filter-select:focus { border-color: var(--orange); background: var(--white); }

.table-wrap { overflow-x: auto; margin-top: 14px; }

.errors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.errors-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 12px 10px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.errors-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.errors-table tr:last-child td { border-bottom: none; }
.errors-table tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}
.errors-table tbody tr:hover { background: var(--bg); }

.col-check { width: 36px; }
.col-check input[type="checkbox"] { cursor: pointer; accent-color: var(--orange); }

.td-time { color: var(--text-s); font-size: 12.5px; white-space: nowrap; font-weight: 500; }

.project-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 130px;
}
.project-avatar {
  width: 26px; height: 26px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.project-name { font-size: 12.5px; color: var(--text-b); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.td-message {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-b);
}
.td-source { font-size: 11px; color: var(--text-xs); font-family: monospace; }

.td-env { font-size: 12px; color: var(--text-s); }

/* Severity / status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-critical { background: var(--critical-bg); color: var(--critical); }
.badge-error    { background: var(--error-bg);    color: var(--error);    }
.badge-warning  { background: var(--warning-bg);  color: #A16207;         }
.badge-info     { background: var(--info-bg);     color: var(--info);     }

.badge-open     { background: var(--error-bg);    color: var(--error);    }
.badge-resolved { background: var(--success-bg);  color: var(--success);  }
.badge-ignored  { background: var(--bg);          color: var(--text-s);   }

.table-loading td { padding: 32px; text-align: center; color: var(--text-xs); }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
}
.page-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--text-s);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}
.page-btn:hover { border-color: var(--orange); color: var(--orange); }
.page-btn.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.page-info { font-size: 12px; color: var(--text-xs); margin-right: 6px; }

/* ── Resolution Rate (Gantt) card ────────────────────────────────────────── */
.gantt-period {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-h);
  margin-bottom: 16px;
}

.gantt-outer {
  position: relative;
  padding-top: 44px;
  margin-bottom: 14px;
}

.gantt-bar {
  display: flex;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--border-light);
}
.gantt-filled {
  background: var(--orange);
  height: 100%;
  border-radius: 10px 0 0 10px;
  min-width: 4px;
  transition: width .6s ease;
}
.gantt-remaining {
  flex: 1;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    var(--orange-mid),
    var(--orange-mid) 4px,
    var(--orange-light) 4px,
    var(--orange-light) 10px
  );
  border-radius: 0 10px 10px 0;
}

.gantt-marker {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.gantt-marker::after {
  content: '';
  display: block;
  width: 2px;
  height: 44px;        /* bridges label to bar */
  background: var(--text-h);
  margin-top: 2px;
}
.gantt-marker-label {
  background: var(--text-h);
  color: var(--white);
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  text-align: center;
  white-space: nowrap;
  line-height: 1.4;
}
body.dark .gantt-marker-label { background: var(--orange); }

.gantt-dates {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.gantt-dates-right { text-align: right; }
.gantt-date-label { font-size: 11px; color: var(--text-xs); margin-bottom: 2px; }
.gantt-date-val   { font-size: 12.5px; font-weight: 600; color: var(--text-b); }

.gantt-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.gantt-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-s);
}
.gantt-stat--rate { margin-left: auto; font-size: 13px; color: var(--text-b); }
.gantt-stat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gantt-stat-dot--resolved { background: var(--orange); }
.gantt-stat-dot--open     { background: var(--border); }

/* Project health mini list */
.project-health-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.health-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.health-avatar {
  width: 28px; height: 28px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.health-name { font-size: 12.5px; font-weight: 500; color: var(--text-b); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-bar-wrap { width: 80px; background: var(--border-light); border-radius: 4px; height: 5px; overflow: hidden; flex-shrink: 0; }
.health-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.health-count { font-size: 11.5px; font-weight: 600; color: var(--text-s); width: 28px; text-align: right; flex-shrink: 0; }

/* ── Alerts card ─────────────────────────────────────────────────────────── */
.alerts-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--critical-bg);
  color: var(--critical);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}
.alerts-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--critical);
  flex-shrink: 0;
}

.alerts-list { padding: 10px 0 4px; }
.alerts-loading { padding: 24px; text-align: center; color: var(--text-xs); }

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--bg); }

.alert-icon-wrap {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--warning-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}
.alert-icon-wrap.critical { background: var(--critical-bg); color: var(--critical); }
.alert-icon-wrap.error    { background: var(--error-bg);    color: var(--orange);   }
.alert-icon-wrap.warning  { background: var(--warning-bg);  color: var(--warning);  }

.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 13px; font-weight: 600; color: var(--text-h); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-meta  { display: flex; align-items: center; gap: 4px; margin-top: 2px; flex-wrap: wrap; }
.alert-project { font-size: 11.5px; color: var(--orange); font-weight: 600; }
.alert-sep     { color: var(--text-xs); font-size: 11px; }
.alert-env     { font-size: 11.5px; color: var(--text-s); }
.alert-time    { font-size: 11px; color: var(--text-xs); white-space: nowrap; margin-top: 2px; flex-shrink: 0; }

/* ── Error detail modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 660px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}
.modal-title-group { display: flex; align-items: center; gap: 10px; }
.modal-severity-badge {
  text-transform: capitalize;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-h); }
.modal-header-actions { display: flex; align-items: center; gap: 8px; }
.modal-action-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-b);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.modal-action-btn:hover { background: var(--bg-card); }
.btn-resolve.active { background: #dcfce7; color: #16a34a; border-color: #16a34a; }
.btn-ignore.active  { background: #f3f4f6; color: #6b7280; border-color: #9ca3af; }
.dark .btn-resolve.active { background: #14532d; color: #86efac; border-color: #22c55e; }
.dark .btn-ignore.active  { background: #1f2937; color: #9ca3af; border-color: #6b7280; }
.modal-close {
  border: none; background: none;
  color: var(--text-s); font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg); color: var(--text-b); }

.modal-body { overflow-y: auto; padding: 20px 22px; flex: 1; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-message {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-h);
  margin-bottom: 18px;
  line-height: 1.5;
}

.modal-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.modal-meta-item { display: flex; flex-direction: column; gap: 3px; }
.modal-meta-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-xs); }
.modal-meta-item span:last-child { font-size: 13px; color: var(--text-b); font-weight: 500; }

.modal-stack-wrap, .modal-metadata-wrap { margin-bottom: 16px; }
.modal-stack-label { font-size: 12px; font-weight: 600; color: var(--text-s); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.modal-stack {
  background: #0F172A;
  color: #94A3B8;
  font-size: 12px;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  line-height: 1.6;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 240px;
  overflow-y: auto;
}

/* ── Login overlay ────────────────────────────────────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #F3F4F6);
}
.login-card {
  background: var(--white, #fff);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
  padding: 48px 40px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-width: 340px;
}
.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-h, #111827);
  text-align: center;
}
.login-sub {
  font-size: 14px;
  color: var(--text-s, #6B7280);
  text-align: center;
  margin-top: -10px;
}
.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 150ms ease;
  margin-top: 4px;
}
.login-btn:hover { opacity: .88; }
