/*
 * Phase 4 — « Registre calme »
 * Couche visuelle uniquement. Les moteurs et les comportements métier restent
 * définis par portfolio.html et les modules JavaScript validés.
 */

:root {
  color-scheme: dark;

  /* Palette */
  --p4-night: #070a10;
  --p4-ink: #0b1018;
  --p4-surface: #0f151f;
  --p4-raised: #151d2a;
  --p4-hover: #192333;
  --p4-text: #f4f7fc;
  --p4-secondary: #b8c2d4;
  --p4-muted: #8b97ae;
  --p4-quiet: #626e86;
  --p4-accent: #7181ff;
  --p4-accent-strong: #4f8fff;
  --p4-positive: #2bd6a1;
  --p4-negative: #ff6178;
  --p4-warning: #f5ba63;

  /* Surfaces et traits */
  --p4-line-soft: rgba(225, 232, 255, 0.065);
  --p4-line: rgba(225, 232, 255, 0.105);
  --p4-line-strong: rgba(225, 232, 255, 0.17);
  --p4-focus: rgba(132, 144, 255, 0.88);
  --p4-accent-wash: rgba(113, 129, 255, 0.12);
  --p4-positive-wash: rgba(43, 214, 161, 0.1);
  --p4-negative-wash: rgba(255, 97, 120, 0.1);

  /* Rayons */
  --p4-radius-xs: 8px;
  --p4-radius-sm: 11px;
  --p4-radius-md: 15px;
  --p4-radius-lg: 20px;
  --p4-radius-sheet: 26px;

  /* Espacements */
  --p4-space-1: 4px;
  --p4-space-2: 8px;
  --p4-space-3: 12px;
  --p4-space-4: 16px;
  --p4-space-5: 20px;
  --p4-space-6: 24px;
  --p4-space-8: 32px;
  --p4-space-10: 40px;

  /* Contrôles */
  --p4-control-sm: 40px;
  --p4-control: 46px;
  --p4-control-lg: 50px;

  /* Mouvement */
  --p4-instant: 130ms;
  --p4-state: 210ms;
  --p4-sheet: 280ms;
  --p4-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --p4-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --p4-ease-spring: cubic-bezier(0.18, 1.14, 0.32, 1);

  /* Ombres */
  --p4-shadow-card: 0 18px 48px rgba(0, 0, 0, 0.2);
  --p4-shadow-dialog: 0 30px 90px rgba(0, 0, 0, 0.58);
  --p4-shadow-focus: 0 0 0 4px rgba(113, 129, 255, 0.16);

  /* Compatibilité avec les composants historiques */
  --ink: var(--p4-night);
  --ink2: var(--p4-ink);
  --ink3: var(--p4-surface);
  --line: var(--p4-line-soft);
  --line2: var(--p4-line);
  --line3: var(--p4-line-strong);
  --dim: var(--p4-quiet);
  --muted: var(--p4-muted);
  --soft: var(--p4-secondary);
  --text: #dfe5f2;
  --bright: var(--p4-text);
  --blue: var(--p4-accent-strong);
  --blue2: #8da1ff;
  --violet: var(--p4-accent);
  --green: var(--p4-positive);
  --green2: #20bd8d;
  --red: var(--p4-negative);
  --red2: #e34f68;
  --amber: var(--p4-warning);
  --r: var(--p4-radius-lg);
  --rs: var(--p4-radius-sm);
  --rx: var(--p4-radius-xs);
  --ease: var(--p4-ease);
  --ease2: var(--p4-ease-standard);
}

/* Base et typographie */

html {
  background: var(--p4-night);
  scroll-padding-bottom: 100px;
}

body.phase4-ui {
  background:
    linear-gradient(180deg, rgba(113, 129, 255, 0.025), transparent 240px),
    var(--p4-night);
  color: #dfe5f2;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

body.phase4-ui::before {
  display: none;
}

body.phase4-ui::after {
  background:
    radial-gradient(circle at 18% -8%, rgba(79, 143, 255, 0.08), transparent 30rem),
    radial-gradient(circle at 88% 8%, rgba(113, 129, 255, 0.07), transparent 28rem);
  opacity: 0.75;
}

body.phase4-ui :is(button, input, select, textarea) {
  font-family: inherit;
}

body.phase4-ui :is(
  .stat-val,
  .val-main,
  .coin-qty,
  .chart-delta,
  .chart-tooltip-value,
  .chart-metric-value,
  .asset-detail-hero strong,
  .asset-financial-item strong,
  .preview-item strong,
  .hist-secondary strong
) {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-numeric: tabular-nums slashed-zero;
}

body.phase4-ui :is(
  .stat-sub,
  .val-sub,
  .pnl-sub,
  .mobile-asset-performance,
  .chart-history-note,
  .chart-tooltip-detail,
  .chart-short-help,
  .chart-help,
  .asset-detail-status,
  .asset-detail-note,
  .field-hint,
  .preview-note,
  .informational-note,
  #snapInfo,
  #btcPriceEur
) {
  font-family: inherit !important;
  font-variant-numeric: tabular-nums;
}

body.phase4-ui :is(
  .brand,
  .first-run h1,
  .transaction-head h2,
  .portfolio-empty-card h2,
  .modal h3
) {
  font-family: "Syne", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.phase4-ui :where(button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--p4-focus);
  outline-offset: 3px;
  box-shadow: var(--p4-shadow-focus);
}

/* App chrome */

.topbar {
  height: 66px;
  padding-inline: max(24px, calc((100vw - 1240px) / 2 + 24px));
  background: rgba(7, 10, 16, 0.9);
  border-bottom-color: var(--p4-line-soft);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.brand {
  gap: 9px;
  font-size: 14px;
  letter-spacing: -0.25px;
  cursor: default;
}

.brand-dot,
.lock-logo-dot {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 0 4px rgba(43, 214, 161, 0.08);
  animation: none;
}

.brand-name {
  color: #a9b8ff;
}

.brand-tld {
  color: var(--p4-muted);
}

.topbar-tools {
  gap: 12px;
}

#topTime {
  color: var(--p4-quiet);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.help-btn {
  min-width: 52px;
  min-height: 38px;
  border-color: var(--p4-line);
  border-radius: 999px;
  color: var(--p4-secondary);
  font-size: 12px;
  font-weight: 650;
  transition:
    color var(--p4-instant) ease,
    border-color var(--p4-instant) ease,
    background var(--p4-instant) ease,
    transform var(--p4-instant) ease;
}

.help-btn:hover {
  background: var(--p4-accent-wash);
  border-color: rgba(113, 129, 255, 0.36);
  color: #dbe1ff;
}

.help-btn:active {
  transform: scale(0.97);
}

.pwa-status {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(calc(100% - 44px), 1100px);
  min-height: 46px;
  margin: 10px auto 0;
  padding: 8px 10px 8px 13px;
  border: 1px solid rgba(245, 186, 99, 0.23);
  border-radius: 13px;
  background: rgba(245, 186, 99, 0.055);
  color: var(--p4-secondary);
}

.pwa-status[hidden] {
  display: none;
}

.pwa-status[data-tone="update"] {
  border-color: rgba(113, 129, 255, 0.26);
  background: rgba(113, 129, 255, 0.06);
}

.pwa-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--p4-warning);
  box-shadow: 0 0 0 4px rgba(245, 186, 99, 0.08);
}

.pwa-status[data-tone="update"] .pwa-status-dot {
  background: var(--p4-accent);
  box-shadow: 0 0 0 4px rgba(113, 129, 255, 0.08);
}

.pwa-status > div {
  display: grid;
  flex: 1;
  gap: 2px;
}

.pwa-status strong {
  font-size: 11px;
}

.pwa-status span:not(.pwa-status-dot) {
  color: var(--p4-muted);
  font-size: 10.5px;
}

