/* DANKE OS — structure du shell : calques, fenêtres, overlays. Les skins surchargent l'habillage (shell/skins/*/skin.css). */
html.is-shell, html.is-shell body { height: 100%; overflow: hidden; }
.shell { position: fixed; inset: 0; overflow: hidden; background: var(--bg); color: var(--fg); --wa-t: 0px; --wa-r: 0px; --wa-b: 0px; --wa-l: 0px; font-family: var(--font-ui); }
.wallpaper { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.wp-layer { position: absolute; inset: 0; filter: blur(var(--wp-blur, 0px)); transform: scale(1.02); }
.wp-layer > img, .wp-layer > video, .wp-canvas { width: 100%; height: 100%; display: block; }
.wp-canvas { mix-blend-mode: screen; }
.wp-dim { position: absolute; inset: 0; background: #000; opacity: var(--wp-dim, 0); pointer-events: none; }
.wp-mark { position: absolute; right: 6vw; bottom: 8vh; width: min(34vw, 460px); height: auto; color: var(--accent); opacity: 0.07; transform: rotate(-6deg); }
.wallpaper[data-preset="ink"] { background: radial-gradient(900px 520px at 8% -5%, var(--glow-a), transparent 60%), radial-gradient(800px 600px at 100% 100%, var(--glow-b), transparent 60%), var(--bg); }
.wallpaper[data-preset="fumee"] { background: var(--bg); }
.wallpaper[data-preset="paper"] { background: radial-gradient(900px 600px at 20% 10%, #fff6d6, transparent 60%), #efe8d0; }
.wallpaper[data-preset="neon"] { background: conic-gradient(from 210deg at 70% 30%, #0c0b08, #2a1466, #ff5a1f55, #e8c33a33, #0c0b08); animation: wp-spin 40s linear infinite; background-size: 140% 140%; }
.wallpaper[data-preset="aurora"] { background: radial-gradient(800px 500px at 20% 20%, #1a6b66aa, transparent 60%), radial-gradient(700px 600px at 80% 70%, #5b3fd6aa, transparent 60%), #0a0f14; }
.wallpaper[data-preset="dusk"] { background: linear-gradient(160deg, #1c1030 0%, #5b2a63 45%, #e8794a 100%); }
.wallpaper[data-preset="bloom"] { background: radial-gradient(900px 700px at 30% 40%, #2b6cf0, transparent 62%), radial-gradient(800px 600px at 75% 65%, #7b3fe4, transparent 60%), radial-gradient(600px 500px at 50% 100%, #0fb5c9aa, transparent 60%), #0b1730; }
.wallpaper[data-preset="sunrise"] { background: radial-gradient(900px 700px at 20% 100%, #ff7a59, transparent 60%), radial-gradient(900px 700px at 90% 20%, #7d5cff, transparent 60%), linear-gradient(180deg, #2a2150, #5b3a7a 60%, #c8607a); }
.wallpaper[data-preset="aubergine"] { background: radial-gradient(900px 600px at 80% 20%, rgba(233, 84, 32, 0.28), transparent 60%), radial-gradient(900px 700px at 10% 90%, rgba(119, 33, 111, 0.55), transparent 60%), #2c001e; }
.wallpaper[data-preset="mintgreen"] { background: radial-gradient(900px 700px at 70% 30%, rgba(143, 191, 90, 0.22), transparent 60%), radial-gradient(800px 600px at 10% 100%, rgba(30, 90, 90, 0.5), transparent 60%), #1c2a24; }
.wallpaper[data-preset="plasma"] { background: radial-gradient(900px 700px at 20% 20%, rgba(61, 174, 233, 0.35), transparent 60%), radial-gradient(900px 700px at 90% 90%, rgba(120, 80, 220, 0.4), transparent 60%), #1b2a3d; }
.wallpaper[data-preset="tokyo"] { background: radial-gradient(900px 600px at 70% 30%, #2a3a6a66, transparent 60%), #1a1b26; }
@keyframes wp-spin { to { background-position: 100% 100%; } }
:root[data-motion="off"] .wallpaper[data-preset="neon"] { animation: none; }

.desk-widgets { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.desktop { position: absolute; inset: 0; z-index: 2; }
.chrome { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.chrome > * { pointer-events: auto; }
.overlays { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.overlays > * { pointer-events: auto; }

/* ---------- Fenêtres ---------- */
.win { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; background: var(--bg-2); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; outline: none; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35); will-change: translate, width, height; contain: layout paint; }
.win[hidden] { display: none; }
.win[data-state="max"] { border-radius: 0; }
.win-bar { flex: none; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; user-select: none; touch-action: none; cursor: default; }
.win-ctl { display: flex; gap: 6px; align-items: center; }
.wc { display: grid; place-items: center; width: 24px; height: 24px; border: 0; padding: 0; background: transparent; color: inherit; border-radius: 6px; cursor: pointer; }
.win-ico { display: inline-flex; }
.win-ico .app-ico { width: 20px; height: 20px; }
.win-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.win-body { flex: 1; min-height: 0; position: relative; overflow: auto; container-type: inline-size; }
.win.dragging .win-body, .win.resizing .win-body { pointer-events: none; }
.win.dragging { z-index: 9000 !important; cursor: grabbing; }
.win-loading { padding: 24px; color: var(--muted); font-family: var(--font-mono); font-size: 13px; }
.win-loading.err { color: var(--danger); }
.rh { position: absolute; z-index: 3; }
.rh-n, .rh-s { left: 8px; right: 8px; height: 6px; cursor: ns-resize; } .rh-n { top: 0; } .rh-s { bottom: 0; }
.rh-e, .rh-w { top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; } .rh-e { right: 0; } .rh-w { left: 0; }
.rh-ne, .rh-nw, .rh-se, .rh-sw { width: 12px; height: 12px; } .rh-ne { top: 0; right: 0; cursor: nesw-resize; } .rh-nw { top: 0; left: 0; cursor: nwse-resize; } .rh-se { bottom: 0; right: 0; cursor: nwse-resize; } .rh-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.win[data-state="max"] .rh, .win[data-tiled="1"] .rh { display: none; }
.snap-ghost { position: absolute; left: 0; top: 0; z-index: 8000; border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 14%, transparent); pointer-events: none; transition: translate 0.12s, width 0.12s, height 0.12s; }
.app-ico { display: inline-grid; place-items: center; flex: none; }

/* ---------- Menu contextuel ---------- */
.ctx { position: absolute; z-index: 100; min-width: 200px; padding: 6px; background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(var(--glass-blur, 18px)); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; color: var(--fg); border-radius: 8px; text-align: left; cursor: pointer; font-size: 14px; }
.ctx-item:hover, .ctx-item:focus-visible { background: color-mix(in srgb, var(--accent) 22%, transparent); outline: none; }
.ctx-item.danger { color: var(--danger); }
.ctx-item[aria-disabled="true"] { opacity: 0.4; cursor: default; }
.ctx-item .grow { flex: 1; } .ctx-gap { width: 15px; } .ctx-hint { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.ctx-sep { height: 1px; margin: 5px 6px; background: var(--line); }

/* ---------- Palette ---------- */
.pal, .lnch, .ov { position: absolute; inset: 0; z-index: 60; display: grid; place-items: start center; padding-top: 13vh; background: rgba(5, 4, 2, 0.5); backdrop-filter: blur(8px) saturate(1.2); }
.pal-box { width: min(660px, calc(100% - 24px)); max-height: 70vh; display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); overflow: hidden; }
.pal-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-input { flex: 1; border: 0; background: none; font-size: 18px; outline: none; color: var(--fg); min-width: 0; }
.pal-list { overflow: auto; padding: 6px; }
.pal-group { padding: 10px 12px 4px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.pal-item[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.pal-ico { display: grid; place-items: center; width: 28px; height: 28px; color: var(--muted); }
.pal-label { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-sub { display: block; font-size: 12px; color: var(--muted); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 28px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; justify-content: space-between; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pal mark, .lnch mark { background: color-mix(in srgb, var(--accent) 45%, transparent); color: inherit; border-radius: 3px; }
.grow { flex: 1; }

/* ---------- Lanceur ---------- */
.lnch-box { width: min(820px, calc(100% - 24px)); max-height: 76vh; display: flex; flex-direction: column; gap: 14px; padding: 22px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
.lnch-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lnch-head h2 { margin: 0; font-family: var(--font-display); font-size: 28px; color: var(--accent); font-weight: 400; }
.lnch-search { flex: 1; min-width: 180px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); font-size: 15px; }
.lnch-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.lnch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; overflow: auto; padding: 4px; }
.lnch-item { display: grid; justify-items: center; gap: 8px; padding: 14px 6px 10px; border: 1px solid transparent; background: none; color: var(--fg); border-radius: 14px; cursor: pointer; }
.lnch-item:hover, .lnch-item[aria-selected="true"] { background: var(--panel-hi); border-color: var(--line); }
.lnch-name { font-size: 13px; font-weight: 600; text-align: center; }

/* ---------- Vue d'ensemble ---------- */
.ov-box { width: min(1100px, calc(100% - 24px)); max-height: 80vh; display: grid; gap: 18px; align-content: start; padding: 20px; background: color-mix(in srgb, var(--bg-2) 90%, transparent); border: 1px solid var(--line); border-radius: 22px; overflow: auto; }
.ov-ws { display: flex; gap: 8px; flex-wrap: wrap; }
.ov-ws-i { display: grid; gap: 2px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 12px; background: none; color: var(--fg); cursor: pointer; text-align: left; }
.ov-ws-i b { font-family: var(--font-display); font-weight: 400; font-size: 20px; }
.ov-ws-i span { font-size: 11px; color: var(--muted); }
.ov-ws-i.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.ov-card { display: grid; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; }
.ov-card:hover, .ov-card:focus-within { border-color: var(--accent); }
.ov-open { all: unset; cursor: pointer; display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--fg); }
.ov-open:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.ov-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 13px; }
.ov-card-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); }
.ov-card-body { display: grid !important; justify-items: center; gap: 6px; padding: 22px 10px; }

/* ---------- Dock (partagé : danke, macOS) ---------- */
.dock { position: absolute; display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px; z-index: 10; }
.dock-item { position: relative; display: grid; place-items: center; width: var(--dock-size, 52px); height: var(--dock-size, 52px); border: 0; padding: 0; background: none; color: inherit; cursor: pointer; transform-origin: 50% 100%; will-change: scale; }
.dock-item .app-ico { width: 100%; height: 100%; }
.dock-item .glyph { width: 52%; height: 52%; }
.dock-item[data-running="1"]::before { content: ""; position: absolute; bottom: -7px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.dock-item::after { content: attr(data-label); position: absolute; bottom: calc(100% + 14px); left: 50%; translate: -50% 4px; padding: 3px 10px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.12s, translate 0.12s; font-size: 12px; font-weight: 700; background: var(--paper); color: var(--ink); border-radius: 6px; }
.dock-item:hover::after, .dock-item:focus-visible::after { opacity: 1; translate: -50% 0; }
.dock-sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--line); flex: none; }
.dock[data-pos="left"], .dock[data-pos="right"] { flex-direction: column; align-items: center; }
.dock[data-pos="left"] .dock-item, .dock[data-pos="right"] .dock-item { transform-origin: 0 50%; }
.dock[data-pos="left"] .dock-sep, .dock[data-pos="right"] .dock-sep { width: auto; height: 1px; align-self: stretch; margin: 4px 6px; }
.dock[data-pos="left"] .dock-item[data-running="1"]::before { left: -7px; bottom: auto; top: 50%; margin: -2.5px 0 0; }
.dock[data-pos="right"] .dock-item[data-running="1"]::before { right: -7px; left: auto; bottom: auto; top: 50%; margin: -2.5px 0 0; }
.dock[data-pos="left"] .dock-item::after { left: calc(100% + 14px); bottom: 50%; translate: 4px 50%; } .dock[data-pos="left"] .dock-item:hover::after { translate: 0 50%; }
.dock[data-pos="right"] .dock-item::after { left: auto; right: calc(100% + 14px); bottom: 50%; translate: -4px 50%; } .dock[data-pos="right"] .dock-item:hover::after { translate: 0 50%; }

/* ---------- Divers ---------- */
.dropzone { z-index: 90; }
.shell .toasts { z-index: 960; }
@media (prefers-reduced-motion: reduce) { .snap-ghost { transition: none; } .dock-item::after { transition: none; } }

/* ---------- Petits écrans (le vrai mode tactile arrive en P2 : ici on évite seulement de casser la mise en page) ---------- */
@media (max-width: 720px) {
  .dock { max-width: calc(100% - 12px); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .dock::-webkit-scrollbar { display: none; }
  .dock-item { flex: none; }
  .dock-item::after { display: none; }
}

/* ---------- Mode tactile (tablette et téléphone) : cibles ≥ 44 px, pas de survol, pas de sélection parasite ---------- */
html[data-touch="1"] { -webkit-tap-highlight-color: transparent; }
html[data-touch="1"] .shell { touch-action: manipulation; -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
html[data-touch="1"] .shell input, html[data-touch="1"] .shell textarea, html[data-touch="1"] .shell [contenteditable], html[data-touch="1"] .shell .cm-editor, html[data-touch="1"] .shell .md, html[data-touch="1"] .shell .term-out { -webkit-user-select: text; user-select: text; }
html[data-touch="1"] .btn, html[data-touch="1"] .chip, html[data-touch="1"] .ck, html[data-touch="1"] .fm-place, html[data-touch="1"] .set-nav-i, html[data-touch="1"] .ctx-item, html[data-touch="1"] .pal-item, html[data-touch="1"] .au-item { min-height: 44px; }
html[data-touch="1"] .chip-btn { width: 44px; height: 44px; }
html[data-touch="1"] .btn.sm { min-height: 40px; padding-inline: 14px; }
html[data-touch="1"] input[type="text"], html[data-touch="1"] input[type="search"], html[data-touch="1"] input[type="password"], html[data-touch="1"] select { min-height: 44px; font-size: 16px; } /* 16 px : iOS ne zoome pas au focus */
html[data-touch="1"] .win-bar { height: 44px; touch-action: none; }
html[data-touch="1"] .wc { width: 36px; height: 36px; }
html[data-touch="1"] .rh-n, html[data-touch="1"] .rh-s { height: 16px; } html[data-touch="1"] .rh-e, html[data-touch="1"] .rh-w { width: 16px; } html[data-touch="1"] .rh-ne, html[data-touch="1"] .rh-nw, html[data-touch="1"] .rh-se, html[data-touch="1"] .rh-sw { width: 28px; height: 28px; }
html[data-touch="1"] .dock-item::after { display: none; }
html[data-touch="1"] .fm-row { padding-block: 10px; }
html[data-touch="1"] .win-body { -webkit-overflow-scrolling: touch; }
html[data-touch="1"] .ctx { min-width: 220px; } html[data-touch="1"] .ctx-item { padding-block: 10px; font-size: 16px; }
