/* WFX.re Portal — Material Design 3 plat, charbon + accent unique */
@font-face { font-family: 'Chakra Petch'; font-weight: 700; src: url('/assets/fonts/ChakraPetch-Bold.ttf'); font-display: swap; }
@font-face { font-family: 'Roboto'; font-weight: 100 900; src: url('/assets/fonts/Roboto-Variable.ttf'); font-display: swap; }

:root {
  --bg: #111111; --surface: #1A1A1A; --surface-2: #222222; --surface-3: #2C2C2C; --line: #333333; --outline: #8A8A8A;
  --text: #E8E8E8; --text-2: #B3B3B3; --muted: #7A7A7A;
  --accent: #FFB800; --on-accent: #261A00; --error: #FFB4AB; --ok: #8BD48B;
  --brand: 'Chakra Petch', 'Roboto', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { overflow-x: hidden; }
body { background: var(--bg); color: var(--text); font: 400 14px/20px 'Roboto', 'Segoe UI', system-ui, sans-serif; letter-spacing: .25px; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; }
code { font-family: Consolas, 'Roboto Mono', monospace; font-size: .92em; background: var(--surface-3); padding: 1px 6px; border-radius: 4px; color: var(--accent); overflow-wrap: anywhere; }
h1 { font: 700 32px/40px var(--brand); letter-spacing: .2px; }
h2 { font: 500 16px/24px 'Roboto', sans-serif; letter-spacing: .15px; margin: 8px 0 4px; }
.sub { color: var(--text-2); margin-top: 4px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- barre du haut ---------- */
.bar { display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--line); }
.brand img { height: 26px; display: block; }
.bar-title { font: 700 18px/1 var(--brand); color: var(--accent); padding-left: 16px; border-left: 1px solid var(--line); }
.spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font: 700 15px var(--brand); flex: none; }
.who-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }

main { max-width: 1180px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 48px) 64px; }

