@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   SI-PANTU HEALTHCARE DASHBOARD DESIGN SYSTEM
   Exact Match to UI Mockup: Deep Royal Blue Sidebar + Clean Light Canvas + White Cards
   ========================================================================== */

:root {
  /* Layout Dimensions */
  --sidebar-w: 240px;
  --topbar-h: 70px;

  /* Primary Puskesmas Emerald Green Palette */
  --primary-blue: #007336;
  --primary-blue-hover: #005c2b;
  --primary-blue-dark: #004d23;
  --primary-blue-light: #e8f5ed;
  --primary-blue-subtle: #f0fdf4;

  /* Environment & Surfaces */
  --bg-environment: #f2f7f4;
  --bg-surface: #ffffff;
  --bg-muted: #f7faf8;
  --bg-subtle: #eef5f0;

  /* Sidebar Tokens (Puskesmas Green Theme) */
  --sidebar-bg: #006837;
  --sidebar-text: #ffffff;
  --sidebar-text-muted: #b7e4c7;
  --sidebar-item-hover: rgba(255, 255, 255, 0.12);
  --sidebar-item-active-bg: #ffffff;
  --sidebar-item-active-text: #006837;

  /* Typography Colors */
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-white: #ffffff;

  /* Borders & Dividers */
  --border-light: #f1f5f9;
  --border-default: #e5edf5;
  --border-card: #e8eef5;

  /* Semantic Status Colors (Matching Mockup) */
  --status-normal-bg: #eaf8f0;
  --status-normal-text: #16a34a;
  --status-normal-dot: #16a34a;

  --status-warning-bg: #fef5e7;
  --status-warning-text: #d97706;
  --status-warning-dot: #d97706;

  --status-critical-bg: #feecec;
  --status-critical-text: #dc2626;
  --status-critical-dot: #dc2626;

  --status-info-bg: #eaf2fc;
  --status-info-text: #0284c7;
  --status-info-dot: #0284c7;

  /* Priority Badges */
  --prio-1-bg: #fee2e2;
  --prio-1-text: #991b1b;

  --prio-2-bg: #fef3c7;
  --prio-2-text: #92400e;

  --prio-3-bg: #fef9c3;
  --prio-3-text: #854d0e;

  /* Radius Scale */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-card: 14px;
  --radius-card-lg: 18px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-card: 0 1px 4px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-dropdown: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease-in-out;
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */

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

html {
  font-size: 13.5px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-environment);
  color: var(--text-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  width: 100%;
}

a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--primary-blue-hover);
}

/* ==========================================================================
   SIDEBAR (BLUE ROYAL VERTICAL SIDEBAR)
   ========================================================================== */

.sidebar {
  width: var(--sidebar-w);
  background-color: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 110;
  color: #ffffff;
  padding: 24px 0 20px;
  transition: transform var(--transition-normal);
}

/* Logo Header */
.sidebar-logo {
  padding: 0 20px 24px;
  display: flex;
  align-items: center;
}

.sidebar-logo .logo-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  padding: 8px;
  box-sizing: border-box;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.logo-text {
  line-height: 1.2;
}

.logo-text strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.logo-text span {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--sidebar-text-muted);
  margin-top: 1px;
}

/* Navigation List */
.sidebar-nav {
  flex: 1;
  padding: 6px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.nav-item:hover {
  background-color: var(--sidebar-item-hover);
}

.nav-item.active {
  background-color: var(--sidebar-item-active-bg);
  color: var(--sidebar-item-active-text);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item .nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: transform var(--transition-fast);
}

.nav-item:hover .nav-icon svg {
  transform: scale(1.08);
}

/* Bottom Sidebar Area */
.sidebar-bottom {
  padding: 16px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-puskesmas-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--sidebar-text-muted);
  text-transform: uppercase;
  padding: 0 4px;
}

.sidebar-puskesmas-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #ffffff;
}

.puskesmas-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #ffffff;
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.puskesmas-avatar svg {
  width: 16px;
  height: 16px;
  stroke: var(--primary-blue);
  fill: none;
  stroke-width: 2;
}

