:root,
[data-bs-theme="light"] {
  --app-bg: #f5f7fb;
  --app-bg-soft: #eef3ff;
  --app-card: rgba(255, 255, 255, 0.96);
  --app-card-solid: #ffffff;
  --app-border: rgba(15, 23, 42, 0.10);
  --app-border-strong: rgba(15, 23, 42, 0.16);
  --app-title: #0f172a;
  --app-text: #1e293b;
  --app-muted: #64748b;
  --app-primary: #4f46e5;
  --app-primary-2: #4338ca;
  --app-info: #0891b2;
  --app-success: #059669;
  --app-warning: #d97706;
  --app-danger: #dc2626;
  --app-radius: 22px;
  --app-radius-md: 18px;
  --app-radius-sm: 14px;
  --app-shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.06);
  --app-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
  --app-shadow-lg: 0 28px 70px rgba(15, 23, 42, 0.14);
  --app-max-width: 1680px;

  --commentaire: #0ea5e9;
  --maj: #94a3b8;

  --bs-primary: var(--app-primary);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--app-primary);
  --bs-link-hover-color: var(--app-primary-2);
  --bs-border-radius: 1rem;
  --bs-border-radius-sm: .85rem;
  --bs-border-radius-lg: 1.15rem;
  --bs-focus-ring-color: rgba(79, 70, 229, 0.16);
}

[data-bs-theme="dark"] {
  --app-bg: #0b1220;
  --app-bg-soft: #101a30;
  --app-card: rgba(15, 23, 42, 0.94);
  --app-card-solid: #0f172a;
  --app-border: rgba(148, 163, 184, 0.16);
  --app-border-strong: rgba(148, 163, 184, 0.28);
  --app-title: #e2e8f0;
  --app-text: #dbe4f0;
  --app-muted: #94a3b8;
  --app-shadow-sm: 0 14px 30px rgba(0, 0, 0, 0.30);
  --app-shadow: 0 22px 50px rgba(0, 0, 0, 0.34);
  --app-shadow-lg: 0 32px 80px rgba(0, 0, 0, 0.45);
  --bs-link-color: #a5b4fc;
  --bs-link-hover-color: #c7d2fe;
  --bs-focus-ring-color: rgba(165, 180, 252, 0.22);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--app-text);
  background:
    radial-gradient(1200px 700px at 0% 0%, rgba(79, 70, 229, 0.08), transparent 55%),
    radial-gradient(900px 600px at 100% 0%, rgba(14, 165, 233, 0.08), transparent 48%),
    linear-gradient(180deg, rgba(255,255,255,0.80), rgba(255,255,255,0.20)),
    var(--app-bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.page-login {
  background:
    radial-gradient(1000px 600px at 0% 0%, rgba(79,70,229,.14), transparent 55%),
    radial-gradient(900px 600px at 100% 100%, rgba(14,165,233,.10), transparent 48%),
    var(--app-bg);
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

a:not(.btn) {
  color: var(--bs-link-color);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:not(.btn):hover {
  color: var(--bs-link-hover-color);
}

::selection {
  background: rgba(79, 70, 229, 0.16);
}

* {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, var(--app-max-width));
  margin: 0 auto;
}

.app-main {
  width: min(100%, var(--app-max-width));
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.app-main-wide {
  max-width: none;
}

.app-main-regular {
  max-width: 1580px;
}

.app-flash {
  margin-bottom: 1rem;
}

.app-navbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

[data-bs-theme="dark"] .app-navbar {
  background: rgba(11, 18, 32, 0.82);
}

.app-brand {
  min-width: 0;
  text-decoration: none;
}

.app-brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(79,70,229,.16), rgba(14,165,233,.16));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(79,70,229,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
  overflow: hidden;
  flex: 0 0 auto;
}

.app-brand-mark-fallback {
  color: var(--app-primary);
  font-size: 1.25rem;
}

.app-brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.app-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-brand-title {
  color: var(--app-title);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.app-brand-subtitle {
  color: var(--app-muted);
  font-size: 0.79rem;
  font-weight: 700;
}

.app-navbar-toggler {
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 14px;
  padding: .45rem .7rem;
  box-shadow: none !important;
}

.app-navbar-panel {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .85rem;
}

.app-navbar-meta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.app-navbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .65rem;
  flex-wrap: wrap;
}

.app-menu-btn {
  border-radius: 999px;
  font-weight: 800;
  padding: .62rem .9rem;
  letter-spacing: .01em;
  white-space: nowrap;
}

.app-menu-btn i {
  font-size: 1rem;
}

.app-menu-btn-active {
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.14);
}

.app-menu-btn.btn-outline-primary.app-menu-btn-active {
  background: rgba(79, 70, 229, 0.10);
  border-color: rgba(79, 70, 229, 0.34);
  color: var(--app-primary-2);
}

.app-menu-btn.btn-outline-secondary.app-menu-btn-active,
.app-menu-btn.btn-outline-warning.app-menu-btn-active,
.app-menu-btn.btn-outline-danger.app-menu-btn-active {
  background: rgba(15, 23, 42, 0.04);
}

.card,
.ticket-card,
.cardx,
.dashboard-card,
.table-container,
.app-card,
.form-card,
.report-container,
.dash-card,
.filter-bar {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  box-shadow: var(--app-shadow-sm);
}

.card,
.app-card,
.form-card,
.report-container,
.dash-card,
.filter-bar {
  overflow: hidden;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid rgba(148,163,184,.18);
}

.form-label {
  font-weight: 700;
  color: var(--app-title);
}

.form-control,
.form-select,
.input-group-text,
.form-check-input {
  border-radius: 14px;
}

.form-control,
.form-select,
.input-group-text {
  min-height: 46px;
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.92);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: rgba(var(--bs-primary-rgb), .45);
  box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color);
}

