:root {
  --primary: #2492da;
  --deep: #001e47;
  --neutral: #9b9b9c;
  --ink: #0d2b4e;
  --panel: #ffffff;
  --panel-soft: #f0f6fd;
  --line: rgba(36, 146, 218, 0.18);
  --danger: #e03e3e;
  --success: #1da060;
  --shadow: 0 8px 36px rgba(36, 146, 218, 0.1), 0 2px 8px rgba(0,0,0,0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: #f2f7fc;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img,
canvas {
  max-width: 100%;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
}

p {
  line-height: 1.55;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-grid::before,
.bg-grid::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.38;
}

.bg-grid::before {
  width: 680px;
  height: 680px;
  background: radial-gradient(circle, rgba(36,146,218,0.22) 0%, transparent 70%);
  top: -160px;
  left: -120px;
  animation: driftA 18s ease-in-out infinite alternate;
}

.bg-grid::after {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(0,30,71,0.10) 0%, transparent 70%);
  bottom: -100px;
  right: -80px;
  animation: driftB 22s ease-in-out infinite alternate;
}

@keyframes driftA {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(60px, 80px) scale(1.08); }
  66%  { transform: translate(-40px, 120px) scale(0.95); }
  100% { transform: translate(80px, 40px) scale(1.04); }
}

@keyframes driftB {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-70px, -60px) scale(1.1); }
  66%  { transform: translate(50px, -100px) scale(0.92); }
  100% { transform: translate(-30px, -40px) scale(1.06); }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #2492da 0%, transparent 70%);
  top: 40%;
  left: 30%;
  animation: driftA 26s ease-in-out infinite alternate-reverse;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #001e47 0%, transparent 70%);
  top: 60%;
  left: 55%;
  animation: driftB 20s ease-in-out infinite alternate;
}

.auth-layout {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 36px;
  align-items: center;
}

