@font-face{font-family:Poppins;font-style:normal;font-weight:400;font-display:swap;src:url('../fonts/Poppins-latin-ext-400.woff2') format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:Poppins;font-style:normal;font-weight:400;font-display:swap;src:url('../fonts/Poppins-latin-400.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:Poppins;font-style:normal;font-weight:500;font-display:swap;src:url('../fonts/Poppins-latin-ext-500.woff2') format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:Poppins;font-style:normal;font-weight:500;font-display:swap;src:url('../fonts/Poppins-latin-500.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:Poppins;font-style:normal;font-weight:600;font-display:swap;src:url('../fonts/Poppins-latin-ext-600.woff2') format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:Poppins;font-style:normal;font-weight:600;font-display:swap;src:url('../fonts/Poppins-latin-600.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:Poppins;font-style:normal;font-weight:700;font-display:swap;src:url('../fonts/Poppins-latin-ext-700.woff2') format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:Poppins;font-style:normal;font-weight:700;font-display:swap;src:url('../fonts/Poppins-latin-700.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Londrina Solid';font-style:normal;font-weight:300;font-display:swap;src:url('../fonts/LondrinaSolid-latin-300.woff2') format('woff2')}
@font-face{font-family:'Londrina Solid';font-style:normal;font-weight:400;font-display:swap;src:url('../fonts/LondrinaSolid-latin-400.woff2') format('woff2')}
@font-face{font-family:'Londrina Solid';font-style:normal;font-weight:900;font-display:swap;src:url('../fonts/LondrinaSolid-latin-900.woff2') format('woff2')}
@font-face {
  font-family: Material;
  src: url('../fonts/MaterialSymbolsRounded.woff2') format('woff2');
  font-display: block;
}
:root {
  --app-background: #e7e4e1;
  --page: #eeecea;
  --paper: #faf9f8;
  --border: #e4e0de;
  --text: #3a3430;
  --muted: #93857b;
  --red: #a85f5f;
  --green: #669849;
  --olive: #9a4f12;
  --blue: #905136;
  --sidebar: #3a3430;
  /* Accent et menu latéral : définis ici, redéfinis par chaque design. */
  --accent: #5a3222;
  --accent-line: #5a3222;
  --accent-hover: #77432e;
  --accent-pressed: #43241a;
  --accent-deep: #43241a;
  --accent-deeper: #35190f;
  --on-accent: #fff;
  --nav-text: #e9e7e5;
  --nav-muted: #94867c;
  --nav-active: #5a3f34;
  --nav-hover: #4a342b;
  --nav-pressed: #63463a;
  --nav-line: #4f3b33;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  font:
    15px/1.25 Poppins,
    Arial,
    sans-serif;
  color: var(--text);
  background: var(--app-background);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
}
.icon {
  font-family: Material;
  font-weight: normal;
  font-size: 19px;
  line-height: 1;
  font-feature-settings: 'liga';
  font-variation-settings: 'FILL' var(--icon-fill, 0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.app {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--border);
  overflow: auto;
}
.nav-heading {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  color: var(--nav-text);
  font-size: 14px;
}
.nav-item {
  width: 100%;
  height: 32px;
  padding: 0 17px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-size: 14px;
  color: var(--nav-text);
}
.nav-item .icon {
  width: 17px;
  font-size: 17px;
  color: var(--nav-text);
}
@media (hover: hover) and (pointer: fine) {
.nav-item:hover {
  background: var(--paper);
}
}
.nav-item:active {
  background: #e6e3e0;
}
.nav-item.active {
  background: #eeecea;
  font-weight: 600;
}
.workspace {
  min-width: 0;
  max-width: 1400px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.account-heading {
  height: 34px;
  min-height: 34px;
  background: var(--paper);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 8px;
  font:
    900 20px/1 'Londrina Solid',
    sans-serif;
}
@media (hover: hover) and (pointer: fine) {
.account-heading:hover {
  background: #f7f6f5;
}
}
.account-heading:focus-visible,
.nav-item:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #99654f;
  outline-offset: -2px;
}
.kpi-strip {
  height: 80px;
  min-height: 80px;
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.kpi-card,
.kpi-more {
  background: var(--paper);
  border: 1px solid var(--border);
}
.available-kpi:not([hidden]) + .balance-kpi,
.balance-kpi:not([hidden]) ~ .deferred-kpi:not([hidden]) {
  border-left: 0;
}
.kpi-card {
  padding: 10px 12px;
  flex: none;
  width: max-content;
}
.kpi-title {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 15px;
}
.kpi-title .icon {
  font-size: 18px;
  color: #83756b;
}
.kpi-number {
  font:
    600 19px/1.2 Poppins,
    sans-serif;
  white-space: nowrap;
  margin-top: 3px;
}
.negative {
  color: var(--red);
}
.positive {
  color: var(--green);
}
.zero {
  color: var(--muted);
}
.kpi-caption {
  font-size: 14px;
  color: #83756b;
  white-space: nowrap;
}
.kpi-pair {
  display: flex;
  gap: 16px;
}
.work-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  flex: 1;
}
.envelopes-panel,
.operations-panel {
  background: var(--paper);
  border: 1px solid var(--border);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel-heading {
  height: 32px;
  min-height: 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-heading h2 {
  font:
    600 17px/1 Poppins,
    sans-serif;
  margin: 0;
  padding-left: 8px;
}
.panel-add {
  align-self: stretch;
  width: 32px;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--paper);
  font-size: 23px;
  line-height: 1;
}
@media (hover: hover) and (pointer: fine) {
.panel-add:hover {
  background: #e8e5e2;
}
}
.panel-add:active {
  background: #ddd8d5;
}
@media (hover: hover) and (pointer: fine) {
.new-operation:hover {
  background: var(--accent-pressed);
}
}
.new-operation:active {
  background: var(--accent-deep);
}
.envelope-list {
  padding: 8px;
  overflow: auto;
  flex: 1;
}
.envelope-card {
  border: 1px solid var(--border);
  padding: 7px 6px;
  margin-bottom: 10px;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.envelope-card:hover {
  background: #f8f7f6;
}
}
.envelope-top {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  font-size: 14px;
}
.envelope-top strong {
  font-weight: 600;
}
.envelope-top span {
  white-space: nowrap;
  color: #83756b;
}
.progress {
  height: 17px;
  background: #e8e5e2;
  margin: 4px 0;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--green);
}
.progress span.fuel {
  background: var(--olive);
}
.envelope-rest {
  font-size: 12px;
  color: #94867c;
  display: flex;
  align-items: center;
  gap: 4px;
}
.envelope-rest .icon {
  font-size: 14px;
  color: #83756b;
}
.envelope-rest strong {
  color: #70645c;
  font-weight: 500;
}
.new-operation {
  align-self: stretch;
  height: auto;
  border: 0;
  border-left: 1px solid var(--accent-hover);
  background: var(--accent);
  color: #fff;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
}
.new-operation .icon {
  font-size: 20px;
}
.operations-toolbar {
  height: 32px;
  min-height: 32px;
  margin: 8px 8px 0;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}
.operations-toolbar button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  background: var(--paper);
  border: 0;
  border-right: 1px solid var(--border);
  font-size: 13px;
}
@media (hover: hover) and (pointer: fine) {
.operations-toolbar button:hover {
  background: #efedeb;
}
}
.operations-toolbar button:active {
  background: #e5e2df;
}
.operations-toolbar button.active {
  background: #e9e7e5;
}
.operations-toolbar .icon {
  font-size: 18px;
  color: #5e544c;
}
.search {
  margin-left: auto;
  border-left: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 9px;
  width: 400px;
}
@media (hover: hover) and (pointer: fine) {
.search:hover {
  background: #f2f1f0;
}
}
.search:focus-within {
  background: #fff;
}
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
  font-size: 13px;
}
.table-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  margin: 0 8px 8px;
  background: #f2f1f0;
}
tbody tr {
  background: var(--paper);
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1088px;
  table-layout: fixed;
}
th,
td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0 8px;
  text-align: left;
}
th:last-child,
td:last-child {
  border-right: 0;
}
th {
  height: 27px;
  background: #f5f4f3;
  color: #a3978f;
  font-size: 13px;
  font-weight: 400;
}
td {
  height: 40px;
  font-size: 13px;
}
:where(table:not(.data-table)) th:nth-child(1),
:where(table:not(.data-table)) td:nth-child(1) {
  width: 41px;
  text-align: center;
  padding: 0 3px;
}
:where(table:not(.data-table)) th:nth-child(2),
:where(table:not(.data-table)) td:nth-child(2) {
  width: 134px;
}
:where(table:not(.data-table)) th:nth-child(3),
:where(table:not(.data-table)) td:nth-child(3) {
  width: 150px;
}
:where(table:not(.data-table)) th:nth-child(4),
:where(table:not(.data-table)) td:nth-child(4) {
  width: 398px;
}
:where(table:not(.data-table)) th:nth-child(5),
:where(table:not(.data-table)) td:nth-child(5) {
  width: 193px;
  text-align: right;
}
:where(table:not(.data-table)) th:nth-child(6),
:where(table:not(.data-table)) td:nth-child(6) {
  width: 87px;
  text-align: right;
}
:where(table:not(.data-table)) th:nth-child(7),
:where(table:not(.data-table)) td:nth-child(7),
:where(table:not(.data-table)) th:nth-child(8),
:where(table:not(.data-table)) td:nth-child(8) {
  width: 44px;
  text-align: center;
  padding: 0;
}
@media (hover: hover) and (pointer: fine) {
tbody tr:hover {
  background: #f8f7f6;
}
}
.type-badge {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.type-expense {
  color: #a94848;
}
.type-deferred {
  color: var(--olive);
}
.type-income {
  color: #3a7625;
}
.type-transfer {
  color: #3a7625;
}
.type-badge .icon {
  font-size: 19px;
}
/* La cellule du type se colore comme celle du montant : seulement quand l'opération est pointée. */
tr:has(.amount-cell.checked-expense) > td:has(> .type-badge) {
  background: #f8e5e5;
}
tr:has(.amount-cell.checked-income) > td:has(> .type-badge) {
  background: #e6f4e3;
}
tr:has(.amount-cell.checked-deferred) > td:has(> .type-badge) {
  background: var(--deferred-bg, #fbe9d6);
}
@media (hover: hover) and (pointer: fine) {
tbody tr:hover:has(.amount-cell:is(.checked-expense, .checked-income, .checked-deferred)) > td:has(> .type-badge) {
  box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.04);
}
}
.category-cell {
  display: flex;
  gap: 5px;
  align-items: center;
}
.category-cell .icon {
  font-size: 18px;
}
.op-name {
  font-weight: 600;
  display: block;
  font-size: 14px;
  color: #25211f;
}
.op-sub {
  font-size: 12px;
  color: #94867c;
  display: block;
}
.budget-cell {
  font-size: 12px;
  color: #94867c;
}
.budget-cell b {
  color: #5e544c;
  font-weight: 600;
}
.amount-cell {
  font-weight: 600;
  white-space: nowrap;
}
.row-action {
  border: 0;
  background: transparent;
  width: 100%;
  height: 39px;
  color: #5e544c;
}
@media (hover: hover) and (pointer: fine) {
.row-action:hover {
  background: #edebe9;
}
}
.row-action:active {
  background: #e0dcda;
}
.row-action .icon {
  font-size: 19px;
}
#notice {
  position: fixed;
  right: 16px;
  top: 14px;
  bottom: auto;
  max-width: min(420px, calc(100vw - 32px));
  background: #38322e;
  color: #fff;
  padding: 9px 13px;
  font-size: 14px;
  z-index: 5;
}
@media (max-width: 1050px) {
  .app {
    grid-template-columns: 170px minmax(0, 1fr);
  }
  .work-grid {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .kpi-strip {
    overflow-x: auto;
  }
  .search {
    width: 170px;
  }
}
@media (max-width: 680px) {
  .app {
    grid-template-columns: 55px minmax(0, 1fr);
  }
  .sidebar .nav-heading,
  .sidebar .nav-item span:not(.icon) {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 0;
  }
  .workspace {
    padding: 6px;
    gap: 6px;
  }
  .work-grid {
    display: flex;
    flex-direction: column;
    overflow: auto;
  }
  .envelopes-panel {
    min-height: 200px;
    max-height: 250px;
  }
  .operations-panel {
    min-height: 400px;
    flex: 1;
  }
  .kpi-strip {
    height: 92px;
    min-height: 92px;
  }
  .account-heading {
    height: 35px;
    min-height: 35px;
  }
  .new-operation {
    font-size: 0;
  }
  .new-operation .icon {
    font-size: 20px;
  }
}

.month-controls {
  display: flex;
  height: 100%;
  align-items: stretch;
  font:
    13px Poppins,
    sans-serif;
}
.month-controls button {
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--paper);
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
.month-controls button:hover {
  background: #efedeb;
}
}
.month-controls button:active {
  background: #e3dfdd;
}
.month-controls .icon {
  font-size: 19px;
}
.nav-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 11px;
  gap: 7px;
}
.nav-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pages and editors outside the supplied dashboard frame. */
[hidden] {
  display: none !important;
}
.work-grid.single-panel {
  grid-template-columns: minmax(0, 1fr);
}
.config-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.config-panel .panel-heading {
  flex-shrink: 0;
}
#config-body {
  overflow: auto;
  padding: 8px;
  min-height: 0;
}
.config-note {
  font-size: 13px;
  color: #83756b;
  margin: 4px 0 13px;
  line-height: 1.5;
}
.config-row {
  min-height: 44px;
  display: grid;
  grid-template-columns: 28px minmax(150px, 1fr) minmax(130px, 1.4fr) auto 80px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-bottom: 0;
  padding: 5px 8px;
  font-size: 13px;
  background: #fbfbfb;
}
.config-row:last-child {
  border-bottom: 1px solid var(--border);
}
.config-row > .icon {
  font-size: 20px;
  color: #83756b;
}
.config-row > strong {
  font-size: 14px;
}
.config-row > span:not(.icon) {
  color: #83756b;
}
.config-row > button,
.forecast-actions > button,
.allocation-editor button,
.dialog-actions button {
  border: 1px solid var(--border);
  background: #fbfbfb;
  color: #38322e;
  padding: 6px 9px;
  font:
    13px Poppins,
    sans-serif;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.config-row > button:hover,
.forecast-actions > button:hover,
.allocation-editor button:hover,
.dialog-actions button:hover {
  background: #eeecea;
}
}
.config-row > button:active,
.forecast-actions > button:active,
.allocation-editor button:active,
.dialog-actions button:active {
  background: #e1dddb;
}
.forecast-account {
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: #fbfbfb;
}
.forecast-account > summary {
  padding: 10px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  /*  border-bottom: 1px solid var(--border);*/
}
.forecast-account > summary span {
  font-weight: 400;
  color: #94867c;
  margin-left: 12px;
  font-size: 13px;
}
.forecast-actions {
  display: flex;
  gap: 5px;
  padding: 8px;
  flex-wrap: wrap;
}
.forecast-account .config-row {
  border-left: 0;
  border-right: 0;
}
#editor-dialog {
  border: 1px solid #d4ceca;
  background: #fbfbfb;
  color: #38322e;
  width: min(700px, calc(100vw - 30px));
  max-height: min(800px, calc(100vh - 30px));
  padding: 0;
  box-shadow: 0 15px 50px #0003;
  font-family: Poppins, sans-serif;
}
#editor-dialog::backdrop {
  background: #0007;
}
#editor-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 30px);
  min-height: 170px;
}
.dialog-heading {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
}
.dialog-heading h2 {
  font:
    900 22px 'Londrina Solid',
    sans-serif;
  margin: 0;
}
.dialog-heading button {
  border: 0;
  background: transparent;
  font-size: 27px;
  color: #83756b;
  cursor: pointer;
  width: 30px;
  height: 30px;
}
#editor-fields {
  padding: 14px;
  overflow: auto;
  flex: 1;
}
.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #70645c;
  min-width: 0;
}
.edit-field input,
.edit-field select,
.allocation-row input,
.allocation-row select {
  border: 1px solid #ddd8d5;
  border-radius: 2px;
  background: #fff;
  min-height: 32px;
  padding: 5px 7px;
  color: #25211f;
  font:
    14px Poppins,
    sans-serif;
  min-width: 0;
  width: 100%;
}
.edit-field input:focus,
.edit-field select:focus,
.allocation-row input:focus,
.allocation-row select:focus {
  outline: 2px solid #bb7a5e;
  outline-offset: -1px;
}
.allocation-editor {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 10px;
}
.allocation-editor p {
  font-size: 12px;
  line-height: 1.45;
  color: #83756b;
  margin: 7px 0;
}
.allocation-row {
  display: grid;
  grid-template-columns: minmax(120px, 2fr) minmax(70px, 1fr) minmax(70px, 1fr) 32px 30px;
  gap: 5px;
  margin: 5px 0;
}
.adjust-allocation,
.remove-allocation {
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.adjust-allocation .icon {
  font-size: 18px;
}
.remove-allocation {
  font-size: 21px !important;
}
.link-field {
  border: 1px solid var(--border);
  margin-top: 12px;
  font-size: 13px;
}
.link-field label {
  display: inline-flex;
  gap: 5px;
  margin: 5px 12px 5px 0;
  align-items: center;
}
#editor-error {
  color: #aa3333;
  font-size: 13px;
  margin: 0;
  padding: 0 14px;
  min-height: 0;
}
#editor-error:not(:empty) {
  padding: 7px 14px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
}
.dialog-actions .save-button {
  background: var(--accent-line);
  color: #fff;
  border-color: var(--accent-line);
}
@media (hover: hover) and (pointer: fine) {
.dialog-actions .save-button:hover {
  background: var(--accent-deeper);
}
}
.dialog-actions .save-button:active {
  background: #653926;
}
@media (max-width: 680px) {
  .edit-grid {
    grid-template-columns: 1fr;
  }
  .config-row {
    grid-template-columns: 24px 1fr auto;
  }
  .config-row > span:not(.icon) {
    display: none;
  }
  .config-row > button {
    grid-column: 3;
  }
  .allocation-row {
    grid-template-columns: minmax(90px, 1fr) 65px 65px 28px 25px;
  }
}
.group-row td {
  background: #eeecea;
  height: 28px;
  padding: 0;
  border-bottom: 1px solid var(--border);
}
.group-row button {
  border: 0;
  background: transparent;
  width: 100%;
  height: 27px;
  text-align: left;
  padding: 0 9px;
  font-weight: 600;
  font-size: 13px;
}
@media (hover: hover) and (pointer: fine) {
.group-row button:hover {
  background: #e4e0de;
}
}
.group-row button:active {
  background: #d9d4d1;
}
#editor-delete {
  margin-right: auto;
  color: #a44b4b;
  border-color: #dfb8b8;
}
@media (hover: hover) and (pointer: fine) {
#editor-delete:hover {
  background: #f5e7e7;
}
}
#editor-delete:active {
  background: #eed5d5;
}
/* Four targeted refinements to the Figma dashboard. */
.kpi-strip {
  height: 92px;
  min-height: 92px;
}
.kpi-more {
  height: 92px;
}
.more-content {
  height: auto;
  min-height: 0;
  flex: 1;
}
.savings-cell {
  padding: 5px 6px;
}
.month-controls {
  position: relative;
}
#month-picker {
  width: 160px;
  min-width: 160px;
  justify-content: space-between;
}
#month-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  right: 96px;
  top: 100%;
  pointer-events: none;
}
.month-fallback-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}
.month-header-date {
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.month-fallback-controls > * {
  min-width: 0;
}
.operations-frame {
  /*  margin: 8px;
  border: 1px solid var(--border);*/
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #f2f1f0;
}
.operations-frame .operations-toolbar {
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.operations-frame .table-scroll {
  margin: 0;
  min-width: 0;
}
.operations-frame table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.operations-frame th:nth-child(1),
.operations-frame td:nth-child(1) {
  width: 4%;
}
.operations-frame th:nth-child(2),
.operations-frame td:nth-child(2) {
  width: 12%;
}
.operations-frame th:nth-child(3),
.operations-frame td:nth-child(3) {
  width: 17%;
}
.operations-frame th:nth-child(4),
.operations-frame td:nth-child(4) {
  width: 23%;
}
.operations-frame th:nth-child(5),
.operations-frame td:nth-child(5) {
  width: 22%;
}
.operations-frame th:nth-child(6),
.operations-frame td:nth-child(6) {
  width: 12%;
}
.operations-frame th:nth-child(7),
.operations-frame td:nth-child(7),
.operations-frame th:nth-child(8),
.operations-frame td:nth-child(8) {
  width: 5%;
}
.operations-frame td:nth-child(2),
.operations-frame td:nth-child(3),
.operations-frame td:nth-child(4) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.operations-frame .op-name,
.operations-frame .op-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .operations-frame table {
    min-width: 720px;
  }
}
/* Dropdowns for the filter and row actions. */
#dropdown-menu {
  position: fixed;
  z-index: 30;
  min-width: 188px;
  max-width: min(270px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  padding: 4px;
  background: #fbfbfb;
  border: 1px solid #d4ceca;
  box-shadow: 0 5px 16px #0002;
}
#dropdown-menu[hidden] {
  display: none !important;
}
#dropdown-menu button {
  width: 100%;
  min-height: 29px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  text-align: left;
  color: #38322e;
  font:
    13px Poppins,
    sans-serif;
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
#dropdown-menu button:hover {
  background: #efedeb;
}
}
#dropdown-menu button:active {
  background: #e1dddb;
}
#dropdown-menu button:disabled {
  opacity: 0.45;
  cursor: default;
  background: transparent;
}
#dropdown-menu button[aria-checked='true'] {
  font-weight: 600;
  background: #f2ebe8;
}
#dropdown-menu .icon,
#dropdown-menu .menu-spacer {
  width: 15px;
  min-width: 15px;
  font-size: 15px;
}
.amount-cell.checked-expense {
  background: #f8e5e5;
}
.amount-cell.checked-income {
  background: #e6f4e3;
}
.amount-cell.checked-deferred {
  background: var(--deferred-bg, #fbe9d6);
  color: var(--olive);
}
#dropdown-menu .menu-date {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 8px;
  font-size: 13px;
  color: #70645c;
}
#dropdown-menu .menu-date input {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 4px;
  font:
    13px Poppins,
    sans-serif;
  color: #38322e;
}
/* Sorting and optional compact category column. */
.column-sort {
  width: 100%;
  height: 27px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  white-space: nowrap;
  cursor: default;
}
.column-sort.active {
  background: #f0eae8;
  color: #504642;
  font-weight: 600;
}
.column-sort .sort-indicator {
  font-size: 14px;
  line-height: 1;
}
.operations-frame th:nth-child(5) .column-sort,
.operations-frame th:nth-child(6) .column-sort {
  justify-content: flex-end;
}
.header-icon {
  display: none;
}
.category-cell {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.category-cell .category-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.operations-panel.hide-category-label .category-label,
.operations-panel.hide-category-label .header-label {
  display: none;
}
.operations-panel.hide-category-label .header-icon {
  display: inline-flex;
  font-size: 17px;
}
.operations-panel.hide-category-label .operations-frame th:nth-child(3),
.operations-panel.hide-category-label .operations-frame td:nth-child(3) {
  width: 6%;
}
.operations-panel.hide-category-label .operations-frame th:nth-child(4),
.operations-panel.hide-category-label .operations-frame td:nth-child(4) {
  width: 31%;
}
.operations-panel.hide-category-label .operations-frame td:nth-child(3) .category-cell {
  justify-content: center;
}
.operations-panel.hide-category-label .operations-frame th:nth-child(3) .column-sort {
  justify-content: center;
  padding-inline: 0;
}
.operations-panel.hide-category-label .operations-frame th:nth-child(3) .sort-indicator:empty {
  display: none;
}
.operations-toolbar #view-options-button {
  padding: 0 9px;
}
.budget-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.budget-cell .budget-extra {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  color: #94867c;
}
.budget-cell .budget-extra .icon {
  font-size: 13px;
}
.amount-cell.deferred-text {
  color: var(--olive);
}
.kpi-more {
  width: var(--more-width, 422px);
}
.available-kpi,
.balance-kpi,
.deferred-kpi {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#dropdown-menu.sort-menu {
  width: 350px;
  max-width: calc(100vw - 16px);
  padding: 7px;
}
.sort-menu-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 2px 8px;
  font-size: 13px;
}
.sort-menu-heading small {
  color: #94867c;
  font-size: 11px;
}
.sort-rule {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 29px 25px 25px 25px;
  align-items: center;
  gap: 3px;
  margin-bottom: 4px;
}
.sort-rank {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #70645c;
}
.sort-rule select,
.sort-add select {
  min-width: 0;
  width: 100%;
  height: 29px;
  padding: 3px 5px;
  border: 1px solid var(--border);
  background: #fff;
  color: #38322e;
  font:
    13px Poppins,
    sans-serif;
}
#dropdown-menu.sort-menu .sort-rule button {
  width: 100%;
  min-width: 0;
  height: 29px;
  min-height: 29px;
  padding: 2px;
  justify-content: center;
  border: 1px solid var(--border);
}
#dropdown-menu.sort-menu .sort-rule button:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}
.sort-add {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: #70645c;
}