.puskesmas-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.sidebar-logout-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  background-color: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */

.main {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-environment);
}

/* ==========================================================================
   TOPBAR
   ========================================================================== */

.topbar {
  height: var(--topbar-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  background-color: var(--bg-environment);
}

.topbar-left {
  display: flex;
  flex-direction: column;
}

.topbar-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Puskesmas Selector Dropdown Pill */
.pusk-selector-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #ffffff;
  border: 1px solid var(--border-default);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.pusk-selector-pill:hover {
  border-color: var(--primary-blue);
}

/* Notification Bell */
.notif-bell-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-body);
  font-size: 15px;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-xs);
}

.notif-bell-btn svg {
  width: 17px;
  height: 17px;
  stroke: var(--text-main);
  fill: none;
  stroke-width: 2;
  transition: transform var(--transition-fast);
}

.notif-bell-btn:hover svg {
  transform: rotate(15deg);
}

.notif-bell-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: var(--primary-blue);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

/* User Profile Chip */
.user-profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  cursor: pointer;
}

.user-chip-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #cbd5e1;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}

.user-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-chip-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-chip-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.user-chip-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ==========================================================================
   PAGE CONTENT (MAX WIDTH & CLEAN SPACING)
   ========================================================================== */

.page-content {
  padding: 8px 32px 40px;
  flex: 1;
  width: 100%;
  max-width: 1600px;
  box-sizing: border-box;
}

.section {
  display: none;
  width: 100%;
}
.section.active {
  display: block;
}

/* ==========================================================================
   CARDS & GRIDS
   ========================================================================== */

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-link:hover {
  text-decoration: underline;
}

.card-footer-link {
  text-align: center;
  padding-top: 14px;
  margin-top: 12px;
  border-top: 1px solid var(--border-light);
}

/* ==========================================================================
   TOP ROW: 4 SUMMARY STAT CARDS (EXACT MATCH)
   ========================================================================== */

.metrics-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.metric-icon-circle.blue {
  background-color: var(--status-info-bg);
  color: var(--status-info-text);
}
.metric-icon-circle.red {
  background-color: var(--status-critical-bg);
  color: var(--status-critical-text);
}
.metric-icon-circle.yellow {
  background-color: var(--status-warning-bg);
  color: var(--status-warning-text);
}
.metric-icon-circle.green {
  background-color: var(--status-normal-bg);
  color: var(--status-normal-text);
}

.metric-content {
  flex: 1;
  min-width: 0;
}

.metric-label-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.info-icon {
  font-size: 11px;
  color: var(--text-subtle);
  cursor: pointer;
}

.metric-number {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
  margin: 2px 0 3px;
}

.metric-sub-text {
  font-size: 11.5px;
  font-weight: 600;
}
.metric-sub-text.blue { color: var(--primary-blue); }
.metric-sub-text.red { color: var(--status-critical-text); }
.metric-sub-text.yellow { color: var(--status-warning-text); }
.metric-sub-text.green { color: var(--status-normal-text); }

/* ==========================================================================
   MIDDLE ROW: 2-COLUMN ASYMMETRIC GRID
   ========================================================================== */

.dash-middle-grid {
  display: grid;
  grid-template-columns: 58% 42%;
  gap: 18px;
  margin-bottom: 20px;
}

/* Dropdown Pill on Card Header */
.card-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #ffffff;
  border: 1px solid var(--border-default);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
}

/* Red Count Badge */
.red-count-badge {
  background-color: var(--status-critical-dot);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Antrean Prioritas Sub-table */
.priority-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.priority-table th {
  padding: 8px 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--border-default);
  text-align: left;
}

.priority-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.priority-table tr:last-child td {
  border-bottom: none;
}

.priority-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.priority-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
  overflow: hidden;
}

.priority-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.priority-user-info {
  line-height: 1.2;
}

.priority-user-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 12px;
}

.priority-user-code {
  font-size: 10.5px;
  color: var(--text-muted);
}

