/* Console d'administration PACT Interphone — palette du logo (voir README du handoff) :
   marine #2C3B8B · nuit #1B2559 · orange #F5A02A · crème #FBF3E6 · fond #F5EAD8 */

@font-face {
  font-family: 'Caprasimo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/caprasimo-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('assets/fonts/figtree-latin.woff2') format('woff2');
}

:root {
  --navy: #2C3B8B;
  --night: #1B2559;
  --orange: #F5A02A;
  --orange-hover: #E08F1C;
  --orange-text: #B9761A;
  --cream: #FBF3E6;
  --page: #F5EAD8;
  --ink: #201E1D;
  --ink-2: #6E6A62;
  --ink-3: #9A948A;
  --sage: #7A8A5E;
  --sage-text: #3E5230;
  --sage-dot: #5C8A4E;
  --red: #C6493C;
  --gray-dot: #B4AEA2;
  --font-display: 'Caprasimo', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  font-family: var(--font-body);
  color: var(--ink);
}
a { color: var(--navy); }
a:hover { color: var(--orange); }
button { border: 0; cursor: pointer; font: inherit; background: none; padding: 0; color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.topbar :focus-visible, .assign :focus-visible { outline-color: var(--orange); }

/* ── En-tête ── */
.topbar {
  background: var(--night);
  padding: 18px 40px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.topbar-logo {
  background: var(--cream);
  border-radius: 999px;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  flex: none;
}
.topbar-logo img { height: 34px; width: auto; display: block; }
.topbar-title { font-size: 15px; font-weight: 600; color: var(--cream); letter-spacing: .01em; }
.topbar-nav { display: flex; align-items: center; gap: 6px; margin-left: 20px; }
.nav-tab {
  font-size: 14px; font-weight: 600; white-space: nowrap;
  border-radius: 999px; padding: 9px 18px;
  color: rgba(251,243,230,.66);
}
.nav-tab:hover { background: rgba(251,243,230,.16); }
.nav-tab.is-active { background: rgba(251,243,230,.18); color: var(--cream); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.server-pill {
  display: flex; align-items: center; gap: 8px;
  background: rgba(122,138,94,.28); border-radius: 999px; padding: 8px 15px;
}
.server-pill .dot { width: 8px; height: 8px; border-radius: 999px; background: #9CC178; }
.server-pill span:last-child { font-size: 13px; color: var(--cream); font-weight: 500; }
.topbar-avatar {
  width: 38px; height: 38px; border-radius: 999px; background: var(--navy);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

/* ── Corps de page ── */
.page {
  max-width: 1280px; margin: 0 auto; padding: 36px 40px 64px;
  display: flex; flex-direction: column; gap: 28px;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-head h1 { font-family: var(--font-display); font-weight: 400; font-size: 38px; line-height: 1.05; color: var(--night); margin: 0; }
.page-head p { margin: 8px 0 0; font-size: 15px; color: var(--ink-2); max-width: 560px; line-height: 1.5; text-wrap: pretty; }
.btn-assign {
  background: var(--orange); color: var(--night); border-radius: 999px;
  padding: 15px 26px; font-size: 15.5px; font-weight: 700;
  box-shadow: 0 8px 22px rgba(245,160,42,.34); white-space: nowrap;
}
.btn-assign:hover { background: var(--orange-hover); }

/* ── Cartes de chiffres ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: #fff; border-radius: 26px; padding: 22px;
  box-shadow: 0 2px 8px rgba(46,43,37,.07);
  display: flex; flex-direction: column; gap: 6px;
}
.kicker { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--orange-text); font-weight: 600; }
.stat-card .value { font-size: 36px; font-weight: 700; color: var(--night); line-height: 1.1; }
.stat-card .note { font-size: 13px; color: var(--ink-2); }

/* ── Panneau d'attribution ── */
.assign {
  background: var(--navy); border-radius: 30px; padding: 28px 30px;
  display: flex; flex-direction: column; gap: 20px;
}
.assign[hidden] { display: none; }
.assign-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.assign .kicker { color: var(--orange); }
.assign-title { font-family: var(--font-display); font-size: 24px; color: var(--cream); margin-top: 7px; }
.btn-close {
  width: 36px; height: 36px; border-radius: 999px; background: rgba(251,243,230,.14);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.btn-close:hover { background: rgba(251,243,230,.26); }
.assign-grid { display: grid; grid-template-columns: 220px 1fr 1fr; gap: 20px; align-items: start; }
.assign-col { display: flex; flex-direction: column; gap: 16px; }
.assign-field { display: flex; flex-direction: column; gap: 8px; }
.assign-label { font-size: 12.5px; color: rgba(251,243,230,.72); font-weight: 500; }
.next-ext {
  background: var(--cream); border-radius: 22px; padding: 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.next-ext .num { font-size: 44px; font-weight: 700; color: var(--night); letter-spacing: .04em; line-height: 1; }
.next-ext .hint { font-size: 12.5px; color: var(--ink-2); }
.input-name {
  background: rgba(251,243,230,.12); border: 2px solid rgba(251,243,230,.2);
  border-radius: 999px; padding: 13px 18px; font-size: 15px; font-family: inherit;
  color: var(--cream); width: 100%;
}
.input-name::placeholder { color: rgba(251,243,230,.55); }
.input-name:focus-visible { border-color: var(--orange); outline: none; }
.input-name.is-error { border-color: var(--red); }
.dept-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.dept-pill {
  border: 2px solid rgba(251,243,230,.28); color: rgba(251,243,230,.85);
  border-radius: 999px; padding: 9px 16px; font-size: 13.5px; font-weight: 600;
}
.dept-pill:hover { border-color: rgba(251,243,230,.55); }
.dept-pill.is-active { background: var(--orange); border-color: var(--orange); color: var(--night); }
.role-cards { display: flex; flex-direction: column; gap: 8px; }
.role-card {
  border: 2px solid rgba(251,243,230,.2); border-radius: 20px; padding: 12px 15px;
  text-align: left; display: flex; align-items: center; gap: 11px; width: 100%;
}
.role-card:hover { border-color: rgba(251,243,230,.45); }
.role-card.is-active { background: rgba(251,243,230,.14); border-color: var(--orange); }
.role-card .dot { width: 11px; height: 11px; border-radius: 999px; flex: none; background: rgba(251,243,230,.3); }
.role-card.is-active .dot { background: var(--orange); }
.role-card .label { font-size: 14px; font-weight: 600; color: var(--cream); }
.role-card .desc { font-size: 12px; color: rgba(251,243,230,.6); line-height: 1.35; }
.assign-foot {
  display: flex; align-items: center; gap: 16px;
  border-top: 1px solid rgba(251,243,230,.16); padding-top: 18px;
}
.assign-foot .info { flex: 1; font-size: 13px; color: rgba(251,243,230,.7); line-height: 1.45; }
.btn-cancel { color: rgba(251,243,230,.8); font-size: 14.5px; font-weight: 600; padding: 12px 18px; }
.btn-cancel:hover { color: var(--cream); }
.btn-create {
  background: var(--orange); color: var(--night); border-radius: 999px;
  padding: 15px 28px; font-size: 15.5px; font-weight: 700; white-space: nowrap;
}
.btn-create:hover { background: var(--orange-hover); }

/* ── Bandeau de confirmation ── */
.notice {
  display: flex; align-items: center; gap: 11px;
  background: rgba(122,138,94,.2); border-radius: 24px; padding: 15px 20px;
}
.notice[hidden] { display: none; }
.notice svg { flex: none; }
.notice .msg { font-size: 14px; color: var(--sage-text); font-weight: 500; }

/* ── Tableau + colonne latérale ── */
.columns { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }

.table-card {
  background: #fff; border-radius: 30px; padding: 8px 26px 20px;
  box-shadow: 0 2px 10px rgba(46,43,37,.07);
}
.table-head { display: flex; align-items: center; gap: 14px; padding: 20px 0 14px; }
.table-head .title { font-family: var(--font-display); font-size: 21px; color: var(--night); }
.filters { display: flex; gap: 6px; margin-left: auto; }
.filter-pill {
  font-size: 13px; font-weight: 600; border-radius: 999px; padding: 8px 15px;
  background: rgba(44,59,139,.08); color: var(--navy);
}
.filter-pill:hover { background: rgba(44,59,139,.14); }
.filter-pill.is-active { background: var(--navy); color: var(--cream); }
.table-card table { width: 100%; border-collapse: collapse; }
.table-card th {
  text-align: left; font-size: 11px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--orange-text); font-weight: 600; padding: 12px 10px;
  border-bottom: 2px solid rgba(32,30,29,.1);
}
.table-card th:first-child { padding-left: 0; }
.table-card td { padding: 15px 10px; border-bottom: 1px solid rgba(32,30,29,.07); }
.table-card td:first-child { padding-left: 0; }
.table-card td:last-child { padding-right: 0; text-align: right; }
.table-card tbody tr:hover { background: rgba(32,30,29,.025); }
.cell-ext { font-size: 19px; font-weight: 700; color: var(--night); letter-spacing: .03em; }
.cell-person { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 999px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.cell-person .name { font-size: 14.5px; font-weight: 600; color: var(--night); }
.cell-person .dept { font-size: 12.5px; color: var(--ink-2); }
.role-tag { font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.cell-device { font-size: 13.5px; color: var(--ink-2); }
.cell-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.cell-status .dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.btn-reset {
  background: rgba(44,59,139,.1); color: var(--navy); border-radius: 999px;
  padding: 8px 14px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.btn-reset:hover { background: rgba(44,59,139,.2); }
.table-empty { padding: 26px 0; font-size: 14px; color: var(--ink-3); text-align: center; }

/* ── Colonne latérale ── */
.sidebar { display: flex; flex-direction: column; gap: 18px; }
.side-card {
  background: #fff; border-radius: 28px; padding: 22px;
  box-shadow: 0 2px 8px rgba(46,43,37,.07);
  display: flex; flex-direction: column; gap: 13px;
}
.plan-row { display: flex; align-items: baseline; gap: 12px; }
.plan-row .range { font-size: 16px; font-weight: 700; color: var(--navy); width: 38px; flex: none; }
.plan-row .use { flex: 1; font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.plan-row .free { font-size: 12.5px; color: var(--orange-text); font-weight: 600; white-space: nowrap; }
.side-note {
  font-size: 12.5px; color: var(--ink-3); line-height: 1.45;
  border-top: 1px solid rgba(32,30,29,.08); padding-top: 12px;
}
.side-intro { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.rule-row {
  display: flex; align-items: center; gap: 9px; padding: 9px 0;
  border-bottom: 1px solid rgba(32,30,29,.07);
}
.rule-row .when { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--night); }
.rule-row svg { flex: none; }
.rule-row .then { flex: 1; font-size: 13px; color: var(--ink-2); text-align: right; }
.btn-outline {
  border: 2px solid var(--navy); color: var(--navy); border-radius: 999px;
  padding: 11px; font-size: 14px; font-weight: 600; margin-top: 4px; width: 100%;
}
.btn-outline:hover { background: rgba(44,59,139,.09); }

/* ── Écran de connexion ─────────────────────────────────────────────── */

.gate {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: var(--page); padding: 24px;
}
/* Sans cette regle, le display:flex ci-dessus (regle d'auteur) l'emporte sur le
   display:none que le navigateur applique a [hidden] : l'ecran de connexion
   resterait affiche par-dessus la console apres la connexion. */
.gate[hidden] { display: none; }
.gate-card {
  width: 100%; max-width: 420px; background: #fff;
  border-radius: 28px; padding: 34px 30px;
  box-shadow: 0 12px 32px rgba(27,37,89,.14);
  display: flex; flex-direction: column;
}
.gate-logo { width: 120px; height: auto; margin-bottom: 18px; }
.gate-title { font-family: var(--font-display); font-size: 27px; color: var(--night); margin: 0 0 8px; line-height: 1.1; }
.gate-sub { font-size: 14.5px; color: var(--ink-2); margin: 0 0 22px; line-height: 1.45; }
.gate-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .12em; color: var(--orange-text); margin-bottom: 6px;
}
.gate-input {
  font-family: var(--font-body); font-size: 17px; font-weight: 600; color: var(--ink);
  background: var(--cream); border: 2px solid rgba(44,59,139,.18);
  border-radius: 999px; padding: 14px 20px; margin-bottom: 16px; width: 100%;
}
.gate-input:focus { outline: none; border-color: var(--navy); }
.gate-toggle {
  align-self: flex-start; background: none; border: 0; cursor: pointer;
  font-family: var(--font-body); font-size: 12.5px; color: var(--ink-2);
  padding: 4px 0; margin-bottom: 10px;
}
.gate-toggle:hover { color: var(--navy); }
.gate-hint { font-size: 12.5px; color: var(--ink-3); margin: -8px 0 14px; line-height: 1.4; }
.gate-error {
  background: rgba(198,73,60,.12); color: var(--red);
  border-radius: 20px; padding: 14px 18px; font-size: 13.5px;
  font-weight: 600; line-height: 1.45; margin-bottom: 16px;
}
.gate-submit {
  font-family: var(--font-body); font-size: 17px; font-weight: 600;
  color: var(--cream); background: var(--navy); border: 0; cursor: pointer;
  border-radius: 999px; padding: 19px 24px; width: 100%;
}
.gate-submit:hover { background: #22306E; }
.gate-submit:disabled { opacity: .6; cursor: default; }

.btn-logout {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  color: rgba(251,243,230,.8); background: rgba(251,243,230,.14);
  border: 0; border-radius: 999px; padding: 9px 16px; cursor: pointer;
  min-height: 44px;
}
.btn-logout:hover { background: rgba(251,243,230,.24); color: var(--cream); }

/* ── Bandeau d'erreur ───────────────────────────────────────────────── */

.notice-error { background: rgba(198,73,60,.12); }
.notice-error .msg { color: var(--red); }

/* ── Table : actions et poste bloqué ────────────────────────────────── */

.cell-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-remove {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  color: var(--red); background: rgba(198,73,60,.1);
  border: 0; border-radius: 999px; padding: 9px 14px; cursor: pointer;
}
.btn-remove:hover { background: rgba(198,73,60,.18); }
.tag-locked {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--red); background: rgba(198,73,60,.14);
  border-radius: 999px; padding: 3px 9px; margin-left: 6px;
}

/* ── Fenêtres modales ───────────────────────────────────────────────── */

.modal-back {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(27,37,89,.42); padding: 24px;
}
.modal-card {
  width: 100%; max-width: 440px; background: var(--cream);
  border-radius: 28px; padding: 30px;
  box-shadow: 0 12px 32px rgba(27,37,89,.3);
}
.modal-wide { max-width: 560px; }
.modal-title { font-family: var(--font-display); font-size: 24px; color: var(--night); line-height: 1.15; margin: 6px 0 14px; }
.modal-text { font-size: 14px; color: var(--ink-2); line-height: 1.5; margin: 0 0 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.modal-card .btn-cancel { color: var(--ink-2); }
.modal-card .btn-cancel:hover { color: var(--ink); }
.btn-danger {
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  color: var(--cream); background: var(--red); border: 0; cursor: pointer;
  border-radius: 999px; padding: 14px 22px; min-height: 44px;
}
.btn-danger:hover { background: #A93A2E; }
.code-box {
  font-family: var(--font-body); font-size: 46px; font-weight: 700;
  letter-spacing: .18em; color: var(--night); text-align: center;
  background: #fff; border-radius: 24px; padding: 22px 10px; margin: 4px 0 18px;
  border: 2px solid rgba(44,59,139,.16);
}
.rules-edit { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.rule-edit-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: #fff; border-radius: 20px; padding: 14px 18px;
}
.rule-edit-row .when { font-size: 14px; font-weight: 600; color: var(--night); }
.rule-edit-row select {
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600; color: var(--navy);
  background: var(--cream); border: 2px solid rgba(44,59,139,.18);
  border-radius: 999px; padding: 10px 14px; min-height: 44px; cursor: pointer;
}
