/* =====================================================================
   Je gère mes biens · Refonte de l'espace propriétaire (novembre 2026)
   Couche à charger APRÈS app.css, theme.css, portfolio.css,
   accounting-*.css et inspections/desk.css. Elle ne change aucun HTML.
   Référence : DESIGN.md
   ===================================================================== */

/* ---------- 1. Jetons ---------- */
html body[data-design] {
  --c-brand: #007398;
  --c-brand-hover: #006584;
  --c-brand-bright: #007DA4;
  --c-brand-deep: #005A75;
  --c-brand-soft: #E7F8FC;
  --c-brand-softer: #F0FAFF;
  --c-ink: #123E4B;
  --c-text: #1E3A44;
  --c-muted: #5B6F76;
  --c-bg: #F4F7F8;
  --c-surface: #FFFFFF;
  --c-track: #EBF1F2;
  --c-line: #E3EAEC;
  --c-field: #D3DEE1;
  --c-success: #1F7A55; --c-success-bg: #E9F6EF;
  --c-warning: #9A5A12; --c-warning-bg: #FFF4E3;
  --c-danger: #B23B3B;  --c-danger-bg: #FDECEC;
  --c-focus: #7FD3EA;
  --c-on-brand: #FFFFFF; /* texte posé sur la couleur de marque */
  /* Rayons : xs badges fins · sm étiquettes · md contrôles et blocs internes · lg cartes et fenêtres · pill */
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  /* Texte : 8 tailles seulement (16px réservé aux champs sur mobile, contre le zoom iOS). */
  --fs-caption: 12px; --fs-small: 13px; --fs-body-sm: 14px; --fs-body: 15px; --fs-input: 16px;
  --fs-lead: 17px; --fs-h3: 20px; --fs-h2: 24px; --fs-h1: 28px;
  /* Hauteurs de contrôle : 44px = cible tactile minimale ; 36px pour les boutons compacts. */
  --h-control: 44px; --h-control-sm: 36px;
  /* Espacements (multiples de 4) et durées d'animation. */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-12: 48px;
  --dur-fast: 150ms; --dur-base: 200ms; --ease: cubic-bezier(.2, 0, 0, 1);
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --sh: 0 1px 2px rgba(18,62,75,.04), 0 4px 16px rgba(18,62,75,.045);
  --sh-pop: 0 12px 32px rgba(18,62,75,.14);
  --card-border: transparent;

  /* Les anciens jetons pointent tous vers la marque : fini le bleu #0066cc et l'indigo #4268e5. */
  --color-brand: var(--c-brand);
  --color-brand-dark: var(--c-brand-hover);
  --color-brand-light: var(--c-brand-soft);
  --color-text: var(--c-text);
  --color-muted: var(--c-muted);
  --color-border: var(--c-line);
  --color-bg: var(--c-bg);
  --color-green: var(--c-success);
  --color-orange: var(--c-warning);
  --color-surface: var(--c-surface);
  --color-fill: var(--c-track);
  --radius: var(--r-lg);
  --shadow: var(--sh);

  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
@media screen {
  html body[data-design][data-theme=dark] {
    --c-brand: #5CC6E4;
    --c-brand-hover: #7FD3EA;
    --c-brand-bright: #5CC6E4;
    --c-brand-deep: #9BDDEF;
    --c-brand-soft: #12313B;
    --c-brand-softer: #172B32;
    --c-ink: #F1F7F8;
    --c-text: #E6F0F2;
    --c-muted: #A9BCC2;
    --c-bg: #0E1B21;
    --c-surface: #152329;
    --c-track: #1C2D33;
    --c-line: #23363D;
    --c-field: #2E444C;
    --c-success: #7FD8AE; --c-success-bg: #143328;
    --c-warning: #F5C17A; --c-warning-bg: #3A2A12;
    --c-danger: #F2A0A0;  --c-danger-bg: #3A1C1F;
    --c-focus: #5CC6E4;
    --c-on-brand: #0E1B21;
    --sh: none;
    --sh-pop: 0 12px 32px rgba(0,0,0,.45);
    --card-border: var(--c-line);
    --summary-blue: var(--c-brand); --summary-muted: var(--c-muted); --summary-line: var(--c-line);
    --portfolio-ink: var(--c-ink); --portfolio-muted: var(--c-muted); --portfolio-line: var(--c-line);
    color-scheme: dark;
  }
}
html body[data-design] .dashboard_component { --summary-blue: var(--c-brand); --summary-muted: var(--c-muted); --summary-line: var(--c-line); }
html body[data-design] .portfolio_component { --portfolio-ink: var(--c-ink); --portfolio-muted: var(--c-muted); --portfolio-line: var(--c-line); color: var(--c-text); }
html body[data-design] .accounting2_component { --a2-ink: var(--c-ink); --a2-muted: var(--c-muted); --a2-line: var(--c-line); --a2-surface: var(--c-surface); --a2-soft: var(--c-bg); color: var(--c-text); }

/* ---------- 2. Base ---------- */
html body[data-design] :focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: var(--r-xs); }
html body[data-design] a:hover { color: var(--c-brand-hover); }
html body[data-design] h1,
html body[data-design] main h1,
html body[data-design] .portfolio_heading h1,
html body[data-design] .accounting2_heading h1,
html body[data-design] .accounts_heading h1,
html body[data-design] .dashboard_component h1 {
  font-size: var(--fs-h1); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; color: var(--c-ink); margin: 0 0 6px;
}
html body[data-design] h2 { font-size: var(--fs-lead); line-height: 1.3; font-weight: 600; letter-spacing: -.01em; color: var(--c-ink); }
html body[data-design] h3 { font-size: var(--fs-body); font-weight: 600; color: var(--c-ink); }
/* Le point coloré après chaque titre disparaît. */
html body[data-design] h1 > .text-color-brand { display: none; }
html body[data-design] .eyebrow,
html body[data-design] .dashboard_component .eyebrow,
html body[data-design] .accounts_eyebrow {
  font-size: var(--fs-caption); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); margin: 0 0 6px;
}
html body[data-design] .text-color-muted,
html body[data-design] .page_heading .text-color-muted,
html body[data-design] .portfolio_heading p:not(.eyebrow),
html body[data-design] .accounting2_heading p:last-child,
html body[data-design] .accounts_heading p:not(.accounts_eyebrow),
html body[data-design] .dashboard_component .page_heading .text-color-muted { color: var(--c-muted); font-size: var(--fs-body); line-height: 1.5; }
html body[data-design] small,
html body[data-design] .helptext { font-size: var(--fs-small); color: var(--c-muted); line-height: 1.45; }
html body[data-design] .text-color-brand,
html body[data-design] .text-link { color: var(--c-brand); }
html body[data-design] .text-link { font-size: var(--fs-body-sm); font-weight: 550; }
html body[data-design] .text-link:hover { color: var(--c-brand-hover); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 3. Menu latéral ---------- */
html body[data-design] .sidebar_component,
html body[data-design] .sidebar_component.is-owner {
  background: var(--c-surface); border-right: 1px solid var(--c-line); backdrop-filter: none; box-shadow: none;
}
html body[data-design] .sidebar_component.is-owner > .brand_component {
  min-height: 72px; padding: 18px 20px; border-bottom: 0; gap: 0; font-size: var(--fs-lead); font-weight: 700; letter-spacing: -.02em; color: var(--c-ink);
}
html body[data-design] .brand_component .text-color-brand { margin-left: .28em; color: var(--c-brand); }
/* Logo officiel « A » : toit + coche dans un carré bleu canard. */
html body[data-design] .brand_mark,
html body[data-design] .sidebar_component.is-owner .brand_mark {
  width: 34px; height: 34px; margin-right: 10px; border-radius: var(--r-md); font-size: 0; box-shadow: none;
  background: #007398 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 34' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 16.5 17 9l9 7.5'/%3E%3Cpath d='M11 15v9.5h12V15'/%3E%3Cpath d='m13.6 19.4 2.4 2.4 4.6-4.6'/%3E%3C/svg%3E") center/100% no-repeat;
}
html body[data-design] .sidebar_component.is-owner .workspace_component {
  margin: 4px 16px 12px; padding: 10px 12px; background: var(--c-bg); border: 0; border-radius: var(--r-md);
}
html body[data-design] .workspace_component strong { font-size: var(--fs-body-sm); color: var(--c-ink); }
html body[data-design] .workspace_component small { font-size: var(--fs-small); color: var(--c-muted); margin-top: 2px; }
html body[data-design] .workspace_avatar,
html body[data-design] .sidebar_component.is-owner .workspace_avatar {
  width: 32px; height: 32px; border: 0; border-radius: var(--r-md); background: var(--c-brand-soft); color: var(--c-brand-deep); font-size: var(--fs-body-sm); font-weight: 650;
}
html body[data-design] .sidebar_component.is-owner .nav_list { padding: 0 12px 12px; }
html body[data-design] .sidebar_component.is-owner .nav_label,
html body[data-design] .nav_label {
  margin: 14px 12px 6px; padding: 0; border: 0; font-size: var(--fs-caption); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted);
}
html body[data-design] .sidebar_component.is-owner .nav_label.is-separated { margin-top: 20px; padding-top: 0; border: 0; }
html body[data-design] .sidebar_component.is-owner .nav_list > .nav_link,
html body[data-design] .sidebar_component .nav_link {
  min-height: var(--h-control); padding: 9px 12px; margin-bottom: 2px; gap: 12px; border-radius: var(--r-md);
  font-size: var(--fs-body); font-weight: 500; color: var(--c-text); box-shadow: none; transition: background-color .15s ease, color .15s ease;
}
html body[data-design] .sidebar_component.is-owner .nav_icon { width: 20px; height: 20px; stroke-width: 1.7; color: var(--c-muted); }
html body[data-design] .sidebar_component .nav_link:hover { background: var(--c-bg); color: var(--c-ink); }
html body[data-design] .sidebar_component.is-owner .nav_link.is-active,
html body[data-design] .sidebar_component .nav_link.is-active {
  background: var(--c-brand-soft); color: var(--c-brand-deep); font-weight: 600; box-shadow: none;
}
html body[data-design] .sidebar_component .nav_link.is-active .nav_icon { color: var(--c-brand); }
html body[data-design] .sidebar_component.is-owner .sidebar_bottom { padding: 12px 16px 0; border-top: 1px solid var(--c-line); }
html body[data-design] .sidebar_component.is-owner .trial_component {
  background: var(--c-brand-softer); border: 0; border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 8px;
}
html body[data-design] .trial_component strong { font-size: var(--fs-body-sm); color: var(--c-ink); }
html body[data-design] .trial_icon { color: var(--c-brand); }
html body[data-design] .sidebar_component.is-owner .trial_component p { font-size: var(--fs-small); color: var(--c-muted); margin: 4px 0 10px; }
html body[data-design] .user_component { border-top-color: transparent; }
html body[data-design] .user_component strong { font-size: var(--fs-body-sm); color: var(--c-ink); }
html body[data-design] .user_avatar { background: var(--c-track); color: var(--c-ink); font-weight: 600; }
html body[data-design] .user_component a { color: var(--c-muted); padding: 8px; border-radius: var(--r-sm); }
html body[data-design] .user_component a:hover { background: var(--c-bg); color: var(--c-ink); }

