:root {
  /* Palette Alegria (vert sombre) */
  --bg: #0f1412;
  --surface: #161b19;
  --muted: #202725;
  --text: #e9f1ee;
  --text-dim: #b8c3bf;
  --primary: #1db954;
  --primary-ink: #0b2e17;
  --accent: #3ddc97;
  --danger: #ff5a5f;
  --ok: #2ecc71;
  --warn: #f5a623;

  --radius: 12px;
  --shadow: 0 6px 20px rgba(0,0,0,.25);

  --font: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --container: 960px;
}

/* Variante claire optionnelle */
.light {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --muted: #eef1f0;
  --text: #1b1f1d;
  --text-dim: #5f6b66;
  --primary: #138a40;
  --primary-ink: #ffffff;
  --accent: #0aa86e;
}

/* Reset + base */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  line-height: 1.5;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container {
  width: 100%; max-width: var(--container); margin: 0 auto; padding: 16px;
}

/* Marque + logo compact */
/* Logo et titre Alegria */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}

.brand__logo { height: 38px; width: auto; }
@media (min-width:640px){ .brand__logo { height: 40px; } }
.auth-logo img { height: 40px; }



/* App bar */
.appbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--muted);
  padding: 10px 14px; display: flex; align-items: center; gap: 12px;
}
.appbar__title { font-weight: 700; font-size: 18px; }
.spacer { flex: 1; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--muted);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px;
}
.grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 14px; border: 0; border-radius: 10px; font-weight: 600; cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-muted { background: var(--muted); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* Forms */
.input, select, textarea {
  width: 100%; padding: 12px 12px; border-radius: 10px;
  border: 1px solid var(--muted); background: var(--surface); color: var(--text);
}
.label { display:block; margin: 10px 0 6px; font-size: 14px; color: var(--text-dim); }
.form-row { display:grid; gap:10px; }
@media (min-width:640px){ .form-row.cols-2{ grid-template-columns: 1fr 1fr; } }

/* Tables -> list mobile */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--muted); }
.table th { text-align: left; color: var(--text-dim); }
.amount { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.negative { color: #ff7675; }
.positive { color: #2ecc71; }

/* Transactions en cartes sur petit écran */
@media (max-width: 640px) {
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px 0; }
  .table td { border: 0; padding: 2px 0; }
  .table td.desc { grid-column: 1 / -1; color: var(--text-dim); }
}

/* Bottom nav mobile */
.tabbar {
  position: sticky; bottom: 0; background: var(--surface); border-top:1px solid var(--muted);
  display: grid; grid-template-columns: repeat(4,1fr); padding: 6px 0;
}
.tab { text-align: center; font-size: 12px; padding: 10px 0; color: var(--text-dim); } /* +2px hit area */
.tab.active { color: var(--primary); font-weight: 700; }

/* Alerts */
.alert { padding: 12px; border-radius: 10px; }
.alert.ok { background: rgba(46,204,113,.15); border:1px solid rgba(46,204,113,.35); }
.alert.warn { background: rgba(245,166,35,.15); border:1px solid rgba(245,166,35,.35); }
.alert.err { background: rgba(255,90,95,.15); border:1px solid rgba(255,90,95,.35); }

/* Auth logo (login/register) plus discret */
.auth-logo img { height:44px; width:auto; margin:10px auto 18px; display:block; }
