/* Portail CDG07 : thème sombre aéré, accents tirés du logo. */

:root {
  --bg: #0d1220;
  --bg-side: #0a0f1b;
  --bg-auth: #121828;
  --surface: #151b2b;
  --surface-hover: #1a2236;
  --surface-soft: #111829;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e8ecf4;
  --text-soft: #b4bdd0;
  --muted: #98a2b8;
  --muted-2: #8993aa;
  --muted-3: #7c879e;
  --primary: #0872c2;
  --danger: #b42318;
  --font-display: "Barlow Semi Condensed", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px;
  --sidebar-w: 264px;
}

[data-bs-theme="dark"] {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-body-font-family: var(--font-body);
  --bs-border-color: var(--line-strong);
  --bs-secondary-color: var(--muted);
  --bs-link-color: #7cc8f5;
  --bs-link-hover-color: #b5e0fa;
  --bs-link-color-rgb: 124, 200, 245;
  --bs-link-hover-color-rgb: 181, 224, 250;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-body); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.icon { flex: none; }
:focus-visible { outline: 2px solid #38b0ee; outline-offset: 2px; }

/* ---------- Couleurs d'accent (chip d'icône, tuiles) ---------- */
.acc-blue    { --acc: #38b0ee; --acc-bg: rgba(0, 144, 216, 0.16); }
.acc-magenta { --acc: #e060c0; --acc-bg: rgba(181, 24, 140, 0.2); }
.acc-teal    { --acc: #2cc4bb; --acc-bg: rgba(0, 158, 150, 0.2); }
.acc-orange  { --acc: #ffa24d; --acc-bg: rgba(245, 130, 32, 0.18); }
.acc-yellow  { --acc: #fdb913; --acc-bg: rgba(253, 185, 19, 0.16); }
.acc-green   { --acc: #a2cc3a; --acc-bg: rgba(162, 204, 58, 0.18); }
.acc-red     { --acc: #ff6b70; --acc-bg: rgba(237, 28, 36, 0.18); }
.acc-indigo  { --acc: #9a9df5; --acc-bg: rgba(154, 157, 245, 0.18); }

.chip-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--acc-bg); color: var(--acc);
  display: flex; align-items: center; justify-content: center;
}
.chip-icon--muted { background: rgba(255, 255, 255, 0.06); color: var(--muted-2); }

/* ---------- Boutons ---------- */
.btn-cta, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 46px; padding: 0 20px; border-radius: 12px;
  font: 600 0.906rem var(--font-body); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: filter 0.15s, background 0.15s, border-color 0.15s;
}
.btn-cta { background: var(--primary); color: #fff; }
.btn-cta:hover { filter: brightness(1.12); color: #fff; }
.btn-cta--danger { background: var(--danger); }
.btn-cta--block, .btn-ghost--block { display: flex; width: 100%; height: 54px; font-size: 1rem; border-radius: 14px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); font-weight: 500; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.btn-ghost--sm { height: 36px; padding: 0 14px; font-size: 0.85rem; }
.btn-ghost--disabled { justify-content: space-between; height: 50px; padding: 0 18px; cursor: default; }
.btn-ghost--disabled:hover { background: transparent; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }

.badge-soon {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.4px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(253, 185, 19, 0.16); color: #fdd36b;
}
.pill {
  display: inline-block; font-size: 0.78rem; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: #a9b3c7;
}
.pill--blue { background: rgba(0, 144, 216, 0.16); border-color: transparent; color: #8fd0f7; font-weight: 600; }
.pill--yellow { background: rgba(253, 185, 19, 0.16); border-color: transparent; color: #fdd36b; font-weight: 600; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: #b5188c; color: #fff; font-weight: 600; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar--sm { background: rgba(0, 144, 216, 0.22); color: #8fd0f7; font-size: 0.875rem; }

/* ---------- Structure ---------- */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; }
.content { padding: 12px 56px 64px; max-width: 1400px; }

.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  box-sizing: border-box; padding: 24px 16px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  background: var(--bg-side); border-right: 1px solid var(--line);
}
.sidebar__top { display: flex; flex-direction: column; gap: 28px; }
.sidebar-backdrop { display: none; }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand__logo {
  width: 44px; height: 44px; border-radius: 12px; background: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.brand__logo img { width: 40px; height: 40px; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; gap: 1px; }
.brand__name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; letter-spacing: 0.4px; line-height: 1.2; }
.brand__sub { font-size: 0.78rem; color: var(--muted-2); }
.brand--lg { padding: 0; gap: 16px; }
.brand--lg .brand__logo { width: 64px; height: 64px; border-radius: 16px; }
.brand--lg .brand__logo img { width: 58px; height: 58px; }
.brand--lg .brand__name { font-size: 1.5rem; }
.brand--lg .brand__sub { font-size: 0.84rem; color: var(--muted); }

.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  padding: 20px 12px 6px; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; color: var(--muted-3);
}
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px;
  border-radius: 10px; font-size: 0.906rem; color: var(--text-soft); text-decoration: none;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #eaf0fa; }
.nav-item.is-active { background: rgba(0, 144, 216, 0.16); color: #eaf6fe; font-weight: 500; }
.nav-item.is-active .icon { color: #38b0ee; }
.nav-item__ext { margin-left: auto; color: var(--muted-3); }

.usercard {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface-soft);
}
.usercard__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.usercard__name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usercard__role { font-size: 0.78rem; color: var(--muted-2); }

.topbar { height: 76px; padding: 0 56px; display: flex; align-items: center; gap: 12px; }
.menu-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; }
.search { position: relative; width: min(460px, 100%); }
.search__field {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px; box-sizing: border-box;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted-2);
}
.search__field:focus-within { border-color: #38b0ee; }
.search__field input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 0.906rem;
}
.search__field input::placeholder { color: var(--muted-2); }
.search__kbd {
  font: inherit; font-size: 0.75rem; padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--muted);
}
.search__results {
  position: absolute; top: 52px; left: 0; right: 0; z-index: 1050; max-height: 420px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.search__results:empty { display: none; }
.search__group { padding: 12px 16px 6px; font-size: 0.72rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted-3); }
.search__item {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: var(--text); text-decoration: none;
}
.search__item:hover, .search__item:focus { background: var(--surface-hover); color: var(--text); }
.search__item small { display: block; color: var(--muted); font-size: 0.8rem; }
.search__empty { padding: 16px; color: var(--muted); font-size: 0.9rem; }

/* ---------- Pages ---------- */
.page-head { margin: 12px 0 32px; display: flex; flex-direction: column; gap: 8px; }
.page-head--row { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head h1 { margin: 0; font-family: var(--font-display); font-size: 2.375rem; line-height: 1.1; font-weight: 600; }
.page-head p { margin: 0; color: #a9b3c7; font-size: 1rem; }
.section { margin-bottom: 40px; }
.section__head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.section__title { margin: 0 0 16px; font-size: 1.125rem; font-weight: 600; }
.section__head .section__title { margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 156px; box-sizing: border-box;
  padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); text-decoration: none; transition: background 0.15s, border-color 0.15s;
}
a.tile:hover { background: var(--surface-hover); border-color: rgba(255, 255, 255, 0.2); color: var(--text); }
.tile__head { display: flex; justify-content: space-between; align-items: flex-start; }
.tile__arrow { color: var(--muted-3); }
.tile__body { display: flex; flex-direction: column; gap: 4px; }
.tile__title { font-size: 1.0625rem; font-weight: 600; }
.tile__desc { font-size: 0.84rem; color: var(--muted); }
.tile--soon .tile__title { color: var(--text-soft); }
.tile--locked { background: #111726; border: 1px dashed var(--line-strong); }
.tile--locked .tile__title { color: var(--text-soft); }
.tile--locked .tile__desc { color: var(--muted-2); }

.card-portail {
  padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.card-portail--flush { padding: 0; overflow: hidden; }
.card-portail__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-portail__title { margin: 0 0 16px; font-size: 1.0625rem; font-weight: 600; }
.card-portail__head .card-portail__title { margin: 0; }
.card-portail__subtitle { margin: 24px 0 8px; font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.notes { margin: 0; color: var(--text-soft); line-height: 1.6; }
.empty { margin: 0; padding: 24px; color: var(--muted); text-align: center; }
.card-portail:not(.card-portail--flush) .empty { padding: 8px 0; text-align: left; }

/* Filtres + liste */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.filters__search {
  flex: 1 1 320px; display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px; box-sizing: border-box;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted-2);
}
.filters__search:focus-within { border-color: #38b0ee; }
.filters__search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; }
.filters__search input::placeholder { color: var(--muted-2); }
.filters__type { width: auto; min-width: 240px; height: 44px; border-radius: 12px; background-color: var(--surface); border-color: var(--line); color: var(--text); }
.filters__check { margin: 0 4px; color: var(--muted); font-size: 0.9rem; }
.table-portail { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--line); margin: 0; }
.table-portail thead th {
  padding: 14px 20px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--muted-3); border-bottom: 1px solid var(--line-strong); background: transparent;
}
.table-portail tbody td { padding: 14px 20px; }
.table-portail tbody tr:hover td { background: var(--surface-hover); }
.row-link { color: var(--text); font-weight: 500; text-decoration: none; }
.row-link:hover { color: #b5e0fa; text-decoration: underline; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }

/* Fiche */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 20px; font-size: 0.84rem; color: var(--muted-2); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs__current { color: var(--text); }
.fiche-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.fiche-head__id { display: flex; align-items: center; gap: 20px; }
.fiche-head__icon {
  width: 72px; height: 72px; border-radius: 18px; background: var(--acc-bg); color: var(--acc);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.fiche-head h1 { margin: 0 0 10px; font-family: var(--font-display); font-size: 2.125rem; line-height: 1.1; font-weight: 600; }
.fiche-head__badges { display: flex; flex-wrap: wrap; gap: 8px; }
.fiche-head__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.tabs__item {
  padding: 10px 2px 14px; margin-bottom: -1px; font-size: 0.94rem; color: var(--muted);
  text-decoration: none; border-bottom: 2px solid transparent;
}
.tabs__item:hover { color: #eaf0fa; }
.tabs__item.is-active { color: #eaf6fe; font-weight: 600; border-bottom-color: #38b0ee; }
.fiche-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.info-list { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.info-list__row { display: flex; align-items: center; gap: 14px; min-height: 44px; }
.info-list__row dt { display: flex; align-items: center; gap: 14px; width: 150px; flex: none; font-weight: 400; font-size: 0.84rem; color: var(--muted); }
.info-list__row dd { margin: 0; font-size: 0.94rem; color: var(--text); word-break: break-word; }
.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.contact { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 6px 0; }
.contact__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.contact__name { font-size: 0.94rem; font-weight: 500; }
.contact__meta { font-size: 0.82rem; color: var(--muted); }
.contact__actions { display: flex; gap: 4px; }

/* Formulaires */
.form-card { max-width: 720px; }
.form-card .form-control, .form-card .form-select {
  background-color: var(--surface-soft); border-color: var(--line-strong); color: var(--text); border-radius: 10px; min-height: 44px;
}
.form-card .form-control:focus, .form-card .form-select:focus { border-color: #38b0ee; box-shadow: 0 0 0 3px rgba(56, 176, 238, 0.2); }
.form-card .form-label { font-size: 0.875rem; color: var(--text-soft); }
.form-card .form-text { color: var(--muted-2); }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ---------- Connexion ---------- */
.auth { display: flex; min-height: 100vh; background: var(--bg); }
.auth__hero {
  position: relative; overflow: hidden; flex: 0 0 53%; box-sizing: border-box; padding: 64px 72px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
}
.auth__rings { position: absolute; right: 0; bottom: 0; pointer-events: none; }
.auth__hero > *:not(.auth__rings) { position: relative; }
.auth__pitch { max-width: 480px; display: flex; flex-direction: column; gap: 22px; }
.auth__pitch h1 { margin: 0; font-family: var(--font-display); font-size: 3.25rem; line-height: 1.08; font-weight: 600; letter-spacing: -0.3px; }
.auth__pitch p { margin: 0; font-size: 1.0625rem; line-height: 1.6; color: #a9b3c7; }
.auth__foot { font-size: 0.8rem; line-height: 1.5; color: var(--muted-2); max-width: 420px; }
.auth__panel { flex: 1; background: var(--bg-auth); display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth__box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 28px; }
.auth__box h2 { margin: 0 0 10px; font-family: var(--font-display); font-size: 2.25rem; font-weight: 600; }
.auth__box p { margin: 0; line-height: 1.55; }
.auth__local { display: flex; flex-direction: column; gap: 14px; padding-top: 24px; border-top: 1px solid var(--line); }
.auth__local-title { font-size: 0.875rem; color: var(--muted); }
.auth__local .form-control { background: var(--surface-soft); border-color: var(--line-strong); color: var(--text); min-height: 44px; border-radius: 10px; }
.auth__collectivites { display: flex; flex-direction: column; gap: 14px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 0.9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 1040; transform: translateX(-100%); transition: transform 0.2s ease;
  }
  .sidebar.is-open { transform: none; }
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; z-index: 1030; background: rgba(0, 0, 0, 0.55); }
  .menu-toggle { display: inline-flex; }
  .topbar, .content { padding-left: 20px; padding-right: 20px; }
  .fiche-grid { grid-template-columns: 1fr; }
  .auth { flex-direction: column; }
  .auth__hero { flex: none; padding: 32px 24px; gap: 24px; }
  .auth__pitch h1 { font-size: 2.25rem; }
  .auth__rings, .auth__foot { display: none; }
  .page-head--row { flex-direction: column; }
  .info-list__row dt { width: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .tile { transition: none; }
}