/* ---------- 4. Barre du haut ---------- */
html body[data-design] .topbar_component {
  height: 64px; padding: 0 40px; position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--c-bg) 88%, transparent); backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent; box-shadow: none; font-size: var(--fs-body-sm);
}
html body[data-design] .topbar_component .text-color-muted { font-size: var(--fs-body-sm); }
html body[data-design] .topbar_component strong { font-weight: 600; color: var(--c-ink); }
html body[data-design] .breadcrumb_separator { color: var(--c-field); }
html body[data-design] .secure_label { font-size: var(--fs-small); color: var(--c-muted); }
html body[data-design] .status_dot { background: var(--c-success); }
html body[data-design] .button.is-icon,
html body[data-design] .topbar_component .button.is-icon {
  width: 38px; min-height: 38px; padding: 0; border-radius: var(--r-md); background: transparent; border-color: transparent; color: var(--c-muted); box-shadow: none;
}
html body[data-design] .button.is-icon:hover { background: var(--c-surface); color: var(--c-ink); }

/* ---------- 5. Contenu ---------- */
html body[data-design] .main_component { max-width: 1320px; padding: 24px 40px 56px; }
html body[data-design] .page_heading,
html body[data-design] .portfolio_heading,
html body[data-design] .dashboard_component .page_heading { margin-bottom: 28px; gap: 20px; align-items: flex-end; }

