/* --- V2: Sidebar layout, rounded XL, glass topbar, teal+slate palette --- */
:root {
  --surface: #0b1220;
  --paper: #0f172a;
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --brand: #14b8a6;
  --brand-600: #0ea5a3;
  --accent: #38bdf8;
  --card: #0b1220;
  --ring: rgba(20, 184, 166, 0.45);
  --radius: 18px;
  --shadow: 0 12px 30px rgba(2, 6, 23, 0.35);
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial,
    sans-serif;
  color: var(--ink);
  background: radial-gradient(
    1200px 800px at 10% -10%,
    #0b3b42 0%,
    #0b1220 35%,
    #0b1220 100%
  );
}

/* Shell (desktop default) */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-auto-rows: minmax(0, 1fr);
  min-height: 100vh;
}
.aside {
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.9),
    rgba(15, 23, 42, 0.75)
  );
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.35);
}
.brand i {
  color: var(--brand);
  font-size: 20px;
}
.brand strong {
  letter-spacing: 0.2px;
}
.nav {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.15);
  transition: 0.18s ease;
}
.nav a:hover {
  transform: translateX(4px);
  border-color: var(--ring);
  box-shadow: 0 8px 24px rgba(20, 184, 166, 0.15);
}
.nav a i {
  color: var(--brand);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 16px;
  backdrop-filter: blur(8px) saturate(1.2);
  background: linear-gradient(
    90deg,
    rgba(11, 18, 32, 0.65),
    rgba(11, 18, 32, 0.45)
  );
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.topbar .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.userchip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(2, 6, 23, 0.35);
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.14);
}
.only-mobile {
  display: none;
} /* default hidden */

.content {
  padding: 20px 20px 28px;
}
h1,
h2,
h3 {
  margin: 0 0 10px 0;
}

/* Cards & KPI */
.card {
  background: linear-gradient(
    180deg,
    rgba(2, 6, 23, 0.45),
    rgba(2, 6, 23, 0.25)
  );
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card .body {
  padding: 16px 18px;
}
.kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}
.kpi .value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.badge {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.72rem;
}
.badge.ok {
  background: rgba(20, 184, 166, 0.18);
  color: #34d399;
}
.badge.warn {
  background: rgba(250, 204, 21, 0.18);
  color: #facc15;
}
.badge.err {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

/* Menu tiles */
.tiles {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.tile {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  padding: 14px 16px;
  background: radial-gradient(
    600px 300px at 0% 0%,
    rgba(20, 184, 166, 0.12),
    rgba(2, 6, 23, 0.25)
  );
  transition: 0.18s ease;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: var(--ring);
  box-shadow: 0 8px 28px rgba(56, 189, 248, 0.15);
}
.tile i {
  color: var(--accent);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  color: var(--ink);
}
.table thead th {
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 10px;
}
.table tbody tr {
  background: rgba(2, 6, 23, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.14);
}
.table tbody td {
  padding: 10px 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}
.table tbody tr:first-child td {
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}
.table tbody tr:last-child td {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}
.table-scroll {
  overflow: auto;
  width: 100%;
} /* wrapper untuk tabel di mobile */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.25);
  color: var(--ink);
  text-decoration: none;
}
.btn.brand {
  border-color: var(--ring);
  background: rgba(20, 184, 166, 0.18);
}

/* Backdrop untuk sidebar di mobile */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 15;
}

/* === Responsiveness === */
@media (max-width: 992px) {
  .app {
    grid-template-columns: 1fr;
  }
  .aside {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  }
  .aside.open {
    transform: translateX(0);
  }
  .only-mobile {
    display: inline-flex;
  } /* tampilkan tombol hamburger */
  .content {
    padding: 16px 14px 22px;
  }
  .tiles {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .tiles {
    grid-template-columns: 1fr;
  }
  .kpi {
    grid-template-columns: 1fr 1fr;
  }
}
body.offcanvas-open .backdrop {
  opacity: 1;
  pointer-events: auto;
}
/* ===== Compact form & table ===== */
.input.sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
}
.btn.sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
}
.btn.icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.form-compact {
  gap: 8px;
}
.form-compact label {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
  display: block;
}

/* table density */
.table.compact th,
.table.compact td {
  font-size: 13px;
  padding: 6px 8px;
  line-height: 1.25;
}
.table.compact .cell-xs {
  width: 64px;
  white-space: nowrap;
  text-align: center;
}
.table.compact .cell-sm {
  width: 96px;
  white-space: nowrap;
}
.table.compact .cell-qr {
  width: 72px;
  text-align: center;
}
.table.compact .cell-aksi {
  width: 120px;
  white-space: nowrap;
  text-align: center;
}
.table.sticky thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* QR kecil */
.qr-mini img,
.qr-mini canvas {
  width: 48px !important;
  height: 48px !important;
}

/* heading spacing */
.page-title {
  margin: 4px 0 10px;
}

/* mobile tweaks */
@media (max-width: 480px) {
  .input.sm,
  .btn.sm {
    font-size: 12px;
    padding: 6px 8px;
  }
  .table.compact th,
  .table.compact td {
    font-size: 12px;
    padding: 6px;
  }
  .qr-mini img,
  .qr-mini canvas {
    width: 42px !important;
    height: 42px !important;
  }
}
