:root {
  --bg: #0f1115;
  --panel: #1a1d23;
  --panel-alt: #20242c;
  --text: #f2f2f2;
  --muted: #9aa0a6;

  --green: #65B446;
  --red: #CC4439;
  --gray: #3a3f4b;
  --border: #2a2f3a;
}

[data-theme="light"] {
  --bg: #f9f9f9;
  --panel: #ffffff;
  --panel-alt: #f2f2f2;
  --text: #111111;
  --muted: #555555;
  --green: #65B446;
  --red: #CC4439;
  --gray: #c0c0c0;
  --border: #dddddd;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
}

/* SPLASH SCREEN */
#splashScreen {
  position: fixed;
  inset: 0;
  background: var(--panel);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#splashScreen img {
  max-width: 80%; /* Limite à 80% de la largeur de l’écran */
  max-height: 80%; /* Limite à 80% de la hauteur de l’écran */
}

/* HEADER */
.top {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 225px;   /* inclut bannière */
  padding: 14px 16px;
  background: var(--panel);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* BANDEAU */
.top .banner {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.top .banner img {
  max-width: 90%; /* Limite à 80% de la largeur de l’écran */
  max-height: 90%; /* Limite à 80% de la hauteur de l’écran */
}

/* MIDDLE */
.middle {
  position: absolute;
  top: 225px;
  bottom: 120px;
  left: 0;
  right: 0;
  padding: 12px;
  overflow-y: auto;
}

/* BOTTOM */
.bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 120px;
  padding: 14px 16px;
  background: var(--panel);
  z-index: 10;
  display: flex;
  align-items: center;      /* centré verticalement */
  justify-content: center;  /* centré horizontalement */
}

/* BLOC SOLDE */
.balance-editable {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  text-align: center;
  cursor: pointer;
  background: var(--panel-alt);
  min-width: 170px;         /* largeur minimale */
  display: flex;
  flex-direction: column;
  justify-content: center;  /* texte centré verticalement */
}

/* AUTRES STYLES */
.amount { font-size: 32px; font-weight: 700; }
.sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.period-summary { font-size: 13px; color: var(--muted); line-height: 1.3; }
.today-remaining { text-align: center; margin-top: 4px; }

/* BUTTONS */
.top-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.top-actions.compact { margin-top: 6px; }
button {
  height: 44px;
  border-radius: 10px;
  border: 1px solid #000000;
  font-size: 14px;
  font-weight: 600;
}
.top-actions.compact button { height: 40px; font-size: 13px; border-radius: 9px; }
.primary { background: var(--green); color: #fff; }
.secondary { background: var(--gray); color: var(--text); }
.danger { background: var(--red); color: #fff; }
.full { width: 100%; }

/* TRANSACTIONS */
/* TRANSACTIONS */
.tx {
  background: var(--panel);
  border-radius: 12px;
  padding: 6px 8px;
  margin-bottom: 6px;
  display: grid;
  grid-template-columns: 28px 72px 1fr 44px;
  align-items: center;
  gap: 8px;
  position: relative;
  min-height: 36px;
  border: 1px solid var(--border); /* Ajoute une bordure fine */
}
.tx input[type="checkbox"] { justify-self: center; width: 22px; height: 22px; transform: scale(1.3); margin: -20px; cursor: pointer; }
.tx.debit { border-left: 4px solid var(--red); }
.tx.credit { border-left: 4px solid var(--green); }
.tx .amount { font-size: 15px; font-weight: 600; }

/* MODALES */
dialog {
  border: none;
  border-radius: 18px;
  padding: 20px;
  width: 90%;
  max-width: 340px;
  background: var(--panel);
  color: var(--text);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
input, select {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #000000;
  background: var(--panel-alt);
  color: var(--text);
  font-size: 16px;
  text-align: center;
  margin-bottom: 12px;
}
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.hidden { display: none; }

/* TODAY */
.tx[data-today="true"] { position: relative; margin-top: 14px; }
.tx[data-today="true"]::before { content: ""; position: absolute; left: 12px; right: 12px; top: -12px; height: 2px; background: var(--red); border-radius: 2px; }
.tx[data-today="true"]::after { content: attr(data-label); position: absolute; left: 50%; top: -22px; transform: translateX(-50%); background: var(--panel); color: var(--text); font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--red); line-height: 1; white-space: nowrap; box-shadow: 0 1px 0 rgba(0,0,0,0.25); }
