/* app.css — 410-gui layout complet.
   Migré du <style> inline de index.html (commit de migration strates).
   Hot-reload: éditer ce fichier → CssWatcher → SSE css-reload → swap sans F5.
   Tailwind supprimé: zéro classe utilitaire utilisée, dépendance fantôme. */

/* Profondeur axée logo (theme.mdao follow:logo): couche fixed séparée,
   NE touche pas au background du body — le gradient d'origine reste
   harmonieux jusqu'en bas (pas de double effet). JS pose --depth-x/y/r/a. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(circle var(--depth-r, 0px) at var(--depth-x, 50%) var(--depth-y, 0px),
    rgba(255,176,0,var(--depth-a, 0)), rgba(255,176,0,calc(var(--depth-a, 0) * 0.45)) 45%, transparent 75%);
}

:root {
  --bg-0: #050301; --bg-1: #0d0805; --bg-2: #16100a; --bg-3: #211710;
  --amber: #ffb000; --amber-dim: #c8893a; --amber-soft: #ffd27a;
  --line: rgba(255,176,0,0.14); --line-strong: rgba(255,176,0,0.30);
  --text: #f4e9d8; --text-dim: #a8947a;
  --good: #6ee7a0; --warn: #ffcf5c; --bad: #ff7a5c;
  --err-bg: #2a0a0a; --err-text: #ff4444; --err-border: #552222;
  --ok-bg: #0a2a0a; --ok-text: #44ff44; --ok-border: #225522;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
/* ── Thème light : mêmes rôles, palette inversée ── */
body.light {
  --bg-0: #faf6ef; --bg-1: #f2ecdf; --bg-2: #eae2d2; --bg-3: #dfd4bf;
  --amber: #b87800; --amber-dim: #9a6a24; --amber-soft: #8a5f10;
  --line: rgba(150,110,30,0.18); --line-strong: rgba(150,110,30,0.38);
  --text: #2b2118; --text-dim: #75654e;
  --good: #1d8a4e; --warn: #a06a00; --bad: #c0392b;
  --err-bg: #fde8e8; --err-text: #c0392b; --err-border: #e8b4b4;
  --ok-bg: #e8f5e8; --ok-text: #1d8a4e; --ok-border: #b4d8b4;
}
body.light { background: radial-gradient(1200px 600px at 50% -10%, rgba(184,120,0,0.07), transparent 60%), var(--bg-0); }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, rgba(255,176,0,0.10), transparent 60%), var(--bg-0);
  color: var(--text); font-family: var(--font); line-height: 1.6;
  padding: 6px 20px 24px; -webkit-font-smoothing: antialiased;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.wrap { max-width: 1340px; margin: 0 auto; width: 100%; flex: 1 1 auto; display: flex; flex-direction: column; }
.layout { display: flex; gap: 24px; margin-top: 26px; align-items: flex-start; }

/* Sidebar */
.sidebar {
  flex: 0 0 230px; position: sticky; top: 24px;
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  padding: 12px; box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
}
.sidebar .nav-title { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--amber-dim); padding: 6px 10px 10px; opacity: 0.8; }
.sidebar .nav-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.nav-item {
  display: block; width: 100%; text-align: left;
  border: 1px solid transparent; border-radius: 9px; padding: 10px 12px;
  background: transparent; color: var(--text-dim); font-size: 15px; cursor: pointer;
  transition: all .15s ease; font-family: var(--font);
}
.nav-item:hover { border-color: var(--line-strong); color: var(--text); }
.nav-item.active { background: var(--bg-3); color: var(--amber); border-color: var(--amber-dim); box-shadow: 0 0 0 1px rgba(255,176,0,0.15) inset; }

/* Content */
.content { flex: 1 1 auto; min-width: 0; }

/* Header */
header {
  display: none !important;
  border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 24px 60px -30px rgba(255,176,0,0.25);
  padding: 28px 32px; position: relative; z-index: 1; overflow: hidden;
}
header::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 200px at 90% 0%, rgba(255,176,0,0.12), transparent 70%); pointer-events: none; }
.eyebrow { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--amber-dim); }
h1 { font-size: 30px; font-weight: 700; margin-top: 6px; letter-spacing: -0.01em; }
h1 .accent { color: var(--amber); }
.sub { color: var(--text-dim); margin-top: 8px; font-size: 16px; max-width: 80ch; }
.badge-pill { margin-top: 18px; display: inline-flex; gap: 10px; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; color: var(--amber-soft); background: rgba(255,176,0,0.06); }
.badge-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 16px; background: linear-gradient(180deg, var(--bg-2), var(--bg-1)); box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset; position: relative; transition: border-color .15s ease, transform .15s ease; }
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.card .k-label { font-size: 13.5px; letter-spacing: 0.04em; color: var(--text-dim); text-transform: uppercase; }
.card .k-val { font-family: var(--mono); font-size: 30px; font-weight: 700; color: var(--text); margin-top: 8px; line-height: 1.1; }
.card .k-unit { font-size: 14px; color: var(--amber-dim); font-weight: 600; margin-left: 4px; }
.card .k-sub { font-size: 14px; color: var(--text-dim); margin-top: 8px; }
.card .k-tag { position: absolute; top: 14px; right: 14px; font-size: 10px; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; font-weight: 700; }
.tag-mac { background: rgba(110,231,160,0.12); color: var(--good); border: 1px solid rgba(110,231,160,0.3); }
.tag-linux { background: rgba(255,176,0,0.10); color: var(--amber-soft); border: 1px solid var(--amber-dim); }
.tag-both { background: rgba(255,176,0,0.10); color: var(--amber-soft); border: 1px solid var(--line-strong); }