.operations-frame th {
  padding: 0;
}
.operations-frame th:first-child .column-sort {
  padding: 0;
  justify-content: center;
}
.operations-toolbar .search {
  background: #fff;
}
.account-filter {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  border-right: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
}
.account-filter select {
  width: 145px;
  min-width: 0;
  height: 25px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 12px;
}
.empty-state {
  padding: 16px 10px;
  color: #83756b;
  font-size: 13px;
  text-align: center;
}
.empty-row td {
  padding: 16px 10px !important;
  text-align: center !important;
  color: #83756b;
  font-size: 13px;
  background: var(--page);
  border-bottom: 0;
}

#account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: none;
}
.associations-kpi {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  margin-left: 10px;
}
.associations-kpi #account-associations {
  font-size: 14px;
  line-height: 1.3;
  color: #83756b;
  max-width: 360px;
  white-space: normal;
}
.account-group {
  margin-bottom: 16px;
}
.account-group h3 {
  margin: 0;
  padding: 7px 8px;
  border: 1px solid var(--border);
  background: #f4f3f2;
  font:
    600 14px Poppins,
    sans-serif;
}
.account-group .config-row {
  border-top: 0;
}
.account-group .config-row:last-child {
  border-bottom: 1px solid var(--border);
}

.config-toolbar button,
.account-group-heading button {
  border: 1px solid var(--border);
  background: var(--paper);
  padding: 6px 9px;
  font:
    13px Poppins,
    sans-serif;
}
@media (hover: hover) and (pointer: fine) {
.config-toolbar button:hover,
.account-group-heading button:hover {
  background: #eeecea;
}
}
.config-toolbar button:active,
.account-group-heading button:active {
  background: #e1dddb;
}
.account-group-heading {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border: 1px solid var(--border);
  background: #f4f3f2;
}
.account-group-heading h3 {
  border: 0;
  background: transparent;
  align-self: center;
}
.account-group-heading button {
  border: 0;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}
