/* ===== SIODGJ - Sistem Informasi ODGJ Terintegrasi ===== */

:root {
  --primary: #0f4c81;
  --primary-light: #1a6db5;
  --accent: #00b4d8;
  --accent2: #f77f00;
  --success: #2ec4b6;
  --danger: #e63946;
  --warning: #f4a261;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1a2332;
  --text-muted: #6b7a8d;
  --border: #dde4ed;
  --sidebar-w: 260px;
  --header-h: 64px;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(15, 76, 129, 0.1);
  --shadow-lg: 0 8px 40px rgba(15, 76, 129, 0.16);
}

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

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SPLASH / ONBOARDING ===== */
#splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(145deg, #0B2D4E 0%, #0d3b5e 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s, transform 0.5s;
  overflow: hidden;
}
#splash::before {
  content: ''; position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,137,123,0.25) 0%, transparent 70%);
  top: -80px; right: -80px;
}
#splash::after {
  content: ''; position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249,168,37,0.12) 0%, transparent 70%);
  bottom: 60px; left: -60px;
}
#splash.hide {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}
.splash-appname {
  font-family: "Playfair Display", serif;
  font-size: 32px; font-weight: 900; 
  color: #fff; text-align: center;
  margin-top: 16px;
}
.splash-appname .si { color: #26A69A; }
.splash-appname .jaga { color: #fff; }
.splash-appname .jiwa { color: #F9A825; }

.splash-sub {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-top: 8px; text-align: center;
}
.splash-by {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; margin-top: 6px; opacity: 0.5; color: #fff;
}

.splash-pulse {
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  margin-top: 40px;
  overflow: hidden;
}
.splash-pulse::after {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: #26A69A;
  border-radius: 4px;
  animation: pulse-bar 1.8s ease-in-out infinite;
}
@keyframes pulse-bar {
  0% { transform: translateX(-150%); }
  100% { transform: translateX(350%); }
}

/* ===== WALKTHROUGH ===== */
#walkthrough {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 76, 129, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.4s;
}
#walkthrough.hide {
  display: none;
}
.wt-card {
  background: #fff;
  border-radius: 24px;
  max-width: 480px;
  width: 100%;
  padding: 40px 36px 32px;
  text-align: center;
  animation: wt-in 0.4s ease;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}
@keyframes wt-in {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.wt-icon {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
}
.wt-title {
  font-family: "DM Serif Display", serif;
  font-size: 26px;
  color: var(--primary);
  margin-bottom: 12px;
}
.wt-desc {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 15px;
}
.wt-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 24px 0;
}
.wt-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  transition: all 0.3s;
}
.wt-dot.active {
  background: var(--primary);
  width: 24px;
}
.wt-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 12px 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15, 76, 129, 0.3);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg);
}
.btn-accent {
  background: var(--accent2);
  color: #fff;
}
.btn-accent:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  opacity: 0.9;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ===== ROLE SELECT ===== */
#role-select {
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: linear-gradient(135deg, #0f4c81 0%, #1a6db5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#role-select.hide {
  display: none;
}
.role-card {
  background: #fff;
  border-radius: 24px;
  max-width: 520px;
  width: 100%;
  padding: 40px 32px;
}
.role-title {
  font-family: "DM Serif Display", serif;
  font-size: 28px;
  color: var(--primary);
  margin-bottom: 8px;
}
.role-sub {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 14px;
}
.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.role-btn {
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 24px 16px;
  cursor: pointer;
  background: #fff;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}
.role-btn:hover,
.role-btn.selected {
  border-color: var(--primary);
  background: #f0f7ff;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(15, 76, 129, 0.1);
}
.role-icon-svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.role-icon-svg svg {
  width: 100%;
  height: 100%;
}
.role-btn .role-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 12px;
}
.role-btn .role-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.role-btn .role-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.3;
}

