/**
 * Liofo mobile — tokens + navigation + écrans (≤768px).
 * Marqueur: LIOFO_MOBILE_CSS_2026_08_04
 * Spec: docs/design-mobile/SPEC.md
 */

:root {
  --liofo-m-bg: #070a10;
  --liofo-m-surface: rgba(18, 24, 34, 0.72);
  --liofo-m-surface-soft: rgba(18, 24, 34, 0.6);
  --liofo-m-border: rgba(255, 255, 255, 0.08);
  --liofo-m-muted: rgba(255, 255, 255, 0.55);
  --liofo-m-text: #eef3f7;
  --liofo-m-radius: 16px;
  --liofo-m-radius-sm: 12px;
  --liofo-m-teal: #0CC0DF;
  --liofo-m-green: #00BF63;
  --liofo-m-pink: #FF66C4;
  --liofo-m-blue: #3DB2FF;
  --liofo-m-violet: #8b5cf6;
  --liofo-m-gold: #ffb84d;
  --liofo-m-up: #00BF63;
  --liofo-m-down: #FF5C7A;
  --liofo-m-grad: linear-gradient(45deg, #00BF63, #0CC0DF);
  --liofo-m-navh: 56px;
}

.liofo-m-card {
  background: var(--liofo-m-surface);
  border: 1px solid var(--liofo-m-border);
  border-radius: var(--liofo-m-radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.liofo-m-section-title {
  position: relative;
  padding-left: 13px;
  font: 700 15px Montserrat, sans-serif;
  color: #fff;
}

.liofo-m-section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 4px;
  border-radius: 2px;
  background: var(--accent, var(--liofo-m-teal));
}

.liofo-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(12, 192, 223, 0.28) transparent;
}

.liofo-scroll::-webkit-scrollbar {
  height: 5px;
  width: 5px;
}

.liofo-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.liofo-scroll::-webkit-scrollbar-thumb {
  background: rgba(12, 192, 223, 0.22);
  border-radius: 999px;
}

.liofo-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(12, 192, 223, 0.4);
}

/* Desktop : tab bar + segmented masqués */
.liofo-tabbar,
.liofo-m-segmented {
  display: none;
}