.account-group .empty-state {
  border: 1px solid var(--border);
  border-top: 0;
  text-align: left;
}
.forecast-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background: #f4f3f2;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.forecast-group-heading h4 {
  margin: 0;
  font-size: 14px;
}
.forecast-group-heading strong {
  white-space: nowrap;
}
.forecast-group .config-row {
  border-top: 0;
}
.forecast-group .config-row:last-child {
  border-bottom: 0;
}

.category-group .config-row {
  grid-template-columns: 28px minmax(0, 1fr) 80px;
}
.icon-picker {
  min-width: 0;
}
.icon-picker summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid #ddd8d5;
  border-radius: 2px;
  background: #fff;
  color: #25211f;
  cursor: pointer;
  font-size: 14px;
}
.icon-picker summary::-webkit-details-marker {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
.icon-picker summary:hover {
  background: #f4f3f2;
}
}
.icon-picker summary:focus-visible {
  outline: 2px solid #bb7a5e;
  outline-offset: -1px;
}
.icon-picker-current-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-picker-options {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-top: 0;
  background: #fff;
}
.icon-picker-options button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  background: #fff;
  text-align: left;
  font:
    13px Poppins,
    sans-serif;
}
@media (hover: hover) and (pointer: fine) {
.icon-picker-options button:hover {
  background: #efedeb;
}
}
.icon-picker-options button:active {
  background: #e1dddb;
}
.icon-picker-options button[aria-selected='true'] {
  background: #f2ebe8;
  font-weight: 600;
}
.icon-picker-options .icon {
  width: 20px;
  flex: none;
  font-size: 19px;
}

/* Prévisionnel : mêmes couleurs de montants que les opérations. */
.forecast-group-heading .forecast-positive,
.forecast-group .config-row > .forecast-positive {
  color: var(--green);
}
.forecast-group-heading .forecast-negative,
.forecast-group .config-row > .forecast-negative {
  color: var(--red);
}
.forecast-group-heading .forecast-deferred,
.forecast-group .config-row > .forecast-deferred {
  color: var(--olive);
}
.forecast-group .config-row > .forecast-neutral,
.forecast-overview .forecast-neutral,
.forecast-table .forecast-neutral {
  color: var(--muted); /* montant nul : gris */
}
.forecast-amount {
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}
#dropdown-menu.filter-menu .menu-section-title {
  margin: 5px -4px 3px;
  padding: 6px 12px 3px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: #83756b;
}
#dropdown-menu.filter-menu .menu-section-title:first-child {
  border-top: 0;
  margin-top: 0;
}
#editor-dialog.category-editor,
#editor-dialog.category-editor #editor-fields {
  overflow: visible;
}
.icon-picker {
  position: relative;
}
.icon-picker-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  z-index: 3;
  max-height: min(320px, calc(100vh - 210px));
  box-shadow: 0 7px 18px #0002;
}
.icon-picker-search {
  display: block;
  width: calc(100% - 12px);
  height: 31px;
  margin: 6px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font:
    13px Poppins,
    sans-serif;
}

#dropdown-menu.month-filter-menu {
  width: 235px;
  max-height: min(360px, calc(100vh - 16px));
}
#dropdown-menu.month-filter-menu .month-search {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 2px 3px 5px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  background: #fff;
}
#dropdown-menu.month-filter-menu .month-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font:
    13px Poppins,
    sans-serif;
}
#dropdown-menu.month-filter-menu .menu-section-title {
  margin: 4px -4px 2px;
  padding: 6px 12px 3px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: #83756b;
}
#dropdown-menu.month-filter-menu .month-filter-empty {
  margin: 6px 8px;
  color: #83756b;
  font-size: 12px;
}
.category-group .config-row {
  border-top: 0;
  border-bottom: 1px solid var(--border);
}
@media (hover: hover) and (pointer: fine) {
.category-group .config-row:hover {
  background: #f2f0ee;
}
}

.account-group-heading button {
  background: var(--accent);
  color: #fff;
  border-left-color: var(--accent-hover);
}
@media (hover: hover) and (pointer: fine) {
.account-group-heading button:hover {
  background: var(--accent-pressed);
  color: #fff;
}
}
.account-group-heading button:active {
  background: var(--accent-deep);
  color: #fff;
}
#editor-dialog.account-icon-editor,
#editor-dialog.account-icon-editor #editor-fields {
  overflow: visible;
}

.category-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  margin-bottom: 8px;
  padding: 0 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: #83756b;
}
.category-search .icon {
  font-size: 17px;
}
.category-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font:
    13px Poppins,
    sans-serif;
}
@media (hover: hover) and (pointer: fine) {
.category-search:hover {
  background: #f8f7f6;
}
}
.category-search:focus-within {
  border-color: #c69d8b;
  background: #fff;
}
.accounts-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-top: 0;
}
.accounts-table {
  width: 100%;
  min-width: 690px;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fbfbfb;
  font-size: 13px;
}
.accounts-table th,
.accounts-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.accounts-table tbody tr:last-child td {
  border-bottom: 0;
}
.accounts-table th {
  background: #f4f3f2;
  color: #83756b;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
.accounts-table tbody tr:hover {
  background: #f2f0ee;
}
}
.accounts-table th:nth-child(1) {
  width: 27%;
}
.accounts-table th:nth-child(2) {
  width: 19%;
}
.accounts-table th:nth-child(3) {
  width: 17%;
}
.accounts-table th:nth-child(4) {
  width: 17%;
}
.accounts-table th:nth-child(5) {
  width: 9%;
}
.accounts-table th:nth-child(6) {
  width: 11%;
}
.accounts-table th:nth-child(3),
.accounts-table th:nth-child(6) {
  text-align: right;
}
.accounts-table th:nth-child(4),
.accounts-table th:nth-child(5) {
  text-align: center;
}
.account-table-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.account-table-name .icon {
  font-size: 19px;
  color: #83756b;
  flex: none;
}
.account-table-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.accounts-table .account-table-amount {
  text-align: right;
  white-space: nowrap;
}
.accounts-table .account-table-order,
.accounts-table .account-table-favorite {
  text-align: center;
}
.account-table-order > div {
  display: flex;
  justify-content: center;
  gap: 3px;
}
.account-table-order button,
.account-table-favorite button {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  background: #fff;
  color: #5e544c;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.account-table-order button:hover:not(:disabled),
.account-table-favorite button:hover {
  background: #f2ebe8;
}
}
.account-table-order button:active:not(:disabled),
.account-table-favorite button:active {
  background: #ebdad3;
}
.account-table-order button:disabled {
  opacity: 0.35;
  cursor: default;
}
.account-table-favorite button[aria-pressed='true'] {
  color: var(--olive);
  background: var(--deferred-bg, #fbe9d6);
}
.account-table-order .icon,
.account-table-favorite .icon {
  font-size: 17px;
}
.accounts-table .account-table-action {
  text-align: right;
}
.account-table-action button {
  border: 1px solid var(--border);
  background: #fff;
  color: #38322e;
  padding: 5px 8px;
  font:
    13px Poppins,
    sans-serif;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.account-table-action button:hover {
  background: #eeecea;
}
}
.account-table-action button:active {
  background: #e1dddb;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.forecast-actions .forecast-apply {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-hover);
}
@media (hover: hover) and (pointer: fine) {
.forecast-actions .forecast-apply:hover:not(:disabled) {
  background: var(--accent-pressed);
  color: #fff;
}
}
.forecast-actions .forecast-apply:active:not(:disabled) {
  background: var(--accent-deep);
  color: #fff;
}
.forecast-actions .forecast-apply:disabled {
  background: #e8e5e2;
  color: #83756b;
  border-color: var(--border);
  cursor: default;
}

/* Connexion locale et comptes utilisateurs. */
.sidebar {
  display: flex;
  flex-direction: column;
  background-color: var(--sidebar);
}
.user-section {
  margin-top: auto;
  border-top: 1px solid var(--border);
  border-bottom: 0;
  padding-bottom: 0;
}
#user-menu {
  border-top: 1px solid var(--border);
}
.app-version {
  display: block;
  padding: 5px 12px 8px;
  color: var(--nav-muted);
  font-size: 11px;
  line-height: 1.3;
}
#release-dialog {
  width: min(600px, calc(100vw - 30px));
  max-height: calc(100vh - 30px);
  padding: 0;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text);
  font-family: Poppins, sans-serif;
}
#release-dialog::backdrop {
  background: #0007;
}
#release-dialog .dialog-heading h2 {
  margin: 0;
  font:
    900 22px 'Londrina Solid',
    sans-serif;
}
#release-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #83756b;
  font-size: 26px;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