.pwa-status-action,
.pwa-status-dismiss {
  min-height: 34px;
  border: 1px solid var(--p4-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--p4-secondary);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.pwa-status-action {
  padding-inline: 12px;
}

.pwa-status-dismiss {
  width: 34px;
  font-size: 17px;
}

.pbar {
  min-height: 52px;
  padding: 9px max(24px, calc((100vw - 1240px) / 2 + 24px));
  gap: 8px;
  background: rgba(9, 13, 20, 0.9);
  border-bottom-color: var(--p4-line-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.pchip,
.pchip-all,
.add-pf-btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -0.01em;
  transition:
    color var(--p4-instant) ease,
    border-color var(--p4-instant) ease,
    background var(--p4-instant) ease,
    transform var(--p4-instant) ease;
}

.pchip {
  border-color: transparent;
  color: var(--p4-muted);
}

.pchip:hover:not(.active) {
  border-color: var(--p4-line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--p4-secondary);
}

.pchip.active {
  background: #e9edff;
  border-color: #e9edff;
  color: #101522;
  box-shadow: none;
}

.pchip-all {
  border-color: rgba(245, 186, 99, 0.22);
  background: rgba(245, 186, 99, 0.07);
  color: #e5ba78;
}

.pchip-all:hover,
.pchip-all.active {
  background: #e7bc79;
  border-color: #e7bc79;
  color: #161109;
}

.add-pf-btn {
  border-color: var(--p4-line);
  border-style: solid;
  color: var(--p4-muted);
}

.add-pf-btn:hover {
  border-color: rgba(113, 129, 255, 0.42);
  background: var(--p4-accent-wash);
  color: #cdd5ff;
}

.nav-tabs {
  width: min(1240px, calc(100% - 48px));
  margin: 18px auto 0;
  padding: 4px;
  gap: 3px;
  border: 1px solid var(--p4-line-soft);
  border-radius: var(--p4-radius-sm);
  background: rgba(15, 21, 31, 0.72);
}

.nav-tab {
  min-height: 38px;
  padding: 0 17px;
  border-radius: 8px;
  color: var(--p4-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -0.01em;
  transition:
    color var(--p4-instant) ease,
    background var(--p4-state) var(--p4-ease);
}

.nav-tab::after {
  display: none;
}

.nav-tab:hover {
  color: var(--p4-secondary);
}

.nav-tab.active {
  background: var(--p4-raised);
  color: var(--p4-text);
  box-shadow: inset 0 0 0 1px var(--p4-line-soft);
}

.main {
  max-width: 1240px;
  padding: 24px 24px 64px;
}

.page.active {
  animation: p4-page-in 260ms var(--p4-ease);
}

@keyframes p4-page-in {
  from {
    opacity: 0;
    transform: translate3d(var(--p4-page-offset, 8px), 3px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Boutons et contrôles */

.btn,
.refresh-btn,
.filter-pill,
.hist-action,
.action-btn,
.modal-close {
  border-radius: var(--p4-radius-sm);
  font-weight: 680;
  letter-spacing: -0.01em;
  transition:
    transform var(--p4-instant) var(--p4-ease),
    background var(--p4-instant) ease,
    border-color var(--p4-instant) ease,
    color var(--p4-instant) ease,
    opacity var(--p4-instant) ease;
}

.btn {
  min-height: var(--p4-control);
  padding: 0 18px;
  font-size: 13px;
}

.btn-blue {
  background: var(--p4-accent);
  color: white;
  box-shadow: 0 8px 24px rgba(79, 98, 220, 0.2);
}

.btn-blue:hover {
  background: #8290ff;
  box-shadow: 0 10px 28px rgba(79, 98, 220, 0.28);
  transform: translateY(-1px);
}

.btn-green {
  background: var(--p4-positive);
  color: #07150f;
}

.btn-red {
  background: var(--p4-negative-wash);
  border: 1px solid rgba(255, 97, 120, 0.25);
  color: #ff8799;
}

.btn-red:hover {
  background: rgba(255, 97, 120, 0.16);
  border-color: rgba(255, 97, 120, 0.42);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--p4-line);
  color: var(--p4-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--p4-line-strong);
  color: var(--p4-text);
  transform: none;
}

.btn:active,
.refresh-btn:active,
.filter-pill:active,
.action-btn:active,
.mnav-btn:active {
  transform: scale(0.97);
}

.btn:disabled,
.refresh-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

/* Synthèse — signature « registre » */

.stats-grid {
  position: relative;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--p4-line);
  border-radius: var(--p4-radius-lg);
  background: linear-gradient(145deg, #111823, #0d131c);
  box-shadow: var(--p4-shadow-card);
}

.stats-grid::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(79, 143, 255, 0.12),
    rgba(113, 129, 255, 0.9) 46%,
    rgba(43, 214, 161, 0.5) 76%,
    rgba(43, 214, 161, 0.08)
  );
}

.stat-card {
  min-width: 0;
  min-height: 144px;
  padding: 24px 26px 22px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  transition: background var(--p4-state) ease;
}

.stat-card + .stat-card {
  border-left: 1px solid var(--p4-line-soft);
}

.stat-card:hover {
  z-index: auto;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.018);
  box-shadow: none;
  transform: none;
}

.stat-card::before,
.stat-card::after {
  display: none;
}

.stat-label {
  margin-bottom: 17px;
  color: var(--p4-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.095em;
}

.term-label {
  justify-content: space-between;
}

.term-help {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  background: rgba(113, 129, 255, 0.08);
  color: #9ba8ff;
  font-family: inherit;
  font-size: 11px;
  transition:
    background var(--p4-instant) ease,
    border-color var(--p4-instant) ease,
    transform var(--p4-instant) ease;
}

.term-help:hover {
  border-color: rgba(113, 129, 255, 0.24);
  background: rgba(113, 129, 255, 0.16);
}

.term-help:active {
  transform: scale(0.94);
}

.stat-val {
  color: var(--p4-text);
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 680;
  line-height: 1.08;
  letter-spacing: -0.055em;
  overflow-wrap: anywhere;
}

.stat-sub {
  min-height: 18px;
  margin-top: 10px;
  color: var(--p4-muted);
  font-size: 11px;
  font-weight: 520;
  line-height: 1.55;
  letter-spacing: 0;
}

.stat-pill {
  border-radius: 999px;
  font-size: 11px;
}

.pill-up {
  border-color: rgba(43, 214, 161, 0.18);
  background: var(--p4-positive-wash);
  color: var(--p4-positive);
}

.pill-down {
  border-color: rgba(255, 97, 120, 0.18);
  background: var(--p4-negative-wash);
  color: var(--p4-negative);
}

/* Lecture patrimoniale — une narration courte avant l’analyse */

.dashboard-summary-card {
  position: relative;
  margin: 20px 0;
  padding: 20px 22px 21px;
  overflow: hidden;
  border: 1px solid rgba(113, 129, 255, 0.17);
  border-radius: var(--p4-radius-lg);
  background:
    linear-gradient(112deg, rgba(113, 129, 255, 0.095), rgba(15, 21, 31, 0.92) 42%, rgba(43, 214, 161, 0.035)),
    var(--p4-surface);
  box-shadow: var(--p4-shadow-card);
}

.dashboard-summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--p4-accent), var(--p4-positive));
}

.dashboard-summary-card[hidden],
.portfolio-story-grid[hidden] {
  display: none;
}

.dashboard-section-kicker {
  margin-bottom: 7px;
  color: #8da1ff;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.dashboard-summary-card h2,
.dashboard-section-heading h2 {
  margin: 0;
  color: var(--p4-text);
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.dashboard-summary-card p {
  max-width: 940px;
  margin: 10px 0 0;
  color: #d9e0ed;
  font-size: 14px;
  font-weight: 470;
  line-height: 1.7;
}

.portfolio-story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(330px, 0.88fr);
  gap: 18px;
  margin-bottom: 20px;
}

.allocation-card,
.contributors-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--p4-line);
  border-radius: var(--p4-radius-lg);
  background: linear-gradient(150deg, #111824, #0d131c 78%);
  box-shadow: var(--p4-shadow-card);
}

.dashboard-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-section-heading h2 {
  font-size: 15px;
}