/* Sélecteur d'entité : une pastille compacte en haut à droite. */
html body[data-design] .entity-filter_component { justify-content: flex-end; margin: 0 0 12px; }
html body[data-design] .entity-filter_form { align-items: center; gap: 6px; padding: 4px; background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--sh); border: 1px solid var(--card-border); }
html body[data-design] .entity-filter_field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html body[data-design] .entity-filter_field select,
html body[data-design] main .entity-filter_field select {
  width: 240px; min-height: 34px; padding: 6px 30px 6px 10px; border: 0; background-color: transparent; font-size: var(--fs-body-sm); font-weight: 550; color: var(--c-ink);
}
html body[data-design] .entity-filter_form .button,
html body[data-design] main .entity-filter_form .button { min-height: var(--h-control-sm); padding: 6px 12px; font-size: var(--fs-small); border-radius: var(--r-md); }

/* Onglets de rubrique */
html body[data-design] .section-tabs_component,
html body[data-design] .accounting2_tabs,
html body[data-design] .accounts_tabs { gap: 28px; border-bottom: 1px solid var(--c-line); margin-bottom: 28px; }
html body[data-design] .section-tabs_link,
html body[data-design] .accounting2_tabs a,
html body[data-design] .accounts_tabs a {
  padding: 10px 0 12px; font-size: var(--fs-body); font-weight: 500; color: var(--c-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
html body[data-design] .section-tabs_link:hover,
html body[data-design] .accounting2_tabs a:hover { color: var(--c-ink); }
html body[data-design] .section-tabs_link[aria-current],
html body[data-design] .accounting2_tabs a[aria-current=page],
html body[data-design] .accounts_tabs a[aria-current] { color: var(--c-ink); font-weight: 600; border-bottom-color: var(--c-brand); }

/* ---------- 6. Boutons ---------- */
html body[data-design] .button,
html body[data-design] main .button {
  min-height: var(--h-control); padding: 9px 16px; gap: 8px; border-radius: var(--r-md);
  background: var(--c-brand); border: 1px solid var(--c-brand); color: #fff;
  font-size: var(--fs-body); font-weight: 550; box-shadow: none; transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
html body[data-design] .button:hover { background: var(--c-brand-hover); border-color: var(--c-brand-hover); color: #fff; }
html body[data-design] .button.is-secondary,
html body[data-design] main .button.is-secondary {
  background: var(--c-surface); border-color: var(--c-line); color: var(--c-ink); box-shadow: 0 1px 2px rgba(18,62,75,.04);
}
html body[data-design] .button.is-secondary:hover { background: var(--c-brand-softer); border-color: var(--c-field); color: var(--c-ink); }
html body[data-design] .button.is-small,
html body[data-design] main .button.is-small { min-height: var(--h-control-sm); padding: 6px 12px; font-size: var(--fs-body-sm); border-radius: var(--r-md); }
html body[data-design] .button.is-danger { background: var(--c-surface); color: var(--c-danger); border-color: var(--c-danger-bg); }
html body[data-design] .button.is-danger:hover { background: var(--c-danger-bg); }
html body[data-design][data-theme=dark] .button:not(.is-secondary):not(.is-icon):not(.is-danger) { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-brand); }
html body[data-design][data-theme=dark] .button:not(.is-secondary):not(.is-icon):not(.is-danger):hover { background: var(--c-brand-hover); border-color: var(--c-brand-hover); color: var(--c-on-brand); }
html body[data-design][data-theme=dark] .button.is-secondary,
html body[data-design][data-theme=dark] .summary_quick,
html body[data-design][data-theme=dark] .summary_task-arrow { background: var(--c-track); border-color: var(--c-line); color: var(--c-text); }

/* ---------- 7. Champs ---------- */
html body[data-design] input:not([type=checkbox]):not([type=radio]):not([type=file]),
html body[data-design] main input:not([type=checkbox]):not([type=radio]):not([type=file]),
html body[data-design] select,
html body[data-design] main select,
html body[data-design] textarea,
html body[data-design] main textarea {
  min-height: var(--h-control); padding: 8px 12px; font-size: var(--fs-body); color: var(--c-ink);
  background-color: var(--c-surface); border: 1px solid var(--c-field); border-radius: var(--r-md);
  transition: border-color .15s ease, box-shadow .15s ease;
}
html body[data-design] input:focus, html body[data-design] select:focus, html body[data-design] textarea:focus {
  outline: none; border-color: var(--c-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-focus) 45%, transparent);
}
html body[data-design] input::placeholder, html body[data-design] textarea::placeholder { color: color-mix(in srgb, var(--c-muted) 80%, transparent); }
html body[data-design] input[type=checkbox], html body[data-design] input[type=radio] { accent-color: var(--c-brand); }
html body[data-design] label, html body[data-design] main label { font-size: var(--fs-body-sm); font-weight: 550; color: var(--c-ink); }
html body[data-design] .portfolio_filters,
html body[data-design] .filter_component {
  background: var(--c-surface); border: 0; border-radius: 0; box-shadow: none; padding: 16px 20px; gap: 12px;
}
html body[data-design] form.filter_component,
html body[data-design] nav.filter_component,
html body[data-design] .page_heading + .filter_component,
html body[data-design] h2 + .filter_component { border-radius: var(--r-lg); box-shadow: var(--sh); border: 1px solid var(--card-border); margin-bottom: 20px; }
html body[data-design] .portfolio_filters { border-bottom: 1px solid var(--c-line); }
html body[data-design] .portfolio_filters label { font-size: var(--fs-small); color: var(--c-muted); font-weight: 500; }
html body[data-design] .portfolio_filters input, html body[data-design] .portfolio_filters select { font-size: var(--fs-body) !important; }
html body[data-design] .portfolio_reset { color: var(--c-muted); font-size: var(--fs-body-sm); text-decoration: none; }
html body[data-design] .portfolio_reset:hover { color: var(--c-ink); text-decoration: underline; }

/* ---------- 8. Cartes ---------- */
html body[data-design] .card_component,
html body[data-design] .portfolio_panel,
html body[data-design] .accounts_panel,
html body[data-design] .accounts_identity,
html body[data-design] .accounting2_panel,
html body[data-design] .accounting2_identity,
html body[data-design] .accounting2_workspace,
html body[data-design] .dashboard_component .card_component,
html body[data-design] .estate_card,
html body[data-design] .loan_card,
html body[data-design] .property_card,
html body[data-design] .tenant_card,
html body[data-design] .wizard_panel {
  background: var(--c-surface); border: 1px solid var(--card-border); border-radius: var(--r-lg); box-shadow: var(--sh); color: var(--c-text);
}
html body[data-design] .summary_chart-card,
html body[data-design] .summary_tasks-card,
html body[data-design] .accounts_panel,
html body[data-design] .accounting2_panel,
html body[data-design] .accounting2_workspace,
html body[data-design] .finance_card,
html body[data-design] .rental_tile,
html body[data-design] .rental_body,
html body[data-design] .settings_panel,
html body[data-design] .form_card { padding: 24px; }
html body[data-design] .card_heading { padding: 22px 24px 8px; }
html body[data-design] .card_heading h2,
html body[data-design] .summary_section-heading h2,
html body[data-design] .dashboard_component .summary_section-heading h2,
html body[data-design] .portfolio_section-heading h2,
html body[data-design] .portfolio_body h2,
html body[data-design] .accounts_panel h2,
html body[data-design] .accounting2_panel h2 { font-size: var(--fs-lead); font-weight: 600; }
html body[data-design] .summary_section-heading p,
html body[data-design] .portfolio_section-heading p,
html body[data-design] .card_heading p { font-size: var(--fs-body-sm); color: var(--c-muted); }

/* Indicateurs (KPI) : toutes les rubriques partagent le même dessin. */
html body[data-design] .metrics_grid,
html body[data-design] .dashboard_component .metrics_grid,
html body[data-design] .portfolio_metrics,
html body[data-design] .accounts_metrics,
html body[data-design] .accounting2_metrics { gap: 16px; margin: 0 0 24px; }
html body[data-design] .metric_component,
html body[data-design] .dashboard_component .metric_component,
html body[data-design] .portfolio_metric,
html body[data-design] .accounts_metrics article,
html body[data-design] .accounting2_metrics article {
  min-height: 0; padding: 20px 22px; background: var(--c-surface); border: 1px solid var(--card-border); border-radius: var(--r-lg); box-shadow: var(--sh);
}
html body[data-design] .metric_label,
html body[data-design] .dashboard_component .metric_label,
html body[data-design] .portfolio_metric p,
html body[data-design] .accounts_metrics span,
html body[data-design] .accounting2_metrics span { font-size: var(--fs-body-sm); font-weight: 500; color: var(--c-muted); margin: 0 0 10px; }
html body[data-design] .metric_value,
html body[data-design] .dashboard_component .metric_value,
html body[data-design] .portfolio_metric strong,
html body[data-design] .accounts_metrics strong,
html body[data-design] .accounting2_metrics strong {
  display: block; margin: 0 0 6px; font-size: var(--fs-h1); line-height: 1.1; font-weight: 650; letter-spacing: -.02em; color: var(--c-ink); font-variant-numeric: tabular-nums;
}
html body[data-design] .metric_caption,
html body[data-design] .dashboard_component .metric_caption,
html body[data-design] .portfolio_metric span,
html body[data-design] .accounts_metrics small,
html body[data-design] .accounting2_metrics small { font-size: var(--fs-small); color: var(--c-muted); line-height: 1.45; margin: 0; }
html body[data-design] .metric_icon,
html body[data-design] .dashboard_component .metric_icon { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--c-brand-soft); color: var(--c-brand-bright); }
html body[data-design] .summary_success { color: var(--c-success); }
html body[data-design] .summary_alert { color: var(--c-danger); }

/* Tableau de bord */
html body[data-design] .dashboard_component .dashboard_grid { gap: 16px; }
html body[data-design] .summary_legend { font-size: var(--fs-small); color: var(--c-muted); }
html body[data-design] .summary_legend i { background: var(--c-brand-bright); }
html body[data-design] .summary_legend .is-muted { background: color-mix(in srgb, var(--c-brand-bright) 25%, var(--c-surface)); }
html body[data-design] .summary_bar { fill: var(--c-brand-bright); }
html body[data-design] .summary_bar.is-muted { fill: color-mix(in srgb, var(--c-brand-bright) 25%, var(--c-surface)); }
html body[data-design] .summary_chart-empty { background: var(--c-bg); color: var(--c-muted); border-radius: var(--r-md); font-size: var(--fs-body-sm); padding: 16px; }
html body[data-design] .summary_chart-caption { font-size: var(--fs-small); color: var(--c-muted); }
html body[data-design] .summary_quick-actions { border-top-color: var(--c-line); }
html body[data-design] .summary_quick {
  min-height: var(--h-control); padding: 9px 14px; font-size: var(--fs-body-sm); font-weight: 550; color: var(--c-ink);
  background: var(--c-bg); border: 1px solid transparent; border-radius: var(--r-md);
}
html body[data-design] .summary_quick .summary_icon { color: var(--c-brand); }
html body[data-design] .summary_quick:hover { background: var(--c-brand-soft); border-color: transparent; color: var(--c-brand-deep); }
html body[data-design] .summary_task { border-bottom-color: var(--c-line); padding: 14px 0; }
html body[data-design] .summary_task-copy strong { font-size: var(--fs-body); color: var(--c-ink); }
html body[data-design] .summary_task-copy p { font-size: var(--fs-body-sm); color: var(--c-muted); }
html body[data-design] .summary_task-icon,
html body[data-design] .summary_task-icon.is-blue { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--c-brand-soft); color: var(--c-brand); }
html body[data-design] .summary_task-icon.is-alert { background: var(--c-danger-bg); color: var(--c-danger); }
html body[data-design] .summary_task-arrow { background: var(--c-bg); color: var(--c-muted); border-radius: var(--r-md); }
html body[data-design] .summary_task-arrow:hover { background: var(--c-brand-soft); color: var(--c-brand); }