/* ---------- boutons M3 ---------- */
.btn { font: 500 14px/20px 'Roboto', sans-serif; letter-spacing: .1px; height: 40px; padding: 0 24px; border-radius: 20px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative; overflow: hidden; color: inherit; background: none; white-space: nowrap; }
.btn::after { content: ''; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; pointer-events: none; }
.btn:hover::after { opacity: .08; } .btn:active::after { opacity: .12; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .38; cursor: default; } .btn:disabled::after { opacity: 0; }
.btn.filled { background: var(--accent); color: var(--on-accent); }
.btn.tonal { background: var(--surface-3); color: var(--text); }
.btn.outlined { border: 1px solid var(--outline); color: var(--accent); }
.btn.text { padding: 0 12px; color: var(--accent); }
.btn.danger { color: var(--error); padding: 0 12px; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* ---------- cartes / champs ---------- */
.card { background: var(--surface); border-radius: 16px; padding: 24px; }
.field { position: relative; display: block; margin-top: 16px; }
.field input, .field textarea { width: 100%; padding: 16px; background: transparent; border: 1px solid var(--outline); border-radius: 4px; outline: 0; font: 400 16px/24px 'Roboto', sans-serif; color: var(--text); resize: vertical; }
.field input { height: 56px; }
.field input:focus, .field textarea:focus { border: 2px solid var(--accent); padding: 15px; }
.field span { position: absolute; left: 12px; top: -8px; padding: 0 4px; background: var(--surface); color: var(--text-2); font-size: 12px; line-height: 16px; pointer-events: none; }
.field:focus-within span { color: var(--accent); }
.field input[type=number] { -moz-appearance: textfield; }
.hint { color: var(--muted); font-size: 12px; padding: 4px 16px 0; }
.err { min-height: 20px; color: var(--error); font-size: 12px; padding: 4px 16px 0; }
.note { color: var(--text-2); font-size: 12px; text-align: center; margin-top: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- connexion ---------- */
.auth { display: grid; place-items: center; padding-top: 4vh; }
.auth-card { width: 100%; max-width: 420px; border-radius: 28px; padding: 32px 28px 28px; }
.auth-card h1 { text-align: center; font-size: 28px; }
.auth-card .sub { text-align: center; margin-bottom: 20px; }
.auth-card form .btn { width: 100%; margin-top: 4px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; height: 40px; border: 1px solid var(--outline); border-radius: 20px; overflow: hidden; }
.seg button { font: 500 14px 'Roboto', sans-serif; color: var(--text); background: none; border: 0; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--outline); }
.seg button.on { background: var(--surface-3); color: var(--accent); }

/* ---------- tableau de bord ---------- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-head > div { max-width: 680px; }
.list { display: grid; gap: 12px; }
.srv { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--surface); border-radius: 16px; padding: 16px 20px; cursor: pointer; transition: background .15s; }
.srv:hover { background: var(--surface-2); }
.ico { width: 56px; height: 56px; border-radius: 12px; background: var(--surface-3); color: var(--accent); display: grid; place-items: center; font: 700 24px var(--brand); overflow: hidden; }
.ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.srv-body { min-width: 0; }
.srv-name { font-weight: 500; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-meta { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip.on { color: var(--ok); } .chip.on::before { background: var(--ok); }
.empty { background: var(--surface); border-radius: 16px; padding: 40px 24px; text-align: center; color: var(--text-2); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

/* ---------- édition ---------- */
.back { margin: -8px 0 16px -12px; }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.form h2 { margin-top: 24px; } .form h2:first-child { margin-top: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.form-actions.split { justify-content: space-between; }
.media { display: grid; gap: 20px; margin-top: 8px; }
.media-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
.media-head small { color: var(--muted); font-size: 12px; }
.media-row { display: flex; align-items: center; gap: 16px; }
.media-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.media-row .media-actions { margin-top: 0; }
.icon-box { width: 96px; height: 96px; border-radius: 16px; background: var(--surface-3); flex: none; display: grid; place-items: center; overflow: hidden; color: var(--accent); font: 700 40px var(--brand); }
.icon-box img, .banner-box img, .pv-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-box { width: 100%; aspect-ratio: 73 / 8; min-height: 40px; border-radius: 8px; background: var(--surface-3); overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 12px; }

.preview { position: sticky; top: 24px; background: var(--surface); border-radius: 16px; padding: 24px; }
.preview h2 { margin-top: 0; }
.pv-banner { margin-top: 16px; aspect-ratio: 73 / 8; border-radius: 8px 8px 0 0; background: var(--surface-3); overflow: hidden; }
.pv-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--bg); padding: 14px 16px; border-radius: 0 0 12px 12px; }
.pv-ico { width: 48px; height: 48px; border-radius: 10px; background: var(--surface-2); color: var(--accent); display: grid; place-items: center; font: 700 22px var(--brand); overflow: hidden; }
.pv-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-desc { color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.pv-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pv-tags span { font-size: 11px; font-weight: 600; letter-spacing: .5px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.pv-pl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-pl small { display: block; color: var(--muted); font-size: 12px; }
.status { margin-top: 16px; color: var(--text-2); font-size: 13px; }

/* ---------- dialogues ---------- */
.dialog { margin: auto; width: min(560px, calc(100vw - 32px)); background: var(--surface-2); color: var(--text); border: 0; border-radius: 28px; padding: 24px; }
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog h2 { font: 400 24px/32px 'Roboto', sans-serif; margin: 0 0 8px; }
.dialog .field span { background: var(--surface-2); }
.key-box { display: flex; gap: 8px; align-items: center; margin-top: 16px; background: var(--bg); border-radius: 12px; padding: 12px; }
.key-box code { flex: 1; min-width: 0; background: none; padding: 0; font-size: 14px; user-select: all; word-break: break-all; }
.snippet { margin-top: 12px; background: var(--bg); border-radius: 12px; padding: 12px; font: 13px/18px Consolas, 'Roboto Mono', monospace; color: var(--text-2); white-space: pre-wrap; word-break: break-all; }

.snack { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); max-width: calc(100vw - 32px); background: #E8E8E8; color: #1A1A1A; padding: 14px 16px; border-radius: 4px; font-size: 14px; transition: transform .2s; z-index: 50; }
.snack.on { transform: translate(-50%, 0); }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .edit-grid { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; order: -1; }
}
@media (max-width: 560px) {
  h1 { font-size: 26px; line-height: 32px; }
  .bar { gap: 10px; }
  .bar-title { padding-left: 10px; font-size: 16px; }
  .brand img { height: 22px; }
  .who-name { display: none; }
  .btn.text { padding: 0 8px; }
  .srv { grid-template-columns: 48px minmax(0, 1fr); padding: 14px 16px; }
  .srv .ico { width: 48px; height: 48px; }
  .srv .chip { grid-column: 2; justify-self: start; }
  .dash-head .btn { width: 100%; }
  .card, .preview { padding: 20px 16px; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .form-actions .btn.filled { flex: 1; }
  .pv-row { grid-template-columns: 40px minmax(0, 1fr); }
  .pv-ico { width: 40px; height: 40px; }
  .pv-pl { grid-column: 2; text-align: left; }
  .pv-pl small { display: inline; margin-left: 6px; }
  .key-box { flex-direction: column; align-items: stretch; }
}
