:root {
  --bg: #0b1320;
  --bg-2: #111a28;
  --panel: rgba(16, 27, 44, 0.9);
  --panel-2: rgba(19, 33, 53, 0.9);
  --card: rgba(20, 36, 58, 0.9);
  --accent: #2f5bdb;
  --accent-2: #1b4aa8;
  --text: #e6edf6;
  --muted: #9fb0c7;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  --green: #2ecc71;
  --yellow: #f1c40f;
  --red: #e74c3c;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", "Noto Sans", sans-serif;
  background: radial-gradient(circle at 20% 10%, #132039 0%, #0b1320 55%),
    linear-gradient(135deg, rgba(9, 15, 25, 0.9), rgba(18, 28, 43, 0.95));
  color: var(--text);
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath fill='rgba(255,255,255,0.02)' d='M0 0h120v1H0z'/%3E%3Cpath fill='rgba(255,255,255,0.02)' d='M0 0v120h1V0z'/%3E%3C/svg%3E");
  opacity: 0.6;
  pointer-events: none;
}

h1,
h2,
h3,
h4 {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  margin: 0 0 12px;
}

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

.login-page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-card {
  width: 70%;
  min-height: 80%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 118px 60px 56px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
}

.login-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(47, 91, 219, 0.12), transparent 45%);
  pointer-events: none;
}

.login-logo-float {
  position: absolute;
  top: -68px;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(128px, 11vw, 180px);
  height: clamp(128px, 11vw, 180px);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), rgba(10, 18, 30, 0.92) 55%, rgba(6, 11, 20, 0.98));
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.55), inset 0 0 18px rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  overflow: hidden;
  z-index: 2;
}

.login-logo-float img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.5));
}

.login-logo-float::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.45);
}

.login-logo-float::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.25), transparent 60%);
  opacity: 0.55;
}

.login-header {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 24px;
  margin-bottom: 30px;
  text-align: center;
  padding-top: 0;
}

.login-heading {
  max-width: 100%;
}

.login-title {
  font-size: clamp(30px, 2.6vw, 40px);
  letter-spacing: 0.4px;
  line-height: 1.22;
}

.login-logo {
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  width: 100%;
  padding: 0;
  flex-direction: column;
}

.login-logo img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.16), rgba(10, 18, 30, 0.92) 55%, rgba(6, 11, 20, 0.98));
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), inset 0 0 18px rgba(0, 0, 0, 0.35);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5));
}

.login-subtitle {
  color: var(--muted);
  font-size: 17px;
  margin-top: 6px;
}

.login-network-link {
  width: 100%;
  max-width: 100%;
  margin: 0 auto 18px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.login-network-link .network-link-url {
  max-width: min(100%, 420px);
}

.form-group {
  margin-bottom: 16px;
}

input,
select,
textarea {
  width: 100%;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 18, 30, 0.6);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="file"] {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-input {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 18, 30, 0.6);
}

.file-input-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-input-label {
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(45, 88, 200, 0.3);
}

.file-input-name {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.file-input.camera-force {
  display: none;
}

.file-input.camera-native {
  padding: 0;
  border: 0;
  background: transparent;
}

.file-input.camera-native .file-input-label,
.file-input.camera-native .file-input-name {
  display: none;
}

.camera-capture {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(10, 18, 30, 0.55);
  display: grid;
  gap: 10px;
}

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

.camera-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.camera-count {
  font-size: 12px;
  color: var(--accent);
  background: rgba(47, 91, 219, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.camera-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.camera-native-launch {
  position: relative;
  overflow: hidden;
}

.camera-native-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

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

.camera-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.camera-btn.primary {
  border: none;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 18px rgba(45, 88, 200, 0.35);
}

.camera-btn.is-active {
  border-color: rgba(47, 91, 219, 0.7);
  background: rgba(47, 91, 219, 0.2);
}

.camera-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.camera-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.camera-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}

.camera-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.camera-error {
  font-size: 12px;
  color: var(--red);
  display: none;
}

.camera-error.is-visible {
  display: block;
}

input::placeholder,
textarea::placeholder {
  color: rgba(159, 176, 199, 0.75);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(79, 123, 255, 0.6);
  box-shadow: 0 0 0 2px rgba(47, 91, 219, 0.2);
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

button.primary {
  width: 100%;
  padding: 16px 18px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(45, 88, 200, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: pulse-login 2.4s ease-in-out infinite;
}

button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(45, 88, 200, 0.55);
}

@keyframes pulse-login {

  0%,
  100% {
    box-shadow: 0 12px 30px rgba(45, 88, 200, 0.45);
  }

  50% {
    box-shadow: 0 16px 40px rgba(45, 88, 200, 0.65);
  }
}

a.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(45, 88, 200, 0.35);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(8, 15, 26, 0.96);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
  padding-bottom: 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  bottom: 0;
  background: inherit;
  z-index: 1;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar .brand img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
}

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

.nav-logout {
  color: #ffb3a8;
  border: 1px solid rgba(231, 76, 60, 0.25);
  background: rgba(231, 76, 60, 0.12);
}

.nav-logout:hover {
  background: rgba(231, 76, 60, 0.18);
  color: #ffd0c7;
}

.nav-group {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.nav-group-title {
  padding: 8px 12px 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  text-decoration: none;
}

.nav-group-title:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.nav-sub {
  padding-left: 24px;
  font-size: 14px;
}

.main {
  padding: 28px;
  --card: rgba(24, 38, 62, 0.92);
  --panel-2: rgba(22, 36, 58, 0.92);
  background:
    radial-gradient(circle at 70% 8%, rgba(120, 155, 225, 0.22), transparent 55%),
    radial-gradient(circle at 85% 90%, rgba(90, 120, 190, 0.18), transparent 60%),
    linear-gradient(90deg, rgba(10, 18, 30, 0) 0%, rgba(24, 38, 62, 0.35) 70%, rgba(28, 44, 72, 0.6) 100%);
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

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

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-header h2 {
  margin: 0;
}

.dashboard-shell {
  display: grid;
  gap: 16px;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 16px;
  min-height: 0;
}

.dashboard-column {
  display: grid;
  gap: 16px;
  align-content: start;
  max-height: 70vh;
  overflow: auto;
  padding-right: 4px;
  min-height: 0;
  scrollbar-gutter: stable;
}

.dashboard-column::-webkit-scrollbar {
  width: 8px;
}

.dashboard-column::-webkit-scrollbar-thumb {
  background: rgba(120, 150, 210, 0.35);
  border-radius: 999px;
}

.dashboard-column .table-scroll {
  max-height: 280px;
}

.dashboard-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}



@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
    border-color: rgba(79, 123, 255, 0.22);
  }

  .person-card:hover,
  .search-result:hover,
  .stat-row:hover,
  .relatives-item:hover,
  .info-item:hover,
  .media-card:hover,
  .mahalla-chip:hover,
  .inspector-card:hover,
  .settings-panel:hover,
  .settings-profile-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
    border-color: rgba(79, 123, 255, 0.28);
  }
}

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

  .dashboard-column {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .dashboard-split {
    grid-template-columns: 1fr;
  }
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(47, 91, 219, 0.35);
  background: rgba(47, 91, 219, 0.18);
  color: #9bb6ff;
  font-size: 12px;
  white-space: nowrap;
}

.chart-body {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(180px, 1fr);
  gap: 14px;
  align-items: center;
}

.chart-canvas {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-list {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.age-card {
  background: linear-gradient(150deg, rgba(12, 20, 34, 0.98), rgba(22, 36, 58, 0.95));
  border: 1px solid var(--border);
  color: var(--text);
}

.age-card .muted {
  color: var(--muted);
}

.age-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.age-kpi {
  display: grid;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 18, 30, 0.7);
  min-width: 120px;
  text-align: right;
}

.age-kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.age-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #b9ccff;
}

.age-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}

.age-meta-item {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #9bb6ff;
  background: rgba(47, 91, 219, 0.16);
  border: 1px solid rgba(47, 91, 219, 0.35);
}

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

.age-tile {
  background: rgba(8, 15, 28, 0.85);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
}

.age-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 10%, rgba(72, 113, 255, 0.18), transparent 60%);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.age-tile>* {
  position: relative;
  z-index: 1;
}

.age-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.age-label {
  color: var(--text);
}

.age-value {
  color: #b9ccff;
  font-weight: 700;
}

.age-bar {
  margin-top: 10px;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.age-bar-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f5bdb, #5fb0ff);
  transition: width 0.4s ease;
}

.stat-row-bar {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) 1fr auto;
  align-items: center;
  gap: 10px;
}

.stat-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
}

.stat-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.stat-count {
  font-size: 12px;
  color: var(--muted);
  min-width: 72px;
  text-align: right;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel-2);
  border-radius: 12px;
  overflow: hidden;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
  word-break: normal;
  overflow-wrap: break-word;
}

.table-modern {
  border: none;
  background: transparent;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table-modern thead th {
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 11px;
  color: rgba(159, 176, 199, 0.9);
  background: rgba(24, 36, 56, 0.9);
  border-bottom: none;
}

.table-modern tbody tr {
  background: linear-gradient(180deg, rgba(16, 27, 44, 0.95), rgba(12, 20, 32, 0.95));
  box-shadow: inset 0 0 0 1px var(--border), 0 8px 20px rgba(0, 0, 0, 0.25);
}

.table-modern tbody tr:hover {
  background: linear-gradient(180deg, rgba(25, 40, 66, 0.98), rgba(18, 30, 50, 0.98));
  transform: translateY(-1px);
  transition: background 0.15s ease, transform 0.15s ease;
}

.table-modern tbody td {
  border-bottom: none;
  padding: 14px 16px;
  vertical-align: middle;
  min-width: 0;
}

.table-modern tbody td:first-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.table-modern tbody td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.table-modern td a {
  color: var(--text);
  font-weight: 600;
}

.table-modern td a:hover {
  color: #8fb2ff;
}

.table-scroll {
  max-height: 320px;
  overflow: auto;
  border-radius: 12px;
}

.table-scroll .table {
  margin: 0;
}

.list-scroll {
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: 1px solid rgba(47, 91, 219, 0.35);
  background: rgba(47, 91, 219, 0.18);
  color: #9bb6ff;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.status.green {
  color: var(--green);
  background: rgba(46, 204, 113, 0.16);
  border-color: rgba(46, 204, 113, 0.35);
}

.status.yellow {
  color: var(--yellow);
  background: rgba(241, 196, 15, 0.16);
  border-color: rgba(241, 196, 15, 0.35);
}

.status.red {
  color: var(--red);
  background: rgba(231, 76, 60, 0.16);
  border-color: rgba(231, 76, 60, 0.35);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(47, 91, 219, 0.15);
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
}

.kpi {
  position: relative;
  overflow: hidden;
}

.kpi::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.08;
  pointer-events: none;
}

