:root {
  /*
  --bg-start: #0f1724;
  --bg-end: #071029;
  --card-bg: rgba(255,255,255,0.02);
  --card-border: rgba(255,255,255,0.04);
  --muted: #94a3b8;
  --text: #e6eef8;
  */
  --accent-1: #7c3aed;
  /* purple */
  --accent-2: #06b6d4;
  /* cyan */
  --btn-grad: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  --glass: rgba(255, 255, 255, 0.03);
  --radius: 14px;
}

/* Page background and container */
html,
body {
  height: 100%
}

body {
  background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
  color: var(--text);
  padding: 5px;
  font-family: Inter, system-ui, Segoe UI, Roboto, Arial
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 5px
}

a {
  text-decoration: none;
  font-size: 12px;
}

/* Header */
header {
  margin-bottom: 16px
}

h1 {
  font-size: 22px;
  color: var(--text);
  margin-bottom: 6px
}

.subtitle {
  color: var(--muted);
  font-size: 13px
}

/* Card / glass look */
.card {
  background: var(--card-bg);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.2);
  margin-bottom: 14px
}

/* Forms */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px
}

label {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  min-width: 0
}

input[type=text],
input[type=number],
input[type=date],
select {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-size: 14px
}

/* Buttons */
a,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px
}

a,
button {
  padding: 10px 14px;
  border-radius: 12px;
  border: 0;
  background: var(--btn-grad);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.14);
  transition: transform .12s, box-shadow .12s, opacity .12s
}

a.pill-link,
button:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(124, 58, 237, 0.18)
}

a,
button.secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text)
}

/* Summary */
.summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px
}

.summary-item {
  flex: 1;
  min-width: 140px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  padding: 12px;
  border-radius: 12px
}

.value {
  font-weight: 800;
  font-size: 18px;
  margin-top: 6px;
  color: var(--text)
}

/* Transactions list */
#transactions {
  list-style: none;
  padding: 0;
  margin: 0
}

.transaction {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  align-items: center
}

.trans-left {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0
}

.type-pill {
  /*padding: 6px 10px;*/
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.type-credit {
  background: #14b8afff
}

.type-debt {
  background: #ef4444
}

.trans-meta {
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden
}

.trans-meta div:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.trans-amt {
  font-weight: 800
}

.footer {
  margin-top: 18px;
  text-align: center;
  color: var(--muted)
}

/* Chart */
#chart {
  width: 100%;
  height: 180px;
  border-radius: 8px;
  background: transparent
}

/* Modal */
.modal.hidden {
  display: none
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 92%;
  max-width: 560px;
  z-index: 60;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: #fff;
  box-shadow: 0 30px 60px rgba(2, 6, 23, 0.7);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--card-bg);
  padding: 20px
}

/* Collapsible filters panel */
.collapsible-panel {
  transition: all .18s ease;
  border-left: 4px solid rgba(124, 58, 237, 0.24);
}

.collapsible-panel.hidden {
  display: none
}

/* Toggle button smaller on desktop */
#toggle-filters {
  padding: 8px 10px
}

/* Responsive adjustments */
@media (max-width:640px) {
  .actions button {
    flex: 1
  }

  .row label {
    width: 100%
  }

  .summary-grid {
    flex-direction: column
  }

  h1 {
    font-size: 20px
  }
}

@media (min-width:641px) {
  .row label {
    min-width: 180px
  }

  .actions {
    justify-content: flex-start
  }
}

.tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tabs>button {
  flex: 1;
  border-radius: 0;
  border-bottom: 1px solid #d5d5d5;
  background: none;
  color: #333;
  box-shadow: none;
}

.tabs>button.active {
  background: #F5F5F5;
  color: #333;
}


/* small tweaks for inputs inside modals to appear stacked */
.modal .row {
  flex-direction: column;
  align-items: stretch
}

.modal .row label {
  width: 100%
}

/* subtle hover for transaction delete */
.transaction button.secondary {
  opacity: 0.9
}

.transaction button.secondary:hover {
  opacity: 1
}