/* ============================================================
   SIMPAN TROLI — Design System
   ShadCN-inspired monochrome / zinc palette
   Font: Inter via BunnyCDN
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Monochrome Zinc Palette */
  --zinc-50: #fafafa;
  --zinc-100: #f4f4f5;
  --zinc-200: #e4e4e7;
  --zinc-300: #d4d4d8;
  --zinc-400: #a1a1aa;
  --zinc-500: #71717a;
  --zinc-600: #52525b;
  --zinc-700: #3f3f46;
  --zinc-800: #27272a;
  --zinc-900: #18181b;
  --zinc-950: #09090b;

  /* Semantic tokens */
  --background: var(--zinc-50);
  --foreground: var(--zinc-950);
  --card: #ffffff;
  --card-foreground: var(--zinc-950);
  --popover: #ffffff;
  --popover-foreground: var(--zinc-950);
  --primary: var(--zinc-900);
  --primary-foreground: var(--zinc-50);
  --secondary: var(--zinc-100);
  --secondary-foreground: var(--zinc-900);
  --muted: var(--zinc-100);
  --muted-foreground: var(--zinc-500);
  --accent: var(--zinc-100);
  --accent-foreground: var(--zinc-900);
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --success: #22c55e;
  --success-foreground: #ffffff;
  --warning: #f59e0b;
  --warning-foreground: #ffffff;
  --info: #3b82f6;
  --info-foreground: #ffffff;
  --border: var(--zinc-200);
  --input: var(--zinc-200);
  --ring: var(--zinc-950);

  /* Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Shadows */
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow: none;
  --shadow-md: none;
  --shadow-lg: none;

  /* Sidebar */
  --sidebar-width: 256px;
  --sidebar-collapsed: 64px;
  --sidebar-logo-filter: invert(1) brightness(2);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Dark Mode Variables ---------- */
[data-theme="dark"] {
  --background: var(--zinc-950);
  --foreground: var(--zinc-50);
  --card: var(--zinc-900);
  --card-foreground: var(--zinc-50);
  --popover: var(--zinc-900);
  --popover-foreground: var(--zinc-50);
  --primary: var(--zinc-50);
  --primary-foreground: var(--zinc-900);
  --secondary: var(--zinc-800);
  --secondary-foreground: var(--zinc-50);
  --muted: var(--zinc-800);
  --muted-foreground: var(--zinc-400);
  --accent: var(--zinc-800);
  --accent-foreground: var(--zinc-50);
  --destructive: #7f1d1d;
  /* darker red for dark mode bg */
  --destructive-foreground: #fca5a5;
  --border: var(--zinc-800);
  --input: var(--zinc-800);
  --ring: var(--zinc-300);
  --sidebar-logo-filter: none;
}

/* Fallback for OS preference if data-theme is not explicitly set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: var(--zinc-950);
    --foreground: var(--zinc-50);
    --card: var(--zinc-900);
    --card-foreground: var(--zinc-50);
    --popover: var(--zinc-900);
    --popover-foreground: var(--zinc-50);
    --primary: var(--zinc-50);
    --primary-foreground: var(--zinc-900);
    --secondary: var(--zinc-800);
    --secondary-foreground: var(--zinc-50);
    --muted: var(--zinc-800);
    --muted-foreground: var(--zinc-400);
    --accent: var(--zinc-800);
    --accent-foreground: var(--zinc-50);
    --destructive: #991b1b;
    --destructive-foreground: #fecaca;
    --border: var(--zinc-800);
    --input: var(--zinc-800);
    --ring: var(--zinc-300);
    --sidebar-logo-filter: none;
  }
}


/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

h1 {
  font-size: 1.875rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.125rem;
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}

.text-sm {
  font-size: 0.8125rem;
  line-height: 1.25rem;
}

.text-base {
  font-size: 0.875rem;
  line-height: 1.5rem;
}

.text-lg {
  font-size: 1rem;
  line-height: 1.5rem;
}

.text-muted {
  color: var(--muted-foreground);
}

/* ---------- Layout Utilities ---------- */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

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