#release-close:hover {
  background: #eeecea;
  color: var(--text);
}
}
#release-close:active {
  background: #e1dddb;
}
.release-content {
  max-height: calc(100vh - 90px);
  padding: 16px 20px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.5;
}
.release-entry h3 {
  margin: 0;
  font:
    900 20px 'Londrina Solid',
    sans-serif;
}
.release-entry time {
  display: block;
  margin-top: 3px;
  color: #83756b;
}
.release-entry h4 {
  margin: 16px 0 5px;
  font-size: 13px;
}
.release-entry ul {
  margin: 0;
  padding-left: 20px;
}
.release-entry li + li {
  margin-top: 4px;
}
#user-feedback {
  margin: 6px 9px;
  color: var(--red);
  font-size: 12px;
}
.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--app-background);
}
.auth-card {
  width: min(390px, 100%);
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--border);
  box-shadow: 0 6px 25px #0000000d;
}
.auth-card h1 {
  margin: 18px 0 8px;
  font:
    900 24px 'Londrina Solid',
    sans-serif;
}
.auth-card p {
  margin: 0 0 18px;
  color: #7b6e65;
  font-size: 13px;
  line-height: 1.5;
}
.auth-card form {
  display: grid;
  gap: 12px;
}
.auth-card label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: #5e544c;
}
.auth-card input {
  height: 35px;
  min-width: 0;
  padding: 5px 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font:
    14px Poppins,
    sans-serif;
}
.auth-card button {
  min-height: 35px;
  padding: 6px 12px;
  border: 1px solid var(--accent-hover);
  background: var(--accent);
  color: #fff;
  font:
    600 13px Poppins,
    sans-serif;
}
@media (hover: hover) and (pointer: fine) {
.auth-card button:hover:not(:disabled),
#new-user-form button:hover:not(:disabled) {
  background: var(--accent-pressed);
}
}
.auth-card button:active:not(:disabled),
#new-user-form button:active:not(:disabled) {
  background: var(--accent-deep);
}
.auth-card button:disabled {
  opacity: 0.55;
  cursor: default;
}
.auth-card .auth-error {
  margin: 12px 0 0;
  color: var(--red);
}
.auth-card .auth-error:empty {
  display: none;
}

/* Ajustements du suivi et des prévisions. */
.kpi-pair > div,
.available-kpi .kpi-number {
  min-width: 150px;
}
#savings-menu .nav-item {
  min-height: 44px;
  height: auto;
}
#savings-menu .nav-label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}
#savings-menu .nav-label > span,
#savings-menu .nav-label > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#savings-menu .nav-label > small {
  color: var(--nav-muted);
  font-size: 11px;
  font-weight: 400;
}
.operations-frame table {
  min-width: 820px;
}
.operations-frame th:nth-child(2),
.operations-frame td:nth-child(2) {
  width: 106px;
}
.operations-frame th:nth-child(3),
.operations-frame td:nth-child(3) {
  width: auto;
}
.operations-frame th:nth-child(4),
.operations-frame td:nth-child(4) {
  width: 140px;
  max-width: 140px;
}
.operations-frame th:nth-child(5),
.operations-frame td:nth-child(5) {
  width: 19%;
}
.operations-frame th:nth-child(6),
.operations-frame td:nth-child(6) {
  width: 115px;
}
.operations-frame th:nth-child(4) .column-sort,
.operations-frame th:nth-child(5) .column-sort,
.operations-frame th:nth-child(6) .column-sort {
  justify-content: flex-end;
}
.operations-panel.hide-category-label .operations-frame th:nth-child(4),
.operations-panel.hide-category-label .operations-frame td:nth-child(4) {
  width: 44px;
}
.operations-panel.hide-category-label .operations-frame th:nth-child(3),
.operations-panel.hide-category-label .operations-frame td:nth-child(3) {
  width: auto;
}
.operations-panel.hide-category-label .operations-frame td:nth-child(4) .category-cell,
.operations-panel.hide-category-label .operations-frame th:nth-child(4) .column-sort {
  justify-content: center;
  padding-inline: 0;
}
.group-row button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.group-row strong {
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
.forecast-account > summary:hover {
  background: #efedeb;
}
}
.forecast-account > summary:active {
  background: #e5e2df;
}
.forecast-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.forecast-overview span {
  display: inline-flex;
  gap: 7px;
  align-items: baseline;
}
.forecast-overview .forecast-positive,
.forecast-table .forecast-positive {
  color: var(--green);
}
.forecast-overview .forecast-negative,
.forecast-table .forecast-negative {
  color: var(--red);
}
.forecast-table .forecast-deferred {
  color: var(--olive);
}
.forecast-table-scroll {
  overflow-x: auto;
}
.forecast-table {
  width: 100%;
  min-width: 650px;
  table-layout: auto;
}
.forecast-table th,
.forecast-table td {
  width: auto;
  height: auto;
  padding: 7px 9px;
  text-align: left;
  white-space: nowrap;
}
.forecast-table th:nth-last-child(2),
.forecast-table td:nth-last-child(2) {
  text-align: right;
}
.forecast-table td.forecast-months {
  white-space: normal;
  overflow-wrap: anywhere;
}
.forecast-table .forecast-group-total > * {
  background: var(--paper);
  border-top: 1px solid var(--border);
  font-weight: 700;
}
.forecast-table tfoot .forecast-group-total th {
  width: auto;
  color: var(--text);
  text-align: right;
}
.forecast-table th:last-child,
.forecast-table td:last-child {
  width: 90px;
  text-align: right;
}
.forecast-table button {
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: #fbfbfb;
  color: #38322e;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.forecast-table button:hover {
  background: #eeecea;
}
}
.forecast-table button:active {
  background: #e1dddb;
}
.forecast-budget-table th:nth-last-child(2),
.forecast-budget-table td:nth-last-child(2) {
  text-align: left;
}
.operations-frame th:nth-child(4) .column-sort {
  justify-content: flex-start;
}

/* Indicateurs plus compacts, avec assez de place pour un montant à six chiffres. */
.kpi-card {
  padding: 7px 9px;
}
.kpi-title {
  font-size: 13px;
}
.kpi-title .icon {
  font-size: 16px;
}
.kpi-number {
  font-size: 16px;
  margin-top: 2px;
}
.kpi-caption {
  font-size: 12px;
}
.kpi-pair {
  gap: 10px;
}
.kpi-pair > div,
.available-kpi .kpi-number {
  min-width: 136px;
}

@media (hover: hover) and (pointer: fine) {
/* Même intensité de survol sur les surfaces interactives neutres. */
.nav-item:not(.active):hover,
tbody tr:hover,
.config-row:hover,
.forecast-account > summary:hover,
.envelope-card:hover {
  background: #f2f0ee;
}
}
.nav-item:not(.active):active,
.forecast-account > summary:active,
.envelope-card:active {
  background: #e5e2df;
}
@media (hover: hover) and (pointer: fine) {
.operations-toolbar button:not(.active):hover,
.month-controls button:hover,
#dropdown-menu button:hover,
.row-action:hover,
.config-row > button:hover,
.forecast-actions > button:not(.forecast-apply):hover,
.forecast-table button:hover,
.account-table-action button:hover {
  background: #ebe9e7;
}
}
.operations-toolbar button:not(.active):active,
.month-controls button:active,
#dropdown-menu button:active,
.row-action:active,
.config-row > button:active,
.forecast-actions > button:not(.forecast-apply):active,
.forecast-table button:active,
.account-table-action button:active {
  background: #e0dbd9;
}
@media (hover: hover) and (pointer: fine) {
.operations-toolbar button.active:hover {
  background: #e1dddb;
}
}
.operations-toolbar button.active:active {
  background: #d6d0cc;
}
.kpi-tab.active {
  cursor: default;
  pointer-events: none;
}
.kpi-more .savings-cell {
  width: 155px;
  min-width: 155px;
  padding-inline: 5px;
}

/* Sauvegarde et restauration du budget de l’utilisateur connecté. */
#user-feedback.success {
  color: var(--green);
}
#import-dialog {
  width: min(520px, calc(100vw - 30px));
  max-height: calc(100vh - 30px);
  padding: 0;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text);
  font-family: Poppins, sans-serif;
}
#import-dialog::backdrop {
  background: #0007;
}
#import-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #83756b;
  font-size: 26px;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
#import-close:hover {
  background: #ebe9e7;
}
}
#import-close:active {
  background: #e0dbd9;
}
.import-content {
  padding: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.import-content p {
  margin: 0 0 12px;
}
#import-summary {
  font-weight: 600;
}
#import-error {
  color: var(--red);
}
#import-error:empty {
  display: none;
}
.import-content .dialog-actions {
  padding: 8px 0 0;
}

/* Menu sombre du thème clair : conserver le contraste de la page sélectionnée. */
html:not([data-theme='dark']) .sidebar .nav-item.active {
  background: #584f48;
  color: #fff;
}
html:not([data-theme='dark']) .sidebar .nav-item.active .icon {
  color: #fff;
}
@media (hover: hover) and (pointer: fine) {
html:not([data-theme='dark']) .sidebar .nav-item:not(.active):hover {
  background: #4c443e;
}
}
html:not([data-theme='dark']) .sidebar .nav-item:not(.active):active {
  background: #5e544c;
}