.dashboard-section-badge {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 6px 9px;
  border: 1px solid var(--p4-line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.022);
  color: var(--p4-muted);
  font-size: 9px;
  font-weight: 650;
}

.allocation-layout {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.allocation-chart-wrap {
  position: relative;
  width: 184px;
  height: 184px;
  margin: auto;
}

.allocation-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
  touch-action: pan-y;
}

.allocation-tooltip {
  position: absolute;
  z-index: 4;
  width: min(152px, calc(100% - 12px));
  padding: 9px 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  border: 1px solid rgba(185, 196, 255, 0.17);
  border-radius: 10px;
  background: rgba(20, 28, 42, 0.97);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
  transition: opacity 90ms ease, transform 90ms ease;
}

.allocation-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.allocation-tooltip strong,
.allocation-tooltip span,
.allocation-tooltip small {
  display: block;
}

.allocation-tooltip strong {
  color: var(--p4-text);
  font-size: 11px;
}

.allocation-tooltip span {
  margin-top: 3px;
  color: var(--p4-secondary);
  font: 650 11px "JetBrains Mono", ui-monospace, monospace;
}

.allocation-tooltip small {
  margin-top: 3px;
  color: var(--p4-muted);
  font-size: 9px;
}

.allocation-legend {
  display: grid;
  gap: 5px;
}

.allocation-legend-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--p4-secondary);
  cursor: pointer;
  text-align: left;
  transition: background var(--p4-instant) ease, border-color var(--p4-instant) ease;
}

.allocation-legend-item:hover,
.allocation-legend-item:focus-visible,
.allocation-legend-item.active {
  border-color: var(--p4-line-soft);
  background: rgba(255, 255, 255, 0.028);
}

.allocation-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.allocation-legend-symbol {
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.allocation-legend-percent {
  color: var(--p4-muted);
  font: 600 9.5px "JetBrains Mono", ui-monospace, monospace;
}

.dashboard-section-note {
  margin: 14px 0 0;
  color: var(--p4-muted);
  font-size: 10px;
  line-height: 1.55;
}

.contributors-groups {
  display: grid;
  gap: 14px;
}

.contributors-group[hidden] {
  display: none;
}

.contributors-group h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 7px;
  color: var(--p4-secondary);
  font-size: 10px;
  font-weight: 680;
}

.contributor-tone-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.contributor-tone-dot.positive { background: var(--p4-positive); }
.contributor-tone-dot.negative { background: var(--p4-negative); }

.contributors-list {
  display: grid;
  gap: 4px;
}

.contributor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--p4-line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.016);
}

.contributor-row strong {
  color: var(--p4-text);
  font-size: 10px;
}

.contributor-row span {
  font: 650 10px "JetBrains Mono", ui-monospace, monospace;
}

.contributor-row small {
  display: block;
  margin-top: 2px;
  color: var(--p4-muted);
  font-size: 8.5px;
}

.contributor-row.positive span { color: var(--p4-positive); }
.contributor-row.negative span { color: var(--p4-negative); }

/* Graphique */

.chart-card {
  margin-bottom: 20px;
  padding: 26px 28px 22px;
  overflow: hidden;
  border: 1px solid var(--p4-line);
  border-radius: var(--p4-radius-lg);
  background: linear-gradient(150deg, #101721, #0d131c 76%);
  box-shadow: var(--p4-shadow-card);
  backdrop-filter: none;
}

.chart-card::before {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(113, 129, 255, 0.55) 34%,
    rgba(79, 143, 255, 0.22) 68%,
    transparent
  );
}

.chart-header {
  align-items: center;
  margin-bottom: 18px;
}

.chart-heading {
  min-width: 220px;
}

.chart-title {
  margin-bottom: 7px;
  color: var(--p4-secondary);
  font-size: 12px;
  letter-spacing: 0.085em;
}

.chart-delta {
  min-height: 20px;
  color: var(--p4-muted);
  font-size: 12px;
}

.chart-toolbar {
  gap: 9px;
}

.chart-mode-toggle,
.chart-filters {
  min-height: var(--p4-control-sm);
}

.chart-mode-toggle {
  gap: 2px;
  padding: 3px;
  border-color: var(--p4-line);
  border-radius: 10px;
  background: rgba(5, 8, 13, 0.52);
}

.chart-mode-btn {
  min-height: 32px;
  padding: 0 13px;
  border-radius: 7px;
  color: var(--p4-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  transition:
    background var(--p4-state) var(--p4-ease),
    color var(--p4-instant) ease,
    transform var(--p4-instant) ease;
}

.chart-mode-btn.active {
  background: var(--p4-raised);
  color: var(--p4-text);
  box-shadow: inset 0 0 0 1px var(--p4-line-soft);
}

.chart-mode-btn:active {
  transform: scale(0.97);
}

.chart-filters {
  gap: 3px;
}

.cf {
  min-width: 38px;
  min-height: 34px;
  padding: 0 10px;
  border-color: transparent;
  border-radius: 8px;
  color: var(--p4-muted);
  font-size: 10px;
  transition:
    color var(--p4-instant) ease,
    background var(--p4-instant) ease,
    transform var(--p4-instant) ease;
}

.cf:hover {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.035);
  color: var(--p4-secondary);
}

.cf.active {
  border-color: transparent;
  background: var(--p4-accent);
  color: white;
}

.cf:active {
  transform: scale(0.95);
}

.chart-wrap {
  height: 286px;
  border-radius: var(--p4-radius-md);
  background: rgba(5, 8, 13, 0.26);
  transition: opacity var(--p4-state) ease;
}

.chart-wrap canvas {
  border-radius: inherit;
}

