/* =========================================
   PORTAL AKREDITASI MRMIK — RSUD dr. Fauziah
   style.css
   ========================================= */

:root {
  --primary: #1a5fa8;
  --primary-dark: #134a85;
  --primary-light: #e8f1fb;
  --secondary: #0d9488;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --sidebar-width: 260px;
  --topbar-height: 70px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-700);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.05);
}

.rs-logo { font-size: 28px; }
.rs-name { font-weight: 700; font-size: 13px; line-height: 1.3; color: #fff; }
.rs-sub { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 2px; }

.sidebar-nav { padding: 12px 8px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .2s;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }

.survey-countdown {
  background: rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.countdown-label { font-size: 11px; color: rgba(255,255,255,.5); margin-bottom: 4px; }
.countdown-value { font-size: 22px; font-weight: 800; color: #fbbf24; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0;
}

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle {
  background: none; border: none; font-size: 20px;
  cursor: pointer; padding: 4px; display: none;
}
.page-title { font-size: 18px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.page-sub { font-size: 12px; color: var(--gray-500); }

/* ===== ALERT BANNER ===== */
.alert-banner {
  background: var(--warning-light);
  border-left: 4px solid var(--warning);
  margin: 16px 24px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.alert-banner a { color: var(--primary); font-weight: 600; }
.alert-banner button { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 16px; color: var(--gray-500); }
.alert-icon { font-size: 18px; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { font-size: 30px; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 3px; }

.stat-blue .stat-value { color: var(--primary); }
.stat-green .stat-value { color: var(--success); }
.stat-yellow .stat-value { color: var(--warning); }
.stat-red .stat-value { color: var(--danger); }

/* ===== CARDS ===== */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 0 24px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap { margin-bottom: 12px; }
.progress-bar-bg {
  background: var(--gray-200);
  border-radius: 99px;
  height: 14px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #22c55e);
  border-radius: 99px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.progress-legend { display: flex; gap: 16px; font-size: 12px; color: var(--gray-500); }
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-green { color: var(--success); }
.legend-yellow { color: var(--warning); }
.legend-red { color: var(--danger); }
.target-note { font-size: 12px; color: var(--gray-500); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--gray-100); }

/* ===== STANDAR LIST ===== */
.standar-progress-list { display: flex; flex-direction: column; gap: 10px; }

.standar-row {
  display: grid;
  grid-template-columns: 120px 1fr 80px 60px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
}
.standar-row:hover { background: var(--primary-light); border-color: var(--primary); }
.standar-code { font-weight: 700; font-size: 13px; color: var(--primary); }
.standar-name { font-size: 13px; color: var(--gray-700); }
.standar-mini-bar { height: 8px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.standar-mini-fill { height: 100%; background: var(--success); border-radius: 99px; transition: width .5s; }
.standar-pct { font-size: 13px; font-weight: 600; text-align: right; }

/* ===== RDOWS GRID ===== */
.rdows-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }

.rdows-card {
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  border: 2px solid transparent;
}
.rdows-r { background: #eff6ff; border-color: #93c5fd; }
.rdows-d { background: #f0fdf4; border-color: #86efac; }
.rdows-o { background: #fffbeb; border-color: #fcd34d; }
.rdows-w { background: #fdf4ff; border-color: #d8b4fe; }
.rdows-s { background: #fff1f2; border-color: #fca5a5; }

.rdows-letter {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}
.rdows-r .rdows-letter { color: #1d4ed8; }
.rdows-d .rdows-letter { color: #15803d; }
.rdows-o .rdows-letter { color: #92400e; }
.rdows-w .rdows-letter { color: #7c3aed; }
.rdows-s .rdows-letter { color: #be123c; }

.rdows-name { font-size: 12px; font-weight: 700; color: var(--gray-900); }
.rdows-desc { font-size: 11px; color: var(--gray-500); margin-top: 2px; margin-bottom: 8px; }
.rdows-count { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.rdows-bar-bg { height: 6px; background: rgba(0,0,0,.1); border-radius: 99px; overflow: hidden; }
.rdows-bar-fill { height: 100%; background: currentColor; border-radius: 99px; transition: width .5s; }
.rdows-r .rdows-bar-fill { background: #1d4ed8; }
.rdows-d .rdows-bar-fill { background: #15803d; }
.rdows-o .rdows-bar-fill { background: #92400e; }
.rdows-w .rdows-bar-fill { background: #7c3aed; }
.rdows-s .rdows-bar-fill { background: #be123c; }

/* ===== QUICK LINKS ===== */
.quick-links-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; padding: 0 24px 24px; }

.quick-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  transition: all .25s;
  display: block;
}
.quick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.quick-icon { font-size: 28px; margin-bottom: 10px; }
.quick-title { font-size: 14px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.quick-desc { font-size: 12px; color: var(--gray-500); line-height: 1.5; }

/* ===== CHECKLIST PAGE ===== */
.checklist-wrap { padding: 20px 24px; }

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-btn {
  padding: 7px 16px;
  border-radius: 99px;
  border: 1px solid var(--gray-300);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  color: var(--gray-700);
}
.filter-btn:hover, .filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.accordion-group { display: flex; flex-direction: column; gap: 12px; }

.accordion-item {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.accordion-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background .2s;
}
.accordion-header:hover { background: var(--gray-50); }
.accordion-header.open { background: var(--primary-light); border-bottom: 1px solid var(--gray-200); }

.acc-code {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  letter-spacing: .04em;
}
.acc-title { flex: 1; font-size: 14px; font-weight: 600; color: var(--gray-900); }
.acc-ep-badge { font-size: 11px; color: var(--gray-500); white-space: nowrap; }
.acc-status-badge { white-space: nowrap; }
.acc-pct { font-size: 13px; font-weight: 700; margin-left: 8px; }
.acc-chevron { font-size: 12px; color: var(--gray-500); transition: transform .2s; }
.acc-chevron.open { transform: rotate(180deg); }

.accordion-body { display: none; padding: 20px; }
.accordion-body.open { display: block; }

.standar-desc {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--gray-700);
  margin-bottom: 16px;
  line-height: 1.6;
}

.ep-list { display: flex; flex-direction: column; gap: 14px; }

.ep-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ep-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--gray-50);
}
.ep-code { font-size: 11px; font-weight: 700; color: var(--primary); white-space: nowrap; min-width: 60px; margin-top: 2px; }
.ep-text { flex: 1; font-size: 13px; color: var(--gray-700); line-height: 1.5; }
.ep-status-select {
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  min-width: 130px;
}
.ep-status-select.status-selesai { background: var(--success-light); color: var(--success); border-color: var(--success); }
.ep-status-select.status-proses { background: var(--warning-light); color: var(--warning); border-color: var(--warning); }
.ep-status-select.status-belum { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

.rdows-table-wrap { overflow-x: auto; }

.rdows-checklist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.rdows-checklist-table th {
  background: var(--gray-100);
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.rdows-checklist-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: top;
}
.rdows-checklist-table tr:last-child td { border-bottom: none; }
.rdows-checklist-table tr:hover td { background: var(--gray-50); }

.rdows-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}
.rdows-type-R { background: #dbeafe; color: #1d4ed8; }
.rdows-type-D { background: #dcfce7; color: #15803d; }
.rdows-type-O { background: #fef3c7; color: #92400e; }
.rdows-type-W { background: #f3e8ff; color: #7c3aed; }
.rdows-type-S { background: #ffe4e6; color: #be123c; }

.doc-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
}
.doc-check input[type=checkbox] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--primary); }
.doc-check.checked label { text-decoration: line-through; color: var(--gray-500); }

.ep-notes {
  padding: 8px 14px 12px;
}
.ep-notes textarea {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  color: var(--gray-700);
}
.ep-notes textarea:focus { outline: none; border-color: var(--primary); }
.ep-notes label { font-size: 11px; font-weight: 600; color: var(--gray-500); display: block; margin-bottom: 4px; }

/* ===== DOKUMEN PAGE ===== */
.doc-page-wrap { padding: 20px 24px; }
.doc-category { margin-bottom: 24px; }
.doc-category-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-table th {
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  letter-spacing: .04em;
}
.doc-table td { padding: 10px 14px; border-bottom: 1px solid var(--gray-200); vertical-align: top; }
.doc-table tr:hover td { background: var(--primary-light); }
.doc-table tr:last-child td { border-bottom: none; }
.doc-table .check-col { width: 40px; text-align: center; }
.doc-table input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.doc-checked td { background: var(--success-light) !important; }
.doc-checked td:first-child { position: relative; }

/* ===== REGULASI PAGE ===== */
.reg-page-wrap { padding: 20px 24px; }
.reg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.reg-table th { background: var(--gray-900); color: #fff; padding: 12px 16px; text-align: left; font-size: 12px; }
.reg-table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-200); vertical-align: top; line-height: 1.5; }
.reg-table tr:nth-child(even) td { background: var(--gray-50); }
.reg-table tr:hover td { background: var(--primary-light); }
.reg-no { font-weight: 700; color: var(--primary); }
.reg-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 4px;
}
.tag-uu { background: #fce7f3; color: #be185d; }
.tag-permenkes { background: #dcfce7; color: #15803d; }
.tag-kmk { background: #dbeafe; color: #1d4ed8; }
.tag-kepdirjen { background: #f3e8ff; color: #7c3aed; }
.tag-pp { background: #fef3c7; color: #92400e; }
.mrmik-ref { font-size: 11px; color: var(--primary); font-weight: 600; }

/* ===== LAPORAN PAGE ===== */
.laporan-wrap { padding: 20px 24px; }
.laporan-summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 20px; }
.laporan-card { background: #fff; border-radius: var(--radius); padding: 20px; border: 1px solid var(--gray-200); }
.laporan-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--gray-900); }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.btn-secondary:hover { background: var(--gray-100); }

.btn-success {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-success:hover { opacity: .9; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 460px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.modal-header button { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gray-500); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--gray-200); display: flex; gap: 8px; justify-content: flex-end; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-input {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--primary); }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 6px; }

/* ===== PRINT ===== */
@media print {
  .sidebar, .topbar, .filter-bar, .btn-primary, .btn-secondary, .btn-success { display: none !important; }
  .main-content { margin-left: 0; }
  .card, .accordion-item { break-inside: avoid; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .rdows-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-links-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .rdows-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-links-grid { grid-template-columns: 1fr; }
  .standar-row { grid-template-columns: 100px 1fr 60px; }
  .laporan-summary-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .card, .checklist-wrap, .doc-page-wrap, .reg-page-wrap, .laporan-wrap { margin-left: 16px; margin-right: 16px; padding-left: 16px; padding-right: 16px; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 40px; color: var(--gray-500); }
.empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ===== UTILS ===== */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--gray-500); }
.fw-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