@media (max-width: 768px) {
  body.logged-in {
    font-family: Montserrat, sans-serif;
    color: var(--liofo-m-text);
    background:
      radial-gradient(120% 65% at 50% -5%, rgba(12, 192, 223, 0.16), transparent 55%),
      radial-gradient(110% 55% at 50% 105%, rgba(0, 191, 99, 0.11), transparent 55%),
      var(--liofo-m-bg);
    padding-bottom: calc(var(--liofo-m-navh) + env(safe-area-inset-bottom, 0px) + 12px);
  }

  body.logged-in .custom-header .header-menu,
  body.logged-in .custom-header .menu-toggle {
    display: none !important;
  }

  body.logged-in .custom-header {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 8px 16px 0;
  }

  /* —— §1 Tab bar —— */
  .liofo-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: calc(var(--liofo-m-navh) + env(safe-area-inset-bottom, 0px));
    padding: 10px 6px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(9, 12, 18, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--liofo-m-border);
  }

  .liofo-tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 56px;
    min-height: 44px;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font: 600 9.5px Montserrat, sans-serif;
  }

  .liofo-tabbar a.is-current {
    color: var(--liofo-m-teal);
    font-weight: 700;
  }

  .liofo-tabbar__icon {
    width: 22px;
    height: 22px;
    display: block;
    background: currentColor;
    opacity: 0.9;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
  }

  .liofo-tabbar__icon--tableau {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
  }

  .liofo-tabbar__icon--patrimoine {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='6' width='20' height='14' rx='2'/%3E%3Cpath d='M2 10h20'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='6' width='20' height='14' rx='2'/%3E%3Cpath d='M2 10h20'/%3E%3C/svg%3E");
  }

  .liofo-tabbar__icon--banques {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 10h18L12 3 3 10z'/%3E%3Cpath d='M5 10v8M9.5 10v8M14.5 10v8M19 10v8M4 18h16'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 10h18L12 3 3 10z'/%3E%3Cpath d='M5 10v8M9.5 10v8M14.5 10v8M19 10v8M4 18h16'/%3E%3C/svg%3E");
  }

  .liofo-tabbar__icon--marches {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19V9M10 19V5M16 19v-7M22 19H2'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19V9M10 19V5M16 19v-7M22 19H2'/%3E%3C/svg%3E");
  }

  .liofo-tabbar__icon--compte {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-4 4.5-6 8-6s6.5 2 8 6'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-4 4.5-6 8-6s6.5 2 8 6'/%3E%3C/svg%3E");
  }

  .liofo-m-segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin: 8px 16px 0;
    background: var(--liofo-m-surface);
    border: 1px solid var(--liofo-m-border);
    border-radius: 12px;
  }

  .liofo-m-segmented a {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font: 700 12px Montserrat, sans-serif;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
  }

  .liofo-m-segmented a.is-active {
    color: #04222a;
    background: var(--liofo-m-grad);
  }

  /* —— §2 Mes Wallets —— */
  body.page-id-mes-wallets .liofo-page-title-head,
  body.logged-in.page-template-default .liofo-page-title-head {
    padding: 8px 16px 0;
  }

  body.liofo-crypto-env .liofo-env-sidebar,
  body.liofo-budget-env .liofo-env-sidebar,
  body.liofo-indicators-env .liofo-env-sidebar,
  body.logged-in .liofo-env-sidebar,
  body.logged-in .conteneurs-rail-crypto {
    display: none !important;
  }

  .wallets-line-scroll,
  #liofo-budget-institutions-list,
  .liofo-budget-banks-line-scroll,
  .liofo-bourse-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(12, 192, 223, 0.28) transparent;
  }

  .conteneurs-transp-mes-wallets {
    margin: 16px;
    padding: 16px;
    background: var(--liofo-m-surface);
    border: 1px solid var(--liofo-m-border);
    border-radius: var(--liofo-m-radius);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .wallet-page-section-title,
  .wallet-page-section-title-wrap h2 {
    position: relative;
    padding-left: 13px;
    font: 700 15px Montserrat, sans-serif !important;
    color: #fff !important;
  }

  .wallet-page-section-title::before,
  .wallet-page-section-title-wrap h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    border-radius: 2px;
    background: var(--liofo-m-teal);
  }

  .wallet-page-section-cta.open-wallet-popup,
  .conteneurs-transp-mes-wallets > .open-wallet-popup {
    background: var(--liofo-m-grad) !important;
    color: #04222a !important;
    border: none !important;
    border-radius: 10px !important;
    font: 700 12px Montserrat, sans-serif !important;
    padding: 10px 14px !important;
    min-height: 44px;
    float: none;
    display: inline-flex;
    align-items: center;
    margin: 0 0 12px auto;
  }

  .wallet-page-section-title-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .wallets-line-prev,
  .wallets-line-next {
    display: none !important;
  }

  .wallets-line-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .wallets-line-scroll > * {
    min-width: 158px;
    flex: 0 0 auto;
  }

  #crypto-table-container,
  .wallet-details-area .tableau-defilable-container,
  .wallet-details-area table {
    display: block;
    width: 100%;
    overflow-x: auto;
  }

  /* —— §3 Santé marchés —— */
  #liofo-market-health {
    margin: 0 16px 20px;
    font-family: Montserrat, sans-serif;
  }

  #liofo-market-health .liofo-mh-hero {
    background: var(--liofo-m-surface);
    border: 1px solid var(--liofo-m-border);
    border-radius: var(--liofo-m-radius);
    padding: 16px;
  }

  #liofo-market-health .liofo-mh-hero-split {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  #liofo-market-health .liofo-mh-score-num {
    font: 800 46px Montserrat, sans-serif !important;
    color: #fff !important;
  }

  #liofo-market-health .liofo-mh-score-suffix {
    color: var(--liofo-m-muted) !important;
  }

  #liofo-mh-sub-crypto,
  #liofo-mh-sub-traditional,
  #liofo-market-health .liofo-mh-pillars,
  #liofo-market-health [data-mh-pillars] {
    margin-top: 12px;
  }

  #liofo-market-health .liofo-mh-pillar,
  #liofo-market-health .liofo-w-brick {
    background: var(--liofo-m-surface-soft);
    border: 1px solid var(--liofo-m-border);
    border-radius: var(--liofo-m-radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    min-height: 44px;
  }

  /* SPEC §3 — jauge / régime / piliers (réagencement mobile, données inchangées) */
  body.liofo-indicators-env #liofo-market-health .liofo-mh-regime-line,
  #liofo-market-health .liofo-mh-regime-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 191, 99, 0.14);
    color: var(--liofo-m-green);
    font: 700 11px Montserrat, sans-serif;
  }

  #liofo-market-health .liofo-w-meter,
  #liofo-market-health .liofo-mh-score-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
  }

  /* —— §4 Bottom sheet (MH + budget + bourse modals) —— */
  .liofo-mh-modal:not([hidden]) {
    align-items: flex-end !important;
  }

  .liofo-mh-modal__backdrop {
    background: rgba(3, 5, 10, 0.55) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }

  .liofo-mh-modal__panel {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 26px 26px 0 0 !important;
    background: #0c1017 !important;
    max-height: 62vh !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    transform: translateY(0);
  }

  .liofo-mh-modal__panel::before {
    content: "";
    display: block;
    width: 42px;
    height: 5px;
    margin: 8px auto 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
  }

  .liofo-mh-modal__close {
    min-width: 44px;
    min-height: 44px;
  }

  .liofo-mh-modal__body {
    overflow-y: auto;
    max-height: calc(62vh - 88px);
    -webkit-overflow-scrolling: touch;
  }

  .liofo-mh-modal__panel .liofo-mh-modal__title {
    font: 800 20px Montserrat, sans-serif;
    color: #fff;
    padding-right: 48px;
  }

  /* —— §5 Tableau de bord —— */
  .conteneurs-graphiques,
  .dashboard-grid,
  #dashboard-container {
    margin-left: 16px;
    margin-right: 16px;
  }

  .patrimoine-chart-container {
    background: var(--liofo-m-surface);
    border: 1px solid var(--liofo-m-border);
    border-radius: var(--liofo-m-radius);
    padding: 16px;
  }

  .patrimoine-chart-amount {
    font: 800 28px Montserrat, sans-serif !important;
    color: #fff !important;
  }

  /* SPEC §5 — donut + top positions (données [donut_chart] / barData existantes) */
  body.logged-in .liofo-page-title-head .titre-page {
    font: 800 26px Montserrat, sans-serif;
    color: #fff;
  }

  #cryptoChart,
  #barChart,
  canvas#myChart,
  .conteneurs-graphiques canvas {
    max-width: 100% !important;
  }

  .conteneurs-graphiques {
    background: var(--liofo-m-surface);
    border: 1px solid var(--liofo-m-border);
    border-radius: var(--liofo-m-radius);
    padding: 14px;
    margin-bottom: 14px;
  }

  /* —— §6 Budget / banques —— */
  #liofo-budget-main {
    margin: 0 16px 24px;
    font-family: Montserrat, sans-serif;
  }

  .liofo-budget-kpi-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .liofo-budget-kpi {
    background: var(--liofo-m-surface);
    border: 1px solid var(--liofo-m-border);
    border-radius: var(--liofo-m-radius);
    padding: 12px;
  }

  .liofo-budget-kpi__value--positive,
  .liofo-budget-kpi [data-kpi="income_entries_month"],
  .liofo-budget-kpi [data-kpi="net_after_expenses_month"] {
    color: var(--liofo-m-green) !important;
  }

  .liofo-budget-month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 12px 0 16px;
    padding: 8px;
    background: var(--liofo-m-surface);
    border: 1px solid var(--liofo-m-border);
    border-radius: var(--liofo-m-radius-sm);
  }

  .liofo-budget-month-nav button {
    min-width: 44px;
    min-height: 44px;
  }

  .liofo-budget-banks-line-nav {
    display: none !important;
  }

  #liofo-budget-institutions-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    list-style: none;
    margin: 0;
    padding: 4px 0 10px;
  }

  #liofo-budget-institutions-list > li {
    min-width: 158px;
    flex: 0 0 auto;
    background: var(--liofo-m-surface);
    border: 1px solid var(--liofo-m-border);
    border-radius: var(--liofo-m-radius);
    padding: 12px;
  }

  .liofo-budget-section-title,
  #liofo-budget-transactions-title {
    position: relative;
    padding-left: 13px;
    font: 700 15px Montserrat, sans-serif !important;
    color: #fff !important;
  }

  .liofo-budget-section-title::before,
  #liofo-budget-transactions-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    border-radius: 2px;
    background: var(--liofo-m-green);
  }

  #liofo-budget-income-bar-chart,
  #liofo-budget-expense-bar-chart {
    width: 100% !important;
    max-height: 180px;
  }

  #liofo-budget-transaction-list .liofo-budget-tx,
  #liofo-budget-transaction-list li {
    border-left: 4px solid rgba(255, 255, 255, 0.2);
    padding-left: 10px;
  }

  /* —— §7 Bourse —— */
  #liofo-bourse-main,
  .liofo-bourse-page {
    margin: 0 16px 24px;
    font-family: Montserrat, sans-serif;
  }

  .liofo-bourse-kpi-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .liofo-bourse-kpi-grid > * {
    background: var(--liofo-m-surface);
    border: 1px solid var(--liofo-m-border);
    border-radius: var(--liofo-m-radius);
    padding: 12px;
  }

  .liofo-bourse-charts-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .liofo-bourse-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .liofo-bourse-positions-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .liofo-bourse-section-title {
    position: relative;
    padding-left: 13px;
    font: 700 15px Montserrat, sans-serif !important;
    color: #fff !important;
  }

  .liofo-bourse-section-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    border-radius: 2px;
    background: var(--liofo-m-blue);
  }

  .liofo-bourse-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 184, 77, 0.18);
    color: var(--liofo-m-gold);
    font: 700 10px Montserrat, sans-serif;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .liofo-bourse-page [data-bourse-modal-open],
  #liofo-budget-main [data-budget-modal-open] {
    background: var(--liofo-m-grad) !important;
    color: #04222a !important;
    border: none !important;
    border-radius: 10px !important;
    font: 700 12px Montserrat, sans-serif !important;
    min-height: 44px;
  }
}
