:root {
  /* ===== Token Warna - terinspirasi wajan panas & api kompor warung ===== */
  --arang: #1c1815;
  --arang-soft: #2a2420;
  --api: #e8540c;
  --api-dark: #c2430a;
  --kuning-telur: #f4a623;
  --krem: #fff8ec;
  --krem-soft: #fff1da;
  --putih: #ffffff;
  --daun: #3d7a4d;
  --daun-soft: #e8f3ea;
  --merah: #d8342a;
  --merah-soft: #fbe8e6;
  --abu: #8a8078;
  --abu-line: #e8e0d4;
  --teks: #2a2420;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 2px 10px rgba(28, 24, 21, 0.08);
  --shadow-pop: 0 8px 28px rgba(28, 24, 21, 0.18);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--krem);
  color: var(--teks);
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

h1,
h2,
h3,
.display {
  font-family: "Poppins", "Inter", sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
  cursor: pointer;
}
input,
select,
textarea {
  font-family: inherit;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--abu-line);
  border-radius: 8px;
}

/* ===== Layout App Shell ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--krem);
}

.sidebar {
  width: 230px;
  background: var(--arang);
  color: var(--krem);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand .flame {
  font-size: 22px;
  margin-right: 8px;
}
.sidebar-brand .brand-name {
  font-family: "Poppins", sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--krem);
  line-height: 1.25;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--kuning-telur);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.nav-list {
  list-style: none;
  padding: 14px 12px;
  margin: 0;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255, 248, 236, 0.72);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  transition:
    background 0.15s,
    color 0.15s;
}
.nav-item .ic {
  font-size: 20px;
  width: 20px;
  text-align: center;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--krem);
}
.nav-item.active {
  background: var(--api);
  color: var(--putih);
}

.sidebar-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 248, 236, 0.55);
}
.sidebar-foot .user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.sidebar-foot .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--kuning-telur);
  color: var(--arang);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar-foot .uname {
  color: var(--krem);
  font-weight: 700;
  font-size: 13px;
}
.btn-logout {
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: var(--krem);
  border: none;
  font-size: 12.5px;
  font-weight: 600;
}
.btn-logout:hover {
  background: rgba(255, 255, 255, 0.13);
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--putih);
  border-bottom: 1px solid var(--abu-line);
  padding: 16px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 {
  font-size: 19px;
  color: var(--arang);
}
.topbar .sub {
  font-size: 12.5px;
  color: var(--abu);
  margin-top: 2px;
}

.content {
  padding: 22px 26px 90px;
  flex: 1;
}

/* ===== Bottom Nav (Mobile) ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--arang);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.18);
}
.bottom-nav-list {
  display: flex;
  justify-content: space-around;
  list-style: none;
  padding: 0;
  margin: 0;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: rgba(255, 248, 236, 0.6);
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 10px;
}
.bottom-nav-item .ic {
  font-size: 20px;
  display: block;
}
.bottom-nav-item.active {
  color: var(--kuning-telur);
}

/* ===== Cards & Generic Components ===== */
.card {
  background: var(--putih);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--putih);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--api);
}
.stat-card .label {
  font-size: 12px;
  color: var(--abu);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat-card .value {
  font-family: "Poppins", sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: var(--arang);
  margin-top: 6px;
}
.stat-card.alt1 {
  border-left-color: var(--kuning-telur);
}
.stat-card.alt2 {
  border-left-color: var(--daun);
}
.stat-card.alt3 {
  border-left-color: var(--merah);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.section-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--arang);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  text-align: left;
  padding: 10px 12px;
  background: var(--krem-soft);
  color: var(--arang);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--abu-line);
}
tr:last-child td {
  border-bottom: none;
}
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--abu-line);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge-aktif {
  background: var(--daun-soft);
  color: var(--daun);
}
.badge-nonaktif {
  background: var(--merah-soft);
  color: var(--merah);
}
.badge-admin {
  background: #eae3ff;
  color: #6b46c1;
}
.badge-kasir {
  background: #dff1ff;
  color: #1976b6;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 700;
  font-size: 13.5px;
  transition:
    transform 0.08s,
    opacity 0.15s;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--api);
  color: var(--putih);
}
.btn-primary:hover {
  background: var(--api-dark);
}
.btn-secondary {
  background: var(--krem-soft);
  color: var(--arang);
}
.btn-secondary:hover {
  background: var(--abu-line);
}
.btn-success {
  background: var(--daun);
  color: var(--putih);
}
.btn-danger {
  background: var(--merah);
  color: var(--putih);
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--abu-line);
  color: var(--arang);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--arang);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--abu-line);
  font-size: 14px;
  background: var(--putih);
  color: var(--teks);
}
.form-control:focus {
  outline: none;
  border-color: var(--api);
  box-shadow: 0 0 0 3px rgba(232, 84, 12, 0.12);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 24, 21, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.show {
  display: flex;
}
.modal-box {
  background: var(--putih);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-pop);
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--abu-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 16px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--abu);
}
.modal-body {
  padding: 20px;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--abu-line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--arang);
  color: var(--krem);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.25s ease;
  min-width: 220px;
}
.toast.success {
  border-left: 4px solid var(--daun);
}
.toast.error {
  border-left: 4px solid var(--merah);
}
@keyframes slideIn {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--abu);
}
.empty-state .ic {
  font-size: 40px;
  margin-bottom: 10px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--putih);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--arang);
  color: var(--krem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 14px;
}
.loading-screen .flame-loader {
  width: 64px;
  height: 64px;
  border: 6px solid rgba(244, 166, 35, 0.18);
  border-top-color: var(--api);
  border-radius: 50%;
  animation: spin-loader 0.9s linear infinite;
}
@keyframes spin-loader {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }
  .bottom-nav {
    display: block;
  }
  .content {
    padding: 16px 14px 100px;
  }
  .topbar {
    padding: 14px 16px;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}