.gap-1 {
  gap: 0.25rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.w-full {
  width: 100%;
}

.hidden {
  display: none !important;
}

/* ---------- Login Page ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--zinc-950);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 50% 40%, rgba(255, 255, 255, 0.03), transparent),
    radial-gradient(ellipse 400px 300px at 80% 20%, rgba(255, 255, 255, 0.02), transparent);
  pointer-events: none;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black, transparent);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--zinc-900);
  border: 1px solid var(--zinc-800);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  animation: loginFadeIn 0.6s ease-out;
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-card .logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .logo-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  background: #ffffff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card .logo-icon svg,
.login-card .logo-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  color: var(--zinc-900);
}

.login-card .logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.03em;
}

.login-card .logo p {
  font-size: 0.8125rem;
  color: var(--zinc-400);
  margin-top: 0.25rem;
}

.login-card label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--zinc-300);
  margin-bottom: 0.375rem;
}

.login-card .form-group {
  margin-bottom: 1.25rem;
}

.login-card input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: var(--zinc-800);
  border: 1px solid var(--zinc-700);
  border-radius: var(--radius);
  color: #ffffff;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.login-card input::placeholder {
  color: var(--zinc-500);
}

.login-card input:focus {
  border-color: var(--zinc-500);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.login-card .btn-login {
  width: 100%;
  padding: 0.625rem;
  background: #ffffff;
  color: var(--zinc-900);
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.login-card .btn-login:hover {
  background: var(--zinc-200);
}

.login-card .btn-login:active {
  transform: scale(0.98);
}

.login-card .btn-login:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-card .btn-login .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--zinc-400);
  border-top-color: var(--zinc-900);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-size: 0.8125rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: none;
}

.login-error.show {
  display: block;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

/* ---------- App Layout (Dashboard shell) ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--background);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header .sidebar-logo {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-header .sidebar-logo svg,
.sidebar-header .sidebar-logo img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  color: var(--primary-foreground);
  filter: var(--sidebar-logo-filter);
}

.sidebar-header .sidebar-title {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.sidebar-header .sidebar-subtitle {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.5rem 0.75rem 0.375rem;
  margin-top: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  position: relative;
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.sidebar-link:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.sidebar-link:hover svg {
  opacity: 1;
}

.sidebar-link.active {
  background: var(--primary);
  color: var(--primary-foreground);
}

.sidebar-link.active svg {
  opacity: 1;
  color: var(--primary-foreground);
}

.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--accent);
  color: var(--foreground);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  min-width: 1.25rem;
  text-align: center;
}

.sidebar-link.active .badge-count {
  background: var(--primary-foreground);
  color: var(--primary);
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: none;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-user:hover {
  background: var(--accent);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--zinc-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--zinc-700);
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  min-width: 0;
  margin: 0.5rem 0.5rem 0.5rem calc(var(--sidebar-width) + 0.5rem);
  min-height: calc(100vh - 1rem);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
  background: var(--card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.main-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.main-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.main-header .breadcrumb {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.main-header .breadcrumb span {
  opacity: 0.5;
}

.btn-menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
}

.btn-menu-toggle svg {
  width: 18px;
  height: 18px;
}

.main-body {
  flex: 1;
  min-width: 0;
  padding: 1.5rem;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1.25rem 1.25rem 0;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
}

.card-description {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 0 1.25rem 1.25rem;
}

/* ---------- Stat Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--zinc-300);
  box-shadow: var(--shadow-sm);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.stat-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-icon svg {
  width: 16px;
  height: 16px;
  color: var(--foreground);
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-card-change {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  margin-top: 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-card-change.up {
  color: var(--success);
}

.stat-card-change.down {
  color: var(--destructive);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.25rem;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--accent);
}

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--accent);
}

.btn-outline-destructive {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-outline-destructive:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .btn-outline-destructive {
  color: #ff6b6b;
}

.btn-ghost {
  background: transparent;
  color: var(--foreground);
}

.btn-ghost:hover {
  background: var(--accent);
}

.btn-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}

.btn-destructive:hover {
  opacity: 0.9;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.6875rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

/* ---------- Form Controls ---------- */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.375rem;
}

