:root {
  --bg-dark: #090D16;
  --bg-sidebar: #0E1322;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(25, 33, 52, 0.95);
  --bg-input: #151D30;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3B82F6;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-glow: rgba(37, 99, 235, 0.35);
  --accent-gold: #F59E0B;
  --accent-red: #EF4444;
  --accent-green: #10B981;
  --accent-indigo: #6366F1;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.45), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pmesp-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(37, 99, 235, 0.3));
}

.brand-info h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.brand-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 0 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-align: left;
}

.nav-item i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  transition: var(--transition);
}

.nav-item:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: #FFFFFF;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.22) 0%, rgba(37, 99, 235, 0.05) 100%);
  border-left: 3px solid var(--primary);
  font-weight: 700;
}

.nav-item.active i {
  color: #60A5FA;
}

.badge {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.badge-primary {
  background: rgba(37, 99, 235, 0.25);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-accent {
  background: rgba(245, 158, 11, 0.2);
  color: #FCD34D;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid var(--border-color);
  background: rgba(10, 14, 25, 0.7);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  position: relative;
  width: 38px;
  height: 38px;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}

.status-indicator.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

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

.profile-info strong {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.profile-info span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.creator-credit {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
  text-align: center;
}

.creator-credit small {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 600;
}

.main-content {
  margin-left: 270px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-header {
  padding: 24px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.header-left p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #34D399;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.ping-badge {
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  color: #A7F3D0;
  font-family: monospace;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--primary);
  color: #60A5FA;
  transform: translateY(-1px);
}

.content-body {
  padding: 32px 36px;
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

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

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-blue::before { background: #3B82F6; }
.stat-emerald::before { background: #10B981; }
.stat-amber::before { background: #F59E0B; }
.stat-purple::before { background: #A855F7; }
.stat-red::before { background: #EF4444; }
.stat-indigo::before { background: #6366F1; }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.stat-blue .stat-icon { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.stat-emerald .stat-icon { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.stat-amber .stat-icon { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.stat-purple .stat-icon { background: rgba(168, 85, 247, 0.15); color: #C084FC; }
.stat-red .stat-icon { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.stat-indigo .stat-icon { background: rgba(99, 102, 241, 0.15); color: #818CF8; }

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

.stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.dashboard-panels-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.glass-card {
  backdrop-filter: blur(14px);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.card-header.space-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header h3 i {
  color: var(--primary);
}

.card-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.card-body {
  padding: 24px;
}

.card-body.p-0 {
  padding: 0;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.info-item span {
  color: var(--text-muted);
}

.info-item strong {
  color: var(--text-main);
}

.text-success { color: var(--accent-green) !important; }

.quick-dispatch-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.quick-dispatch-grid .btn {
  justify-content: flex-start;
  padding: 12px 16px;
}

.sub-heading {
  font-size: 0.92rem;
  font-weight: 700;
  color: #93C5FD;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.mt-4 { margin-top: 24px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.86rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background-color: rgba(21, 29, 48, 0.95);
}

.form-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

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

.mapping-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mapping-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mapping-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.mapping-desc {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.search-box {
  position: relative;
  width: 300px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.85rem;
}

.search-box input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-tag.on-duty {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-tag.off-duty {
  background: rgba(100, 116, 139, 0.15);
  color: #94A3B8;
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.dispatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.dispatch-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dispatch-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.15);
  color: #60A5FA;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.dispatch-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.dispatch-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.dispatch-action {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.dispatch-action select {
  flex: 1;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); color: #34D399; }
.toast.error { border-color: rgba(239, 68, 68, 0.4); color: #F87171; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1024px) {
  .sidebar { width: 80px; }
  .brand-info, .section-title, .nav-item span, .badge, .profile-info, .creator-credit { display: none; }
  .nav-item { justify-content: center; padding: 14px 0; }
  .main-content { margin-left: 80px; }
  .dashboard-panels-grid { grid-template-columns: 1fr; }
}
