/* ==========================================================================
   SCSNP — Modern 3D Light / Glass & Tactile Elevation Theme
   ออกแบบสำหรับหน้าผู้ดูแลระบบ (Admin Console) และแดชบอร์ด
   ========================================================================== */

:root {
  --3d-bg-top: #f2f6ff;
  --3d-bg-mid: #e8effc;
  --3d-bg-bot: #dde7f9;
  --3d-surface: linear-gradient(168deg, #ffffff 0%, #fafcff 62%, #f1f6fe 100%);
  --3d-border: #cfddf2;
  --3d-ledge: #cddbf1;
  --3d-shadow:
    inset 0 2px 0 #ffffff,
    0 5px 0 var(--3d-ledge),
    0 18px 38px -10px rgba(15, 35, 85, 0.14);
  --3d-shadow-hover:
    inset 0 2px 0 #ffffff,
    0 7px 0 #c5d5ee,
    0 24px 46px -10px rgba(15, 35, 85, 0.2);
  --3d-input-shadow:
    inset 0 2px 5px rgba(15, 35, 85, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    0 1px 0 #ffffff;
}

body.is-admin {
  background:
    radial-gradient(1000px 560px at 95% -5%, rgba(59, 130, 246, 0.22), transparent 60%),
    radial-gradient(850px 480px at -5% 15%, rgba(99, 102, 241, 0.15), transparent 60%),
    linear-gradient(180deg, var(--3d-bg-top) 0%, var(--3d-bg-mid) 50%, var(--3d-bg-bot) 100%) fixed;
}

/* ==========================================================================
   1. 3D ADMIN SHELL (SIDEBAR + MAIN WORKSPACE)
   ========================================================================== */
.admin-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 18px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px 20px 40px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 12px;
  border-radius: 26px;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.96) 0%, rgba(246, 250, 255, 0.94) 60%, rgba(236, 243, 254, 0.96) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #cedcf2;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 6px 0 #cad9f0,
    0 24px 50px -12px rgba(15, 35, 85, 0.18);
  z-index: 30;
}