.chart-tooltip {
  width: min(214px, calc(100% - 20px));
  padding: 11px 13px 12px;
  border: 1px solid rgba(185, 196, 255, 0.16);
  border-radius: 12px;
  background: rgba(20, 28, 42, 0.96);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.chart-tooltip-date {
  margin-bottom: 5px;
  color: var(--p4-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.025em;
}

.chart-tooltip-value {
  color: var(--p4-text);
  font-size: 15px;
  font-weight: 700;
}

.chart-tooltip-detail {
  margin-top: 5px;
  color: var(--p4-secondary);
  font-size: 10px;
  line-height: 1.5;
}

.chart-empty {
  z-index: 5;
  inset: 12px;
  border: 1px dashed var(--p4-line);
  border-radius: var(--p4-radius-md);
  background: linear-gradient(145deg, #101722, #0c121b);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.012);
}

.chart-empty-icon {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 13px;
  overflow: visible;
}

.chart-empty-icon rect {
  fill: rgba(113, 129, 255, 0.07);
  stroke: rgba(113, 129, 255, 0.22);
}

.chart-empty-icon path {
  stroke: #7181ff;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-empty strong {
  color: var(--p4-text);
  font-size: 15px;
  letter-spacing: -0.02em;
}

.chart-empty span {
  max-width: 500px;
  margin: 7px auto 0;
  color: var(--p4-muted);
  font-size: 11px;
  line-height: 1.55;
}

.chart-short-help,
.chart-help,
.chart-reliability {
  color: var(--p4-muted);
}

.chart-short-help {
  margin-top: 12px;
  font-size: 11px;
}

.chart-primary-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 14px;
}

.chart-primary-summary.performance-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-primary-metric {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--p4-line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
}

.chart-primary-metric span,
.chart-primary-metric strong {
  display: block;
}

.chart-primary-metric span {
  color: var(--p4-muted);
  font-size: 9px;
  font-weight: 670;
}

.chart-primary-metric strong {
  overflow: hidden;
  margin-top: 5px;
  color: var(--p4-text);
  font: 680 12px "JetBrains Mono", ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-mode-explanation {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  line-height: 1.55;
}

.chart-info-mark {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border: 1px solid var(--p4-line);
  border-radius: 50%;
  color: #8da1ff;
  font: 700 9px "JetBrains Mono", ui-monospace, monospace;
}

.chart-disclosure-bar {
  margin-top: 12px;
  padding-top: 12px;
  border-top-color: var(--p4-line-soft);
}

.chart-history-note {
  color: var(--p4-muted);
  font-size: 10px;
}

.progressive-toggle {
  min-height: 42px;
  padding: 0 14px;
  border-color: var(--p4-line);
  border-radius: var(--p4-radius-sm);
  background: rgba(255, 255, 255, 0.022);
  color: var(--p4-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
}

.progressive-toggle:hover {
  border-color: rgba(113, 129, 255, 0.3);
  background: var(--p4-accent-wash);
  color: #dfe3ff;
}

.progressive-details,
.analysis-expanded .progressive-details,
.progressive-chevron {
  transition-duration: var(--p4-state);
  transition-timing-function: var(--p4-ease);
}

.chart-analysis-content {
  border-top-color: var(--p4-line-soft);
}

.chart-metric {
  padding: 10px 11px;
  border-color: var(--p4-line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.016);
}

.chart-metric-label {
  color: var(--p4-muted);
  font-size: 9px;
}

.chart-metric-value {
  color: var(--p4-text);
  font-size: 11px;
}

.market-context {
  border-top-color: var(--p4-line-soft);
}

.market-context-copy strong {
  font-size: 13px;
}

.market-context-copy span {
  color: var(--p4-muted);
  font-size: 11px;
}

.btc-card {
  border-color: var(--p4-line-soft);
  border-radius: var(--p4-radius-md);
  background: rgba(245, 186, 99, 0.035);
  backdrop-filter: none;
}

.btc-card::before {
  display: none;
}

/* Actifs */

.sec-head {
  min-height: 48px;
  margin-bottom: 8px;
}

.sec-title {
  color: var(--p4-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.095em;
}

.refresh-btn {
  min-height: 38px;
  padding: 0 13px;
  border-color: var(--p4-line);
  color: var(--p4-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
}

.refresh-btn:hover {
  border-color: rgba(113, 129, 255, 0.3);
  background: var(--p4-accent-wash);
  color: #dfe3ff;
}

.refresh-btn.loading svg {
  animation-duration: 920ms;
}

.refresh-btn.done {
  border-color: rgba(43, 214, 161, 0.34);
  color: var(--p4-positive);
}

.refresh-btn.done svg {
  animation: none;
}

.refresh-btn.partial {
  border-color: rgba(245, 186, 99, 0.36);
  color: var(--p4-warning);
}

.refresh-btn.failed {
  border-color: rgba(255, 97, 120, 0.34);
  color: var(--p4-negative);
}

.price-notice {
  margin: 0 0 12px;
  overflow: hidden;
  border: 1px solid rgba(245, 186, 99, 0.24);
  border-radius: var(--p4-radius-md);
  background: rgba(245, 186, 99, 0.055);
  color: var(--p4-secondary);
}

.price-notice[hidden] {
  display: none;
}

.price-notice[data-tone="failure"] {
  border-color: rgba(255, 97, 120, 0.25);
  background: rgba(255, 97, 120, 0.055);
}

.price-notice-main {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 8px 12px;
  gap: 10px;
}

.price-notice-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(245, 186, 99, 0.35);
  border-radius: 8px;
  color: var(--p4-warning);
  font: 750 12px "JetBrains Mono", monospace;
}

.price-notice[data-tone="failure"] .price-notice-icon {
  border-color: rgba(255, 97, 120, 0.4);
  color: var(--p4-negative);
}

.price-notice-main p {
  flex: 1;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
}

.price-notice-toggle {
  min-height: 34px;
  padding: 0 10px;
  flex: 0 0 auto;
  border: 1px solid var(--p4-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--p4-secondary);
  font-size: 10px;
  font-weight: 680;
  cursor: pointer;
}

.price-notice-details {
  padding: 10px 46px 12px;
  border-top: 1px solid rgba(245, 186, 99, 0.13);
  background: rgba(4, 7, 12, 0.16);
}

.price-notice[data-tone="failure"] .price-notice-details {
  border-top-color: rgba(255, 97, 120, 0.13);
}

.price-notice-details p {
  margin: 0 0 5px;
  color: var(--p4-muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.price-notice-details p:last-child {
  margin-bottom: 0;
}

.price-notice-details strong {
  color: var(--p4-secondary);
  font-weight: 680;
}

.table-wrap,
.hist-table {
  overflow: hidden;
  border: 1px solid var(--p4-line);
  border-radius: var(--p4-radius-lg);
  background: var(--p4-surface);
  box-shadow: var(--p4-shadow-card);
}

.table-head {
  min-height: 44px;
  padding-inline: 18px;
  border-bottom: 1px solid var(--p4-line-soft);
  background: rgba(255, 255, 255, 0.018);
}

.th {
  color: var(--p4-quiet);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
}

.asset-row {
  min-height: 72px;
  padding-inline: 18px;
  border-bottom-color: var(--p4-line-soft);
  transition:
    background var(--p4-instant) ease,
    box-shadow var(--p4-instant) ease,
    transform var(--p4-instant) ease;
}

.asset-row:hover {
  background: rgba(113, 129, 255, 0.045);
}

.asset-row:active {
  background: rgba(113, 129, 255, 0.075);
}

.asset-row:focus-visible {
  outline-color: var(--p4-focus);
  background: rgba(113, 129, 255, 0.06);
}

.coin-logo,
.coin-logo-fallback {
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.coin-logo {
  box-sizing: border-box;
  padding: 7px;
  border: 1px solid rgba(185, 196, 255, 0.12);
  background: rgba(255, 255, 255, 0.92);
  object-fit: contain;
}

.coin-name {
  color: var(--p4-text);
  font-size: 13px;
  font-weight: 720;
  letter-spacing: -0.015em;
}

.coin-qty,
.val-sub,
.pnl-sub,
.mobile-asset-performance {
  color: var(--p4-muted);
}

.coin-qty {
  margin-top: 3px;
  font-size: 10px;
}

.val-main,
.asset-row .stat-pill {
  color: #e9edf7;
  font-size: 12px;
  font-weight: 650;
}

.asset-row .stat-pill {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
}

.asset-row .pill-up {
  color: var(--p4-positive);
}

.asset-row .pill-down {
  color: var(--p4-negative);
}

.mobile-asset-performance {
  font-size: 10px;
}

.market-change-24h {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
  font: 600 9.5px "JetBrains Mono", ui-monospace, monospace;
  white-space: nowrap;
}

.asset-row .td:nth-child(7) .market-change-24h {
  justify-content: flex-end;
}

.market-change-24h svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.market-change-24h small {
  color: var(--p4-muted);
  font-family: inherit;
  font-size: 8.5px;
  font-weight: 520;
}

.market-change-up {
  color: var(--p4-positive);
}

.market-change-down {
  color: var(--p4-negative);
}

.market-change-neutral {
  color: var(--p4-muted);
}

.help-about {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--p4-line-soft);
  border-radius: var(--p4-radius-sm);
  background: rgba(113, 129, 255, 0.035);
  color: var(--p4-secondary);
  font-size: 11px;
}

.help-about a {
  color: #9daaff;
  font-weight: 650;
  text-decoration: none;
}

.help-about a:hover {
  color: #c5ccff;
}

.action-btn {
  width: 38px;
  height: 38px;
  border-color: var(--p4-line-soft);
  background: transparent;
}

.asset-detail-btn {
  color: #91a3ff;
  background: rgba(113, 129, 255, 0.04);
}

.asset-detail-btn:hover {
  border-color: rgba(113, 129, 255, 0.3);
  background: rgba(113, 129, 255, 0.1);
}

.informational-note {
  color: var(--p4-quiet);
  font-size: 10px;
}

/* Panneaux, formulaires et données */

.panel,
.backup-card {
  border: 1px solid var(--p4-line);
  border-radius: var(--p4-radius-lg);
  background: var(--p4-surface);
  box-shadow: var(--p4-shadow-card);
}

.transaction-panel {
  padding: 28px;
}

.transaction-head {
  margin-bottom: 24px;
}

.transaction-head h2 {
  color: var(--p4-text);
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.transaction-head p {
  max-width: 620px;
  margin-top: 7px;
  color: var(--p4-muted);
  font-size: 13px;
}

.transaction-form-grid {
  gap: 18px;
}

.field label {
  margin-bottom: 8px;
  color: var(--p4-secondary);
  font-size: 12px;
  font-weight: 650;
}

.field label span {
  color: var(--p4-muted);
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.history-toolbar :is(select, input) {
  min-height: var(--p4-control-lg);
  padding: 0 14px;
  border: 1px solid var(--p4-line);
  border-radius: var(--p4-radius-sm);
  background: rgba(4, 7, 12, 0.38);
  color: var(--p4-text);
  font-size: 15px;
  transition:
    border-color var(--p4-instant) ease,
    background var(--p4-instant) ease,
    box-shadow var(--p4-instant) ease;
}

.field input[type="number"],
.field input[type="date"],
.field input[type="time"] {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.field textarea {
  min-height: 94px;
  padding-block: 13px;
}

.field :is(input, select, textarea):hover {
  border-color: var(--p4-line-strong);
}

.field :is(input, select, textarea):focus {
  border-color: rgba(113, 129, 255, 0.66);
  background: rgba(9, 13, 21, 0.78);
  box-shadow: var(--p4-shadow-focus);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--p4-quiet);
}

.field-hint {
  margin-top: 7px;
  color: var(--p4-muted);
  font-size: 10px;
}

.field-error {
  min-height: 17px;
  margin-top: 5px;
  color: #ff8092;
  font-size: 11px;
  animation: none;
}

.field.has-error :is(input, select, textarea) {
  border-color: rgba(255, 97, 120, 0.7);
  background: rgba(255, 97, 120, 0.045);
}

.field.has-error .field-error:not(:empty) {
  animation: p4-error-in var(--p4-instant) var(--p4-ease);
}

@keyframes p4-error-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.transaction-type {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--p4-line);
  border-radius: var(--p4-radius-sm);
  background: rgba(4, 7, 12, 0.38);
}

.transaction-type button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--p4-muted);
  font-family: inherit;
  font-size: 12px;
  transition:
    background var(--p4-state) var(--p4-ease),
    color var(--p4-instant) ease,
    transform var(--p4-instant) ease;
}

.transaction-type button[aria-pressed="true"][data-type="buy"] {
  border-color: transparent;
  background: var(--p4-positive-wash);
  color: var(--p4-positive);
}

.transaction-type button[aria-pressed="true"][data-type="sell"] {
  border-color: transparent;
  background: var(--p4-negative-wash);
  color: var(--p4-negative);
}

.transaction-type button:active {
  transform: scale(0.98);
}

.supplementary-fields {
  border: 1px solid var(--p4-line-soft);
  border-radius: var(--p4-radius-md);
  background: rgba(255, 255, 255, 0.014);
}

.supplementary-fields summary {
  min-height: 62px;
  padding: 11px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  list-style: none;
  border-radius: inherit;
  transition: background var(--p4-instant) ease;
}

.supplementary-fields summary::-webkit-details-marker {
  display: none;
}

.supplementary-fields summary:hover {
  background: rgba(255, 255, 255, 0.022);
}

.supplementary-fields summary strong,
.supplementary-fields summary small {
  display: block;
}

.supplementary-fields summary strong {
  color: var(--p4-secondary);
  font-size: 12px;
}

.supplementary-fields summary small {
  margin-top: 3px;
  color: var(--p4-muted);
  font-size: 10px;
}

.supplementary-fields summary svg {
  width: 17px;
  flex: 0 0 auto;
  color: var(--p4-muted);
  transition: transform var(--p4-state) var(--p4-ease);
}

.supplementary-fields[open] summary {
  border-bottom: 1px solid var(--p4-line-soft);
  border-radius: var(--p4-radius-md) var(--p4-radius-md) 0 0;
}

.supplementary-fields[open] summary svg {
  transform: rotate(180deg);
}

.supplementary-fields-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px;
  animation: p4-disclosure-in var(--p4-state) var(--p4-ease);
}

.supplementary-fields-content .field-wide {
  grid-column: 1 / -1;
}

@keyframes p4-disclosure-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.transaction-preview {
  margin-top: 22px;
  padding: 18px;
  border-color: var(--p4-line-soft);
  border-radius: var(--p4-radius-md);
  background: rgba(113, 129, 255, 0.035);
}

.transaction-preview h3 {
  color: var(--p4-secondary);
  font-size: 10px;
}

.preview-item {
  border-color: var(--p4-line-soft);
  border-radius: 10px;
  background: rgba(4, 7, 12, 0.2);
}

.transaction-form-actions {
  margin-top: 20px;
}

.edit-source-warning,
.demo-banner {
  border-color: rgba(245, 186, 99, 0.2);
  background: rgba(245, 186, 99, 0.055);
}

.drop-zone {
  border-color: rgba(113, 129, 255, 0.18) !important;
  background: rgba(113, 129, 255, 0.025);
  transition:
    border-color var(--p4-instant) ease,
    background var(--p4-instant) ease;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: rgba(113, 129, 255, 0.46) !important;
  background: rgba(113, 129, 255, 0.055);
}

/* Historique et sauvegarde */

.history-toolbar {
  gap: 8px;
}

.filter-pills {
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--p4-line-soft);
  border-radius: var(--p4-radius-sm);
  background: var(--p4-surface);
}

.filter-pill {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: var(--p4-muted);
  font-family: inherit;
}

.filter-pill[aria-pressed="true"] {
  border-color: transparent;
  background: var(--p4-raised);
  color: var(--p4-text);
}

.history-toolbar :is(select, input) {
  min-height: 48px;
  background: var(--p4-surface);
  font-family: inherit;
  font-size: 12px;
}

.hist-row-v3 {
  border-bottom-color: var(--p4-line-soft);
  transition: background var(--p4-instant) ease;
}

.hist-row-v3:hover {
  background: rgba(113, 129, 255, 0.035);
}

.hist-action {
  border-color: var(--p4-line);
  font-family: inherit;
}

.backup-grid {
  gap: 12px;
}

.backup-card {
  padding: 22px;
}

.backup-card h3 {
  color: var(--p4-text);
  font-size: 15px;
}

.backup-card p {
  color: var(--p4-muted);
  font-size: 12px;
}

/* États vides et première ouverture */

.first-run {
  background:
    radial-gradient(circle at 50% 30%, rgba(113, 129, 255, 0.1), transparent 24rem),
    var(--p4-night);
}

.first-run-card {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 6vw, 70px);
  border-color: var(--p4-line);
  border-radius: var(--p4-radius-sheet);
  background: linear-gradient(150deg, #111824, #0b1018 72%);
  box-shadow: var(--p4-shadow-dialog);
}

.first-run-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--p4-accent), var(--p4-positive), transparent);
  opacity: 0.82;
}

.first-run-mark {
  color: #aab6ff;
  font-size: 10px;
  letter-spacing: 0.13em;
}

.first-run-mark::before {
  background: var(--p4-accent);
  box-shadow: 0 0 0 4px rgba(113, 129, 255, 0.08);
}

.first-run h1 {
  max-width: 650px;
  margin-bottom: 20px;
  color: var(--p4-text);
  font-size: clamp(36px, 6vw, 62px);
  line-height: 0.99;
  letter-spacing: -0.055em;
}

.first-run-copy {
  max-width: 610px;
  color: var(--p4-secondary);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.65;
}

.first-run-privacy {
  color: var(--p4-muted);
}

.portfolio-empty-card,
.empty-state {
  position: relative;
  overflow: hidden;
  border-color: var(--p4-line);
  border-radius: var(--p4-radius-lg);
  background: linear-gradient(145deg, #111824, #0c121b);
  box-shadow: var(--p4-shadow-card);
}

.portfolio-empty-card::before,
.empty-state::before {
  content: "";
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto 18px;
  border: 1px solid rgba(113, 129, 255, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at 68% 34%, var(--p4-positive) 0 3px, transparent 4px),
    linear-gradient(145deg, transparent 45%, rgba(113, 129, 255, 0.8) 46% 49%, transparent 50%),
    rgba(113, 129, 255, 0.06);
}

.portfolio-empty-card h2 {
  color: var(--p4-text);
  font-size: 26px;
  letter-spacing: -0.04em;
}

.portfolio-empty-card p,
.empty-state p {
  color: var(--p4-muted);
}

/* Modales, bottom sheet et toasts */

.overlay {
  padding: 24px;
  background: rgba(3, 5, 9, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity var(--p4-state) ease;
}

.modal {
  padding: 24px;
  border: 1px solid var(--p4-line);
  border-radius: var(--p4-radius-lg);
  background: linear-gradient(150deg, #151d29, #0f151f 70%);
  box-shadow: var(--p4-shadow-dialog);
  transform: translateY(10px) scale(0.985);
  transition: transform var(--p4-sheet) var(--p4-ease);
}

.overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal h3 {
  color: var(--p4-text);
  font-size: 19px;
  letter-spacing: -0.035em;
}

.modal-sub {
  color: var(--p4-muted);
  font-size: 12px;
}

.modal-close {
  width: 40px;
  height: 40px;
  border-color: var(--p4-line);
  background: rgba(255, 255, 255, 0.018);
  color: var(--p4-secondary);
}

.modal-close:hover {
  border-color: var(--p4-line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--p4-text);
}

.asset-detail-panel {
  width: min(620px, 94vw);
  max-height: min(760px, 88vh);
  padding: 26px;
}

.asset-detail-heading {
  border-bottom-color: var(--p4-line-soft);
}

.asset-detail-kicker {
  color: #9daaff;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.asset-detail-overview {
  gap: 10px;
}

.asset-detail-hero {
  padding: 17px;
  border-color: var(--p4-line-soft);
  border-radius: var(--p4-radius-md);
  background: rgba(113, 129, 255, 0.045);
}

.asset-detail-hero span,
.asset-financial-item span {
  color: var(--p4-muted);
  letter-spacing: 0.08em;
}

.asset-detail-hero strong {
  color: var(--p4-text);
  font-size: 18px;
}

.asset-detail-status {
  border-color: var(--p4-line-soft);
  border-radius: var(--p4-radius-sm);
  background: rgba(255, 255, 255, 0.016);
}

.asset-detail-status[data-status="fresh"]::before {
  background: var(--p4-positive);
  box-shadow: 0 0 0 4px rgba(43, 214, 161, 0.08);
}

.asset-detail-status[data-status="estimated"]::before {
  background: var(--p4-warning);
}

.asset-detail-status[data-status="unavailable"]::before {
  background: var(--p4-negative);
}

.asset-financial-item {
  padding: 12px;
  border-color: var(--p4-line-soft);
  border-radius: var(--p4-radius-sm);
  background: rgba(255, 255, 255, 0.014);
}

.asset-detail-actions {
  border-top-color: var(--p4-line-soft);
}

#assetDetailEdit {
  min-width: 128px;
  border-color: transparent;
  background: var(--p4-accent);
  color: white;
}

#assetDetailDelete {
  min-width: 112px;
}

.undo-toast,
#af-toast,
.api-toast {
  border-color: var(--p4-line);
  border-radius: 14px;
  background: rgba(22, 30, 43, 0.96);
  color: var(--p4-secondary);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Skeleton disponible pour les transitions de données */

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: transparent !important;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.055), transparent);
  animation: p4-skeleton 1.35s ease-in-out infinite;
}