.kpi-green::after {
  background: radial-gradient(circle at 20% 20%, rgba(46, 204, 113, 0.6), transparent 55%);
}

.kpi-yellow::after {
  background: radial-gradient(circle at 20% 20%, rgba(241, 196, 15, 0.6), transparent 55%);
}

.kpi-red::after {
  background: radial-gradient(circle at 20% 20%, rgba(231, 76, 60, 0.6), transparent 55%);
}

.kpi .kpi-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.kpi-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.kpi-dot.green {
  background: var(--green);
}

.kpi-dot.yellow {
  background: var(--yellow);
}

.kpi-dot.red {
  background: var(--red);
}

.table-scroll.tight {
  max-height: 260px;
}

.table td[data-label="Telefon"] {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  word-break: normal;
  overflow-wrap: normal;
}

.table td[data-label="Status"] {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.table td[data-label="Muddat"] {
  font-variant-numeric: tabular-nums;
}

.mahalla-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.mahalla-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(14, 24, 39, 0.9);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.mahalla-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 91, 219, 0.4);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}

.category-chip {
  background: rgba(18, 28, 46, 0.95);
}

.mahalla-name {
  font-size: 13px;
  line-height: 1.2;
}

.mahalla-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(47, 91, 219, 0.2);
  color: #9bb6ff;
  font-size: 12px;
  min-width: 28px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 16px;
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(980px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.photo-modal-card {
  width: min(860px, 96vw);
  max-height: 90vh;
  padding: 14px;
}

.photo-modal-body {
  display: grid;
  place-items: center;
}

.photo-modal-img {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.04);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
}

.mini-bars {
  display: grid;
  gap: 10px;
}

.mini-bar {
  display: grid;
  grid-template-columns: 52px 1fr 32px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.mini-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-radius: 999px;
}

.mini-bar-value {
  text-align: right;
  color: var(--muted);
}

.stat-list {
  display: grid;
  gap: 8px;
}

.person-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.person-list.scroll {
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.person-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(16, 26, 40, 0.98), rgba(10, 16, 28, 0.9));
  border: 1px solid rgba(59, 84, 132, 0.35);
  box-shadow: 0 12px 26px rgba(5, 10, 18, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.person-card:hover {
  transform: translateY(-1px);
  border-color: rgba(90, 124, 200, 0.55);
  box-shadow: 0 16px 34px rgba(6, 12, 20, 0.55);
}

.person-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.person-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, rgba(86, 128, 230, 0.5), rgba(34, 56, 98, 0.3));
  border: 1px solid rgba(80, 122, 220, 0.6);
  color: #d3e2ff;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.person-avatar-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.person-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.person-text {
  min-width: 0;
}

.person-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-meta {
  font-size: 12px;
  color: var(--muted);
}

.person-link {
  font-size: 12px;
  color: #d9e6ff;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(90, 124, 200, 0.55);
  background: rgba(52, 88, 186, 0.32);
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.person-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(45, 88, 200, 0.35);
}

.person-list.compact .person-card {
  padding: 10px 12px;
  border-radius: 14px;
}

.person-list.compact .person-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 12px;
}

.search-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.search-results {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(16, 26, 40, 0.98), rgba(10, 16, 28, 0.9));
  border: 1px solid rgba(59, 84, 132, 0.35);
  box-shadow: 0 12px 26px rgba(5, 10, 18, 0.45);
}

.search-result-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.search-result-text {
  min-width: 0;
}

