/* ============ Linkii — design system (POC) · charte « Corporate », cf. brand/charte.md ============ */
:root {
  --bg: #F5F7FA; --surface: #fff; --ink: #0B1F3A; --muted: #5A6B80; --line: #DDE3EA; --line-2: #C5CED9; --row: #EDF1F5;
  --brand: #0B1F3A;            /* couleur principale : Nuit par défaut, remplacée par celle du revendeur */
  --brand-tint: color-mix(in srgb, var(--brand) 8%, #fff);
  --signal: #3B82C4;           /* accent : logo, sélection, focus, liens */
  --ok: #1E8E5A; --ok-bg: #E1F0E8; --ok-ink: #155A38;
  --warn: #B7791F; --warn-bg: #FBF0DC; --warn-ink: #7A4F12;
  --danger: #C8372D; --danger-bg: #FBE4E2; --danger-ink: #8A231C;
  --radius: 4px;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; font-weight: 500; }
p { font-weight: 400; }
b, strong, th { font-weight: 500; }
a { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }

/* ---------- Logo (wordmark « linkii ») ---------- */
.wm { display: inline-flex; align-items: baseline; font-weight: 500; letter-spacing: -.03em; line-height: 1; color: var(--ink); }
.wm .i { display: inline-block; width: .095em; height: .5em; background: currentColor; margin-left: .07em; position: relative; }
.wm .i + .i { margin-left: .1em; }
.wm .i::before { content: ""; position: absolute; left: 0; top: -.2em; width: .095em; height: .095em; background: currentColor; }
.wm .i.s::before { background: var(--signal); }
.mark { width: 30px; height: 30px; border-radius: var(--radius); background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 500; font-size: 15px; flex: none; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--surface); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 17px; color: var(--ink); padding: 4px 10px 24px; }
.sidebar .brand .wm { font-size: 26px; }
.sidebar a.nav { display: flex; align-items: center; gap: 12px; color: var(--muted); text-decoration: none; padding: 9px 12px; border-radius: var(--radius); transition: background .12s, color .12s; }
.sidebar a.nav svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar a.nav:hover { background: var(--bg); color: var(--ink); }
.sidebar a.nav.active { background: var(--brand-tint); color: var(--ink); font-weight: 500; box-shadow: inset 2px 0 0 var(--brand); border-radius: 0 var(--radius) var(--radius) 0; }
.sidebar .spacer { flex: 1; }
main.content { flex: 1; padding: 32px 40px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; letter-spacing: -.01em; line-height: 1.2; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h3 { font-size: 16px; margin-bottom: 4px; }
.card .hint { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.stat .n { font-size: 28px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat .n.ok { color: var(--ok); }

input, select, textarea { font: inherit; color: var(--ink); padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: #fff; outline: none; transition: border-color .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
input:disabled { background: var(--bg); color: var(--muted); }
.btn { font: inherit; font-weight: 500; cursor: pointer; border: 1px solid var(--brand); border-radius: var(--radius); padding: 9px 16px; background: var(--brand); color: #fff; transition: background .12s, border-color .12s; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: color-mix(in srgb, var(--brand) 85%, #fff); border-color: color-mix(in srgb, var(--brand) 85%, #fff); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--bg); border-color: var(--muted); }
.btn.danger { background: #fff; color: var(--danger); border-color: #EBC2BE; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.icon { padding: 5px 9px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--radius); font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot, currentColor); }
.badge.en-ligne { color: var(--ok-ink); background: var(--ok-bg); --dot: var(--ok); }
.badge.mise-a-jour { color: var(--warn-ink); background: var(--warn-bg); --dot: var(--warn); }
.badge.hors-ligne { color: var(--danger-ink); background: var(--danger-bg); --dot: var(--danger); }

.msg { color: var(--ok); font-weight: 500; margin-top: 10px; }
.err { color: var(--danger); font-weight: 500; margin-top: 10px; }
small, .muted { color: var(--muted); }

/* ---------- Cartes écran ---------- */
.screens-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.screen-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.screen-preview { aspect-ratio: 16/9; background: var(--ink); display: grid; place-items: center; position: relative; color: #9AAABD; font-size: 13px; }
.screen-preview span { z-index: 1; color: #DDE3EA; font-weight: 500; }
.screen-body { padding: 14px 16px 16px; display: grid; gap: 10px; }
.screen-body .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.screen-body .name { font-weight: 500; font-size: 16px; }
.screen-body select { width: 100%; }

/* ---------- Médiathèque ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: relative; }
.tile .thumb { aspect-ratio: 16/9; background: var(--ink); display: grid; place-items: center; overflow: hidden; position: relative; }
.tile .thumb img, .tile .thumb video { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb .clock-ico { color: #fff; font-weight: 500; font-size: 26px; font-family: var(--mono); }
.tile .meta { padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tile .meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .type { position: absolute; top: 8px; left: 8px; background: rgba(11,31,58,.85); color: #fff; font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 3px; }
.tile .thumb .proc { position: absolute; left: 8px; right: 8px; bottom: 8px; color: #DDE3EA; font-size: 12px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.failed { border-color: #EBC2BE; }

/* ---------- Playlists ---------- */
.pl-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.pl-list { display: grid; gap: 6px; }
.pl-pill { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 11px 14px; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .12s; display: flex; justify-content: space-between; align-items: center; }
.pl-pill:hover { border-color: var(--line-2); }
.pl-pill.active { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); font-weight: 500; }
.item-row { display: grid; grid-template-columns: 28px 84px 1fr 190px auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 6px; }
.item-row .idx { color: var(--muted); font-family: var(--mono); font-size: 13px; text-align: center; }
.item-row .th { aspect-ratio: 16/9; background: var(--ink); border-radius: 3px; overflow: hidden; display: grid; place-items: center; color: #fff; font-weight: 500; position: relative; }
.item-row .th img, .item-row .th video { width: 100%; height: 100%; object-fit: cover; }
.item-row input[type=number] { width: 100%; }
.item-row .summary { color: var(--muted); }
.publish-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.draft-dot { color: var(--warn-ink); background: var(--warn-bg); padding: 2px 9px; border-radius: var(--radius); font-size: 12px; font-weight: 500; }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .big { font-size: 18px; color: var(--ink); font-weight: 500; margin-bottom: 6px; }

/* ============ Connexion / création de compte ============ */
.wz { position: fixed; inset: 0; z-index: 100; background: var(--bg); color: var(--ink); display: grid; place-items: center; overflow: auto; padding: 24px; }
.wz-blobs { display: none; }
.wz.auth .auth-card { width: min(420px, 100%); padding: 36px 36px 30px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.auth-card .brand { padding: 0 0 26px; }
.auth-card .brand .wm { font-size: 34px; }
.auth-card h1 { font-size: 24px; letter-spacing: -.01em; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 22px; }
.auth-form { display: grid; gap: 6px; }
.auth-form label { font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 10px; }
.auth-form input { width: 100%; padding: 11px 12px; }
.auth-form .btn { margin-top: 18px; justify-content: center; padding: 11px; }
.auth-form .validation-message { color: var(--danger); font-size: 13px; }
.auth-form ul.validation-errors { color: var(--danger); margin: 6px 0 0; padding-left: 18px; }
.auth-alt { margin: 16px 0 0; text-align: center; font-size: 14px; }
.powered { margin: 18px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.sidebar .powered { margin: 10px 0 0; text-align: left; padding: 0 10px; }

/* ============ Topbar + menu utilisateur ============ */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 40px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.topbar .org { font-weight: 500; color: var(--ink); }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid transparent; border-radius: var(--radius); padding: 5px 8px; cursor: pointer; font: inherit; color: var(--ink); }
.user-btn:hover { background: var(--bg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 500; font-size: 13px; }
.who { display: flex; flex-direction: column; text-align: left; line-height: 1.25; font-size: 14px; }
.who small { font-size: 12px; }
.chev { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu-backdrop { position: fixed; inset: 0; z-index: 29; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 4px; z-index: 30; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 3px; border: 0; background: transparent; color: var(--ink); font: inherit; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.menu .logout { color: var(--danger); }
.menu form { margin: 0; }

/* ============ Segmented / format d'écran ============ */
.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.seg button { font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line-2); background: #fff; color: var(--ink); transition: border-color .12s; }
.seg button:hover { border-color: var(--muted); }
.seg button.on { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); font-weight: 500; }
.seg button small { background: var(--row); color: var(--muted); border-radius: 3px; padding: 0 6px; font-family: var(--mono); font-size: 11px; }
.seg button.on small { background: var(--signal); color: #fff; }
.shape { display: inline-block; border: 2px solid currentColor; border-radius: 2px; }
.shape.land { width: 20px; height: 12px; } .shape.port { width: 12px; height: 20px; }
.fmt { display: grid; gap: 16px; }
.fmt label, .lbl { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.lbl { margin-top: 14px; } .full { width: 100%; }
.fmt-line { color: var(--muted); font-size: 13px; }
.fmt-line small { margin-left: 4px; }
.screen-preview .frame { z-index: 1; border: 1px solid #3A5170; border-radius: 3px; width: 62%; aspect-ratio: 16/9; display: grid; place-items: center; }
.screen-preview.portrait .frame { aspect-ratio: 9/16; height: 82%; width: auto; }
.screen-preview .frame span { font-size: 12px; text-align: center; padding: 4px; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; align-items: start; }
.settings-grid input[type=number], .settings-grid .full { width: 100%; }

/* ============ Widgets de données / connecteurs ============ */
.dw { display: grid; gap: 14px; max-width: 640px; }
.dw-field label, .dw-check { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.dw-field input[type=text], .dw-field select { width: 100%; }
.dw-field small { display: block; margin-top: 6px; font-weight: 400; }
.dw-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.dw-check input { width: 18px; height: 18px; padding: 0; }
.dw-note { background: #EAF2FA; border: 1px solid #C4DAF0; color: #1F4E7E; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; }
.csv-pick { position: relative; display: inline-block; }
.csv-pick input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.steps-doc { margin: 0 0 16px; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.ms-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
code { font-family: var(--mono); background: var(--row); padding: 1px 5px; border-radius: 3px; font-size: 12.5px; }
.linklike { background: none; border: none; color: var(--signal); cursor: pointer; font: inherit; padding: 8px; }

/* conversion vidéo */
.spinner-lg { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Multi-tenant / white-label ---------- */
.impersonation { background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid #EBD3A6; padding: 8px 20px; display: flex; align-items: center; gap: 14px; font-size: 14px; }
.impersonation form { margin: 0; }
.impersonation button { background: var(--warn-ink); color: #fff; border: 0; border-radius: var(--radius); padding: 5px 12px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.tbl th, .tbl td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--row); font-size: 14px; vertical-align: middle; }
.tbl th { color: var(--muted); font-size: 13px; background: var(--bg); border-bottom-color: var(--line); }
.tbl .num { text-align: right; font-family: var(--mono); font-size: 13px; }
.tbl form { display: inline; margin: 0; }
.pill { display: inline-block; padding: 2px 9px; border-radius: var(--radius); font-size: 12px; font-weight: 500; background: var(--row); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); } .pill.bad { background: var(--danger-bg); color: var(--danger-ink); } .pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.logo-prev { height: 56px; max-width: 220px; object-fit: contain; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; display: block; margin-bottom: 8px; }

/* ---------- Apps : catalogue ---------- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.app-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; justify-content: space-between; }
.app-top { display: flex; gap: 12px; align-items: flex-start; }
.app-title { font-size: 15px; font-weight: 500; }
.app-sum { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.app-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.app-foot .added { margin-left: auto; font-size: 12px; color: var(--ok-ink); background: var(--ok-bg); padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.app-foot .added::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 6px; }
.app-ico { width: 46px; height: 46px; border-radius: 6px; background: #EAF0F7; color: var(--ink); display: grid; place-items: center; flex: none; }
.app-ico.yt { background: #fff; border: 1px solid var(--line); }
.app-ico.sm { width: 34px; height: 34px; }
.ico-svg { display: block; flex: none; }

/* catalogue : recherche, filtres, groupes pliables */
.search-box { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0 10px; color: var(--muted); margin-bottom: 12px; }
.search-box:focus-within { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.search-box input { flex: 1; min-width: 0; border: 0; box-shadow: none; padding: 9px 0; background: transparent; }
.search-box input:focus { box-shadow: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); border-radius: var(--radius); }
.chip:hover { border-color: var(--muted); }
.chip .ico-svg { color: var(--muted); }
.chip small { font-family: var(--mono); font-size: 11px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.on .ico-svg, .chip.on small { color: #B9C6D8; }
.cat-group { margin-top: 18px; }
.cat-head { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 8px 2px; cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.cat-head:hover .chev { color: var(--ink); }
.cat-head > .ico-svg { color: var(--signal); }
.cat-head h2 { font-size: 15px; font-weight: 500; }
.cat-head .count { color: var(--muted); font-size: 12px; flex: 1; }
.cat-head .chev { color: var(--muted); display: grid; transition: transform .15s; transform: rotate(-90deg); }
.cat-head .chev.open { transform: none; }
.cat-desc { color: var(--muted); font-size: 13px; margin: 10px 0; }
.app-grid { margin-top: 10px; }
.cat-desc + .app-grid { margin-top: 0; }
.fold-all { margin-top: 12px; text-align: right; }
.note-line { display: block; margin-top: 10px; }
.dur { position: absolute; right: 6px; bottom: 6px; background: rgba(11,31,58,.88); color: #fff; font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 3px; line-height: 1.5; }

/* ---------- Fenêtre modale ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11,31,58,.45); z-index: 100; }
.modal { position: fixed; z-index: 101; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
         background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 22px 24px; }
.modal h3 { margin: 0 0 4px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal.app-modal { padding: 0; width: min(640px, calc(100vw - 32px)); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.app-modal .modal-head h3 { margin: 0; font-size: 18px; }
.app-modal .modal-x { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 6px; border-radius: var(--radius); display: grid; margin: -6px -6px -6px 0; }
.app-modal .modal-x:hover { background: var(--bg); color: var(--ink); }
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; margin: 0; }
.app-modal .modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.app-modal .modal-body > .lbl:first-of-type { margin-top: 16px; }
.app-modal .modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--bg); }

.nav-toggle { display: none; background: none; border: 0; padding: 6px; margin-left: -6px; color: var(--ink); cursor: pointer; border-radius: var(--radius); }
.nav-backdrop { display: none; }

/* ---------- Responsive : tablette et smartphone ---------- */
@media (max-width: 900px) {
  .nav-toggle { display: grid; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; z-index: 60; width: min(280px, 85vw); transform: translateX(-100%); transition: transform .2s; overflow-y: auto; }
  .sidebar.open { transform: none; }
  .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(11,31,58,.45); z-index: 55; }
  .sidebar a.nav { padding: 12px; }
  main.content { padding: 20px 16px 48px; } .topbar { padding: 0 16px; gap: 10px; }
  .topbar .org { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-head { margin-bottom: 18px; } .page-head h1 { font-size: 24px; }
  .pl-layout { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 24px 64px 1fr; } .item-row > :nth-child(n+4) { grid-column: 2 / -1; }
}
@media (max-width: 640px) {
  .who, .user-btn .chev { display: none; }
  .menu { position: fixed; left: 12px; right: 12px; top: 64px; min-width: 0; }
  .card { padding: 16px; }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .page-head > .btn, .page-head .row > .btn { flex: 1; justify-content: center; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; } .stat { padding: 12px 14px; } .stat .n { font-size: 24px; }
  .publish-bar .btn { flex: 1 1 100%; justify-content: center; }
  .btn, select, input { min-height: 40px; } .btn.sm { min-height: 34px; }
  .modal:not(.app-modal) { width: calc(100vw - 16px); padding: 18px 16px; }
  .modal.app-modal { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%; max-height: 92vh; border-radius: 12px 12px 0 0; border-bottom: 0; }
  .app-modal .modal-foot { flex-direction: column-reverse; } .app-modal .modal-foot .btn { justify-content: center; }
}

/* fenêtres de confirmation (désinstaller, supprimer) */
.modal.app-modal.sm { width: min(440px, calc(100vw - 32px)); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: #A92D24; border-color: #A92D24; }
@media (max-width: 640px) { .modal.app-modal.sm { width: 100%; } }

/* champ « fichier importé » des apps */
.file-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-btn { position: relative; cursor: pointer; }
.file-btn input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; min-height: 0; }
.dw-field input[type=password], .dw-field input[type=number], .dw-field textarea { width: 100%; }

/* ============ Installation sur l'écran d'accueil (PWA) ============ */
.pwa-install { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: 520px; margin: 0 auto;
               display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 14px;
               background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 12px 14px; }
.pwa-install[hidden] { display: none; }
.pwa-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; font-size: 14px; }
.pwa-text span { color: var(--muted); }
.pwa-actions { display: flex; gap: 8px; }
.menu .install-item { display: none; }
.can-install .menu .install-item { display: block; }
@media (min-width: 720px) { .pwa-install { left: auto; right: 20px; margin: 0; } }