/* Skalib — Portail prestataire. Styles propres à la surface.
   La charte (couleurs, typos, .sk-btn, .sk-wordmark) vient de ../shared/tokens.css.
   Thème sombre STABLE : <html class="theme-dark">. */

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100vh; }
body { background: var(--bg); color: var(--text); }

/* Utilitaires */
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.dim { color: var(--text-dim); }
a { color: var(--lake); }

/* ---- Boutons : ambre = UNE seule action chaude par écran ---- */
/* .sk-btn (ambre) hérité de tokens. Variantes froides/secondaires ci-dessous. */
.sk-btn { font-size: 14px; }
.sk-btn.sm { padding: 8px 14px; font-size: 13px; }
.sk-btn:disabled { opacity: .5; cursor: not-allowed; }
/* Action froide, répétable (accepter, envoyer, ajouter) — accent lac, jamais ambre */
.sk-btn.cold { background: var(--lake); color: #04211d; }
.sk-btn.cold:hover { background: var(--lake-deep); color: var(--snow); }
/* Action destructive / refus */
.sk-btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.sk-btn.danger:hover { background: rgba(232,121,90,.14); }

/* ================= Écran de connexion ================= */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px 28px; }
.login-card h1 { font-family: var(--font-display); font-weight: 600; font-size: 34px; margin: 0 0 4px; letter-spacing: -.03em; }
.login-card .role-tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--lake); margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 13px; font-size: 14px; font-family: var(--font-body); }
.field input:focus-visible, .field select:focus-visible, textarea:focus-visible,
input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-cold); outline-offset: 1px; border-color: var(--accent-cold); }
.login-hint { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.5; }

/* Message d'erreur / bandeau (aria-live) */
.banner { border-radius: 10px; padding: 10px 13px; font-size: 13px; margin-bottom: 12px; }
.banner.err { background: rgba(232,121,90,.14); border: 1px solid var(--danger); color: var(--danger); }
.banner.ok { background: rgba(111,207,151,.14); border: 1px solid var(--green); color: var(--green); }

/* ================= Shell application ================= */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.brand object, .brand img { width: 38px; height: 38px; flex: 0 0 auto; }
.brand .wm { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -.03em; line-height: 1; }
.brand .tag { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.who { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; }
.who .nm { font-weight: 600; font-size: 13.5px; }
.who .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: none;
  border: none; color: var(--muted); padding: 10px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 500;
  font-family: var(--font-body); cursor: pointer; }
.nav button:hover { background: var(--surface-2); color: var(--text); }
.nav button.active { background: rgba(70,180,193,.14); color: var(--lake); }
.nav .ic { width: 17px; height: 17px; flex: 0 0 auto; }
.nav .bn { margin-left: auto; font-family: var(--font-mono); font-size: 10px; background: var(--ember);
  color: #1a0f06; padding: 1px 7px; border-radius: 8px; }
.spacer { flex: 1; }
.logout { font-size: 12.5px; color: var(--muted); background: none; border: 1px solid var(--border);
  border-radius: 9px; padding: 9px; cursor: pointer; font-family: var(--font-body); }
.logout:hover { color: var(--text); border-color: var(--muted); }

.main { padding: 24px 30px 60px; overflow: hidden; }
.vtitle { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.02em; }
.vsub { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; max-width: 720px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; }
.kpi .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.kpi .num { font-family: var(--font-mono); font-size: 22px; font-weight: 700; margin-top: 6px; }
.kpi.hl { border-color: var(--lake); background: linear-gradient(160deg, rgba(70,180,193,.12), transparent); }
.kpi.hl .num { color: var(--lake); }
@media (max-width: 1050px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

/* Panneaux */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.panel h4 { font-family: var(--font-display); font-size: 15px; margin: 0 0 4px; font-weight: 600; }
.panel .ph { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0;
  border-bottom: 1px solid var(--border); font-size: 13.5px; gap: 10px; }
.row:last-child { border: none; }
.setgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .setgrid { grid-template-columns: 1fr; } }

/* Pastilles d'état */
.pill { font-size: 11px; padding: 2px 9px; border-radius: 7px; white-space: nowrap; font-weight: 600; }
.pill.amber { background: rgba(240,160,90,.16); color: var(--ember); }
.pill.lake { background: rgba(70,180,193,.16); color: var(--lake); }
.pill.blue { background: rgba(166,219,225,.16); color: var(--ice); }
.pill.green { background: rgba(111,207,151,.16); color: var(--green); }
.pill.muted { background: var(--surface-2); color: var(--muted); }

/* Onglets (role=tablist) */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; font-family: var(--font-body); }
.tab[aria-selected="true"] { background: rgba(70,180,193,.14); border-color: var(--lake); color: var(--lake); }
.tab:focus-visible { outline: 2px solid var(--accent-cold); outline-offset: 2px; }
.tab .c { font-family: var(--font-mono); font-size: 10.5px; margin-left: 5px; opacity: .85; }