/* ===== AUTH PAGE ===== */
#auth-page {
  position: fixed;
  inset: 0;
  z-index: 9996;
  background: linear-gradient(135deg, #0f4c81 0%, #1a6db5 100%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
#auth-page.show {
  display: flex;
}

.auth-card {
  background: #fff;
  border-radius: 24px;
  max-width: 520px;
  width: 100%;
  padding: 36px 32px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  animation: wt-in 0.4s ease;
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-header .auth-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}
.auth-header .auth-title {
  font-family: "DM Serif Display", serif;
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 4px;
}
.auth-header .auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s;
  border: none;
  background: transparent;
  font-family: inherit;
}
.auth-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 76, 129, 0.3);
}

.auth-form {
  display: none;
}
.auth-form.active {
  display: block;
}

.auth-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 16px;
  background: none;
  border: none;
  font-family: inherit;
}
.auth-back:hover {
  text-decoration: underline;
}

.auth-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin: 16px 0;
  position: relative;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before {
  left: 0;
}
.auth-divider::after {
  right: 0;
}

.password-wrapper {
  position: relative;
}
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

/* ===== LAYOUT ===== */
#app {
  display: none;
  min-height: 100vh;
}
#app.show {
  display: flex;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar.closed {
  transform: translateX(-260px);
}
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-family: "DM Serif Display", serif;
  font-size: 22px;
  color: #fff;
}
.sidebar-logo span {
  display: block;
  font-size: 11px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}
.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info .name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.user-info .role-tag {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.nav-section {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 8px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.nav-item.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
}
.nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}
.topbar {
  height: var(--header-h);
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  position: relative;
}
.icon-btn:hover {
  background: var(--border);
}
.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}
.hamburger {
  display: flex;
}

.chat-modal-body {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}
.chat-modal-sidebar {
  width: 280px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.page-content {
  padding: 28px;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  cursor: pointer;
  border-top: 3px solid transparent;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.stat-card.blue {
  border-top-color: var(--primary);
}
.stat-card.cyan {
  border-top-color: var(--accent);
}
.stat-card.orange {
  border-top-color: var(--accent2);
}
.stat-card.green {
  border-top-color: var(--success);
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin: 8px 0 4px;
  line-height: 1;
}
.stat-change {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}
.stat-icon {
  font-size: 28px;
  float: right;
  margin-top: -40px;
  opacity: 0.8;
}

/* ===== SECTION CARDS ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.section-action {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ===== PATIENT TABLE ===== */
.patient-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.patient-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1.5px solid transparent;
}
.patient-item:hover {
  background: #e8f0f8;
  border-color: var(--primary);
}
.p-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.p-info {
  flex: 1;
}
.p-name {
  font-size: 14px;
  font-weight: 700;
}
.p-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.p-status {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
}
.status-stable {
  background: #d1fae5;
  color: #065f46;
}
.status-monitor {
  background: #fef3c7;
  color: #92400e;
}
.status-critical {
  background: #fee2e2;
  color: #991b1b;
}

/* ===== PMO TABLE ===== */
.pmo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.pmo-item:last-child {
  border: none;
}
.pmo-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: #e0eef8;
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.pmo-drug {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}
.pmo-patient {
  font-size: 11px;
  color: var(--text-muted);
}
.check-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}
.check-btn.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.check-btn:hover {
  border-color: var(--success);
}

/* ===== CHAT ===== */
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
}
.chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-msg.mine {
  flex-direction: row-reverse;
}
.chat-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.chat-msg:not(.mine) .chat-bubble {
  background: var(--bg);
  border-bottom-left-radius: 4px;
}
.chat-msg.mine .chat-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-time {
  font-size: 10px;
  color: var(--text-muted);
}
.chat-input-area {
  display: flex;
  gap: 10px;
}
.chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.chat-input:focus {
  border-color: var(--primary);
}
.send-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  width: 42px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}
.send-btn:hover {
  background: var(--primary-light);
}