.search-result-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.search-results .person-avatar {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

@media (max-width: 640px) {
  .search-result {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-result-name {
    white-space: normal;
  }

  .person-link {
    align-self: stretch;
    text-align: center;
  }
}

.search-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.search-input {
  width: 100%;
}

@media (max-width: 640px) {
  .search-form {
    grid-template-columns: 1fr;
  }

  .search-header {
    gap: 8px;
  }
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(12, 20, 32, 0.9);
  border: 1px solid var(--border);
}

.stat-block {
  padding: 10px;
  border-radius: 12px;
  background: rgba(10, 18, 30, 0.85);
  border: 1px solid var(--border);
}

.stat-block-title {
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--muted);
}

.stat-block-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.name-chip {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(47, 91, 219, 0.18);
  color: #9bb6ff;
  font-size: 12px;
}

.inspector-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar.placeholder {
  font-size: 14px;
  font-weight: 600;
  color: #9bb6ff;
  text-transform: uppercase;
}

.inspector-row {
  cursor: pointer;
}

.inspector-row.disabled {
  cursor: default;
  opacity: 0.6;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.inspector-card {
  background: linear-gradient(160deg, rgba(18, 30, 49, 0.95), rgba(12, 20, 32, 0.95));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.inspector-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.inspector-card img.avatar {
  cursor: pointer;
}

.inspector-info {
  display: grid;
  gap: 4px;
}

.inspector-name {
  font-weight: 700;
  font-size: 15px;
}

.inspector-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(47, 91, 219, 0.35);
  background: rgba(47, 91, 219, 0.18);
  color: #b9ccff;
  white-space: nowrap;
}

.stat-pill.secondary {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

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

.meta-item {
  background: rgba(10, 18, 30, 0.7);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.meta-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.meta-value {
  font-size: 14px;
  font-weight: 600;
}

.inspector-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inspector-card-actions form {
  margin: 0;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.person-filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: end;
}

@media (max-width: 1024px) {
  .person-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .person-filter-grid {
    grid-template-columns: 1fr;
  }
}

.settings-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(14, 24, 39, 0.9);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.settings-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(47, 91, 219, 0.2);
  border: 1px solid rgba(47, 91, 219, 0.35);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #9bb6ff;
}

.settings-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-hero-info {
  display: grid;
  gap: 6px;
}

.settings-name {
  font-size: 18px;
  font-weight: 700;
}

.settings-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.settings-card {
  padding: 14px 16px;
}

.settings-card .primary {
  font-size: 15px;
  padding: 12px 14px;
}

.settings-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.info-panel {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(12, 20, 32, 0.8);
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.info-panel p {
  margin: 0;
}

.info-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.info-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(47, 91, 219, 0.35);
  background: rgba(47, 91, 219, 0.16);
  color: #b9ccff;
  font-size: 11px;
  font-weight: 600;
}

.info-chip-warn {
  border-color: rgba(241, 196, 15, 0.45);
  background: rgba(241, 196, 15, 0.15);
  color: #ffe08a;
}

.alert {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(14, 24, 39, 0.85);
  display: grid;
  gap: 6px;
}

.alert-title {
  font-weight: 600;
  font-size: 13px;
}

.alert-text {
  color: var(--muted);
  font-size: 12px;
}

.alert-meta {
  font-size: 12px;
  color: #cfe0ff;
}

.alert-warn {
  border-color: rgba(241, 196, 15, 0.35);
  background: rgba(241, 196, 15, 0.08);
}

.form-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .settings-hero {
    padding: 12px 14px;
  }

  .settings-avatar {
    width: 48px;
    height: 48px;
  }

  .settings-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: 15;
    background: rgba(8, 15, 26, 0.98);
  }

  .sidebar .brand {
    min-width: 220px;
  }

  .nav-item {
    white-space: nowrap;
  }

  .main {
    padding: 20px;
  }

  .chart-body {
    grid-template-columns: 1fr;
  }

  .stat-row-bar {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .stat-count {
    text-align: left;
  }

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

@media (max-width: 640px) {
  .login-page {
    padding: 20px 16px;
    align-items: flex-start;
  }

  .main {
    padding: 16px;
  }

  .login-card {
    width: 100%;
    max-width: 520px;
    margin-top: 36px;
    padding: 72px 24px 24px;
    min-height: auto;
  }

  .login-logo-float {
    top: -54px;
    left: 50%;
    transform: translateX(-50%);
    width: 108px;
    height: 108px;
  }

  .login-logo {
    flex-direction: column;
    gap: 10px;
  }

  .login-logo-float img,
  .login-logo img {
    width: 96px;
    height: 96px;
  }

  .login-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .login-title {
    font-size: 20px;
  }

  .login-heading {
    max-width: 100%;
  }

  input,
  select,
  textarea {
    padding: 12px 14px;
    font-size: 14px;
  }

  button.primary {
    padding: 12px 14px;
    font-size: 15px;
  }

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

  .table th,
  .table td {
    font-size: 12px;
    padding: 10px 10px;
  }

  .sidebar .brand {
    display: none;
  }

  .download-banner,
  .install-banner {
    padding: 10px 12px;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    border-top: 1px solid var(--border);
    border-right: none;
    justify-content: space-around;
    padding: 10px 12px;
  }

  .main {
    padding-bottom: 90px;
  }
}

@media (min-width: 641px) {
  .login-header {
    padding-top: 0;
  }
}

@media (max-width: 980px) {
  .table:not(.table-stacked) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table:not(.table-stacked) th,
  .table:not(.table-stacked) td {
    white-space: nowrap;
  }

  .table-stacked thead {
    display: none;
  }

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

  .table-modern.table-stacked tr,
  .table-neo.table-stacked tr,
  .table.table-stacked tr {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
  }

  .table-modern.table-stacked td,
  .table-neo.table-stacked td,
  .table.table-stacked td {
    border: none;
    padding: 6px 0;
    display: grid;
    grid-template-columns: minmax(96px, 140px) minmax(0, 1fr);
    column-gap: 12px;
    font-size: 13px;
    align-items: center;
    justify-items: start;
  }

  .table-modern.table-stacked td::before,
  .table-neo.table-stacked td::before,
  .table.table-stacked td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    min-width: 0;
  }

  .table-stacked td[colspan] {
    display: block;
    text-align: center;
    padding: 10px 0;
  }

  .table-stacked td[colspan]::before {
    content: none;
  }

  .table-modern.table-stacked td[data-label="FIO"] .person-row,
  .table-neo.table-stacked td[data-label="FIO"] .person-row {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
  }

  .table-modern.table-stacked td[data-label="FIO"] .person-avatar,
  .table-neo.table-stacked td[data-label="FIO"] .person-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .table-modern.table-stacked td[data-label="FIO"] .person-name,
  .table-neo.table-stacked td[data-label="FIO"] .person-name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .status {
    padding: 4px 10px;
    font-size: 11px;
  }

  .table-modern.table-stacked td[data-label="Telefon"],
  .table-neo.table-stacked td[data-label="Telefon"] {
    font-size: 12px;
  }
}

@media (min-width: 1024px) and (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 220px 1fr;
  }

  .sidebar {
    padding: 20px 14px;
  }

  .main {
    padding: 24px;
  }

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

@media (min-width: 1281px) {
  .login-card {
    width: min(520px, 42vw);
    padding: 118px 32px 36px;
  }

  .main {
    padding: 32px;
  }

  .card {
    padding: 20px 22px;
  }
}

.download-banner,
.install-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 15, 26, 0.98);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: none;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.download-banner.show,
.install-banner.show {
  display: flex;
}

.download-banner .actions,
.install-banner .actions {
  display: flex;
  gap: 10px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.button-outline {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(12, 20, 32, 0.35);
}

.button-outline.export-btn {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 640px) {

  .download-banner,
  .install-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .download-banner .actions,
  .install-banner .actions {
    width: 100%;
    flex-direction: column;
  }
}

/* =========================
   THEME OVERRIDES
   ========================= */

body.theme-dark {
  /* default tokens already match dark */
}

body.theme-light {
  --bg: #f4f6f3;
  --bg-2: #eef2ef;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-2: rgba(248, 250, 249, 0.96);
  --card: #ffffff;
  --accent: #0f4c81;
  --accent-2: #0b3a63;
  --text: #0d1b2a;
  --muted: #5a6b7a;
  --border: rgba(13, 27, 42, 0.12);
  --shadow: 0 12px 28px rgba(13, 27, 42, 0.10);
}

body.theme-light {
  background:
    radial-gradient(circle at 10% 0%, rgba(15, 76, 129, 0.10), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(180, 140, 90, 0.08), transparent 50%),
    linear-gradient(180deg, #f4f6f3, #eef2ef);
  color: var(--text);
}



body.theme-light::before {
  opacity: 0.25;
}

body.theme-light .sidebar {
  background: rgba(255, 255, 255, 0.98);
  border-right: 1px solid var(--border);
  box-shadow: 12px 0 30px rgba(13, 27, 42, 0.06);
  border-top-right-radius: 18px;
  border-bottom-right-radius: 18px;
}

body.theme-light .nav-item {
  color: var(--muted);
  border: 1px solid transparent;
}

body.theme-light .nav-item.active,
body.theme-light .nav-item:hover {
  background: rgba(15, 76, 129, 0.10);
  border-color: rgba(15, 76, 129, 0.20);
  color: var(--text);
}

body.theme-light .card,
body.theme-light .table,
body.theme-light .panel,
body.theme-light .login-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

body.theme-light .topbar {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(13, 27, 42, 0.08);
}

body.theme-light .badge {
  background: rgba(15, 76, 129, 0.12);
  color: #0f4c81;
}

body.theme-light .pill {
  border-color: rgba(15, 76, 129, 0.3);
  background: rgba(15, 76, 129, 0.12);
  color: #0f4c81;
}

body.theme-light .button-outline {
  background: rgba(15, 76, 129, 0.06);
  border-color: rgba(15, 76, 129, 0.2);
  color: var(--text);
}

/* Mobile sidebar */
.sidebar-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(99, 140, 255, 0.28);
  background:
    radial-gradient(circle at 30% 20%, rgba(92, 130, 220, 0.35), rgba(14, 22, 36, 0.92));
  box-shadow: 0 10px 24px rgba(5, 10, 18, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sidebar-toggle::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 55%);
  pointer-events: none;
}

.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: linear-gradient(90deg, #a9c3ff, #e3edff);
  margin: 3px 0;
  opacity: .9;
  border-radius: 999px;
  box-shadow: 0 1px 6px rgba(120, 160, 255, 0.35);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.sidebar-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(6, 12, 22, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  border-color: rgba(120, 160, 255, 0.6);
}

.sidebar-toggle:active {
  transform: translateY(0);
  box-shadow: 0 10px 24px rgba(5, 10, 18, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.sidebar-open .sidebar-toggle {
  border-color: rgba(120, 160, 255, 0.7);
  background: radial-gradient(circle at 30% 20%, rgba(120, 160, 255, 0.45), rgba(16, 26, 42, 0.96));
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 20px 16px;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-102%);
    transition: transform .22s ease;
    z-index: 40;
    justify-content: flex-start;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.35);
  }

  .sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 4px;
  }

  .sidebar-footer {
    position: sticky;
    bottom: 0;
  }

  .sidebar .brand {
    min-width: 0;
  }

  .nav-item {
    white-space: normal;
  }

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

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(2px);
    z-index: 30;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .sidebar-toggle {
    display: inline-flex;
    margin-right: 12px;
  }

  .topbar {
    gap: 12px;
  }

  .main {
    padding: 18px;
  }
}

@media (max-width: 640px) {
  .sidebar {
    width: min(86vw, 320px);
    padding: 18px 14px;
    gap: 12px;
  }

  .sidebar-nav {
    gap: 6px;
  }

  .nav-item {
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(140deg, rgba(16, 28, 45, 0.95), rgba(10, 18, 30, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #d9e4f7;
    font-weight: 600;
    position: relative;
    overflow: hidden;
  }

  .nav-item+.nav-item {
    margin-top: 4px;
  }

  .nav-item::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(79, 123, 255, 0.9);
    box-shadow: 0 0 10px rgba(79, 123, 255, 0.6);
  }

  .nav-item.active {
    background: linear-gradient(110deg, rgba(47, 91, 219, 0.65), rgba(20, 32, 54, 0.95));
    border-color: rgba(79, 123, 255, 0.6);
  }

  .sidebar .brand {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(12, 20, 32, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  .sidebar .brand img {
    width: 40px;
    height: 40px;
  }

  .sidebar .brand div {
    font-size: 14px;
    line-height: 1.2;
  }

  .sidebar-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    background: rgba(8, 15, 26, 0.88);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 10px 12px;
  }

  .topbar .badge {
    font-size: 11px;
  }

  .main {
    padding: 16px;
    padding-bottom: 16px;
  }

  .main [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  canvas {
    max-width: 100%;
    height: auto;
  }

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

  .inspector-card {
    padding: 14px 16px;
  }

  /* Dashboard & lists mobile */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
  }

  .stat-card-link,
  .stat-card {
    padding: 10px 12px;
    gap: 8px;
  }

  .stat-card-link .stat-value,
  .stat-value {
    font-size: 1.125rem;
  }

  .stat-card-link .stat-label,
  .stat-label {
    font-size: 0.7rem;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
  }

  .stat-icon svg {
    width: 18px;
    height: 18px;
  }

  .page-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .page-subtitle {
    font-size: 12px;
  }

  .main {
    overflow-x: hidden;
  }

  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 280px;
  }

  .table-scroll .table {
    min-width: 320px;
  }

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

  .network-link-wrap {
    flex-wrap: wrap;
    max-width: 100%;
  }

  .network-link-label {
    display: none;
  }

  .network-link-url {
    max-width: 140px;
  }

  .user-card {
    flex-wrap: wrap;
    gap: 6px;
  }

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

  .user-card .user-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
  }

  .user-card .user-role {
    font-size: 11px;
  }

  .card {
    padding: 12px 14px;
  }

  .card h3,
  .card h4 {
    font-size: 1rem;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-actions {
    width: 100%;
  }

  .u-grid.u-grid-cols-3 {
    grid-template-columns: 1fr;
  }

  .map-frame,
  .map-leaflet {
    min-height: 220px;
  }
}

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

/* Login polish (dark glass) */
.theme-dark .login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.theme-dark .login-card {
  max-width: 560px;
  width: 100%;
  border-radius: 18px;
  background: rgba(18, 30, 49, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.theme-dark .login-title {
  letter-spacing: 1px;
}

.theme-dark .input {
  height: 52px;
}

.theme-dark .btn {
  height: 56px;
  border-radius: 14px;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  box-shadow: none;
}

.help {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* =========================
   Inspector Settings (new)
   ========================= */
.settings-shell {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.settings-profile-card {
  background: linear-gradient(160deg, rgba(15, 26, 44, 0.96), rgba(10, 18, 30, 0.92));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.settings-profile-top {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
}

.settings-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(47, 91, 219, 0.18);
  border: 1px solid rgba(47, 91, 219, 0.35);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #9bb6ff;
}

.settings-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-profile-name {
  font-size: 18px;
  font-weight: 700;
}

.settings-profile-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.settings-profile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.settings-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(47, 91, 219, 0.35);
  background: rgba(47, 91, 219, 0.16);
  color: #9bb6ff;
  font-size: 12px;
}

.settings-info-grid {
  display: grid;
  gap: 10px;
}

.settings-info-item {
  background: rgba(12, 20, 32, 0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.settings-info-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.settings-info-value {
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.settings-note {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background: rgba(8, 15, 26, 0.6);
}

.settings-actions {
  display: grid;
  gap: 14px;
}

.settings-header h2 {
  margin-bottom: 4px;
}

.settings-alerts {
  display: grid;
  gap: 8px;
}

.settings-alert {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(47, 91, 219, 0.35);
  background: rgba(47, 91, 219, 0.16);
  color: #b9ccff;
  font-size: 13px;
}

.settings-alert.error {
  border-color: rgba(231, 76, 60, 0.4);
  background: rgba(231, 76, 60, 0.16);
  color: #ffb3a8;
}

.settings-alert.success {
  border-color: rgba(46, 204, 113, 0.4);
  background: rgba(46, 204, 113, 0.16);
  color: #b6f3d0;
}

.settings-panels {
  display: grid;
  gap: 16px;
}

.settings-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.settings-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.settings-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
}

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

.settings-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.settings-field input {
  color: var(--text);
}

.settings-button {
  width: auto;
  justify-self: flex-start;
  padding: 12px 18px;
  font-size: 15px;
}

@media (max-width: 980px) {
  .settings-shell {
    grid-template-columns: 1fr;
  }

  .settings-button {
    width: 100%;
    justify-self: stretch;
  }

  .settings-profile-top {
    grid-template-columns: 64px 1fr;
  }

  .settings-avatar-lg {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 640px) {
  .settings-profile-card {
    padding: 14px;
  }

  .settings-panel {
    padding: 14px;
  }
}

.person-hint {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #cfe0ff;
  border: 1px solid rgba(90, 124, 200, 0.55);
  background: rgba(52, 88, 186, 0.25);
  vertical-align: middle;
}

/* =========================
   Person Profile (modern)
   ========================= */
.person-profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* =========================
   2026 REDESIGN (AdminLTE + Flowbite + GitHub + Creative Tim inspired)
   ========================= */
:root {
  --bg: #f6f8fc;
  --bg-2: #eef2f7;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --card: #ffffff;
  --accent: #2563eb;
  --accent-2: #0ea5e9;
  --accent-3: #8b5cf6;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --green: #16a34a;
  --yellow: #f59e0b;
  --red: #ef4444;
  --radius: 14px;
  --radius-lg: 18px;
}

body {
  font-family: "Bahnschrift", "Segoe UI Variable", "Segoe UI", "Noto Sans", sans-serif;
  background:
    radial-gradient(circle at 15% 5%, rgba(56, 189, 248, 0.2), transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(139, 92, 246, 0.15), transparent 45%),
    linear-gradient(180deg, #f7f9fe 0%, #eef2f7 100%);
  color: var(--text);
}

body::before {
  background-image:
    radial-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    radial-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px);
  background-size: 120px 120px, 24px 24px;
  background-position: 0 0, 10px 10px;
  opacity: 0.45;
}

h1,
h2,
h3,
h4 {
  font-family: "Bahnschrift", "Segoe UI Variable", "Segoe UI", "Noto Sans", sans-serif;
  letter-spacing: 0.2px;
}

a {
  color: inherit;
}

body.theme-dark {
  --bg: #0b1220;
  --bg-2: #0f172a;
  --panel: #0f172a;
  --panel-2: #111827;
  --card: #111827;
  --accent: #38bdf8;
  --accent-2: #6366f1;
  --accent-3: #22d3ee;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  background:
    radial-gradient(circle at 20% 8%, rgba(56, 189, 248, 0.18), transparent 42%),
    radial-gradient(circle at 85% 12%, rgba(99, 102, 241, 0.14), transparent 45%),
    linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  color: var(--text);
}

body.theme-dark::before {
  opacity: 0.2;
  background-image:
    radial-gradient(rgba(226, 232, 240, 0.08) 1px, transparent 1px),
    radial-gradient(rgba(226, 232, 240, 0.06) 1px, transparent 1px);
}

body.theme-light {
  color: var(--text);
}

.app-shell {
  background: transparent;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.95));
  border-right: 1px solid var(--border);
  box-shadow: 12px 0 30px rgba(15, 23, 42, 0.06);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  position: sticky;
  top: 0;
}

body.theme-dark .sidebar {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98));
  box-shadow: 12px 0 30px rgba(2, 6, 23, 0.45);
}

.sidebar .brand {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 14px;
  text-transform: none;
}

body.theme-dark .sidebar .brand {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
}

.sidebar .brand img {
  width: 42px;
  height: 42px;
}

.nav-item {
  color: var(--muted);
  font-weight: 600;
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid transparent;
  background: transparent;
  transition: all 0.15s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
}

body.theme-dark .nav-item:hover,
body.theme-dark .nav-item.active {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.35);
}

.nav-logout {
  color: #b42318;
  border: 1px solid rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.08);
}

body.theme-dark .nav-logout {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.18);
}

.main {
  background: transparent;
  padding: 28px 32px 40px;
  max-width: 1600px;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 20;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

body.theme-dark .topbar {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.45);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.network-link-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 10px;
  font-size: 0.85rem;
}

.network-link-label {
  color: var(--muted);
  white-space: nowrap;
}

.network-link-url {
  color: var(--accent);
  text-decoration: none;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-link-url:hover {
  text-decoration: underline;
}

.network-link-copy {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

.network-link-copy:hover {
  background: rgba(37, 99, 235, 0.25);
}

.sidebar-toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.08);
  box-shadow: none;
}

.sidebar-toggle span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: none;
}

