/* ─── ConnectGH Incident System — Main Stylesheet ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --green-900: #0B2318;
  --green-800: #1B4332;
  --green-700: #2D6A4F;
  --green-600: #40916C;
  --green-100: #D8F3DC;
  --green-50:  #F0F7F4;
  --gold-600:  #C8971A;
  --gold-500:  #D4A520;
  --gold-100:  #FEF3C7;
  --gold-50:   #FFFBEB;
  --gray-950:  #030712;
  --gray-900:  #111827;
  --gray-700:  #374151;
  --gray-500:  #6B7280;
  --gray-300:  #D1D5DB;
  --gray-200:  #E5E7EB;
  --gray-100:  #F3F4F6;
  --gray-50:   #F9FAFB;
  --white:     #FFFFFF;
  --red-600:   #DC2626;
  --red-50:    #FEF2F2;
  --orange-600:#EA580C;
  --orange-50: #FFF7ED;
  --amber-600: #D97706;
  --blue-600:  #2563EB;
  --blue-50:   #EFF6FF;
  --sidebar-w: 256px;
  --header-h:  64px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--green-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo img { height: 36px; width: auto; display: block; }
.sidebar-tagline {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: rgba(255,255,255,.45);
  margin-top: 8px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav-item.active {
  background: var(--gold-600);
  color: #fff;
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .85;
}
.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--red-600);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 11px;
  color: rgba(255,255,255,.3);
  line-height: 1.6;
}

/* ─── MAIN LAYOUT ─── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
  flex: 1;
}
.topbar-breadcrumb .crumb-current {
  color: var(--gray-900);
  font-weight: 600;
}
.topbar-breadcrumb .sep { color: var(--gray-300); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  width: 240px;
  transition: border-color .15s;
}
.topbar-search:focus-within {
  border-color: var(--green-600);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(64,145,108,.12);
}
.topbar-search input {
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--gray-900);
  width: 100%;
}
.topbar-search svg { color: var(--gray-400); flex-shrink: 0; }

.page-content { flex: 1; padding: 28px; }

/* ─── PAGE HEADER ─── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-header-left {}
.page-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--green-700);
  margin-bottom: 4px;
}
.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -.4px;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all .15s; text-decoration: none;
  white-space: nowrap; line-height: 1;
}
.btn-primary   { background: var(--green-800); color: #fff; }
.btn-primary:hover   { background: var(--green-900); color: #fff; text-decoration: none; }
.btn-gold      { background: var(--gold-600); color: #fff; }
.btn-gold:hover      { background: #a87e14; color: #fff; text-decoration: none; }
.btn-danger    { background: var(--red-600); color: #fff; }
.btn-danger:hover    { background: #b91c1c; color: #fff; text-decoration: none; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover   { background: #15803d; color: #fff; text-decoration: none; }
.btn-outline   { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover   { background: var(--gray-50); color: var(--gray-900); text-decoration: none; }
.btn-ghost     { background: transparent; color: var(--gray-600); border: 1px solid transparent; }
.btn-ghost:hover     { background: var(--gray-100); text-decoration: none; }
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-xs  { padding: 4px 9px; font-size: 11px; }
.btn-icon { padding: 8px; }

/* ─── CARDS ─── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0;
}
.card-title {
  font-size: 14px; font-weight: 700;
  color: var(--green-800);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 18px 22px; }
.card-body.no-pad { padding: 0; }

/* ─── STAT CARDS ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--green-800);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card.gold::before  { background: var(--gold-600); }
.stat-card.red::before   { background: var(--red-600); }
.stat-card.amber::before { background: var(--amber-600); }
.stat-card.teal::before  { background: #16a34a; }
.stat-num {
  font-size: 32px; font-weight: 800;
  color: var(--green-800);
  letter-spacing: -1px;
  line-height: 1;
}
.stat-card.gold .stat-num  { color: var(--gold-600); }
.stat-card.red .stat-num   { color: var(--red-600); }
.stat-card.amber .stat-num { color: var(--amber-600); }
.stat-card.teal .stat-num  { color: #16a34a; }
.stat-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--gray-500);
}
.stat-icon {
  position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%);
  opacity: .07;
}

/* ─── BADGES ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-critical { background: #FEE2E2; color: #991B1B; }
.badge-high     { background: #FFEDD5; color: #9A3412; }
.badge-medium   { background: #FEF3C7; color: #92400E; }
.badge-low      { background: #DCFCE7; color: #166534; }
.badge-open     { background: #D1FAE5; color: #065F46; }
.badge-progress { background: #FEF9C3; color: #854D0E; }
.badge-resolved { background: #DCFCE7; color: #166534; }
.badge-closed   { background: var(--gray-100); color: var(--gray-500); }

/* ─── TABLE ─── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table thead th {
  background: var(--green-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--green-800);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--green-100);
  white-space: nowrap;
}
table.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  font-size: 13px;
}
table.data-table tbody tr { transition: background .1s; }
table.data-table tbody tr:hover { background: var(--green-50); }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* ─── REF CHIP ─── */
.ref-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 500;
  background: var(--green-50);
  color: var(--green-800);
  border: 1px solid var(--green-100);
  padding: 3px 9px;
  border-radius: 5px;
  white-space: nowrap;
}

