/* =========================================================
   SID Kaluwatu - Styling Admin Modern & Interaktif
   Menggunakan variabel CSS dinamis dari app.css
   ========================================================= */

body.admin {
  background: var(--bg-alt);
  display: flex;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
}

/* ---------- Sidebar ---------- */
/* ---------- Sidebar Modern & Interaktif ---------- */
.side {
  width: 275px;
  flex: none;
  background: #ffffff;
  border-right: 1px solid var(--border);
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  padding: 1.1rem .9rem 2.5rem;
  z-index: 60;
  transition: transform .28s cubic-bezier(.16, 1, .3, 1), box-shadow .28s;
  display: flex;
  flex-direction: column;
}
.side::-webkit-scrollbar { width: 5px; }
.side::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.side-brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .3rem .5rem 1rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: .85rem;
}
.side-brand .logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: none;
  display: grid;
  place-items: center;
  box-shadow: none;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.15));
}
.side-brand img.logo { width: 44px; height: 44px; object-fit: contain; }
.side-brand b { display: block; line-height: 1.2; font-size: 1.02rem; }
.side-brand small { color: var(--muted); font-size: .78rem; }

/* Kartu Profil Pengguna di Sidebar (Admin vs Operator) */
.side-user-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .75rem;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: .75rem .85rem;
  margin-bottom: .85rem;
  transition: all .25s ease;
}
.side-user-card.user-admin-mode {
  background: linear-gradient(135deg, rgba(124, 58, 237, .06), rgba(255, 255, 255, .95));
  border-color: rgba(124, 58, 237, .25);
}
.side-user-card.user-op-mode {
  background: linear-gradient(135deg, rgba(16, 185, 129, .06), rgba(255, 255, 255, .95));
  border-color: rgba(16, 185, 129, .25);
}
.side-user-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
}
.side-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: .95rem;
  display: grid;
  place-items: center;
  position: relative;
  flex: none;
}
.user-admin-mode .side-user-avatar { background: linear-gradient(135deg, #7c3aed, #a855f7); box-shadow: 0 2px 8px rgba(124, 58, 237, .3); }
.user-op-mode .side-user-avatar { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 2px 8px rgba(5, 150, 105, .3); }
.dot-online {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, .4);
}
.side-user-meta { min-width: 0; }
.side-user-name {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user-badge { margin-top: .2rem; }
.role-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 999px;
  line-height: 1.2;
}
.role-pill.role-admin { background: #f3e8ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.role-pill.role-op { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.side-user-edit-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: all .2s;
}
.side-user-edit-btn:hover {
  background: var(--p);
  color: #fff;
  border-color: var(--p);
  transform: scale(1.1) rotate(8deg);
}

/* Pencarian Cepat Menu */
.side-search-box {
  position: relative;
  margin-bottom: .85rem;
}
.side-search-box .search-ico {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.side-search-box input {
  width: 100%;
  padding: .5rem .75rem .5rem 2.2rem;
  border-radius: 10px;
  font-size: .83rem;
  border: 1.5px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  outline: none;
  transition: all .2s;
}
.side-search-box input:focus {
  background: #ffffff;
  border-color: var(--p);
  box-shadow: 0 0 0 3px rgba(var(--p-rgb), .15);
}

/* Navigasi & Kelompok Menu */
.side-nav { display: flex; flex-direction: column; gap: .35rem; }
.side-group { margin-bottom: .5rem; }
.sg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45rem .65rem;
  font-size: .73rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.sg-title { display: flex; align-items: center; gap: .4rem; }
.sg-title .ic { width: 1.1em; height: 1.1em; opacity: .85; }
.sg-count {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 999px;
  line-height: 1;
}
.sg-items { display: flex; flex-direction: column; gap: .2rem; }

/* Item Link Navigasi */
.si {
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .62rem .85rem;
  border-radius: 11px;
  color: #334155;
  font-size: .9rem;
  font-weight: 500;
  transition: all .18s cubic-bezier(.16, 1, .3, 1);
  text-decoration: none;
}
.si::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--p);
  transform: scaleY(0);
  transition: transform .18s ease;
}
.si:hover {
  background: var(--p-soft);
  color: var(--p);
  transform: translateX(3px);
}
.si.on {
  background: var(--p);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(var(--p-rgb), .3);
}
.si.on::before {
  transform: scaleY(1);
  background: #ffffff;
}
.si-ico {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: none;
  transition: transform .2s ease;
}
.si:hover .si-ico { transform: scale(1.15); }
.si-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.si-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 999px;
  line-height: 1;
  flex: none;
}
.si-badge.warn { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.si-badge.purple { background: #f3e8ff; color: #7c3aed; border: 1px solid #e9d5ff; }
.si-badge.green { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.si.on .si-badge { background: rgba(255, 255, 255, .25); color: #fff; border-color: rgba(255, 255, 255, .3); }

/* ---------- Topbar Header Modern ---------- */
.main {
  margin-left: 275px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.atop {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1.6rem;
  transition: box-shadow .2s;
  min-height: 64px;
}
.atop-title-wrap h1 {
  font-size: 1.22rem;
  margin: 0;
  font-weight: 800;
  line-height: 1.2;
}
.atop-crumb {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .15rem;
}
.atop-crumb a { color: var(--muted); }
.atop-crumb a:hover { color: var(--p); }
.atop-r {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.who-pill {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem .75rem;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: .86rem;
  transition: all .2s;
}
.who-pill:hover {
  border-color: var(--p);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
}
.who-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.who-admin .who-avatar { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.who-op .who-avatar { background: linear-gradient(135deg, #059669, #10b981); }
.who-info { display: flex; flex-direction: column; line-height: 1.2; }
.who-name { font-size: .84rem; color: var(--text); }
.who-role { font-size: .72rem; color: var(--muted); font-weight: 500; }
.content { padding: 1.6rem; }
.side-scrim { display: none; }
.admin .burger { display: none; }

/* ---------- Dashboard Cards ---------- */
.welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  background: linear-gradient(135deg, var(--p-dark) 0%, var(--p) 65%, var(--p-600) 100%);
  color: #ffffff;
  border: 0;
  padding: 1.8rem 2rem;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.welcome::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -50px;
  top: -70px;
  background: rgba(255, 255, 255, .1);
  border-radius: 50%;
  pointer-events: none;
}
.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(255, 255, 255, .2);
  backdrop-filter: blur(8px);
  padding: .25rem .75rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: .6rem;
}
.welcome h2 { font-size: 1.6rem; margin: 0 0 .3rem; color: #fff; }
.welcome p { margin: 0; opacity: .94; font-size: .96rem; max-width: 38rem; }
.welcome-actions { display: flex; gap: .7rem; flex-wrap: wrap; z-index: 2; }

/* Stat card modern */
.stat-card {
  padding: 1.3rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  border-radius: var(--radius);
  color: inherit;
  position: relative;
  transition: transform .25s, box-shadow .25s;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.stat-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  flex: none;
  transition: transform .25s;
}
.stat-card:hover .stat-icon-wrap { transform: scale(1.1) rotate(-6deg); }
.stat-content { flex: 1; }
.stat-content .num { font-size: 1.85rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-content .lab { color: var(--muted); font-size: .86rem; margin-top: .2rem; font-weight: 500; }
.stat-arrow { opacity: 0; transform: translateX(-6px); transition: all .2s; color: var(--p); }
.stat-card:hover .stat-arrow { opacity: 1; transform: none; }

/* Quick Pills */
.quick-pill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .9rem;
}
@media (max-width: 800px) { .quick-pill-grid { grid-template-columns: 1fr; } }
.quick-pill {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .8rem 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  transition: all .2s;
}
.quick-pill:hover {
  background: #ffffff;
  border-color: rgba(var(--p-rgb), .4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  color: var(--p);
}
.quick-pill .p-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  flex: none;
}
.quick-pill b { display: block; font-size: .93rem; line-height: 1.2; }
.quick-pill small { color: var(--muted); font-size: .78rem; }

/* Recent history photos grid in dashboard */
.recent-photos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .85rem;
}
.recent-photo-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.recent-photo-card .thumb-box {
  aspect-ratio: 16/10;
  position: relative;
  background: #0f172a;
}
.recent-photo-card .thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.recent-photo-card .thumb-box .no-img {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.8rem;
}
.recent-photo-card .photo-yr {
  position: absolute;
  top: .4rem;
  left: .4rem;
  font-size: .7rem;
}
.recent-photo-card .photo-info {
  padding: .7rem .8rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}
.recent-photo-card b {
  font-size: .85rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* File upload zone & instant live preview */
.file-upload-zone {
  display: grid;
  gap: .6rem;
}
.live-preview-box {
  border: 1.5px dashed rgba(var(--p-rgb), .35);
  background: var(--p-soft);
  padding: .9rem;
  border-radius: 12px;
  animation: fadeIn .25s ease;
}
.preview-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.preview-card img {
  max-width: 120px;
  max-height: 80px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.preview-meta {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .88rem;
}
.file-pill {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
}

/* Modal Pratinjau Gambar Admin */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(11, 19, 41, .88);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s;
}
.admin-modal.show {
  opacity: 1;
  visibility: visible;
}
.admin-modal-card {
  position: relative;
  max-width: 860px;
  max-height: 88vh;
  background: #fff;
  padding: .5rem;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .5);
}
.admin-modal-card img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 12px;
}
.admin-modal-close {
  position: absolute;
  top: .8rem;
  right: .8rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15, 23, 42, .8);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 10;
}
.admin-modal-close:hover { background: var(--danger); }

/* Table thumb */
.thumb-sm {
  width: 64px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: transform .18s;
}
.thumb-sm:hover {
  transform: scale(1.12);
  box-shadow: var(--shadow);
}

/* ---------- Login Page Modern ---------- */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: radial-gradient(circle at 80% 20%, rgba(var(--p-rgb), .35), transparent 40%),
              linear-gradient(135deg, var(--p-dark) 0%, #0f172a 100%);
  position: relative;
}
.login-theme {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  color: #fff;
  z-index: 10;
}
.login-card {
  width: min(440px, 100%);
  padding: 2.2rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(14px);
}
.login-head {
  text-align: center;
  margin-bottom: 1.4rem;
}
.login-head .logo-wrap {
  width: 68px;
  height: 68px;
  margin: 0 auto .8rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
}
.login-head .logo-wrap img.logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.25));
  transition: transform .25s ease;
}
.login-head .logo-wrap img.logo:hover {
  transform: scale(1.08) rotate(-3deg);
}
.login-head h1 { font-size: 1.4rem; margin-bottom: .2rem; }
.login-head p { color: var(--muted); margin: 0; font-size: .92rem; }

/* Formal & Interactive Greeting Card */
.login-greeting-box {
  background: linear-gradient(135deg, rgba(var(--p-rgb), .08), rgba(var(--p-rgb), .02));
  border: 1px solid rgba(var(--p-rgb), .18);
  border-radius: 14px;
  padding: .95rem 1.1rem;
  margin-bottom: 1.3rem;
  text-align: left;
  position: relative;
  transition: all .25s ease;
}
.login-greeting-box:hover {
  border-color: rgba(var(--p-rgb), .35);
  box-shadow: 0 4px 14px rgba(var(--p-rgb), .08);
}
.greeting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .5rem;
}
.live-time-pill {
  font-size: .78rem;
  font-weight: 700;
  color: var(--p-dark);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: rgba(255, 255, 255, .8);
  padding: .2rem .55rem;
  border-radius: 20px;
  border: 1px solid rgba(var(--p-rgb), .2);
}
.live-time-pill svg { width: 14px; height: 14px; color: var(--p); }
.sec-pill {
  font-size: .74rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-weight: 500;
}
.sec-pill svg { width: 13px; height: 13px; color: #16a34a; }
.greeting-text {
  font-size: .86rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}

/* Caps Lock Warning */
.caps-warning {
  margin-top: .4rem;
  padding: .4rem .7rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: #b45309;
  font-size: .78rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  animation: fadeIn .2s ease;
}
.caps-warning svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Help & Assistance Section */
.login-help-section {
  margin-top: 1.2rem;
  border-top: 1px solid var(--border);
  padding-top: .9rem;
}
.login-help-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  padding: .3rem;
  transition: color .2s ease;
}
.login-help-btn:hover { color: var(--p); }
.login-help-btn svg.help-chev {
  width: 14px;
  height: 14px;
  transition: transform .25s ease;
}
.login-help-btn[aria-expanded="true"] svg.help-chev {
  transform: rotate(180deg);
}
.login-help-content {
  margin-top: .6rem;
  padding: .75rem .9rem;
  background: var(--p-soft);
  border-radius: 10px;
  font-size: .8rem;
  line-height: 1.5;
  color: var(--text);
  text-align: left;
  border: 1px solid rgba(var(--p-rgb), .15);
  animation: fadeIn .25s ease;
}
.login-help-content p { margin: 0; }
.login-help-content b { color: var(--p-dark); }

.input-icon-wrap {
  position: relative;
}
.input-icon-wrap .input-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.input-icon-wrap input {
  padding-left: 2.6rem;
}
.toggle-pass-label {
  font-size: .82rem;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.btn-login {
  margin-top: .6rem;
  padding: .85rem 1.4rem;
  font-size: 1rem;
  border-radius: 12px;
}
.login-foot {
  text-align: center;
  margin-top: 1.4rem;
  font-size: .9rem;
}
.login-foot a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--muted);
}
.login-foot a:hover { color: var(--p); }