/* ===== NOTIFICATION ===== */
.notif-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.notif-item:hover {
  background: var(--bg);
}
.notif-item.unread {
  background: #f0f7ff;
  border-color: #d0e4f7;
}
.notif-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.notif-icon.blue {
  background: #dbeafe;
}
.notif-icon.orange {
  background: #fef3c7;
}
.notif-icon.red {
  background: #fee2e2;
}
.notif-icon.green {
  background: #d1fae5;
}
.notif-text {
  flex: 1;
}
.notif-title {
  font-size: 13px;
  font-weight: 700;
}
.notif-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
}
.form-textarea {
  resize: vertical;
  min-height: 80px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}
.form-error.show {
  display: block;
}
.form-input.error,
.form-select.error {
  border-color: var(--danger);
}

/* ===== REAL TIME INDICATOR ===== */
.realtime-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  margin-right: 6px;
  animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ===== ALERT STOCK ===== */
.stock-alert {
  background: linear-gradient(135deg, #f77f00, #fcbf49);
  border-radius: 14px;
  padding: 16px 20px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.stock-alert .alert-icon {
  font-size: 28px;
}
.stock-alert .alert-text {
  flex: 1;
}
.stock-alert .alert-title {
  font-size: 14px;
  font-weight: 700;
}
.stock-alert .alert-sub {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}
.stock-alert .alert-action {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.stock-alert .alert-action:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ===== SCHEDULE ===== */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.day-cell {
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.day-cell:hover {
  background: var(--bg);
}
.day-cell.today {
  background: var(--primary);
  color: #fff;
}
.day-cell .day-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.day-cell.today .day-name {
  color: rgba(255, 255, 255, 0.7);
}
.day-cell .day-num {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}
.day-cell .day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin: 4px auto 0;
}

/* ===== PICKUP SCHEDULE ===== */
.pickup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 8px;
}
.pickup-icon {
  font-size: 22px;
}
.pickup-info {
  flex: 1;
}
.pickup-name {
  font-size: 13px;
  font-weight: 700;
}
.pickup-addr {
  font-size: 11px;
  color: var(--text-muted);
}
.pickup-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}
.pickup-status-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.chip-scheduled {
  background: #dbeafe;
  color: var(--primary);
}
.chip-done {
  background: #d1fae5;
  color: #065f46;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.8s ease;
}

/* ===== CHART (Pure CSS) ===== */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 0 4px;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--accent) 0%, var(--primary) 100%);
  border-radius: 6px 6px 0 0;
  transition: height 0.8s ease;
  min-height: 4px;
}
.bar-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ===== MOBILE ===== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}
.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s;
  min-width: 60px;
}
.mobile-nav-item.active .m-icon {
  color: var(--primary);
}
.mobile-nav-item.active .m-label {
  color: var(--primary);
  font-weight: 700;
}
.m-icon {
  font-size: 22px;
  color: var(--text-muted);
}
.m-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: 20px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}
.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
}
.modal-close {
  background: var(--bg);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-body {
  padding: 20px 24px 24px;
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  animation: toast-in 0.3s ease;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.toast.success {
  background: var(--success);
}
.toast.warning {
  background: var(--warning);
}
.toast.error {
  background: var(--danger);
}
@keyframes toast-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== PAGES ===== */
.page {
  display: none;
}
.page.active {
  display: block;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}
.sidebar-overlay.show {
  display: block;
}

/* report page */
.report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.report-row:last-child {
  border: none;
}
.report-label {
  font-size: 14px;
  font-weight: 600;
}
.report-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

/* realtime banner */
.rt-banner {
  background: linear-gradient(135deg, var(--success) 0%, #0ab3a8 100%);
  border-radius: 14px;
  padding: 14px 20px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.rt-banner .rt-txt {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}
.rt-banner .rt-time {
  font-size: 18px;
  font-weight: 800;
}

/* inline detail page */
.detail-hero {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius);
  padding: 28px;
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
}
.detail-hero .dh-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  margin: 0 auto 12px;
}
.detail-hero .dh-name {
  font-size: 20px;
  font-weight: 700;
}
.detail-hero .dh-meta {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 4px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 16px;
}
.back-btn:hover {
  text-decoration: underline;
}

/* ===== PROFILE TABS ===== */
.profile-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.profile-header-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  color: #fff;
  box-shadow: var(--shadow);
}
.ph-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  border: 2px solid rgba(255,255,255,0.4);
}
.ph-info {
  flex: 1;
}
.ph-name {
  font-family: "DM Serif Display", serif;
  font-size: 28px;
  margin-bottom: 4px;
}
.ph-role {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.profile-tabs {
  display: flex;
  gap: 12px;
  background: var(--bg);
  padding: 8px;
  border-radius: 12px;
  overflow-x: auto;
}
.ptab-btn {
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
  white-space: nowrap;
}
.ptab-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.ptab-btn:not(.active):hover {
  color: var(--text);
  background: rgba(255,255,255,0.5);
}

.ptab-content {
  display: none;
  animation: fade-in 0.3s ease;
}
.ptab-content.active {
  display: block;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border);
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: var(--success);
}
input:checked + .slider:before {
  transform: translateX(20px);
}
.slider.round {
  border-radius: 24px;
}
.slider.round:before {
  border-radius: 50%;
}

