/* ============ Cockpit — design tokens ============ */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --line: #e7e6e1;
  --line-2: #efeeea;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #8a8984;
  --accent: #111111;
  --accent-ink: #ffffff;
  --hover: rgba(17, 17, 17, .045);
  --perso: #2a78d6;
  --freelance: #eb6834;
  --immo: #1baf7a;
  --flow-in: #3b4a63;
  --flow-out: #b9c3d4;
  --good: #0ca30c; --good-ink: #006300; --good-bg: #e8f6e8;
  --warn: #fab219; --warn-ink: #7a5200; --warn-bg: #fff4d9;
  --crit: #d03b3b; --crit-ink: #a52626; --crit-bg: #fdeaea;
  --info-bg: #eef3fb; --info-ink: #1c5cab;
  --shadow: 0 1px 2px rgba(16, 16, 16, .04), 0 6px 20px rgba(16, 16, 16, .05);
  --shadow-lg: 0 24px 64px rgba(16, 16, 16, .22);
  --radius: 14px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface: #1b1b1a;
  --surface-2: #212120;
  --line: #2e2e2c;
  --line-2: #272725;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #8f8e87;
  --accent: #f0efec;
  --accent-ink: #111111;
  --hover: rgba(255, 255, 255, .06);
  --perso: #3987e5;
  --freelance: #d95926;
  --immo: #199e70;
  --flow-in: #c9d3e6;
  --flow-out: #4b5873;
  --good: #3fc13f; --good-ink: #7ddf7d; --good-bg: #17301a;
  --warn: #fab219; --warn-ink: #f6c453; --warn-bg: #352b11;
  --crit: #e66767; --crit-ink: #f19a9a; --crit-bg: #381a1a;
  --info-bg: #17263b; --info-ink: #86b6ef;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.sec { color: var(--ink-2); }
.sr { position: absolute; left: -9999px; }
svg.i { flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ============ Layout ============ */
.app { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.side {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px 12px; gap: 4px; overflow: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 550; cursor: pointer; user-select: none;
}
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.on { background: var(--accent); color: var(--accent-ink); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--crit); color: #fff; border-radius: 99px; padding: 1px 7px; }
.nav a.on .count { background: var(--accent-ink); color: var(--accent); }
.side .spacer { flex: 1; }
.filebox { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); font-size: 12px; color: var(--ink-2); }
.filebox b { display: block; color: var(--ink); font-size: 12.5px; word-break: break-all; }
.filebox .row { display: flex; gap: 6px; margin-top: 8px; }
.dot-ok { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.top {
  display: flex; align-items: center; gap: 14px; padding: 14px 28px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: relative; z-index: 20;
}
.top h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-right: auto; }
.top .sub { font-size: 12.5px; color: var(--ink-3); font-weight: 450; display: block; letter-spacing: 0; margin-top: 1px; }
.scroll { flex: 1; overflow: auto; padding: 22px 28px 60px; }
.page { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* ============ Controls ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 8px 14px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  transition: background .12s, transform .06s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent); filter: brightness(1.15); }
.btn.danger { color: var(--crit-ink); }
.btn.danger:hover { background: var(--crit-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); box-shadow: none; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.icon { padding: 7px; }
kbd { font: 600 11px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--ink-3); background: var(--surface-2); }
.btn.primary kbd { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); opacity: .8; }

.seg { display: inline-flex; background: var(--hover); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 8px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg.lg button { padding: 10px 18px; font-size: 15px; }
.seg .dotc { width: 8px; height: 8px; border-radius: 50%; }
.seg.block { display: flex; } .seg.block button { flex: 1; justify-content: center; }

.pillbtn {
  display: inline-flex; align-items: center; gap: 9px; padding: 8px 13px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 11px; font-weight: 600; cursor: pointer;
}
.pillbtn:hover { box-shadow: var(--shadow); }
.pillbtn .arrow { color: var(--ink-3); font-weight: 500; }

input[type=text], input[type=number], input[type=date], input[type=month], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; outline: none;
  transition: border-color .12s, box-shadow .12s; min-height: 38px;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 12px; font-weight: 650; color: var(--ink-2); letter-spacing: .01em; }
