
    :root {
      --primary: #C46B13;
      --primary-soft: #F4E6D8;
      --primary-dark: #9E5510;
      --ink: #2A2928;
      --muted: #7A7A7A;
      --line: #E6E2DC;
      --bg: #F7F5F2;
      --card: #FFFFFF;
      --success: #1B7F5A;
      --success-soft: #E8F5EF;
      --danger: #B42318;
      --danger-soft: #FDECEA;
      --warn: #B8860B;
      --shadow: 0 8px 32px rgba(42, 41, 40, 0.08);
      --radius: 16px;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      font-family: 'Epilogue', system-ui, sans-serif;
      background: var(--bg);
      color: var(--ink);
      min-height: 100vh;
      line-height: 1.45;
    }

    .app {
      max-width: 1440px;
      margin: 0 auto;
      padding: 24px 28px 48px;
    }

    /* Header — une seule ligne */
    .header {
      display: flex;
      align-items: center;
      gap: 20px;
      margin-bottom: 24px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--line);
      flex-wrap: nowrap;
      white-space: nowrap;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
    }

    .brand img {
      height: 36px;
      width: auto;
      flex-shrink: 0;
    }

    .brand h1 {
      font-size: 1.1rem;
      font-weight: 700;
      letter-spacing: -0.02em;
      line-height: 1;
    }

    .brand-sub {
      font-size: 0.8rem;
      color: var(--muted);
      line-height: 1;
    }

    .brand-sub::before {
      content: '—';
      margin: 0 8px;
      color: #C8C2BA;
    }

    .header-end {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-left: auto;
      flex-shrink: 0;
    }

    .header-total {
      font-size: 0.85rem;
      color: var(--muted);
    }

    .header-total-label {
      font-size: 0.72rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .header-total strong {
      font-family: 'JetBrains Mono', monospace;
      font-size: 1.05rem;
      color: var(--ink);
      font-weight: 700;
      font-variant-numeric: tabular-nums;
    }

    /* Tabs */
    .tabs {
      display: flex;
      gap: 6px;
      margin: 0;
      background: var(--card);
      padding: 4px;
      border-radius: 10px;
      box-shadow: var(--shadow);
      flex-shrink: 0;
    }

    .tab {
      border: none;
      background: transparent;
      font-family: inherit;
      font-size: 0.82rem;
      font-weight: 600;
      padding: 8px 14px;
      border-radius: 7px;
      cursor: pointer;
      color: var(--muted);
      transition: all 0.2s;
      white-space: nowrap;
    }

    .tab.active {
      background: var(--primary);
      color: white;
    }

    .tab:hover:not(.active) {
      background: var(--primary-soft);
      color: var(--primary-dark);
    }

    .view { display: none; }
    .view.active { display: block; }

    /* Organigramme */
    .orga-canvas {
      position: relative;
      background: linear-gradient(160deg, #FAFAF8 0%, #F0EBE4 100%);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: 24px 56px 48px;
      min-height: 720px;
      overflow: visible;
    }

    .orga-canvas::before {
      content: '';
      position: absolute;
      inset: 0;
      background:
        radial-gradient(circle at 50% 45%, rgba(196, 107, 19, 0.06) 0%, transparent 55%),
        repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(42,41,40,0.03) 39px, rgba(42,41,40,0.03) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(42,41,40,0.03) 39px, rgba(42,41,40,0.03) 40px);
      pointer-events: none;
    }

    .orga-layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 252px minmax(0, 1fr);
      gap: 16px 20px;
      align-items: start;
      position: relative;
      z-index: 1;
    }

    .orga-col {
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding-top: 8px;
    }

    .orga-col.right { align-items: flex-end; }
    .orga-col.left { align-items: flex-start; }

    .entity-card {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 14px 16px;
      width: 100%;
      max-width: 300px;
      box-shadow: 0 4px 16px rgba(42,41,40,0.05);
      transition: transform 0.2s, box-shadow 0.2s;
      position: relative;
    }

    .entity-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(42,41,40,0.1);
      border-color: var(--primary-soft);
    }

    .entity-card::after {
      content: '';
      position: absolute;
      top: 50%;
      width: 16px;
      height: 2px;
      background: linear-gradient(90deg, var(--primary), transparent);
      opacity: 0.35;
      pointer-events: none;
    }

    .orga-col.left .entity-card::after {
      right: -16px;
    }

    .orga-col.right .entity-card::after {
      left: -16px;
      background: linear-gradient(270deg, var(--primary), transparent);
    }

    .entity-head {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      margin: 0 0 10px;
      padding: 0;
      border: none;
      background: none;
      font: inherit;
      text-align: left;
      cursor: pointer;
      color: inherit;
    }

    .entity-head:hover .entity-name {
      color: var(--primary-dark);
    }

    .entity-chevron {
      margin-left: auto;
      flex-shrink: 0;
      font-size: 0.65rem;
      color: var(--muted);
      transition: transform 0.2s ease;
    }

    .entity-card:not(.is-collapsed) .entity-chevron {
      transform: rotate(180deg);
    }

    .entity-card.is-collapsed .accounts {
      display: none;
    }

    .entity-card.is-collapsed .entity-head {
      margin-bottom: 8px;
    }

    .entity-card.is-collapsed .entity-total {
      margin-top: 0;
      padding-top: 0;
      border-top: none;
    }

    .entity-head img {
      height: 36px;
      width: auto;
      max-width: 80px;
      object-fit: contain;
    }

    .entity-name {
      font-size: 0.78rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--ink);
      line-height: 1.2;
    }

    .accounts {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .account-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.78rem;
      padding: 4px 8px;
      border-radius: 6px;
      background: #FAFAF8;
    }

    .account-row .bank {
      font-weight: 600;
      color: var(--muted);
      font-size: 0.7rem;
      letter-spacing: 0.06em;
    }

    .account-row .amount {
      font-family: 'JetBrains Mono', monospace;
      font-weight: 500;
      font-size: 0.8rem;
    }

    .entity-total {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px dashed var(--line);
      display: flex;
      justify-content: space-between;
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--primary-dark);
    }

    /* Centre hub */
    .hub {
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      align-self: start;
      justify-self: center;
      width: 252px;
      flex-shrink: 0;
      padding-top: 0;
      position: sticky;
      top: 16px;
    }

    .hub-ring {
      width: 252px;
      height: 252px;
      border-radius: 50%;
      background: var(--card);
      border: 3px solid var(--primary);
      box-shadow:
        0 0 0 8px rgba(196, 107, 19, 0.07),
        var(--shadow);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px;
      box-sizing: border-box;
    }

    .hub-inner {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 14px;
      width: 100%;
      max-width: 168px;
    }

    .hub-ring img {
      height: 68px;
      width: auto;
      max-width: 100%;
      flex-shrink: 0;
    }

    .hub-accounts {
      width: 100%;
      display: flex;
      flex-direction: column;
      gap: 5px;
      font-size: 0.72rem;
    }

    .hub-accounts .account-row {
      background: var(--primary-soft);
      width: 100%;
      box-sizing: border-box;
    }

    .hub-totals {
      margin-top: 14px;
      width: 100%;
    }

    .total-pill {
      background: var(--card);
      border: 2px solid var(--line);
      border-radius: 12px;
      padding: 12px 16px;
      margin-bottom: 8px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .total-pill.highlight {
      border-color: var(--primary);
      background: linear-gradient(135deg, #FFF 0%, var(--primary-soft) 100%);
    }

    .total-pill .label {
      font-size: 0.72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--muted);
    }

    .total-pill .value {
      font-family: 'JetBrains Mono', monospace;
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--ink);
    }

    .total-pill.highlight .value {
      color: var(--primary-dark);
      font-size: 1.25rem;
    }

    .verify-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-top: 8px;
      font-size: 0.72rem;
      color: var(--success);
      font-weight: 600;
    }

    .verify-badge::before {
      content: '✓';
      background: var(--success-soft);
      color: var(--success);
      width: 18px;
      height: 18px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.65rem;
    }

    /* Calendrier — bandeau + en-têtes colonnes fixes */
    .cal-sticky-top {
      position: sticky;
      top: 0;
      z-index: 10;
    }

    .cal-banner {
      margin-bottom: 0;
      background: linear-gradient(180deg, #F3EDE4 0%, #EDE6DC 100%);
      border: 1px solid #DDD4C8;
      border-bottom: none;
      border-radius: 12px 12px 0 0;
      box-shadow: 0 2px 12px rgba(42, 41, 40, 0.06);
    }

    table.cal.cal-head {
      border-radius: 0;
      box-shadow: 0 2px 8px rgba(42, 41, 40, 0.08);
    }

    .cal-banner-row {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 10px 16px;
      flex-wrap: nowrap;
      white-space: nowrap;
      overflow: hidden;
    }

    .cal-banner-inline {
      display: inline;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .cal-banner-inline strong,
    .cal-banner-inline time {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.92rem;
      font-weight: 600;
      color: var(--ink);
      font-variant-numeric: tabular-nums;
    }

    .cal-banner-sep {
      color: var(--muted);
      opacity: 0.45;
      flex-shrink: 0;
      user-select: none;
    }

    .cal-banner-sync {
      margin-left: auto;
    }

    .cal-month-picker {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
      padding: 0;
      cursor: pointer;
    }

    .cal-month-visible {
      font-size: 1rem;
      font-weight: 700;
      color: var(--ink);
      letter-spacing: -0.02em;
      line-height: 1;
      pointer-events: none;
      white-space: nowrap;
    }

    .cal-month-chevron {
      font-size: 0.95rem;
      color: var(--muted);
      line-height: 1;
      pointer-events: none;
    }

    .cal-month-select {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      opacity: 0;
      cursor: pointer;
      border: none;
      background: transparent;
    }

    .cal-meta-label {
      font-size: 0.62rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: var(--muted);
      line-height: 1.2;
    }

    .cal-wrap {
      background: var(--card);
      border-radius: 0 0 var(--radius) var(--radius);
      box-shadow: var(--shadow);
      overflow: visible;
      border: 1px solid var(--line);
      border-top: none;
    }

    table.cal {
      width: 100%;
      border-collapse: collapse;
      table-layout: fixed;
      font-size: 0.82rem;
    }

    table.cal .col-day { width: 7%; }
    table.cal .col-label { width: 38%; }
    table.cal .col-num { width: 13.75%; }

    table.cal thead th {
      background: var(--ink);
      color: white;
      font-weight: 600;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      padding: 12px 14px;
      text-align: left;
    }

    table.cal tbody tr.month-divider {
      background: linear-gradient(90deg, var(--primary-soft) 0%, #FAFAF8 100%);
      border-top: 2px solid var(--primary);
      border-bottom: 1px solid var(--line);
      scroll-margin-top: var(--cal-scroll-margin, 108px);
    }

    table.cal tbody tr.month-divider td {
      padding: 14px 16px;
      font-size: 1rem;
      font-weight: 700;
      color: var(--primary-dark);
      letter-spacing: -0.01em;
    }

    table.cal tbody tr.month-divider:hover {
      background: linear-gradient(90deg, var(--primary-soft) 0%, #FAFAF8 100%);
    }

    table.cal thead th.num { text-align: right; }

    table.cal tbody tr {
      border-bottom: 1px solid var(--line);
      transition: background 0.15s;
    }

    table.cal tbody tr:hover { background: #FAFAF8; }

    table.cal tbody tr.has-event {
      background: linear-gradient(90deg, var(--success-soft) 0%, transparent 30%);
    }

    table.cal tbody tr.has-sortie {
      background: linear-gradient(90deg, var(--danger-soft) 0%, transparent 30%);
    }

    table.cal tbody tr.has-both {
      background: linear-gradient(90deg, #F0EBE4 0%, transparent 40%);
    }

    table.cal td {
      padding: 9px 14px;
      vertical-align: middle;
    }

    table.cal td.num {
      text-align: right;
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.8rem;
      font-variant-numeric: tabular-nums;
    }

    table.cal td.day {
      font-weight: 700;
      color: var(--muted);
      width: 48px;
      white-space: nowrap;
    }

    table.cal td.label {
      max-width: 340px;
    }

    table.cal td.label .tag {
      display: inline-block;
      font-size: 0.65rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 2px 6px;
      border-radius: 4px;
      margin-right: 6px;
      vertical-align: middle;
    }

    .tag.achat { background: var(--danger-soft); color: var(--danger); }
    .tag.vente { background: var(--success-soft); color: var(--success); }
    .tag.charges { background: #EEE; color: var(--muted); }
    .tag.crm { background: #E8EEF8; color: #3B5998; }

    .amount-in { color: var(--success); font-weight: 600; }
    .amount-out { color: var(--danger); font-weight: 600; }
    .amount-adj { color: var(--warn); font-weight: 600; }

    .balance-strong {
      font-weight: 700;
      color: var(--ink);
    }

    /* Footer note */
    .proposal-note {
      margin-top: 32px;
      padding: 20px 24px;
      background: var(--card);
      border-left: 4px solid var(--primary);
      border-radius: 0 12px 12px 0;
      font-size: 0.85rem;
      color: var(--muted);
    }

    .proposal-note h4 {
      color: var(--ink);
      font-size: 0.95rem;
      margin-bottom: 8px;
    }

    .proposal-note ul {
      margin: 8px 0 0 18px;
    }

    .proposal-note li { margin-bottom: 4px; }

    @media (max-width: 1100px) {
      .orga-layout {
        grid-template-columns: 1fr;
        gap: 32px;
      }
      .orga-col { align-items: center !important; }
      .entity-card::after { display: none; }
      .hub { order: -1; }
    }
  
.btn-logout { color: var(--primary-dark); text-decoration:none; font-size:0.85rem; font-weight:600; white-space:nowrap; flex-shrink:0; }
.btn-logout:hover { text-decoration:underline; }
.entity-fallback { width:36px; height:36px; border-radius:8px; background:#EEE; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:0.7rem; color:#888; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

@media (max-width: 900px) {
  .cal-banner-row { padding: 8px 12px; gap: 10px; }
  .cal-month-visible { font-size: 0.92rem; }
  .cal-banner-inline strong,
  .cal-banner-inline time { font-size: 0.82rem; }
  .cal-meta-label { font-size: 0.58rem; }
}
.login-page { min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--bg); }
.login-wrap { width:100%; max-width:400px; padding:24px; }
.login-card { background:var(--card); border-radius:16px; padding:32px; box-shadow:var(--shadow); text-align:center; }
.login-logo { height:48px; margin-bottom:16px; }
.login-card h1 { font-size:1.4rem; margin-bottom:4px; }
.login-card .muted { color:var(--muted); font-size:0.85rem; margin-bottom:24px; }
.login-card label { display:block; text-align:left; font-size:0.8rem; font-weight:600; margin:12px 0 6px; }
.login-card input { width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:8px; font-family:inherit; }
.login-card button { width:100%; margin-top:20px; padding:12px; border:none; border-radius:8px; background:var(--primary); color:white; font-weight:700; font-family:inherit; cursor:pointer; }
.login-card .error { color:var(--danger); font-size:0.85rem; margin-top:12px; }
