/* SoftFlow Hub — charte : #004080 #008080 #4D94DB #607D88 #FF6F61, Poppins / Open Sans.
   Polices et logos : kit d'identité SoftFlow Edition v1.0 (static/fonts, static/brand), auto-hébergés. */
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap;
  src: url("fonts/Poppins-Bold.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap;
  src: url("fonts/Poppins-Medium.ttf") format("truetype"); }
@font-face { font-family: "Open Sans"; font-weight: 400; font-display: swap;
  src: url("fonts/OpenSans-Regular.ttf") format("truetype"); }
@font-face { font-family: "Open Sans"; font-weight: 700; font-display: swap;
  src: url("fonts/OpenSans-Bold.ttf") format("truetype"); }

:root {
  --navy: #004080; --teal: #008080; --sky: #4D94DB; --slate: #607D88; --coral: #FF6F61;
  --bg: #f4f7fb; --card: #fff; --text: #1d2733; --muted: #607D88; --line: #dde5ee;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Open Sans", -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { font-family: "Poppins", -apple-system, "Segoe UI", sans-serif; font-weight: 700;
  color: var(--navy); line-height: 1.25; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
a { color: var(--navy); }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em;
  word-break: break-all; }

/* En-tête et navigation */
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center;
  gap: 1rem; padding: .6rem 1rem; }
.brand { font-family: "Poppins", sans-serif; font-weight: 700; color: #fff;
  text-decoration: none; white-space: nowrap; }
