:root {
  --bg: #eef7f5;
  --surface: #ffffff;
  --surface-soft: #f6fbfa;
  --text: #10201e;
  --muted: #64748b;
  --line: #dbe7e4;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #ccfbf1;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warning: #a16207;
  --shadow: 0 24px 70px rgba(15, 118, 110, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* MENGUNCI LAYAR AGAR TIDAK BOCOR KE KANAN DI HP */
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.18), transparent 34rem),
    linear-gradient(135deg, #eef7f5 0%, #f8fafc 52%, #eef7f5 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden; 
  max-width: 100vw;
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px;
  background: #0b2421;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #14b8a6, #facc15);
  color: #07231f;
  font-weight: 900;
  font-size: 28px;
  box-shadow: 0 18px 34px rgba(20, 184, 166, 0.35);
}

.brand h1, .topbar h2, .card h3, .card h4 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #0f766e;
  font-weight: 800;
}

.sidebar .eyebrow,
.sidebar .muted {
  color: rgba(255, 255, 255, 0.72);
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-btn {
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.84);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: left;
  transition: 0.2s ease;
}

.nav-btn:hover,
.nav-btn.active {
  color: #07302b;
  background: #ccfbf1;
  transform: translateX(4px);
}

.sidebar-note {
  margin-top: auto;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.10);
  display: grid;
  gap: 8px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
}

.main {
  padding: 30px;
  min-width: 0;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.topbar h2 {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.15;
}

.top-actions, .row-actions, .form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 118, 110, 0.10);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  min-width: 0; /* SUPER PENTING: Mencegah card melar karena tabel */
  width: 100%;
}

.mt { margin-top: 20px; }
.mb-2 { margin-bottom: 16px; }

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.form {
  display: grid;
  gap: 16px;
}

.form.compact {
  margin-top: 22px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
  transition: 0.18s ease;
}

textarea {
  resize: vertical;
  line-height: 1.65;
}

input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.16);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.ghost {
  background: #ffffff;
  color: var(--primary-dark);
  border: 1px solid var(--line);
}

.btn.soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.neutral {
  background: #eef2ff;
  color: #3730a3;
}

.alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(15, 118, 110, 0.08);
}

.alert.success {
  border-color: rgba(15, 118, 110, 0.25);
  background: #ecfdf5;
}

.alert.error {
  border-color: rgba(185, 28, 28, 0.25);
  background: #fef2f2;
}

.hidden {
  display: none !important;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 24px 0;
}

.large-textarea {
  min-height: 230px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.qr-panel {
  display: grid;
  place-items: center;
  min-height: 250px;
  text-align: center;
}

.qr-panel canvas, .qr-panel img {
  width: 220px !important;
  height: 220px !important;
  background: white;
  padding: 10px;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.12);
}

/* WADAH TABEL: Ini yang membuat tabel bisa di-scroll internal di HP */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 550px; /* Ukuran ini pas agar tidak terlalu lebar tapi tetap terbaca */
}

th, td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ========================================================
   HAMBURGER MENU & TAMPILAN MOBILE (HP)
   ======================================================== */
.hamburger-btn {
  display: none;
  background: rgba(15, 118, 110, 0.1);
  border: 1px solid rgba(15, 118, 110, 0.2);
  color: var(--primary);
  font-size: 22px;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
}

.hamburger-btn:hover {
  background: rgba(15, 118, 110, 0.25);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  
  /* Tampilkan Tombol Hamburger */
  .hamburger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Sidebar Menjadi Laci Geser Kiri */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .nav {
    grid-template-columns: 1fr;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
  
  .topbar {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .section-title {
    flex-direction: column;
  }

  .main {
    padding: 16px;
    width: 100vw;
  }
  
  .card {
    padding: 16px; /* Mengecilkan ruang kosong kotak di layar HP */
  }
}

/* ========================================================
   MODE CETAK (PRINT KERTAS)
   ======================================================== */
@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .nav,
  .btn,
  .alert,
  .hamburger-btn,
  .sidebar-overlay {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 0;
    padding: 0;
  }
}