/* ==========================================================================
   ADMIN PANEL STYLESHEET (DOMINAN BIRU & PUTIH • RESPONSIF HP & PC)
   ========================================================================== */
:root {
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #047857;

  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #b45309;

  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #dc2626;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(37, 99, 235, 0.08);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.14);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background-color: #f3f7fc;
  color: var(--slate-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* ==========================================================================
   1. LOGIN KHUSUS ADMINISTRATOR
   ========================================================================== */
.admin-login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top left, #dbeafe 0%, #eff6ff 45%, #f8fafc 100%);
}

.admin-login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--primary-200);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 16px 36px -6px rgba(30, 64, 175, 0.14);
}

.admin-login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-200);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.admin-login-header {
  text-align: center;
  margin-bottom: 24px;
}

.admin-logo-circle {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.admin-login-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--slate-900);
  margin-bottom: 6px;
}

.admin-login-header p {
  font-size: 0.88rem;
  color: var(--slate-500);
}

.admin-login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-login-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--slate-200);
  text-align: center;
}

.link-back-exam {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-700);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
}

.link-back-exam:hover {
  text-decoration: underline;
}

/* ==========================================================================
   2. LAYOUT SIDEBAR & MAIN PANEL ADMIN
   ========================================================================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 265px;
  background: linear-gradient(180deg, #1e3a8a 0%, #172554 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-text strong {
  font-size: 0.98rem;
  letter-spacing: 0.4px;
}

.sidebar-brand-text span {
  font-size: 0.75rem;
  color: #93c5fd;
}

.btn-close-sidebar {
  display: none;
  margin-left: auto;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.2rem;
  cursor: pointer;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
}

.nav-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #93c5fd;
  padding: 4px 10px 8px;
  letter-spacing: 0.8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #dbeafe;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-item.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-sidebar-exam {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #e0f2fe;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
}

.btn-sidebar-exam:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-sidebar-logout {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(239, 68, 68, 0.15);
  color: #fecaca;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-sidebar-logout:hover {
  background: rgba(239, 68, 68, 0.28);
  color: #ffffff;
}

/* ==========================================================================
   3. TOPBAR & MAIN CONTENT AREA
   ========================================================================== */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

.admin-main-wrapper {
  flex: 1;
  margin-left: 265px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

.admin-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 240px;
}

.topbar-left > div {
  min-width: 0;
  flex: 1;
}

.btn-hamburger {
  display: none;
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-200);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.25;
}

.topbar-subtitle {
  display: block;
  font-size: 0.8rem;
  color: var(--slate-500);
  line-height: 1.35;
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.db-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.db-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.admin-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  max-width: 100%;
  min-width: 0;
}