.brand span { color: var(--sky); }
.topbar .who { margin-left: auto; font-size: .85rem; opacity: .9; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.topbar .who a { color: #fff; }
nav.menu { background: #fff; border-bottom: 1px solid var(--line); display: flex;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
nav.menu::-webkit-scrollbar { display: none; }
nav.menu a { padding: .7rem .9rem; text-decoration: none; color: var(--slate);
  white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 600; font-size: .9rem; }
nav.menu a.on { color: var(--navy); border-bottom-color: var(--teal); }
main { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

/* Cartes, grilles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat { font-family: "Poppins", sans-serif; font-size: 1.8rem; color: var(--navy); }
.tile h3 { margin-top: 0; }
.tile img { max-height: 40px; max-width: 140px; }
.auth { max-width: 420px; margin: 8vh auto 2rem; padding: 0 1rem; }
.auth .card { padding: 1.5rem; }
.auth .logo { text-align: center; margin-bottom: 1.2rem; }
.qr svg { width: 200px; height: 200px; display: block; margin: .5rem auto; background: #fff; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: .85rem; margin: .7rem 0 .25rem;
  color: var(--slate); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 16px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sky); border-color: var(--sky); }
textarea { min-height: 5rem; }
.row { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; align-items: center; }
form.inline { display: inline; }
button, .btn { display: inline-block; border: 0; border-radius: 8px; padding: .6rem 1rem;
  background: var(--navy); color: #fff; font: inherit; font-family: "Poppins", sans-serif;
  font-weight: 500; cursor: pointer;
  text-decoration: none; min-height: 40px; }
button:hover, .btn:hover { background: #00336a; }
.btn.teal, button.teal { background: var(--teal); }
.btn.ghost, button.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
button.danger { background: var(--coral); }
button.small, .btn.small { padding: .3rem .6rem; min-height: 32px; font-size: .85rem; }
.search { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search input { flex: 1; }

/* Tableaux : défilement horizontal sur mobile */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line);
  vertical-align: top; }
th { color: var(--slate); font-weight: 600; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .03em; white-space: nowrap; }

/* Badges et messages */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem;
  font-weight: 600; background: #e8eef5; color: var(--slate); white-space: nowrap; }
.badge.active, .badge.online, .badge.accepted, .badge.open { background: #dff3f1; color: var(--teal); }
.badge.trial, .badge.beta, .badge.pending, .badge.invited { background: #e3effb; color: #2a6db3; }
.badge.suspended, .badge.expired, .badge.disabled, .badge.refused { background: #ffe7e4; color: #c0392b; }
.badge.editor { background: var(--navy); color: #fff; }
.msg { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; }
.msg.error { background: #ffe7e4; color: #a12d22; }
.msg.info { background: #dff3f1; color: #075e5e; }
.msg.secret { background: #fff8e1; color: #6b5200; border: 1px solid #f3d27a; }
pre.history { white-space: pre-wrap; font: .9rem/1.5 "Open Sans", sans-serif; margin: 0; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }

@media (max-width: 600px) {
  h1 { font-size: 1.25rem; }
  main { padding: 1rem .75rem 3rem; }
  .card { padding: .9rem; }
  .hide-sm { display: none; }
  .grid.stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .grid.stats .card { margin: 0; padding: .7rem .9rem; }
  .stat { font-size: 1.4rem; }
}

/* Entreprise → Site → Personnel → Licences */
.site-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.site-head h2 { margin: 0; }
.site.archived { opacity: .7; }
.licence-strip { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .8rem; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; font-size: .85rem; background: var(--bg); }
tr.off td { color: var(--muted); }
details { margin-top: .6rem; }
details > summary { cursor: pointer; color: var(--navy); font-weight: 600; font-size: .9rem; }
td details { margin: 0; }
td form { display: inline; }
.crumbs { font-size: .9rem; margin-bottom: .6rem; }
.crumbs a { text-decoration: none; }

/* Logo SoftFlow Edition (kit v1.0) : horizontal fond sombre dans les bandeaux,
   vertical sur la page de connexion, monogramme en pied de page des pages habillées. */
.brand { display: inline-flex; align-items: center; gap: .6rem; }
.brand img { height: 28px; width: auto; }
.brand span { border-left: 1px solid rgba(255,255,255,.35); padding-left: .6rem; }
.auth .sf-logo { width: 190px; height: auto; }
footer .sf-mini { width: 28px; height: auto; vertical-align: middle; margin-right: .35rem; }

/* Page de connexion aux couleurs de l'appli (variables servies par /marques/<appli>.css) */
body:has(.auth.branded) { background: var(--brand-tint, var(--bg)); }
.auth.branded .card { border-top: 4px solid var(--brand); }
.auth.branded .app-logo { max-height: 72px; max-width: min(300px, 100%); height: auto; }
.auth.branded .app-name { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 1.8rem;
  color: var(--brand-ink); margin: 0; }
.auth.branded h1, .auth.branded a { color: var(--brand-ink); }
.auth.branded button:not(.ghost), .auth.branded .btn:not(.ghost) {
  background: var(--brand); color: var(--brand-on); }
.auth.branded button:not(.ghost):hover { background: var(--brand-dark); }
.auth.branded input:focus { outline-color: var(--brand); border-color: var(--brand); }
.auth.branded footer { display: flex; align-items: center; justify-content: center; gap: .1rem;
  line-height: 1.3; }

/* Apparence d'une appli dans la console */
.brand-preview { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand-preview img { max-height: 56px; max-width: 240px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: .4rem; }
input[type=color] { width: 4rem; height: 2.5rem; padding: .15rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; }
input[type=file] { font: inherit; max-width: 100%; }

/* Formulaires détaillés et compacts (fiche entreprise, sites, personnes) */
.grid-form { display: grid; gap: 0 .7rem; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.grid-form .w1 { grid-column: span 1; } .grid-form .w2 { grid-column: span 2; }
.grid-form .w3 { grid-column: span 3; } .grid-form .w4 { grid-column: span 4; }
.compact { font-size: .88rem; }
.compact h3 { font-size: .9rem; margin: 1rem 0 .1rem; color: var(--teal); }
.compact label { font-size: .75rem; margin: .45rem 0 .15rem; }
.compact input[type=text], .compact input[type=email], .compact input[type=tel],
.compact input[type=date], .compact input[type=number], .compact select {
  padding: .35rem .5rem; font-size: .88rem; border-radius: 6px; }
.inline-field { display: flex; gap: .4rem; }
.inline-field input { flex: 1; min-width: 0; }
p.small, .small { font-size: .8rem; }
@media (max-width: 900px) {
  .grid-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-form .w3, .grid-form .w4 { grid-column: span 4; }
}
@media (max-width: 600px) {
  .grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-form .w2, .grid-form .w3, .grid-form .w4 { grid-column: span 2; }
  /* iOS : pas de zoom à la saisie */
  .compact input[type=text], .compact input[type=email], .compact input[type=tel],
  .compact select { font-size: 16px; }
}
th.center, td.center { text-align: center; }
table.people td, table.people th { padding: .4rem .5rem; }
input.seat, .checks input, .matrix input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--teal); }
.checks { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.matrix td, .matrix th { vertical-align: middle; }
.matrix .cell { display: flex; align-items: center; gap: .4rem; }
.matrix .cell select { min-width: 7rem; }
