:root {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #38bdf8;
  --accent-hover: #0ea5e9;
  --success-color: #4ade80;
  --input-bg: #334155;
  --border-radius: 16px;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
  line-height: 1.5;
}

#app {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--accent-color), #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.5rem;
}

.header p {
  color: var(--text-secondary);
}

.container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--accent-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.5rem;
}

/* Payment Controls */
.payment-type-selector {
  display: flex;
  margin-bottom: 1rem;
  background: var(--input-bg);
  padding: 4px;
  border-radius: 8px;
}

.btn-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-tab.active {
  background: var(--accent-color);
  color: #fff;
}

.payment-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: end;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  width: 100%;
  height: 48px;
  /* Match input height roughly */
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.payment-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--input-bg);
  border-radius: 8px;
  font-size: 0.9rem;
}

/* Payment Table specific */
.payment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.payment-table th,
.payment-table td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.payment-table th {
  color: var(--text-secondary);
  font-weight: 500;
}

.payment-table .remove-btn {
  color: #ef4444;
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}

.payment-table .remove-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Table */
.full-width {
  grid-column: 1 / -1;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.select-small {
  background: var(--input-bg);
  color: var(--text-primary);
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  max-height: 500px;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 1rem;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-secondary);
  font-weight: 500;
  position: sticky;
  top: 0;
}

td {
  color: var(--text-primary);
}

@media (min-width: 900px) {
  .container {
    grid-template-columns: 350px 1fr;
    align-items: start;
  }
}


.card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.input-group {
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.input-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background-color: var(--input-bg);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.result-card {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.balance-section {
  text-align: center;
  margin-bottom: 2rem;
}

.label-small {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.balance-amount {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent-color);
  text-shadow: var(--shadow-glow);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: auto;
}

.stat-item {
  background-color: rgba(255, 255, 255, 0.03);
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  opacity: 0.5;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate {
  animation: fadeIn 0.5s ease-out forwards;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}