:root {
  --ink: #172026;
  --muted: #61717d;
  --line: #d9e0e5;
  --paper: #ffffff;
  --soft: #f5f7f8;
  --teal: #0f8b8d;
  --gold: #f2a541;
  --red: #d64550;
  --blue: #315c9a;
  --green: #2f8f62;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef7f6 0, var(--soft) 360px),
    var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 0 32px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.98), rgba(239, 249, 247, 0.98));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(23, 32, 38, 0.06);
  backdrop-filter: blur(10px);
}

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

.brand-logo {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  max-width: 42px;
  max-height: 42px;
  object-fit: contain;
}

.brand-mark {
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  font-size: 0.78rem;
  font-weight: 850;
}

.brand strong, .brand small { display: block; }
.brand strong {
  color: var(--ink);
  font-size: 1.22rem;
  line-height: 1;
  letter-spacing: 0;
}
.brand small { color: var(--muted); margin-top: 2px; }

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

.nav a {
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 650;
}

.nav a.active, .nav a:hover {
  background: rgba(15, 139, 141, 0.1);
  color: var(--teal);
}

main { padding: 30px 32px 48px; }

.home-hero,
.feature-band,
.sample-section,
.about-intro,
.about-section,
.about-layout,
.values-grid,
.access-page {
  max-width: 1440px;
  margin: 0 auto;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 0.68fr);
  gap: 44px;
  align-items: center;
  min-height: calc(100vh - 190px);
  padding: 32px 0 46px;
}