/* Ajustements des opérations et du prévisionnel. */
.workspace {
  width: 100%;
  max-width: 1400px;
  justify-self: center;
}
.sidebar {
  border-right: 0;
}
.operations-frame thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.type-transfer-debit {
  color: #a94848;
}
.type-transfer-credit {
  color: #3a7625;
}
.transfer-counterparty strong {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text);
  font-weight: 600;
}
.transfer-counterparty .icon {
  font-size: 12px;
}
.forecast-table {
  table-layout: fixed;
}
.forecast-table th:nth-child(1) {
  width: 22%;
}
.forecast-table th:nth-child(2) {
  width: 17%;
}
.forecast-table th:nth-child(3) {
  width: 6%;
}
.forecast-table th:nth-child(4),
.forecast-table th:nth-child(5) {
  width: 11%;
}
.forecast-table th:nth-child(6) {
  width: 15%;
}
.forecast-table th:nth-child(7) {
  width: 11%;
}
.forecast-table th:nth-child(8) {
  width: 7%;
}
.forecast-budget-table th:nth-child(1) {
  width: 35%;
}
.forecast-budget-table th:nth-child(2) {
  width: 25%;
}
.forecast-budget-table th:nth-child(3) {
  width: 25%;
}
.forecast-budget-table th:nth-child(4) {
  width: 15%;
}
.forecast-rule-outside {
  opacity: 0.53;
}
.forecast-rule-expired {
  color: var(--red);
}
.forecast-added {
  display: block;
  color: var(--blue);
  font-size: 11px;
  font-weight: 400;
}
.forecast-table td:last-child button + button {
  margin-left: 4px;
}
.recurring-months,
.link-field {
  border: 1px solid var(--border);
  padding: 8px;
}
.recurring-months {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-top: 12px;
  font-size: 13px;
}
.recurring-months legend,
.link-field legend {
  padding: 0 4px;
}
.recurring-months label {
  display: flex;
  align-items: center;
  gap: 5px;
}
.category-group .config-row {
  grid-template-columns: 28px minmax(0, 1fr) 64px 80px;
}
.category-order {
  display: flex;
  gap: 2px;
}
.category-order button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--paper);
  display: grid;
  place-items: center;
}
@media (hover: hover) and (pointer: fine) {
.category-order button:hover:not(:disabled) {
  background: #ebe9e7;
}
}
.category-order button:active:not(:disabled) {
  background: #e0dbd9;
}
.category-order button:disabled {
  opacity: 0.35;
  cursor: default;
}
.category-order .icon {
  font-size: 16px;
}
.choice-picker {
  min-width: 0;
}
.choice-picker > select {
  display: none;
}
.choice-trigger {
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  text-align: left;
}
.choice-trigger > span:nth-last-child(2) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.choice-trigger .icon {
  font-size: 17px;
}
.choice-menu {
  position: fixed;
  z-index: 15;
  max-height: 235px;
  padding: 5px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--border);
  box-shadow: 0 7px 18px #0003;
}
.choice-search {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 4px 6px;
}
.choice-options button {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 28px;
  border: 0;
  background: transparent;
  text-align: left;
}
@media (hover: hover) and (pointer: fine) {
.choice-options button:hover {
  background: #ebe9e7;
}
}
.choice-options button:active {
  background: #e0dbd9;
}
.choice-options button[aria-selected='true'] {
  background: #f2ebe8;
  font-weight: 600;
}
.choice-options .icon {
  font-size: 17px;
}
.dialog-actions {
  position: relative;
}
#editor-delete-popover {
  position: absolute;
  bottom: calc(100% - 1px);
  left: 14px;
  z-index: 5;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--paper);
  box-shadow: 0 6px 20px #0003;
  font-size: 13px;
}
.app {
  user-select: none;
}
.app
  :is(
    input,
    textarea,
    .op-name,
    .op-sub,
    .account-table-name,
    .config-row strong,
    .forecast-table strong,
    .amount-cell,
    .kpi-number
  ) {
  user-select: text;
}
@media (max-width: 680px) {
  .recurring-months {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .category-group .config-row {
    grid-template-columns: 24px minmax(0, 1fr) 64px 80px;
  }
  .category-group .config-row > button {
    grid-column: 4;
  }
}

.forecast-rule-expired :is(td, .forecast-amount, strong) {
  color: var(--red);
}
.forecast-rule-expired [data-remove-expired] {
  color: var(--red);
}

/* Affectation automatique par catégorie. */
.auto-category-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px 12px;
  max-height: 180px;
  overflow: auto;
}
.auto-category-list label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auto-category-list small,
.auto-categories-note,
.auto-budget-hint {
  color: var(--muted);
}
.auto-categories-note,
.auto-budget-hint {
  margin: 8px 0 0;
  font-size: 13px;
}

/* Colonne « Modifier » ajoutée entre le pointage et les options. */
:where(table:not(.data-table)) th:nth-child(9),
:where(table:not(.data-table)) td:nth-child(9) {
  width: 44px;
  text-align: center;
  padding: 0;
}
.operations-frame th:nth-child(9),
.operations-frame td:nth-child(9) {
  width: 5%;
}

/* Date facultative : champ et cellule mis en évidence quand elle est absente. */
.edit-field.field-missing input {
  border-color: #d08a1e !important;
  box-shadow: 0 0 0 2px rgba(208, 138, 30, 0.28);
}
.edit-field.field-missing > span::after {
  content: ' · aucune date';
  color: #b36b00;
  font-weight: 600;
}
.no-date {
  color: #b36b00;
  font-style: italic;
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
/* Survol d'une ligne : les montants colorés suivent aussi. */
tbody tr:hover .amount-cell:is(.checked-expense, .checked-income, .checked-deferred) {
  box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.04);
}
}

/* Comptes associés d'un livret, sous son nom (page Comptes). */
.account-table-links {
  display: block;
  margin: 2px 0 0 28px;
  color: var(--muted);
  font-size: 13px;
}

/* Édition directe d'une cellule d'opération. */
.inline-edit {
  width: 100%;
  min-width: 0;
  padding: 3px 5px;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 2px rgba(155, 93, 66, 0.2);
}
.inline-edit-amount {
  text-align: right;
}
/* Liste déroulante avec icônes pour la catégorie d'une ligne. */
.inline-pick {
  position: relative;
  min-width: 0;
}
.inline-pick .choice-trigger {
  min-height: 0;
  padding: 3px 5px;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(155, 93, 66, 0.2);
  color: var(--text);
}
.inline-pick .choice-menu {
  z-index: 40;
}
.inline-pick .choice-menu[hidden] {
  display: none;
}
.forecast-actions-all {
  padding: 0 0 10px;
}

/* Blocs de soldes : fond du « Disponible » selon le signe, prévisionnel léger et réel appuyé. */
.available-kpi.kpi-positive {
  background: #e6f4e3;
}
.available-kpi.kpi-negative {
  background: #f8e5e5;
}
.available-kpi.kpi-zero {
  background: #edeae8;
}
.kpi-number.zero {
  color: var(--muted);
}
.available-kpi .kpi-number,
.kpi-pair > div:first-child .kpi-number,
.savings-cell .mini-forecast b {
  font-weight: 400;
}
.kpi-pair > div:last-child .kpi-number,
.savings-cell .mini-real b {
  font-weight: 700;
}

/* Paiements différés : fond jaune seulement, textes et icône comme les autres blocs. */
.deferred-kpi {
  background: var(--deferred-bg, #fbe9d6);
}

/* Bandeau d'indicateurs : une seule carte (Disponible, soldes, différés). */
.kpi-strip {
  height: auto;
  min-height: 92px;
}
.available-kpi {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 190px;
  padding-inline: 14px;
}
.available-kpi .kpi-number {
  font-size: 26px;
  font-weight: 600;
  min-width: 0;
}
.kpi-pair {
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.kpi-pair > div {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: baseline;
  gap: 22px;
  min-width: 220px;
}
.kpi-pair .kpi-number {
  margin-top: 0;
}
.kpi-pair > div:first-child .kpi-number {
  font-weight: 500;
}

/* Livrets associés : bas du panneau des enveloppes. */
.linked-savings {
  flex: none;
  background: var(--paper);
  border: 1px solid var(--border);
  padding: 6px 8px 8px;
}
.ls-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 82px;
  gap: 6px;
  align-items: baseline;
  padding: 3px 0;
  font-size: 13px;
}
.ls-head {
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 4px;
}
.ls-head span:nth-child(n + 2),
.ls-row b {
  text-align: right;
  white-space: nowrap;
}
.ls-head span:first-child {
  font-weight: 600;
}
.ls-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ls-forecast {
  font-weight: 500;
}
.ls-real {
  font-weight: 700;
}

/* Stats du mois : barre de totaux sous le tableau des opérations. */
.month-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.stats-title {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  font-weight: 600;
  white-space: nowrap;
}
.stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-left: 1px solid var(--border);
}
.stat span {
  color: var(--muted);
}
.stat b {
  font-weight: 600;
  white-space: nowrap;
}

/* Livrets associés : colonnes de montants adaptées au plus grand chiffre. */
.linked-savings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  column-gap: 14px;
}
.linked-savings .ls-row {
  display: contents;
}
.linked-savings .ls-row > * {
  padding: 3px 0;
}
.linked-savings .ls-head > * {
  padding-bottom: 4px;
}
.ls-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  padding-bottom: 2px;
}

/* Bulles d'aide. */
.info-btn {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.info-btn .icon {
  font-size: 15px;
}
@media (hover: hover) and (pointer: fine) {
.info-btn:hover {
  color: var(--text);
}
}
#dropdown-menu.info-menu {
  width: 300px;
  padding: 10px 12px;
}
.info-pop strong {
  display: block;
  margin-bottom: 4px;
}
.info-pop p {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 400;
  white-space: normal;
}
.info-pop em {
  font-style: normal;
  font-weight: 600;
}

/* Aucune enveloppe : fond grisé comme les tableaux vides. */
.envelope-list {
  background: var(--page);
}

/* Bandeau du nom de compte : rien à cliquer {
  background: var(--paper) !important;
}
@media (hover: hover) and (pointer: fine) {
donc pas de survol. */
.account-heading:hover {
  background: var(--paper) !important;
}
}

.envelope-card {
  background: var(--paper);
}

/* Boutons d'action en icône : même look que les boutons de ligne des opérations. */
.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 36px;
  height: 39px;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--muted) !important;
  cursor: pointer;
}
.icon-action .icon {
  font-size: 19px;
}
html[data-theme='dark'] .icon-action {
  color: #dacec9 !important;
}
.icon-action.danger,
html[data-theme='dark'] .icon-action.danger {
  color: var(--red) !important;
}
.forecast-table td:last-child {
  width: 76px;
}
.forecast-table-scroll {
  overflow-y: hidden;
}
#tooltip {
  position: fixed;
  z-index: 60;
  max-width: 260px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #33251f;
  color: #faf6f4;
  font-size: 12px;
  line-height: 1.3;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
html[data-theme='dark'] #tooltip {
  background: #f1ebe9;
  color: #201a17;
}