.priority-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.priority-badge.prio-1 {
  background-color: var(--prio-1-bg);
  color: var(--prio-1-text);
}
.priority-badge.prio-2 {
  background-color: var(--prio-2-bg);
  color: var(--prio-2-text);
}
.priority-badge.prio-3 {
  background-color: var(--prio-3-bg);
  color: var(--prio-3-text);
}

/* ==========================================================================
   BOTTOM ROW: AKTIVITAS TERBARU (4-COLUMN FEED)
   ========================================================================== */

.activity-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 4px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.activity-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.activity-icon-circle.blue { background-color: var(--status-info-bg); color: var(--status-info-text); }
.activity-icon-circle.yellow { background-color: var(--status-warning-bg); color: var(--status-warning-text); }
.activity-icon-circle.green { background-color: var(--status-normal-bg); color: var(--status-normal-text); }
.activity-icon-circle.purple { background-color: #f3e8ff; color: #7e22ce; }

.activity-content {
  line-height: 1.25;
}

.activity-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 12.5px;
}

.activity-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-time {
  font-size: 10.5px;
  color: var(--text-subtle);
  margin-top: 3px;
}

/* ==========================================================================
   OTHER PAGES (ANTREAN, PASIEN, LAPORAN, KOMUNIKASI, RME)
   ========================================================================== */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background-color: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-body);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #f8fbfd; }

