:root {
  --bg: #0a0e18; --surface: #131a2e; --surface-2: #1a2340; --text: #eef1f8; --muted: #aab4d0;
  --primary: #4fb0ff; --primary-2: #7c5cff; --border: rgba(255,255,255,0.1);
  --top: env(safe-area-inset-top); --bottom: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: radial-gradient(120% 60% at 50% 0, #14213d 0, var(--bg) 60%) no-repeat var(--bg); color: var(--text); font: 15px/1.45 Inter, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: calc(14px + var(--top)) 20px 14px; background: rgba(10,14,24,0.8); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.logo { width: 34px; height: 34px; border-radius: 9px; }
.bar h1 { flex: 1; margin: 0; font: 700 1.25rem Poppins, sans-serif; }
.me { padding: 7px 14px; border-radius: 99px; background: var(--surface-2); font-size: 0.85rem; font-weight: 600; }
.me.avatar { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; background: linear-gradient(135deg, var(--primary), var(--primary-2)); font: 700 1rem Poppins, sans-serif; }

.install { display: block; width: calc(100% - 40px); max-width: 720px; margin: 16px auto 0; padding: 12px; border: 1px dashed var(--primary); border-radius: 14px; background: rgba(79,176,255,0.08); color: var(--primary); font: 600 0.95rem Inter, sans-serif; cursor: pointer; }

main { max-width: 760px; margin: 0 auto; padding: 20px 20px calc(96px + var(--bottom)); }
.hello { margin: 0 0 16px; color: var(--muted); }
.hello:empty { display: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); transition: transform 0.15s, background 0.15s; }
.tile:active { transform: scale(0.96); }
@media (hover: hover) { .tile:hover { background: var(--surface-2); transform: translateY(-2px); } }
.tile-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 8px; border-radius: 16px; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.tile-icon svg { width: 27px; height: 27px; stroke-width: 2; }
.tile-name { font: 700 1.05rem Poppins, sans-serif; }
.tile-tag { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
.tile-status { position: absolute; top: 14px; right: 14px; padding: 2px 8px; border-radius: 99px; background: rgba(79,176,255,0.15); color: var(--primary); font-size: 0.7rem; font-weight: 600; }
/* Pastille d'état (status.wiski.pro) sur le coin de l'icône */
.project-live { position: absolute; top: 60px; left: 60px; width: 14px; height: 14px; border: 3px solid var(--surface); border-radius: 50%; font-size: 0; }
.live-operational { background: #37d399; }
.live-degraded { background: #ffb020; }
.live-down { background: #ff5a5a; }
.live-maintenance { background: #ff8a3d; }

.news { display: flex; flex-direction: column; gap: 10px; }
.news .timeline-item { padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.news time { color: var(--muted); font-size: 0.8rem; }
.news p { margin: 4px 0 0; }
.changelog-tag { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--primary); font-size: 0.75rem; font-weight: 600; }

.account { padding: 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.account p { margin: 0 0 16px; color: var(--muted); }
.account .who { color: var(--text); }
.btn { display: inline-block; padding: 11px 20px; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); font-weight: 600; }
.btn-ghost { background: var(--surface-2); }
.links { display: flex; flex-direction: column; margin-top: 16px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); overflow: hidden; }
.links a { padding: 14px 20px; border-top: 1px solid var(--border); }
.links a:first-child { border-top: 0; }
.links a::after { content: '›'; float: right; color: var(--muted); }

.tabs { position: fixed; inset: auto 0 0; z-index: 2; display: flex; justify-content: center; gap: 4px; padding: 8px 12px calc(8px + var(--bottom)); background: rgba(10,14,24,0.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
.tabs button { flex: 0 1 140px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; border: 0; border-radius: 12px; background: none; color: var(--muted); font: 500 0.75rem Inter, sans-serif; cursor: pointer; }
.tabs svg { width: 22px; height: 22px; }
.tabs [aria-pressed="true"] { color: var(--primary); }

/* Projet ouvert dans l'appli */
.viewer { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; background: var(--bg); }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--top)) 10px 8px; border-bottom: 1px solid var(--border); background: var(--bg); }
.viewer-bar strong { flex: 1; overflow: hidden; font: 700 1.05rem Poppins, sans-serif; white-space: nowrap; text-overflow: ellipsis; }
.viewer-icon .tile-icon, .viewer-icon img { display: grid; place-items: center; width: 30px; height: 30px; margin: 0; border-radius: 9px; box-shadow: none; }
.viewer-icon .tile-icon svg { width: 17px; height: 17px; }
.icon-btn { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 12px; background: var(--surface); color: var(--text); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.frames { position: relative; flex: 1; }
.frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
body.viewing { overflow: hidden; }
/* Sites en maintenance : à la fin de la grille (classe posée par loadLiveState de js/card.js) */
.tile:has(.live-maintenance) { order: 1; }

/* Store */
.store { display: flex; flex-direction: column; gap: 10px; }
.store-item { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.store-item .tile-icon { flex: none; width: 48px; height: 48px; margin: 0; border-radius: 14px; }
.store-item .tile-icon svg { width: 24px; height: 24px; }
.store-item div { flex: 1; min-width: 0; }
.store-item strong { display: block; font: 700 1rem Poppins, sans-serif; }
.store-item div span { color: var(--muted); font-size: 0.8rem; }
.store-item .btn { flex: none; padding: 8px 16px; font-size: 0.85rem; }
.tile-native::after { content: 'Installée'; margin-top: 4px; color: #37d399; font-size: 0.7rem; font-weight: 600; } /* sous le texte, pas par-dessus */
.store-off { order: 1; opacity: 0.55; }
.store-off .btn { cursor: not-allowed; }
.not-installed { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; }

/* Écrans de chargement (démarrage, projet en cours d'ouverture) */
.loader { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: radial-gradient(120% 60% at 50% 0, #14213d 0, var(--bg) 60%) var(--bg); transition: opacity 0.4s, visibility 0.4s; }
.frames .loader { position: absolute; z-index: 1; }
.loader.done { opacity: 0; visibility: hidden; }
.ring { position: relative; display: grid; place-items: center; width: 84px; height: 84px; }
.ring::before { content: ''; position: absolute; inset: 0; border: 3px solid var(--border); border-top-color: var(--primary); border-right-color: var(--primary-2); border-radius: 50%; animation: spin 0.9s linear infinite; }
.ring img, .ring .tile-icon { width: 52px; height: 52px; margin: 0; border-radius: 14px; animation: pulse 1.4s ease-in-out infinite; }
.ring .tile-icon svg { width: 26px; height: 26px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(0.92); } }
@media (prefers-reduced-motion: reduce) { .ring::before, .ring img, .ring .tile-icon { animation: none; } }
