/* ConsultFlow — pages serveur (connexion, administration)
   Palette : encre acier, bleu signal, gris tôle ; couleurs du bandeau SIPOC réservées au tableau de marque (classes héritées du socle AC Pro). */
:root {
  --ink: #17324d;
  --ink-soft: #5b6b7b;
  --signal: #1f5fa8;
  --steel: #c9d3dd;
  --paper: #f3f6f9;
  --white: #ffffff;
  --danger: #9b2c20;
  --ok: #2e7d4f;
  --s: #c0392b;
  --q: #1f5fa8;
  --c: #2e7d4f;
  --d: #d68a00;
  --p: #6c4a9e;
  --font: Bahnschrift, "DIN Alternate", "DIN Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--font); color: var(--ink); background: var(--paper); }
a { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
[hidden] { display: none !important; }

h1 { font-size: 1.9rem; line-height: 1.15; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; margin: 0 0 0.75rem; font-weight: 600; }

label { font-weight: 600; font-size: 0.95rem; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--white);
  border: 1px solid var(--steel); border-radius: 4px; padding: 0.55rem 0.7rem; width: 100%;
}
input:focus, select:focus { border-color: var(--signal); }

button { font: inherit; cursor: pointer; }
.btn-primary {
  background: var(--signal); color: var(--white); border: 1px solid var(--signal);
  border-radius: 4px; padding: 0.6rem 1.1rem; font-weight: 600;
}
.btn-primary:hover { background: #184d8a; }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn {
  background: var(--white); color: var(--ink); border: 1px solid var(--steel);
  border-radius: 4px; padding: 0.4rem 0.8rem;
}
.btn:hover { background: var(--paper); }
.btn-danger { color: var(--danger); }
.btn-link { background: none; border: 0; color: var(--signal); padding: 0.3rem 0; text-align: left; }

.stack { display: flex; flex-direction: column; gap: 0.45rem; }
.stack > h1 { margin-bottom: 0.2rem; }
.stack > button { margin-top: 0.9rem; }
.lead { margin: 0 0 1rem; color: var(--ink-soft); }
.hint { margin: 0.2rem 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.error { color: var(--danger); font-weight: 600; }
.notice { background: #fff4de; border-left: 4px solid var(--d); padding: 0.6rem 0.8rem; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(260px, 38%) 1fr; }
.login-board {
  background: var(--ink); color: var(--white);
  display: flex; flex-direction: column; justify-content: space-between; padding: 2.5rem;
}
.board-brand { margin: 0; font-size: 1.6rem; font-weight: 700; }
.board-brand span { font-weight: 400; opacity: 0.6; margin-left: 0.35rem; }
.board-strip { list-style: none; margin: 2rem 0; padding: 0; display: grid; gap: 0.5rem; }
.board-strip li {
  display: grid; grid-template-columns: 3.6rem 1fr; align-items: center;
  background: rgba(255, 255, 255, 0.06); border-radius: 3px; overflow: hidden;
}
.board-strip b {
  font-size: 2.4rem; line-height: 1; text-align: center; padding: 0.55rem 0; color: var(--white);
}
.board-strip span { padding-left: 1rem; font-size: 1.05rem; opacity: 0.85; }
.board-strip .s b { background: var(--s); }
.board-strip .q b { background: var(--q); }
.board-strip .c b { background: var(--c); }
.board-strip .d b { background: var(--d); }
.board-strip .p b { background: var(--p); }
.board-foot { margin: 0; opacity: 0.6; font-size: 0.9rem; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.login-panel form { width: 100%; max-width: 380px; }

@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; }
  .login-board { padding: 1.2rem 1.5rem; flex-direction: row; align-items: center; gap: 1rem; }
  .board-strip { grid-auto-flow: column; margin: 0; gap: 0.3rem; }
  .board-strip li { grid-template-columns: 2rem; }
  .board-strip b { font-size: 1.2rem; padding: 0.35rem 0; }
  .board-strip span, .board-foot { display: none; }
}

/* ---------- Administration ---------- */
.topbar {
  background: var(--ink); color: var(--white);
  display: flex; align-items: center; gap: 1.5rem; padding: 0.7rem 1.5rem; flex-wrap: wrap;
}
.topbar .brand { font-weight: 700; font-size: 1.15rem; }
.topbar .who { margin-left: auto; opacity: 0.85; font-size: 0.95rem; }
.topbar a, .topbar button { color: var(--white); background: none; border: 1px solid rgba(255,255,255,.35); border-radius: 4px; padding: 0.3rem 0.7rem; text-decoration: none; }
.topbar a:hover, .topbar button:hover { background: rgba(255,255,255,.1); }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--steel); padding: 0 1.5rem; background: var(--white); overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 0.8rem 1rem; color: var(--ink-soft); white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--signal); font-weight: 600; }

