:root {
  --bg: #060c17;
  --bg-2: #0a1323;
  --panel: rgba(15, 24, 42, 0.9);
  --panel-soft: rgba(18, 29, 50, 0.96);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f5f8ff;
  --muted: #9bb0d1;
  --accent: #7d8cff;
  --accent-2: #ff76c8;
  --accent-3: #43d7b7;
  --red: #ff7287;
  --yellow: #ffc85c;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  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;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(125, 140, 255, 0.2), transparent 25%),
    radial-gradient(circle at 100% 10%, rgba(255, 118, 200, 0.18), transparent 28%),
    linear-gradient(180deg, #060c17 0%, #08111f 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(46px);
  opacity: 0.24;
  pointer-events: none;
}

.ambient-one {
  width: 180px;
  height: 180px;
  top: 4%;
  left: -36px;
  background: rgba(125, 140, 255, 0.6);
}

.ambient-two {
  width: 160px;
  height: 160px;
  right: -30px;
  bottom: 20%;
  background: rgba(255, 118, 200, 0.48);
}

.phone-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(8, 14, 28, 0.92), rgba(7, 12, 24, 0.96));
  border-inline: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: calc(102px + env(safe-area-inset-bottom));
}

@media (min-width: 640px) {
  .phone-shell {
    min-height: calc(100vh - 26px);
    margin: 13px auto;
    border-radius: 36px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: max(16px, env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(180deg, rgba(7, 12, 24, 0.95), rgba(7, 12, 24, 0.82));
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 1.4rem;
  background: linear-gradient(135deg, rgba(125, 140, 255, 0.28), rgba(255, 118, 200, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-copy h1 {
  margin-bottom: 6px;
  font-size: 1.6rem;
  line-height: 1.02;
}

.eyebrow,
.section-label {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c8d4f0;
}

.subtitle,
.muted,
small.muted {
  color: var(--muted);
}

.header-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.month-chip,
.pill,
.text-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8efff;
  font-size: 0.84rem;
}

.header-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 10px;
  margin-top: 14px;
}

.compact-field {
  display: grid;
  gap: 8px;
}

.compact-field span {
  font-size: 0.76rem;
  color: #bdcae5;
}

.compact-field input,
input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 14px 15px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #8698b8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(125, 140, 255, 0.8);
  box-shadow: 0 0 0 4px rgba(125, 140, 255, 0.14);
}

.quick-action,
.primary-btn,
.ghost-btn,
.text-btn,
.segment-btn,
.nav-item,
.mini-link,
.action-btn {
  transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.quick-action,
.ghost-btn,
.action-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.quick-action {
  border-radius: 16px;
  min-height: 52px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}

.primary-btn,
.ghost-btn,
.action-btn {
  min-height: 46px;
  border-radius: 16px;
  padding: 0 16px;
}

.primary-btn {
  border: 0;
  color: white;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.big-btn {
  min-height: 52px;
  border-radius: 18px;
}

.text-btn {
  border: 0;
  background: transparent;
  color: #cfe0ff;
  font-weight: 600;
  padding: 0;
}

.quick-action:hover,
.primary-btn:hover,
.ghost-btn:hover,
.action-btn:hover,
.text-btn:hover,
.nav-item:hover,
.segment-btn:hover {
  transform: translateY(-1px);
  opacity: 0.96;
}

.app-main {
  padding: 14px 16px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.auth-panel,
.hero-card,
.mobile-chart-card,
.mobile-section-card,
.form-panel,
.transactions-panel {
  padding: 18px;
}

.auth-panel {
  display: grid;
  gap: 18px;
}

.auth-mascots {
  display: flex;
  gap: 10px;
  font-size: 1.8rem;
}

.auth-form,
.transaction-form {
  display: grid;
  gap: 16px;
}

.screen {
  display: none;
}

.screen.is-active {
  display: grid;
  gap: 16px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 14px;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(125, 140, 255, 0.18), rgba(255, 118, 200, 0.1)),
    var(--panel);
}

.hero-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.hero-mascot {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-badge {
  text-align: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff0c6;
  font-size: 0.86rem;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  padding: 16px;
}

.summary-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.card-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.15rem;
}

.summary-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.4rem;
}

.balance-card {
  background: linear-gradient(135deg, rgba(125, 140, 255, 0.28), rgba(255, 118, 200, 0.14));
}

.income-card strong {
  color: var(--accent-3);
}

.expense-card strong {
  color: var(--red);
}

.count-card strong {
  color: var(--yellow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.donut-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.chart-ring {
  width: 150px;
  height: 150px;
  padding: 14px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent-3) 0deg 180deg, var(--red) 180deg 360deg);
}

.chart-ring.neutral {
  background: conic-gradient(rgba(255, 255, 255, 0.14) 0deg 360deg);
}

.ring-hole {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  border-radius: 999px;
  background: rgba(7, 12, 24, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ring-hole strong {
  font-size: 1rem;
}

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

.donut-side {
  display: grid;
  gap: 10px;
}

.mini-stat {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-stat span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.legend-list,
.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.legend-item,
.trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.segment-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-segment {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segment-btn {
  min-height: 44px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #dfe8ff;
  font-weight: 600;
}

.segment-btn.is-active {
  background: linear-gradient(135deg, rgba(125, 140, 255, 0.32), rgba(255, 118, 200, 0.18));
  border-color: rgba(125, 140, 255, 0.36);
  color: white;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-transactions,
.transactions-list,
.breakdown-list,
.insight-grid {
  display: grid;
  gap: 12px;
}

.mini-transaction,
.transaction-item,
.breakdown-item,
.insight-card {
  border-radius: 20px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-transaction {
  padding: 14px;
}

.mini-row,
.transaction-row,
.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.mini-main,
.transaction-main {
  display: grid;
  gap: 6px;
}

.mini-title,
.transaction-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mini-icon,
.transaction-icon,
.breakdown-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.08);
}

.mini-meta,
.transaction-meta,
.breakdown-copy span {
  color: var(--muted);
  font-size: 0.84rem;
}

.mini-amount,
.transaction-amount {
  font-weight: 800;
}

.mini-amount.income,
.transaction-amount.income {
  color: var(--accent-3);
}

.mini-amount.expense,
.transaction-amount.expense {
  color: var(--red);
}

.transaction-item {
  padding: 16px;
}

.transaction-item.income {
  box-shadow: inset 4px 0 0 rgba(67, 215, 183, 0.7);
}

.transaction-item.expense {
  box-shadow: inset 4px 0 0 rgba(255, 114, 135, 0.75);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.badge-income {
  background: rgba(67, 215, 183, 0.16);
  color: #98f1dc;
}

.badge-expense {
  background: rgba(255, 114, 135, 0.16);
  color: #ffc4ce;
}

.transaction-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.breakdown-item {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.breakdown-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.breakdown-copy strong {
  display: block;
}

.breakdown-value {
  font-weight: 800;
  text-align: right;
}

.breakdown-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.breakdown-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
}

.trend-chart {
  min-height: 170px;
}

.trend-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.daily-chart {
  min-height: 155px;
}

.daily-bars {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 146px;
}

.day-column {
  flex: 1;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.day-bar-shell {
  width: 100%;
  min-height: 118px;
  display: flex;
  align-items: end;
}

.day-bar {
  width: 100%;
  min-height: 10px;
  border-radius: 999px 999px 16px 16px;
  background: linear-gradient(180deg, var(--yellow), var(--accent-2));
}

.day-label,
.day-value {
  font-size: 0.76rem;
}

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

.day-value {
  color: #ffe8b3;
}

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

.insight-card {
  padding: 14px;
}

.insight-icon {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.insight-card span,
.insight-card strong,
.insight-card small {
  display: block;
}

.insight-card span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.empty-state {
  padding: 16px;
  text-align: center;
  border-radius: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  width: min(calc(100% - 20px), 398px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 24px;
  background: rgba(9, 15, 28, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.nav-item {
  min-height: 62px;
  display: grid;
  place-items: center;
  gap: 4px;
  border-radius: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.nav-item.is-active {
  background: linear-gradient(135deg, rgba(125, 140, 255, 0.25), rgba(255, 118, 200, 0.18));
  color: white;
}

.nav-icon {
  font-size: 1.12rem;
}

.nav-label {
  font-size: 0.76rem;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(94px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(9, 15, 27, 0.96);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

@media (max-width: 420px) {
  .donut-layout,
  .hero-card,
  .insight-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-side {
    justify-items: start;
  }

  .chart-ring {
    margin-inline: auto;
  }
}