body.theme-dark .sidebar-toggle {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.12);
}

.user-pill {
  display: grid;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.15);
  min-width: 120px;
}

body.theme-dark .user-pill {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
}

.user-name {
  font-weight: 700;
  font-size: 13px;
}

.user-role {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

body.theme-dark .theme-toggle {
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.12);
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.12);
}

.theme-toggle-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

body.theme-dark .theme-toggle-icon {
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}

.theme-toggle-float {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), transparent 45%);
  opacity: 0.35;
  pointer-events: none;
}

body.theme-dark .card::after {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.14), transparent 45%);
  opacity: 0.25;
}

.card>* {
  position: relative;
  z-index: 1;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
  border-color: rgba(37, 99, 235, 0.3);
}

.card h3,
.card h4 {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.card-head {
  margin-bottom: 14px;
}

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

.card-grid .card {
  min-height: 120px;
}

.pill,
.badge {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.2);
}

body.theme-dark .pill,
body.theme-dark .badge {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.16);
}

.status {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.3);
  color: #1d4ed8;
}

.status.green {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--green);
}

.status.yellow {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--yellow);
}

.status.red {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--red);
}

input,
select,
textarea {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.16);
  color: var(--text);
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text);
}

button.primary,
a.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
  border-radius: 12px;
  font-size: 15px;
}

.button-outline {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

body.theme-dark .button-outline {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.65);
}

.table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.03);
}

body.theme-dark .table th {
  background: rgba(148, 163, 184, 0.1);
}

.table-modern tbody tr {
  background: var(--card);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--border);
}

body.theme-dark .table-modern tbody tr {
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.4);
}

.table-modern tbody tr:hover {
  background: rgba(37, 99, 235, 0.06);
}

body.theme-dark .table-modern tbody tr:hover {
  background: rgba(56, 189, 248, 0.12);
}

.age-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.08));
}

body.theme-dark .age-card {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.14), rgba(99, 102, 241, 0.12));
}

.age-kpi {
  background: rgba(255, 255, 255, 0.7);
}

body.theme-dark .age-kpi {
  background: rgba(15, 23, 42, 0.6);
}

.age-tile {
  background: rgba(255, 255, 255, 0.85);
}

body.theme-dark .age-tile {
  background: rgba(15, 23, 42, 0.75);
}

.age-bar {
  background: rgba(15, 23, 42, 0.08);
}

body.theme-dark .age-bar {
  background: rgba(148, 163, 184, 0.2);
}

.age-bar-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.login-page {
  background: transparent;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  border-radius: 24px;
}

body.theme-dark .login-card {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 55px rgba(2, 6, 23, 0.55);
}

.login-logo-float {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(14, 165, 233, 0.2));
  border-color: rgba(37, 99, 235, 0.35);
}

body.theme-dark .login-logo-float {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(99, 102, 241, 0.2));
  border-color: rgba(56, 189, 248, 0.35);
}

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

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.map-card {
  display: grid;
  gap: 12px;
}

.map-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.06), rgba(14, 165, 233, 0.06));
  height: 360px;
  min-height: 300px;
}

.map-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-marker {
  position: absolute;
  right: 22%;
  top: 45%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.18);
}

body.theme-dark .map-marker {
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.2);
}

.map-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.75);
}

body.theme-dark .map-chip {
  background: rgba(15, 23, 42, 0.75);
}

.map-leaflet {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
}

.leaflet-container {
  background: rgba(148, 163, 184, 0.1);
  border-radius: 16px;
  font-family: "Bahnschrift", "Segoe UI Variable", "Segoe UI", "Noto Sans", sans-serif;
  color: var(--text);
}

.map-empty {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  text-align: center;
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2;
}

body.theme-dark .map-empty {
  background: rgba(15, 23, 42, 0.7);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.map-card::after {
  opacity: 0.18;
}

body.theme-dark .map-card::after {
  opacity: 0.12;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

.legend-dot.green {
  background: var(--green);
}

.legend-dot.yellow {
  background: var(--yellow);
}

.legend-dot.red {
  background: var(--red);
}

.legend-ring {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: transparent;
}

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

.info-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  min-height: 92px;
}

.info-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.info-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.info-icon.green {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.info-icon.yellow {
  background: linear-gradient(135deg, #facc15, #f59e0b);
}

.info-icon.red {
  background: linear-gradient(135deg, #f87171, #ef4444);
}

.info-icon.purple {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

.info-icon.sky {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

.info-icon.blue {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
}

.info-content {
  display: grid;
  gap: 4px;
}

.info-title {
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}

.info-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.info-sub {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 1100px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 22px 18px 32px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    background: var(--panel);
  }

  body.theme-dark .sidebar {
    background: var(--panel);
  }

  .topbar {
    top: 10px;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

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

.person-close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  border: 1px solid rgba(90, 130, 220, 0.35);
  background: linear-gradient(150deg, rgba(16, 26, 40, 0.98), rgba(10, 16, 28, 0.9));
  box-shadow: 0 10px 22px rgba(5, 10, 18, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.person-close:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 160, 255, 0.6);
  box-shadow: 0 14px 30px rgba(6, 12, 22, 0.55);
}

.person-close:active {
  transform: translateY(0);
}

.login-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
}

.modal-close-x {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.person-hero-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.person-hero-name {
  font-size: 26px;
  margin: 6px 0 4px;
}

.person-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(47, 91, 219, 0.35);
  background: rgba(47, 91, 219, 0.18);
  color: #b9ccff;
  font-size: 12px;
  font-weight: 600;
}

.person-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 20, 32, 0.85);
  font-size: 12px;
  color: var(--text);
}

.person-profile {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.person-section {
  margin-top: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 16px;
}

.person-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.info-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 18, 30, 0.7);
}

.info-item.wide {
  grid-column: span 2;
}

.info-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.info-value {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
}

.person-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.media-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(10, 18, 30, 0.7);
  display: grid;
  gap: 8px;
}

.media-title {
  font-size: 12px;
  color: var(--muted);
}

.media-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.media-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(8, 15, 26, 0.6);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.media-placeholder-error {
  border-style: solid;
  border-color: rgba(231, 76, 60, 0.28);
  background: rgba(96, 24, 24, 0.18);
  color: var(--text);
  text-align: center;
  padding: 12px;
}

.history-thumb-placeholder {
  width: 72px;
  height: 72px;
  aspect-ratio: auto;
  font-size: 10px;
  line-height: 1.3;
  padding: 6px;
}

.history-media {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  display: block;
}

.history-meta {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.location-card {
  display: grid;
  gap: 10px;
  align-items: start;
}

.qr-image {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px;
}

.category-block {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--panel-2);
  color: var(--text);
  margin-bottom: 10px;
}

.category-block summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.category-block summary::-webkit-details-marker {
  display: none;
}

.category-body {
  margin-top: 10px;
}

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

.relatives-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 18, 30, 0.7);
  display: grid;
  gap: 4px;
}