@keyframes p4-skeleton {
  to {
    transform: translateX(100%);
  }
}

/* Tablette */

@media (max-width: 900px) {
  .portfolio-story-grid {
    grid-template-columns: 1fr;
  }

  .allocation-layout {
    grid-template-columns: minmax(170px, 0.72fr) minmax(0, 1.28fr);
  }

  .contributors-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .topbar,
  .pbar {
    padding-inline: 22px;
  }

  .nav-tabs {
    width: calc(100% - 44px);
  }

  .main {
    padding-inline: 22px;
  }

  .stat-card {
    min-height: 136px;
    padding: 22px;
  }

  .stat-val {
    font-size: clamp(24px, 3vw, 30px);
  }

  .chart-wrap {
    height: 272px;
  }
}

/* Mobile — web app native */

@media (max-width: 640px) {
  html {
    scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  body.phase4-ui {
    font-size: 14px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  body.phase4-ui::after {
    opacity: 0.5;
  }

  .topbar {
    height: calc(54px + env(safe-area-inset-top));
    padding:
      env(safe-area-inset-top)
      16px
      0;
    background: rgba(7, 10, 16, 0.94);
  }

  .brand {
    font-size: 13px;
  }

  .brand-name {
    overflow: hidden;
    max-width: min(43vw, 178px);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pin-key {
    min-width: 56px;
    min-height: 56px;
    touch-action: manipulation;
  }

  #topTime {
    display: none;
  }

  .help-btn {
    min-width: 50px;
    min-height: 36px;
    padding: 0 12px;
  }

  .pwa-status {
    align-items: flex-start;
    width: calc(100% - 28px);
    margin-top: 8px;
    padding: 10px;
  }

  .pwa-status-action {
    align-self: center;
  }

  .pbar {
    min-height: 48px;
    padding: 7px 14px;
    gap: 6px;
  }

  .pchip,
  .pchip-all,
  .add-pf-btn {
    min-height: 34px;
    padding-inline: 13px;
    font-size: 11px;
  }

  .nav-tabs {
    display: none;
  }

  .nav-mobile {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(66px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--p4-line);
    background: rgba(9, 13, 20, 0.96);
    box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
  }

  .mnav-btn {
    position: relative;
    min-width: 0;
    min-height: 54px;
    gap: 3px;
    border-radius: 13px;
    color: var(--p4-muted);
    font-family: inherit;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: -0.01em;
    transition:
      color var(--p4-instant) ease,
      background var(--p4-instant) ease,
      transform var(--p4-instant) ease;
  }

  .mnav-btn svg {
    width: 20px;
    height: 20px;
    filter: none;
  }

  .mnav-btn.active {
    background: rgba(113, 129, 255, 0.1);
    color: #aeb9ff;
  }

  .mnav-btn.active svg {
    filter: none;
  }

  .main {
    padding: 14px 14px calc(92px + env(safe-area-inset-bottom));
  }

  .demo-banner {
    border-radius: var(--p4-radius-md);
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .stats-grid::before {
    display: none;
  }

  .stat-card {
    min-height: 112px;
    padding: 16px;
    border: 1px solid var(--p4-line) !important;
    border-radius: var(--p4-radius-md);
    background: linear-gradient(145deg, #111823, #0d131c);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
  }

  .stats-grid .stat-card:first-child {
    min-height: 126px;
    grid-column: 1 / -1;
  }

  .dashboard-summary-card {
    margin: 14px 0;
    padding: 17px 17px 18px;
    border-radius: 17px;
  }

  .dashboard-summary-card h2,
  .dashboard-section-heading h2 {
    font-size: 15px;
  }

  .dashboard-summary-card p {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.65;
  }

  .portfolio-story-grid {
    gap: 12px;
    margin-bottom: 14px;
  }

  .allocation-card,
  .contributors-card {
    padding: 16px 14px;
    border-radius: 17px;
  }

  .allocation-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .allocation-chart-wrap {
    width: 164px;
    height: 164px;
  }

  .allocation-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .allocation-legend-item {
    min-height: 34px;
    padding-inline: 6px;
  }

  .contributors-groups {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .stat-label {
    margin-bottom: 12px;
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .stat-val {
    font-size: 21px;
    letter-spacing: -0.045em;
  }

  .stat-primary .stat-val {
    font-size: 31px;
  }

  .stat-sub {
    margin-top: 7px;
    font-size: 9px;
    line-height: 1.45;
  }

  .term-help {
    width: 26px;
    height: 26px;
  }

  .chart-card {
    margin-bottom: 18px;
    padding: 16px 14px 14px;
    border-radius: 17px;
  }

  .chart-header {
    display: block;
    margin-bottom: 12px;
  }

  .chart-heading {
    min-width: 0;
    margin-bottom: 12px;
  }

  .chart-title {
    font-size: 10px;
  }

  .chart-delta {
    font-size: 11px;
  }

  .chart-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .chart-mode-toggle {
    width: 100%;
  }

  .chart-mode-btn {
    flex: 1;
  }

  .chart-periods {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
  }

  .chart-periods .cf {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 0;
  }

  .chart-wrap {
    height: 230px;
    border-radius: 13px;
  }

  .chart-primary-summary,
  .chart-primary-summary.performance-mode {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .chart-primary-metric {
    padding: 9px;
  }

  .chart-primary-metric strong {
    font-size: 11px;
  }

  .chart-empty {
    inset: 8px;
  }

  .chart-empty-icon {
    width: 38px;
    height: 38px;
    margin-bottom: 10px;
  }

  .chart-empty strong {
    font-size: 14px;
  }

  .chart-empty span {
    font-size: 10px;
  }

  .chart-tooltip {
    padding: 10px 12px;
  }

  .chart-short-help {
    font-size: 10px;
  }

  .chart-disclosure-bar {
    gap: 9px;
  }

  .progressive-toggle {
    min-height: 46px;
  }

  .chart-analysis-content .chart-summary {
    gap: 6px;
  }

  .chart-metric {
    padding: 9px;
  }

  .sec-head {
    min-height: 44px;
    margin-bottom: 6px;
  }

  .sec-title {
    font-size: 11px;
  }

  .refresh-btn {
    min-height: 38px;
  }

  .price-notice-main {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px;
  }

  .price-notice-main p {
    min-width: calc(100% - 36px);
    padding-top: 3px;
    font-size: 11px;
  }

  .price-notice-toggle {
    width: 100%;
    margin-left: 34px;
  }

  .price-notice-details {
    padding: 10px 12px 12px 44px;
  }

  .table-wrap {
    border-radius: var(--p4-radius-md);
  }

  .asset-row {
    grid-template-columns: 36px minmax(0, 1fr) minmax(86px, auto) 42px;
    min-height: 72px;
    padding: 7px 9px;
    gap: 1px 8px;
  }

  .coin-logo,
  .coin-logo-fallback {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .asset-row .coin-name {
    font-size: 13px;
  }

  .asset-row .coin-qty {
    font-size: 9px;
  }

  .asset-row .td:nth-child(3) .val-main {
    font-size: 11px;
  }

  .asset-row .td:nth-child(7) .stat-pill {
    max-width: 100px;
    font-size: 11px;
  }

  .asset-row .td:nth-child(7) .market-change-24h {
    max-width: 112px;
    font-size: 9px;
  }

  .asset-row .td:nth-child(7) .market-change-24h small {
    font-size: 8px;
  }

  .action-btn,
  .asset-row .action-btn {
    width: 40px;
    height: 44px;
    border-radius: 11px;
  }

  .informational-note {
    margin-top: 12px;
  }

  .transaction-panel {
    padding: 20px 16px !important;
  }

  .transaction-head {
    margin-bottom: 20px;
  }

  .transaction-head h2 {
    font-size: 22px;
  }

  .transaction-head p {
    font-size: 12px;
  }

  .transaction-form-grid {
    gap: 14px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 50px;
    font-size: 16px;
  }

  .supplementary-fields-content {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  .supplementary-fields-content .field-wide {
    grid-column: auto;
  }

  .supplementary-fields summary {
    min-height: 64px;
  }

  .transaction-preview {
    padding: 15px;
  }

  .transaction-form-actions {
    bottom: calc(68px + env(safe-area-inset-bottom));
    margin-inline: -2px;
    padding: 13px 2px 4px;
    background: linear-gradient(transparent, var(--p4-night) 34%);
  }

  .transaction-form-actions .btn {
    min-height: 50px;
  }

  .history-toolbar :is(select, input) {
    min-height: 48px;
    font-size: 16px;
  }

  .first-run {
    padding:
      calc(18px + env(safe-area-inset-top))
      14px
      calc(18px + env(safe-area-inset-bottom));
  }

  .first-run-card {
    padding: 30px 22px;
    border-radius: 22px;
  }

  .first-run h1 {
    font-size: clamp(34px, 10vw, 46px);
  }

  .first-run-copy {
    font-size: 15px;
  }

  .portfolio-empty-card {
    padding: 30px 20px;
  }

  .portfolio-empty-card h2 {
    font-size: 23px;
  }

  .overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: min(88vh, 760px);
    padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--p4-radius-sheet) var(--p4-radius-sheet) 0 0;
    transform: translateY(32px);
  }

  .overlay.open .modal {
    transform: translateY(0);
  }

  .asset-detail-overlay {
    padding: 0 0 calc(66px + env(safe-area-inset-bottom));
  }

  .asset-detail-panel {
    max-height: min(78vh, 740px);
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: var(--p4-radius-sheet) var(--p4-radius-sheet) 0 0;
  }

  .asset-detail-heading {
    top: -20px;
    padding: 13px 0 14px;
    background: #131b27;
  }

  .asset-detail-heading::before {
    width: 36px;
    height: 4px;
    top: 5px;
    background: rgba(225, 232, 255, 0.18);
  }

  .asset-detail-overview {
    gap: 8px;
  }

  .asset-detail-hero {
    padding: 13px;
  }

  .asset-detail-hero strong {
    font-size: 15px;
  }

  .asset-financial-grid {
    gap: 7px;
  }

  .asset-financial-item {
    padding: 11px;
  }

  .asset-detail-actions {
    bottom: calc(-18px - env(safe-area-inset-bottom));
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(19, 27, 39, 0.94), #131b27 26%);
  }

  #assetDetailEdit,
  #assetDetailDelete {
    min-width: 0;
  }

  .undo-toast,
  #af-toast {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}

/* Polissage premium — hiérarchie, continuité des données et micro-interactions */

.val-sub,
.pnl-sub {
  font-size: 10.5px;
  line-height: 1.45;
}

.chart-history-note,
.chart-short-help,
.field-hint,
.preview-note,
.informational-note,
.asset-detail-note,
.asset-detail-status {
  color: var(--p4-muted);
  font-size: 11px;
  line-height: 1.5;
}

.asset-detail-kicker {
  font-size: 10px;
}

.asset-detail-hero span,
.asset-financial-item span {
  font-size: 9.5px;
}

/* Signature « data pulse » pendant l’actualisation et à la stabilisation */

.dashboard-populated .stat-val,
.dashboard-populated .stat-sub,
.dashboard-populated .asset-row {
  transition:
    color var(--p4-state) var(--p4-ease),
    opacity var(--p4-state) var(--p4-ease),
    transform var(--p4-state) var(--p4-ease);
}

.dashboard-populated.is-refreshing .stat-val,
.dashboard-populated.is-refreshing .stat-sub {
  opacity: 0.44;
  transform: translateY(1px);
}

.dashboard-populated.is-refreshing .stat-card {
  position: relative;
  overflow: hidden;
}

.dashboard-populated.is-refreshing .stat-card::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(185, 196, 255, 0.055) 43%,
    rgba(113, 129, 255, 0.11) 50%,
    transparent 72%
  );
  transform: translateX(-112%);
  animation: p4-refresh-sheen 1.1s linear infinite;
}

.dashboard-populated.data-settled .stat-val {
  animation: p4-value-settle 520ms var(--p4-ease-spring) both;
}

.dashboard-populated.data-settled .stats-grid::before {
  animation: p4-data-pulse 620ms var(--p4-ease) both;
}

#assetList.data-settled .asset-row {
  animation: p4-row-settle 360ms var(--p4-ease) both;
  animation-delay: calc(var(--row-index, 0) * 24ms);
}

@keyframes p4-refresh-sheen {
  to {
    transform: translateX(112%);
  }
}

@keyframes p4-value-settle {
  0% {
    opacity: 0.48;
    transform: translateY(3px);
  }
  58% {
    color: #fff;
    transform: translateY(-1px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes p4-data-pulse {
  0% {
    filter: brightness(0.72);
    transform: scaleX(0.2);
    transform-origin: left;
  }
  58% {
    filter: brightness(1.38);
  }
  100% {
    filter: brightness(1);
    transform: scaleX(1);
    transform-origin: left;
  }
}

@keyframes p4-row-settle {
  from {
    opacity: 0.55;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Skeletons : mêmes proportions que la liste finale, sans saut de mise en page */

.portfolio-skeleton {
  overflow: hidden;
}

.portfolio-skeleton-row {
  display: grid;
  grid-template-columns: 38px minmax(140px, 1fr) minmax(110px, 0.7fr) 38px;
  align-items: center;
  min-height: 72px;
  padding: 0 18px;
  gap: 14px;
  border-bottom: 1px solid var(--p4-line-soft);
  opacity: 0;
  animation: p4-skeleton-row-in 260ms var(--p4-ease) both;
  animation-delay: calc(var(--skeleton-index, 0) * 32ms);
}

.portfolio-skeleton-row:last-child {
  border-bottom: 0;
}

.portfolio-skeleton-row :is(
  .portfolio-skeleton-logo,
  .portfolio-skeleton-copy > i,
  .portfolio-skeleton-value > i,
  .portfolio-skeleton-action
) {
  position: relative;
  display: block;
  overflow: hidden;
  background: rgba(185, 196, 255, 0.075);
}

.portfolio-skeleton-row :is(
  .portfolio-skeleton-logo,
  .portfolio-skeleton-copy > i,
  .portfolio-skeleton-value > i,
  .portfolio-skeleton-action
)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(214, 221, 255, 0.09),
    transparent
  );
  transform: translateX(-100%);
  animation: p4-skeleton-shimmer 1.25s ease-in-out infinite;
}

.portfolio-skeleton-logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.portfolio-skeleton-copy,
.portfolio-skeleton-value {
  display: grid;
  gap: 8px;
}

.portfolio-skeleton-copy > i:first-child {
  width: 94px;
  height: 11px;
  border-radius: 4px;
}

.portfolio-skeleton-copy > i:last-child {
  width: 62px;
  height: 8px;
  border-radius: 3px;
}

.portfolio-skeleton-value > i:first-child {
  width: 88px;
  height: 11px;
  border-radius: 4px;
}

.portfolio-skeleton-value > i:last-child {
  width: 70px;
  height: 8px;
  border-radius: 3px;
}

.portfolio-skeleton-action {
  width: 38px;
  height: 38px;
  border: 1px solid var(--p4-line-soft);
  border-radius: 11px;
}

.portfolio-skeleton-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes p4-skeleton-row-in {
  to {
    opacity: 1;
  }
}

@keyframes p4-skeleton-shimmer {
  60%,
  100% {
    transform: translateX(100%);
  }
}

/* Graphique : l’instance Chart.js reste en place, seul son rendu se raccorde */

.chart-card.chart-is-changing .chart-heading {
  animation: p4-chart-copy-swap 260ms var(--p4-ease) both;
}

.chart-card.chart-is-changing .chart-wrap canvas {
  animation: p4-chart-swap 280ms var(--p4-ease) both;
}

.chart-card.chart-first-entry .chart-wrap canvas {
  transform-origin: left center;
  animation: p4-chart-reveal 640ms var(--p4-ease) both;
}

@keyframes p4-chart-copy-swap {
  0% {
    opacity: 0.62;
    transform: translateY(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes p4-chart-swap {
  0% {
    opacity: 0.56;
    filter: saturate(0.7);
  }
  100% {
    opacity: 1;
    filter: saturate(1);
  }
}

@keyframes p4-chart-reveal {
  0% {
    opacity: 0;
    clip-path: inset(0 100% 0 0 round 12px);
  }
  100% {
    opacity: 1;
    clip-path: inset(0 0 0 0 round 12px);
  }
}

/* Détail d’actif : continuité depuis la ligne, puis panneau à détente douce */

.asset-row.is-opening {
  z-index: 1;
  background: rgba(113, 129, 255, 0.075);
  box-shadow: inset 3px 0 0 rgba(113, 129, 255, 0.72);
  transform: scale(0.995);
}

.asset-detail-panel {
  transform-origin: var(--asset-origin-x, 50%) var(--asset-origin-y, 50%);
  will-change: transform, opacity;
}

.asset-detail-overlay.open {
  animation: p4-overlay-in 240ms ease-out both;
}

.asset-detail-overlay.open .asset-detail-panel {
  animation: p4-asset-panel-in 380ms var(--p4-ease-spring) both;
}

@keyframes p4-overlay-in {
  from {
    background-color: rgba(3, 5, 9, 0);
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
  }
}

@keyframes p4-asset-panel-in {
  0% {
    opacity: 0;
    transform: translateY(13px) scale(0.982);
  }
  68% {
    opacity: 1;
    transform: translateY(-2px) scale(1.002);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Enregistrement : le bouton porte toute la confirmation, sans modal supplémentaire */

#transactionSubmit {
  position: relative;
  min-width: 150px;
  overflow: hidden;
  transition:
    color var(--p4-state) ease,
    background var(--p4-state) ease,
    border-color var(--p4-state) ease,
    transform var(--p4-state) var(--p4-ease-spring);
}

#transactionSubmit.is-saving {
  padding-right: 42px;
  cursor: wait;
  color: #dbe2ff;
}

#transactionSubmit.is-saving::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 15px;
  height: 15px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: white;
  border-radius: 50%;
  animation: p4-submit-spin 650ms linear infinite;
}

#transactionSubmit.is-saved {
  border-color: var(--p4-positive);
  background: var(--p4-positive);
  color: #061611;
  transform: scale(1.018);
}

@keyframes p4-submit-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1024px) {
  .nav-mobile {
    --active-index: 0;
    isolation: isolate;
  }

  .nav-mobile::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: 6px;
    left: 8px;
    width: calc((100% - 16px) / 4);
    height: 54px;
    border: 1px solid rgba(113, 129, 255, 0.11);
    border-radius: 13px;
    background: linear-gradient(
      155deg,
      rgba(113, 129, 255, 0.13),
      rgba(79, 143, 255, 0.055)
    );
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
    transform: translateX(calc(var(--active-index) * 100%));
    transition: transform 300ms var(--p4-ease-spring);
    pointer-events: none;
  }

  .mnav-btn {
    z-index: 1;
    font-size: 10px;
    background: transparent;
  }

  .mnav-btn.active {
    background: transparent;
  }

  .mnav-btn svg {
    transition: transform 260ms var(--p4-ease-spring);
  }

  .mnav-btn.active svg {
    transform: translateY(-1px) scale(1.045);
  }

  .asset-detail-overlay.open .asset-detail-panel {
    animation-name: p4-asset-sheet-in;
  }

  @keyframes p4-asset-sheet-in {
    0% {
      opacity: 0;
      transform: translateY(46px) scale(0.987);
    }
    68% {
      opacity: 1;
      transform: translateY(-3px) scale(1);
    }
    100% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
}

@media (max-width: 640px) {
  .stat-sub {
    font-size: 10.5px;
    line-height: 1.45;
  }

  .chart-empty span,
  .chart-short-help {
    font-size: 11px;
  }

  .asset-row .coin-qty {
    font-size: 10px;
  }

  .portfolio-skeleton-row {
    grid-template-columns: 36px minmax(0, 1fr) 88px 42px;
    min-height: 66px;
    padding: 7px 9px;
    gap: 8px;
  }

  #transactionSubmit {
    min-width: 0;
  }
}

/* Réduction de mouvement — toutes les animations visuelles de phase 4 */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .skeleton::after,
  .portfolio-skeleton-row *::after {
    display: none;
  }
}
