/* Mazer-inspired admin theme */

:root {
  --bg: #f2f7ff;
  --bg-accent: #edf3ff;
  --surface: #ffffff;
  --surface-soft: #f6f9ff;
  --text: #25396f;
  --muted: #7c8db5;
  --line: #dfe7fb;
  --primary: #435ebe;
  --primary-deep: #344a9a;
  --success: #21b573;
  --warning: #fdac41;
  --danger: #ff7976;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 26px rgba(58, 86, 156, 0.08);
  --sidebar-width: 270px;
}

body.theme-dark {
  --bg: #111827;
  --bg-accent: #182132;
  --surface: #162033;
  --surface-soft: #1b2740;
  --text: #e5ecff;
  --muted: #9fb0d3;
  --line: #283552;
  --primary: #6f86dc;
  --primary-deep: #5870c9;
  --success: #37c988;
  --warning: #ffbe5c;
  --danger: #ff8f8c;
  --shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% -10%, #dce8ff 0%, #eef4ff 45%, #f3f7ff 100%);
}

body.theme-dark {
  background: radial-gradient(circle at 10% -10%, #1e2a44 0%, #111827 40%, #0f1726 100%);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.admin-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

body.admin-layout::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  z-index: 1020;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

body.sidebar-open::before {
  opacity: 1;
  pointer-events: auto;
}

body.theme-dark.sidebar-open::before {
  background: rgba(0, 0, 0, 0.42);
}

.sidebar-panel {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: 0 0 30px rgba(115, 147, 214, 0.18);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 1030;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand a {
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  font-weight: 800;
  color: var(--primary);
}

.sidebar-brand a span {
  color: var(--text);
  font-weight: 600;
}

.sidebar-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 4px;
  font-size: 1.1rem;
}

.sidebar-menu {
  padding: 14px 12px;
  display: grid;
  gap: 4px;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  padding: 10px 12px;
  color: #5f6f92;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.18s ease;
}

.menu-item i {
  font-size: 1rem;
}

.menu-item:hover {
  color: var(--primary);
  background: #f3f6ff;
}

body.theme-dark .menu-item:hover {
  background: #1f2b45;
}

.menu-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #6070d4);
  box-shadow: 0 8px 22px rgba(67, 94, 190, 0.28);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.menu-logout {
  color: #7f5a7a;
}

.menu-logout:hover {
  color: var(--danger);
  background: #fff2f9;
}

.main-panel {
  flex: 1;
  min-width: 0;
  padding: 22px 28px 30px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: #56698f;
  display: inline-grid;
  place-items: center;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-toggle.is-animating {
  animation: theme-toggle-pop 0.26s ease;
}

@keyframes theme-toggle-pop {
  0% {
    transform: scale(0.96);
  }
  45% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.theme-toggle-light-icon {
  display: none;
}

body.theme-dark .theme-toggle {
  background: #1a2740;
  color: #ffd97b;
}

body.theme-dark .theme-toggle-dark-icon {
  display: none;
}

body.theme-dark .theme-toggle-light-icon {
  display: inline-block;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sidebar-toggle {
  display: none;
  border: 0;
  background: var(--surface);
  border-radius: 10px;
  color: var(--primary);
  width: 40px;
  height: 40px;
  box-shadow: var(--shadow);
}

.sidebar-toggle i {
  font-size: 1.4rem;
}

.topbar-title {
  color: #6f7ea8;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  padding: 6px 12px;
  color: #4f5f83;
  font-weight: 700;
  font-size: 0.88rem;
}

body.theme-dark .topbar-user,
body.theme-dark .theme-toggle,
body.theme-dark .sidebar-toggle {
  border-color: var(--line);
  background: rgba(22, 32, 51, 0.95);
  color: var(--text);
}

.page-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.page-breadcrumb {
  margin-bottom: 6px;
  width: 100%;
}

.page-breadcrumb .breadcrumb {
  margin: 0;
  padding: 0;
  background: transparent;
  font-size: 0.85rem;
}

.page-breadcrumb .breadcrumb-item,
.page-breadcrumb .breadcrumb-item a {
  color: #7e8bb0;
  font-weight: 700;
}

.page-breadcrumb .breadcrumb-item.active {
  color: #6a78a0;
}

.page-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  color: #9caacd;
}

.page-heading h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.page-content {
  min-height: calc(100vh - 170px);
}

.page-body {
  display: grid;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid #e1e8fb;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 0;
}

body.theme-dark .sidebar-panel,
body.theme-dark .metric-card,
body.theme-dark .card,
body.theme-dark .tool-link,
body.theme-dark .status-item,
body.theme-dark .upload-dropzone,
body.theme-dark .bulk-qr-report-view .bulk-qr-page,
body.theme-dark .bulk-qr-report-view .bulk-qr-code {
  background: var(--surface);
  border-color: var(--line);
}

body.theme-dark .bulk-qr-report-view .bulk-qr-code,
body.theme-dark .upload-dropzone,
body.theme-dark .settings-subcard,
body.theme-dark .status-item,
body.theme-dark .tool-link,
body.theme-dark .button {
  background: var(--surface-soft);
}

body.theme-dark .table th,
body.theme-dark th {
  background: #1d2941;
  color: #c7d5f3;
}

body.theme-dark .table tbody tr:hover,
body.theme-dark tbody tr:hover {
  background: rgba(111, 134, 220, 0.08);
}

body.theme-dark .event-filter-row,
body.theme-dark .form-label,
body.theme-dark .rank-score,
body.theme-dark .topbar-title,
body.theme-dark .tool-link,
body.theme-dark .button,
body.theme-dark .bulk-qr-report-view .bulk-qr-label,
body.theme-dark .metric-label,
body.theme-dark .page-breadcrumb .breadcrumb-item,
body.theme-dark .page-breadcrumb .breadcrumb-item a,
body.theme-dark .status-note,
body.theme-dark .page-heading p,
body.theme-dark .footer {
  color: var(--muted);
}

body.theme-dark .page-breadcrumb .breadcrumb-item.active,
body.theme-dark .stat,
body.theme-dark .page-heading h1,
body.theme-dark .metric-value,
body.theme-dark .rank-label,
body.theme-dark .bulk-qr-report-view .bulk-qr-value,
body.theme-dark .card h2,
body.theme-dark .card h3,
body.theme-dark .card h4,
body.theme-dark .topbar-user,
body.theme-dark .menu-item,
body.theme-dark .section-header h2,
body.theme-dark .section-header h3,
body.theme-dark .section-header h4 {
  color: var(--text);
}

body.theme-dark .input,
body.theme-dark .select,
body.theme-dark .textarea,
body.theme-dark .form-control,
body.theme-dark .form-select {
  background: #111a2c;
  border-color: var(--line);
  color: var(--text);
}

body.theme-dark .input::placeholder,
body.theme-dark .textarea::placeholder,
body.theme-dark .form-control::placeholder {
  color: #7f91b6;
}

body.theme-dark .settings-code {
  background: #111a2c;
  border-color: var(--line);
  color: #d4dfff;
}

body.theme-dark .alert {
  border-color: var(--line);
  background: #1b2740;
  color: var(--text);
}

body.theme-dark .alert-danger {
  background: rgba(185, 43, 80, 0.16);
  color: #ffb4c2;
}

body.theme-dark .alert-warning {
  background: rgba(157, 103, 15, 0.2);
  color: #ffd797;
}

body.theme-dark .alert-success {
  background: rgba(23, 127, 80, 0.18);
  color: #a8f0c9;
}

body.theme-dark .alert-info {
  background: rgba(54, 81, 172, 0.18);
  color: #c5d6ff;
}

.card h2,
.card h3,
.card h4 {
  margin-top: 0;
  margin-bottom: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.card.border-danger {
  border-color: rgba(214, 51, 132, 0.45) !important;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat {
  font-size: clamp(1.2rem, 2.3vw, 1.8rem);
  line-height: 1.2;
  font-weight: 800;
  color: #25396f;
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.metric-card {
  background: #fff;
  border: 1px solid #e1e8fb;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.metric-icon.primary {
  background: linear-gradient(135deg, #435ebe, #6f86dc);
}

.metric-icon.info {
  background: linear-gradient(135deg, #3f8cff, #69a8ff);
}

.metric-icon.success {
  background: linear-gradient(135deg, #21b573, #56d397);
}

.metric-icon.warning {
  background: linear-gradient(135deg, #fdac41, #f9c274);
}

.metric-content {
  min-width: 0;
}

.metric-label {
  display: block;
  color: #96a4c7;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric-value {
  margin: 4px 0 8px;
  font-size: 1.6rem;
  line-height: 1.1;
  color: #25396f;
  font-weight: 800;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.metric-badge.success {
  color: #0c7b49;
  background: #def8eb;
}

.metric-badge.info {
  color: #1f65cc;
  background: #e5f0ff;
}

.metric-badge.warn,
.metric-badge.warning {
  color: #a76a12;
  background: #fff3df;
}

.section-card {
  padding: 18px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-header h3 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.event-filter-row {
  margin-bottom: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: #61739f;
}

.event-filter-form {
  margin: 0;
  display: inline-flex;
  align-items: center;
  min-width: 240px;
}

.event-filter-form .form-select {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-weight: 700;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.status-item {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-label {
  color: #66779f;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.action-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.action-grid .button {
  width: 100%;
}

.inline-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.test-vote-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.test-vote-panel h4 {
  margin: 0 0 10px;
}

.test-vote-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}

.ranking-list {
  display: grid;
  gap: 10px;
}

.ranking-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 10px 12px;
}

.rank-pill {
  min-width: 34px;
  text-align: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #435ebe, #6070d4);
}

.rank-label {
  font-weight: 800;
  color: #324c87;
}

.rank-score {
  font-size: 0.85rem;
  font-weight: 700;
  color: #6f7fa4;
}

.top-ten-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.top-ten-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #ffffff, #f3f7ff);
  padding: 12px;
  box-shadow: 0 8px 16px rgba(62, 92, 170, 0.1);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.top-ten-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 22px rgba(62, 92, 170, 0.14);
}

.top-ten-rank-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
  background: linear-gradient(135deg, #4a63c4, #2e427f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.top-ten-body h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #2f467f;
}

.top-ten-body p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: #6f7fa4;
}

.top-ten-rank-1 .top-ten-rank-badge {
  background: linear-gradient(135deg, #f5c84b, #d1941d);
}

.top-ten-rank-2 .top-ten-rank-badge {
  background: linear-gradient(135deg, #b3c0d7, #7c8da9);
}

.top-ten-rank-3 .top-ten-rank-badge {
  background: linear-gradient(135deg, #d6a06d, #9f6238);
}

body.theme-dark .top-ten-item {
  background: linear-gradient(145deg, #1b2740, #182235);
  border-color: var(--line);
}

body.theme-dark .top-ten-body h4 {
  color: #dce8ff;
}

body.theme-dark .top-ten-body p {
  color: #9fb0d3;
}

.top-ten-owner-thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--line);
  box-shadow: 0 2px 6px rgba(62, 92, 170, 0.15);
}

.top-ten-owner-name {
  margin: 3px 0 0;
  font-size: 0.78rem;
  color: #4a63c4;
  font-weight: 600;
}

body.theme-dark .top-ten-owner-name {
  color: #7b9dff;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbff;
  color: #41537d;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 12px;
  transition: all 0.14s ease;
}

.tool-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(60, 92, 174, 0.16);
  background: #fff;
}

.tool-link i {
  color: #5671cf;
}

.superadmin-card {
  margin-top: 4px;
}

.danger-title {
  color: #d53b63;
}

.superadmin-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.tool-link.danger {
  border-color: rgba(213, 59, 99, 0.35);
  color: #c52f57;
  background: #fff1f5;
}

.tool-link.danger i {
  color: #c52f57;
}

.settings-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.settings-subcard {
  margin-top: 10px;
  background: var(--surface-soft);
}

.settings-days-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.settings-day-item {
  font-weight: 600;
  color: #4e5f87;
}

.settings-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-code {
  background: rgba(37, 57, 111, 0.06);
  border: 1px solid rgba(37, 57, 111, 0.12);
  padding: 10px;
  border-radius: 8px;
  color: #2f477d;
}

.settings-error-list {
  margin: 0;
  padding-left: 18px;
  color: #c52f57;
  font-weight: 700;
}

.events-timeline {
  margin-top: 12px;
}

.events-list {
  margin: 8px 0 0 16px;
  padding: 0;
  list-style: disc;
}

.events-closed {
  color: #d53b63;
  font-weight: 700;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-highlight {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.empty-table {
  text-align: center;
  color: var(--muted);
}

.inline-form {
  display: inline;
}

.upload-dropzone {
  border: 2px dashed #9aa8cb;
  padding: 14px;
  border-radius: 10px;
  text-align: center;
  margin-top: 8px;
  background: #fbfdff;
}

.upload-dropzone-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.upload-preview-wrap {
  margin-top: 14px;
}

.upload-preview {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.upload-link {
  word-break: break-all;
  font-size: 0.9rem;
}

.candidate-image-preview {
  max-width: 100%;
  max-height: 160px;
}

.upload-crop-toggle {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #4f618b;
}

.upload-status-note {
  margin-top: 8px;
  min-height: 1.1rem;
  color: #3b5fa5;
  font-size: 0.9rem;
  font-weight: 700;
}

.upload-status-note.error {
  color: #b92b50;
}

.upload-progress {
  margin-top: 8px;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  border: 1px solid #c9d7f7;
  background: #f5f8ff;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(135deg, var(--primary), #607bdc);
  color: #fff;
  font-size: 0.72rem;
  line-height: 12px;
  text-align: center;
  font-weight: 800;
  transition: width 0.2s ease;
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(12, 20, 38, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.crop-modal-content {
  width: min(100%, 460px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.crop-modal-content h4 {
  margin: 0;
}

.crop-modal-note {
  margin: 4px 0 12px;
  color: var(--muted);
}

.crop-canvas {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.crop-controls {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.crop-controls label {
  font-weight: 700;
  color: #4f618b;
}

.crop-controls input[type='range'] {
  width: 100%;
}

body.crop-modal-open {
  overflow: hidden;
}

.qr-config-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}

.qr-preview-wrap {
  margin-top: 18px;
  text-align: center;
}

.qr-preview-canvas {
  max-width: min(100%, 520px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-preview-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-card-wrap {
  max-width: 420px;
}

.auth-card {
  padding: 20px;
}

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

.bulk-qr-report-view .bulk-qr-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.bulk-qr-report-view .bulk-qr-pages {
  display: grid;
  gap: 18px;
}

.bulk-qr-report-view .bulk-qr-page {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  break-after: page;
  page-break-after: always;
  min-height: calc(11in - 1in);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) auto;
  gap: 24px;
  align-items: start;
}

.bulk-qr-report-view .bulk-qr-page:last-child {
  break-after: auto;
  page-break-after: auto;
}

.bulk-qr-report-view .bulk-qr-meta {
  display: grid;
  gap: 12px;
}

.bulk-qr-report-view .bulk-qr-heading {
  display: grid;
  gap: 6px;
}

.bulk-qr-report-view .bulk-qr-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bulk-qr-report-view .bulk-qr-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.bulk-qr-report-view .bulk-qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.bulk-qr-report-view .bulk-qr-code {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  min-width: 180px;
}

.bulk-qr-report-view .bulk-qr-canvas {
  width: 2in;
  height: 2in;
  background: #fff;
  image-rendering: pixelated;
}

.bulk-qr-report-view .bulk-qr-caption {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.import-card-gap {
  margin-bottom: 16px;
}

/* Normalize leftover bootstrap button variants to the shared Mazer button visual language. */
.btn {
  border-radius: 10px;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #607bdc);
  border-color: #4f69c6;
}

.btn-outline-secondary,
.btn-secondary,
.btn-outline-primary,
.btn-outline-info,
.btn-outline-danger {
  border-color: #c8d6f5;
  color: #41537d;
  background: #f9fbff;
}

.btn-outline-danger {
  color: #bf2f57;
  border-color: rgba(213, 59, 99, 0.35);
  background: #fff1f5;
}

.status {
  padding: 6px 11px;
  border-radius: 999px;
  display: inline-block;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: #fff;
}

.status.active {
  background: var(--success);
}

.status.off {
  background: #6e768f;
}

.status.warn {
  background: var(--warning);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid #c8d6f5;
  background: #f9fbff;
  color: #41537d;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  text-decoration: none;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(60, 92, 174, 0.17);
  background: #fff;
}

.button.primary,
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #607bdc);
  color: #fff;
  border-color: #4f69c6;
}

.button.primary:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-deep), #556fcb);
}

.button.danger,
.btn-danger {
  background: #d63384;
  border-color: #c02875;
  color: #fff;
}

.button.small {
  padding: 7px 11px;
  font-size: 0.86rem;
}

.btn,
.form-control,
.form-select,
.form-check-input {
  border-radius: 10px;
}

.form-control,
.form-select,
.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c9d7f7;
  background: #fff;
  color: var(--text);
  font-size: 0.98rem;
}

.form-control:focus,
.form-select:focus,
.input:focus,
.select:focus,
.textarea:focus {
  border-color: #7b95ea;
  box-shadow: 0 0 0 0.2rem rgba(99, 127, 229, 0.18);
}

.form-control.is-invalid,
.input.is-invalid {
  border-color: var(--danger) !important;
  background-image: none !important;
}

.field-error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 4px;
}

.field-error-msg:empty {
  display: none;
}

.form {
  display: grid;
  gap: 12px;
}

.form-label {
  font-weight: 700;
  color: #4a5d86;
  margin-bottom: 4px;
}

.alert {
  border-radius: 10px;
  font-weight: 600;
  border-color: #d7e3fb;
  background: #f8fbff;
  color: #516289;
}

.alert-danger {
  border-color: rgba(213, 59, 99, 0.3);
  background: #fff1f5;
  color: #b92b50;
}

.alert-warning {
  border-color: rgba(253, 172, 65, 0.35);
  background: #fff7e9;
  color: #9d670f;
}

.alert-success {
  border-color: rgba(33, 181, 115, 0.35);
  background: #ecfbf4;
  color: #177f50;
}

.alert-info {
  border-color: rgba(67, 94, 190, 0.25);
  background: #edf2ff;
  color: #3651ac;
}

.table,
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th,
.table td,
th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #e3eaf9;
  text-align: left;
  vertical-align: middle;
}

.table th,
th {
  background: #f3f6ff;
  color: #4f618b;
  font-weight: 800;
}

.table tbody tr:hover,
tbody tr:hover {
  background: #f8faff;
}

.certificate {
  border: 8px solid #f5cc57;
  border-radius: 18px;
  padding: 32px;
  margin: 22px auto;
  max-width: 740px;
  background: #fff;
  box-shadow: 0 20px 45px rgba(31, 50, 101, 0.15);
  text-align: center;
}

.certificate h1 {
  margin-top: 0;
  font-size: 1.9rem;
}

.certificate h2 {
  margin: 8px 0;
  font-size: 1.4rem;
}

.certificate p {
  margin: 10px 0;
  line-height: 1.4;
}

.certificate-qr {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.certificate-qr canvas,
.certificate-qr img {
  width: 150px !important;
  height: 150px !important;
}

.footer {
  color: #7a88a9;
  font-size: 0.84rem;
  text-align: center;
  padding: 16px 8px 8px;
}

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.auth-main {
  width: min(100%, 960px);
}

.open-full-admin-link {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 1055;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}

body:not(.admin-embedded) .open-full-admin-link {
  display: none;
}

/* When embedded inside the WordPress iframe, viewport-relative min-heights
   drive the syncIframeHeight feedback loop. Strip them so scroll height
   reflects real content only. */
body.admin-embedded,
body.admin-embedded .admin-shell,
body.admin-embedded .page-content,
body.admin-embedded .auth-shell {
  min-height: 0 !important;
}

body.theme-dark .open-full-admin-link {
  background: var(--surface-soft);
}

.auth-heading {
  text-align: center;
  margin-bottom: 20px;
  display: block;
}

.auth-heading p {
  margin-top: 8px;
}

.auth-body .row {
  margin: 0;
}

.auth-body .col-md-4 {
  max-width: 420px;
  margin: 0 auto;
}

@media (max-width: 992px) {
  .sidebar-panel {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.24s ease, opacity 0.24s ease, visibility 0.24s ease;
  }

  body.sidebar-open .sidebar-panel {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }

  .sidebar-toggle {
    display: inline-grid;
    place-items: center;
  }

  .admin-topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }

  .main-panel {
    padding: 18px 14px 24px;
    padding-top: calc(18px + env(safe-area-inset-top));
  }

  .page-heading {
    align-items: flex-start;
  }

  .topbar-title {
    font-size: 0.95rem;
  }

  .topbar-user {
    font-size: 0.8rem;
    padding: 5px 10px;
  }

  .topbar-actions {
    gap: 6px;
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.admin-layout::before,
  .sidebar-panel,
  .theme-toggle {
    transition: none !important;
  }

  .theme-toggle.is-animating {
    animation: none !important;
  }
}

@media (max-width: 640px) {
  .page-heading h1 {
    font-size: 1.45rem;
  }

  .page-heading p {
    font-size: 0.9rem;
  }

  .card {
    padding: 16px;
  }

  .admin-topbar {
    gap: 8px;
  }

  .theme-toggle,
  .sidebar-toggle {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    box-shadow: none;
  }

  .topbar-user {
    padding: 5px 8px;
  }

  .topbar-user span {
    display: none;
  }

  .topbar-user i {
    margin: 0;
  }

  .topbar-title {
    font-size: 0.9rem;
  }

  .page-heading {
    margin-bottom: 14px;
  }

  .page-content {
    min-height: auto;
  }

  .ranking-item {
    grid-template-columns: auto 1fr;
  }

  .rank-score {
    grid-column: 1 / -1;
    padding-left: 44px;
  }

  .top-ten-grid {
    grid-template-columns: 1fr;
  }

  .open-full-admin-link {
    right: 10px;
    bottom: 10px;
    padding: 8px 10px;
    font-size: 0.78rem;
  }
}

/* Candidate directory: retain the desktop table, but present each row as a
   compact, labeled card on phones so every action remains reachable. */
@media (max-width: 760px) {
  .candidates-table-wrap {
    overflow: visible;
  }

  .candidates-table,
  .candidates-table tbody,
  .candidates-table tr,
  .candidates-table td {
    display: block;
    width: 100%;
  }

  .candidates-table thead {
    display: none;
  }

  .candidates-table {
    margin-top: 0;
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
  }

  .candidates-table tr {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
  }

  .candidates-table td {
    display: grid;
    grid-template-columns: minmax(105px, 38%) 1fr;
    gap: 10px;
    padding: 8px 0;
    border: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text);
    text-align: right;
  }

  .candidates-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-align: left;
  }

  .candidates-table td[data-label="Actions"] {
    display: block;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    text-align: left;
  }

  .candidates-table td[data-label="Actions"]::before {
    display: block;
    margin-bottom: 8px;
  }

  .candidates-table .table-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
    gap: 8px;
  }

  .candidates-table .table-actions .button,
  .candidates-table .table-actions form {
    width: 100%;
  }

  .candidates-table .table-actions form {
    display: block !important;
  }
}

@media (max-width: 860px) {
  .bulk-qr-report-view .bulk-qr-page {
    grid-template-columns: 1fr;
  }

  .bulk-qr-report-view .bulk-qr-grid {
    grid-template-columns: 1fr;
  }

  .bulk-qr-report-view .bulk-qr-code {
    justify-self: start;
  }
}

@media print {
  @page {
    margin: 0.5in;
  }

  .bulk-qr-report-view body,
  body {
    background: #fff;
  }

  .bulk-qr-report-view .main-panel,
  .bulk-qr-report-view .page-content,
  .bulk-qr-report-view .page-body,
  .bulk-qr-report-view .card {
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .bulk-qr-report-view .bulk-qr-toolbar,
  .bulk-qr-report-view .page-heading,
  .bulk-qr-report-view .admin-topbar,
  .bulk-qr-report-view .footer,
  .sidebar-panel,
  .open-full-admin-link {
    display: none !important;
  }

  .bulk-qr-report-view .bulk-qr-pages {
    gap: 0;
  }

  .bulk-qr-report-view .bulk-qr-page {
    min-height: 0;
    height: 10in;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }
}
