@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=Sora:wght@500;700&display=swap");

:root {
  --bg-1: #08122f;
  --bg-2: #132d66;
  --bg-3: #2a1148;
  --text: #e6eeff;
  --muted: #b9c7ef;
  --blue: #4f8dff;
  --blue-soft: #89b4ff;
  --purple: #7f56d9;
  --positive: #49d39b;
  --negative: #ff7b9a;
  --glass: rgba(15, 24, 56, 0.58);
  --glass-border: rgba(163, 189, 255, 0.24);
  --shadow: 0 24px 50px rgba(5, 9, 24, 0.45);
  --input-bg: rgba(10, 20, 48, 0.75);
  --input-border: rgba(134, 164, 240, 0.3);
  --ghost-bg: rgba(15, 32, 75, 0.62);
  --ghost-text: #d0ddff;
  --table-line: rgba(151, 174, 235, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(130deg, var(--bg-1), var(--bg-2) 48%, var(--bg-3));
  overflow-x: hidden;
}

body.theme-deep-ocean {
  --bg-1: #08122f;
  --bg-2: #163776;
  --bg-3: #2d1451;
}

body.theme-midnight-blue {
  --bg-1: #060f26;
  --bg-2: #123063;
  --bg-3: #31104f;
}

body.theme-navy-shade {
  --bg-1: #0a132f;
  --bg-2: #1c3361;
  --bg-3: #22103c;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(35px);
  z-index: -1;
  opacity: 0.6;
}

.shape-1 {
  width: 320px;
  height: 320px;
  top: -60px;
  right: -40px;
  background: linear-gradient(120deg, #2f62d6, #5f2fae);
}

.shape-2 {
  width: 280px;
  height: 280px;
  bottom: 60px;
  left: -80px;
  background: linear-gradient(120deg, #194eab, #253c89);
}

.shape-3 {
  width: 180px;
  height: 180px;
  top: 45%;
  right: 25%;
  background: #4a2f8a;
}

.app {
  width: min(1200px, 92vw);
  margin: 36px auto;
  display: grid;
  gap: 18px;
}

.top-finance-bar {
  position: sticky;
  top: 8px;
  z-index: 32;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
}

.top-kpi {
  padding: 8px 10px;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: rgba(10, 23, 56, 0.72);
}

.top-kpi .label {
  font-size: 0.82rem;
}

.top-kpi .value {
  margin-top: 3px;
  font-size: 0.98rem;
}

.side-menu {
  position: fixed;
  top: 14px;
  left: 14px;
  width: min(320px, 88vw);
  z-index: 80;
  padding: 14px;
}

.side-menu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.side-menu-nav {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.side-link {
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: rgba(9, 20, 49, 0.72);
  color: var(--text);
}

.side-link.active {
  background: linear-gradient(110deg, var(--blue), var(--purple));
  border-color: transparent;
}

.hidden {
  display: none !important;
}

.auth-screen {
  width: min(520px, 92vw);
  margin: 52px auto;
}

.auth-card {
  padding: 24px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.tab-btn {
  color: var(--ghost-text);
  background: var(--ghost-bg);
  border: 1px solid var(--input-border);
}

.tab-btn.active {
  color: #fff;
  background: linear-gradient(110deg, var(--blue), var(--purple));
  border-color: transparent;
}

.auth-message {
  margin: 12px 2px 2px;
  min-height: 24px;
  color: var(--blue-soft);
  font-weight: 600;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.brand {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blue-soft);
  font-weight: 800;
  font-size: 0.8rem;
}

h1,
h2 {
  font-family: "Sora", "Trebuchet MS", sans-serif;
  margin: 8px 0 10px;
}

h1 {
  font-size: clamp(1.4rem, 2.2vw, 2rem);
}

h2 {
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 68ch;
}

header.panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-chip {
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  background: linear-gradient(120deg, rgba(79, 141, 255, 0.2), rgba(127, 86, 217, 0.25));
  white-space: nowrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px;
}

.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.value {
  margin: 8px 0 0;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-weight: 800;
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--negative);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  gap: 14px;
}

.content-grid.single-column {
  grid-template-columns: 1fr;
}

.stack-column {
  display: grid;
  gap: 14px;
}

.actions-dock {
  padding: 14px 16px;
}

.actions-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.reports-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-open-btn {
  width: auto;
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(120deg, rgba(64, 132, 255, 0.95), rgba(59, 206, 166, 0.9));
}

.action-drawer {
  border-radius: 18px;
}

.action-panel {
  margin-top: 10px;
  padding-top: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.transaction-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.93rem;
}

input,
select,
button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  padding: 12px 13px;
  font: inherit;
}

input,
select {
  background: var(--input-bg);
  color: var(--text);
}

input::placeholder {
  color: #8ca3d9;
}

button {
  border: none;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(110deg, var(--blue), var(--purple));
  transition: transform 0.2s ease, filter 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.app-message {
  margin: 8px 2px 0;
  min-height: 24px;
  color: var(--blue-soft);
  font-weight: 700;
}

.ghost-btn {
  background: var(--ghost-bg);
  color: var(--ghost-text);
  border: 1px solid var(--input-border);
  width: auto;
  padding-inline: 14px;
}

.table-wrap {
  overflow: auto;
  margin-top: 10px;
}

.subpanel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: rgba(7, 15, 38, 0.45);
}

h3 {
  margin: 0 0 10px;
  font-family: "Sora", "Trebuchet MS", sans-serif;
  font-size: 1rem;
}

.month-filter-bar {
  align-items: flex-start;
}

.month-filter-bar.compact {
  align-items: center;
  margin-bottom: 0;
}

.month-dock {
  position: sticky;
  top: 10px;
  z-index: 30;
  border-radius: 16px;
  padding: 14px 16px;
  background: linear-gradient(130deg, rgba(11, 25, 58, 0.95), rgba(18, 44, 92, 0.94));
  border: 1px solid rgba(132, 164, 238, 0.4);
  box-shadow: 0 16px 28px rgba(5, 10, 28, 0.35);
}

.month-dock-content {
  margin-top: 8px;
}

.month-tabs-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.month-range-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.month-range-label select {
  width: auto;
  min-width: 110px;
  padding: 8px 10px;
}

.month-nav-btn {
  padding: 8px 11px;
}

.month-tabs {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.month-tab {
  width: auto;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  background: rgba(12, 28, 66, 0.7);
  color: var(--muted);
  font-weight: 700;
}

.month-tab.active {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(110deg, var(--blue), var(--purple));
}

.month-more-menu {
  margin-top: 8px;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: rgba(7, 18, 44, 0.96);
  display: grid;
  gap: 6px;
  padding: 8px;
}

.month-more-item {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: rgba(11, 26, 60, 0.82);
  color: var(--text);
  padding: 8px 10px;
}

.month-title {
  margin: 6px 0 4px;
  color: #dbe6ff;
  font-weight: 800;
}

.month-summary {
  margin: 0 0 12px;
}

.month-summary-header {
  margin-bottom: 8px;
  color: var(--blue-soft);
  font-weight: 800;
  font-size: 0.92rem;
}

.month-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.month-kpi {
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--table-line);
  background: rgba(9, 22, 54, 0.72);
}

.kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.kpi-value {
  margin: 6px 0 0;
  color: var(--text);
  font-weight: 800;
  font-size: 0.98rem;
  line-height: 1.2;
}

.card-list,
.launch-list {
  display: grid;
  gap: 10px;
}

.launch-grid-head,
.launch-row {
  display: grid;
  grid-template-columns: 86px minmax(220px, 1fr) 120px 160px;
  gap: 8px;
  align-items: center;
}

.launch-grid-head {
  padding: 8px 10px;
  border: 1px solid var(--table-line);
  border-radius: 10px;
  background: rgba(7, 19, 46, 0.72);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.launch-row {
  padding: 9px 10px;
  border: 1px solid var(--table-line);
  border-radius: 10px;
  background: rgba(8, 18, 44, 0.55);
  font-size: 0.9rem;
}

.launch-row span {
  min-width: 0;
}

.launch-row strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.launch-spender-select {
  padding: 8px 9px;
  border-radius: 9px;
  font-size: 0.83rem;
}

.spender-picker-btn {
  width: auto;
  max-width: 130px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 4px 7px;
  background: rgba(10, 25, 58, 0.78);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.launch-row > span:nth-child(4) {
  text-align: right;
}

.mini-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--table-line);
  border-radius: 12px;
  background: rgba(10, 19, 48, 0.62);
}

.mini-title {
  margin: 0;
  font-weight: 800;
  font-size: 1rem;
}

.mini-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.87rem;
}

.launch-item {
  border: 1px solid var(--table-line);
  border-radius: 14px;
  background: rgba(8, 18, 44, 0.75);
  padding: 14px;
}

.launch-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.launch-title {
  margin: 0;
  font-weight: 800;
  font-size: 1.08rem;
}

.launch-meta {
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.launch-meta span {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  background: rgba(10, 26, 62, 0.9);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.launch-amount {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 800;
  white-space: nowrap;
}

.launch-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.empty-text {
  margin: 6px 0;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--table-line);
  font-size: 0.92rem;
}

td strong.income {
  color: var(--positive);
}

td strong.expense {
  color: var(--negative);
}

.delete-btn {
  border: 1px solid rgba(255, 123, 154, 0.35);
  color: #ffb3c4;
  background: rgba(74, 19, 43, 0.45);
  padding: 6px 9px;
  border-radius: 8px;
  width: auto;
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: revealUp 0.6s ease forwards;
}

.reveal:nth-child(2) {
  animation-delay: 0.1s;
}

.reveal:nth-child(3) {
  animation-delay: 0.2s;
}

.reveal:nth-child(4) {
  animation-delay: 0.3s;
}

@keyframes revealUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .month-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .launch-grid-head,
  .launch-row {
    grid-template-columns: 78px minmax(180px, 1fr) 104px 140px;
  }

  .top-finance-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .app {
    width: 100%;
    max-width: 100%;
    margin: 14px auto;
    padding: 0 10px;
    gap: 12px;
  }

  .auth-screen {
    margin: 20px auto;
  }

  .panel {
    padding: 16px;
    max-width: 100%;
    overflow: hidden;
  }

  .top-finance-bar {
    top: 6px;
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    gap: 8px;
    padding: 8px;
  }

  .top-kpi {
    flex: 0 0 auto;
    min-width: 180px;
    padding: 8px 10px;
    scroll-snap-align: start;
  }

  .top-kpi .value {
    font-size: 0.95rem;
  }

  header.panel {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .header-right {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .side-menu {
    top: 0;
    left: 0;
    width: min(320px, 86vw);
    height: 100dvh;
    border-radius: 0 14px 14px 0;
    background: rgba(7, 16, 41, 0.96);
    border: 1px solid rgba(133, 165, 238, 0.34);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
  }

  .actions-toolbar {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .action-open-btn {
    width: auto;
    white-space: nowrap;
  }

  .mini-card,
  .launch-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .launch-list {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .launch-grid-head,
  .launch-row {
    min-width: 460px;
    width: max-content;
    grid-template-columns: 58px minmax(170px, 1fr) 90px 110px;
    gap: 6px;
    align-items: center;
  }

  .launch-grid-head {
    display: grid;
    padding: 6px 8px;
    font-size: 0.64rem;
  }

  .launch-row {
    display: grid;
    margin-top: 6px;
    padding: 6px 8px;
    font-size: 0.74rem;
    border-radius: 10px;
    border: 1px solid var(--table-line);
    background: rgba(8, 18, 44, 0.62);
  }

  .launch-row > span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .launch-row > span:nth-child(2) {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .launch-row > span:nth-child(1) {
    color: var(--muted);
  }

  .launch-row strong {
    display: block;
    font-size: 0.76rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .launch-amount {
    font-size: 0.79rem;
  }

  .spender-picker-btn {
    width: auto;
    max-width: 110px;
    padding: 4px 6px;
    font-size: 0.64rem;
    text-align: center;
  }

  .launch-row .delete-btn {
    padding: 4px 6px;
    font-size: 0.68rem;
  }

  .month-filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .month-filter-bar.compact {
    flex-direction: row;
    align-items: center;
  }

  .month-dock {
    top: 6px;
    padding: 12px;
    max-width: 100%;
  }

  .month-tabs-toolbar {
    width: 100%;
    max-width: 100%;
  }

  .month-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .month-tab {
    white-space: nowrap;
    padding: 8px 10px;
    scroll-snap-align: start;
  }

  .month-title {
    margin-top: 2px;
    font-size: 1rem;
  }

  .month-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .month-kpi {
    padding: 9px;
  }

  .kpi-value {
    font-size: 0.92rem;
  }
}