/* ---------- 9. Listes et tableaux ---------- */
html body[data-design] .portfolio_toolbar { padding: 14px 20px; border-bottom-color: var(--c-line); }
html body[data-design] .portfolio_tabs { background: var(--c-track); padding: 3px; border-radius: var(--r-md); gap: 2px; }
html body[data-design] .portfolio_tabs a { font-size: var(--fs-body-sm); padding: 6px 14px; border-radius: var(--r-sm); color: var(--c-muted); font-weight: 500; }
html body[data-design] .portfolio_tabs a[aria-current] { background: var(--c-surface); color: var(--c-ink); font-weight: 600; box-shadow: 0 1px 3px rgba(18,62,75,.12); }
html body[data-design][data-theme=dark] .portfolio_tabs a[aria-current] { background: var(--c-line); color: var(--c-ink); }
html body[data-design] .portfolio_count { font-size: var(--fs-body-sm); color: var(--c-muted); }
html body[data-design] table th,
html body[data-design] .portfolio_table th,
html body[data-design] .table_component th,
html body[data-design] .accounting2_table-wrap th {
  font-size: var(--fs-caption); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--c-muted); background: transparent;
}
html body[data-design] .table_component thead,
html body[data-design] .portfolio_table thead,
html body[data-design][data-theme=dark] thead th { background: var(--c-bg); }
html body[data-design] .portfolio_table th,
html body[data-design] .table_component th { padding: 12px 20px; }
html body[data-design] .portfolio_table td,
html body[data-design] .table_component td,
html body[data-design] .accounting2_table-wrap td {
  padding: 16px 20px; border-top: 1px solid var(--c-line); font-size: var(--fs-body); color: var(--c-text);
}
html body[data-design] .portfolio_table tbody tr:hover,
html body[data-design] .table_component tbody tr:hover,
html body[data-design][data-theme=dark] .portfolio_table tbody tr:hover td { background: var(--c-brand-softer); }
html body[data-design] .portfolio_name,
html body[data-design] .table_component td > strong:first-child,
html body[data-design] .portfolio_table td > strong:first-child { font-size: var(--fs-body); font-weight: 600; color: var(--c-ink); }
html body[data-design] .portfolio_table td small,
html body[data-design] .table_component td small,
html body[data-design] .portfolio_subtitle { font-size: var(--fs-small); color: var(--c-muted); }
html body[data-design] .portfolio_table td small a { color: var(--c-brand); }
html body[data-design] .portfolio_avatar { background: var(--c-brand-soft); color: var(--c-brand-deep); }
html body[data-design] .portfolio_avatar.is-property { background: var(--c-bg); color: var(--c-brand); border-radius: var(--r-md); }
html body[data-design] .portfolio_link { color: var(--c-brand); font-size: var(--fs-body-sm); }
html body[data-design] .portfolio_menu-trigger {
  width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: var(--r-md); background: transparent; color: var(--c-muted); letter-spacing: 1px;
}
html body[data-design] .portfolio_menu-trigger:hover { background: var(--c-bg); color: var(--c-ink); }
html body[data-design] .portfolio_menu,
html body[data-design][data-theme=dark] .portfolio_menu { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-md); box-shadow: var(--sh-pop); padding: 6px 14px; }
html body[data-design] .portfolio_menu a, html body[data-design] .portfolio_menu button { font-size: var(--fs-body-sm); color: var(--c-ink); }
html body[data-design] .portfolio_menu .portfolio_delete summary { color: var(--c-danger); font-size: var(--fs-body-sm); }

