﻿:root {
  color-scheme: light;
  --bg: #f5f2ec;
  --surface: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --brand: #275f5d;
  --accent: #d58f2a;
  --positive: #0f7b41;
  --negative: #b42318;
  --border: #e5ded4;
  --shadow: 0 18px 32px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Tahoma", "Verdana", sans-serif;
  background: linear-gradient(160deg, #ffffff 0%, #f7f3ed 45%, #f1ebe2 100%);
  color: var(--ink);
}

h1, h2, h3 {
  font-family: "Georgia", "Times New Roman", serif;
  margin: 0 0 8px;
  color: var(--ink);
}

p {
  margin: 0;
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 22px 20px 80px;
}

.header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand span {
  font-size: 0.8rem;
  color: var(--muted);
}

.header .title {
  font-size: 1.8rem;
}

.header .subtitle {
  font-size: 0.95rem;
}

.header-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.logout {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: 12px;
  cursor: pointer;
}

.nav {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, 90%);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 12px 10px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.nav a {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}

.nav a.active {
  color: var(--brand);
}

.card-grid {
  display: grid;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.summary-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eef2f1;
  color: var(--brand);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.row:last-child {
  border-bottom: none;
}

.amount.positive {
  color: var(--positive);
  font-weight: 700;
}

.amount.negative {
  color: var(--negative);
  font-weight: 700;
}

.amount.neutral {
  color: var(--brand);
  font-weight: 700;
}

.chip {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  background: #f4efe7;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f0ece5;
  color: var(--muted);
  font-size: 0.75rem;
}

.form {
  display: grid;
  gap: 12px;
}

.form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 700;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}

.notice {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff3cd;
  color: #8a5d00;
  border: 1px solid #ffd48a;
  font-size: 0.9rem;
}

.error {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fdecea;
  color: #b42318;
  border: 1px solid #f5c2c7;
  font-size: 0.9rem;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title small {
  color: var(--muted);
}

.category-bar {
  height: 8px;
  background: #f1ede7;
  border-radius: 999px;
  overflow: hidden;
}

.category-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.detail-grid {
  display: grid;
  gap: 14px;
}

.detail-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: #faf7f2;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.detail-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.detail-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 6px;
}

.detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--muted);
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.auth-modal.hidden {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin-bottom: 6px;
}

@media (min-width: 768px) {
  .header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .card-grid.two {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-grid.three {
    grid-template-columns: repeat(3, 1fr);
  }

  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form.two {
    grid-template-columns: repeat(2, 1fr);
  }
}
