:root {
  color-scheme: dark;
  --bg: #070a16;
  --surface: rgba(12, 17, 39, 0.9);
  --surface-strong: rgba(22, 29, 67, 0.95);
  --text: #f4f7ff;
  --muted: #9db2ff;
  --accent: #7c5dff;
  --accent-soft: rgba(124, 93, 255, 0.15);
  --success: #3ce6b1;
  --danger: #ff6b92;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at top left, rgba(124, 93, 255, 0.18), transparent 22%),
    radial-gradient(circle at bottom right, rgba(59, 107, 255, 0.14), transparent 20%),
    linear-gradient(180deg, #03050f 0%, #090c1c 100%);
  color: var(--text);
}

button, input, select {
  font: inherit;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 3vw, 3rem);
  line-height: 1.05;
}

.intro {
  margin: 16px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.theme-button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.theme-button:hover {
  transform: translateY(-1px);
  background: rgba(124, 93, 255, 0.14);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.summary-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 26px;
  min-height: 128px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.summary-card strong {
  display: block;
  font-size: 1.9rem;
}

.summary-card.accent {
  background: linear-gradient(135deg, rgba(124, 93, 255, 0.22), rgba(38, 105, 255, 0.14));
  border-color: rgba(124, 93, 255, 0.4);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 28px;
  backdrop-filter: blur(18px);
}

.glass-panel {
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.16);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.section-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

h2 {
  margin: 0;
  font-size: 1.4rem;
}

.transaction-form {
  display: grid;
  gap: 18px;
}

.transaction-form label {
  display: grid;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text);
}

.transaction-form input,
.transaction-form select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 18px;
  padding: 16px 18px;
}

.transaction-form input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.primary-button {
  border: none;
  background: linear-gradient(135deg, #7c5dff, #3b79ff);
  color: white;
  padding: 16px 20px;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(124, 93, 255, 0.24);
}

.chart-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.chart-container {
  position: relative;
  min-height: 320px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 28px;
}

.chart-hint {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.transactions-panel {
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th, td {
  padding: 18px 16px;
  text-align: left;
  font-size: 0.95rem;
}

thead th {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

tbody tr {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

tbody td {
  color: var(--text);
}

.type-income {
  color: #6ee7b7;
}

.type-expense {
  color: #fb7185;
}

.action-button {
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #fdfdfd;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 28px 0;
}

@media (max-width: 980px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .app-shell {
    width: calc(100% - 24px);
    padding: 24px 0 40px;
  }
  th, td {
    padding: 14px 12px;
  }
}

body.light {
  color-scheme: light;
  --bg: #f4f6ff;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-strong: rgba(255, 255, 255, 1);
  --text: #081132;
  --muted: #6676a9;
  --border: rgba(9, 18, 50, 0.08);
  background: radial-gradient(circle at top left, rgba(124, 93, 255, 0.18), transparent 22%),
    radial-gradient(circle at bottom right, rgba(59, 107, 255, 0.14), transparent 20%),
    linear-gradient(180deg, #f8fbff 0%, #e3ebff 100%);
}

body.light .panel,
body.light .summary-card,
body.light .chart-container {
  background: rgba(255, 255, 255, 0.92);
}

body.light .summary-card.accent {
  background: linear-gradient(135deg, rgba(124, 93, 255, 0.12), rgba(38, 105, 255, 0.08));
}

body.light .theme-button {
  background: rgba(9, 25, 58, 0.08);
  color: var(--text);
}

body.light .primary-button {
  background: linear-gradient(135deg, #7c5dff, #3b79ff);
}

body.light table {
  border-color: rgba(9, 18, 50, 0.08);
}

body.light tbody tr {
  border-color: rgba(9, 18, 50, 0.06);
}