/* Statuts et badges */
html body[data-design] .portfolio_status,
html body[data-design] .badge,
html body[data-design] .edld_status,
html body[data-design] .accounts_status,
html body[data-design] .accounting2_badge {
  padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--fs-small); font-weight: 550; background: var(--c-track); color: var(--c-muted); border: 0;
}
html body[data-design] .portfolio_status.is-current,
html body[data-design] .badge.is-green,
html body[data-design] .accounting2_badge.is-closed { background: var(--c-success-bg); color: var(--c-success); }
html body[data-design] .portfolio_status.is-upcoming,
html body[data-design] .badge.is-orange,
html body[data-design] .accounting2_badge { background: var(--c-warning-bg); color: var(--c-warning); }
html body[data-design] .badge.is-purple,
html body[data-design] .accounts_status { background: var(--c-brand-soft); color: var(--c-brand-deep); }
html body[data-design] .badge.is-neutral { background: var(--c-track); color: var(--c-muted); }

/* Messages */
html body[data-design] .message_component,
html body[data-design] .accounting2_notice,
html body[data-design] .accounting2_regime-note,
html body[data-design] .partner-callout_component,
html body[data-design] .loan_notice {
  background: var(--c-brand-softer); border: 0; border-left: 3px solid var(--c-brand-bright); border-radius: var(--r-md);
  padding: 14px 18px; font-size: var(--fs-body-sm); line-height: 1.55; color: var(--c-text);
}
html body[data-design] .message_component.warning,
html body[data-design] .loan_warning { background: var(--c-warning-bg); border-left-color: var(--c-warning); color: var(--c-text); }
html body[data-design] .message_component.error { background: var(--c-danger-bg); border-left-color: var(--c-danger); color: var(--c-text); }
html body[data-design] .message_component.success { background: var(--c-success-bg); border-left-color: var(--c-success); color: var(--c-text); }
html body[data-design] .accounting2_regime-note p { color: var(--c-muted); }