/* Prévision terminée : toute la ligne en rouge. */
tr.forecast-rule-expired > td {
  background: var(--danger-bg, #f8e5e5);
}

.app-clock {
  margin-left: auto;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font:
    13px Poppins,
    sans-serif;
  color: var(--muted);
  white-space: nowrap;
}
.app-clock .clock-time {
  font-weight: 600;
  color: var(--text);
}
@media (max-width: 900px) {
  .app-clock .clock-date {
    display: none;
  }
}

@media (hover: hover) and (pointer: fine) {
/* Survol des boutons de ligne : nettement plus marqué que le survol de la ligne. */
.row-action:hover,
.icon-action:hover {
  background: var(--hover-button) !important;
}
}
.row-action:active,
.icon-action:active {
  background: var(--pressed-button) !important;
}

/* En-tête : fil d'Ariane, puis sélecteur de mois et date. */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}
.account-heading {
  padding-left: 0;
}

/* Glisser-déposer. */
[data-category-name][draggable='true'],
[data-account-row][draggable='true'] {
  cursor: grab;
}
.dragging {
  opacity: 0.4;
}
.config-row.drop-before {
  box-shadow: inset 0 3px 0 var(--blue);
}
.config-row.drop-after {
  box-shadow: inset 0 -3px 0 var(--blue);
}
tr.drop-before > td {
  box-shadow: inset 0 3px 0 var(--blue);
}
tr.drop-after > td {
  box-shadow: inset 0 -3px 0 var(--blue);
}

/* ===== Passe finale : en-tête, boutons de ligne, grips, états des prévisions ===== */
.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-clock {
  margin-left: 0;
  padding: 0;
  font-size: 15px;
}
.account-heading {
  width: fit-content;
  height: auto;
  min-height: 0;
  background: transparent;
  border: 0;
  padding: 0;
}
.account-heading:has(.month-controls[hidden]) {
  display: none;
}
.month-controls {
  height: 34px;
  border: 1px solid var(--border);
  background: var(--paper);
}
.month-controls > button:first-child {
  border-left: 0;
}

/* Boutons de ligne : cellule pleine hauteur, séparée par une bordure, comme les opérations. */
.icon-action {
  width: 100%;
  min-width: 40px;
}
.forecast-rule-table td.action-cell {
  width: 44px;
  padding: 0 !important;
}
.forecast-rule-table tbody td:nth-last-child(3) {
  text-align: right;
}
.category-group .config-row {
  grid-template-columns: 20px 28px minmax(0, 1fr) auto auto !important;
  padding: 0 0 0 8px;
  gap: 8px;
}
.category-group .config-row > .grip,
.accounts-table .grip {
  font-size: 18px;
  color: var(--muted);
  cursor: grab;
}
.category-group .config-row > button {
  grid-column: auto !important;
}
.category-order {
  align-self: stretch;
  gap: 0;
}
.category-order button,
.category-group .config-row > .icon-action,
.account-table-order button,
.account-table-favorite button,
.account-table-action button {
  align-self: stretch;
  width: 44px;
  height: auto;
  min-height: 39px;
  border: 0 !important;
  border-left: 1px solid var(--border) !important;
  border-radius: 0;
  background: transparent !important;
  color: var(--muted) !important;
}
.account-table-order button:first-child{
  border-left: 0 !important;
}
html[data-theme='dark'] :is(.category-order button, .account-table-order button, .account-table-favorite button, .account-table-action button, .config-row > .icon-action) {
  color: #dacec9 !important;
}
@media (hover: hover) and (pointer: fine) {
.category-order button:hover:not(:disabled),
.account-table-order button:hover:not(:disabled),
.account-table-favorite button:hover,
.account-table-action button:hover,
.category-group .config-row > .icon-action:hover {
  background: var(--hover-button) !important;
}
}
.category-order button:active:not(:disabled),
.account-table-order button:active:not(:disabled),
.account-table-favorite button:active,
.account-table-action button:active {
  background: var(--pressed-button) !important;
}
.category-order button:disabled,
.account-table-order button:disabled {
  opacity: 0.35;
}
.account-table-favorite button[aria-pressed='true'] {
  color: var(--olive) !important;
}
.accounts-table td.account-table-order,
.accounts-table td.account-table-favorite,
.accounts-table td.account-table-action {
  padding: 0;
}
.account-table-order > div {
  display: flex;
  height: 100%;
}
.account-table-order button,
.account-table-favorite button,
.account-table-action button {
  width: 100%;
  height: 39px;
}
.account-table-order button + button {
  border-left: 1px solid var(--border) !important;
}

/* Prévisions : lignes hors période en gris, éléments modifiables signalés au survol. */
tr.forecast-rule-outside > td {
  background: var(--page);
}
.forecast-rule-outside {
  opacity: 0.72;
}
@media (hover: hover) and (pointer: fine) {
#operation-rows td:is(:nth-child(2), :nth-child(3), :nth-child(4), :nth-child(6)):hover,
.forecast-rule-table tbody td:is(:nth-child(1), :nth-child(2), :nth-child(3), :nth-child(4), :nth-child(5), :nth-child(6), :nth-child(7)):hover {
  outline: 1px dashed var(--muted);
  outline-offset: -3px;
  cursor: text;
}
}

/* ===== Correctifs : espacements, désactivés, grips, étiquettes de compte, mois ===== */
.category-group .config-row {
  gap: 0 !important;
}
.category-group .config-row > .grip {
  align-self: center;
  justify-self: center;
}
.category-group .config-row > .icon:not(.grip),
.category-group .config-row > strong {
  margin-left: 8px;
}
.category-group .config-row > .category-order {
  margin-left: 8px;
}
.category-order button,
.account-table-order button {
  flex: 1;
  padding: 0 !important;
  opacity: 1 !important;
}
.category-order button:disabled .icon,
.account-table-order button:disabled .icon {
  opacity: 0.35;
}
.account-table-order > div {
  gap: 0 !important;
  justify-content: stretch !important;
}
.account-table-action button,
.account-table-favorite button {
  padding: 0 !important;
}
.account-table-name {
  align-items: center;
}
.accounts-table .grip {
  align-self: center;
}

/* Étiquette de compte (virements). */
.account-chip,
.transfer-counterparty strong {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--blue) 14%, var(--paper));
  color: var(--text);
  font-weight: 600;
}

/* Choix des mois d'une prévision. */
#dropdown-menu.months-menu {
  width: 250px;
  max-width: calc(100vw - 16px);
  padding: 10px;
}
.months-pop strong {
  display: block;
  margin-bottom: 6px;
}
.months-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}
.months-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}
.months-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.months-actions button {
  flex: 1;
  justify-content: center;
  text-align: center;
}

/* Lignes d'opération avec seconde ligne d'information : plus d'air. */
#operation-rows tr:has(.op-sub) > td {
  height: 58px;
}
#operation-rows .op-name + .op-sub {
  margin-top: 5px;
}
#operation-rows td .row-action {
  height: 100%;
  min-height: 39px;
}

/* Grip des comptes : centré sur toute la hauteur de la cellule. */
.accounts-table td:first-child {
  position: relative;
  padding-left: 34px;
}
.accounts-table td:first-child .grip {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
}

/* Boutons de la liste des mois : même design que les boutons des fenêtres. */
#dropdown-menu .months-actions button {
  flex: 1;
  padding: 6px 9px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text);
  font: 13px Poppins, sans-serif;
  text-align: center;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
#dropdown-menu .months-actions button:hover {
  background: var(--hover-control);
}
}
#dropdown-menu .months-actions button.save-button {
  background: var(--accent-line);
  border-color: var(--accent-line);
  color: #fff;
}
@media (hover: hover) and (pointer: fine) {
#dropdown-menu .months-actions button.save-button:hover {
  background: var(--accent-deeper);
}
}

/* Prévisionnel : un onglet par compte ; seul le contenu de l'onglet défile. */
.config-panel.forecast-page {
  overflow: hidden;
}
.config-panel.forecast-page #config-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 0;
}
.forecast-head {
  flex: none;
}
.forecast-head .config-note {
  margin-bottom: 8px;
}
.forecast-tabs {
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;
  border-bottom: 1px solid var(--border);
}
.forecast-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 -1px -1px 0;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--page);
  color: var(--muted);
  font: 600 13px Poppins, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.forecast-tab:not(.active):hover {
  background: var(--hover-control);
  color: var(--text);
}
}
.forecast-tab.active {
  position: relative;
  background: var(--paper);
  border-bottom-color: var(--paper);
  color: var(--text);
  box-shadow: inset 0 2px 0 var(--blue);
}
.forecast-tab-count {
  min-width: 18px;
  padding: 0 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}
.forecast-panels {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-top: 0;
  background: var(--paper);
}
.forecast-panels .forecast-account {
  margin: 0;
  border: 0;
  background: transparent;
}

/* Barres visibles sur les zones qui débordent, aux couleurs du thème. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--muted) var(--paper);
}

/* Sur écran tactile, conserver l'indicateur natif superposé du navigateur.
   Les règles propres aux carrousels et listes sans indicateur restent prioritaires. */
@media (hover: none) and (pointer: coarse) {
  * {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }
}

/* Firefox : conserver une barre plus facile à repérer et à saisir. */
@supports (-moz-appearance: none) {
  * {
    scrollbar-width: auto;
  }
}

.forecast-panels .forecast-account:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.forecast-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.forecast-budget-table td.action-cell {
  width: 44px;
  padding: 0 !important;
}
.forecast-budget-table td:nth-child(2),
.forecast-budget-table td:nth-child(3),
.forecast-budget-table th:nth-child(2),
.forecast-budget-table th:nth-child(3) {
  text-align: right;
}
@media (hover: hover) and (pointer: fine) {
.forecast-budget-table tbody td:is(:nth-child(1), :nth-child(2), :nth-child(3)):hover {
  outline: 1px dashed var(--muted);
  outline-offset: -3px;
  cursor: text;
}
}

/* ===== Administration et design system ===== */
.admin-table td.action-cell,
.forecast-table td.action-cell {
  width: 44px;
  padding: 0 !important;
}
.admin-table td:not(.action-cell) {
  white-space: normal;
}
.role-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 1px;
  background: var(--page);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.role-badge.admin {
  background: color-mix(in srgb, var(--blue) 14%, var(--paper));
  border-color: color-mix(in srgb, var(--blue) 40%, var(--border));
  color: var(--text);
}
.danger-button {
  padding: 6px 9px;
  border: 1px solid var(--red);
  background: transparent;
  color: var(--red);
  font: 13px Poppins, sans-serif;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.danger-button:hover {
  background: var(--danger-bg);
}
}
.admin-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
  align-items: end;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--page);
}
.admin-form h4 {
  grid-column: 1 / -1;
  margin: 0;
}
.admin-form label,
.admin-inline-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.admin-form input:not([type='checkbox']),
.admin-inline-form input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text);
  font: 13px Poppins, sans-serif;
}
.admin-form .admin-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.admin-form .dialog-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  border: 0;
}
.admin-password {
  display: flex;
}
.admin-password input {
  flex: 1;
}
.admin-password button {
  width: 36px;
  border: 1px solid var(--border);
  border-left: 0;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
}
.admin-message {
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--blue) 10%, var(--paper));
  font-size: 13px;
}
.admin-inline > td {
  padding: 10px 12px !important;
  background: var(--page);
}
.admin-inline-danger > td {
  background: var(--danger-bg);
}
.admin-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 10px;
  font-size: 13px;
}
.admin-inline-form label {
  flex: 1 1 260px;
}
.admin-inline-form > button,
.admin-inline-form > span {
  white-space: normal;
}
.admin-inline-form > button:not(.danger-button):not(.save-button) {
  padding: 6px 9px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text);
  font: 13px Poppins, sans-serif;
  cursor: pointer;
}
.admin-inline-form .save-button {
  padding: 6px 9px;
  border: 1px solid var(--accent-line);
  background: var(--accent-line);
  color: #fff;
  font: 13px Poppins, sans-serif;
  cursor: pointer;
}
.admin-inline-form small {
  flex-basis: 100%;
  color: var(--muted);
}
.admin-inline-form .icon {
  font-size: 16px;
  vertical-align: -3px;
  margin-right: 4px;
}
.ds {
  padding: 12px 14px;
}
.ds-section {
  margin-bottom: 22px;
}
.ds-section h3 {
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.ds-section h4 {
  margin: 12px 0 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ds-rules {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  line-height: 1.45;
}
.ds-rules code {
  padding: 0 4px;
  background: var(--page);
  font-size: 12px;
}
.ds-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.ds-swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--border);
}
.ds-swatch small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.ds-swatch strong {
  font-size: 13px;
}
.ds-chip {
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
}
.ds-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

