:root {
  --bg: #f3f0fb;
  --bg-2: #faf8ff;
  --ink: #1c1633;
  --muted: #6b6280;
  --line: #ece7f7;
  --card: #ffffff;
  --violet: #6d5ae6;
  --violet-2: #8b7cff;
  --pink: #e879f9;
  --blue: #93c5fd;
  --lavender: #c4b5fd;
  --green: #059669;
  --green-bg: #ecfdf5;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --radius: 28px;
  --radius-sm: 18px;
  --shadow: 0 12px 40px rgba(88, 70, 180, 0.08);
  --font: "DM Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 10% -10%, #efe8ff 0%, transparent 60%),
    radial-gradient(900px 400px at 100% 0%, #fde7ff 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
.app { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand:hover { text-decoration: none; }
.logo {
  width: 44px; height: 44px; border-radius: 16px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  display: grid; place-items: center; color: #fff; font-weight: 700;
  box-shadow: 0 8px 20px rgba(109, 90, 230, 0.3);
}
.brand h1 { font-size: 1.05rem; margin: 0; font-weight: 700; }
.brand p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.nav {
  display: flex; flex-wrap: wrap; gap: 6px; background: #fff;
  padding: 6px; border-radius: 999px; box-shadow: var(--shadow);
}
.nav a {
  color: var(--muted); padding: 8px 14px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 600; text-decoration: none;
}
.nav a:hover, .nav a.active { background: var(--violet); color: #fff; }
.nav .badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  margin-left: 4px; border-radius: 99px; background: #fff; color: var(--violet);
  font-size: 0.7rem;
}
.nav a.active .badge { background: rgba(255,255,255,.25); color: #fff; }
.userbar { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.85rem; }
.btn, button.btn {
  border: 0; cursor: pointer; font-family: inherit; font-weight: 650;
  border-radius: 999px; padding: 10px 16px; font-size: 0.9rem;
}
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover { background: #5b49d4; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-soft { background: #efe9ff; color: var(--violet); }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1.4fr 1fr; }
.grid-3 { grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) {
  .grid-4, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav { border-radius: 22px; }
}
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.card h2, .card h3 { margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.balance {
  background: linear-gradient(135deg, #6d5ae6 0%, #9b7dff 52%, #e879f9 100%);
  color: #fff; border-radius: var(--radius); padding: 26px 28px;
  box-shadow: 0 16px 40px rgba(109, 90, 230, 0.28);
  position: relative; overflow: hidden;
}
.balance::after {
  content: ""; position: absolute; right: -40px; top: -30px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.balance .label { opacity: .85; font-size: .9rem; margin: 0 0 6px; }
.balance .amount { font-size: 2.3rem; font-weight: 750; letter-spacing: -0.03em; margin: 0; }
.balance .sub { opacity: .9; margin-top: 10px; font-size: .9rem; }
.metric .label { color: var(--muted); font-size: .82rem; margin: 0 0 6px; }
.metric .value { font-size: 1.35rem; font-weight: 720; margin: 0; }
.metric .detail { color: var(--muted); font-size: .8rem; margin-top: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 4px 10px; font-size: .75rem; font-weight: 650;
}
.pill-ok { background: var(--green-bg); color: var(--green); }
.pill-no { background: var(--red-bg); color: var(--red); }
.pill-wait { background: var(--amber-bg); color: var(--amber); }
.pill-vio { background: #efe9ff; color: var(--violet); }
.seg {
  display: inline-flex; background: #efe9ff; padding: 4px; border-radius: 999px; gap: 2px;
}
.seg a, .seg button {
  border: 0; background: transparent; color: var(--violet); font-weight: 650;
  padding: 7px 14px; border-radius: 999px; font-family: inherit; cursor: pointer;
  text-decoration: none; font-size: .88rem;
}
.seg a.active, .seg button.active { background: var(--violet); color: #fff; }
.callout {
  border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 16px;
  background: #fff; box-shadow: var(--shadow); border-left: 5px solid var(--violet);
}
.callout.warn { border-left-color: var(--amber); background: #fffdf6; }
.callout.info { border-left-color: var(--violet-2); }
.callout strong { display: block; margin-bottom: 4px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f7f4ff; }
.pos { color: var(--green); font-weight: 650; }
.neg { color: var(--red); font-weight: 650; }
form.inline { display: inline; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .82rem; font-weight: 650; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid #e4def3; border-radius: 14px; padding: 11px 12px;
  font-family: inherit; font-size: 1rem; background: #fff;
}
.field input:focus, .field select:focus { outline: 2px solid #c4b5fd; border-color: var(--violet); }
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card { width: min(420px, 100%); }
.login-card .balance { margin-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.login-body { padding: 24px; background: #fff; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); }
.chart { width: 100%; height: 220px; }
.barrow { display: flex; align-items: flex-end; gap: 10px; height: 160px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar-stack { width: 70%; max-width: 36px; display: flex; flex-direction: column-reverse; height: 100%; justify-content: flex-end; gap: 3px; }
.bar { border-radius: 8px 8px 4px 4px; width: 100%; min-height: 4px; }
.bar.in { background: var(--blue); }
.bar.out { background: var(--lavender); }
.bar-col span { font-size: .7rem; color: var(--muted); margin-top: 6px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
details.cat { background: #fff; border-radius: 22px; box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
details.cat > summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between;
  align-items: center; padding: 16px 20px; font-weight: 700; gap: 12px;
}
details.cat > summary::-webkit-details-marker { display: none; }
details.sous { box-shadow: none; border-radius: 0; margin: 0; border-top: 1px solid var(--line); }
details.sous > summary { font-weight: 600; padding: 12px 20px 12px 32px; }
.tx-table { padding: 0 8px 8px 24px; }
.flash { padding: 10px 14px; border-radius: 14px; margin-bottom: 12px; }
.flash.ok { background: var(--green-bg); color: var(--green); }
.flash.err { background: var(--red-bg); color: var(--red); }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { border: 1px solid #e4def3; border-radius: 999px; padding: 8px 14px; font-family: inherit; min-width: 220px; }
.foot { margin-top: 28px; color: var(--muted); font-size: .8rem; text-align: center; }