.form-control::placeholder {
  color: rgba(100,116,139,.78);
}

.btn {
  border-radius: 14px;
  font-weight: 700;
}

.btn-primary,
.btn-action {
  box-shadow: 0 12px 26px rgba(79,70,229,.18);
}

.btn-primary:hover,
.btn-action:hover {
  transform: translateY(-1px);
}

.alert {
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.18);
  box-shadow: var(--app-shadow-sm);
}

.table-container,
.table-responsive {
  border-radius: inherit;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: rgba(248,250,252,.88);
  color: var(--app-muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .74rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(226,232,240,.9);
}

.table tbody td {
  padding: 1rem;
  vertical-align: middle;
  border-bottom: 1px solid rgba(241,245,249,.95);
}

.table tbody tr:hover {
  background: rgba(79, 70, 229, 0.04);
}

.user-avatar {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 900;
  border: 1px solid rgba(var(--bs-primary-rgb), .18);
  background: rgba(var(--bs-primary-rgb), .08);
  color: var(--bs-primary);
}

.role-badge,
.status-pill,
.badgetype,
.badgevis {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 800;
  font-size: .72rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(248,250,252,.85);
  color: rgba(51,65,85,.95);
}

.timeline-wrap {
  position: relative;
  padding: 8px 6px 6px 6px;
}

.timeline {
  position: relative;
  margin: 0;
  padding: 0 0 0 22px;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, rgba(148,163,184,.35), rgba(148,163,184,.10));
  border-radius: 999px;
}

.titem {
  position: relative;
  padding: 12px 0;
}

.tdot {
  position: absolute;
  left: 2px;
  top: 18px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--app-card-solid);
  border: 2px solid var(--maj);
  box-shadow: 0 6px 14px rgba(15,23,42,.10);
}

.tdot.commentaire {
  border-color: var(--commentaire);
}

.tcard {
  margin-left: 12px;
  background: var(--app-card);
  border: 1px solid rgba(148,163,184,.18);
  border-radius: var(--app-radius-sm);
  padding: 12px;
  box-shadow: 0 8px 18px rgba(15,23,42,.05);
}

body.page-login .card {
  max-width: 560px;
  margin: 3vh auto 0;
  border-radius: 24px;
  box-shadow: var(--app-shadow-lg);
}

body.page-login .card-body {
  padding: clamp(1.4rem, 3vw, 2rem);
}

body.page-login h1 {
  font-weight: 900;
  color: var(--app-title);
}

body.page-index .app-main {
  padding-top: 1rem;
}

body.page-index .report-shell {
  padding-inline: 0;
}

body.page-index .page-header h1 {
  font-size: clamp(1.7rem, 2vw, 2.4rem);
}

body.page-index .report-container {
  border-radius: 28px;
  box-shadow: var(--app-shadow-lg);
}

body.page-index .mairie-pill {
  border-radius: 999px;
  box-shadow: var(--app-shadow);
}

.modal-photo-view .modal-content {
  background: transparent;
  border: none;
}

#modalImage {
  border-radius: var(--app-radius);
  max-height: 85vh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  display: block;
}

.modal-backdrop.show {
  opacity: .85;
}

@media (max-width: 1199.98px) {
  .app-navbar-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem 0 .25rem;
  }

  .app-navbar-meta,
  .app-navbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 767.98px) {
  .app-main {
    padding: 1rem .85rem 1.6rem;
  }

  .app-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .app-brand-title {
    font-size: .98rem;
  }

  .app-brand-subtitle {
    font-size: .74rem;
  }

  .app-navbar-actions {
    gap: .55rem;
  }

  .app-menu-btn {
    width: 100%;
    justify-content: center;
  }

  .table thead th,
  .table tbody td {
    padding: .85rem .75rem;
  }

  .mapbox {
    height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