.admin-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-600);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.admin-user-meta strong {
  font-size: 0.78rem;
  color: var(--primary-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-meta span {
  font-size: 0.69rem;
  color: var(--primary-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-content {
  padding: 24px;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

/* ==========================================================================
   4. CARDS, STATS, & TABLES
   ========================================================================== */
.seed-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid #93c5fd;
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.seed-banner-text h3 {
  font-size: 1rem;
  color: var(--primary-900);
  margin-bottom: 4px;
}

.seed-banner-text p {
  font-size: 0.86rem;
  color: var(--slate-700);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.stat-card-clickable {
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.stat-card-clickable::after {
  content: '→';
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--slate-400);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.stat-card-clickable:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 8px 20px -4px rgba(29, 78, 216, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.05);
  background: #f8fafc;
}

.stat-card-clickable:hover::after {
  opacity: 1;
  transform: translateX(0);
  color: var(--primary-600);
}

.stat-card-clickable:active {
  transform: translateY(0);
}

.stat-card-clickable:focus-visible {
  outline: 2px solid var(--primary-600);
  outline-offset: 2px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-blue { background: #dbeafe; color: #1d4ed8; }
.stat-indigo { background: #e0e7ff; color: #4338ca; }
.stat-emerald { background: #d1fae5; color: #047857; }
.stat-amber { background: #fef3c7; color: #b45309; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate-500);
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.2;
  margin: 2px 0;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--slate-500);
}

.panel-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--slate-900);
}

.panel-desc {
  font-size: 0.84rem;
  color: var(--slate-500);
  margin-top: 2px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 230px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--slate-400);
}

.search-box .input-control {
  padding-left: 36px;
}

.table-meta-bar {
  font-size: 0.82rem;
  color: var(--slate-500);
  margin-bottom: 10px;
  font-weight: 600;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
}

.preview-table-scroll {
  max-height: 420px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.data-table th {
  background: var(--primary-50);
  color: var(--primary-900);
  font-weight: 700;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--primary-200);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

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

.text-center { text-align: center; }
.text-muted { color: var(--slate-500); }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--slate-200);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-600);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate-700);
  background: #ffffff;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.page-btn:hover:not(:disabled) {
  background: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-700);
}

.page-btn.active {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==========================================================================
   5. FORMS, BUTTONS, & BADGES
   ========================================================================== */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.form-field label {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--slate-700);
}

.req { color: #dc2626; }

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 12px;
  color: var(--slate-400);
}

.input-icon-wrap .input-control {
  padding-left: 38px;
}

.btn-pass-eye {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--slate-500);
  cursor: pointer;
  padding: 4px;
}

.input-control, .select-control {
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--slate-800);
  background: #ffffff;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select-control {
  width: auto;
  min-width: 170px;
}

.form-field .select-control {
  width: 100%;
}

.input-control:focus, .select-control:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-600);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-700);
}

.btn-outline {
  background: #ffffff;
  color: var(--slate-700);
  border-color: var(--slate-300);
}

.btn-outline:hover:not(:disabled) {
  background: var(--slate-100);
  color: var(--slate-900);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.btn-danger:hover:not(:disabled) {
  background: #fee2e2;
}

.btn-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.79rem;
}

.btn-lg {
  padding: 12px 18px;
  font-size: 0.95rem;
}

.btn-block {
  width: 100%;
}

.btn-group-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btns {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.badge-info { background: var(--primary-50); color: var(--primary-700); border: 1px solid var(--primary-200); }
.badge-neutral { background: var(--slate-100); color: var(--slate-600); border: 1px solid var(--slate-300); }

/* ==========================================================================
   6. UPLOAD DROPZONE & PRATINJAU IMPOR SOAL
   ========================================================================== */
.upload-dropzone {
  border: 2px dashed var(--primary-500);
  background: var(--primary-50);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  background: #dbeafe;
  border-color: var(--primary-700);
}

.upload-icon-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  box-shadow: var(--shadow-sm);
}

.upload-dropzone h4 {
  font-size: 1rem;
  color: var(--primary-900);
  margin-bottom: 4px;
}

.upload-dropzone p {
  font-size: 0.84rem;
  color: var(--slate-600);
}

.import-preview-box {
  margin-top: 20px;
  border: 1.5px solid var(--primary-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: #fbfdff;
}

.preview-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--slate-200);
}

.preview-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.import-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.import-checkbox-row {
  margin: 10px 0 16px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.86rem;
  color: var(--slate-700);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
}

