:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-2: #0d1830;
  --panel: rgba(15, 23, 46, 0.9);
  --panel-2: rgba(18, 28, 54, 0.96);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(16, 215, 196, 0.28);
  --text: #f3f7ff;
  --muted: #9aa8c4;
  --teal: #10d7c4;
  --teal-2: #14c3b2;
  --green: #42d392;
  --rose: #ff6b89;
  --amber: #ffcc66;
  --blue: #65a8ff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top right, rgba(16, 215, 196, 0.12), transparent 22rem),
    linear-gradient(160deg, var(--bg) 0%, #0a1430 55%, #071526 100%);
  color: var(--text);
}

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

a {
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 44px;
  font-weight: 800;
}

.primary-button {
  color: #07111f;
  background: var(--teal);
}

.primary-button:hover {
  background: var(--teal-2);
}

.primary-button.compact {
  padding: 0 18px;
}

.secondary-button,
.ghost-button {
  color: var(--text);
  background: transparent;
  border-color: var(--line);
}

.ghost-button {
  min-height: 38px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--teal), #9ffff4);
  box-shadow: 0 18px 34px rgba(16, 215, 196, 0.18);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
  fill: #061022;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.site-brand-text strong,
.site-brand-text span {
  display: block;
}

.site-brand-text strong {
  font-size: 18px;
}

.site-brand-text span,
.eyebrow,
.sidebar-footer span,
.muted {
  color: var(--muted);
}

.site-brand-text span {
  font-size: 13px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Homepage */

.marketing-shell {
  width: min(1240px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.marketing-header {
  position: sticky;
  top: 18px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 17, 31, 0.84);
  backdrop-filter: blur(18px);
}

.marketing-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.marketing-nav a {
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.marketing-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.marketing-nav .nav-cta {
  border: 1px solid var(--line-strong);
  background: rgba(16, 215, 196, 0.12);
  color: var(--text);
}

.marketing-main {
  display: grid;
  gap: 34px;
  padding-top: 28px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  gap: 22px;
}

.home-hero-copy,
.home-hero-panel,
.home-cta-band,
.landing-card,
.team-card,
.app-auth-copy,
.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at top right, rgba(16, 215, 196, 0.08), transparent 18rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)),
    var(--panel);
  box-shadow: var(--shadow);
}

.home-hero-copy {
  display: grid;
  align-content: center;
  gap: 22px;
  padding: clamp(32px, 4vw, 54px);
}

.hero-kicker {
  margin: 0;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.home-hero-copy h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(54px, 6vw, 86px);
  line-height: 0.92;
}

.hero-summary {
  max-width: 56ch;
  margin: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.75;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.home-hero-panel {
  display: grid;
  padding: 24px;
}

.hero-stat-grid {
  display: grid;
  gap: 14px;
  align-content: center;
}

.hero-stat-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.hero-stat-card strong {
  font-size: 15px;
}

.hero-stat-card span {
  color: var(--muted);
  line-height: 1.6;
}

.home-section {
  display: grid;
  gap: 20px;
}

.home-section-heading {
  display: grid;
  gap: 10px;
  max-width: 860px;
}

.home-section-heading h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.08;
}

.home-section-heading p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.home-card-grid {
  display: grid;
  gap: 18px;
}

.home-card-grid.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-card-grid.two-up,
.team-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.team-grid {
  display: grid;
  gap: 18px;
}

.landing-card {
  padding: 22px;
}

.landing-card h2,
.landing-card h3,
.team-card strong {
  margin: 0 0 12px;
}

.landing-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.stat-number {
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.feature-list {
  margin: 0;
  padding-left: 18px;
  color: #d7dcef;
  line-height: 1.75;
}

.feature-list li + li {
  margin-top: 8px;
}

.team-card {
  display: grid;
  gap: 8px;
  padding: 22px;
}

.team-card strong {
  font-size: 18px;
}

.team-card span {
  color: var(--teal);
  font-weight: 800;
}

.home-cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
}

.home-cta-band h2,
.home-cta-band p {
  margin: 0;
}

