:root {
  --bg-top: #eef5f3;
  --bg-mid: #e5efec;
  --bg-bottom: #f6faf8;
  --surface: rgba(255, 255, 255, 0.82);
  --text: #163233;
  --muted: #4f6f6f;
  --accent: #2f5f5f;
  --line: rgba(213, 226, 222, 0.92);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'SF Pro Display', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 42%),
    radial-gradient(circle at 88% 16%, rgba(224, 238, 233, 0.55) 0%, rgba(224, 238, 233, 0) 38%),
    linear-gradient(160deg, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-bottom) 100%);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 14px 24px;
}

.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}

.glass-card {
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow:
    0 14px 32px rgba(22, 50, 51, 0.1),
    0 2px 8px rgba(22, 50, 51, 0.05);
}

#appTitle {
  margin: 2px 0 18px;
  font-size: 1.52rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  letter-spacing: 0.03em;
  color: #194547;
  text-shadow: 0 8px 24px rgba(129, 191, 178, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2f6f67;
  filter: drop-shadow(0 3px 8px rgba(88, 149, 137, 0.45));
  transform: translateY(1px);
}

.top-tabs {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.header-label {
  font-weight: 600;
  color: var(--muted);
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 46px;
  padding: 0 12px;
  font-size: 0.96rem;
  background: rgba(255, 255, 255, 0.95);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, #4f6f6f 50%),
    linear-gradient(135deg, #4f6f6f 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

#monthSelect {
  width: 138px;
}

button {
  border: 0;
  border-radius: 12px;
  min-height: 46px;
  padding: 0 14px;
  background: rgba(47, 95, 95, 0.9);
  color: #f8fafb;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.subtle {
  background: rgba(255, 255, 255, 0.9);
  color: #2f5254;
}

.row {
  display: flex;
  gap: 8px;
}

.budget-wrap {
  margin-top: 12px;
}

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

.budget-values {
  display: grid;
  justify-items: end;
}

.budget-values small {
  color: var(--muted);
  font-size: 0.8rem;
}

.progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(239, 244, 242, 0.95);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4a8d83 0%, #7fb4aa 100%);
}

.budget-input-row {
  margin-top: 10px;
}

.composer label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--muted);
}

.section-title {
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.panel {
  opacity: 1;
}

.panel.is-visible {
  opacity: 1;
}

.tx-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.tx-item {
  border: 1px solid rgba(214, 228, 223, 0.92);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.tx-item p {
  margin: 2px 0;
}

.tx-main {
  font-weight: 600;
}

.tx-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.tx-price {
  font-weight: 700;
}

.tx-action {
  margin-top: 6px;
  width: 100%;
  min-height: 38px;
  font-size: 0.88rem;
}

.edit-panel {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-block;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.83rem;
  color: #2e5756;
  background: rgba(255, 255, 255, 0.9);
}

.edit-actions {
  margin-top: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.86rem;
}

.tab {
  min-height: 44px;
  background: rgba(255, 255, 255, 0.86);
  color: #2f5555;
  border: 1px solid rgba(214, 228, 223, 0.92);
}

.tab.active {
  background: rgba(47, 95, 95, 0.92);
  color: #fff;
  box-shadow: 0 6px 14px rgba(37, 84, 81, 0.24);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-box {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(214, 228, 223, 0.96);
  border-radius: 12px;
  box-shadow: 0 5px 14px rgba(22, 50, 51, 0.07);
  padding: 10px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

.calendar-day {
  min-height: 64px;
  border-radius: 10px;
  padding: 6px;
  border: 1px solid rgba(214, 228, 223, 0.92);
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  align-content: space-between;
}

.calendar-day.empty {
  background: rgba(244, 247, 246, 0.72);
  border-style: dashed;
}

.calendar-date {
  font-size: 0.78rem;
  color: var(--muted);
}

.calendar-amount {
  font-size: 0.74rem;
  line-height: 1.2;
  font-weight: 600;
  color: var(--text);
}

.summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.summary-item {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(214, 228, 223, 0.92);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.summary-item small {
  color: var(--muted);
}

.summary-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.summary-bar-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(228, 236, 233, 0.9);
  overflow: hidden;
}

.summary-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #5e9f94 0%, #88b9b0 100%);
}

.sheet-link-btn {
  width: 100%;
  min-height: 48px;
  background: rgba(112, 145, 140, 0.78);
  color: rgba(249, 253, 252, 0.98);
  border: 1px solid rgba(190, 214, 209, 0.78);
  box-shadow: 0 6px 14px rgba(73, 106, 101, 0.14);
}

.stats-bottom-action {
  margin-top: 6px;
  margin-bottom: 4px;
}

.hidden {
  display: none;
}