.field .hint { font-size: 12px; color: var(--ink-3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.err { color: var(--crit-ink); font-size: 12.5px; font-weight: 600; }

/* ============ Cards ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card > header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card > header h2 { font-size: 14px; font-weight: 700; letter-spacing: -.005em; }
.card > header .sub { color: var(--ink-3); font-size: 12.5px; }
.card > header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.row2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; }
.row2e { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 1100px) { .row2, .row2e { grid-template-columns: 1fr; } }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1150px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi .t { font-size: 12.5px; font-weight: 650; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 27px; font-weight: 720; letter-spacing: -.03em; line-height: 1.15; margin-top: 2px; }
.kpi .d { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi .spark { position: absolute; right: 14px; top: 16px; opacity: .9; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12px; padding: 1px 7px 1px 5px; border-radius: 99px; }
.delta.good { background: var(--good-bg); color: var(--good-ink); }
.delta.bad { background: var(--crit-bg); color: var(--crit-ink); }
.delta.flat { background: var(--hover); color: var(--ink-2); }
.pos { color: var(--good-ink); } .neg { color: var(--crit-ink); }

/* ============ Table ============ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl .r { text-align: right; } .tbl .c { text-align: center; }
.tbl td .sub { display: block; font-size: 12px; color: var(--ink-3); }
.tbl .acts { opacity: 0; display: flex; gap: 2px; justify-content: flex-end; }
.tbl tr:hover .acts { opacity: 1; }
.tbl tr.dim td { opacity: .55; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: var(--hover); font-size: 12.5px; font-weight: 550; color: var(--ink-2); white-space: nowrap; }
.adot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.adot.Perso, .bg-Perso { background: var(--perso); } .adot.Freelance, .bg-Freelance { background: var(--freelance); } .adot.Immobilier, .bg-Immobilier { background: var(--immo); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.bad { background: var(--crit-bg); color: var(--crit-ink); }
.pill.info { background: var(--info-bg); color: var(--info-ink); }
.pill.mute { background: var(--hover); color: var(--ink-2); }

/* ============ Bars list ============ */
.bl { display: flex; flex-direction: column; gap: 11px; }
.bl .it { display: grid; grid-template-columns: minmax(90px, 170px) 1fr auto; gap: 12px; align-items: center; }
.bl .it .lb { font-weight: 550; display: flex; align-items: center; gap: 7px; min-width: 0; }
.bl .it .lb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl .it .tr { height: 9px; background: var(--hover); border-radius: 99px; overflow: hidden; }
.bl .it .fl { height: 100%; border-radius: 99px; background: var(--flow-in); min-width: 3px; transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.bl .it .vl { font-weight: 650; min-width: 74px; text-align: right; }

/* ============ Alerts ============ */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 12px; align-items: center; padding: 11px 13px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.alert .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.alert.warn .ic { background: var(--warn-bg); color: var(--warn-ink); }
.alert.bad .ic { background: var(--crit-bg); color: var(--crit-ink); }
.alert.info .ic { background: var(--info-bg); color: var(--info-ink); }
.alert.good .ic { background: var(--good-bg); color: var(--good-ink); }
.alert .tx { flex: 1; min-width: 0; font-weight: 550; }
.alert .tx small { display: block; color: var(--ink-3); font-weight: 450; font-size: 12.5px; }

/* ============ Charts ============ */
.chart { width: 100%; position: relative; }
.chart svg { display: block; overflow: visible; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; z-index: 200; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; box-shadow: var(--shadow-lg); font-size: 12.5px; min-width: 150px; opacity: 0; transition: opacity .1s; }
.tip.on { opacity: 1; }
.tip .th { font-weight: 700; margin-bottom: 5px; }
.tip .tr { display: flex; justify-content: space-between; gap: 18px; padding: 1px 0; }
.tip .tr i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* ============ Rent grid ============ */
.gridwrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table.rent { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.rent th, table.rent td { padding: 0; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); text-align: center; }
table.rent th { background: var(--surface-2); font-weight: 700; font-size: 12px; color: var(--ink-2); padding: 9px 6px; position: sticky; top: 0; z-index: 2; white-space: nowrap; }
table.rent th:first-child, table.rent td:first-child { position: sticky; left: 0; z-index: 3; background: var(--surface); text-align: left; padding: 9px 12px; min-width: 210px; border-right: 1px solid var(--line); }
table.rent th:first-child { background: var(--surface-2); z-index: 4; }
table.rent td.cell { min-width: 74px; }
table.rent .c { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 4px; height: 100%; cursor: pointer; transition: background .1s; font-weight: 650; }
table.rent .c small { font-weight: 500; font-size: 11px; opacity: .85; }
table.rent .c:hover { filter: brightness(.96); outline: 2px solid var(--ink-3); outline-offset: -2px; border-radius: 2px; }
.c.paid { background: var(--good-bg); color: var(--good-ink); }
.c.part { background: var(--warn-bg); color: var(--warn-ink); }
.c.late { background: var(--crit-bg); color: var(--crit-ink); }
.c.vac { color: var(--ink-3); cursor: default !important; font-weight: 400 !important; }
.c.fut { color: var(--ink-3); background: repeating-linear-gradient(135deg, transparent 0 6px, var(--hover) 6px 7px); }
table.rent tfoot td { background: var(--surface-2); font-weight: 700; padding: 8px 6px; }
table.rent .lot b { font-weight: 650; display: block; }
table.rent .lot span { font-size: 12px; color: var(--ink-3); }

/* ============ Modal / popover / toast ============ */
.overlay { position: fixed; inset: 0; background: rgba(10, 10, 10, .45); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow: auto; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; animation: pop .18s cubic-bezier(.2, .8, .2, 1); border: 1px solid var(--line); }
.modal > header { display: flex; align-items: center; padding: 18px 22px 6px; gap: 10px; }
.modal > header h2 { font-size: 17px; font-weight: 720; letter-spacing: -.015em; }
.modal > header .x { margin-left: auto; }
.modal .body { padding: 10px 22px 8px; display: flex; flex-direction: column; gap: 16px; }
.modal > footer { padding: 14px 22px 18px; display: flex; gap: 10px; align-items: center; }
.modal > footer .sp { flex: 1; }

.amount-row { display: flex; gap: 10px; align-items: stretch; }
.amount { font-size: 34px !important; font-weight: 720; letter-spacing: -.03em; padding: 10px 16px !important; height: 66px; border-radius: 14px !important; }
.catgrid { display: flex; flex-wrap: wrap; gap: 7px; }
.cat {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 13px; color: var(--ink-2); transition: all .1s;
}
.cat:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface-2); }
.cat.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cat .em { font-size: 15px; line-height: 1; }
.grp { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin: 8px 0 6px; }
.grp:first-child { margin-top: 0; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 30; overflow: hidden; }
.suggest div { padding: 9px 13px; display: flex; justify-content: space-between; gap: 10px; cursor: pointer; }
.suggest div:hover, .suggest div.on { background: var(--hover); }
.suggest small { color: var(--ink-3); }
.rel { position: relative; }
.details > summary { cursor: pointer; font-weight: 650; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 6px; }
.details > summary::-webkit-details-marker { display: none; }
.details[open] > summary { margin-bottom: 12px; }

.pop { position: fixed; z-index: 150; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .15s; }
.period { display: grid; grid-template-columns: 170px 1fr 1fr; gap: 0; padding: 0; }
.period .presets { padding: 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.period .presets button { text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; font-weight: 600; color: var(--ink-2); }
.period .presets button:hover { background: var(--hover); color: var(--ink); }
.period .presets button.on { background: var(--accent); color: var(--accent-ink); }
.period .mp { padding: 14px 16px; width: 232px; }
.period .mp .yr { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.period .mp .ttl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; }
.period .mp .ms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.period .mp .ms button { border: 0; background: transparent; padding: 9px 0; border-radius: 9px; font-weight: 600; color: var(--ink-2); }
.period .mp .ms button:hover { background: var(--hover); }
.period .mp .ms button.on { background: var(--accent); color: var(--accent-ink); }
.period .mp .ms button.in { background: var(--hover); }
.period .mp .ms button:disabled { opacity: .3; pointer-events: none; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast { background: var(--accent); color: var(--accent-ink); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; animation: pop .2s; display: flex; gap: 10px; align-items: center; max-width: 440px; }
.toast.error { background: var(--crit); color: #fff; }

/* ============ Misc ============ */
.empty { text-align: center; padding: 34px 10px; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .grow { flex: 1; min-width: 200px; position: relative; }
.filters .grow input { padding-left: 36px; }
.filters .grow svg { position: absolute; left: 11px; top: 10px; color: var(--ink-3); }
.filters select { width: auto; min-width: 150px; }
.thr { position: relative; height: 46px; margin: 26px 0 30px; }
.thr .track { position: absolute; left: 0; right: 0; top: 16px; height: 14px; background: var(--hover); border-radius: 99px; overflow: hidden; display: flex; }
.thr .seg1 { background: var(--flow-in); height: 100%; }
.thr .seg2 { background: var(--flow-out); height: 100%; }
.thr .seg3 { height: 100%; background: repeating-linear-gradient(135deg, var(--flow-out) 0 4px, transparent 4px 8px); opacity: .8; }
.thr .mk { position: absolute; top: 6px; width: 0; border-left: 2px solid var(--ink-3); height: 34px; }
.thr .mk span { position: absolute; top: -20px; left: 0; transform: translateX(-50%); font-size: 11.5px; font-weight: 700; white-space: nowrap; color: var(--ink-2); }
.thr .mk em { position: absolute; top: 36px; left: 0; transform: translateX(-50%); font-size: 11px; font-style: normal; color: var(--ink-3); white-space: nowrap; }
.thr .mk.low span { top: 56px; } .thr .mk.low em { top: 56px; transform: translateX(-50%); } .thr .mk.low { border-left-style: dashed; height: 54px; }
.thr .mk.low span, .thr .mk.low em { position: absolute; }
.thr .mk.low span { top: 54px; } .thr .mk.low em { display: none; }
.thr { margin-bottom: 52px; }
.note { font-size: 12.5px; color: var(--ink-3); }
.infobox { background: var(--info-bg); color: var(--info-ink); border-radius: 12px; padding: 10px 14px; font-weight: 500; font-size: 13px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.split { display: flex; align-items: center; gap: 10px; }
.sp { flex: 1; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 6px 0 -6px; }
.toggle { position: relative; width: 38px; height: 22px; background: var(--line); border-radius: 99px; border: 0; padding: 0; transition: background .15s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.toggle.on { background: var(--good); } .toggle.on::after { transform: translateX(16px); }
.loading { display: grid; place-items: center; height: 100vh; color: var(--ink-3); font-weight: 600; }
::-webkit-scrollbar { width: 11px; height: 11px; } ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; } ::-webkit-scrollbar-thumb:hover { background: var(--ink-3); border: 3px solid transparent; background-clip: content-box; }

table.rent td.num { text-align: right; } table.rent td:first-child { font-weight: inherit; }

/* ============ Cloud : connexion, synchro, réglages ============ */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.auth-card { width: 100%; max-width: 420px; padding: 26px 26px 20px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .brand { padding: 0 0 4px; }
.auth-card h1 { font-size: 22px; letter-spacing: -.02em; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn { justify-content: center; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
input[type=email], input[type=password] { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; outline: none; min-height: 38px; }
input.otp { font: 700 26px/1 var(--mono); letter-spacing: .35em; text-align: center; padding: 12px; }
.qr { display: grid; place-items: center; padding: 8px; background: #fff; border-radius: 12px; width: max-content; margin: 0 auto; }
.secret { font: 600 13px var(--mono); background: var(--hover); padding: 2px 6px; border-radius: 6px; user-select: all; word-break: break-all; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); }
.kv b { color: var(--ink); word-break: break-all; text-align: right; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin-top: 12px; }
.tg { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-weight: 550; font-size: 13px; }
.dot-off, .dot-warn { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.dot-off { background: var(--ink-3); } .dot-warn { background: var(--warn); }
.tbl tr.pending td { opacity: .65; }
.tbl tr.pending td.c-amt::after { content: "⟳"; margin-left: 4px; color: var(--warn-ink); }
.m-only { display: none; }
.tabbar { display: none; }
.morelist { display: flex; flex-direction: column; }
.morelist a { display: flex; align-items: center; gap: 14px; padding: 15px 4px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16px; }
.morelist a > svg:last-child { margin-left: auto; color: var(--ink-3); }
.morelist a.on { color: var(--accent); }
.morelist .count { font-size: 11px; font-weight: 700; background: var(--crit); color: #fff; border-radius: 99px; padding: 1px 7px; }
.syncline { padding: 14px 4px 4px; color: var(--ink-3); font-size: 13px; }

/* ============ Mobile (iPhone) ============ */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 1fr; height: 100dvh; }
  .side { display: none; }
  .main { height: 100dvh; }
  .top { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 6px 8px; flex-wrap: wrap; }
  .top h1 { flex-basis: 100%; }
  .top .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .top::-webkit-scrollbar { display: none; }
  .top h1 { font-size: 19px; white-space: nowrap; }
  .top .sub { display: none; }
  .top .seg button { padding: 6px 10px; font-size: 13px; }
  .pillbtn { padding: 7px 10px; font-size: 13px; white-space: nowrap; }
  .scroll { padding: 12px 12px calc(92px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
  .page { gap: 12px; }
  .card { padding: 14px; border-radius: 16px; }
  .card > header { flex-wrap: wrap; margin-bottom: 10px; }
  .card > header .right { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 13px; }
  .kpi .v { font-size: 21px; }
  .kpi .spark { display: none; }
  .kpi .d { font-size: 11.5px; }
  .grid2, .grid3, .toggles { grid-template-columns: 1fr; }
  .row2, .row2e { gap: 12px; }
  kbd { display: none; }
  input, select, textarea { font-size: 16px !important; }   /* évite le zoom automatique d'iOS */
  .amount { font-size: 30px !important; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  .filters select { min-width: 0; flex: 1 1 45%; }
  .filters .grow { min-width: 100%; }
  .bl .it { grid-template-columns: minmax(80px, 120px) 1fr auto; gap: 8px; }
  .tbl { font-size: 14px; }
  .tbl th, .tbl td { padding: 9px 6px; }
  .card:has(> .tbl), .card > .tbl { overflow-x: auto; }
  table.rent th:first-child, table.rent td:first-child { min-width: 118px; padding: 8px; }
  table.rent .lot span { display: none; }
  .tbl .acts { opacity: 1; }
  .thr .mk span, .thr .mk em { font-size: 10px; }

  /* listes d'opérations en cartes */
  .txlist thead { display: none; }
  .txlist tr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; padding: 10px 2px; border-bottom: 1px solid var(--line-2); }
  .txlist td { padding: 0 !important; border: 0 !important; }
  .txlist td.c-date, .txlist td.c-cat, .txlist td.c-act, .txlist td.c-nat { display: none; }
  .txlist td.c-lib .lib { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .txlist td.c-lib { min-width: 0; }
  .txlist .m-only { display: inline; }
  .txlist tfoot tr { display: block; }
  .txlist tfoot td { display: block; text-align: left !important; padding: 8px 2px !important; }

  /* fenêtres = feuilles plein écran venant du bas */
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: none !important; border-radius: 20px 20px 0 0; max-height: 94dvh; display: flex; flex-direction: column; animation: sheet .22s cubic-bezier(.2, .8, .2, 1); }
  .modal .body { overflow-y: auto; padding: 8px 16px 8px; -webkit-overflow-scrolling: touch; }
  .modal > header { padding: 14px 16px 6px; }
  .modal > header::before { content: ""; position: absolute; left: 50%; top: 6px; width: 38px; height: 4px; border-radius: 9px; background: var(--line); transform: translateX(-50%); }
  .modal { position: relative; }
  .modal > footer { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; border-top: 1px solid var(--line-2); }
  .modal > footer .btn.lg { flex: 1; justify-content: center; }
  .pop { left: 8px !important; right: 8px; max-height: 80dvh; overflow: auto; }
  .period { grid-template-columns: 1fr; }
  .period .presets { border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; }
  .period .mp { width: auto; }
  .toasts { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); align-items: center; }
  .toast { max-width: 100%; }

  /* barre d'onglets */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border: 0; background: none; color: var(--ink-3); text-decoration: none; font-size: 10.5px; font-weight: 600; }
  .tabbar a.on, .tabbar button.on { color: var(--ink); }
  .tabbar .fab { width: 54px; height: 54px; border-radius: 18px; background: var(--accent); color: var(--accent-ink); justify-self: center; margin-bottom: 4px; box-shadow: var(--shadow-lg); display: grid; place-items: center; padding: 0; }
  .tabbar .dotn { position: absolute; top: 0; left: calc(50% + 6px); font-style: normal; font-size: 10px; font-weight: 700; background: var(--crit); color: #fff; border-radius: 99px; padding: 0 5px; min-width: 16px; text-align: center; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
@media (hover: none) { .tbl tbody tr:hover { background: none; } .btn:hover { box-shadow: none; } }