/* Comptabilité : liens d'action en tuiles */
html body[data-design] .accounting2_actions a,
html body[data-design] .accounts_actions a {
  background: var(--c-bg); border: 1px solid transparent; border-radius: var(--r-md); padding: 16px 18px; color: var(--c-ink);
}
html body[data-design] .accounting2_actions a:hover,
html body[data-design] .accounts_actions a:hover { background: var(--c-brand-soft); border-color: transparent; color: var(--c-brand-deep); }
html body[data-design] .accounting2_actions a small { color: var(--c-muted); font-size: var(--fs-body-sm); }
html body[data-design] .accounting2_identity select,
html body[data-design] .accounting2_scope-form select,
html body[data-design] .accounting2_panel-head select { background: var(--c-surface); border-color: var(--c-field); }
html body[data-design] .accounting2_table-wrap a,
html body[data-design] .accounting2_panel a { color: var(--c-brand); }

/* Fiches détaillées, définitions */
html body[data-design] .portfolio_definition dt,
html body[data-design] .definition_grid dt,
html body[data-design] .rental_metadata dt { font-size: var(--fs-small); color: var(--c-muted); }
html body[data-design] .portfolio_definition dd,
html body[data-design] .definition_grid dd { font-size: var(--fs-body); color: var(--c-ink); }
html body[data-design] .definition_grid { background: var(--c-bg); border-radius: var(--r-md); }
html body[data-design] .portfolio_definition > div { border-bottom-color: var(--c-line); }
html body[data-design] .portfolio_back { font-size: var(--fs-body-sm); color: var(--c-muted); }
html body[data-design] .portfolio_back:hover { color: var(--c-brand); }
html body[data-design] .portfolio_anchors a { color: var(--c-muted); font-size: var(--fs-body-sm); }
html body[data-design] .portfolio_anchors a:hover { color: var(--c-brand); }
html body[data-design] .portfolio_prose { color: var(--c-text); font-size: var(--fs-body); line-height: 1.7; }