.home-cta-band p:last-child {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

/* App auth */

.app-auth-view {
  min-height: 100vh;
  display: grid;
  width: min(1080px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 34px 0;
}

.app-auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 24px;
  align-items: center;
}

.app-auth-copy {
  display: grid;
  gap: 18px;
  padding: clamp(28px, 4vw, 46px);
}

.app-auth-copy h1,
.app-auth-copy p {
  margin: 0;
}

.app-auth-copy h1 {
  max-width: 10ch;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 0.95;
}

.app-auth-copy p {
  max-width: 44ch;
  color: var(--muted);
  line-height: 1.75;
  font-size: 17px;
}

.back-link {
  display: inline-flex;
  width: fit-content;
  color: var(--teal);
  text-decoration: none;
  font-weight: 700;
}

.back-link:hover {
  color: #91fbf1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand.horizontal {
  margin-bottom: 18px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 19px;
}

.auth-card,
.modal form {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.auth-card {
  width: min(100%, 420px);
  justify-self: end;
  background: var(--panel-2);
}

.auth-card h2,
.modal h2 {
  margin: 0 0 4px;
}

.card-intro {
  margin: -4px 0 4px;
  color: var(--muted);
  line-height: 1.6;
}

label {
  display: grid;
  gap: 8px;
  color: #dce2f5;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--text);
  background: #0d1530;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(16, 215, 196, 0.14);
}

.form-error {
  min-height: 20px;
  color: var(--rose);
  font-weight: 700;
}

/* App shell */

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.auth-mode {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background: rgba(8, 13, 32, 0.86);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--teal);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.sidebar-footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-panel {
  display: grid;
  min-width: 0;
}

.workspace {
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto 28px;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(28px, 3vw, 42px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-grid,
.view-panel {
  max-width: 1480px;
  margin: 0 auto;
}

.view-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.card,
.table-card,
.chat-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 26, 53, 0.78);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

.card {
  padding: 20px;
}

.metric {
  grid-column: span 3;
  min-height: 142px;
}

.metric span {
  color: var(--muted);
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 18px;
  font-size: 32px;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.wide {
  grid-column: span 8;
}

.side {
  grid-column: span 4;
}

.full {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
  font-size: 20px;
}

.bar-list {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  color: #dce2f5;
  font-size: 14px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #0d1530;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.table-card {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.amount.expense {
  color: var(--rose);
}

.amount.income {
  color: var(--green);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.toolbar input,
.toolbar select {
  max-width: 240px;
}

.insight-list {
  display: grid;
  gap: 14px;
}

.insight {
  padding: 16px;
  border-left: 4px solid var(--blue);
}

.insight.warning {
  border-left-color: var(--amber);
}

.insight.critical {
  border-left-color: var(--rose);
}

.insight.info {
  border-left-color: var(--blue);
}

.insight h3 {
  margin: 0 0 8px;
}

.insight p {
  margin: 0;
  color: #d2d8ea;
  line-height: 1.6;
}

.chat-shell {
  display: grid;
  grid-template-rows: minmax(320px, 58vh) auto;
  overflow: hidden;
}

.messages {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  overflow: auto;
}

.bubble {
  max-width: 720px;
  padding: 13px 15px;
  border-radius: 8px;
  line-height: 1.6;
  background: rgba(24, 34, 64, 0.96);
}

.bubble.user {
  justify-self: end;
  color: #071527;
  background: var(--teal);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.empty-state {
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.modal {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.66);
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 980px) {
  .marketing-shell,
  .app-auth-view {
    width: min(100%, calc(100vw - 24px));
    padding: 12px 0 24px;
  }

  .marketing-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .marketing-nav {
    width: 100%;
    overflow: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .home-hero,
  .app-auth-shell,
  .home-card-grid.three-up,
  .home-card-grid.two-up,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .home-hero-copy,
  .home-hero-panel,
  .app-auth-copy,
  .home-cta-band {
    padding: 24px;
  }

  .home-hero-copy h1,
  .app-auth-copy h1 {
    font-size: 44px;
  }

  .home-cta-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 10;
    height: auto;
    display: block;
    padding: 8px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .sidebar .brand,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    grid-template-columns: repeat(5, 1fr);
  }

  .nav-item {
    padding: 10px 6px;
    text-align: center;
    font-size: 12px;
  }

  .nav-item.active {
    box-shadow: inset 0 3px 0 var(--teal);
  }

  .workspace {
    padding: 22px 14px 88px;
  }

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

  .view-grid {
    grid-template-columns: 1fr;
  }

  .metric,
  .wide,
  .side,
  .full {
    grid-column: auto;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  td {
    border: 0;
    padding: 6px 14px;
  }
}