/* Tableau des utilisateurs : colonnes assez larges pour leur contenu. */
.admin-table {
  min-width: 860px;
  table-layout: auto;
}
.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
  min-width: 140px;
}
.admin-table th:nth-child(2),
.admin-table td:nth-child(2) {
  min-width: 200px;
}
.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
  min-width: 160px;
  width: 160px;
  overflow: visible;
}
.admin-table th:nth-child(4),
.admin-table td:nth-child(4),
.admin-table th:nth-child(5),
.admin-table td:nth-child(5) {
  min-width: 140px;
  white-space: nowrap;
}
.admin-table .role-badge {
  max-width: 100%;
}

/* ===== Confirmations : même présentation partout (menus et fenêtre d'édition) ===== */
#dropdown-menu.confirm-menu {
  padding: 0;
  min-width: 250px;
  max-width: min(310px, calc(100vw - 16px));
}
.confirm-title {
  padding: 12px 14px 4px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}
.confirm-text {
  padding: 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
#dropdown-menu.confirm-menu .menu-date {
  padding: 6px 14px 0;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px;
}
#dropdown-menu.confirm-menu .confirm-actions button,
#editor-delete-popover button {
  width: auto;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text);
  font: 13px Poppins, sans-serif;
  text-align: center;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
#dropdown-menu.confirm-menu .confirm-actions button:hover,
#editor-delete-popover button:hover {
  background: var(--hover-control, #eeecea) !important;
}
}
#dropdown-menu.confirm-menu .confirm-actions button:active,
#editor-delete-popover button:active {
  background: var(--pressed, #e1dddb) !important;
}
#dropdown-menu.confirm-menu .confirm-actions button.confirm-danger,
#editor-delete-popover button.confirm-danger {
  border-color: var(--red) !important;
  background: transparent !important;
  color: var(--red) !important;
}
@media (hover: hover) and (pointer: fine) {
#dropdown-menu.confirm-menu .confirm-actions button.confirm-danger:hover,
#editor-delete-popover button.confirm-danger:hover {
  background: var(--danger-bg) !important;
}
}
#dropdown-menu.confirm-menu .confirm-actions button.confirm-primary,
#editor-delete-popover button.confirm-primary {
  border-color: var(--accent) !important;
  background: var(--accent) !important;
  color: #fff !important;
}
@media (hover: hover) and (pointer: fine) {
#dropdown-menu.confirm-menu .confirm-actions button.confirm-primary:hover,
#editor-delete-popover button.confirm-primary:hover {
  background: var(--accent-hover) !important;
}
}
#editor-delete-popover {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 8px;
  padding: 12px 14px;
  min-width: 260px;
}
#editor-delete-popover span {
  flex: 1 1 100%;
  font-weight: 600;
  font-size: 14px;
}

/* Sélecteur de design (page Administration). */
.ds-design {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 170px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text);
  text-align: left;
}
.ds-design small {
  color: var(--muted);
}
@media (hover: hover) and (pointer: fine) {
.ds-design:hover {
  background: var(--hover-control);
}
}
.ds-design[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.ds-lead {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.45;
}

/* Boutons destructifs : fond rouge plein, comme le bouton principal mais en rouge. */
:root {
  --danger-solid: #b03c3c;
  --danger-solid-hover: #9a3232;
}
html[data-theme='dark'] {
  --danger-solid: #b3363f;
  --danger-solid-hover: #c24049;
}
#editor-delete,
.danger-button,
#dropdown-menu.confirm-menu .confirm-actions button.confirm-danger,
#editor-delete-popover button.confirm-danger {
  border-color: var(--danger-solid) !important;
  background: var(--danger-solid) !important;
  color: #fff !important;
}
@media (hover: hover) and (pointer: fine) {
#editor-delete:hover,
.danger-button:hover,
#dropdown-menu.confirm-menu .confirm-actions button.confirm-danger:hover,
#editor-delete-popover button.confirm-danger:hover {
  border-color: var(--danger-solid-hover) !important;
  background: var(--danger-solid-hover) !important;
}
}
#editor-delete:active,
.danger-button:active {
  background: var(--danger-solid-hover) !important;
  filter: brightness(0.92);
}

/* Fil d'Ariane au-dessus du sélecteur de mois. */
.page-top {
  justify-content: flex-start;
  gap: 2px;
  min-height: 20px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.page-top .icon {
  font-size: 17px;
}
.page-top #account-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
/* Comptes associés d'un livret : étiquettes avec icône, à la place d'une liste en texte. */
.associations-kpi #account-associations {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 360px;
  color: var(--text);
}
.associations-kpi .account-chip .icon {
  font-size: 15px;
}
.associations-kpi .associations-none {
  color: var(--muted);
}

/* Comptes associés : contenu aligné en haut, comme les autres blocs. */
.associations-kpi {
  justify-content: flex-start;
}

