/* v121-v129 — finition, Transactions, rapports, diagnostic, sécurité et thèmes. */

/* --- Navigation : Accueil | Transactions | Options | Profil ---------------- */
.ca-bottom-nav { grid-template-columns: repeat(4,minmax(0,1fr)) !important; }
html.is-ios .ca-bottom-nav { grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
html.is-ios .ca-bottom-nav > :nth-child(1){grid-column:1!important}
html.is-ios .ca-bottom-nav > :nth-child(2){grid-column:2!important}
html.is-ios .ca-bottom-nav > :nth-child(3){grid-column:3!important}
html.is-ios .ca-bottom-nav > :nth-child(4){grid-column:4!important}
body[data-active-nav="transactions"] .ca-bottom-link[data-ca-target="transactions"] { color:var(--ca-accent)!important;font-weight:750!important; }
body[data-active-nav="transactions"] .ca-bottom-link[data-ca-target="transactions"] .ca-bottom-icon { transform:translateY(-1px);stroke-width:2.25!important; }
html[data-ui-theme="win98"] body[data-active-nav="transactions"] .ca-bottom-link[data-ca-target="transactions"] { color:#000080!important; }

/* --- Transactions ---------------------------------------------------------- */
.transactions-hub { display:grid;gap:14px;margin:8px 0 14px; }
.transactions-hub[hidden]{display:none!important}
.transactions-hero { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px; }
.transactions-hero > div { min-width:0;padding:13px 12px;border:1px solid var(--ui-border,var(--line));border-radius:14px;background:var(--ui-surface,var(--paper)); }
.transactions-hero span { display:block;color:var(--ui-muted,var(--muted));font-size:10.5px;line-height:1.2;margin-bottom:5px; }
.transactions-hero strong { display:block;min-width:0;font-size:16px;line-height:1.1;letter-spacing:-.025em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.transactions-segmented { display:grid;grid-template-columns:repeat(3,1fr);padding:3px;border-radius:12px;background:rgba(110,120,130,.10); }
.transactions-segmented button { min-height:38px;border:0;border-radius:9px;background:transparent;color:var(--ui-muted,var(--muted));font:inherit;font-size:12px;font-weight:700; }
.transactions-segmented button.active { background:var(--ui-surface-solid,var(--paper));color:var(--ink,var(--text));box-shadow:0 1px 4px rgba(28,42,57,.08); }
.transactions-section-title,.transaction-panel-head { display:flex;align-items:flex-end;justify-content:space-between;gap:14px;padding:0 3px; }
.transactions-section-title > div,.transaction-panel-head > div { min-width:0;display:grid;gap:3px; }
.transactions-section-title strong,.transaction-panel-head .section-title { font-size:15px!important;line-height:1.2;font-weight:770!important;color:var(--ink,var(--text));text-transform:none!important;letter-spacing:-.01em!important; }
.transactions-section-title small,.transaction-panel-head .section-subtitle,.section-head .section-subtitle { color:var(--ui-muted,var(--muted));font-size:11px;line-height:1.32; }
.transactions-section-title button { border:0;background:none;color:var(--ca-accent);font:inherit;font-size:12px;font-weight:720;padding:6px 0; }
.transactions-recurring-overview,.transactions-detected { display:grid;gap:7px;padding-top:3px; }
.transactions-flat-list { border-top:1px solid var(--ui-border,var(--line)); }
.transactions-flat-row,.transactions-detected-row { display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:52px;padding:9px 3px;border-bottom:1px solid var(--ui-border,var(--line)); }
.transactions-flat-row > span,.transactions-detected-row > span:first-child { min-width:0;display:grid;gap:2px; }
.transactions-flat-row strong,.transactions-detected-row strong { font-size:13px;font-weight:720; }
.transactions-flat-row small,.transactions-detected-row small { font-size:10.5px;color:var(--ui-muted,var(--muted));line-height:1.3; }
.transactions-flat-row b { white-space:nowrap;font-size:13px; }
.transactions-empty { padding:15px 3px;color:var(--ui-muted,var(--muted));font-size:12px; }
.transactions-detected-actions { display:flex!important;gap:6px;flex:0 0 auto; }
.transactions-detected-actions button { min-height:34px;padding:0 9px;border:0;border-radius:9px;background:rgba(var(--accent-user-rgb),.08);color:var(--ca-accent);font:inherit;font-size:10.5px;font-weight:720; }
.transactions-detected-actions .dismiss { background:transparent;color:var(--ui-muted,var(--muted)); }
#fixed-section,#variable-section { margin-top:12px; }
#fixed-section .transaction-panel-head { margin:0 0 8px; }
#fixed-section .fixed-add-category-wide { margin-top:8px; }
body.transactions-mode .expense-tabs { margin-top:4px; }
body.transactions-mode .expense-tabs.mode-overview { display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px; }
body.transactions-mode .expense-tabs.mode-overview .expense-tab { display:grid!important;min-width:0; }

/* --- Rapports -------------------------------------------------------------- */
.v129-action-list { display:grid;border-top:1px solid var(--ui-border,var(--line)); }
.v129-action-list button { width:100%;min-height:58px;padding:10px 2px;border:0;border-bottom:1px solid var(--ui-border,var(--line));background:none;color:inherit;text-align:left;display:grid;gap:2px;font:inherit; }
.v129-action-list button span { font-size:13px;font-weight:720; }
.v129-action-list button small { color:var(--ui-muted,var(--muted));font-size:10.5px;line-height:1.3; }

/* --- Intelligence commerçants -------------------------------------------- */
.merchant-suggestion { grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:-3px;padding:8px 10px;border-radius:10px;background:rgba(var(--accent-user-rgb),.075);color:var(--ink,var(--text));font-size:11px; }
.merchant-suggestion[hidden]{display:none!important}
.merchant-suggestion button { border:0;background:none;color:var(--ca-accent);font:inherit;font-size:11px;font-weight:750;padding:3px; }

/* --- Diagnostic / sécurité ------------------------------------------------ */
.v129-diagnostic-card,.v129-security-card { padding:2px 14px!important; }
.v129-diagnostic-grid { display:grid; }
.v129-diagnostic-row { min-height:42px;display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--ui-border,var(--line));font-size:12px; }
.v129-diagnostic-row:last-child{border-bottom:0}
.v129-diagnostic-row span { color:var(--ui-muted,var(--muted)); }
.v129-diagnostic-row strong { text-align:right;font-size:11px;font-weight:720; }
.v129-diagnostic-card .profile-inline-actions { margin:10px 0 12px; }
.v129-security-message { min-height:14px;margin:6px 3px 0;font-size:11px;color:var(--ui-muted,var(--muted)); }
.v129-security-message[data-state="success"]{color:var(--ca-accent)}
.v129-security-message[data-state="error"]{color:#B04A43}
.v129-device-block { margin:8px 0 0;padding:0 3px; }
.v129-device-title { margin:0 0 4px;color:var(--ui-muted,var(--muted));font-size:10px;font-weight:750;text-transform:uppercase;letter-spacing:.05em; }
.v129-device-list { border-top:1px solid var(--ui-border,var(--line)); }
.v129-device-row { min-height:46px;display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--ui-border,var(--line)); }
.v129-device-row span { display:grid;gap:1px; }
.v129-device-row strong { font-size:12px; }
.v129-device-row small,.v129-device-empty { color:var(--ui-muted,var(--muted));font-size:10.5px; }
.v129-device-row b { color:var(--ca-accent);font-size:10px; }
.v129-device-empty { padding:11px 0; }
body.privacy-hidden::after { content:"Budget masqué";position:fixed;inset:0;z-index:999999;display:grid;place-items:center;background:var(--paper,#fff);color:var(--ui-muted,#777);font:700 14px -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }

/* --- Personnalisation ++ -------------------------------------------------- */
.preference-home-order-block { margin-top:12px; }
.preference-order-list { border-top:1px solid var(--ui-border,var(--line)); }
.preference-order-row { min-height:42px;display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--ui-border,var(--line));font-size:12px; }
.preference-order-actions { display:flex;gap:3px; }
.preference-order-actions button { width:32px;height:32px;border:0;background:none;color:var(--ca-accent);font:inherit;font-weight:800; }
.preference-order-actions button:disabled { opacity:.25; }
html[data-density="compact"] { --ui-row-height:46px;--ui-control-height:38px; }
html[data-density="compact"] .settings-row { min-height:46px!important; }
html[data-density="compact"] .variable-category,html[data-density="compact"] .income-block,html[data-density="compact"] .v110-home-tile { padding-top:9px!important;padding-bottom:9px!important; }
html[data-radius="round"] { --ui-radius-card:20px;--ui-radius-control:14px;--ui-radius-sheet:28px; }
html[data-radius="square"] { --ui-radius-card:4px;--ui-radius-control:4px;--ui-radius-sheet:8px; }
html[data-radius="round"] .income-block,html[data-radius="round"] .variable-category,html[data-radius="round"] .v110-home-main,html[data-radius="round"] .v110-home-tile,html[data-radius="round"] .profile-settings-list { border-radius:20px!important; }
html[data-radius="square"] .income-block,html[data-radius="square"] .variable-category,html[data-radius="square"] .v110-home-main,html[data-radius="square"] .v110-home-tile,html[data-radius="square"] .profile-settings-list { border-radius:4px!important; }
html[data-amount-size="large"] .v110-home-amount,html[data-amount-size="large"] .month-balance-amount,html[data-amount-size="large"] .month-balance-state { font-size:1.18em!important; }

/* --- Thèmes prédéfinis, sans thème personnalisé --------------------------- */
html[data-ui-theme="ios-classic"] { --accent-user:#007AFF;--accent-user-rgb:0,122,255;--ca-accent:#007AFF!important;--bg:#EFEFF4;--paper:#FFF;--soft:#F2F2F7;--line:#C6C6C8; }
html[data-ui-theme="ios-classic"],html[data-ui-theme="ios-classic"] body { background:#EFEFF4!important; }
html[data-ui-theme="ios-classic"] .income-block,html[data-ui-theme="ios-classic"] .variable-category,html[data-ui-theme="ios-classic"] .v110-home-main,html[data-ui-theme="ios-classic"] .v110-home-tile,html[data-ui-theme="ios-classic"] .profile-settings-list { background:#FFF!important;border-color:rgba(60,60,67,.16)!important;box-shadow:none!important; }
html[data-ui-theme="ios-classic"] .ca-bottom-nav { background:rgba(248,248,248,.96)!important;border-top-color:#C6C6C8!important; }

html[data-ui-theme="aqua"] { --accent-user:#1676D2;--accent-user-rgb:22,118,210;--ca-accent:#1676D2!important;--bg:#EAF4FB;--paper:#F8FCFF;--soft:#E3F0F8;--line:#AFC8D8; }
html[data-ui-theme="aqua"] body { background:linear-gradient(180deg,#D8ECF8 0,#F4FAFD 44%,#DDEAF3 100%) fixed!important; }
html[data-ui-theme="aqua"] .income-block,html[data-ui-theme="aqua"] .variable-category,html[data-ui-theme="aqua"] .v110-home-main,html[data-ui-theme="aqua"] .v110-home-tile,html[data-ui-theme="aqua"] .profile-settings-list { background:linear-gradient(180deg,rgba(255,255,255,.94),rgba(231,244,252,.9))!important;border-color:rgba(70,126,160,.23)!important;box-shadow:0 1px 0 rgba(255,255,255,.85) inset!important; }
html[data-ui-theme="aqua"] .ca-bottom-nav { background:rgba(235,246,252,.94)!important;border-top-color:rgba(70,126,160,.22)!important; }

html[data-ui-theme="mono"] { --accent-user:#2B2B2B;--accent-user-rgb:43,43,43;--ca-accent:#2B2B2B!important;filter:grayscale(1); }
html[data-ui-theme="mono"][data-theme="dark"] { --accent-user:#F2F2F2;--accent-user-rgb:242,242,242;--ca-accent:#F2F2F2!important; }

html[data-ui-theme="paper"] { --accent-user:#65513D;--accent-user-rgb:101,81,61;--ca-accent:#65513D!important;--bg:#EAE2D3;--paper:#F7F0E4;--soft:#EFE5D5;--line:#D2C2AC;--text:#352F29;--ink:#352F29;--muted:#796E62; }
html[data-ui-theme="paper"],html[data-ui-theme="paper"] body,html[data-ui-theme="paper"] .page { background:#EAE2D3!important;color:#352F29!important; }
html[data-ui-theme="paper"] .income-block,html[data-ui-theme="paper"] .variable-category,html[data-ui-theme="paper"] .v110-home-main,html[data-ui-theme="paper"] .v110-home-tile,html[data-ui-theme="paper"] .profile-settings-list,html[data-ui-theme="paper"] .sheet { background:#F7F0E4!important;border-color:#D2C2AC!important;color:#352F29!important; }
html[data-ui-theme="paper"] .ca-bottom-nav { background:rgba(247,240,228,.95)!important;border-top-color:#D2C2AC!important; }

html[data-ui-theme="oled"] { --accent-user:#55D9B5;--accent-user-rgb:85,217,181;--ca-accent:#55D9B5!important;--bg:#000;--paper:#000;--soft:#080808;--line:#1A1A1A;--text:#F5F5F5;--ink:#F5F5F5;--muted:#9A9A9A;--ui-surface:#050505;--ui-surface-solid:#050505;--ui-border:#1A1A1A;color-scheme:dark; }
html[data-ui-theme="oled"],html[data-ui-theme="oled"] body,html[data-ui-theme="oled"] .page { background:#000!important;color:#F5F5F5!important; }
html[data-ui-theme="oled"] .income-block,html[data-ui-theme="oled"] .variable-category,html[data-ui-theme="oled"] .v110-home-main,html[data-ui-theme="oled"] .v110-home-tile,html[data-ui-theme="oled"] .profile-settings-list,html[data-ui-theme="oled"] .sheet,html[data-ui-theme="oled"] input,html[data-ui-theme="oled"] select { background:#050505!important;border-color:#1A1A1A!important;color:#F5F5F5!important;box-shadow:none!important; }
html[data-ui-theme="oled"] .ca-bottom-nav { background:rgba(0,0,0,.96)!important;border-top-color:#1A1A1A!important; }

/* Windows 98 reste compatible avec la navigation à 4 onglets. */
html[data-ui-theme="win98"] .transactions-segmented { border:2px solid;border-color:#808080 #fff #fff #808080;border-radius:0;background:#c0c0c0; }
html[data-ui-theme="win98"] .transactions-segmented button { border-radius:0;color:#000; }
html[data-ui-theme="win98"] .transactions-segmented button.active { background:#c0c0c0;border:2px solid;border-color:#fff #000 #000 #fff;box-shadow:none; }

/* --- v121 accessibilité ---------------------------------------------------- */
@media (hover:none) and (pointer:coarse){
  .a11y-target:not(input):not(select):not(textarea){min-height:44px;}
  .transactions-detected-actions button{min-height:38px;}
}
@supports (font:-apple-system-body){ body{font:-apple-system-body;} h1,.v110-home-amount,.income-summary-amount{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",sans-serif;} }
:focus-visible { outline:3px solid rgba(var(--accent-user-rgb),.28)!important;outline-offset:2px!important; }
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;scroll-behavior:auto!important;}}

/* --- v126 performance visuelle des longues listes ------------------------- */
.variable-category,.v110-search-row,.cloud-backup-row,.household-activity-row,.transactions-flat-row,.transactions-detected-row { content-visibility:auto;contain-intrinsic-size:1px 58px; }

/* Dark mode des nouveaux composants. */
html[data-theme="dark"] .transactions-hero>div,html[data-theme="dark"] .transactions-segmented button.active,html[data-theme="dark"] .v129-diagnostic-card,html[data-theme="dark"] .v129-security-card { background:#1A1E22!important;border-color:rgba(255,255,255,.075)!important;color:#F3F4F5!important; }
html[data-theme="dark"] .transactions-segmented { background:rgba(255,255,255,.075); }
html[data-theme="dark"] .merchant-suggestion { background:rgba(var(--accent-user-rgb),.12); }

@media (max-width:390px){
  .transactions-hero strong{font-size:14px}.transactions-hero>div{padding:11px 9px}.transactions-hero span{font-size:9.5px}
  .transactions-section-title{align-items:flex-start}.transactions-detected-row{align-items:flex-start;flex-direction:column}.transactions-detected-actions{align-self:flex-end}
}