.home-hero h1 {
  max-width: 820px;
  margin: 8px 0 16px;
  font-size: clamp(2.75rem, 5.2vw, 4.95rem);
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.access-page h1 {
  margin: 8px 0 16px;
  font-size: clamp(3rem, 7vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.visual-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.visual-card {
  min-height: 190px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 42px rgba(23, 32, 38, 0.08);
}

.visual-card.tall {
  grid-row: span 2;
  background: linear-gradient(180deg, #ffffff, #edf8f8);
  border-color: #c6dddd;
}
.visual-card.accent { background: #f9f4ea; border-color: #ead8b8; }
.visual-card:not(.tall):not(.accent) {
  background: linear-gradient(180deg, #ffffff, #f2f6fb);
  border-color: #cbd9ea;
}

.visual-card span,
.visual-card small {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.visual-card strong {
  display: block;
  margin: 12px 0;
  font-size: clamp(1.55rem, 3vw, 3.2rem);
  line-height: 1;
}

.mini-bars {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 170px;
  margin-top: 22px;
}

.mini-bars i {
  flex: 1;
  min-height: 24px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--teal), var(--blue));
}

.feature-band,
.values-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.feature-band article,
.values-grid article,
.about-main,
.about-aside,
.access-form {
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.feature-band article:nth-child(1) { border-top: 4px solid var(--teal); }
.feature-band article:nth-child(2) { border-top: 4px solid var(--gold); }
.feature-band article:nth-child(3) { border-top: 4px solid var(--blue); }

.feature-band h2,
.values-grid h2,
.about-layout h2 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.feature-band p,
.values-grid p,
.about-layout p,
.about-layout li {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.sample-section {
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: clamp(1.8rem, 3vw, 3.2rem);
}

.section-heading p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.sample-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.55fr) minmax(0, 1fr);
  gap: 16px;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 2px dashed #b9c7cf;
  border-radius: var(--radius);
  background: #f8fafb;
  text-align: center;
  cursor: pointer;
}

.drop-zone.dragging {
  border-color: var(--teal);
  background: #edf7f7;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-zone-content {
  display: grid;
  gap: 8px;
  padding: 24px;
}

.drop-zone-content strong {
  font-size: 1.45rem;
}

.drop-zone-content span,
.drop-zone-content small {
  color: var(--muted);
}

.sample-results {
  display: grid;
  gap: 16px;
}

.result-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.result-summary span { color: var(--muted); }

.model-customer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.model-pill {
  min-height: 94px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.model-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.model-pill strong {
  display: block;
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.model-pill small { color: var(--teal); font-weight: 800; }

.sample-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.form-message.error { color: var(--red); }
.form-message.success { color: var(--green); }

.about-intro {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  margin-bottom: 24px;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.founder-photo {
  min-height: 360px;
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 139, 141, 0.12), rgba(242, 165, 65, 0.14)),
    #eef4f4;
}

.headshot-placeholder {
  display: none;
  place-items: center;
  min-height: 360px;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 800;
}

.founder-photo img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
}

.founder-copy h2,
.about-section .section-heading h2 {
  margin: 4px 0 14px;
  font-size: clamp(1.9rem, 3vw, 3.4rem);
  line-height: 1;
}

.founder-copy p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.founder-copy p + p { margin-top: 14px; }

.about-section {
  margin-bottom: 24px;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.service-grid,
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.service-grid article,
.work-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafb;
}

.service-grid h3,
.work-card h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.service-grid p,
.work-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.viz-preview {
  position: relative;
  height: 180px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}

.bar-preview {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 18px;
}

.bar-preview span {
  flex: 1;
  min-height: 28px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--teal), var(--blue));
}

.map-preview {
  background:
    linear-gradient(90deg, rgba(217, 224, 229, 0.72) 1px, transparent 1px),
    linear-gradient(0deg, rgba(217, 224, 229, 0.72) 1px, transparent 1px),
    #f8fafb;
  background-size: 44px 44px;
}

.map-preview::before {
  content: "";
  position: absolute;
  inset: 22px 38px 28px 28px;
  border: 2px solid rgba(15, 139, 141, 0.35);
  border-radius: 56% 44% 62% 38%;
  transform: rotate(-9deg);
}

.pin {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 6px 16px rgba(23, 32, 38, 0.18);
}

.pin.one { left: 28%; top: 42%; }
.pin.two { left: 56%; top: 25%; background: var(--teal); }
.pin.three { left: 68%; top: 62%; background: var(--gold); }

.line-preview {
  display: grid;
  place-items: center;
  padding: 20px;
}

.line-preview svg {
  width: 100%;
  height: 100%;
}

.line-preview polyline {
  fill: none;
  stroke: var(--teal);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-preview circle {
  fill: var(--gold);
  stroke: white;
  stroke-width: 4;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  margin-bottom: 16px;
}

.about-main p + p { margin-top: 14px; }
.about-aside ul { margin: 0; padding-left: 20px; }
.about-aside li + li { margin-top: 8px; }

.access-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 32px;
  align-items: center;
  min-height: calc(100vh - 180px);
}

.access-form {
  display: grid;
  gap: 16px;
}

.access-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.page-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  max-width: 1440px;
  margin: 0 auto 24px;
}

.page-hero.compact h1 {
  margin: 4px 0 10px;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.55;
}

.updated {
  min-width: 220px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.updated strong { color: var(--ink); }

.database-alert {
  display: grid;
  gap: 6px;
  max-width: 1440px;
  margin: 0 auto 18px;
  padding: 14px 16px;
  border: 1px solid rgba(214, 69, 80, 0.35);
  border-radius: var(--radius);
  background: rgba(214, 69, 80, 0.08);
  color: var(--red);
}

.database-alert span {
  color: var(--ink);
  overflow-wrap: anywhere;
}


.analytics-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1440px;
  margin: 0 auto 18px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(23, 32, 38, 0.06);
}

.analytics-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  font-weight: 850;
}

.analytics-tabs a.active {
  background: var(--teal);
  color: white;
  box-shadow: 0 8px 18px rgba(15, 139, 141, 0.22);
}

.analytics-tabs a:hover:not(.active) {
  background: rgba(15, 139, 141, 0.1);
  color: var(--teal);
}

.budget-tabs {
  display: flex;
  gap: 8px;
  max-width: 1440px;
  margin: 0 auto 18px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.budget-tab {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.budget-tab.active {
  background: var(--teal);
  color: white;
}

.budget-view { display: none; }
.budget-view.active { display: block; }

.budget-month-selector {
  display: flex;
  justify-content: flex-end;
  max-width: 1440px;
  margin: 0 auto 14px;
}

.budget-month-selector label {
  display: grid;
  gap: 6px;
  min-width: 240px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.stat-grid, .dashboard-grid {
  max-width: 1440px;
  margin: 0 auto;
}

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

.stat {
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat span {
  display: block;
  min-height: 22px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.55rem, 2vw, 2.3rem);
}

.stat small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel.wide { grid-column: 1 / -1; }

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

.panel h2 {
  margin: 0;
  font-size: 1.2rem;
}

.panel p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.tab-controls {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7faf9;
}

.chart-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.chart-tools select {
  width: auto;
  min-width: 190px;
  height: 42px;
}

.tab-button {
  min-width: 48px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.tab-button.active {
  background: var(--teal);
  color: white;
}

.chart-box {
  position: relative;
  width: 100%;
  height: 340px;
  min-height: 340px;
  max-height: 340px;
  overflow: hidden;
}

.chart-box-large {
  height: 380px;
  min-height: 380px;
  max-height: 380px;
}

.chart-box canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.fastfunds-dashboard table {
  min-width: 860px;
}

.fastfunds-dashboard th {
  position: static;
  top: auto;
}

.budget-entry-shell {
  display: grid;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
}

.budget-form {
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.budget-form-heading {
  align-items: center;
  margin-bottom: 16px;
}

.budget-form-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px 190px 150px 160px minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
}

.budget-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.budget-comment {
  min-width: 0;
}

.budget-items-table table {
  min-width: 1240px;
  table-layout: fixed;
}

.budget-items-table th {
  position: static;
  top: auto;
  white-space: nowrap;
}

.budget-items-table th,
.budget-items-table td {
  vertical-align: middle;
}

.budget-items-table th:nth-child(1),
.budget-items-table td:nth-child(1) { width: 118px; }
.budget-items-table th:nth-child(2),
.budget-items-table td:nth-child(2) { width: 190px; }
.budget-items-table th:nth-child(3),
.budget-items-table td:nth-child(3) { width: 118px; }
.budget-items-table th:nth-child(4),
.budget-items-table td:nth-child(4) { width: 145px; }
.budget-items-table th:nth-child(5),
.budget-items-table td:nth-child(5) { width: 120px; }
.budget-items-table th:nth-child(6),
.budget-items-table td:nth-child(6) {
  width: 120px;
  text-align: right;
}
.budget-items-table th:nth-child(7),
.budget-items-table td:nth-child(7) {
  width: auto;
  overflow-wrap: anywhere;
}

.budget-items-table th:nth-child(8),
.budget-items-table td:nth-child(8) {
  width: 100px;
  text-align: right;
}

.budget-items-table form {
  margin: 0;
}

.budget-type {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: capitalize;
}

.budget-type.income {
  background: rgba(47, 143, 98, 0.12);
  color: var(--green);
}

.budget-type.expense {
  background: rgba(214, 69, 80, 0.12);
  color: var(--red);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.button.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.button.danger {
  border-color: rgba(214, 69, 80, 0.42);
  background: rgba(214, 69, 80, 0.08);
  color: var(--red);
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.filters, .table-shell {
  max-width: 1440px;
  margin: 0 auto;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input, select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  font: inherit;
}

.table-shell {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.table-heading strong { color: var(--ink); }

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

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 72px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.score {
  color: var(--teal);
  font-weight: 850;
}

.map-page {
  height: calc(100vh - 132px);
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.map-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.map-toolbar h1 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
}

.map-toolbar span {
  color: var(--muted);
}

.map-frame {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

@media (max-width: 980px) {
  .app-header, .page-hero, .panel-heading, .map-toolbar, .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  main { padding: 22px 16px 36px; }
  .app-header { padding: 14px 16px; }
  .nav { width: 100%; flex-wrap: wrap; }
  .nav a { flex: 1 1 120px; text-align: center; }
  .stat-grid, .dashboard-grid, .filters, .home-hero, .feature-band, .sample-grid, .sample-charts, .about-intro, .service-grid, .work-grid, .about-layout, .values-grid, .access-page, .budget-form-grid { grid-template-columns: 1fr; }
  .panel.wide { grid-column: auto; }
  .updated { min-width: 0; }
  th { top: 120px; }
  .home-hero, .access-page { min-height: auto; }
  .visual-board, .model-customer { grid-template-columns: 1fr; }
}
