@font-face {
  font-family: "InstrumentSans";
  src: url("/assets/fonts/InstrumentSans-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "InstrumentSans";
  src: url("/assets/fonts/InstrumentSans-Bold.ttf") format("truetype");
  font-weight: 700;
}

@font-face {
  font-family: "GeistMono";
  src: url("/assets/fonts/GeistMono-Regular.ttf") format("truetype");
  font-weight: 400;
}

:root {
  --bg: #050505;
  --bg-soft: #0b0b0b;
  --panel: rgba(14, 14, 14, 0.92);
  --panel-strong: rgba(18, 18, 18, 0.96);
  --panel-alt: rgba(24, 24, 24, 0.92);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --accent: #8dcf9b;
  --accent-soft: rgba(141, 207, 155, 0.14);
  --accent-fade: rgba(141, 207, 155, 0.08);
  --success: #9fcd9f;
  --danger: #ff8f80;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "InstrumentSans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(141, 207, 155, 0.08), transparent 18%),
    linear-gradient(180deg, #090909 0%, #060606 45%, #030303 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 48%, transparent 94%);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(7, 17, 14, 0.96), rgba(9, 18, 15, 0.82)),
    rgba(7, 17, 14, 0.88);
  backdrop-filter: blur(18px);
}

.sidebar > div {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 0 22px;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
}

.brand strong {
  display: block;
  font-family: "InstrumentSans", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand span,
.muted {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--muted);
  transition: 180ms ease;
}

.nav a.active,
.nav a:hover {
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(141, 207, 155, 0.06));
  border-color: var(--line);
  transform: translateX(2px);
}

.page {
  padding: 34px;
}

.hero,
.panel,
.cards,
.masthead {
  animation: rise 0.55s ease;
}

.masthead {
  display: grid;
  gap: 18px;
  margin-bottom: 22px;
  padding: 28px 30px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(18, 18, 18, 0.94), rgba(11, 11, 11, 0.9)),
    var(--panel);
  box-shadow: var(--shadow);
}

.masthead-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  color: #b7d8bf;
  font-family: "GeistMono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-title,
.masthead h1,
.panel-header h1 {
  margin: 0;
  font-family: "InstrumentSans", sans-serif;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 18ch;
}

.masthead p,
.hero-note {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.65;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 22px;
  padding: 28px 30px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(18, 18, 18, 0.94), rgba(11, 11, 11, 0.9)),
    var(--panel);
  box-shadow: var(--shadow);
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(19, 19, 19, 0.96), rgba(11, 11, 11, 0.92)),
    var(--panel);
  box-shadow: var(--shadow);
}

.card {
  position: relative;
  overflow: hidden;
  min-height: 164px;
  padding: 22px;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(141, 207, 155, 0.08), transparent 48%);
  pointer-events: none;
}