.flash-input {
  animation: flashInput .6s ease;
  border-color: var(--p) !important;
  box-shadow: 0 0 0 4px rgba(var(--p-rgb), .25) !important;
}
@keyframes flashInput {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* Textarea Alignment Toolbar */
.textarea-align-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: .5rem;
  padding: .5rem .75rem;
  background: var(--p-soft);
  border: 1px solid rgba(var(--p-rgb), .18);
  border-radius: 10px;
}
.textarea-align-toolbar .align-lbl {
  font-size: .8rem;
  font-weight: 700;
  color: var(--p-dark);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.textarea-align-toolbar .align-lbl svg { width: 14px; height: 14px; color: var(--p); }
.align-btn-group {
  display: inline-flex;
  gap: .3rem;
  background: rgba(255, 255, 255, .85);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.btn-align-pill {
  border: 0;
  background: none;
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  padding: .35rem .65rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  transition: all .18s ease;
}
.btn-align-pill svg { width: 14px; height: 14px; }
.btn-align-pill:hover {
  color: var(--p);
  background: rgba(var(--p-rgb), .08);
}
.btn-align-pill.active {
  color: #ffffff !important;
  background: var(--p) !important;
  box-shadow: 0 2px 6px rgba(var(--p-rgb), .35);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* APBDes Admin Matrix & Hero */
.apbdes-admin-hero {
  background: linear-gradient(135deg, rgba(var(--p-rgb), .06), rgba(var(--p-rgb), .02));
  border: 1px solid rgba(var(--p-rgb), .2);
  border-radius: 16px;
}
.stat-pill-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem 1.1rem;
}
.stat-pill-box .lbl {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: .25rem;
}
.stat-pill-box .val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-pill-box .sub {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-top: .3rem;
}

/* Matrix Table Inputs */
.matrix-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.5rem;
}
.matrix-actions-top {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
}
.year-select-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.year-select-wrap select {
  padding: .4rem .8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-weight: 700;
  background: #fff;
}

.matrix-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: .4rem .6rem;
  border-radius: 6px;
  font: inherit;
  font-size: .92rem;
  transition: all .15s ease;
}
.matrix-input:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.matrix-input:focus {
  background: #ffffff;
  border-color: var(--p);
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--p-rgb), .2);
}
.num-input {
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
}
.btn-del-row {
  border: 0;
  background: none;
  color: #ef4444;
  cursor: pointer;
  padding: .35rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .6;
  transition: all .15s ease;
}
.btn-del-row:hover {
  opacity: 1;
  background: #fee2e2;
}
.btn-del-row svg { width: 15px; height: 15px; }

.matrix-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.5rem;
  position: sticky;
  bottom: 1rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .05);
  z-index: 10;
}
.btn-save-matrix {
  padding: .75rem 1.4rem;
  font-size: .95rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .side { transform: translateX(-105%); box-shadow: 10px 0 30px rgba(0, 0, 0, .2); }
  .side.show { transform: none; }
  .side-scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 55; opacity: 0; visibility: hidden; transition: .2s; }
  .side-scrim.show { opacity: 1; visibility: visible; }
  .main { margin-left: 0; }
  .admin .burger { display: grid; place-items: center; }
  .hide-sm { display: none; }
  .atop { padding: .65rem 1.1rem; }
  .content { padding: 1.1rem; }
  .atop .themes .lbl { display: none; }
}