.relatives-name {
  font-weight: 600;
}

.relatives-meta {
  font-size: 12px;
  color: var(--muted);
}

.person-alerts {
  margin-bottom: 16px;
}

@media (max-width: 980px) {
  .person-profile {
    grid-template-columns: 1fr;
  }

  .person-media-grid {
    grid-template-columns: 1fr;
  }

  .person-info-grid {
    grid-template-columns: 1fr;
  }

  .info-item.wide {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .person-hero-name {
    font-size: 22px;
  }

  .info-chip {
    width: 100%;
    justify-content: space-between;
  }

  .person-profile-header {
    gap: 10px;
  }
}

/* =========================
   Utilities (CSP)
   ========================= */
.u-text-center {
  text-align: center;
}

.u-inline {
  display: inline;
}

.u-block {
  display: block;
}

.u-hidden {
  display: none !important;
}

.u-flex {
  display: flex;
}

.u-flex-wrap {
  flex-wrap: wrap;
}

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

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

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

.u-gap-8 {
  gap: 8px;
}

.u-gap-10 {
  gap: 10px;
}

.u-gap-12 {
  gap: 12px;
}

.u-gap-16 {
  gap: 16px;
}

.u-grid {
  display: grid;
}

.u-grid-cols-1 {
  grid-template-columns: 1fr;
}

.u-grid-cols-2 {
  grid-template-columns: 1fr 1fr;
}

.u-grid-cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.u-grid-cols-1-140 {
  grid-template-columns: 1fr 140px;
}

.u-py-6 {
  padding-top: 6px;
  padding-bottom: 6px;
}

.u-border-bottom {
  border-bottom: 1px solid var(--border);
}

.u-m-0 {
  margin: 0;
}

.u-my-12 {
  margin-top: 12px;
  margin-bottom: 12px;
}

.u-mb-6 {
  margin-bottom: 6px;
}

.u-mb-8 {
  margin-bottom: 8px;
}

.u-mb-10 {
  margin-bottom: 10px;
}

.u-mb-12 {
  margin-bottom: 12px;
}

.u-mb-16 {
  margin-bottom: 16px;
}

.u-mb-20 {
  margin-bottom: 20px;
}

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

.u-mt-8 {
  margin-top: 8px;
}

.u-mt-10 {
  margin-top: 10px;
}

.u-mt-12 {
  margin-top: 12px;
}

.u-mt-14 {
  margin-top: 14px;
}

.u-mt-16 {
  margin-top: 16px;
}

.u-mt-20 {
  margin-top: 20px;
}

.u-ml-10 {
  margin-left: 10px;
}

.u-fs-12 {
  font-size: 12px;
}

.u-fs-13 {
  font-size: 13px;
}

.u-fs-20 {
  font-size: 20px;
}

.u-fs-24 {
  font-size: 24px;
}

.u-fs-28 {
  font-size: 28px;
}

.u-fw-600 {
  font-weight: 600;
}

.u-fw-700 {
  font-weight: 700;
}

.u-break-all {
  word-break: break-all;
}

.u-width-auto {
  width: auto;
}

.u-size-180 {
  width: 180px;
  height: 180px;
}

.u-size-220 {
  width: 220px;
  height: 220px;
}

.u-flex-1-min-220 {
  flex: 1;
  min-width: 220px;
}

.u-list-reset {
  list-style: none;
  padding: 0;
  margin: 0;
}

.u-muted {
  color: var(--muted);
}

@media (max-width: 980px) {

  .u-grid-cols-2,
  .u-grid-cols-3 {
    grid-template-columns: 1fr;
  }
}

.btn-danger {
  background: linear-gradient(120deg, #aa2f2f, #7a1f1f);
}

/* =========================
   Modern UI Refresh (2026)
   ========================= */
.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-title {
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 800;
  margin: 0 0 6px;
}

.page-subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

body.theme-dark .chip {
  background: rgba(15, 23, 42, 0.6);
}

.chip.green {
  color: var(--green);
  border-color: rgba(22, 163, 74, 0.35);
}

.chip.yellow {
  color: var(--yellow);
  border-color: rgba(245, 158, 11, 0.35);
}

.chip.red {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.35);
}

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

.stat-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.stat-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.stat-icon.green {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.stat-icon.yellow {
  background: linear-gradient(135deg, #facc15, #f59e0b);
}

.stat-icon.red {
  background: linear-gradient(135deg, #f87171, #ef4444);
}

.stat-icon.purple {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

.stat-icon.sky {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

.stat-icon.blue {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
}

.stat-label {
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  margin-top: 2px;
}

.stat-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.section {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
}

.section-sub {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

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

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

.panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
}

body.theme-dark .panel-head {
  background: rgba(15, 23, 42, 0.7);
}

.panel-title {
  font-weight: 700;
  margin: 0 0 4px;
  font-size: 15px;
}

.panel-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-body {
  padding: 12px 14px 16px;
}

.panel-foot {
  padding: 10px 14px 14px;
}

.table-neo {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  background: transparent;
}

.table-neo thead th {
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 11px;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.table-neo tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 13px;
  vertical-align: middle;
}

body.theme-dark .table-neo tbody td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.table-neo tbody tr:hover {
  background: rgba(37, 99, 235, 0.06);
}

.empty-state {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-columns.modern .dashboard-column {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

@media (max-width: 980px) {
  .page-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* =========================
   Off-canvas Nav (Responsive)
   ========================= */
.app-shell {
  grid-template-columns: 270px 1fr;
}

.sidebar {
  position: relative;
  transform: none;
  width: auto;
  max-width: none;
  height: 100vh;
  z-index: 10;
}

.sidebar-overlay {
  display: none;
}

.sidebar-toggle {
  display: none;
}

.topbar {
  position: static;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 290px;
    max-width: 86vw;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 50;
  }

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

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    display: none;
    z-index: 40;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .sidebar-toggle {
    display: inline-flex;
  }
}

/* Auto-hide sidebar on long pages (desktop only) */
body.nav-hidden .app-shell {
  grid-template-columns: 1fr;
}

body.nav-hidden .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  transform: translateX(-105%);
  transition: transform 0.25s ease;
  z-index: 50;
  box-shadow: 12px 0 30px rgba(2, 6, 23, 0.35);
}

body.nav-hidden .sidebar-toggle {
  display: inline-flex;
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 70;
}

body.nav-hidden.sidebar-open .sidebar {
  transform: translateX(0);
}

body.nav-hidden .sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 40;
}

body.nav-hidden.sidebar-open .sidebar-overlay {
  display: block;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.legend-label {
  flex: 1;
}

.legend-count {
  font-size: 12px;
  color: var(--muted);
}

.legend-dot.color-0 {
  background: #2f5bdb;
}

.legend-dot.color-1 {
  background: #4a7bff;
}

.legend-dot.color-2 {
  background: #6ed3ff;
}

.legend-dot.color-3 {
  background: #8c7bff;
}

.legend-dot.color-4 {
  background: #39c0ff;
}

.legend-dot.color-5 {
  background: #f1c40f;
}

.legend-dot.color-6 {
  background: #e67e22;
}

/* =========================
   UI Reset 2026
   ========================= */
:root {
  --font-body: "IBM Plex Sans", "Noto Sans", sans-serif;
  --font-display: "Sora", "IBM Plex Sans", sans-serif;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 26px;
}

body.theme-light {
  --bg: #f6f1e8;
  --bg-2: #efe7da;
  --panel: #ffffff;
  --panel-2: #f7f3ec;
  --card: #ffffff;
  --text: #101624;
  --muted: #5b6676;
  --border: #e3dccf;
  --accent: #0f766e;
  --accent-2: #0b5f57;
  --accent-3: #f97316;
  --shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
  --green: #16a34a;
  --yellow: #eab308;
  --red: #dc2626;
  --sidebar-bg: #0b1426;
  --sidebar-text: #e6edf6;
  --sidebar-muted: #93a4bf;
}

body.theme-dark {
  --bg: #0b111a;
  --bg-2: #0f172a;
  --panel: #101826;
  --panel-2: #111c2f;
  --card: #0f1a2e;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --accent: #22c1a6;
  --accent-2: #0ea5e9;
  --accent-3: #f59e0b;
  --shadow: 0 18px 42px rgba(2, 6, 23, 0.55);
  --green: #22c55e;
  --yellow: #fbbf24;
  --red: #f87171;
  --sidebar-bg: #0a1222;
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
}

body {
  font-family: var(--font-body);
  background: radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.65), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(15, 118, 110, 0.08), transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  letter-spacing: 0.1px;
}

body.theme-dark {
  background: radial-gradient(circle at 12% 8%, rgba(56, 189, 248, 0.10), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(34, 193, 166, 0.12), transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

body::before {
  background-image:
    linear-gradient(90deg, rgba(15, 23, 42, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.35;
}

body.theme-dark::before {
  background-image:
    linear-gradient(90deg, rgba(148, 163, 184, 0.14) 1px, transparent 1px),
    linear-gradient(0deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  opacity: 0.25;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: 0.2px;
}

.app-shell {
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 26px 18px;
  box-shadow: 8px 0 24px rgba(2, 6, 23, 0.25);
}

.sidebar .brand {
  font-family: var(--font-display);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #fff;
}

.sidebar .brand img {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-nav {
  gap: 8px;
}

.nav-item {
  color: var(--sidebar-muted);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(2px);
}

.nav-logout {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.16);
}

.nav-logout:hover {
  background: rgba(248, 113, 113, 0.22);
  color: #fff;
}

.main {
  padding: 32px 32px 48px;
  max-width: 1600px;
  background: transparent;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 20;
  padding: 12px 16px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar .badge {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.25);
}

.theme-toggle,
.sidebar-toggle,
.button-outline {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 118, 110, 0.08);
  color: var(--text);
}

.theme-toggle:hover,
.sidebar-toggle:hover,
.button-outline:hover {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 8px 16px rgba(15, 118, 110, 0.18);
}

.user-pill {
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.2);
}

input,
select,
textarea {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 118, 110, 0.5);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.18);
}

button.primary,
a.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 22px rgba(15, 118, 110, 0.25);
  border-radius: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  overflow: hidden;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.login-logo-float {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), rgba(15, 118, 110, 0.25) 45%, rgba(2, 6, 23, 0.9) 80%);
  border-color: rgba(15, 118, 110, 0.35);
}

.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  opacity: 0.8;
  pointer-events: none;
}

.card>* {
  position: relative;
  z-index: 1;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.16);
}

.info-box {
  border-radius: var(--radius-xl);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.info-icon {
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.2);
}

.status {
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
}

.status.green {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--green);
}

.status.yellow {
  background: rgba(234, 179, 8, 0.14);
  border-color: rgba(234, 179, 8, 0.3);
  color: var(--yellow);
}

.status.red {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.3);
  color: var(--red);
}

.pill,
.badge {
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.25);
}