.page { padding: 1.5rem; max-width: 1200px; }
.panel { background: var(--white); border: 1px solid var(--steel); border-radius: 6px; padding: 1.2rem 1.4rem; margin-bottom: 1.2rem; }
.panel-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.panel-head h2 { margin: 0; }
.panel-head .meta { color: var(--ink-soft); }
.panel-head .spacer { flex: 1; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.8rem 1rem; align-items: end; }
.form-grid .field { display: flex; flex-direction: column; gap: 0.3rem; }
.form-grid .field-check label { display: flex; align-items: center; gap: 0.45rem; min-height: 2.3rem; cursor: pointer; }
.form-grid .field-check input { width: auto; padding: 0; margin: 0; flex: none; }
.form-grid .field-check label { flex-direction: row; white-space: nowrap; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid #e3eaf1; vertical-align: middle; }
th { font-weight: 600; color: var(--ink-soft); background: var(--paper); }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 0.3rem; padding: 0.25rem 0.6rem; font-size: 0.88rem; }

.pill { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.82rem; border: 1px solid var(--steel); }
.pill.ok { color: var(--ok); border-color: #b9dcc7; background: #eef8f1; }
.pill.warn { color: #8a5a00; border-color: #f0d49a; background: #fff6e3; }
.pill.off { color: var(--danger); border-color: #e7bcb6; background: #fbeeec; }

.secret {
  font-family: Consolas, "Courier New", monospace; font-size: 1.1rem;
  background: var(--paper); border: 1px dashed var(--signal); padding: 0.6rem 0.8rem; border-radius: 4px; user-select: all;
}
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--ink); color: var(--white); padding: 0.7rem 1.1rem; border-radius: 6px; max-width: 90vw;
}
.toast.err { background: var(--danger); }

dialog { border: 0; border-top: 5px solid var(--signal); border-radius: 8px; padding: 1.4rem 1.6rem; max-width: 480px; color: var(--ink); }
dialog::backdrop { background: rgba(10, 25, 40, 0.55); }
dialog .row { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.2rem; }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise 0.2s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
}
.num-input { width: 5rem; }

/* Services (onglet Administration) */
.svc { border: 1px solid #e3eaf1; border-radius: 6px; padding: 0.8rem 1rem; margin-bottom: 0.9rem; }
.svc-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.5rem; }
.svc-head .svc-name { max-width: 22rem; font-weight: 600; }
.svc-head .meta { flex: 1; color: var(--ink-soft); }
.svc table select { width: auto; min-width: 12rem; }
.svc .svc-add td { border-bottom: 0; }
.panel-head select { width: auto; min-width: 14rem; }

/* Charte graphique du client */
.brand-apercu { max-width: 260px; max-height: 110px; border: 1px solid #e3eaf1; border-radius: 6px; padding: 8px; background: #fff; }
.form-grid .field input[type="color"] { width: 5rem; height: 2.3rem; padding: 2px; }

/* ---------------------------------------------------------------------------
   Charte GXG Solutions
   Verrou de marque, dans cet ordre : logo GXG Solutions · icône de l'application
   · nom de l'application. Forme courte quand la place manque : « ConsultFlow by GXG Solutions ».
   Couleurs de la marque : bleu #176C96, orange #F39200.
   --------------------------------------------------------------------------- */
:root {
  --gxg-bleu: #176C96;
  --gxg-orange: #F39200;
}
.marque { display: flex; align-items: center; gap: 0.9rem; text-decoration: none; color: inherit; }
.marque img.marque-gxg { height: 2.1rem; width: auto; display: block; }
.marque .marque-trait { width: 1px; align-self: stretch; margin: 0.15rem 0; background: currentColor; opacity: 0.2; }
.marque img.marque-appli { height: 1.9rem; width: 1.9rem; display: block; border-radius: 0.45rem; }
.marque .marque-nom { font-weight: 700; font-size: 1.05rem; line-height: 1.1; white-space: nowrap; }
.marque .marque-nom small { display: block; font-weight: 400; font-size: 0.75rem; opacity: 0.7; letter-spacing: 0.02em; }
.marque-by { font-size: 0.8rem; opacity: 0.7; }
.marque-by b { font-weight: 600; }
@media (max-width: 720px) {
  .marque img.marque-gxg { height: 1.7rem; }
  .marque .marque-trait, .marque .marque-nom small { display: none; }
}
/* Les surfaces de marque prennent le bleu GXG Solutions : toutes les applications du groupe
   se reconnaissent à cette teinte. L'encre acier reste celle du texte et des tableaux. */
.login-board { background: var(--gxg-bleu); }
.topbar { background: var(--gxg-bleu); }
.topbar .brand { font-size: 1rem; }
.board-foot { opacity: 0.85; }
.board-marque { margin-bottom: 0.5rem; }
.page-pied { padding: 1rem 1.5rem 1.5rem; color: var(--ink-soft); }
td.code { font-family: Consolas, "Courier New", monospace; color: var(--ink-soft); white-space: nowrap; }

/* Journal d un document (GED) */
.journal-ligne { padding: 0.35rem 0; border-bottom: 1px solid #eef3f8; font-size: 0.95rem; }
#dlgBody textarea { width: 100%; font: inherit; border: 1px solid var(--steel); border-radius: 4px; padding: 0.5rem; }
.panel-head label { white-space: nowrap; }
