/* Portail admin MonkyRUN — style moderne épuré (anthracite, arrondis, jaune en touche). */
:root {
  --bg: #0b0c0e;
  --surface: #121316;
  --surface-2: #17181c;
  --surface-3: #1e2025;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .12);
  --text: #ececee;
  --text-2: #b4b6bc;
  --muted: #7d8088;
  --accent: #fdd003;
  --accent-soft: rgba(253, 208, 3, .12);
  --danger: #f2655a;
  --danger-soft: rgba(242, 101, 90, .12);
  --success: #4fd18b;
  --warn: #f1b44c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
b { font-weight: 600; }
code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; color: var(--text); word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }

/* ---------- Icônes ---------- */
.ico { display: inline-flex; width: 18px; height: 18px; flex: 0 0 18px; }
.ico svg { width: 100%; height: 100%; }

/* ---------- Marque ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand em { font-style: normal; color: var(--muted); font-weight: 500; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #111; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.brand-lg { font-size: 17px; }
.brand-lg .mark { width: 34px; height: 34px; border-radius: 10px; font-size: 18px; }

/* ---------- Boutons / champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 13.5px; text-decoration: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: #111; }
.btn-primary:hover:not(:disabled) { background: #ffdc2e; }
.btn-secondary { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-strong); background: #23252b; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(242, 101, 90, .25); }
.btn-danger:hover { background: rgba(242, 101, 90, .2); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn-block { width: 100%; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); display: flex; justify-content: space-between; }
.field small { color: var(--muted); font-weight: 400; }
input[type=email], input[type=password], input[type=text], select, .otp {
  height: 40px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, .otp:focus { border-color: rgba(253, 208, 3, .6); box-shadow: 0 0 0 3px var(--accent-soft); }
.otp { height: 52px; text-align: center; font-size: 24px; font-weight: 600; letter-spacing: .35em; font-variant-numeric: tabular-nums; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.alert { color: var(--danger); font-size: 13px; font-weight: 500; min-height: 0; }
.alert:not(:empty) { margin-top: 14px; padding: 10px 12px; background: var(--danger-soft); border-radius: var(--radius-sm); }
.msg { font-size: 13px; font-weight: 500; margin-top: 10px; }
.msg:empty { display: none; }
.msg.ok { color: var(--success); }
.msg.err { color: var(--danger); }

/* ---------- Connexion ---------- */
.auth { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 32px 16px;
  background: radial-gradient(600px 300px at 50% 0%, rgba(253, 208, 3, .06), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth-card > .brand { margin-bottom: 24px; }
.auth-head { margin-bottom: 4px; }
.auth-head h1 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 4px; }
.view { display: flex; flex-direction: column; gap: 14px; }
.auth-foot { color: var(--muted); font-size: 12px; }
.enroll-step { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); }
.enroll-step .num { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text); }
.qr { align-self: center; background: #fff; padding: 10px; border-radius: var(--radius); }
.qr img { width: 200px; height: 200px; display: block; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes span { background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px; text-align: center; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 14px; letter-spacing: .04em; }

/* ---------- Structure ---------- */
.app { display: flex; height: 100%; }
.side { width: 248px; flex: 0 0 248px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 14px 0 16px; }
.nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 10px; }
.nav-group { font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 14px 10px 6px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 500; text-align: left; }
.nav-item .ico { color: var(--muted); }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.on { background: var(--surface-3); color: var(--text); }
.nav-item.on .ico { color: var(--accent); }
.nav-item.on::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-bottom { margin-top: auto; padding-top: 8px; }
.side-foot { display: flex; align-items: center; gap: 10px; margin: 8px 10px 10px; padding: 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: linear-gradient(135deg, #2a2c33, #3a3d46); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--text); }
.me { flex: 1; min-width: 0; }
.me-email { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 12px; color: var(--muted); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bar { height: 56px; flex: 0 0 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--border); }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; overflow: hidden; }
.crumb-group { color: var(--muted); }
.crumb-group:not(:empty)::after { content: "/"; margin-left: 8px; color: #44464d; }
.crumb-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.bar-actions { display: flex; gap: 4px; }
.frames { flex: 1; position: relative; margin: 12px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--surface); }
.frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.page { flex: 1; overflow-y: auto; padding: 28px 32px 48px; }
.page-inner { max-width: 960px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------- Cartes / sections ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-head { margin-bottom: 14px; }
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1; min-width: 180px; }
.form-row .field.narrow { flex: 0 0 150px; min-width: 150px; }
.stat { display: inline-flex; align-items: baseline; gap: 6px; }
.stat b { font-size: 22px; font-weight: 600; }

.section-title { font-size: 12px; font-weight: 500; color: var(--muted); margin: 26px 0 10px; }
.section-title:first-of-type { margin-top: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { display: flex; align-items: flex-start; gap: 12px; text-align: left; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, background .15s, transform .15s; }
.tile:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.tile-ico { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.tile:hover .tile-ico { color: var(--accent); }
.tile-ico .ico { width: 18px; height: 18px; }
.tile-txt { min-width: 0; display: flex; flex-direction: column; }
.tile-title { font-weight: 600; font-size: 14px; }
.tile-desc { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 20px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
td { padding: 11px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.accent { color: var(--accent); background: var(--accent-soft); border-color: rgba(253, 208, 3, .2); }
.badge.ok { color: var(--success); background: rgba(79, 209, 139, .1); border-color: rgba(79, 209, 139, .2); }
.badge.warn { color: var(--warn); background: rgba(241, 180, 76, .1); border-color: rgba(241, 180, 76, .2); }
.badge.off { color: var(--danger); background: var(--danger-soft); border-color: rgba(242, 101, 90, .2); }
.linkbox { margin-top: 12px; display: flex; gap: 8px; }
.linkbox input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.ev { display: flex; align-items: center; gap: 8px; }
.ev .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ev .dot.ok { background: var(--success); }
.ev .dot.bad { background: var(--danger); }
.ev .dot.info { background: var(--accent); }

/* ---------- Mobile ---------- */
.only-mobile { display: none; }
.scrim { display: none; }
@media (max-width: 880px) {
  .only-mobile { display: inline-grid; }
  .side { position: fixed; z-index: 30; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .5); }
  .bar { padding: 0 10px; }
  .frames { margin: 8px; }
  .page { padding: 20px 16px 40px; }
  .hide-sm { display: none; }
}