.table {
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
}

.table th {
  background: var(--panel-2);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}

.table td {
  background: var(--card);
}

.table-modern tbody tr {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.table-modern tbody tr:hover {
  background: rgba(15, 118, 110, 0.06);
}

.table-scroll {
  border-radius: var(--radius-lg);
}

.map-frame {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 20% 20%, rgba(15, 118, 110, 0.22), transparent 55%),
    radial-gradient(circle at 85% 0%, rgba(14, 165, 233, 0.16), transparent 45%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.2), rgba(2, 6, 23, 0.12));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.map-empty {
  inset: auto 16px 16px 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.14);
  border: 1px solid rgba(15, 118, 110, 0.28);
  color: var(--text);
  font-weight: 500;
  display: none;
  pointer-events: none;
  z-index: 3;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.2);
}

body.theme-dark .map-empty {
  background: rgba(6, 10, 22, 0.76);
  border-color: rgba(34, 193, 166, 0.32);
}

body.theme-light .map-frame {
  background:
    radial-gradient(circle at 20% 20%, rgba(15, 118, 110, 0.14), transparent 55%),
    radial-gradient(circle at 85% 0%, rgba(14, 165, 233, 0.1), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.55));
}

body.theme-light .map-empty {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(15, 118, 110, 0.2);
}

.map-legend {
  gap: 10px;
  color: var(--muted);
}

.map-frame .leaflet-container {
  background:
    radial-gradient(circle at 25% 20%, rgba(15, 118, 110, 0.2), rgba(2, 6, 23, 0.25));
  font-family: var(--font-body);
  color: var(--text);
  border-radius: var(--radius-xl);
}

body.theme-light .map-frame .leaflet-container {
  background:
    radial-gradient(circle at 25% 20%, rgba(15, 118, 110, 0.12), rgba(255, 255, 255, 0.7));
}

.map-frame .leaflet-bar,
.map-frame .leaflet-control-layers {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 118, 110, 0.12);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.28);
}

body.theme-light .map-frame .leaflet-bar,
body.theme-light .map-frame .leaflet-control-layers {
  background: rgba(255, 255, 255, 0.92);
}

.map-frame .leaflet-control-layers,
.map-frame .leaflet-control-layers label {
  color: var(--text);
}

.map-frame .leaflet-bar a {
  background: transparent;
  color: var(--text);
  width: 34px;
  height: 34px;
  line-height: 34px;
  border-bottom: 1px solid var(--border);
}

.map-frame .leaflet-bar a:last-child {
  border-bottom: none;
}

.map-frame .leaflet-bar a:hover,
.map-frame .leaflet-bar a:focus {
  background: rgba(15, 118, 110, 0.18);
}

.map-frame .leaflet-control-layers-toggle {
  width: 34px;
  height: 34px;
  background-size: 18px 18px;
}

.map-frame .leaflet-control-layers-expanded {
  padding: 10px 12px;
}

.map-frame .leaflet-control-attribution {
  font-size: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.6);
  color: var(--muted);
  border: 1px solid var(--border);
}

body.theme-light .map-frame .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.9);
}

.map-frame .leaflet-control-attribution a {
  color: var(--text);
  opacity: 0.85;
}

.map-frame .leaflet-control-scale-line {
  border: 1px solid var(--border);
  background: rgba(15, 118, 110, 0.12);
  color: var(--text);
  border-radius: 10px;
}

.map-frame .leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 32px rgba(2, 6, 23, 0.45);
}

.map-frame .leaflet-popup-tip {
  background: var(--panel);
  border: 1px solid var(--border);
}

.map-frame .leaflet-popup-content {
  margin: 10px 12px;
  font-family: var(--font-body);
}

.map-frame .leaflet-popup-close-button {
  color: var(--muted);
}

.map-frame .leaflet-popup-close-button:hover {
  color: var(--text);
}

.map-frame .leaflet-interactive.map-dot {
  filter: drop-shadow(0 8px 12px rgba(2, 6, 23, 0.35));
  transition: transform 0.15s ease, filter 0.15s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.map-frame .leaflet-interactive.map-dot:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 10px 16px rgba(2, 6, 23, 0.45));
}

.map-frame .leaflet-interactive.map-ring {
  filter: drop-shadow(0 10px 18px rgba(15, 118, 110, 0.25));
}

.dashboard-column {
  max-height: none;
  overflow: visible;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 30;
}

body.sidebar-open .sidebar-overlay {
  display: block;
}

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

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

.card,
.info-box,
.login-card {
  animation: card-rise 0.4s ease both;
}

@media (prefers-reduced-motion: reduce) {

  .card,
  .info-box,
  .login-card {
    animation: none;
  }
}

/* =========================
   User Card (Topbar)
   ========================= */
.user-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.7));
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  min-width: 220px;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.user-meta .user-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta .user-role {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-action {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  background: rgba(37, 99, 235, 0.1);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.user-action:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.16);
}

body.theme-dark .user-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.6));
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.45);
}

body.theme-dark .user-avatar {
  border-color: rgba(148, 163, 184, 0.28);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.5);
}

body.theme-dark .user-action {
  border-color: rgba(56, 189, 248, 0.28);
  background: rgba(56, 189, 248, 0.12);
}

body.theme-dark .user-action:hover {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.5);
}

@media (max-width: 640px) {
  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .user-card {
    width: 100%;
    grid-template-columns: auto 1fr;
    gap: 10px 12px;
  }

  .user-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* =========================
   Person Create Form (Modern)
   ========================= */
.person-form {
  display: grid;
  gap: 18px;
}

.person-form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.person-form-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 600;
}

.person-form-title {
  margin: 6px 0 4px;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 700;
}

.person-form-sub {
  color: var(--muted);
  font-size: 13px;
  max-width: 560px;
}

.form-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.form-section::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 55%);
  opacity: 0.6;
  pointer-events: none;
}

body.theme-dark .form-section::after {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), transparent 55%);
  opacity: 0.4;
}

.form-section>* {
  position: relative;
  z-index: 1;
}

.form-section-compact {
  padding: 14px 16px;
}

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

.section-title {
  font-size: 16px;
  font-weight: 700;
}

.section-sub {
  font-size: 12px;
  color: var(--muted);
}

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

.person-form .form-group {
  margin: 0;
  display: grid;
  gap: 6px;
}

.person-form .form-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 600;
}

.field-full {
  grid-column: 1 / -1;
}

.person-form input,
.person-form select,
.person-form textarea {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

body.theme-dark .person-form input,
body.theme-dark .person-form select,
body.theme-dark .person-form textarea {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text);
}

.fullname-preview {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px dashed rgba(37, 99, 235, 0.35);
  font-weight: 600;
}

body.theme-dark .fullname-preview {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
}

.form-alert {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  grid-column: 1 / -1;
}

.form-alert-inline {
  margin-bottom: 12px;
}

.form-alert-info,
.form-alert.info {
  border-color: rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.form-alert.success {
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.form-alert.error {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

body.theme-dark .form-alert {
  color: #fbbf24;
}

body.theme-dark .form-alert-info,
body.theme-dark .form-alert.info {
  color: #93c5fd;
}

body.theme-dark .form-alert.success {
  color: #86efac;
}

body.theme-dark .form-alert.error {
  color: #fca5a5;
}

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

.relative-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px dashed rgba(15, 23, 42, 0.15);
}

body.theme-dark .relative-row {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.25);
}

.section-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}

.upload-card .file-input {
  background: rgba(15, 23, 42, 0.04);
  border-radius: 12px;
  border: 1px dashed rgba(15, 23, 42, 0.2);
  padding: 12px;
}