.card span {
  position: relative;
  z-index: 1;
  display: inline-block;
  color: var(--muted);
  font-family: "GeistMono", monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 18px;
  font-family: "InstrumentSans", sans-serif;
  font-size: clamp(1.5rem, 1.8vw, 2.1rem);
  font-weight: 700;
  line-height: 1;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-family: "InstrumentSans", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-header h2 {
  font-size: 1.15rem;
}

.metric-list,
.stack {
  display: grid;
  gap: 12px;
}

.metric-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 22, 22, 0.94), rgba(14, 14, 14, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-item strong {
  font-family: "InstrumentSans", sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.metric-item.wrap {
  flex-wrap: wrap;
  align-items: center;
}

.actions-inline,
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

input,
select,
button,
textarea {
  font: inherit;
}

input,
select,
textarea {
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(7, 15, 12, 0.82);
  color: var(--text);
  padding: 0 16px;
}

textarea {
  min-height: 130px;
  padding-top: 14px;
  resize: vertical;
}

input::placeholder {
  color: #8da197;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.primary {
  background: linear-gradient(135deg, #f3f3f3, #dcdcdc);
  color: #090909;
}

.secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--text);
}

.button.danger {
  background: rgba(255, 143, 128, 0.12);
  border-color: rgba(255, 143, 128, 0.32);
  color: #ffd9d1;
}

.filters.compact {
  gap: 10px;
}

.filters.compact > * {
  flex: 1 1 140px;
}

.category-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.96), rgba(12, 12, 12, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.category-card-head,
.category-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.category-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-card-title strong {
  display: block;
  font-size: 1rem;
}

.category-card-title span {
  color: var(--muted);
  font-size: 0.82rem;
}

.category-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.category-card-body {
  display: grid;
  gap: 10px;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed rgba(217, 163, 95, 0.3);
  border-radius: 26px;
  background:
    radial-gradient(circle at top left, rgba(141, 207, 155, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(18, 18, 18, 0.88), rgba(10, 10, 10, 0.8));
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  padding: 24px;
}

.dropzone input {
  display: none;
}

.feedback-error {
  color: #ffb0a3;
}

.feedback-success {
  color: #b5dfb5;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(10, 10, 10, 0.56);
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(218, 187, 138, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: 0;
}

thead th {
  font-family: "GeistMono", monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #d6d6d6;
  background: rgba(16, 16, 16, 0.92);
  padding-top: 14px;
  padding-bottom: 14px;
}

.table-sort {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

.table-sort:hover {
  color: var(--accent);
}

tbody tr {
  transition: background 160ms ease;
}

tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.015);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.table-wrap select,
.table-wrap input[type="search"] {
  min-height: 34px;
  padding: 0 9px;
  border-radius: 10px;
  font-size: 0.82rem;
  width: 100%;
}

.table-wrap .button {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 0.76rem;
}

.col-check {
  width: 42px;
  vertical-align: middle;
}

.col-date {
  width: 128px;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
}

.col-date .table-sort {
  display: inline-flex;
  width: 100%;
  justify-content: center;
}

tbody td.col-date {
  font-size: 0.88rem;
  padding-left: 8px;
  padding-right: 8px;
}

.col-description {
  width: 32%;
}

.transaction-description {
  display: -webkit-box;
  line-height: 1.28;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.transaction-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
}

.col-classification {
  width: 26%;
}

.col-category {
  width: 22%;
}

.col-amount {
  width: 110px;
  white-space: nowrap;
  vertical-align: middle;
  font-weight: 600;
}

.col-actions {
  width: 58px;
  vertical-align: middle;
}

.col-actions .button.danger {
  width: 100%;
}

.cell-stack {
  display: grid;
  gap: 6px;
}

.cell-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 6px;
}

.col-classification .cell-inline select:last-child {
  text-align: center;
}

tfoot td {
  padding: 16px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 0;
}

tbody td.col-description,
tbody td.col-classification,
tbody td.col-category {
  padding-top: 10px;
  padding-bottom: 10px;
}

.table-summary-row td {
  background: rgba(255, 255, 255, 0.035);
  color: #e7e7e7;
  font-family: "GeistMono", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(141, 207, 155, 0.18);
  background: rgba(141, 207, 155, 0.08);
  color: #d9f0de;
  font-family: "GeistMono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.cashflow-chart {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.income {
  background: #8dcf9b;
}

.legend-dot.expense {
  background: #f1f1f1;
}

.chart-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-stage {
  position: relative;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.chart-grid-label,
.chart-axis-label {
  fill: #9a9a9a;
  font-size: 12px;
  font-family: "GeistMono", monospace;
}

.chart-axis-label {
  font-size: 11px;
}

.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line.income,
.chart-point.income {
  stroke: #8dcf9b;
  fill: #8dcf9b;
}

.chart-line.expense,
.chart-point.expense {
  stroke: #f1f1f1;
  fill: #f1f1f1;
}

.chart-point {
  cursor: pointer;
  transition: transform 140ms ease;
}

.chart-point:hover {
  transform: scale(1.12);
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 10, 10, 0.94);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  display: grid;
  gap: 4px;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip strong {
  font-size: 0.86rem;
}

.chart-tooltip span {
  color: var(--muted);
  font-size: 0.82rem;
}

.subtle {
  background: linear-gradient(180deg, rgba(19, 19, 19, 0.62), rgba(11, 11, 11, 0.5));
}

hr {
  margin: 22px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .page {
    padding: 20px;
  }

  .cards,
  .grid-two {
    grid-template-columns: 1fr;
  }

  .hero,
  .masthead,
  .panel {
    padding: 20px;
    border-radius: 24px;
  }

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

  .cashflow-chart {
    padding: 14px;
  }

  .panel-header {
    align-items: start;
    flex-direction: column;
  }
}
