* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #f8fbff 0%, #eef3fb 100%);
  color: #1c2333;
}

a {
  color: #1557ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e7edf8;
  box-shadow: 0 2px 12px rgba(31, 41, 55, 0.05);
}

.topbar-inner {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #13213a;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 38px;
  height: 38px;
  display: block;
  border-radius: 11px;
  box-shadow: 0 6px 16px rgba(31, 94, 255, 0.22);
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-name {
  font-size: 0.98rem;
  letter-spacing: 0.2px;
}

.brand-tagline {
  font-size: 0.72rem;
  color: #66738a;
  font-weight: 600;
}

.nav-link {
  margin-left: 6px;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main {
  padding: 12px 0 22px;
}

.card {
  background: #fff;
  border: 1px solid #dfe6f3;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(22, 32, 55, 0.06);
}

.form-card {
  max-width: 520px;
  margin: 0 auto;
}

.stack {
  display: grid;
  gap: 8px;
}

.stack-lg {
  display: grid;
  gap: 12px;
}

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

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

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wrap-gap {
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid #c7d2ea;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #2f6bff 0%, #2159eb 100%);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(31, 94, 255, 0.15);
}

.btn-small {
  padding: 6px 10px;
  font-size: 0.9rem;
}

.btn:hover {
  background: linear-gradient(180deg, #2961ef 0%, #1b4dd0 100%);
}

.btn-ghost {
  background: #f8fbff;
  color: #21314d;
  border: 1px solid #d3dcf0;
}

.btn-ghost:hover {
  background: #eef4ff;
}

.flash {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.flash p {
  margin: 4px 0;
}

.flash-error {
  background: #ffe5e8;
  border: 1px solid #ffbac4;
}

.flash-success {
  background: #e6faee;
  border: 1px solid #b4e9c9;
}

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

.stats dt {
  font-size: 0.82rem;
  color: #5e687d;
}

.stats dd {
  margin: 6px 0 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.good {
  color: #11753a;
}

.bad {
  color: #b3272d;
}

.muted {
  color: #57607a;
}

.clean-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.pill {
  display: inline-block;
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid #d1d9ea;
  text-transform: capitalize;
}

.pill.income {
  border-color: #98dcb3;
  background: #ecfbf2;
}

.pill.expense {
  border-color: #ffb4be;
  background: #fff0f3;
}

.table-wrap {
  overflow-x: auto;
}

table thead th {
  font-size: 0.88rem;
  color: #5c6780;
  font-weight: 700;
  background: #f8faff;
}

table tbody tr:hover {
  background: #fbfcff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid #e8ecf7;
  padding: 6px;
  text-align: left;
  vertical-align: top;
}

.editable-list-item {
  border: 1px solid #e3e9f7;
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 6px;
  background: #fcfdff;
}

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

.action-summary {
  cursor: pointer;
  color: #2159eb;
  font-weight: 600;
  font-size: 0.9rem;
}

.compact-form {
  margin-top: 6px;
  gap: 6px;
}

.compact-delete {
  margin-top: 2px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.section-head h2 {
  margin: 0;
}

.modal-card {
  width: min(460px, 92vw);
  border: 1px solid #dfe6f8;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
}

.modal-card::backdrop {
  background: rgba(10, 15, 30, 0.42);
}

.modal-close-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.error-box {
  white-space: pre-wrap;
  background: #fff3f4;
  border: 1px solid #ffb4be;
  border-radius: 8px;
  padding: 10px;
}

.budget-tabs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tabs-sidebar {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.tab-link {
  display: block;
  border: 1px solid #d4ddf3;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  color: #24304a;
  background: #f8faff;
}

.tab-link:hover {
  text-decoration: none;
  background: #edf2ff;
}

.tab-link.active {
  background: #1f5eff;
  color: #fff;
  border-color: #1f5eff;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.section-head h2 {
  margin: 0;
}

.modal-card {
  width: min(460px, 92vw);
  border: 1px solid #dfe6f8;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
}

.modal-card::backdrop {
  background: rgba(10, 15, 30, 0.42);
}

.modal-close-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.tab-panel-wrap {
  min-width: 0;
}

.analytics-list li {
  border: 1px solid #e6ebfb;
  border-radius: 10px;
  padding: 10px;
}

.analytics-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.small-text {
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .budget-tabs-layout {
    grid-template-columns: 1fr;
  }

  .tabs-sidebar {
    position: static;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    overflow-x: auto;
    white-space: nowrap;
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .topbar-inner {
    min-height: 46px;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  .brand-name {
    font-size: 0.92rem;
  }

  .brand-tagline {

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  table {
    min-width: 620px;
  }
}

@media (min-width: 1024px) {
  body {
    font-size: 15px;
  }

  .container {
    width: min(1280px, 94vw);
  }

  .tabs-sidebar {
    gap: 6px;
    padding: 8px;
  }

  .tab-link {
    padding: 8px 10px;
  }
}
}