body.theme-dark .upload-card .file-input {
  background: rgba(15, 23, 42, 0.35);
  border-color: rgba(148, 163, 184, 0.25);
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.form-submit {
  min-width: 200px;
}

@media (max-width: 640px) {
  .person-form-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .relative-row {
    grid-template-columns: 1fr;
  }

  .form-footer {
    justify-content: stretch;
  }

  .form-submit {
    width: 100%;
  }
}

@media (max-width: 980px) {
  .main {
    padding: 22px 18px 32px;
  }
}

/* =========================
   Theme Light Fix (Cards)
   ========================= */
body.theme-light .card,
body.theme-light .panel,
body.theme-light .info-box,
body.theme-light .stat-card,
body.theme-light .settings-panel,
body.theme-light .settings-profile-card,
body.theme-light .person-card,
body.theme-light .inspector-card,
body.theme-light .media-card,
body.theme-light .age-card,
body.theme-light .age-tile,
body.theme-light .modal-card {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}

body.theme-light .table,
body.theme-light .table-modern tbody tr,
body.theme-light .table-neo tbody tr,
body.theme-light .table-modern thead th,
body.theme-light .table-neo thead th {
  background: #ffffff;
}

body.theme-light .table-modern tbody tr:hover,
body.theme-light .table-neo tbody tr:hover {
  background: rgba(37, 99, 235, 0.06);
}

body.theme-light .panel-head {
  background: rgba(255, 255, 255, 0.85);
}

body.theme-light .mahalla-chip,
body.theme-light .category-chip,
body.theme-light .info-item,
body.theme-light .relatives-item,
body.theme-light .stat-row,
body.theme-light .settings-info-item {
  background: #ffffff;
  border-color: var(--border);
}

/* =========================
   UI Fixes: Theme, Spacing, Menu
   ========================= */
body.theme-light {
  --accent-bg: rgba(15, 118, 110, 0.12);
  --accent-border: rgba(15, 118, 110, 0.28);
  --accent-soft: rgba(15, 118, 110, 0.08);
  --sidebar-bg: #ffffff;
  --sidebar-text: #0f172a;
  --sidebar-muted: #5b6676;
}

body.theme-dark {
  --accent-bg: rgba(34, 193, 166, 0.18);
  --accent-border: rgba(34, 193, 166, 0.32);
  --accent-soft: rgba(34, 193, 166, 0.12);
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--border);
}

.sidebar .brand {
  color: var(--sidebar-text);
}

.sidebar-nav {
  gap: 12px;
}

.nav-item {
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--sidebar-muted);
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--sidebar-text);
  transform: translateX(2px);
}

.main {
  padding: 34px 32px 50px;
}

.card {
  padding: 20px 22px;
}

.card-grid {
  gap: 20px;
}

.dashboard-shell {
  gap: 20px;
}

.dashboard-columns {
  gap: 20px;
}

.dashboard-column {
  gap: 18px;
}

.dashboard-split {
  gap: 18px;
}

.section-head {
  margin-bottom: 16px;
}

.form-grid {
  gap: 18px;
}

.person-form {
  gap: 20px;
}

.form-section {
  padding: 20px;
}

.table th,
.table td {
  padding: 14px 16px;
}

.table-modern tbody td {
  padding: 14px 16px;
}

@media (min-width: 981px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
  }

  body.nav-hidden .app-shell {
    grid-template-columns: 280px 1fr;
  }

  body.nav-hidden .sidebar {
    position: sticky;
    transform: none;
    box-shadow: 8px 0 24px rgba(2, 6, 23, 0.12);
  }

  body.nav-hidden .sidebar-toggle,
  body.nav-hidden .sidebar-overlay {
    display: none;
  }
}

@media (max-width: 980px) {
  .main {
    padding: 22px 18px 32px;
  }

  .sidebar-nav {
    gap: 10px;
  }

  .nav-item {
    padding: 10px 12px;
  }
}

/* =========================
   Fixes: Theme + Responsive (2026-03-01)
   ========================= */
body {
  overflow-x: hidden;
}

body.theme-light {
  color-scheme: light;
}

body.theme-dark {
  color-scheme: dark;
}

.table td,
.table th {
  color: var(--text);
}

body.theme-dark .table td,
body.theme-dark .table-modern tbody td,
body.theme-dark .table-neo tbody td {
  color: #f8fafc;
}

body.theme-dark .table th,
body.theme-dark .table-modern thead th,
body.theme-dark .table-neo thead th,
body.theme-dark .table-stacked td::before {
  color: rgba(248, 250, 252, 0.75);
}

body.theme-dark .table td a,
body.theme-dark .table-modern td a,
body.theme-dark .table-neo td a {
  color: #e8f0ff;
}

body.theme-dark .table td a:hover,
body.theme-dark .table-modern td a:hover,
body.theme-dark .table-neo td a:hover {
  color: #ffffff;
}

.app-shell {
  min-height: 100svh;
}

.main,
.topbar,
.topbar-left,
.topbar-actions,
.user-card {
  min-width: 0;
}

/* Ensure light theme surfaces are actually light */
body.theme-light .stat-row,
body.theme-light .stat-block,
body.theme-light .meta-item,
body.theme-light .age-kpi,
body.theme-light .age-card,
body.theme-light .age-tile,
body.theme-light .info-item,
body.theme-light .relatives-item,
body.theme-light .settings-info-item,
body.theme-light .person-close {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
}

body.theme-light .stat-pill.secondary,
body.theme-light .name-chip {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--text);
}

body.theme-light .person-close {
  box-shadow: var(--shadow);
}

/* Mobile/tablet navigation consistency */
@media (max-width: 980px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar {
    right: auto;
    top: 0;
    bottom: 0;
    border-top: none;
    border-right: 1px solid var(--border);
    justify-content: flex-start;
    padding: 20px 16px;
  }

  .sidebar .brand {
    display: flex;
  }
}

@media (min-width: 641px) and (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-left {
    flex: 1 1 220px;
    min-width: 0;
    flex-wrap: wrap;
  }

  .topbar-actions {
    flex: 1 1 260px;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    row-gap: 10px;
  }

  .user-card {
    flex: 1 1 260px;
    max-width: 100%;
  }

  .user-meta .user-name {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .topbar-actions {
    gap: 8px;
  }

  .user-actions {
    flex-wrap: wrap;
  }

  .user-meta .user-name {
    white-space: normal;
    overflow: visible;
  }

  .table-modern.table-stacked td,
  .table-neo.table-stacked td,
  .table.table-stacked td {
    grid-template-columns: minmax(84px, 120px) minmax(0, 1fr);
    word-break: break-word;
  }
}

/* =========================
   Person Detail Spacing
   ========================= */
.person-profile-main,
.person-profile-side {
  display: grid;
  gap: 16px;
}

.person-profile+.person-section {
  margin-top: 16px;
}

.person-profile~.person-section+.person-section {
  margin-top: 16px;
}

/* =========================
   Theme Light Fix (Forms + Panels)
   ========================= */
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}

body.theme-light input::placeholder,
body.theme-light textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

body.theme-light .file-input,
body.theme-light .camera-capture,
body.theme-light .upload-card .file-input {
  background: var(--panel-2);
  border-color: var(--border);
}

body.theme-light .info-panel {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--muted);
}

body.theme-light .info-chip {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--text);
}

body.theme-light .info-chip-warn {
  background: rgba(234, 179, 8, 0.18);
  border-color: rgba(234, 179, 8, 0.35);
  color: #7a4b00;
}

body.theme-light .alert {
  background: var(--panel-2);
  border-color: var(--border);
}

body.theme-light .alert-meta {
  color: var(--muted);
}

body.theme-light .category-block,
body.theme-light .media-placeholder {
  background: var(--panel-2) !important;
  border-color: var(--border) !important;
  color: var(--text);
}

body.theme-light .category-block summary,
body.theme-light .category-block .table th,
body.theme-light .category-block .table td {
  color: var(--text);
}

body.theme-light .media-thumb {
  border-color: var(--border);
  background: #ffffff;
}

/* =========================
   Soft Inset Shadow (Siliq)
   ========================= */
:root {
  --soft-inset-shadow: inset 14px 14px 40px rgba(0, 0, 0, 0.2),
    inset -14px -14px 40px rgba(255, 255, 255, 0.08);
}

body.theme-light {
  --soft-inset-shadow: inset 14px 14px 40px rgba(0, 0, 0, 0.12),
    inset -14px -14px 40px rgba(255, 255, 255, 0.6);
}

body.theme-dark {
  --soft-inset-shadow: inset 18px 18px 50px rgba(0, 0, 0, 0.55),
    inset -18px -18px 50px rgba(255, 255, 255, 0.05);
}

.soft-inset {
  box-shadow: var(--soft-inset-shadow);
}

.soft-inset:hover {
  box-shadow: var(--soft-inset-shadow);
}

button.soft-inset:disabled,
.soft-inset[aria-disabled="true"] {
  box-shadow: none;
}

/* =========================
   Global Loader
   ========================= */
body.is-loading {
  overflow: hidden;
}

.global-loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 12, 20, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 9999;
}

.global-loader.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.loading-stack {
  display: grid;
  place-items: center;
  gap: 14px;
  color: #f0f0f0;
}

.loading-label {
  font-size: 14px;
  letter-spacing: 0.4px;
  color: rgba(240, 240, 240, 0.9);
}

.loading-orbit {
  position: relative;
  width: 13em;
  height: 13em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.loading-bars,
.loading-balls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-bar {
  position: absolute;
  width: 1.15em;
  height: 13em;
  border-radius: 50px;
  background: #e0e0e0;
}

.loading-bar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1.15em;
  height: 5em;
  background: #e0e0e0;
  border-radius: 50px;
  border: 1px solid #e2e2e2;
  box-shadow:
    inset 5px 5px 15px #d3d2d2ab,
    inset -5px -5px 15px #e9e9e9ab;
  -webkit-mask-image: linear-gradient(to bottom,
      black calc(100% - 48px),
      transparent 100%);
  mask-image: linear-gradient(to bottom,
      black calc(100% - 48px),
      transparent 100%);
}

.loading-bar::before {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 1.15em;
  height: 4.5em;
  background: #e0e0e0;
  border-radius: 50px;
  border: 1px solid #e2e2e2;
  box-shadow:
    inset 5px 5px 15px #d3d2d2ab,
    inset -5px -5px 15px #e9e9e9ab;
  -webkit-mask-image: linear-gradient(to top,
      black calc(100% - 48px),
      transparent 100%);
  mask-image: linear-gradient(to top,
      black calc(100% - 48px),
      transparent 100%);
}

.loading-track {
  position: absolute;
  width: 1.15em;
  height: 13em;
  border-radius: 50px;
  background: transparent;
}