/* Brand Emblem Pedestal */
.sidebar-brand-3d {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--ink);
  background: linear-gradient(145deg, #1e3a8a 0%, #1d4ed8 55%, #2563eb 100%);
  border: 1px solid #1e40af;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 4px 0 #152c6e,
    0 12px 24px -8px rgba(29, 78, 216, 0.55);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-brand-3d:hover {
  transform: translateY(-1px);
}

.brand-orb-3d {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 14px;
  padding: 4px;
  background: linear-gradient(180deg, #ffffff 0%, #e6effe 100%);
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 3px 0 #93c5fd,
    0 6px 14px rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
}

.brand-orb-3d img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.brand-meta {
  min-width: 0;
  color: #ffffff;
}

.brand-tag-3d {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.2);
  color: #dbeafe;
  border: 1px solid rgba(255, 255, 255, 0.28);
  margin-bottom: 2px;
}

.brand-meta b {
  display: block;
  font-size: 0.94rem;
  line-height: 1.2;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-meta small {
  display: block;
  font-size: 0.74rem;
  color: #bfdbfe;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Navigation */
.sidebar-nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2px 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}

.nav-group-3d {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group-label {
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0 10px 1px;
}

.nav-item-3d {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 14px;
  text-decoration: none;
  color: #1e293b;
  font-weight: 600;
  font-size: 0.89rem;
  background: transparent;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.nav-item-3d:hover:not(.active) {
  background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
  border-color: #d5e2f6;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 3px 0 #d5e2f6,
    0 8px 16px -6px rgba(15, 35, 85, 0.12);
  color: #1d4ed8;
}

.nav-item-3d.active {
  background: linear-gradient(160deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
  color: #ffffff;
  border-color: #1e40af;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.38),
    0 4px 0 #17369e,
    0 12px 22px -6px rgba(37, 99, 235, 0.55);
  transform: translateY(-1px);
}

.nav-item-3d.active:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 1px 0 #17369e;
}

/* 3D Squircle Icons inside Sidebar */
.nav-icon-3d {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(160deg, #60a5fa, #2563eb);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.45),
    0 2.5px 0 #1e40af,
    0 5px 10px -3px rgba(37, 99, 235, 0.45);
}

.nav-icon-3d svg {
  width: 16px;
  height: 16px;
}

.nav-icon-3d.indigo { background: linear-gradient(160deg, #818cf8, #4f46e5); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), 0 3px 0 #3730a3; }
.nav-icon-3d.crimson { background: linear-gradient(160deg, #f87171, #dc2626); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), 0 3px 0 #991b1b; }
.nav-icon-3d.cyan { background: linear-gradient(160deg, #22d3ee, #0891b2); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), 0 3px 0 #155e75; }
.nav-icon-3d.emerald { background: linear-gradient(160deg, #34d399, #059669); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), 0 3px 0 #065f46; }
.nav-icon-3d.purple { background: linear-gradient(160deg, #c084fc, #9333ea); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), 0 3px 0 #6b21a8; }
.nav-icon-3d.amber { background: linear-gradient(160deg, #fbbf24, #d97706); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), 0 3px 0 #92400e; }
.nav-icon-3d.slate { background: linear-gradient(160deg, #94a3b8, #475569); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), 0 3px 0 #1e293b; }
.nav-icon-3d.sky { background: linear-gradient(160deg, #38bdf8, #0284c7); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), 0 3px 0 #075985; }
.nav-icon-3d.rose { background: linear-gradient(160deg, #fb7185, #e11d48); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), 0 3px 0 #9f1239; }

.nav-item-3d.active .nav-icon-3d {
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 2px 4px rgba(0, 0, 0, 0.15);
}

.nav-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ext-pill {
  font-size: 0.75rem;
  opacity: 0.65;
}

.badge-3d {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 0 #991b1b;
}

.badge-3d.pulse {
  animation: pinPulse 1.8s infinite;
}

/* Sidebar User Card */
.sidebar-user-3d {
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f6fe 100%);
  border: 1px solid #d2dff3;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 4px 0 #cbd9ef;
}

.user-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.user-avatar-3d {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.98rem;
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    0 3px 0 #1e3a8a;
  flex: none;
}

.user-meta {
  min-width: 0;
}

.user-meta b {
  display: block;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.user-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.user-card-actions .btn,
.user-card-actions form .btn {
  width: 100%;
  justify-content: center;
}

/* ==========================================================================
   2. 3D TOPBAR & MAIN COLUMN
   ========================================================================== */
.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-topbar {
  position: sticky;
  top: 18px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid #d1dff3;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 5px 0 #cddbf1,
    0 16px 34px -12px rgba(15, 35, 85, 0.15);
}

.mobile-brand,
.mobile-who {
  display: none;
}

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

.topbar-context-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(160deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  box-shadow: inset 0 2px 0 #ffffff, 0 3px 0 #bfdbfe;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  flex: none;
}

.topbar-title {
  display: block;
  font-size: 1.05rem;
  color: #0b1b3a;
  line-height: 1.25;
}

.topbar-sub {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

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

.clock-pill-3d,
.status-pill-3d {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(180deg, #ffffff 0%, #f1f6fe 100%);
  border: 1px solid #d0def2;
  color: #1e293b;
  box-shadow: inset 0 1.5px 0 #ffffff, 0 3px 0 #cddbf1;
  white-space: nowrap;
}

.clock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22);
}

.status-pill-3d.ok {
  color: #15803d;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
  box-shadow: inset 0 1.5px 0 #ffffff, 0 3px 0 #a7f3d0;
}

.status-pill-3d.off {
  color: #64748b;
}

.admin-wrap {
  width: 100%;
  max-width: 100%;
  padding: 0;
  gap: 18px;
}

/* ==========================================================================
   3. 3D SURFACES, CARDS, BUTTONS & INPUTS
   ========================================================================== */
.card-3d,
.is-admin .card {
  background: var(--3d-surface);
  border: 1px solid var(--3d-border);
  border-radius: 22px;
  padding: 20px 22px;
  box-shadow: var(--3d-shadow);
  position: relative;
}

.card-3d-editing {
  border: 2px solid #f59e0b !important;
  background: linear-gradient(168deg, #fffbeb 0%, #ffffff 50%, #fef3c7 100%) !important;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 6px 0 #fcd34d,
    0 20px 42px -12px rgba(217, 119, 6, 0.22) !important;
}

.card-3d-alert {
  border: 2px solid #f87171 !important;
  background: linear-gradient(168deg, #fff5f5 0%, #ffffff 60%, #fee2e2 100%) !important;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 6px 0 #fca5a5,
    0 20px 42px -12px rgba(220, 38, 38, 0.22) !important;
}

/* Section Title with 3D Orb */
.section-title-3d {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title-3d h1,
.section-title-3d h2 {
  margin: 0;
}

.title-orb-3d {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: #ffffff;
  background: linear-gradient(150deg, #60a5fa 0%, #2563eb 60%, #1d4ed8 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 4px 0 #1e3a8a,
    0 10px 20px -6px rgba(37, 99, 235, 0.5);
}

.title-orb-3d.indigo {
  background: linear-gradient(150deg, #818cf8 0%, #4f46e5 65%, #3730a3 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 #312e81, 0 10px 20px -6px rgba(79, 70, 229, 0.5);
}

.title-orb-3d.emerald {
  background: linear-gradient(150deg, #34d399 0%, #10b981 60%, #059669 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 #065f46, 0 10px 20px -6px rgba(16, 185, 129, 0.5);
}

.title-orb-3d.crimson {
  background: linear-gradient(150deg, #f87171 0%, #ef4444 60%, #dc2626 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 #991b1b, 0 10px 20px -6px rgba(220, 38, 38, 0.5);
}

.title-orb-3d.amber {
  background: linear-gradient(150deg, #fbbf24 0%, #f59e0b 60%, #d97706 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 #92400e, 0 10px 20px -6px rgba(245, 158, 11, 0.5);
}

.title-orb-3d.cyan {
  background: linear-gradient(150deg, #22d3ee 0%, #0891b2 60%, #0e7490 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 #155e75, 0 10px 20px -6px rgba(8, 145, 178, 0.5);
}

/* 3D Tactile Buttons */
.btn {
  border-radius: 13px;
  border: 1px solid #c6d6ee;
  background: linear-gradient(180deg, #ffffff 0%, #f0f5fe 100%);
  color: #0f172a;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 4px 0 #c2d3ec,
    0 8px 16px -6px rgba(15, 35, 85, 0.14);
  transition: transform 0.1s ease, box-shadow 0.12s ease, filter 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffffff 0%, #e6effe 100%);
  border-color: #b4c9ea;
  transform: translateY(-1px);
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 5px 0 #b8cBe8,
    0 12px 20px -6px rgba(15, 35, 85, 0.18);
}

.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 1px 0 #c2d3ec,
    0 3px 6px -2px rgba(15, 35, 85, 0.12);
}

.btn.primary {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
  border-color: #1e40af;
  color: #ffffff;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.38),
    0 4px 0 #17369e,
    0 10px 22px -6px rgba(37, 99, 235, 0.6);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #4f8ff7 0%, #2563eb 55%, #1e40af 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.42),
    0 5px 0 #17369e,
    0 14px 26px -6px rgba(37, 99, 235, 0.7);
}

.btn.primary:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 1px 0 #17369e;
}

.btn.danger {
  background: linear-gradient(180deg, #f87171 0%, #ef4444 50%, #dc2626 100%);
  border-color: #b91c1c;
  color: #ffffff;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.36),
    0 4px 0 #991b1b,
    0 10px 20px -6px rgba(220, 38, 38, 0.55);
}

.btn.danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #fca5a5 0%, #ef4444 50%, #b91c1c 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    0 5px 0 #991b1b,
    0 14px 24px -6px rgba(220, 38, 38, 0.65);
}

.btn.danger:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 0 #991b1b;
}

.btn.success {
  background: linear-gradient(180deg, #34d399 0%, #10b981 55%, #059669 100%);
  border-color: #047857;
  color: #ffffff;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.38),
    0 4px 0 #065f46,
    0 10px 20px -6px rgba(16, 185, 129, 0.5);
}

.btn.success:hover:not(:disabled) {
  background: linear-gradient(180deg, #6ee7b7 0%, #10b981 55%, #047857 100%);
}

.btn.success:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 0 #065f46;
}

.btn.small {
  padding: 5px 11px;
  border-radius: 10px;
  box-shadow:
    inset 0 1.5px 0 #ffffff,
    0 3px 0 #c2d3ec,
    0 6px 12px -4px rgba(15, 35, 85, 0.12);
}

.btn.small.primary {
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.38), 0 3px 0 #17369e, 0 6px 14px -4px rgba(37, 99, 235, 0.5);
}

.btn.small.danger {
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.36), 0 3px 0 #991b1b, 0 6px 14px -4px rgba(220, 38, 38, 0.45);
}

.btn.small.success {
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.36), 0 3px 0 #065f46, 0 6px 14px -4px rgba(16, 185, 129, 0.45);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* 3D Recessed Inputs */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  border-radius: 12px;
  border: 1px solid #c7d6ed;
  background: linear-gradient(180deg, #f6f9ff 0%, #ffffff 100%);
  box-shadow: var(--3d-input-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  background: #ffffff;
  box-shadow:
    inset 0 2px 4px rgba(37, 99, 235, 0.06),
    0 0 0 4px rgba(37, 99, 235, 0.16);
}

/* 3D Chips */
.chip {
  border-radius: 999px;
  padding: 3px 11px;
  font-weight: 700;
  border: 1px solid #d5e1f2;
  background: linear-gradient(180deg, #ffffff 0%, #edf3fc 100%);
  box-shadow: inset 0 1px 0 #ffffff, 0 2px 0 #d4e0f2;
}

.chip.ok {
  background: linear-gradient(180deg, #ecfdf5 0%, #dcfce7 100%);
  border-color: #a7f3d0;
  color: #15803d;
  box-shadow: inset 0 1px 0 #ffffff, 0 2px 0 #a7f3d0;
}

.chip.bad {
  background: linear-gradient(180deg, #fff1f2 0%, #fee2e2 100%);
  border-color: #fecaca;
  color: #b91c1c;
  box-shadow: inset 0 1px 0 #ffffff, 0 2px 0 #fecaca;
}

.chip.warn {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fde68a;
  color: #92400e;
  box-shadow: inset 0 1px 0 #ffffff, 0 2px 0 #fde68a;
}

/* Flash 3D */
.flash-3d {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 600;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.7),
    0 4px 0 #a7f3d0,
    0 12px 24px -8px rgba(22, 163, 74, 0.25);
}

.flash-3d.error {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.7),
    0 4px 0 #fca5a5,
    0 12px 24px -8px rgba(220, 38, 38, 0.25);
}

/* ==========================================================================
   4. 3D HERO COMMAND BANNER & KPI CARDS
   ========================================================================== */
.hero-3d {
  background:
    radial-gradient(420px 260px at 88% 20%, rgba(147, 197, 253, 0.35), transparent 70%),
    linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 48%, #2563eb 82%, #3b82f6 100%) !important;
  border: 1px solid #1e40af !important;
  border-radius: 26px !important;
  padding: 24px 26px !important;
  color: #ffffff !important;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 7px 0 #152c6e,
    0 24px 48px -12px rgba(29, 78, 216, 0.55) !important;
}

.hero-3d-main {
  width: 100%;
  position: relative;
  z-index: 2;
}

.hero-greeting-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 0.86rem;
  color: #eff6ff;
}

.greeting-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3);
}

.view-switch-3d {
  background: rgba(15, 23, 42, 0.28);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

.view-switch-3d a.chip {
  border: 0;
  box-shadow: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  padding: 5px 13px;
}

.view-switch-3d a.chip.active {
  background: linear-gradient(180deg, #ffffff 0%, #e0ecff 100%);
  color: #1e3a8a;
  box-shadow: 0 2px 0 #93c5fd, 0 4px 10px rgba(0, 0, 0, 0.22);
}

.hero-headline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 8px 0 12px;
}

.hero-headline-row h1 {
  font-size: 2rem;
  margin: 0 0 4px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
}

.hero-sub {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.86);
}

/* 3D Circular Progress Ring inside Hero */
.hero-ring-3d {
  width: 94px;
  height: 94px;
  flex: none;
  border-radius: 50%;
  padding: 9px;
  background: conic-gradient(#4ade80 calc(var(--pct, 0) * 1%), rgba(255, 255, 255, 0.2) 0);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.35),
    0 5px 0 rgba(15, 23, 42, 0.35),
    0 12px 24px rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
}

.hero-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(160deg, #1e3a8a, #172554);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
}

.hero-ring-inner b {
  font-size: 1.15rem;
  color: #ffffff;
}

.hero-ring-inner small {
  font-size: 0.66rem;
  color: #93c5fd;
}

.progress-3d {
  height: 13px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.32) !important;
  padding: 2px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.2);
}

.progress-3d span {
  background: linear-gradient(90deg, #4ade80 0%, #a7f3d0 50%, #ffffff 100%) !important;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.6);
}

.btn-hero-scan {
  background: linear-gradient(180deg, #ffffff 0%, #e0ecff 100%) !important;
  color: #1e3a8a !important;
  border-color: #ffffff !important;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 4px 0 #93c5fd,
    0 12px 24px -6px rgba(0, 0, 0, 0.35) !important;
}

.btn-hero-glass {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.32) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 0 rgba(15, 23, 42, 0.3) !important;
}

.btn-hero-glass:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

/* 3D KPI Cards Grid */
.kpi-grid-3d {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card-3d {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(165deg, #ffffff 0%, #f8fbff 65%, #eef4fe 100%);
  border: 1px solid #d0def3;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 5px 0 #cad9f0,
    0 14px 30px -10px rgba(15, 35, 85, 0.13);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card-3d:hover {
  transform: translateY(-2px);
  box-shadow: var(--3d-shadow-hover);
}

.kpi-icon-3d {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  background: linear-gradient(150deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 4px 0 #93c5fd,
    0 8px 16px -6px rgba(37, 99, 235, 0.35);
}

.kpi-card-3d.indigo .kpi-icon-3d {
  background: linear-gradient(150deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #c7d2fe;
  box-shadow: inset 0 2px 0 #ffffff, 0 4px 0 #a5b4fc;
}

.kpi-card-3d.emerald .kpi-icon-3d {
  background: linear-gradient(150deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #a7f3d0;
  box-shadow: inset 0 2px 0 #ffffff, 0 4px 0 #6ee7b7;
}

.kpi-card-3d.crimson {
  border-color: #fecaca;
  background: linear-gradient(165deg, #ffffff 0%, #fff5f5 70%, #fee2e2 100%);
  box-shadow: inset 0 2px 0 #ffffff, 0 5px 0 #fca5a5, 0 14px 30px -10px rgba(220, 38, 38, 0.18);
}

.kpi-card-3d.crimson .kpi-icon-3d {
  background: linear-gradient(150deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fecaca;
  box-shadow: inset 0 2px 0 #ffffff, 0 4px 0 #fca5a5;
}

.kpi-card-3d.amber .kpi-icon-3d {
  background: linear-gradient(150deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fde68a;
  box-shadow: inset 0 2px 0 #ffffff, 0 4px 0 #fcd34d;
}

.kpi-body {
  min-width: 0;
  flex: 1;
}

.kpi-body small {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.kpi-body strong {
  display: block;
  font-size: 1.55rem;
  font-weight: 800;
  color: #0b1b3a;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-card-3d.crimson .kpi-body strong {
  color: #b91c1c;
}

.kpi-unit {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
}

.kpi-tag {
  display: block;
  font-size: 0.75rem;
  color: #475569;
  margin-top: 2px;
}

.kpi-tag a {
  text-decoration: none;
  font-weight: 700;
}

/* ==========================================================================
   5. DASHBOARD & REPORTS GRIDS, CHECKPOINT ORBS, TIMELINE FEED
   ========================================================================== */
.dashboard-cols-3d,
.reports-dual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.points-3d li {
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  border: 1px solid #d5e2f4;
  box-shadow: inset 0 1.5px 0 #ffffff, 0 3px 0 #d5e2f4;
  transition: transform 0.12s ease;
}

.points-3d li:hover {
  transform: translateY(-1px);
}

.points-3d li.done {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
  box-shadow: inset 0 1.5px 0 #ffffff, 0 3px 0 #bbf7d0;
}

.points-3d li.alert {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff5f5 0%, #fee2e2 100%);
  box-shadow: inset 0 1.5px 0 #ffffff, 0 3px 0 #fca5a5;
}

.orb-status-3d {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #64748b;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  box-shadow: inset 0 1.5px 0 #ffffff, 0 2px 0 #cbd5e1;
}

.points-3d li.done .orb-status-3d {
  color: #ffffff;
  background: linear-gradient(160deg, #22c55e, #15803d);
  border-color: #166534;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.45), 0 3px 0 #14532d;
}

.points-3d li.alert .orb-status-3d {
  color: #ffffff;
  background: linear-gradient(160deg, #ef4444, #b91c1c);
  border-color: #991b1b;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.45), 0 3px 0 #7f1d1d;
}

/* Feed Tabs & List */
.feed-tabs-3d {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #e6eefc;
  border: 1px solid #cedcf2;
  box-shadow: inset 0 2px 4px rgba(15, 35, 85, 0.08);
}

.feed-tab-btn {
  border: 0;
  border-radius: 9px;
  padding: 5px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  background: transparent;
  cursor: pointer;
}

.feed-tab-btn.active {
  background: linear-gradient(180deg, #ffffff 0%, #f0f5ff 100%);
  color: #1d4ed8;
  box-shadow: 0 2px 0 #c2d3ec, 0 4px 8px rgba(15, 35, 85, 0.1);
}

.list-3d a {
  border-radius: 15px;
  padding: 11px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #d5e2f4;
  box-shadow: inset 0 1.5px 0 #ffffff, 0 3px 0 #d5e2f4;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.list-3d a:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  background: #ffffff;
}

.time-pill-3d {
  padding: 4px 10px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 0.84rem;
  color: #1d4ed8;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  box-shadow: inset 0 1px 0 #ffffff, 0 2px 0 #bfdbfe;
}

.time-pill-3d.bad {
  color: #b91c1c;
  background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fecaca;
  box-shadow: inset 0 1px 0 #ffffff, 0 2px 0 #fca5a5;
}

/* Empty State 3D */
.empty-state-3d {
  text-align: center;
  padding: 32px 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #f0f5fe 100%);
  border: 1.5px dashed #c5d6ef;
}

.empty-state-3d.compact {
  padding: 22px 16px;
}

.empty-orb {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #d2e0f5;
  box-shadow: inset 0 2px 0 #ffffff, 0 4px 0 #cddbf1;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
}

/* ==========================================================================
   6. 3D TABLES, MAP FRAME, QR BOXES & DOSSIER
   ========================================================================== */
.filters-3d {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f4f8ff 0%, #ebf2fe 100%);
  border: 1px solid #d0def3;
  box-shadow: inset 0 2px 4px rgba(15, 35, 85, 0.05), 0 1px 0 #ffffff;
  margin-top: 12px;
}

.filter-btns-3d {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.filter-btns-3d .btn {
  margin-bottom: 0;
}

.map-ctrls-3d {
  padding: 10px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f6f9ff 0%, #edf3fe 100%);
  border: 1px solid #d2e0f4;
  margin-top: 10px;
}

.map-select-pill {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
}

.map-select-pill select {
  width: auto;
  padding: 5px 12px;
  font-size: 0.88rem;
  min-height: 36px;
}

.map-check-pill {
  margin: 0;
  padding: 5px 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #d4e1f4;
  box-shadow: 0 2px 0 #d4e1f4;
  font-size: 0.86rem;
  cursor: pointer;
}

.map-check-pill input {
  width: 16px;
  height: 16px;
}

.map-frame-3d {
  padding: 6px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #e6eefc 100%);
  border: 1px solid #c7d7ef;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 5px 0 #c5d5ee,
    0 14px 28px -8px rgba(15, 35, 85, 0.16);
}

.table-3d th {
  background: linear-gradient(180deg, #f4f8ff 0%, #e9f0fd 100%);
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 9px 8px;
  border-bottom: 2px solid #d0def2;
  white-space: nowrap;
}

.table-3d th:first-child { border-top-left-radius: 12px; }
.table-3d th:last-child { border-top-right-radius: 12px; }

.table-3d td {
  padding: 9px 8px;
  vertical-align: middle;
  word-break: normal;
  overflow-wrap: normal;
}

.table-3d .chip {
  padding: 2px 8px;
  font-size: 0.78rem;
}

.row-link-3d {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  text-decoration: none;
  white-space: nowrap;
}

.row-link-3d:hover {
  background: #dbeafe;
}

/* Mini Coverage Bar in Guard Table */
.mini-cov-wrap {
  display: grid;
  gap: 4px;
  min-width: 85px;
  max-width: 140px;
}

.mini-cov-wrap span {
  white-space: nowrap;
}

.mini-bar {
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.mini-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #10b981);
}

/* QR Code 3D Frame */
.qr-box-3d {
  display: inline-block;
  padding: 6px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #cedcf2;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 4px 0 #cad9f0,
    0 8px 16px -4px rgba(15, 35, 85, 0.15);
  transition: transform 0.15s ease;
}

.qr-box-3d:hover {
  transform: scale(1.06) translateY(-2px);
}

.order-badge-3d {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border-radius: 10px;
  font-weight: 800;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  flex-shrink: 0;
  background: linear-gradient(180deg, #ffffff 0%, #edf3fc 100%);
  border: 1px solid #cedcf2;
  box-shadow: 0 2px 0 #cedcf2;
}

.token-pill {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.75rem;
  background: #f1f5f9;
  color: #64748b;
  white-space: nowrap;
}

.gps-link-pill {
  display: inline-block;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.row-actions-3d {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* User Table Avatar */
.user-cell-3d {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.user-cell-3d b,
.user-cell-3d small,
.guard-name-badge {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.guard-name-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.avatar-mini-3d {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.4), 0 3px 0 #1e3a8a;
}

.avatar-mini-3d.admin {
  background: linear-gradient(145deg, #f59e0b, #d97706);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.4), 0 3px 0 #92400e;
}

/* Toggle Box 3D */
.toggle-box-3d {
  padding: 13px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1.5px solid #86efac;
  box-shadow: inset 0 2px 0 #ffffff, 0 3px 0 #86efac;
}

.info-callout-3d {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 15px;
  background: linear-gradient(180deg, #eff6ff 0%, #e0ecff 100%);
  border: 1px solid #bfdbfe;
  box-shadow: inset 0 1.5px 0 #ffffff, 0 3px 0 #bfdbfe;
  margin-top: 8px;
}

.settings-studio-3d {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Dossier Detail Layout (Report Detail & Incident Detail) */
.dossier-grid-3d {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
  margin-top: 14px;
  align-items: start;
}

.sub-head-3d {
  font-size: 1rem;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid #dbe6f6;
  color: #1e3a8a;
}

.info-3d {
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #eff5fe 100%);
  border: 1px solid #d4e2f5;
  box-shadow: inset 0 2px 4px rgba(15, 35, 85, 0.04);
}

.photo-frame-3d {
  position: relative;
  display: block;
  padding: 6px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #cedcf2;
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 5px 0 #c6d6ee,
    0 14px 28px -8px rgba(15, 35, 85, 0.18);
  overflow: hidden;
  transition: transform 0.15s ease;
}

.photo-frame-3d:hover {
  transform: translateY(-3px);
}

.photo-frame-3d img {
  border-radius: 13px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.photo-badge-3d {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
}

/* 3D Modal Dialog */
.modal-3d {
  border: 1px solid #cedcf2;
  border-radius: 24px;
  padding: 0;
  width: min(440px, 92vw);
  background: linear-gradient(168deg, #ffffff 0%, #f4f8ff 100%);
  box-shadow:
    inset 0 2px 0 #ffffff,
    0 6px 0 #c5d5ee,
    0 28px 60px rgba(15, 30, 70, 0.32);
  color: var(--ink);
}

.modal-3d::backdrop {
  background: rgba(10, 20, 50, 0.55);
  backdrop-filter: blur(6px);
}

.modal-3d-body {
  padding: 22px;
}

/* Pager 3D */
.pager-3d .pager-pill {
  padding: 7px 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #d0def2;
  box-shadow: 0 3px 0 #d0def2;
  font-size: 0.9rem;
}

/* ==========================================================================
   7. RESPONSIVE BREAKPOINTS (TABLET & MOBILE)
   ========================================================================== */
@media (max-width: 1120px) {
  .kpi-grid-3d {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-cols-3d,
  .reports-dual-grid,
  .dossier-grid-3d {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .admin-shell {
    grid-template-columns: 1fr;
    padding: 0 0 24px;
    gap: 12px;
  }
  .admin-sidebar {
    display: none !important;
  }
  .admin-topbar {
    position: sticky;
    top: 0;
    border-radius: 0 0 20px 20px;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
  }
  .mobile-brand b {
    display: block;
    font-size: 0.95rem;
    line-height: 1.2;
  }
  .mobile-brand small {
    display: block;
    font-size: 0.75rem;
    color: #2563eb;
    font-weight: 600;
  }
  .topbar-context,
  .clock-pill-3d,
  .status-pill-3d,
  .topbar-cta {
    display: none !important;
  }
  .mobile-who {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    color: #1d4ed8;
  }
  .admin-wrap {
    padding: 0 12px;
  }
  body.is-admin.has-nav {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }
  body.is-admin .bottom-nav {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px rgba(15, 30, 70, 0.08);
  }
  body.is-admin .sheet[open] {
    display: block;
  }
  /* Hide floating scan button on desktop when sidebar has it, or on mobile where bottom-nav has it */
  .fab {
    display: none !important;
  }
}

@media (min-width: 961px) {
  body.is-admin .fab {
    display: none !important;
  }
  body.is-admin .bottom-nav {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .kpi-grid-3d {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .kpi-card-3d {
    padding: 12px;
    gap: 10px;
    border-radius: 16px;
  }
  .kpi-icon-3d {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    border-radius: 12px;
  }
  .kpi-body strong {
    font-size: 1.25rem;
  }
  .hero-headline-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-headline-row h1 {
    font-size: 1.55rem;
  }
  .hero-ring-3d {
    display: none;
  }
  .card-3d,
  .is-admin .card {
    padding: 15px;
    border-radius: 18px;
  }
}

/* ==========================================================================
   8. GUARD INSPECTION STATISTICS DASHBOARD (DAILY & MONTHLY)
   ========================================================================== */
.dash-section-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dash-section-stack[hidden] {
  display: none !important;
}

.dash-mode-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  margin-top: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #e8f0fe 0%, #dde8fc 100%);
  border: 1px solid #cad9f2;
  box-shadow: inset 0 2px 4px rgba(15, 35, 85, 0.08);
}

.dash-tab-btn {
  flex: 1 1 auto;
  border: 0;
  border-radius: 12px;
  padding: 9px 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
  background: transparent;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.dash-tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.65);
  color: #1d4ed8;
}

.dash-tab-btn.active {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 60%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.4),
    0 3px 0 #1e3a8a,
    0 8px 16px -4px rgba(37, 99, 235, 0.45);
}

.legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Dashboard Filters Grid */
.dash-filters-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 14px !important;
  align-items: end;
}

.dash-filters-grid label {
  margin-bottom: 0 !important;
  min-width: 0;
}

.dash-filters-grid label > span {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-filters-grid .with-btn {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
}

.dash-filters-grid .with-btn input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
}

.dash-filters-grid .filter-btns-3d {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

/* Daily Bar Chart (1 .. 31) */
.daily-chart-scroll {
  overflow-x: auto;
  padding: 10px 4px 6px;
}

.daily-bars-grid {
  display: grid;
  grid-template-columns: repeat(var(--days-count, 30), minmax(28px, 1fr));
  gap: 5px;
  align-items: end;
  min-width: 920px;
  padding: 12px 12px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f6f9ff 0%, #edf4ff 100%);
  border: 1px solid #d2e0f5;
  box-shadow: inset 0 2px 5px rgba(15, 35, 85, 0.05);
}

.day-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease;
}

.day-bar-col:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: #bfdbfe;
  transform: translateY(-2px);
}

.day-bar-col.selected {
  background: linear-gradient(180deg, #ffffff 0%, #dbeafe 100%);
  border-color: #3b82f6;
  box-shadow: 0 3px 0 #93c5fd, 0 6px 14px -4px rgba(37, 99, 235, 0.28);
}

.day-bar-val {
  font-size: 0.72rem;
  font-weight: 800;
  color: #1d4ed8;
  min-height: 1.1em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.day-bar-track {
  width: 16px;
  height: 120px;
  border-radius: 999px;
  background: #e2e8f0;
  display: flex;
  align-items: flex-end;
  padding: 2px;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.12);
}

.day-bar-fill {
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 65%, #1d4ed8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: height 0.25s ease;
}

.day-bar-col:not(.has-data) .day-bar-fill {
  background: #cbd5e1;
  opacity: 0.45;
}

.day-bar-fill.alert {
  background: linear-gradient(180deg, #fbbf24 0%, #ef4444 75%, #b91c1c 100%);
}

.day-bar-num {
  font-size: 0.78rem;
  font-weight: 800;
  color: #1e293b;
  white-space: nowrap;
}

.day-bar-col.selected .day-bar-num {
  color: #1d4ed8;
}

.day-bar-guards {
  font-size: 0.66rem;
  color: #64748b;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

/* 12-Month Yearly Bar Chart */
.yearly-bars-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(56px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding: 14px 12px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f6f9ff 0%, #edf4ff 100%);
  border: 1px solid #d2e0f5;
  box-shadow: inset 0 2px 5px rgba(15, 35, 85, 0.05);
}

.month-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease;
}

.month-bar-col:hover {
  background: #ffffff;
  border-color: #bfdbfe;
  transform: translateY(-2px);
}

.month-bar-col.selected {
  background: linear-gradient(180deg, #ffffff 0%, #e0e7ff 100%);
  border-color: #4f46e5;
  box-shadow: 0 3px 0 #a5b4fc, 0 6px 14px -4px rgba(79, 70, 229, 0.28);
}

.month-track {
  width: 24px;
  height: 110px;
}

.month-bar-label {
  font-size: 0.84rem;
  color: #1e293b;
  white-space: nowrap;
}

/* Hourly Breakdown */
.shift-summary-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.shift-summary-pills.three-shifts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.shift-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  border: 1px solid #d4e1f4;
  white-space: nowrap;
}

.shift-pill b {
  white-space: nowrap;
  flex-shrink: 0;
}

.shift-pill.day,
.shift-pill.morning {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fde68a;
  color: #92400e;
}

.shift-pill.afternoon {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fed7aa;
  color: #9a3412;
}

.shift-pill.night {
  background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #c7d2fe;
  color: #312e81;
}

.hourly-grid-3d {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 14px;
}

@media (max-width: 1080px) {
  .hourly-grid-3d {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .shift-summary-pills.three-shifts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hourly-grid-3d,
  .shift-summary-pills {
    grid-template-columns: 1fr;
  }
}

.hour-row-3d {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.8rem;
}

.hour-row-3d.has-val {
  background: #ffffff;
  border-color: #cbd5e1;
}

.hour-label {
  width: 42px;
  font-weight: 700;
  color: #475569;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hour-shift-tag {
  font-size: 0.78rem;
  flex-shrink: 0;
}

.hour-bar-track {
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.hour-bar-fill {
  height: 100%;
  border-radius: inherit;
}

.hour-bar-fill.day,
.hour-bar-fill.morning {
  background: linear-gradient(90deg, #f59e0b, #eab308);
}

.hour-bar-fill.afternoon {
  background: linear-gradient(90deg, #f97316, #ea580c);
}

.hour-bar-fill.night {
  background: linear-gradient(90deg, #4f46e5, #2563eb);
}

.hour-cnt {
  min-width: 24px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  white-space: nowrap;
}

/* Matrix Tables (Daily & Monthly Crosstab) */
.matrix-scroll {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid #d0def2;
}

.matrix-table {
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
}

.matrix-table th,
.matrix-table td {
  padding: 7px 5px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #eef2f8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.matrix-table th.num-col,
.matrix-table td.num-col {
  min-width: 30px;
}

.matrix-table th.sticky-col,
.matrix-table td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  text-align: left;
  padding: 9px 12px;
  min-width: 170px;
  background: #ffffff;
  border-right: 2px solid #cbd5e1;
  white-space: nowrap;
}

.matrix-table thead th.sticky-col {
  background: #eef4ff;
  z-index: 4;
}

.matrix-table tfoot td.sticky-col {
  background: #f1f5fe;
}

.matrix-table .num-col a {
  text-decoration: none;
  color: inherit;
  display: inline-block;
}

.matrix-table .sel-col {
  background: #eff6ff !important;
}

.matrix-table thead .sel-col {
  background: #dbeafe !important;
  color: #1d4ed8;
}

.matrix-table .sum-col {
  background: #f8fafc;
  white-space: nowrap;
  padding: 8px 10px;
}

.cnt-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 5px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #1e3a8a;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.cnt-pill.mid {
  background: #bfdbfe;
  border-color: #60a5fa;
  color: #1e3a8a;
}

.cnt-pill.high {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  border-color: #1e40af;
  color: #ffffff !important;
}

.zero-dot {
  color: #cbd5e1;
  font-size: 0.78rem;
}

.tfoot-3d td {
  background: linear-gradient(180deg, #f1f6fe 0%, #e6eefc 100%);
  border-top: 2px solid #c5d6ef;
  font-weight: 700;
  color: #0b1b3a;
}

.order-badge-3d.top1 {
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
  color: #92400e;
  box-shadow: 0 2px 0 #f59e0b;
}

