:root {
  color-scheme: light;
  --bg: radial-gradient(circle at 20% 35%, rgba(54, 176, 0, 0.25), transparent 35%), radial-gradient(circle at 80% 40%, rgba(255, 90, 95, 0.18), transparent 40%), #0a0a0c;
  --surface: #121215;
  --text: #f6f8f5;
  --muted: #9ea7b3;
  --accent: #36b000;
  --accent-2: #ff5a5f;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "SF Pro Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  padding-top: constant(safe-area-inset-top, 0);
  padding-top: env(safe-area-inset-top, 0);
  background-attachment: fixed;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.collapsible {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-height 420ms ease, opacity 320ms ease;
}

.collapsible.show {
  max-height: 1200px;
  opacity: 1;
  pointer-events: auto;
}

.collapsible.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

.landing-page .app-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.small-text {
  font-size: 13px;
}

.app-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px 20px;
  align-items: center;
  margin-bottom: 28px;
}

.app-header--compact {
  margin-bottom: 12px;
}

.landing-header .app-title {
  font-size: clamp(32px, 6vw, 44px);
}

.landing-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 520px;
}

.landing-mark {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.connection-indicator {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4), 0 10px 20px rgba(0, 0, 0, 0.25);
  z-index: 30;
}

.connection-indicator.online {
  background: var(--accent);
}

.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  display: block;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.app-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.app-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.02em;
}

.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.main {
  display: grid;
  gap: 18px;
}

.app-main {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
}

.download-main {
  display: grid;
  gap: 16px;
}

.card {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.action-card.card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 8px 0;
}

.card h2 {
  margin: 0 0 8px;
}

.card h3 {
  margin: 0;
}

.cta-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn.danger {
  background: linear-gradient(120deg, #c8162c, #ff5a5f);
  color: #0b0b0d;
  box-shadow: 0 12px 30px rgba(200, 22, 44, 0.32);
}

.btn.primary {
  background: linear-gradient(120deg, #2da300, #44c600);
  color: #0b0b0d;
  box-shadow: 0 12px 30px rgba(68, 198, 0, 0.32);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  transition: background 200ms ease, transform 160ms ease, border 200ms ease;
}

.btn.ghost:active {
  transform: translateY(1px);
}

.btn:active {
  transform: translateY(1px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.tile {
  background: rgba(255, 255, 255, 0.1);
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

.tile h3 {
  margin: 0 0 6px;
}

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

.action-card .action-row {
  display: flex;
  justify-content: center;
  margin: 6px 0;
  align-items: center;
}

.action-buttons {
  display: flex;
  gap: 12px;
  padding: 0;
  border: none;
  background: transparent;
}

.record-form {
  display: grid;
  gap: 12px;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  transition: padding 280ms ease, margin 280ms ease, border 280ms ease, max-height 420ms ease, opacity 320ms ease;
}

.record-form.show {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.record-form.collapsed {
  margin-top: 0;
  padding: 0;
  border: 0;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 14px;
  color: var(--muted);
}

.field input,
.field select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.16);
  font-size: 15px;
  color: var(--text);
}

.form-actions {
  display: flex;
  justify-content: flex-start;
}

.log-card {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

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

.log-controls {
  display: flex;
  align-items: center;
}

.month-filter {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}

.entry-feed {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

.entry-feed-wrapper {
  overflow: hidden;
}

.entry-feed.collapsed {
  max-height: 120px;
  overflow: hidden;
  transition: max-height 400ms ease, opacity 300ms ease;
  opacity: 0.95;
}

.entry-feed.expanded {
  max-height: 1200px;
  transition: max-height 400ms ease, opacity 300ms ease;
  opacity: 1;
}

.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.entry-title {
  font-weight: 600;
}

.entry-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.entry-amount {
  justify-self: end;
  font-weight: 700;
}

.entry-amount.income {
  color: var(--accent);
}

.entry-amount.expense {
  color: var(--accent-2);
}

.entry-actions {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.btn.small {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 16px;
  min-width: 48px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  transition: background 220ms ease, transform 160ms ease;
}

.btn.small:active {
  transform: translateY(1px);
}

.charts-card {
  grid-column: 1 / -1;
}

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

.chart-body {
  margin-top: 14px;
}

.chart-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.chart-tile {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.chart-wide {
  grid-column: 1 / -1;
}

.chart-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.chart-pie {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0 60%, rgba(255, 255, 255, 0.02) 60%);
  display: grid;
  place-items: center;
  position: relative;
}

.chart-pie.chart-empty::after {
  content: "Немає даних";
  color: var(--muted);
  font-size: 14px;
}

.chart-legend {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.chart-legend li {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-summary {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-weight: 700;
  color: #f6f8f5;
  gap: 10px;
}

.summary-income {
  color: var(--accent);
}

.summary-expense {
  color: var(--accent-2);
}

.crypto-card {
  grid-column: 1 / -1;
}

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

.crypto-total {
  text-align: right;
}

.crypto-total-value {
  font-size: 20px;
  font-weight: 700;
  color: #f6f8f5;
}

.crypto-change {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.crypto-trends {
  display: flex;
  gap: 14px;
  margin-top: 8px;
}

.crypto-actions {
  margin-top: 6px;
}

.crypto-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 400ms ease, opacity 300ms ease;
}

.crypto-list.expanded {
  max-height: 1200px;
  opacity: 1;
}

.crypto-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.crypto-info {
  display: grid;
  gap: 4px;
}

.crypto-symbol {
  font-weight: 700;
  color: #f6f8f5;
}

.crypto-name {
  font-size: 13px;
  color: var(--muted);
}

.crypto-change-asset {
  font-size: 13px;
  font-weight: 600;
}

.trend-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.trend-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.trend-label {
  font-size: 12px;
  color: var(--muted);
}

.crypto-pricing {
  text-align: right;
  font-size: 14px;
  color: var(--muted);
}

.crypto-value {
  font-weight: 700;
  color: #f6f8f5;
}

.crypto-input {
  display: grid;
  gap: 6px;
}

.crypto-input input {
  width: 120px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
  font-size: 15px;
}


@media (max-width: 720px) {
  .app-shell {
    padding: 28px 18px 48px;
  }

  .app-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .brand-mark {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-actions {
    justify-content: flex-start;
  }
}