/* ─── FORM ELEMENTS ─── */
.form-section { margin-bottom: 28px; }
.form-section-title {
  font-size: 13px; font-weight: 700;
  color: var(--green-800);
  border-bottom: 2px solid var(--gold-600);
  padding-bottom: 8px;
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
}
.form-grid { display: grid; gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 11px; font-weight: 700;
  color: var(--gray-700);
  text-transform: uppercase; letter-spacing: .5px;
}
.form-label .req { color: var(--red-600); margin-left: 2px; }
.form-control {
  padding: 10px 13px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--gray-900);
  background: #fff; width: 100%;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(27,67,50,.1);
}
textarea.form-control { resize: vertical; min-height: 88px; line-height: 1.6; }

/* ─── TIMELINE ─── */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; position: relative; }
.tl-item:not(:last-child)::before {
  content: ''; position: absolute;
  left: 11px; top: 28px; width: 2px; bottom: 0;
  background: var(--green-100);
}
.tl-dot {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--green-800); flex-shrink: 0;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px var(--green-50);
}
.tl-dot.gold { background: var(--gold-600); box-shadow: 0 0 0 3px var(--gold-50); }
.tl-dot svg { width: 11px; height: 11px; fill: #fff; }
.tl-body {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 10px 14px; flex: 1;
  margin-bottom: 10px;
}
.tl-meta { font-size: 11px; color: var(--gray-400); margin-bottom: 3px; }
.tl-action { font-size: 13px; font-weight: 600; color: var(--green-800); }
.tl-note { font-size: 12px; color: var(--gray-500); margin-top: 3px; line-height: 1.5; }

/* ─── DETAIL GRID ─── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-field {}
.detail-field .df-label {
  font-size: 10px; font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 3px;
}
.detail-field .df-value { font-size: 13.5px; color: var(--gray-900); line-height: 1.5; }
.detail-field .df-value.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* ─── ANALYTICS ─── */
.chart-bar-wrap { display: flex; flex-direction: column; gap: 10px; }
.chart-bar-item {}
.chart-bar-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--gray-600); margin-bottom: 4px;
}
.chart-bar-track {
  height: 8px; background: var(--gray-100);
  border-radius: 99px; overflow: hidden;
}
.chart-bar-fill {
  height: 100%; border-radius: 99px;
  background: var(--green-700);
  transition: width .6s ease;
}
.donut-wrap { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ─── EMPTY STATE ─── */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 64px 24px; text-align: center;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .7; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--gray-700); margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--gray-400); margin-bottom: 24px; line-height: 1.6; }

/* ─── TOAST ─── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 9999;
}
.toast {
  background: var(--gray-900); color: #fff;
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideUp .25s ease;
  max-width: 320px;
}
.toast.success { background: var(--green-800); }
.toast.error   { background: var(--red-600); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  padding: 28px; max-width: 440px; width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(.96);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 10px; }
.modal-body  { font-size: 13px; color: var(--gray-600); line-height: 1.6; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── FILTER BAR ─── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.filter-select {
  padding: 7px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--gray-700);
  background: #fff; cursor: pointer;
  font-family: inherit;
}
.filter-select:focus { outline: none; border-color: var(--green-700); }
.filter-search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 7px 12px; flex: 1; min-width: 180px;
  background: #fff;
}
.filter-search input {
  border: none; outline: none;
  font-size: 12.5px; color: var(--gray-700);
  font-family: inherit; background: transparent; width: 100%;
}
.filter-count {
  margin-left: auto;
  font-size: 12px; color: var(--gray-400); white-space: nowrap;
}

/* ─── STATUS PANEL ─── */
.status-panel { display: flex; flex-direction: column; gap: 6px; }
.status-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200); background: #fff;
  cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--gray-700); transition: all .15s;
  font-family: inherit; text-align: left; width: 100%;
}
.status-btn:hover { border-color: var(--green-700); background: var(--green-50); color: var(--green-800); }
.status-btn.active { border-color: var(--green-800); background: var(--green-50); color: var(--green-800); font-weight: 700; }
.status-btn .dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* ─── RESPONSIVE ─── */
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 4px; color: var(--gray-600);
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}
