/* ============================================
   ERM Praktek Dokter — Tema Profesional
   ============================================ */
:root {
  --primary: #0e7490;
  --primary-dark: #155e75;
  --primary-light: #22b8d4;
  --accent: #10b981;
  --sidebar-bg: #0b2437;
  --sidebar-bg2: #10344e;
  --bg: #eef2f6;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-soft: #64748b;
  --danger: #e11d48;
  --warning: #d97706;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 42, 66, .06), 0 4px 12px rgba(15, 42, 66, .06);
  --shadow-lg: 0 8px 24px rgba(15, 42, 66, .12);
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.layout { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 236px;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}
.brand {
  padding: 22px 20px 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--primary-light));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: bold; color: #fff;
  flex-shrink: 0;
}
.brand span:last-child { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: #7d97ad; padding: 10px 12px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  color: #b8c9d8;
  text-decoration: none;
  border-radius: 9px;
  margin-bottom: 3px;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active {
  background: linear-gradient(90deg, rgba(34,184,212,.22), rgba(16,185,129,.12));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary-light);
}
.nav a .ico { width: 18px; text-align: center; }
.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #b8c9d8;
}
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,.3); color: #dfe9f2; }
.btn-outline:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.5); }

/* ---------- Konten & Topbar ---------- */
.content { flex: 1; padding: 0 28px 32px; max-width: 1180px; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0;
  margin-bottom: 8px;
}
.topbar .page-date {
  font-size: 13px; color: var(--text-soft);
  display: flex; align-items: center; gap: 6px;
}
.user-chip {
  display: flex; align-items: center; gap: 9px;
  background: var(--card); border: 1px solid var(--border);
  padding: 6px 12px 6px 6px; border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13px;
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-chip small { color: var(--text-soft); }

h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 4px; }
h2 { font-size: 15.5px; font-weight: 650; margin: 0 0 12px; color: var(--text); }
.page-sub { color: var(--text-soft); font-size: 13px; margin-bottom: 18px; }

/* ---------- Komponen ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  transition: transform .1s, box-shadow .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); box-shadow: 0 4px 10px rgba(14,116,144,.3); }
.btn:active { transform: translateY(1px); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); }
.btn-success:hover { background: linear-gradient(135deg, #059669, #047857); box-shadow: 0 4px 10px rgba(16,185,129,.3); }
.btn-warning { background: linear-gradient(135deg, #fbbf24, #d97706); color: #451a03; }
.btn-warning:hover { background: linear-gradient(135deg, #d97706, #b45309); color:#fff; }
.btn-danger { background: linear-gradient(135deg, #fb7185, #e11d48); }
.btn-danger:hover { background: linear-gradient(135deg, #e11d48, #be123c); box-shadow: 0 4px 10px rgba(225,29,72,.3); }
.btn-outline { background: transparent; border: 1px solid #cbd5e1; color: #475569; }
.btn-outline:hover { background: #f1f5f9; box-shadow: none; border-color: #94a3b8; color: #1e293b; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--primary-dark); margin-bottom: 14px;
}
.card h2::before {
  content: ""; width: 4px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, var(--primary-light), var(--accent));
}

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: linear-gradient(180deg, var(--primary-light), var(--accent));
}
.stat .num { font-size: 26px; font-weight: 750; color: var(--primary-dark); letter-spacing: -.02em; }
.stat .lbl { color: var(--text-soft); font-size: 12.5px; margin-top: 2px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13.5px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  background: #f8fafc;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-soft); font-weight: 650;
  white-space: nowrap;
}
tbody tr:hover td { background: #f0f9ff; }
tbody tr:last-child td { border-bottom: none; }

/* Card berisi tabel: rapat & bisa di-scroll di layar kecil */
.card:has(> table) { padding: 0; overflow-x: auto; }
.card:has(> table) table { min-width: 640px; }

label { display: block; margin: 12px 0 5px; font-weight: 600; font-size: 12.5px; color: #334155; }
input[type=text], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(34,184,212,.18);
}
textarea { min-height: 74px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
}
.badge-menunggu { background: #fef3c7; color: #92400e; }
.badge-diperiksa { background: #e0f2fe; color: #075985; }
.badge-selesai { background: #d1fae5; color: #065f46; }
.badge-batal { background: #ffe4e6; color: #9f1239; }
.badge-belum { background: #fef3c7; color: #92400e; }
.badge-lunas { background: #d1fae5; color: #065f46; }
.badge-siap { background: #e0e7ff; color: #3730a3; }
.badge-mock_terkirim { background: #d1fae5; color: #065f46; }
.badge-terkirim { background: #065f46; color: #fff; }
.badge-gagal { background: #ffe4e6; color: #9f1239; }

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid transparent;
  animation: slideDown .25s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.alert .close-x { background: none; border: none; font-size: 16px; cursor: pointer; color: inherit; opacity: .6; line-height: 1; }
.alert .close-x:hover { opacity: 1; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.search-box { display: flex; gap: 8px; }
.search-box input, .search-box select { width: auto; }

.empty { text-align: center; color: var(--text-soft); padding: 34px 20px; }
.small { font-size: 12px; color: var(--text-soft); }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0b2437 0%, #0e7490 100%);
}
.login-hero {
  flex: 1;
  color: #fff;
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
}
.login-hero h1 { font-size: 30px; margin-bottom: 14px; }
.login-hero p { color: #bae6fd; font-size: 15px; max-width: 420px; }
.login-hero .features { margin-top: 30px; display: grid; gap: 12px; }
.login-hero .features div { display: flex; gap: 10px; align-items: center; font-size: 14px; color: #e0f2fe; }
.login-panel {
  width: 100%;
  max-width: 440px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.login-panel h1 { font-size: 22px; }
.login-panel .logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
@media (min-width: 900px) {
  .login-hero { display: flex; }
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { width: 60px; }
  .brand span:last-child, .sidebar-foot div { display: none; }
  .nav a { font-size: 0; justify-content: center; padding: 11px; }
  .nav a .ico { font-size: 16px; }
  .nav-label { display: none; }
  .sidebar-foot { justify-content: center; padding: 10px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .content { padding: 0 14px 24px; }
}
@media print {
  .sidebar, .topbar, .toolbar, .btn, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
}
