:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --card-soft: #f8fafc;
  --ink: #172033;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-light: #dbeafe;
  --good: #059669;
  --good-light: #d1fae5;
  --bad: #dc2626;
  --bad-light: #fee2e2;
  --border: #e2e8f0;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top right, #eaf2ff 0, transparent 34%), var(--bg);
  color: var(--ink);
  padding-bottom: 96px;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 470px; margin: 0 auto; padding: 28px 18px; }
.wrap.dash { max-width: 760px; }

h1, h2, h3, p { line-height: 1.35; }
h1 { font-size: 24px; letter-spacing: -0.04em; text-align: center; margin: 0 0 6px; }
h2 { font-size: 20px; letter-spacing: -0.03em; }
h3 { letter-spacing: -0.02em; }
p.sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 24px; }

.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

label { display: block; font-size: 12px; font-weight: 700; color: #475569; margin: 14px 0 6px; }
input, select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-soft);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, select:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
input::placeholder { color: #94a3b8; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  margin-top: 16px;
  box-shadow: 0 8px 16px rgba(37, 99, 235, .2);
  transition: transform .2s, box-shadow .2s, filter .2s;
}
button:hover, .btn:hover { transform: translateY(-1px); filter: brightness(1.03); box-shadow: 0 12px 22px rgba(37, 99, 235, .24); }
button:active, .btn:active { transform: translateY(0); }
.btn.secondary { background: var(--accent-light); color: var(--accent-dark); box-shadow: none; }

.erro, .ok {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}
.erro { background: var(--bad-light); color: var(--bad); border: 1px solid #fecaca; }
.ok { background: var(--good-light); color: var(--good); border: 1px solid #a7f3d0; }
.link { display: block; text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.link a { color: var(--accent); font-weight: 700; text-decoration: none; }
.codigo-box { background: var(--accent-light); color: var(--accent-dark); border-radius: 14px; padding: 16px; text-align: center; font-size: 24px; font-weight: 900; letter-spacing: 3px; margin: 16px 0; }

header.app-header {
  max-width: 760px;
  margin: 0 auto;
  padding: 26px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
header.app-header h1 { font-size: 22px; text-align: left; margin: 0; }
header.app-header .sair {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 12px;
}
header.app-header .sair:hover { color: var(--bad); border-color: #fecaca; }

nav.tabs {
  position: fixed;
  bottom: 14px;
  left: 50%;
  width: min(720px, calc(100% - 24px));
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  justify-content: space-around;
  padding: 8px;
  z-index: 10;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .14);
  backdrop-filter: blur(12px);
}
nav.tabs a {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
  padding: 9px 3px;
  border-radius: 12px;
  transition: background .2s, color .2s;
}
nav.tabs a:hover { background: #f1f5f9; color: var(--accent); }
nav.tabs a.active { color: var(--accent); background: var(--accent-light); }

.total-box {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  border-radius: 22px;
  padding: 24px 20px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: 0 16px 28px rgba(37, 99, 235, .23);
}
.total-box .l { font-size: 12px; opacity: .84; font-weight: 700; }
.total-box .v { font-size: 32px; font-weight: 900; letter-spacing: -0.04em; margin-top: 4px; }

ul.list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ul.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card-soft);
  font-size: 14px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
ul.list li:hover { transform: translateY(-1px); border-color: #bfdbfe; box-shadow: var(--shadow-sm); }
ul.list li.feita .desc { text-decoration: line-through; opacity: .55; }
.desc { min-width: 0; font-weight: 650; }
.meta { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.valor { font-weight: 850; color: var(--accent); white-space: nowrap; }
.del { width: auto; min-height: auto; background: transparent; color: var(--bad); font-size: 16px; padding: 5px 7px; margin: 0; box-shadow: none; }
.del:hover { background: var(--bad-light); box-shadow: none; }
.icon { width: auto; min-height: auto; background: var(--accent-light); color: var(--accent-dark); border: none; padding: 7px 10px; border-radius: 9px; font-size: 13px; cursor: pointer; margin: 0; box-shadow: none; }
.icon:hover { box-shadow: none; background: #bfdbfe; }
.empty { justify-content: center !important; text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0 !important; background: transparent !important; border: none !important; }

@media (max-width: 520px) {
  header.app-header { padding-top: 20px; }
  .wrap { padding-top: 18px; }
  .card { padding: 17px; }
  nav.tabs a { font-size: 10px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a;
    --card: #172033;
    --card-soft: #111a2d;
    --ink: #e5edf8;
    --muted: #94a3b8;
    --border: #293750;
    --accent-light: #172d55;
    --good-light: #123b32;
    --bad-light: #451b25;
    --shadow: 0 14px 30px rgba(0, 0, 0, .2);
  }
  body { background: radial-gradient(circle at top right, #172554 0, transparent 36%), var(--bg); }
  .card, nav.tabs, header.app-header .sair { background: rgba(23, 32, 51, .94); }
  input, select { background: #111a2d; }
  input:focus, select:focus { background: #172033; }
  ul.list li { background: #111a2d; }
  nav.tabs a:hover { background: #1e293b; }
}