/* Cartes tâche */
.task { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 17px; margin-bottom: 12px; }
.task.new { border-color: var(--ember); }
.task.prog { border-color: var(--lake); }
.task .top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.task .ttl { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.task .loc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.task .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.task .meta b { color: var(--text); font-family: var(--font-mono); }
.task .when { font-family: var(--font-mono); font-size: 12.5px; color: var(--lake); text-align: right; white-space: nowrap; }
.task .acts { display: flex; gap: 9px; margin-top: 13px; flex-wrap: wrap; }
.empty { padding: 34px; text-align: center; color: var(--muted); }

/* Bandeau conformité (liberté d'accepter/refuser) */
.conform { background: rgba(240,160,90,.08); border: 1px solid rgba(240,160,90,.3); border-radius: 10px;
  padding: 11px 14px; font-size: 12.5px; color: var(--text-dim); margin-bottom: 16px; }
.conform b { color: var(--ember); }

/* Disponibilités */
.wk { display: flex; flex-direction: column; }
.wkrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.wkrow:last-child { border: none; }
.wkrow .day { width: 92px; font-weight: 600; font-size: 13px; }
.wkrow select { background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 9px; font-size: 12.5px; font-family: var(--font-mono); }
.wkrow .off-lbl { color: var(--muted-2); font-size: 12.5px; }
.switch { width: 40px; height: 22px; border-radius: 20px; background: var(--line); position: relative;
  flex: 0 0 auto; cursor: pointer; border: none; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: .2s; }
.switch[aria-checked="true"] { background: var(--lake); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--accent-cold); outline-offset: 2px; }
.exc-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 13px; }

/* Messagerie */
.inbox { display: grid; grid-template-columns: 320px 1fr; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; height: calc(100vh - 190px); min-height: 440px; }
.ilist { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.isearch { padding: 12px; border-bottom: 1px solid var(--border); }
.isearch input { width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font-size: 13px; }
.ithreads { overflow-y: auto; flex: 1; }
.ithread { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; width: 100%; text-align: left; background: none; border-left: none; border-right: none;
  border-top: none; color: var(--text); font-family: var(--font-body); }
.ithread:hover { background: var(--surface-2); }
.ithread[aria-current="true"] { background: rgba(70,180,193,.12); }
.ithread .body { flex: 1; min-width: 0; }
.ithread .top { display: flex; justify-content: space-between; gap: 6px; }
.ithread .nm { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ithread .tm { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }
.ithread .pv { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.ithread .unread { min-width: 18px; height: 18px; border-radius: 9px; background: var(--lake); color: #04211d;
  font-size: 10px; font-weight: 700; display: grid; place-items: center; font-family: var(--font-mono); padding: 0 5px; }
.ipanel { display: flex; flex-direction: column; min-width: 0; }
.ihead { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 11px; }
.ihead .nm { font-weight: 600; }
.ihead .sub { font-size: 11.5px; color: var(--muted); }
.ichat { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 72%; padding: 10px 13px; border-radius: 13px; font-size: 13px; line-height: 1.5; }
.msg.in { background: var(--surface-2); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: rgba(70,180,193,.14); border: 1px solid var(--lake); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg .t { font-size: 10px; color: var(--muted-2); margin-top: 4px; text-align: right; }
.icompose { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 9px; }
.icompose input { flex: 1; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 11px; padding: 12px 14px; font-size: 13.5px; }
.iempty { flex: 1; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

/* Modal (accessible : role=dialog, focus piégé, Échap) */
.overlay { position: fixed; inset: 0; background: rgba(5,9,10,.66); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.overlay.show { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; padding: 24px; }
.modal h3 { font-family: var(--font-display); margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.section-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted-2); margin: 16px 0 10px; }
.check { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: 13.5px; cursor: pointer; width: 100%; text-align: left; background: none; border-left: none;
  border-right: none; border-top: none; color: var(--text); font-family: var(--font-body); }
.check:focus-visible { outline: 2px solid var(--accent-cold); outline-offset: 2px; }
.cbox { width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid var(--muted-2); display: grid;
  place-items: center; font-size: 12px; flex: 0 0 auto; }
.cbox.on { background: var(--lake); border-color: var(--lake); color: #04211d; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; }
.photo-thumb { width: 90px; height: 68px; border-radius: 9px; object-fit: cover; border: 1px solid var(--border); }
.photo-thumb.ph-fallback { display: grid; place-items: center; font-size: 11px; color: var(--muted); background: var(--surface-2); }
.access-box { font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; color: var(--text-dim); }

/* Toasts (aria-live) */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--lake);
  border-radius: 10px; padding: 12px 16px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.35); max-width: 320px; }
.toast.err { border-left-color: var(--danger); }

/* Responsive : sidebar en haut */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar .spacer { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .nav .bn { margin-left: 6px; }
  .who { display: none; }
  .inbox { grid-template-columns: 1fr; }
  .inbox .ipanel { display: none; }
  .inbox.openthread .ilist { display: none; }
  .inbox.openthread .ipanel { display: flex; }
  .main { padding: 18px; }
}