.loading-ball {
  width: 1.15em;
  height: 1.15em;
  box-shadow:
    rgba(0, 0, 0, 0.17) 0px -10px 10px 0px inset,
    rgba(0, 0, 0, 0.15) 0px -15px 15px 0px inset,
    rgba(0, 0, 0, 0.1) 0px -40px 20px 0px inset,
    rgba(0, 0, 0, 0.06) 0px 2px 1px,
    rgba(0, 0, 0, 0.09) 0px 4px 2px,
    rgba(0, 0, 0, 0.09) 0px 8px 4px,
    rgba(0, 0, 0, 0.09) 0px 16px 8px,
    rgba(0, 0, 0, 0.09) 0px 32px 16px,
    0px -1px 15px -8px rgba(0, 0, 0, 0.09);
  border-radius: 50%;
  transition: transform 800ms cubic-bezier(1, -0.4, 0, 1.4);
  background-color: rgba(232, 232, 232, 1);
  animation: 3.63s loading-move ease-in-out infinite;
}

.loading-bar:nth-child(2) {
  transform: rotate(20deg);
}

.loading-bar:nth-child(3) {
  transform: rotate(40deg);
}

.loading-bar:nth-child(4) {
  transform: rotate(60deg);
}

.loading-bar:nth-child(5) {
  transform: rotate(80deg);
}

.loading-bar:nth-child(6) {
  transform: rotate(100deg);
}

.loading-bar:nth-child(7) {
  transform: rotate(120deg);
}

.loading-bar:nth-child(8) {
  transform: rotate(140deg);
}

.loading-bar:nth-child(9) {
  transform: rotate(160deg);
}

.loading-track:nth-child(2) {
  transform: rotate(20deg);
}

.loading-track:nth-child(3) {
  transform: rotate(40deg);
}

.loading-track:nth-child(4) {
  transform: rotate(60deg);
}

.loading-track:nth-child(5) {
  transform: rotate(80deg);
}

.loading-track:nth-child(6) {
  transform: rotate(100deg);
}

.loading-track:nth-child(7) {
  transform: rotate(120deg);
}

.loading-track:nth-child(8) {
  transform: rotate(140deg);
}

.loading-track:nth-child(9) {
  transform: rotate(160deg);
}

.ball1 {
  animation-delay: 0.2s;
}

.ball2 {
  animation-delay: 0.4s;
}

.ball3 {
  animation-delay: 0.6s;
}

.ball4 {
  animation-delay: 0.8s;
}

.ball5 {
  animation-delay: 1s;
}

.ball6 {
  animation-delay: 1.2s;
}

.ball7 {
  animation-delay: 1.4s;
}

.ball8 {
  animation-delay: 1.6s;
}

.ball9 {
  animation-delay: 1.8s;
}

@keyframes loading-move {
  0% {
    transform: translateY(0em);
  }

  50% {
    transform: translateY(12em);
  }

  100% {
    transform: translateY(0em);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-ball {
    animation: none;
  }
}

/* =========================
   Mobile Layout Hotfix (2026-03-03)
   Prevent half-width content on phones/tablets
   ========================= */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .main {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  .topbar-actions {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .network-link-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
  }

  .network-link-url {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }
}

@media (max-width: 640px) {
  .network-link-label {
    display: none;
  }

  .network-link-copy {
    margin-left: auto;
  }

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

/* Mobile fallback for phones in desktop-UA mode */
body.device-mobile .app-shell {
  grid-template-columns: minmax(0, 1fr) !important;
}

body.device-mobile .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 290px;
  max-width: 86vw;
  transform: translateX(-105%);
  transition: transform 0.25s ease;
  z-index: 50;
}

body.device-mobile.sidebar-open .sidebar {
  transform: translateX(0);
}

body.device-mobile .sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 40;
}

body.device-mobile.sidebar-open .sidebar-overlay {
  display: block;
}

body.device-mobile .sidebar-toggle {
  display: inline-flex;
}

body.device-mobile .main {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 22px 18px 32px;
}

body.device-mobile .card {
  width: 100%;
}

body.device-mobile .topbar-actions {
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-start;
}

body.device-mobile .network-link-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
}

body.device-mobile .network-link-label {
  display: none;
}

body.device-mobile .network-link-url {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
}

body.device-mobile .network-link-copy {
  margin-left: auto;
}

body.device-mobile .user-card {
  min-width: 0;
  width: 100%;
}

body.device-mobile .download-banner {
  display: none !important;
}

body.ui-guard-active {
  -webkit-touch-callout: none;
}

body.ui-guard-active .app-shell,
body.ui-guard-active .login-page {
  -webkit-user-select: none;
  user-select: none;
}

body.ui-guard-active input,
body.ui-guard-active textarea,
body.ui-guard-active select,
body.ui-guard-active [contenteditable=""],
body.ui-guard-active [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

.ui-guard-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 10, 18, 0.92);
  backdrop-filter: blur(16px);
}

.ui-guard-overlay[aria-hidden="false"] {
  display: flex;
}

.ui-guard-overlay__card {
  width: min(100%, 480px);
  padding: 28px 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(16, 27, 44, 0.98), rgba(8, 14, 24, 0.98));
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.ui-guard-overlay__title {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  margin-bottom: 10px;
}

.ui-guard-overlay__text {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

body.devtools-blocked {
  overflow: hidden;
}

body.devtools-blocked .app-shell,
body.devtools-blocked .login-page,
body.devtools-blocked .theme-toggle-float {
  pointer-events: none;
  filter: blur(12px);
}

/* =========================
   Auth Mobile Theme Fix (2026-03-05)
   ========================= */
@media (max-width: 640px) {
  body .theme-toggle-float {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: 12px;
    padding: 8px 10px;
    gap: 6px;
    z-index: 80;
  }

  .login-page {
    padding-top: calc(env(safe-area-inset-top, 0px) + 64px);
    padding-right: 14px;
    padding-left: 14px;
    padding-bottom: 16px;
    align-items: flex-start;
  }

  .login-card {
    margin-top: 0;
    padding: 78px 18px 22px;
  }

  .login-logo-float {
    top: -50px;
    width: 100px;
    height: 100px;
  }

  body.theme-light .login-card {
    background: #ffffff;
    border-color: rgba(13, 27, 42, 0.14);
  }

  body.theme-dark .login-card {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.3);
  }
}

@media (max-width: 640px) and (min-height: 760px) {
  .login-page {
    padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 20px);
    align-items: center;
  }
}

@media (max-width: 400px) {
  body .theme-toggle-float .theme-toggle-text {
    display: none;
  }

  body .theme-toggle-float {
    min-width: 38px;
    justify-content: center;
    padding: 8px;
  }
}

/* =========================
   Modern Card Hover (2026-03-05)
   ========================= */
.card,
.stat-card,
.person-card,
.inspector-card,
.media-card,
.settings-card,
.settings-panel,
.settings-profile-card,
.relatives-item,
.info-item,
.mahalla-chip,
.stat-row {
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s ease,
    filter 0.24s ease;
  transform-origin: center center;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover,
  .stat-card:hover,
  .person-card:hover,
  .inspector-card:hover,
  .media-card:hover,
  .settings-card:hover,
  .settings-panel:hover,
  .settings-profile-card:hover,
  .relatives-item:hover,
  .info-item:hover,
  .mahalla-chip:hover,
  .stat-row:hover {
    transform: translateY(-4px) scale(1.015);
    border-color: var(--accent-border, rgba(15, 118, 110, 0.35));
    box-shadow: 0 24px 48px rgba(2, 8, 23, 0.24), 0 10px 24px rgba(15, 118, 110, 0.14);
    filter: saturate(1.03);
  }
}

/* =========================
   PWA + Mobile polish
   ========================= */
.download-banner,
.install-banner {
  margin: 0 0 18px;
  top: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(15, 76, 129, 0.94), rgba(11, 58, 99, 0.92)),
    rgba(8, 15, 26, 0.98);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(14px);
}

.download-banner .muted,
.install-banner .muted {
  color: rgba(230, 237, 246, 0.82);
}

.download-banner .primary,
.install-banner .primary,
.download-banner .button-outline,
.install-banner .button-outline {
  min-height: 42px;
}

.realtime-refresh-chip {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 76, 129, 0.18);
  background: rgba(255, 255, 255, 0.96);
  color: #0d1b2a;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
}

.realtime-refresh-chip button {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.realtime-refresh-chip button[data-realtime-reload] {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
}

.realtime-refresh-chip button[data-realtime-dismiss] {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
  line-height: 1;
}

body.theme-dark .realtime-refresh-chip {
  background: rgba(10, 18, 30, 0.94);
  color: #e6edf6;
  border-color: rgba(148, 163, 184, 0.22);
}

body.theme-dark .realtime-refresh-chip button[data-realtime-dismiss] {
  background: rgba(148, 163, 184, 0.12);
  color: #e6edf6;
}

@media (max-width: 980px) {
  .download-banner,
  .install-banner {
    top: 8px;
    padding: 14px;
    border-radius: 16px;
  }

  .pagination {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .download-banner,
  .install-banner {
    margin-bottom: 14px;
  }

  .file-input {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .file-input-label {
    width: 100%;
    text-align: center;
  }

  .file-input-name {
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    overflow-wrap: anywhere;
  }

  .button-outline.export-btn,
  .person-filter-grid .primary {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .table-modern.table-stacked td,
  .table-neo.table-stacked td,
  .table.table-stacked td {
    grid-template-columns: 1fr;
    row-gap: 4px;
  }

  .table-modern.table-stacked td::before,
  .table-neo.table-stacked td::before,
  .table.table-stacked td::before {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .table-modern.table-stacked tr,
  .table-neo.table-stacked tr,
  .table.table-stacked tr {
    padding: 14px;
    border-radius: 18px;
  }

  .realtime-refresh-chip {
    right: 12px;
    left: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    justify-content: space-between;
    border-radius: 18px;
  }
}

body.device-mobile .main {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 32px);
}

body.device-mobile .card,
body.device-mobile .settings-card,
body.device-mobile .settings-panel,
body.device-mobile .person-card,
body.device-mobile .inspector-card {
  border-radius: 20px;
}
