/* =========================================================
   Admin Template - Ringan & Responsive (Pure CSS, no framework)
   ========================================================= */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  font-size: 14px;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ===== Layout ===== */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 230px;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  transition: transform .25s ease;
  z-index: 1000;
}

/* Submenu / dropdown */
.sidebar .submenu-toggle {
  position: relative;
}

.sidebar .submenu-toggle .arrow {
  margin-left: auto;
  transition: transform .2s ease;
  font-size: 11px;
}

.sidebar li.has-submenu.open>.submenu-toggle .arrow {
  transform: rotate(180deg);
}

.sidebar .submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
  background: #16202f;
}

.sidebar li.has-submenu.open .submenu {
  max-height: 300px;
  /* cukup besar untuk menampung semua item */
}

.sidebar .submenu li a {
  padding: 10px 20px 10px 48px;
  /* indent ke kanan */
  font-size: 13px;
}

.sidebar .brand {
  padding: 18px 20px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid #334155;
}

.sidebar .brand span {
  color: var(--primary);
}

.sidebar .user-info {
  padding: 14px 20px;
  border-bottom: 1px solid #334155;
  font-size: 13px;
}

.sidebar .user-info .role-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.sidebar nav ul li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: #cbd5e1;
  border-left: 3px solid transparent;
}

.sidebar nav ul li a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar nav ul li a.active {
  background: var(--sidebar-hover);
  border-left-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.sidebar .icon {
  width: 18px;
  display: inline-block;
  text-align: center;
}

/* ===== Main content ===== */
.main {
  margin-left: 230px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left .25s ease;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 500;
}

.topbar .toggle-btn {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-dark);
}

.topbar h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}

.content {
  padding: 20px;
  flex: 1;
}

footer.app-footer {
  text-align: center;
  padding: 14px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  background: #fff;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  margin-bottom: 20px;
}

.card h2 {
  margin-top: 0;
  font-size: 15px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-card .icon-box {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  background: var(--primary);
  flex-shrink: 0;
}

.stat-card .icon-box.blue {
  background: #2563eb;
}

.stat-card .icon-box.green {
  background: #16a34a;
}

.stat-card .icon-box.orange {
  background: #d97706;
}

.stat-card .num {
  font-size: 22px;
  font-weight: 700;
}

.stat-card .label {
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: background .15s ease, opacity .15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  opacity: .85;
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text-dark);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  background: #fff;
  color: var(--text-dark);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

select.form-control {
  cursor: pointer;
}

/* ===== Table ===== */
.table-responsive {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data-table th,
table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

table.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: .4px;
}

table.data-table tbody tr:hover {
  background: #f8fafc;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-superadmin {
  background: #ede9fe;
  color: #6d28d9;
}

.badge-admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-teknisi {
  background: #ceeae9;
  color: #0e845e;
}

.action-links {
  display: flex;
  gap: 6px;
}

/* ===== Alerts ===== */
.alert {
  padding: 11px 15px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid transparent;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #1e293b);
  padding: 16px;
}

.login-box {
  background: #fff;
  width: 100%;
  max-width: 360px;
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}

.login-box h1 {
  font-size: 20px;
  margin: 0 0 4px;
  text-align: center;
}

.login-box p.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin: 0 0 22px;
  font-size: 13px;
}

.login-box .btn-primary {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
}

.login-hint {
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* ===== Overlay for mobile sidebar ===== */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 900;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .topbar .toggle-btn {
    display: inline-block;
  }

  .overlay.show {
    display: block;
  }
}

@media (max-width: 560px) {
  .content {
    padding: 14px;
  }

  .card {
    padding: 14px;
  }

  table.data-table th,
  table.data-table td {
    padding: 8px;
  }
}