/**
 * Portail espace.comapo.fr — shell type intranet (sidebar) + charte ComApo.
 */
:root {
  --esp-brand: #0f172a;
  --esp-brand-soft: #1e293b;
  --esp-accent: #FFFC03;
  --esp-accent-soft: #fff8b3;
  --esp-blue: #006EB9;
  --esp-bg: #f8fafc;
  --esp-panel: #ffffff;
  --esp-line: #e5e7eb;
  --esp-ink: #0f172a;
  --esp-muted: #64748b;
  --esp-ok: #15803d;
  --esp-danger: #b91c1c;
  --esp-radius: 14px;
  --esp-font: "DM Sans", system-ui, -apple-system, sans-serif;
  --esp-sidebar: 240px;
  --esp-shadow: 0 10px 30px -12px rgba(15, 23, 42, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.esp {
  min-height: 100vh;
  font-family: var(--esp-font);
  color: var(--esp-ink);
  background: var(--esp-bg);
  -webkit-font-smoothing: antialiased;
}
body.esp--auth {
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(255, 252, 3, .22), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, rgba(0, 110, 185, .08), transparent 50%),
    linear-gradient(180deg, #fafbfc 0%, var(--esp-bg) 100%);
}

/* ── Sidebar (miroir intranet) ─────────────────────────────────────────── */
.esp-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--esp-sidebar);
  background: #fff;
  border-right: 1px solid var(--esp-line);
  display: flex;
  flex-direction: column;
  z-index: 150;
  font-size: 14px;
}
.esp-sidebar__brand {
  padding: 18px 20px;
  border-bottom: 1px solid #f1f5f9;
  min-height: 64px;
  display: flex;
  align-items: center;
  text-decoration: none;
}
.esp-sidebar__brand img { max-height: 38px; max-width: 100%; object-fit: contain; }
.esp-sidebar__label {
  padding: 18px 22px 8px;
  font-size: .625rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.esp-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 14px;
}
.esp-sidebar__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: var(--esp-muted);
  text-decoration: none;
  font-weight: 600;
}
.esp-sidebar__item:hover { background: #f1f5f9; color: var(--esp-ink); }
.esp-sidebar__item.is-active {
  background: var(--esp-brand);
  color: var(--esp-accent);
}
.esp-sidebar__icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.esp-sidebar__icon svg { width: 18px; height: 18px; }
.esp-sidebar__footer {
  border-top: 1px solid #f1f5f9;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.esp-sidebar__user { flex: 1; min-width: 0; }
.esp-sidebar__user-name {
  font-weight: 700;
  font-size: .85rem;
  color: var(--esp-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.esp-sidebar__user-email {
  font-size: .75rem;
  color: var(--esp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.esp-sidebar__logout {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--esp-muted);
  text-decoration: none;
}
.esp-sidebar__logout:hover { background: #f1f5f9; color: var(--esp-ink); }

.esp-shell {
  margin-left: var(--esp-sidebar);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.esp-topbar {
  display: none;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--esp-line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.esp-menu-btn {
  border: 1px solid var(--esp-line);
  background: #fff;
  border-radius: 8px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  cursor: pointer;
}
.esp-topbar__title { font-weight: 750; flex: 1; }
.esp-topbar__who { font-size: .85rem; color: var(--esp-muted); }
.esp-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .4);
  z-index: 140;
}

.esp-main {
  width: min(960px, calc(100% - 2.5rem));
  margin: 1.5rem auto 2rem;
  flex: 1;
}

.esp-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 1rem;
  padding: .3rem;
  background: #fff;
  border: 1px solid var(--esp-line);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}
.esp-subtabs a {
  text-decoration: none;
  color: var(--esp-muted);
  font-weight: 650;
  font-size: .9rem;
  padding: .5rem 1rem;
  border-radius: 999px;
}
.esp-subtabs a.is-active {
  background: var(--esp-brand);
  color: var(--esp-accent);
}
.esp-subtabs a:hover:not(.is-active) {
  background: #f1f5f9;
  color: var(--esp-ink);
}

.esp-hero { margin-bottom: 1.35rem; }
.esp-hero h1 {
  font-weight: 750;
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  margin: 0 0 .35rem;
  letter-spacing: -.03em;
}
.esp-hero p { margin: 0; color: var(--esp-muted); max-width: 38rem; line-height: 1.5; }

.esp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .9rem;
  margin-bottom: 1rem;
}
.esp-card {
  background: var(--esp-panel);
  border: 1px solid var(--esp-line);
  border-radius: var(--esp-radius);
  padding: 1.15rem 1.2rem;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.esp-card h2, .esp-card h3 {
  margin: 0 0 .7rem;
  font-size: .7rem;
  font-weight: 750;
  color: var(--esp-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.esp-card p, .esp-muted { color: var(--esp-muted); margin: .25rem 0; }
.esp-stat {
  font-size: 1.75rem;
  font-weight: 750;
  margin: .15rem 0 .35rem;
  letter-spacing: -.03em;
}
.esp-progress {
  height: 8px; border-radius: 99px; background: #eef2f7; overflow: hidden; margin-top: .65rem;
}
.esp-progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--esp-brand), var(--esp-blue));
  border-radius: 99px;
}

.esp-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.esp-table th, .esp-table td {
  text-align: left; padding: .75rem .35rem;
  border-bottom: 1px solid var(--esp-line); vertical-align: top;
}
.esp-table th {
  color: var(--esp-muted); font-weight: 750; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .06em;
}
.esp-table a { color: var(--esp-blue); font-weight: 650; text-decoration: none; }

.esp-badge {
  display: inline-block; padding: .18rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 750; background: #f1f5f9; color: var(--esp-muted);
}
.esp-badge--ok { color: var(--esp-ok); background: #dcfce7; }
.esp-badge--todo { color: #854d0e; background: var(--esp-accent-soft); }

.esp-form { display: grid; gap: .85rem; }
.esp-form label {
  display: grid; gap: .35rem;
  font-size: .82rem; font-weight: 650; color: var(--esp-muted);
}
.esp-form input, .esp-form select, .esp-form textarea {
  width: 100%; border: 1px solid var(--esp-line); background: #fff;
  color: var(--esp-ink); border-radius: 12px; padding: .75rem .9rem;
  font: inherit; font-weight: 500;
}
.esp-form input:focus, .esp-form select:focus, .esp-form textarea:focus {
  outline: none; border-color: var(--esp-brand);
  box-shadow: 0 0 0 3px rgba(255, 252, 3, .35);
}
.esp-check {
  display: flex !important;
  align-items: center;
  gap: .55rem;
  flex-direction: row !important;
  color: var(--esp-ink) !important;
  font-weight: 600 !important;
}
.esp-check input { width: auto; }

.esp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 999px; padding: .75rem 1.25rem;
  font: inherit; font-weight: 750; cursor: pointer; text-decoration: none;
  background: var(--esp-brand); color: #fff;
}
.esp-btn:hover { background: var(--esp-brand-soft); }
.esp-btn--accent { background: var(--esp-accent); color: var(--esp-brand); }
.esp-btn--ghost { background: #fff; color: var(--esp-brand); border: 1px solid var(--esp-line); }

.esp-alert {
  padding: .9rem 1rem; border-radius: 12px; margin-bottom: 1rem;
  border: 1px solid var(--esp-line); background: #fff; font-weight: 500;
}
.esp-alert--err { border-color: #fecaca; background: #fef2f2; color: var(--esp-danger); }
.esp-alert--ok {
  border-color: #f5e98a;
  background: linear-gradient(90deg, var(--esp-accent-soft), #fff);
  color: var(--esp-brand);
}

.esp-auth {
  width: min(420px, calc(100% - 2rem));
  margin: 3.5rem auto;
  padding: 2rem 1.75rem 1.75rem;
  background: #fff;
  border: 1px solid var(--esp-line);
  border-radius: 20px;
  box-shadow: var(--esp-shadow);
}
.esp-auth .esp-logo { height: 56px; margin-bottom: .85rem; }
.esp-auth h1 { font-size: 1.55rem; margin: 0 0 .35rem; letter-spacing: -.02em; }
.esp-auth .lead { color: var(--esp-muted); margin: 0 0 1.25rem; line-height: 1.45; }

.esp-foot {
  text-align: center; color: var(--esp-muted); font-size: .78rem;
  padding: 1.25rem; margin-left: 0;
}

@media (max-width: 900px) {
  .esp-sidebar {
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .esp-sidebar.is-open { transform: none; }
  .esp-shell { margin-left: 0; }
  .esp-topbar { display: flex; }
  .esp-main { width: min(960px, calc(100% - 1.5rem)); }
}