/* Table responsive for Stok Obat */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
  }
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .hamburger {
    display: flex;
  }
  .main-content {
    margin-left: 0;
    padding-bottom: 72px;
  }
  .mobile-nav {
    display: block;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
  .page-content {
    padding: 16px;
  }
  .topbar {
    padding: 0 16px;
  }
  .role-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .profile-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    padding: 4px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    background: #f0f4f8;
    border-radius: 12px;
  }
  .profile-tabs::-webkit-scrollbar {
    display: none;
  }
  .ptab-btn {
    flex: none;
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
  }
  .ptab-btn.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .chat-modal-body {
    flex-direction: column;
  }
  #chat-modal-box {
    height: 98vh !important;
    max-height: 98vh !important;
    width: 100% !important;
    margin: 0;
    border-radius: 0;
    background: #fff;
  }
  .chat-modal-body {
    flex-direction: column !important;
    height: calc(100% - 60px); /* Adjust based on header height */
  }
  .chat-modal-sidebar {
    width: 100% !important;
    height: 60px !important;
    max-height: 60px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
  }
  .chat-modal-sidebar .section-title {
    display: none; /* Hide 'Percakapan' title on mobile to save space */
  }
  .chat-modal-sidebar > div:first-child {
    padding: 0 !important;
    border-bottom: none !important;
  }
  .contact-list-container {
    display: flex !important;
    flex-direction: row !important;
    padding: 8px !important;
    gap: 8px;
    height: 100%;
    align-items: center;
  }
  .contact-list-container .patient-item {
    flex: 0 0 160px !important;
    margin-bottom: 0 !important;
    padding: 6px 10px !important;
    font-size: 11px;
    border: 1px solid var(--border);
    white-space: nowrap;
  }
  .chat-modal-main {
    height: calc(100% - 60px); /* Remaining space */
    display: flex;
    flex-direction: column;
  }
  .chat-input-area {
    padding: 10px !important;
    background: #fff;
    border-top: 1px solid var(--border);
  }

  .mobile-card-table, .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td {
    display: block;
    width: 100%;
  }
  .mobile-card-table thead {
    display: none;
  }
  .mobile-card-table tr {
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
  }
  .mobile-card-table td {
    text-align: right !important;
    padding: 8px 12px !important;
    position: relative;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .mobile-card-table td:last-child {
    border-bottom: none;
  }
  .mobile-card-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-align: left;
  }
}
@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