.preview-actions-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.single-q-editor {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.single-q-editor h4 {
  margin-bottom: 12px;
  color: var(--primary-900);
}

/* ==========================================================================
   7. ALERTS, MODALS, & TOASTS
   ========================================================================== */
.admin-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.admin-alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.admin-alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-sm { max-width: 440px; }
.modal-xl { max-width: 980px; }

.modal-header {
  padding: 16px 20px;
  background: var(--primary-50);
  border-bottom: 1px solid var(--primary-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.02rem;
  color: var(--primary-900);
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  color: var(--slate-500);
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-note {
  font-size: 0.86rem;
  color: var(--slate-600);
  margin-bottom: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  margin-top: 8px;
  border-top: 1px solid var(--slate-200);
}

.code-sample {
  background: var(--slate-900);
  color: #e2e8f0;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  overflow-x: auto;
}

.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast-item {
  background: #ffffff;
  border-left: 4px solid var(--primary-600);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--slate-800);
  animation: slideInRight 0.2s ease;
}

.toast-item.toast-success { border-left-color: #10b981; }
.toast-item.toast-error { border-left-color: #ef4444; }
.toast-item.toast-warning { border-left-color: #f59e0b; }

@keyframes slideInRight {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 90;
}

/* ==========================================================================
   8. RESPONSIVE DESIGN (HP & TABLET)
   ========================================================================== */
@media (max-width: 992px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

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

  .sidebar-backdrop.show {
    display: block;
  }

  .btn-close-sidebar {
    display: inline-block;
  }

  .admin-main-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .btn-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-topbar {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-left {
    width: 100%;
    flex: none;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-title {
    font-size: 1.05rem;
    line-height: 1.25;
  }

  .topbar-subtitle {
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px dashed var(--slate-200);
    gap: 8px;
    flex-wrap: nowrap;
  }

  .db-status-pill {
    font-size: 0.7rem;
    padding: 4px 8px;
    flex-shrink: 0;
  }

  .admin-user-pill {
    padding: 4px 10px 4px 5px;
    max-width: calc(100% - 115px);
  }

  .admin-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  .admin-user-meta strong {
    font-size: 0.73rem;
  }

  .admin-user-meta span,
  .admin-user-meta small {
    font-size: 0.65rem;
  }

  .admin-content {
    padding: 12px;
  }

  .panel-card {
    padding: 14px;
    border-radius: 12px;
  }

  .panel-header,
  .panel-card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .btn-group-wrap,
  .panel-card-actions {
    width: 100%;
  }

  .btn-group-wrap .btn,
  .panel-card-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .search-box,
  .search-input-wrap,
  .select-control {
    width: 100%;
    min-width: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .import-form-grid {
    grid-template-columns: 1fr;
  }

  .seed-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .preview-actions-footer {
    flex-direction: column-reverse;
  }

  .preview-actions-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .modal-box {
    max-height: 92vh;
    border-radius: 14px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* Tampilan Kartu Responsif (Mobile Card View) untuk seluruh tabel di HP */
  .table-responsive {
    border: none;
    border-radius: 0;
    overflow-x: visible;
    background: transparent;
  }

  .data-table,
  .data-table tbody {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    display: block;
    background: #ffffff;
    border: 1.5px solid var(--slate-200);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  }

  .data-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .data-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--slate-200);
    text-align: right;
    font-size: 0.85rem;
    word-break: break-word;
  }

  .data-table tbody td:last-child {
    border-bottom: none;
    padding-bottom: 2px;
  }

  .data-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.77rem;
    color: var(--slate-500);
    text-align: left;
    flex-shrink: 0;
    max-width: 44%;
  }

  /* Baris kosong / status loading dengan colspan */
  .data-table tbody td[colspan] {
    display: block;
    text-align: center;
    padding: 16px 8px;
    border-bottom: none;
  }

  .data-table tbody td[colspan]::before {
    display: none;
  }

  /* Sel teks panjang (Pertanyaan, Pilihan Jawaban, Keterangan) */
  .data-table tbody td.td-block {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 5px;
  }

  .data-table tbody td.td-block::before {
    max-width: 100%;
  }

  /* Sel tombol aksi pengelolaan di bagian bawah kartu */
  .data-table tbody td.td-actions {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding-top: 10px;
    gap: 8px;
  }

  .data-table tbody td.td-actions::before {
    max-width: 100%;
  }

  .data-table tbody td.td-actions .action-btns {
    width: 100%;
    justify-content: stretch;
    gap: 6px;
  }

  .data-table tbody td.td-actions .action-btns .btn {
    flex: 1 1 auto;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 10px;
  }

  .pagination-controls {
    justify-content: center;
  }

  .hide-xs {
    display: none;
  }
}