/* Formulaires en rubriques */
html body[data-design] .portfolio_form-nav a { font-size: var(--fs-body-sm); color: var(--c-muted); border-radius: var(--r-md); }
html body[data-design] .portfolio_form-nav a:hover { background: var(--c-surface); color: var(--c-ink); }
html body[data-design] .portfolio_form-section { padding: 24px; border-color: var(--card-border); }
html body[data-design] .portfolio_form-section legend { font-size: var(--fs-lead); font-weight: 600; color: var(--c-ink); }
html body[data-design] .portfolio_form-section > p { font-size: var(--fs-body-sm); color: var(--c-muted); }
html body[data-design] .portfolio_field > label { font-size: var(--fs-body-sm); }
html body[data-design] .loan_mode { background: var(--c-track); border-radius: var(--r-md); }
html body[data-design] .loan_mode-option { font-size: var(--fs-body-sm); color: var(--c-muted); }
html body[data-design] .loan_mode-option:has(input:checked) { background: var(--c-surface); color: var(--c-ink); }
html body[data-design] .loan_ai, html body[data-design] .loan_stat { background: var(--c-bg); }
html body[data-design] .loan_dropzone { border-color: var(--c-field); }
html body[data-design] .sci-wizard_steps li { background: var(--c-track); color: var(--c-muted); border-radius: var(--r-pill); font-size: var(--fs-body-sm); }
html body[data-design] .sci-wizard_steps [aria-current] { background: var(--c-brand); color: #fff; }
html body[data-design] .wizard_steps li { border-radius: var(--r-pill); }

/* Tuiles de la gestion locative */
html body[data-design] .rental_grid { gap: 16px; }
html body[data-design] .rental_tile h2 { font-size: var(--fs-input); }
html body[data-design] .rental_tile h2 a { color: var(--c-ink); }
html body[data-design] .rental_tile h2 a:hover { color: var(--c-brand); }
html body[data-design] .rental_tile p { color: var(--c-muted); font-size: var(--fs-body-sm); }
html body[data-design] .rental_metadata dd { font-size: var(--fs-body-sm); color: var(--c-ink); }
html body[data-design] a.rental_tile:hover { box-shadow: var(--sh-pop); }

/* États vides, pagination, pied de page */
html body[data-design] .empty_component { color: var(--c-muted); }
html body[data-design] .empty_component h2 { color: var(--c-ink); }
html body[data-design] .empty_icon { color: var(--c-brand-bright); }
html body[data-design] .pagination_component { font-size: var(--fs-body-sm); color: var(--c-muted); }
html body[data-design] .pagination_component a { color: var(--c-brand); font-weight: 550; }
html body[data-design] .footer_component { border-top-color: var(--c-line); color: var(--c-muted); font-size: var(--fs-small); padding: 20px 40px; background: transparent; }

/* ---------- 10. Mode sombre : surfaces restantes ---------- */
@media screen {
  html body[data-design][data-theme=dark] .sidebar_component,
  html body[data-design][data-theme=dark] .sidebar_component.is-owner { background: var(--c-surface); border-color: var(--c-line); }
  html body[data-design][data-theme=dark] .topbar_component { background: color-mix(in srgb, var(--c-bg) 88%, transparent); }
  html body[data-design][data-theme=dark] .nav_link,
  html body[data-design][data-theme=dark] .sidebar_component.is-owner .nav_link { color: var(--c-text); }
  html body[data-design][data-theme=dark] .nav_link.is-active,
  html body[data-design][data-theme=dark] .sidebar_component.is-owner .nav_link.is-active { background: var(--c-brand-soft); color: var(--c-brand-deep); }
  html body[data-design][data-theme=dark] .metric_icon,
  html body[data-design][data-theme=dark] .workspace_avatar,
  html body[data-design][data-theme=dark] .sidebar_component.is-owner .workspace_avatar,
  html body[data-design][data-theme=dark] .summary_task-icon.is-blue { background: var(--c-brand-soft); color: var(--c-brand); }
  html body[data-design][data-theme=dark] .workspace_component,
  html body[data-design][data-theme=dark] .sidebar_component.is-owner .workspace_component,
  html body[data-design][data-theme=dark] .summary_quick,
  html body[data-design][data-theme=dark] .summary_chart-empty,
  html body[data-design][data-theme=dark] .accounting2_actions a,
  html body[data-design][data-theme=dark] .definition_grid { background: var(--c-track); border-color: transparent; }
  html body[data-design][data-theme=dark] .sidebar_component.is-owner .trial_component,
  html body[data-design][data-theme=dark] .message_component,
  html body[data-design][data-theme=dark] .accounting2_notice,
  html body[data-design][data-theme=dark] .accounting2_regime-note { background: var(--c-brand-softer); color: var(--c-text); }
  html body[data-design][data-theme=dark] .message_component.warning { background: var(--c-warning-bg); }
  html body[data-design][data-theme=dark] .filter_component,
  html body[data-design][data-theme=dark] .portfolio_filters,
  html body[data-design][data-theme=dark] .portfolio_toolbar,
  html body[data-design][data-theme=dark] .portfolio_tabs { border-color: var(--c-line); }
  html body[data-design][data-theme=dark] .portfolio_filters,
  html body[data-design][data-theme=dark] .filter_component { background: var(--c-surface); }
  html body[data-design][data-theme=dark] .portfolio_tabs { background: var(--c-track); }
  html body[data-design][data-theme=dark] input:not([type=checkbox]):not([type=radio]):not([type=file]),
  html body[data-design][data-theme=dark] select,
  html body[data-design][data-theme=dark] textarea,
  html body[data-design][data-theme=dark] .entity-filter_field select { background-color: var(--c-bg); border-color: var(--c-field); color: var(--c-ink); }
  html body[data-design][data-theme=dark] .entity-filter_field select { background-color: transparent; }
  html body[data-design][data-theme=dark] .badge.is-purple,
  html body[data-design][data-theme=dark] .accounts_status { background: var(--c-brand-soft); color: var(--c-brand-deep); }
  html body[data-design][data-theme=dark] .badge.is-neutral,
  html body[data-design][data-theme=dark] .portfolio_status { background: var(--c-track); color: var(--c-muted); }
  html body[data-design][data-theme=dark] .summary_bar,
  html body[data-design][data-theme=dark] .summary_legend i { fill: var(--c-brand); background: var(--c-brand); }
}

/* ---------- 11. Tailles d'écran ---------- */
@media (max-width: 1150px) {
  html body[data-design] .main_component { padding: 20px 24px 48px; }
  html body[data-design] .topbar_component { padding: 0 24px; }
}
@media (max-width: 900px) {
  html body[data-design] .sidebar_component.is-owner { box-shadow: var(--sh-pop); }
  html body[data-design] .topbar_component { height: 56px; }
}
@media (max-width: 650px) {
  html body[data-design] .main_component { padding: 12px 16px 40px; }
  html body[data-design] .topbar_component { padding: 0 12px; }
  html body[data-design] h1,
  html body[data-design] main h1,
  html body[data-design] .portfolio_heading h1,
  html body[data-design] .accounting2_heading h1,
  html body[data-design] .accounts_heading h1,
  html body[data-design] .dashboard_component h1 { font-size: var(--fs-h2); }
  html body[data-design] .page_heading,
  html body[data-design] .portfolio_heading,
  html body[data-design] .dashboard_component .page_heading { align-items: stretch; }
  html body[data-design] .entity-filter_component { justify-content: stretch; }
  html body[data-design] .entity-filter_form { width: 100%; }
  html body[data-design] .entity-filter_field { flex: 1; }
  html body[data-design] .entity-filter_field select,
  html body[data-design] main .entity-filter_field select { width: 100%; font-size: var(--fs-input); }
  html body[data-design] main input:not([type=checkbox]):not([type=radio]):not([type=file]),
  html body[data-design] main select,
  html body[data-design] main textarea { font-size: var(--fs-input); }
  html body[data-design] .metrics_grid,
  html body[data-design] .dashboard_component .metrics_grid { gap: 10px; }
  html body[data-design] .metric_component,
  html body[data-design] .dashboard_component .metric_component,
  html body[data-design] .portfolio_metric { padding: 14px 16px; }
  html body[data-design] .dashboard_component .metric_label { flex-direction: row-reverse; justify-content: flex-end; flex-wrap: nowrap; }
  html body[data-design] .dashboard_component .metric_icon { width: 28px; height: 28px; }
  html body[data-design] .metric_value,
  html body[data-design] .dashboard_component .metric_value,
  html body[data-design] .portfolio_metric strong { font-size: var(--fs-h2); }
  html body[data-design] .metric_caption strong { margin-right: 4px; }
  html body[data-design] .section-tabs_component { gap: 20px; }
  html body[data-design] .footer_component { padding: 16px; }
}

/* ---------- 12. Ajustements après rendu ---------- */
html body[data-design][data-theme=dark] .brand_component .text-color-brand { color: var(--c-brand); }
html body[data-design][data-theme=dark] .summary_legend .is-muted { background: color-mix(in srgb, var(--c-brand) 30%, var(--c-surface)); }
html body[data-design][data-theme=dark] .summary_bar.is-muted { fill: color-mix(in srgb, var(--c-brand) 30%, var(--c-surface)); }
/* Indicateurs posés dans une carte : à plat, sans carte dans la carte. */
html body[data-design] .accounting2_workspace .accounting2_metrics article,
html body[data-design] .accounting2_panel .accounting2_metrics article,
html body[data-design] .card_component .metric_component {
  display: block; background: var(--c-bg); box-shadow: none; border-color: transparent; border-radius: var(--r-md);
}
html body[data-design][data-theme=dark] .accounting2_workspace .accounting2_metrics article { background: var(--c-track); }
@media (max-width: 650px) {
  html body[data-design] .dashboard_component .metric_icon { display: none; }
  html body[data-design] .dashboard_component .metric_label { margin-bottom: 6px; }
  html body[data-design] .metric_caption,
  html body[data-design] .dashboard_component .metric_caption { display: block; }
}

html body[data-design] .accounts_metrics span,
html body[data-design] .accounting2_metrics span { display: block; }
html body[data-design] .metric_value,
html body[data-design] .portfolio_metric strong,
html body[data-design] .accounting2_metrics strong { white-space: nowrap; }
@media (max-width: 650px) {
  html body[data-design] .portfolio_metrics,
  html body[data-design] .accounting2_metrics,
  html body[data-design] .accounts_metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  html body[data-design] .accounting2_metrics strong, html body[data-design] .portfolio_metric strong { font-size: var(--fs-h3); }
  html body[data-design] .portfolio_metric:last-child:nth-child(odd),
  html body[data-design] .accounting2_metrics article:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

html body[data-design] .accounting2_tabs a[aria-current=page] { border-color: transparent; border-bottom-color: var(--c-brand); }

@media (prefers-reduced-motion: reduce) {
  html body[data-design] * { transition: none !important; }
}

html body[data-design] .sidebar_component.is-owner > .brand_component { padding-inline: 8px; }