/* Bénéficiaires : intertitres des groupes (favoris puis autres). */
.accounts-table .accounts-subheading > td {
  padding: 5px 10px;
  background: var(--hover-surface, #f4f3f2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.accounts-subheading .icon {
  font-size: 14px;
  margin-right: 4px;
  vertical-align: -2px;
  font-variation-settings: 'FILL' 1;
  color: var(--olive);
}
/* Étoile des favoris : pleine et colorée quand elle est active, contour discret sinon. */
.account-table-favorite button[aria-pressed='true'] {
  color: var(--olive) !important;
  background: color-mix(in srgb, var(--olive) 16%, var(--paper)) !important;
}
.account-table-favorite button[aria-pressed='true'] .icon {
  font-variation-settings: 'FILL' 1;
}
@media (hover: hover) and (pointer: fine) {
.account-table-favorite button[aria-pressed='true']:hover {
  background: color-mix(in srgb, var(--olive) 26%, var(--paper)) !important;
}
}

/* Page Comptes : boutons d'ordre, de favori et d'action sur toute la hauteur de la ligne
   (les livrets ont un nom sur deux lignes, donc des lignes plus hautes). */
.accounts-table tbody tr {
  height: 39px;
}
.accounts-table td.account-table-order,
.accounts-table td.account-table-favorite,
.accounts-table td.account-table-action {
  position: relative;
  padding: 0;
}
.accounts-table td.account-table-order > div {
  position: absolute;
  inset: 0;
  display: flex;
}
.accounts-table td.account-table-order > div > button {
  flex: 1;
  width: auto;
  height: 100%;
  min-height: 0;
}
.accounts-table td.account-table-favorite > button,
.accounts-table td.account-table-action > button {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Bouton « Valider » du bloc des paiements différés. */
.deferred-kpi {
  position: relative;
}
.deferred-kpi .kpi-title {
  padding-right: 28px; /* place réservée au bouton, qu'il soit visible ou non */
}
.kpi-validate {
  position: absolute;
  top: 6px;
  right: 8px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-s, 0);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.kpi-validate > span:not(.icon) {
  display: none;
}
.kpi-validate[hidden] {
  display: none;
}
.kpi-validate .icon {
  font-size: 18px;
}
@media (hover: hover) and (pointer: fine) {
.kpi-validate:hover {
  background: var(--hover-control, #f0eeec);
  color: var(--text);
}
}
.kpi-validate:active {
  background: var(--pressed, #e5e2df);
}
.menu-check {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 2px;
  font-size: 13px;
}

/* Mise en évidence d’une ligne depuis l’historique (« Voir »). */
@keyframes hist-flash {
  0%,
  60% {
    box-shadow: inset 0 0 0 2px var(--accent, #c17a5b);
    background-color: color-mix(in srgb, var(--accent, #c17a5b) 18%, transparent);
  }
  100% {
    box-shadow: inset 0 0 0 2px transparent;
    background-color: transparent;
  }
}
.hist-flash,
.hist-flash > td {
  animation: hist-flash 2.6s ease-out;
}

/* ======================================================================
   Composants de formulaire partagés : sélecteur segmenté, accordéon,
   pastilles à cocher, grille d'icônes, zone d'affectation aux enveloppes.
   Ils ne reposent que sur les variables de thème (couleurs, rayons).
   ====================================================================== */
/* Compatibilité des anciens thèmes : ui.css définit le composant Doudapp.
   Cette couche reste moins prioritaire que les composants actuels. */
@layer legacy-controls {
  .segmented {
    display: inline-flex;
    flex-wrap: wrap;
    align-self: flex-start;
    max-width: 100%;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s, 2px);
    background: #fff;
  }
  html[data-theme='dark'] .segmented {
    background: #2c211c;
  }
  .segmented > button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 5px 12px;
    border: 0;
    border-radius: max(0px, calc(var(--radius-s, 2px) - 2px));
    background: transparent;
    color: var(--text);
    font: 500 13px Poppins, sans-serif;
    cursor: pointer;
  }
  @media (hover: hover) and (pointer: fine) {
.segmented > button:hover {
    background: var(--hover-control, #f0e9e6);
  }
}
  .segmented > button[aria-checked='true'] {
    background: var(--accent-line, #905136);
    color: #fff;
    font-weight: 600;
  }
  .segmented > button[hidden] {
    display: none;
  }
  .segmented > button .icon {
    font-size: 17px;
  }
  .segmented > button:focus-visible {
    outline: 2px solid var(--accent-line, #905136);
    outline-offset: 1px;
  }
}
.seg-field {
  align-items: flex-start;
}

.edit-field.span-all,
.edit-grid > .span-all,
.transfer-accounts {
  grid-column: 1 / -1;
}
.edit-grid + .edit-grid,
.accordion + .edit-grid,
.seg-field + .edit-grid,
.seg-field + .seg-field,
.edit-grid + .seg-field,
.edit-grid + .icon-field,
.seg-field + .icon-field,
.edit-field + .seg-field,
.edit-grid + .field-help,
.seg-field + .link-field {
  margin-top: 10px;
}

@layer legacy-controls {
  /* Accordéon d'en-tête : le résumé reste visible, le détail se déplie. */
  .accordion {
    margin: -14px -14px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--hover-surface, #f4f1f0);
  }
  .accordion-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    font: 13px Poppins, sans-serif;
    cursor: pointer;
  }
  @media (hover: hover) and (pointer: fine) {
.accordion-head:hover {
    background: var(--hover-control, #f0e9e6);
  }
}
  .accordion-summary {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
  }
  .accordion-summary strong {
    font-size: 13px;
    font-weight: 600;
  }
  .accordion-summary small {
    color: var(--muted);
    font-size: 13px;
  }
  .accordion-badge {
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s, 2px);
    background: var(--paper);
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
  }
  .accordion-badge[hidden] {
    display: none;
  }
  .accordion-chevron {
    color: var(--muted);
    transition: transform 0.15s;
  }
  .accordion.is-open .accordion-chevron {
    transform: rotate(180deg);
  }
  .accordion-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 14px 14px;
  }
  .accordion-body[hidden] {
    display: none;
  }

}

/* Virement : compte débiteur → compte créditeur. */
.transfer-accounts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}
.transfer-accounts[hidden] {
  display: none;
}
.transfer-arrow {
  align-self: end;
  padding-bottom: 6px;
  color: var(--muted);
}

/* Affectation aux enveloppes. */
.allocation-editor .alloc-title {
  display: block;
  font-size: 14px;
}
.allocation-editor .auto-budget {
  margin-top: 8px;
}
.alloc-manual {
  margin-top: 8px;
}
.alloc-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}
.alloc-box {
  padding: 8px;
  border: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent);
  border-radius: var(--radius-s, 2px);
  text-align: center;
}
.alloc-box .alloc-empty {
  margin: 6px 0;
  color: var(--muted);
  font-size: 13px;
}
.alloc-box:has(.allocation-row) .alloc-empty {
  display: none;
}
.alloc-box #allocation-rows {
  text-align: left;
}
.alloc-box #add-allocation {
  margin-top: 4px;
}
.allocation-editor .alloc-note {
  margin: 8px 0 0;
}
.adjust-allocation .icon {
  font-size: 18px;
}

@layer legacy-controls {
  /* Pastilles à cocher (catégories automatiques, mois, comptes associés). */
  .chip-check {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s, 2px);
    background: var(--paper);
    font-size: 13px;
    cursor: pointer;
  }
  @media (hover: hover) and (pointer: fine) {
.chip-check:hover {
    background: var(--hover-surface, #f4f1f0);
  }
}
  .chip-check:has(input:checked) {
    border-color: var(--accent-line, #905136);
    background: color-mix(in srgb, var(--accent-line, #905136) 14%, var(--paper));
  }
  .chip-check .icon {
    font-size: 18px;
    color: var(--muted);
  }
  .chip-check .chip-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chip-check small {
    color: var(--muted);
    font-size: 12px;
  }
  .chip-check.is-taken:not(:has(input:checked)) {
    opacity: 0.6;
  }
}

.auto-category-list,
.link-field {
  --gap: 6px;
}
.link-field:has(.chip-check) {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.link-field:has(.chip-check) > legend {
  flex-basis: 100%;
}
.link-field:has(.chip-check) > .chip-check {
  margin: 0;
}
.link-field[hidden] {
  display: none;
}
.auto-categories,
.recurring-months.link-field {
  display: block !important;
}
.link-field > .auto-category-list {
  flex: 1 1 100%;
}
.auto-category-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 210px;
  padding: 2px;
}
.months-chips {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: none;
}
@media (max-width: 680px) {
  .auto-category-list {
    grid-template-columns: 1fr;
  }
  .months-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .transfer-accounts {
    grid-template-columns: 1fr;
  }
  .transfer-arrow {
    justify-self: center;
    padding: 0;
    transform: rotate(90deg);
  }
}
.recurring-months {
  margin-top: 10px;
}

/* Info-bulle explicative d'un champ. */
.info-tip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 3px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  vertical-align: middle;
  cursor: help;
}
.info-tip .icon {
  font-size: 16px;
}
@media (hover: hover) and (pointer: fine) {
.info-tip:hover {
  color: var(--text);
}
}
.field-help {
  margin: 6px 0 0;
  padding: 7px 9px;
  border-left: 3px solid var(--accent-line, #905136);
  background: var(--hover-surface, #f4f1f0);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.field-help[hidden] {
  display: none;
}

/* Grille d'icônes visuelle (catégories, comptes). */
.icon-field .icon-field-name {
  margin-left: 6px;
  color: var(--text);
  font-weight: 600;
}
.chip-check.is-taken {
  flex-wrap: wrap;
}
.chip-check.is-taken small {
  flex-basis: 100%;
  padding-left: 24px;
}

/* Les blocs repliés ou masqués le restent, même quand une règle d'affichage plus haut les rendrait visibles. */
.auto-categories[hidden],
.recurring-months[hidden],
.link-field[hidden] {
  display: none !important;
}

/* Comptes : l'icône est centrée sur toute la hauteur du bloc (nom + comptes associés), comme le grip. */
.account-table-name .account-table-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.account-table-name {
  align-items: center;
}
.account-table-name .account-table-links {
  margin: 2px 0 0;
}

/* Modales sans accordéon (catégorie, compte) : blocs espacés régulièrement, comme dans les autres modales. */
.editor-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.editor-stack > * {
  margin-top: 0 !important;
}

/* Icônes pleines par défaut ; l'étoile des favoris reste en contour tant qu'elle n'est pas active. */
.account-table-favorite button:not([aria-pressed='true']) .icon {
  font-variation-settings: 'FILL' 0;
}

/* Fenêtres (modales) : fond un peu plus foncé que les champs, pour que les champs ressortent. */
:root {
  --dialog-bg: #f2ebe7;
  --field-bg: #fdfbfa;
  --bar-s: 36%;
  --bar-l: 48%;
}
html[data-theme='dark'] {
  --dialog-bg: #2b211c;
  --field-bg: #342a25;
  --bar-s: 32%;
  --bar-l: 55%;
}
html:root:root:root :is(#editor-dialog, #action-dialog, #release-dialog, #users-dialog, #import-dialog) {
  background: var(--dialog-bg);
}
html:root:root:root
  :is(#editor-dialog, #action-dialog, #release-dialog, #users-dialog, #import-dialog)
  :is(.dialog-heading, .dialog-actions, #editor-fields) {
  background: transparent;
}
html:root:root:root
  :is(#editor-dialog, #action-dialog, #release-dialog, #users-dialog, #import-dialog)
  :is(
    input:not([type='checkbox']):not([type='radio']):not([type='range']),
    select,
    textarea
  ) {
  background-color: var(--field-bg);
}

/* Prévisionnel : lignes hors total (inactives, pas commencées ou terminées), séparées du total. */
.forecast-excluded {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
}
.forecast-subheading {
  padding: 8px 12px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.forecast-excluded-table {
  opacity: 0.8;
}
.forecast-excluded-table thead {
  visibility: collapse;
}
.forecast-none {
  color: var(--muted);
  font-style: italic;
}

/* Page « Mois par mois ». */
.months-toolbar {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  padding: 4px 0 10px;
}
.months-toolbar .config-note {
  margin: 0;
  flex: 1;
  min-width: 240px;
}
.months-account {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.months-account select {
  height: 30px;
  min-width: 180px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text);
  font: inherit;
}
.months-table th.num,
.months-table td.num {
  text-align: right;
  white-space: nowrap;
}
.months-table .months-year th,
.months-table .months-year td {
  background: var(--page);
  font-weight: 700;
  border-top: 1px solid var(--border);
}
.months-table .months-row {
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.months-table .months-row:hover > * {
  background: var(--hover-surface);
}
}
.months-table .months-row.is-current > th {
  box-shadow: inset 3px 0 0 var(--accent);
}
.months-table .months-row.is-selected > th {
  color: var(--blue);
}
.months-table .months-row > th {
  text-align: left;
  font-weight: 500;
}
.months-table td.zero {
  color: var(--muted);
}
.months-go {
  width: 40px;
}

/* Livrets : évolution du solde sur 12 mois, dans son propre bloc au-dessus des opérations. */
.ops-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}
.ops-column > .operations-panel {
  flex: 1;
  min-height: 0;
}
.ops-column:not(:has(> :not([hidden]))) {
  display: none;
}
.savings-chart {
  background: var(--paper);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.savings-chart[hidden] {
  display: none;
}
.sc-summary {
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-body {
  padding: 6px 12px 2px;
}
.sc-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 190px;
}
.sc-zero {
  stroke: var(--border);
  stroke-dasharray: 3 3;
}
.sc-area {
  fill: color-mix(in srgb, var(--accent) 14%, transparent);
}
.sc-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linejoin: round;
}
.sc-dot {
  fill: var(--paper);
  stroke: var(--accent);
  stroke-width: 2;
  cursor: default;
}
.sc-dot.is-last {
  fill: var(--accent);
}
.sc-dot:focus {
  stroke-width: 3.5;
  outline: none;
}
@media (hover: hover) and (pointer: fine) {
.sc-dot:hover {
  stroke-width: 3.5;
  outline: none;
}
}
.sc-label {
  fill: var(--muted);
  font: 500 11px Poppins, sans-serif;
}

.sc-grid {
  stroke: var(--border);
  stroke-dasharray: 2 4;
}
.months-table.forecast-table th,
.months-table.forecast-table td {
  width: auto !important;
  height: auto;
}
.months-table .months-go {
  width: 44px !important;
  padding: 0 6px;
}
.months-table .months-go .row-action {
  width: 28px;
  height: 28px;
  min-width: 0;
  padding: 0;
}
.months-table .months-row > * {
  padding-top: 7px;
  padding-bottom: 7px;
}
tr.forecast-rule-inactive > td {
  color: var(--muted);
}

/* Prévisionnel : groupes repliables, bien séparés. */
.forecast-group {
  margin: 10px 8px;
  border: 1px solid var(--border);
  background: var(--paper);
}
.forecast-group-toggle {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
}
@media (hover: hover) and (pointer: fine) {
.forecast-group-toggle:hover {
  background: var(--hover-control);
}
}
.forecast-group-toggle[aria-expanded='false'] {
  border-bottom: 0;
}
.forecast-group-toggle > .icon:first-child {
  transition: transform 0.15s;
}
.forecast-group-toggle[aria-expanded='false'] > .icon:first-child {
  transform: rotate(-90deg);
}
.forecast-group-icon {
  display: inline-flex;
  color: var(--muted);
}
.forecast-group-toggle h4 {
  margin: 0;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.forecast-group-count {
  min-width: 18px;
  padding: 0 6px;
  background: var(--hover-button, #eee);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}
.forecast-group-sum {
  margin-left: auto;
}
.forecast-group-body[hidden] {
  display: none;
}
.forecast-group-body .forecast-table-scroll {
  border: 0;
}

/* Listes déroulantes avec recherche : le champ reste fixe, seules les options défilent. */
.choice-menu {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.choice-menu[hidden] {
  display: none;
}
.choice-menu .choice-search {
  flex: none;
  margin-bottom: 4px;
}
.choice-menu .choice-options {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Essai design : textes secondaires plus lisibles, barre d'enveloppe intacte neutre. */
:root {
  --bar-calm: #b3a398;
}
html[data-theme='dark'] {
  --bar-calm: #94857a;
}
html:root:root :is(.envelope-rest, .envelope-top span, .nav-muted) {
  color: var(--muted);
}

/* Sur écran tactile, les états d'appui du design remplacent le flash natif rectangulaire. */
@media (hover: none) {
  :is(button, a, summary, label, [role='button']) {
    -webkit-tap-highlight-color: transparent;
  }
}