.hero-panel,
.auth-card,
.card,
.hero-card,
.top-nav,
.onboarding-layout {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.hero-panel,
.auth-card,
.card,
.hero-card {
  padding: 24px;
}

.logo-wrap {
  margin-bottom: 18px;
}

.logo-img {
  width: 170px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.logo-img.nav-logo {
  width: 120px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.72rem;
  color: #2492da;
}

.muted {
  color: #5a7a96;
  margin: 4px 0 0;
}

.pill-row,
.chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pill,
.chip {
  border: 1px solid rgba(36, 146, 218, 0.3);
  background: rgba(36, 146, 218, 0.08);
  color: #0d4f80;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.stack-form label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

.text-action {
  justify-self: start;
  padding: 0;
  border: none;
  background: transparent;
  color: #1970ad;
  font-weight: 700;
  cursor: pointer;
}

.text-action:hover,
.text-action:focus-visible {
  color: #0d4f80;
}

.text-action:focus-visible {
  outline: 2px solid rgba(36, 146, 218, 0.35);
  outline-offset: 4px;
}

.text-action[hidden] {
  display: none;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(36, 146, 218, 0.3);
  background: #f5f9fd;
  color: #0d2b4e;
  padding: 11px 12px;
}

input::placeholder {
  color: #9ab3c9;
}

input:focus,
select:focus {
  outline: 2px solid rgba(36, 146, 218, 0.5);
  outline-offset: 1px;
  background: #ffffff;
}

.cta-row {
  display: flex;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(120deg, #2492da, #1970ad);
  box-shadow: 0 8px 24px rgba(36, 146, 218, 0.4);
}

.btn-ghost {
  color: #2492da;
  background: rgba(36, 146, 218, 0.07);
  border: 1px solid rgba(36, 146, 218, 0.3);
}

.status-message {
  margin: 0;
  font-size: 0.9rem;
  min-height: 1.4em;
}

.status-message.error {
  color: var(--danger);
}

.status-message.success {
  color: var(--success);
}

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  color: #0d2b4e;
}

.loader-ring {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid rgba(36, 146, 218, 0.2);
  border-top-color: #2492da;
  margin: 0 auto;
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.onboarding-layout {
  max-width: 1000px;
  margin: 40px auto;
  padding: 28px;
}

.category-grid {
  margin-top: 18px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.category-card {
  background: #f5f9fd;
  border: 1px solid rgba(36, 146, 218, 0.2);
  border-radius: 14px;
  padding: 14px;
  min-height: 112px;
  cursor: pointer;
  color: #0d2b4e;
  text-align: left;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.category-card:hover {
  transform: translateY(-3px);
  border-color: #2492da;
  box-shadow: 0 8px 20px rgba(36, 146, 218, 0.15);
}

.category-card.selected {
  border-color: #2492da;
  box-shadow: 0 8px 24px rgba(36, 146, 218, 0.22);
  background: rgba(36, 146, 218, 0.1);
}

.onboarding-footer {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-nav {
  margin: 20px auto 0;
  max-width: 1240px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(36, 146, 218, 0.15);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-layout {
  max-width: 1100px;
  margin: 32px auto 72px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.about-section {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 44px;
  box-shadow: var(--shadow);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

.about-section .section-label {
  font-family: "Lora", serif;
  font-size: clamp(1.5rem, 3.6vw, 2.4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--deep);
  margin-bottom: 8px;
}

.about-section h2 {
  font-size: 1.7rem;
  color: var(--deep);
  margin-bottom: 12px;
}

.about-section p {
  max-width: 680px;
  color: #2e4f6e;
  line-height: 1.7;
}

.quote-slideshow {
  margin-top: 0;
  min-height: 92px;
  width: 100%;
  position: relative;
  display: grid;
  align-items: center;
}

.quote-slide {
  margin: 0;
  grid-area: 1 / 1;
  font-family: "Lora", serif;
  font-size: clamp(1.05rem, 1.8vw, 1.4rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.6;
  color: #173f67;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  pointer-events: none;
}

.quote-slide.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.quote-mark {
  color: #2492da;
  font-weight: 700;
  font-size: 1.2em;
}

.quote-dots {
  margin-top: 18px;
  display: flex;
  gap: 8px;
}

.quote-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(36, 146, 218, 0.45);
  background: rgba(36, 146, 218, 0.18);
  padding: 0;
  cursor: pointer;
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.quote-dot:hover {
  transform: translateY(-1px);
}

.quote-dot.is-active {
  background: #2492da;
}

.feature-section {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 40px 44px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.feature-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(36, 146, 218, 0.14);
}

.feature-badge {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2492da, #1361a0);
  color: #ffffff;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  display: grid;
  place-content: center;
}

.feature-header h2 {
  font-size: 1.45rem;
  color: var(--deep);
  margin-bottom: 4px;
}

.feature-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 36px;
  align-items: start;
  min-width: 0;
}

.feature-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.feature-main {
  flex: 1;
  min-width: 0;
}

.fields-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}


.field-label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a3a5c;
  letter-spacing: 0.01em;
}

.summary-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
  background: #f0f6fd;
  border: 1px solid rgba(36, 146, 218, 0.18);
  border-radius: 14px;
}

.summary-card.stacked {
  grid-template-columns: 1fr;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5a7a96;
  font-weight: 600;
}

.stat-value {
  font-size: 1.25rem;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: var(--deep);
}

.stat-value.accent {
  color: #2492da;
}

.stat-value.danger {
  color: var(--danger);
}

.btn-full {
  width: 100%;
}

.totals-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.total-pill {
  flex: 1;
  padding: 16px 20px;
  background: #f0f6fd;
  border: 1px solid rgba(36, 146, 218, 0.18);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.allocation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 6px;
}

.add-category-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 30, 71, 0.45);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  width: min(480px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.modal-card h3 {
  margin-bottom: 14px;
  color: var(--deep);
}

.modal-warning {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(224, 62, 62, 0.08);
  border: 1px solid rgba(224, 62, 62, 0.2);
  color: #8f2c2c;
  font-size: 0.92rem;
}

.selection-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.selection-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f5f9fd;
  border: 1px solid rgba(36, 146, 218, 0.18);
  border-radius: 12px;
  color: #0d2b4e;
  font-weight: 600;
}

.selection-option input {
  width: auto;
  margin: 0;
}

.table-wrap {
  margin-top: 14px;
  overflow: auto;
}

.clip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.clip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #f5f9fd;
  border: 1px solid rgba(36, 146, 218, 0.16);
}

.clip-item-details {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.clip-item-title {
  color: var(--deep);
}

.clip-item-description {
  margin: 0;
}

.clip-item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clip-state-pill {
  display: inline-block;
  width: fit-content;
  margin-top: 2px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7f4e00;
  background: rgba(255, 183, 77, 0.2);
  border: 1px solid rgba(255, 183, 77, 0.5);
}

.btn-danger {
  color: #b42323;
  background: rgba(224, 62, 62, 0.1);
  border: 1px solid rgba(224, 62, 62, 0.35);
}

.btn-danger:hover,
.btn-danger:focus-visible {
  background: rgba(224, 62, 62, 0.16);
}

.audio-player-shell {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  background: #f0f6fd;
  border: 1px solid rgba(36, 146, 218, 0.16);
}

.audio-player-shell audio {
  width: 100%;
}

.audio-library-section.clips-listener-mode .feature-body {
  grid-template-columns: 1fr;
}

.audio-library-section.clips-listener-mode .feature-side {
  display: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}

th {
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid rgba(36, 146, 218, 0.2);
  font-size: 0.92rem;
  color: #2492da;
  font-weight: 600;
}

td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid rgba(36, 146, 218, 0.1);
  font-size: 0.92rem;
  color: #0d2b4e;
}

.chart-shell {
  margin-top: 10px;
  background: #f5f9fd;
  border: 1px solid rgba(36, 146, 218, 0.15);
  border-radius: 14px;
  padding: 14px;
}

.hidden {
  display: none;
}

.reveal-up {
  opacity: 0;
  transform: translateY(18px);
  animation: reveal 0.7s ease forwards;
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .auth-layout {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .hero-panel,
  .auth-card,
  .card,
  .hero-card,
  .onboarding-layout {
    border-radius: 18px;
  }

  .dashboard-layout {
    margin-top: 20px;
  }

  .feature-body {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .about-section,
  .feature-section {
    padding: 28px 22px;
  }

  .dashboard-layout {
    gap: 28px;
    padding: 0 14px;
  }

  .totals-row {
    flex-direction: column;
  }

  .onboarding-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .add-category-row {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .clip-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .clip-item-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .clip-item .btn {
    width: 100%;
  }

  .feature-header {
    gap: 14px;
    padding-bottom: 22px;
  }

  .feature-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 680px) {
  .auth-layout,
  .dashboard-layout,
  .top-nav,
  .onboarding-layout {
    padding-left: 14px;
    padding-right: 14px;
  }

  .onboarding-layout {
    margin-top: 18px;
    margin-bottom: 18px;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .about-section,
  .feature-section,
  .hero-panel,
  .auth-card,
  .card,
  .hero-card {
    padding: 18px;
  }

  .feature-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .feature-header h2,
  .about-section h2 {
    font-size: 1.2rem;
  }

  .about-section .section-label {
    font-size: clamp(1.35rem, 6vw, 1.95rem);
    margin-bottom: 6px;
  }

  .quote-slideshow {
    min-height: 82px;
  }

  .quote-slide {
    font-size: 1rem;
    line-height: 1.5;
  }

  .summary-card {
    grid-template-columns: 1fr;
  }

  .cta-row {
    flex-direction: column;
  }

  .cta-row .btn {
    width: 100%;
  }

  .brand-wrap {
    width: 100%;
  }

  .top-nav #logout-btn {
    width: 100%;
  }

  .category-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .allocation-grid {
    grid-template-columns: 1fr;
    max-height: none;
    padding-right: 0;
  }

  .table-wrap {
    margin-left: -4px;
    margin-right: -4px;
    padding: 0 4px;
  }

  th,
  td {
    padding: 9px 8px;
    font-size: 0.86rem;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-card {
    padding: 16px;
  }

  #spending-form,
  #spending-form .field-label,
  #spending-form input,
  #spending-form select {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .auth-layout {
    padding: 12px;
    gap: 14px;
  }

  .hero-panel,
  .auth-card,
  .card,
  .hero-card,
  .about-section,
  .feature-section,
  .onboarding-layout {
    border-radius: 14px;
    padding: 14px;
  }

  .logo-img {
    width: 146px;
  }

  .logo-img.nav-logo {
    width: 104px;
  }

  .pill,
  .chip {
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  .stat-value {
    font-size: 1.05rem;
  }

  .feature-section {
    gap: 22px;
  }

  .top-nav {
    margin-top: 12px;
    padding: 12px;
  }

  .dashboard-layout {
    margin: 16px auto 44px;
    gap: 20px;
  }
}

@media (max-width: 320px) {
  .brand-wrap {
    width: 100%;
    min-width: 0;
    gap: 8px;
    align-items: center;
  }

  .logo-img.nav-logo {
    width: 96px;
    flex-shrink: 0;
  }

  .brand-wrap > div {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .brand-wrap h1 {
    font-family: "Lora", serif;
    font-size: 0.95rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .brand-wrap .muted {
    font-size: 0.8rem;
  }
}