.map-popup-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.map-popup-value {
  font-size: 0.875rem;
  color: var(--foreground);
  margin-bottom: 0.75rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted-foreground);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(9, 9, 11, 0.06);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.form-select option,
select option {
  background-color: var(--background);
  color: var(--foreground);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-input-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
}

.form-checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-radio-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.8125rem;
}

.form-radio-card:hover {
  border-color: var(--zinc-400);
}

.form-radio-card.selected {
  border-color: var(--border);
  background: var(--accent);
}

.form-radio-card input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  margin: 0;
  display: grid;
  place-content: center;
  outline: none;
  background: color-mix(in srgb, var(--border) 30%, transparent);
  cursor: pointer;
}

.form-radio-card input[type="radio"]::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 120ms ease-in-out;
  background-color: var(--background);
}

.form-radio-card input[type="radio"]:checked {
  background-color: var(--foreground);
  border-color: var(--border);
}

.form-radio-card input[type="radio"]:checked::before {
  transform: scale(1);
}

/* ---------- Table ---------- */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
}

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

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background: var(--accent);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.data-table td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--accent);
}

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

.data-table .td-actions {
  text-align: right;
  white-space: nowrap;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.badge-default {
  background: var(--accent);
  color: var(--foreground);
}

.badge-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-destructive {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}

/* Badge dot indicator */
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-success .badge-dot {
  background: #22c55e;
}

.badge-warning .badge-dot {
  background: #f59e0b;
}

.badge-destructive .badge-dot {
  background: #ef4444;
}

.badge-info .badge-dot {
  background: #3b82f6;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.pagination-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--foreground);
  transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--accent);
}

.pagination-btn.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

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

.pagination-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- Modal / Dialog ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--accent);
  color: var(--foreground);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 0.875rem 1rem;
  background: var(--zinc-900);
  color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  font-size: 0.8125rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  animation: toastIn 0.3s ease-out;
}

.toast.toast-out {
  animation: toastOut 0.2s ease-in forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }
}

.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.toast-message {
  opacity: 0.8;
  font-size: 0.75rem;
}

.toast.toast-success {
  background: #166534;
}

.toast.toast-error {
  background: #991b1b;
}

.toast.toast-warning {
  background: #92400e;
}

/* ---------- Chart area ---------- */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted-foreground);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.375rem;
}

.empty-state p {
  font-size: 0.8125rem;
  max-width: 320px;
  margin: 0 auto;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar .search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.toolbar .search-box input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--foreground);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.toolbar .search-box input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(9, 9, 11, 0.06);
}

.toolbar .search-box svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--muted-foreground);
  pointer-events: none;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* ---------- Filter Chips ---------- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--card);
  color: var(--muted-foreground);
}

.filter-chip:hover {
  border-color: var(--zinc-400);
  color: var(--foreground);
}

.filter-chip.active {
  background: var(--zinc-900);
  color: #ffffff;
  border-color: var(--zinc-900);
}

/* ---------- Detail Info Grid ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-size: 0.8125rem;
  font-weight: 500;
}

.detail-item.full-width {
  grid-column: 1 / -1;
}

/* ---------- Photo Preview ---------- */
.photo-preview {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.photo-preview:hover {
  border-color: var(--zinc-400);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview .placeholder {
  text-align: center;
  color: var(--muted-foreground);
}

.photo-preview .placeholder svg {
  width: 32px;
  height: 32px;
  margin: 0 auto 0.5rem;
  opacity: 0.3;
}

.photo-preview .placeholder p {
  font-size: 0.75rem;
}

/* ---------- GPS Indicator ---------- */
.gps-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  background: var(--accent);
}

.gps-status.captured {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.gps-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-foreground);
}

