:root {
  --de-bg: #f4f5f7;
  --de-surface: #ffffff;
  --de-text: #1c1e21;
  --de-muted: #6b7280;
  --de-border: #e6e8eb;
  --de-primary: #146c43;
  --de-primary-contrast: #ffffff;
  --de-danger: #dc3545;
  --de-success: #198754;
  --de-safe-bottom: env(safe-area-inset-bottom, 0px);
  --de-safe-top: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --de-bg: #0f1115;
    --de-surface: #181b20;
    --de-text: #e7e9ec;
    --de-muted: #9aa1ab;
    --de-border: #2a2e35;
  }
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--de-bg);
  color: var(--de-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior-y: contain;
}

a { text-decoration: none; }

.de-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: var(--de-surface);
  border-bottom: 1px solid var(--de-border);
  padding-top: var(--de-safe-top);
}

.de-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
}

.de-topbar-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.de-main {
  padding: 1rem;
  padding-bottom: calc(84px + var(--de-safe-bottom));
  max-width: 720px;
  margin: 0 auto;
}

.de-card {
  background: var(--de-surface);
  border: 1px solid var(--de-border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: .75rem;
}

.de-card-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--de-muted);
  margin-bottom: .5rem;
}

.de-list-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--de-border);
}
.de-list-row:last-child { border-bottom: none; }

.de-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--de-primary) 15%, transparent);
  color: var(--de-primary);
  flex-shrink: 0;
}

.de-amount-expense { color: var(--de-danger); font-weight: 600; }
.de-amount-income { color: var(--de-success); font-weight: 600; }

.de-bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1030;
  background: var(--de-surface);
  border-top: 1px solid var(--de-border);
  padding-bottom: var(--de-safe-bottom);
}

.de-bottomnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

.de-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: .5rem 0 .4rem;
  color: var(--de-muted);
  font-size: .68rem;
}

.de-nav-item i { font-size: 1.3rem; }
.de-nav-item.active { color: var(--de-primary); }

.de-nav-fab {
  flex: 1;
  display: flex;
  justify-content: center;
  margin-top: -22px;
}

.de-nav-fab a {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--de-primary);
  color: var(--de-primary-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 6px 16px rgba(20,108,67,.4);
  border: 4px solid var(--de-bg);
}

.de-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.de-auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--de-surface);
  border-radius: 18px;
  padding: 2rem 1.5rem;
  border: 1px solid var(--de-border);
}

.de-toggle-group {
  display: flex;
  background: var(--de-bg);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.de-toggle-group button {
  flex: 1;
  border: none;
  background: transparent;
  padding: .5rem;
  border-radius: 9px;
  font-weight: 600;
  color: var(--de-muted);
}
.de-toggle-group button.active.expense { background: var(--de-danger); color: #fff; }
.de-toggle-group button.active.income { background: var(--de-success); color: #fff; }

.form-control, .form-select {
  background: var(--de-bg);
  border: 1px solid var(--de-border);
  color: var(--de-text);
}
.form-control:focus, .form-select:focus {
  background: var(--de-bg);
  color: var(--de-text);
}
