/* ---------- Always-on styles for the new features ---------- */
.welcome-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #eaf4ea;
  color: #1e8449;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.welcome-banner[hidden] { display: none; }

fieldset.options {
  border: 1px solid #e5e9ed;
  border-radius: 8px;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
}
fieldset.options legend { padding: 0 0.4rem; font-size: 0.9rem; }
label.option { flex-direction: row; align-items: center; gap: 0.5rem; padding: 0.25rem 0; }
label.option input { width: auto; }
.hint { font-size: 0.8rem; color: #6b7785; margin: 0.5rem 0 0; }

/* ---------- Dark mode ---------- */
html[data-mode="dark"] { color-scheme: dark; }
html[data-mode="dark"] body { background: #12161c; color: #e6e9ee; }
html[data-mode="dark"] .topbar { background: #16253b; }

html[data-mode="dark"] .card,
html[data-mode="dark"] .summary .box { background: #1c222b; box-shadow: none; }

html[data-mode="dark"] input,
html[data-mode="dark"] select {
  background: #232b36;
  color: #e6e9ee;
  border-color: #3a4452;
}
html[data-mode="dark"] input::placeholder { color: #7f8a99; }

html[data-mode="dark"] button { background: #3a6ea5; }
html[data-mode="dark"] button.secondary { background: #4a5463; }
html[data-mode="dark"] button.danger { background: #b03a2e; }

html[data-mode="dark"] th { color: #9aa5b4; }
html[data-mode="dark"] th,
html[data-mode="dark"] td,
html[data-mode="dark"] .item-list li,
html[data-mode="dark"] fieldset.options { border-color: #323a46; }

html[data-mode="dark"] tr.editing td { background: #202833; }
html[data-mode="dark"] .progress { background: #323a46; }
html[data-mode="dark"] code { background: #2a323d; }
html[data-mode="dark"] .empty,
html[data-mode="dark"] .hint { color: #9aa5b4; }

html[data-mode="dark"] .alert { background: #3a1f1c; color: #ff9d8f; }
html[data-mode="dark"] .info,
html[data-mode="dark"] .welcome-banner { background: #1d3326; color: #6fd09a; }

html[data-mode="dark"] .income strong,
html[data-mode="dark"] .income-text { color: #4cd07d; }
html[data-mode="dark"] .expense strong,
html[data-mode="dark"] .expense-text { color: #ff7b6b; }
html[data-mode="dark"] .balance strong { color: #8fb4e8; }
/* ---------- Footer and small additions ---------- */
.site-footer {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  font-size: 0.85rem;
  color: #6b7785;
}
.site-footer a { color: #1f3a5f; text-decoration: none; font-weight: bold; }
.site-footer a:hover { text-decoration: underline; }

.remove-password { margin-top: 1rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

html[data-mode="dark"] .site-footer { color: #9aa5b4; }
html[data-mode="dark"] .site-footer a { color: #8fb4e8; }

/* Make dropdown options readable in dark mode */
html[data-mode="dark"] select option {
  background: #232b36;
  color: #e6e9ee;
}

/* ---------- Install suggestion ---------- */
.install-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: #eef3fa;
  border: 1px solid #c9d7ea;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
}
.install-banner[hidden] { display: none; }
.install-banner strong { display: block; margin-bottom: 0.2rem; }
.install-banner span { font-size: 0.85rem; color: #4a5565; }
.install-actions { display: flex; gap: 0.5rem; }

html[data-mode="dark"] .install-banner { background: #1b2635; border-color: #2e3d52; }
html[data-mode="dark"] .install-banner span { color: #9aa5b4; }

/* ---------- Brand link, justified text and mobile menu ---------- */
.topbar { position: relative; }
.topbar h1 a.brand { color: inherit; text-decoration: none; }
.topbar h1 a.brand:hover { opacity: 0.85; }

/* Justify running text (empty-state messages keep their own centering) */
p, .hint, .alert, .info { text-align: justify; }
p.empty { text-align: center; }

/* The hamburger button only exists on small screens */
.nav-toggle {
  display: none;
  position: absolute;
  top: 0.6rem;
  left: 0.75rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.35rem 0.7rem;
  min-height: 0;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .topbar nav {
    display: none;
    flex-direction: column;
    gap: 0;
    margin-top: 0.75rem;
  }
  .topbar nav.open { display: flex; }
  .topbar nav a {
    padding: 0.65rem 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 1rem;
  }
}