.td-name { font-weight: 700; color: var(--text-main); }
.td-name small { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); margin-top: 2px; }
.td-truncate { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-red { background-color: var(--status-critical-bg); color: var(--status-critical-text); }
.badge-yellow { background-color: var(--status-warning-bg); color: var(--status-warning-text); }
.badge-green { background-color: var(--status-normal-bg); color: var(--status-normal-text); }
.badge-blue { background-color: var(--status-info-bg); color: var(--status-info-text); }
.badge-gray { background-color: #f1f5f9; color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary { background-color: var(--primary-blue); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-blue-hover); }
.btn-secondary { background-color: #ffffff; color: var(--text-body); border-color: var(--border-default); }
.btn-secondary:hover { background-color: var(--bg-muted); }
.btn-warn { background-color: var(--status-warning-bg); color: var(--status-warning-text); }
.btn-warn:hover { filter: brightness(0.96); }
.btn-success { background-color: var(--status-normal-bg); color: var(--status-normal-text); border-color: #86efac; }
.btn-success:hover { background-color: #bbf7d0; }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }

/* Forms & Filters */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.form-control, .filter-input, .filter-select {
  padding: 8px 12px;
  background-color: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}
.filter-input { flex: 1; min-width: 220px; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background-color: var(--bg-surface);
  border-radius: var(--radius-card);
  width: 100%;
  max-width: 520px;
  padding: 22px;
  box-shadow: var(--shadow-dropdown);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-default); }
.modal-title { font-size: 15px; font-weight: 800; color: var(--text-main); }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-default); }

/* Dropdown */
.notif-dropdown {
  position: absolute;
  right: 0;
  top: 46px;
  width: 360px;
  background-color: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  border: 1px solid var(--border-default);
  z-index: 999;
  overflow: hidden;
}
.notif-dropdown-header { padding: 12px 16px; background-color: #f8fafc; border-bottom: 1px solid var(--border-default); display: flex; justify-content: space-between; align-items: center; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; box-shadow: var(--shadow-dropdown); background-color: #ffffff; border: 1px solid var(--border-default); }
.toast.success { border-left: 4px solid var(--status-normal-dot); }
.toast.error { border-left: 4px solid var(--status-critical-dot); }
.toast.info { border-left: 4px solid var(--primary-blue); }

/* RME Detail */
.rme-header-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.rme-avatar { width: 56px; height: 56px; border-radius: var(--radius-md); background-color: var(--primary-blue-light); color: var(--primary-blue); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.rme-name-row { display: flex; align-items: center; gap: 10px; }
.rme-name { font-size: 18px; font-weight: 800; color: var(--text-main); }
.rme-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 14px; margin-top: 8px; font-size: 12px; }
.antro-metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.antro-metric-card { background-color: var(--bg-surface); border: 1px solid var(--border-card); border-radius: var(--radius-card); padding: 14px 18px; }
.rme-main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pemeriksaan-item, .intervensi-item { padding: 12px 14px; background-color: #f8fafc; border-radius: var(--radius-sm); margin-bottom: 10px; border: 1px solid var(--border-default); }
.pemeriksaan-item { border-left: 3.5px solid var(--primary-blue); }
.intervensi-item { border-left: 3.5px solid var(--status-normal-dot); }

/* ==========================================================================
   WHATSAPP-STYLE 2-PANE COMMUNICATION CENTER
   ========================================================================== */

.whatsapp-chat-container {
  display: grid;
  grid-template-columns: 330px 1fr;
  grid-template-rows: 100%;
  height: calc(100vh - 190px);
  min-height: 540px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

/* Left Pane: Contacts & Recent Chats */
.wa-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-default);
  background-color: #ffffff;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.wa-sidebar-header {
  padding: 14px 16px;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wa-sidebar-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.wa-search-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  background-color: #f8fafc;
}

.wa-search-input {
  width: 100%;
  padding: 7px 14px;
  background-color: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 12px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.wa-search-input:focus {
  border-color: var(--primary-blue);
}

.wa-contact-list {
  flex: 1;
  overflow-y: auto;
}

.wa-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.wa-contact-item:hover {
  background-color: #f1f5f9;
}

.wa-contact-item.active {
  background-color: var(--primary-blue-light);
  border-left: 3.5px solid var(--primary-blue);
}

.wa-contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: #e0e7ff;
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

.wa-contact-info {
  flex: 1;
  min-width: 0;
}

.wa-contact-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.wa-contact-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-contact-time {
  font-size: 10.5px;
  color: var(--text-subtle);
  flex-shrink: 0;
  margin-left: 6px;
}

.wa-contact-child {
  font-size: 11px;
  color: var(--primary-blue);
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-contact-msg {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-contact-msg.unread {
  font-weight: 700;
  color: var(--text-main);
}

/* Right Pane: Live Chat Window */
.wa-chat-area {
  display: flex;
  flex-direction: column;
  background-color: #f1f5f9;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.wa-chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
}

.wa-chat-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 14px;
}

#wa-chat-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.wa-chat-header {
  flex-shrink: 0;
  padding: 10px 16px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  z-index: 2;
}

.wa-chat-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-chat-user-name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
}

.wa-chat-user-status {
  font-size: 11.5px;
  color: var(--status-normal-text);
  display: flex;
  align-items: center;
  gap: 4px;
}

.wa-messages-canvas {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* WhatsApp Message Bubbles */
.wa-bubble {
  max-width: 68%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}

.wa-bubble.nakes {
  align-self: flex-end;
  background-color: var(--primary-blue);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.wa-bubble.ortu {
  align-self: flex-start;
  background-color: #ffffff;
  color: #1e293b;
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border-default);
}

.wa-bubble-sender {
  font-size: 10.5px;
  font-weight: 700;
  margin-bottom: 2px;
}

.wa-bubble.nakes .wa-bubble-sender {
  color: #bfdbfe;
}

.wa-bubble.ortu .wa-bubble-sender {
  color: var(--primary-blue);
}

.wa-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 10px;
  margin-top: 3px;
  text-align: right;
}

.wa-bubble.nakes .wa-bubble-meta {
  color: rgba(255, 255, 255, 0.75);
}

.wa-bubble.ortu .wa-bubble-meta {
  color: #94a3b8;
}

/* Chat Input Bar */
.wa-chat-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  background-color: #ffffff;
  border-top: 1px solid var(--border-default);
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

.wa-chat-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wa-chat-input {
  flex: 1;
  padding: 9px 14px;
  background-color: #f8fafc;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 12.5px;
  outline: none;
  font-family: inherit;
}

.wa-chat-input:focus {
  background-color: #ffffff;
  border-color: var(--primary-blue);
}

.wa-btn-send {
  background-color: var(--primary-blue);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background-color var(--transition-fast);
}

.wa-btn-send:hover {
  background-color: var(--primary-blue-hover);
}

/* Login Page (Nature Illustration UI Style) */
.login-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.login-page {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #E8F5EE radial-gradient(circle at 50% 25%, #F4FBF7 0%, #DCF2E5 50%, #C8E8D5 100%);
  padding: 24px 16px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.login-page::before, .login-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.login-page::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 70%);
  top: -120px;
  left: 5%;
}

.login-page::after {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 70%);
  bottom: -150px;
  right: 5%;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 375px;
  background: #ffffff;
  border-radius: 26px;
  box-shadow: 0 20px 45px -10px rgba(0, 115, 54, 0.16), 0 8px 20px -4px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.login-card-content {
  padding: 34px 28px 16px;
  box-sizing: border-box;
}

.login-logo {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo .logo-icon-lg {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 4px 16px rgba(0, 115, 54, 0.12);
  padding: 8px;
  overflow: hidden;
  border: 2px solid #e8f5ed;
  box-sizing: border-box;
}

.login-logo .logo-icon-lg img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.login-logo h1 {
  font-size: 23px;
  font-weight: 800;
  color: #1e3a2b;
  letter-spacing: -0.3px;
  margin: 0 0 3px;
}

.login-logo p {
  font-size: 12.5px;
  font-weight: 500;
  color: #64748b;
  margin: 0;
  letter-spacing: 0.1px;
}

.login-error {
  display: none;
  background-color: #FEE2E2;
  color: #B91C1C;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 18px;
  border: 1px solid rgba(220, 38, 38, 0.2);
  text-align: center;
}

.login-error.show {
  display: block;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-sizing: border-box;
}

.input-row {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1.8px solid #E2E8F0;
  padding: 6px 2px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  box-sizing: border-box;
}

.input-row:focus-within {
  border-bottom-color: #007336;
}

.input-icon-left {
  width: 18px;
  height: 18px;
  color: #94A3B8;
  flex-shrink: 0;
  margin-right: 10px;
  transition: color 0.25s ease;
}

.input-row:focus-within .input-icon-left {
  color: #007336;
}

.input-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #1E293B;
  font-family: inherit;
  padding: 6px 0;
  box-sizing: border-box;
}

.input-field::placeholder {
  color: #94A3B8;
  font-size: 13px;
}

.input-icon-right {
  width: 22px;
  height: 22px;
  color: #94A3B8;
  flex-shrink: 0;
  margin-left: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  transition: color 0.2s;
}

.input-icon-right:hover {
  color: #007336;
}

.input-icon-right.valid {
  color: #007336;
  cursor: default;
}

.btn-login-pill {
  width: 100%;
  padding: 13px 20px;
  border-radius: 50px;
  background: linear-gradient(135deg, #008740 0%, #006837 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: none;
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
  box-shadow: 0 8px 20px -2px rgba(0, 115, 54, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
}

.btn-login-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -2px rgba(0, 115, 54, 0.42);
  background: linear-gradient(135deg, #009949 0%, #007336 100%);
}

.btn-login-pill:active {
  transform: translateY(0);
}

.btn-login-pill:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-footer-info {
  text-align: center;
  font-size: 11px;
  color: #94A3B8;
  margin-top: 14px;
  line-height: 1.4;
}

/* Bottom Scenery Artwork */
.login-scenery {
  width: 100%;
  height: 110px;
  margin-top: 6px;
  overflow: hidden;
  line-height: 0;
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
}

.login-scenery svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Responsive */
@media (max-width: 1200px) {
  .metrics-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-middle-grid { grid-template-columns: 1fr; }
  .activity-grid { grid-template-columns: repeat(2, 1fr); }
  .rme-main-grid, .antro-metrics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-dropdown); }
  .main { margin-left: 0; width: 100%; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
  .metrics-summary-grid, .activity-grid { grid-template-columns: 1fr; }
}