.gps-status.captured .gps-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  animation: gpsPulse 2s infinite;
}

@keyframes gpsPulse {

  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.1);
  }
}

/* ---------- Loading Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--accent) 25%, var(--border) 50%, var(--accent) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-circle {
  border-radius: 50%;
}

/* ---------- Mobile Overlay ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 35;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

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

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

  .main-content {
    margin-left: 0.5rem;
  }

  .btn-menu-toggle {
    display: flex;
  }

  .main-header {
    padding: 1rem 1.25rem;
  }

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

  .main-body {
    padding: 1rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .toolbar .search-box {
    max-width: 100%;
  }

  .toolbar-right {
    margin-left: 0;
    justify-content: flex-end;
  }

  .modal {
    max-width: calc(100% - 2rem);
  }

  .charts-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 2rem 1.5rem;
  }

  .pagination {
    flex-direction: column;
    gap: 0.75rem;
  }
}

}

@media (min-width: 769px) {
  .header-greeting {
    display: inline-block !important;
  }
}

.header-date {
  display: inline-block;
  font-size: 0.8125rem !important;
  /* Slightly smaller on mobile */
}

.hide-on-mobile {
  display: none;
}

@media (min-width: 480px) {
  .header-date {
    font-size: 0.875rem !important;
  }

  .hide-on-mobile {
    display: inline;
  }
}

/* ---------- Map Specific Styles ---------- */
.map-container-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  margin: -1.5rem;
  margin-bottom: 0;
  width: calc(100% + 3rem);
  z-index: 1;
  overflow: hidden;
}

#mapContainer {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: var(--zinc-100);
}

[data-theme="dark"] #mapContainer {
  background: var(--zinc-900);
}

.map-controls {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  pointer-events: none;
}

.map-controls>* {
  pointer-events: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.map-controls select {
  background: transparent;
  border: none;
  color: var(--foreground);
  font-weight: 600;
  outline: none;
  font-family: inherit;
  cursor: pointer;
}

.map-legend {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 1000;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  min-width: 180px;
}

.map-legend-title {
  font-weight: 700;
  font-size: 0.8125rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
  color: var(--foreground);
}

.map-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip {
  background: var(--card);
  color: var(--foreground);
}

[data-theme="dark"] .leaflet-container a.leaflet-popup-close-button {
  color: var(--muted-foreground);
}

[data-theme="dark"] .leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--foreground);
}

.map-popup-content {
  font-family: 'Inter', sans-serif;
}

.map-popup-header {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}

.map-popup-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.125rem;
  font-size: 0.75rem;
}

.map-popup-label {
  color: var(--muted-foreground);
}

.map-popup-value {
  font-weight: 500;
  text-align: right;
}

.leaflet-popup-content {
  margin: 14px 16px;
  line-height: 1.4;
}

/* ---------- Custom Searchable Select ---------- */
.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-select-trigger::after {
  content: "";
  width: 16px;
  height: 16px;
  background-color: var(--muted-foreground);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.custom-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  margin-top: 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 50;
  display: none;
  flex-direction: column;
}

.custom-select-dropdown.open {
  display: flex;
}

.custom-select-search {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.custom-select-search input {
  width: 100%;
  padding: 0.375rem 0.625rem;
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  font-size: 0.8125rem;
  outline: none;
}

.custom-select-search input:focus {
  border-color: var(--ring);
}

.custom-select-options {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.25rem 0;
  list-style: none;
  margin: 0;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

.custom-select-option {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--foreground);
}

.custom-select-option:hover {
  background: var(--accent);
}

.custom-select-option.selected {
  background: var(--accent);
  font-weight: 500;
}

.custom-select-option.hidden {
  display: none;
}

/*  
 - - - - - - - - - -  
 C u s t o m  
 S e a r c h a b l e  
 S e l e c t  
 - - - - - - - - - -  
 * /