:root {
  --un-blue: #009EDB;
  --un-blue-dark: #0077B5;
  --un-navy: #131B2E;
  --un-navy-light: #1E293B;
  --bg-canvas: #F3F6FA;
  --card-bg: #FFFFFF;
  --border-color: #E2E8F0;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --purple: #6366F1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-canvas);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
}

/* Top Dark Navy Header Bar */
.topbar {
  background: var(--un-navy);
  color: #fff;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.15);
}
.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.4px;
}
.brand-emblem {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--un-blue), var(--un-blue-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  font-size: 15px;
}
.topbar-search {
  flex: 1;
  max-width: 480px;
  margin: 0 24px;
}
.topbar-search form {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.topbar-search input {
  background: transparent;
  border: none;
  color: #fff;
  width: 100%;
  outline: none;
  font-size: 13px;
}
.topbar-search input::placeholder { color: #94A3B8; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 3-Column Clinked-inspired Workspace */
.workspace-grid {
  display: grid;
  grid-template-columns: 245px 1fr 275px;
  min-height: calc(100vh - 62px);
}
@media (max-width: 1180px) {
  .workspace-grid { grid-template-columns: 230px 1fr; }
  .right-rail { display: none; }
}
@media (max-width: 820px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .left-rail { border-right: none; border-bottom: 1px solid var(--border-color); }
}

/* Left Profile & Navigation Rail */
.left-rail {
  background: var(--card-bg);
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.officer-profile-card {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
}
.officer-avatar-ring {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  margin: 0 auto 10px;
  padding: 3px;
  background: linear-gradient(135deg, var(--un-blue), #38BDF8);
}
.officer-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--un-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
}
.officer-name { font-weight: 700; font-size: 15px; color: var(--text-main); }
.officer-role { font-size: 12px; color: var(--un-blue-dark); font-weight: 600; margin-top: 2px; }
.officer-dept { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin: 14px 10px 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  color: #334155;
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 4px;
  transition: all 0.15s ease;
}
.nav-link:hover { background: #F1F5F9; color: var(--un-blue-dark); }
.nav-link.active {
  background: rgba(0, 158, 219, 0.12);
  color: var(--un-blue-dark);
  font-weight: 700;
  border-left: 3px solid var(--un-blue);
}
.nav-pill {
  background: var(--un-blue);
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
}

/* Main Center Stage */
.center-stage {
  padding: 22px 26px;
  overflow-x: hidden;
}

/* UN Blue Hero Banner with Analytics */
.un-hero-banner {
  background: linear-gradient(125deg, #0077B5 0%, #009EDB 55%, #0284C7 100%);
  border-radius: 14px;
  color: #fff;
  padding: 22px 26px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: center;
  box-shadow: 0 10px 25px rgba(0, 158, 219, 0.22);
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .un-hero-banner { grid-template-columns: 1fr; }
}
.hero-kpis {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.hero-kpi-box {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 105px;
}
.hero-kpi-val { font-size: 20px; font-weight: 800; }
.hero-kpi-lbl { font-size: 11px; opacity: 0.9; }

.hero-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 92px;
  background: rgba(15, 23, 42, 0.16);
  padding: 12px 16px;
  border-radius: 10px;
}
.hero-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
}
.hero-bar-fill {
  width: 100%;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #BAE6FD 0%, #FFFFFF 100%);
  min-height: 8px;
}
.hero-bar-lbl { font-size: 10px; color: #E0F2FE; }

/* Sub-navigation tabs bar */
.subtabs-bar {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.subtab {
  padding: 6px 14px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
}
.subtab.active {
  background: var(--un-blue);
  color: #fff;
}

/* Cards & Grids */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text-main); }

.category-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 1100px) {
  .category-cards-grid { grid-template-columns: repeat(2, 1fr); }
}
.cat-tile {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.15s ease;
}
.cat-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 158, 219, 0.12); }
.cat-tile-top {
  height: 54px;
  padding: 12px;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cat-tile-body { padding: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  background: #F8FAFC;
}
td {
  padding: 12px;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: top;
}
tr:hover td { background: #F8FAFC; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-open { background: #E0F2FE; color: #0369A1; }
.badge-progress { background: #FEF3C7; color: #B45309; }
.badge-pending-member { background: #F3E8FF; color: #7E22CE; }
.badge-pending-third { background: #FFEDD5; color: #C2410C; }
.badge-resolved { background: #DCFCE7; color: #15803D; }
.badge-closed { background: #E2E8F0; color: #475569; }

.prio-critical { color: #DC2626; font-weight: 800; }
.prio-high { color: #D97706; font-weight: 700; }
.prio-normal { color: #0284C7; font-weight: 600; }
.prio-low { color: #64748B; font-weight: 600; }

/* Buttons & Forms */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-un { background: var(--un-blue); color: #fff; }
.btn-un:hover { background: var(--un-blue-dark); }
.btn-navy { background: var(--un-navy); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border-color); color: var(--text-main); }
.btn-outline:hover { background: #F8FAFC; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-group label { font-size: 12px; font-weight: 600; color: #334155; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
.form-control:focus {
  outline: none;
  border-color: var(--un-blue);
  box-shadow: 0 0 0 3px rgba(0, 158, 219, 0.15);
}

/* Right Directory & Activity Rail */
.right-rail {
  background: var(--card-bg);
  border-left: 1px solid var(--border-color);
  padding: 20px 16px;
}
.dir-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
}
.dir-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0, 158, 219, 0.12);
  color: var(--un-blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 500;
}
.alert-success { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.alert-danger { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-info { background: #E0F2FE; color: #075985; border: 1px solid #7DD3FC; }

.code-block {
  background: #0F172A;
  color: #E2E8F0;
  padding: 14px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.55;
}