/* Custom Elements (strates-based) — barre topmenu unifiée */
#top-menu-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px 16px 8px 0;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: 14px;
  /* Les rayons du logo (déborde volontairement) passent au-dessus */
  position: relative;
}
/* #top-menu flex/justify: contrôlé par le shadow :host du composant mdao-menu.js */
#top-menu-row #top-menu {
  display: flex;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  margin-bottom: 0;
}
#site-logo {
  flex: 0 0 auto;
  height: 30px;
  width: 30px;
  cursor: default;
  /* Logo HORS FLUX: la rangée garde sa hauteur naturelle (topmenu seul
     définit le début de page), le logo déborde derrière/autour sans
     influencer la mise en page. Taille réelle via logo.mdao (0x0a00 w/h). */
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 0;
  overflow: visible;
  border-radius: 0;
  object-fit: contain;
}
#theme-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  padding: 0;
  line-height: 0;
  color: var(--amber);
  transition: border-color .15s ease, transform .2s ease;
}
#theme-toggle:hover { border-color: var(--line-strong); background: rgba(255,176,0,0.06); }
#theme-toggle:active { transform: scale(0.94); }
#theme-toggle svg { width: 1.4em; height: 1.4em; }
#main-panel {
  min-height: 200px;
}

/* Gauge */
.gauge { height: 6px; border-radius: 999px; background: var(--bg-3); margin-top: 12px; overflow: hidden; border: 1px solid var(--line); }
.gauge > span { display: block; height: 100%; background: linear-gradient(90deg, var(--amber-dim), var(--amber)); }

/* Section */
.sec-title { font-size: 15px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--amber-dim); margin: 30px 0 4px; }
.sec-note { font-size: 14.5px; color: var(--text-dim); margin-bottom: 14px; max-width: 85ch; }

/* Panel */
.panel { border: 1px solid var(--line); border-radius: 14px; padding: 8px 16px 12px; background: var(--bg-1); margin-top: 12px; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 15px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--amber-dim); font-weight: 600; font-size: 13.5px; letter-spacing: 0.04em; text-transform: uppercase; }
td { color: var(--text); }
td .mono { font-family: var(--mono); }
.ok { color: var(--good); } .warnc { color: var(--warn); } .badc { color: var(--bad); }

/* Feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.feature-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: linear-gradient(180deg, var(--bg-2), var(--bg-1)); }
.feature-card h4 { color: var(--amber); font-size: 16px; margin-bottom: 8px; }
.feature-card p { font-size: 14.5px; color: var(--text-dim); line-height: 1.6; }
.feature-card .badge { display: inline-block; font-size: 10px; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; font-weight: 700; margin-bottom: 10px; }

/* Status indicator */
.status-live { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--good); }
.status-live .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 10px var(--good); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

footer { text-align: center; color: var(--text-dim); font-size: 11.5px; margin-top: auto; padding-top: 40px; }
.hidden { display: none; }

/* topMenuPage (niveau 3) — circonscrire la zone d'onglets (existe dans input.css,
   jamais compilé par le build css; reporté ici directement) */
#page-menu {
  display: flex;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
}

/* ── Scrollbars thémées (suivent dark/light via les vars) ── */
* { scrollbar-width: thin; scrollbar-color: var(--amber-dim) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--amber-dim); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--amber); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ── Sidebar à l'extrême gauche, contenu au max (toutes les pages) ── */
.layout { margin-left: calc(50% - 50vw + 6px); margin-right: calc(50% - 50vw + 20px); gap: 14px; }
.layout .content { padding-right: 20px; }
.sidebar { z-index: 30; } /* le soleil passe DERRIÈRE le sidebar (z du logo = max_h logo.mdao) */
.sidebar { background: linear-gradient(180deg,
  color-mix(in srgb, var(--bg-2) 38%, transparent),
  color-mix(in srgb, var(--bg-1) 38%, transparent));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
/* Colonne de labels du cashflow : largeur contrainte (le layout auto lui
   donnait tout le surplus en vue Mois → vide entre labels et 1re colonne) */
.midbook-cashflow td:first-child, .midbook-cashflow th:first-child { width: 150px; max-width: 150px; }
