:root {
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --surface-2: #ebe4d6;
  --ink: #151718;
  --muted: #68706f;
  --line: #ded7ca;
  --green: #16785d;
  --blue: #266b9a;
  --gold: #b77a1a;
  --danger: #b54b3d;
  --shadow: 0 22px 60px rgba(35, 31, 23, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.auth-mode {
  grid-template-columns: 1fr;
}

.auth-mode .sidebar,
.auth-mode .app-shell {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 460px);
  gap: 32px;
  align-items: center;
  padding: clamp(24px, 5vw, 72px);
  background:
    linear-gradient(135deg, rgba(24, 32, 29, 0.92), rgba(22, 120, 93, 0.82)),
    url("https://images.unsplash.com/photo-1495474472287-4d71bcdd2085?auto=format&fit=crop&w=1600&q=80");
  background-position: center;
  background-size: cover;
  color: #fffdf8;
}

.auth-brand {
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand .brand-mark {
  width: 58px;
  height: 58px;
  font-size: 24px;
}

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

.auth-brand strong {
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.92;
}

.auth-brand span {
  margin-top: 8px;
  color: rgba(255, 253, 248, 0.72);
  font-size: 16px;
}

.auth-panel {
  display: grid;
  gap: 13px;
  padding: 28px;
  border: 1px solid rgba(255, 253, 248, 0.22);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.auth-panel h1 {
  font-size: 32px;
  line-height: 1.05;
}

.auth-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.auth-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-panel input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f0;
  color: var(--ink);
}

.auth-panel .primary-button {
  width: 100%;
  margin-top: 4px;
}

.auth-error {
  padding: 11px 12px;
  border: 1px solid rgba(181, 75, 61, 0.26);
  border-radius: 8px;
  background: #f8e7e2;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.auth-helper {
  padding: 10px 12px;
  border-radius: 8px;
  background: #e8f1eb;
  color: var(--green) !important;
  font-size: 12px;
  font-weight: 800;
}

.auth-switch {
  display: flex;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.auth-switch button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.sidebar {
  min-height: 100vh;
  padding: 24px;
  background: #18201d;
  color: #fffdf8;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffd37a;
  color: #18201d;
  font-weight: 800;
}

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

.brand span,
.business-card p {
  color: rgba(255, 253, 248, 0.66);
  font-size: 13px;
}

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

.nav-item {
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 253, 248, 0.72);
  text-align: left;
  cursor: pointer;
}

.nav-item span,
.nav-item small {
  display: block;
}

.nav-item span {
  font-weight: 700;
}

.nav-item small {
  margin-top: 4px;
  color: rgba(255, 253, 248, 0.48);
  font-size: 11px;
  line-height: 1.25;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 253, 248, 0.1);
  color: #fffdf8;
}

.nav-item.active small,
.nav-item:hover small {
  color: rgba(255, 253, 248, 0.68);
}

.business-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 253, 248, 0.14);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.08);
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-shell {
  min-width: 0;
  padding: 28px;
}

.topbar,
.panel-heading,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 5px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-top: 4px;
  font-size: 18px;
}

.topbar-actions {
  gap: 10px;
}

.account-menu {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.account-menu span {
  max-width: 160px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu .ghost-button {
  min-height: 34px;
  margin-right: 3px;
  padding: 0 10px;
}

.api-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.api-status.online {
  border-color: rgba(22, 120, 93, 0.28);
  background: #e8f1eb;
  color: var(--green);
}

.api-status.offline {
  border-color: rgba(181, 75, 61, 0.26);
  background: #f8e7e2;
  color: var(--danger);
}

.icon-button,
.primary-button,
.ghost-button,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  font-size: 22px;
}

.primary-button {
  padding: 0 16px;
  border-color: #18201d;
  background: #18201d;
  color: #fffdf8;
  font-weight: 700;
}

.ghost-button,
select {
  padding: 0 12px;
}

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

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.metric-card strong {
  font-size: 26px;
}

.metric-card em {
  color: var(--green);
  font-size: 13px;
  font-style: normal;
}

.metric-card.warning em {
  color: var(--danger);
}

.workspace {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.panel {
  padding: 20px;
}

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

.cash-panel,
.transaction-panel {
  grid-column: span 1;
}

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

.wide-panel,
.report-panel,
.insight-hero {
  grid-column: span 1;
}

.panel-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.setup-progress {
  min-width: 92px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #e8f1eb;
  color: var(--green);
  font-size: 13px;
  text-align: center;
}

.setup-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.setup-step {
  min-height: 146px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f0;
  cursor: default;
}

.setup-step input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.step-number {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.setup-step strong,
.setup-step small {
  display: block;
}

.setup-step small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.setup-step .setup-status {
  color: var(--ink);
  font-weight: 700;
}

.setup-step:has(input:checked) {
  border-color: rgba(22, 120, 93, 0.36);
  background: #edf7f0;
}

.setup-step:has(input:checked) .step-number {
  background: var(--green);
  color: #fffdf8;
}

.chart {
  height: 260px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f7f1e5, #ebe4d6);
}

.chart span {
  min-height: 34px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--green), var(--blue));
}

.chart-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-list label {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f0;
}

.task-list input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.transaction-list {
  display: grid;
  gap: 10px;
}

.transaction {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.transaction:last-child {
  border-bottom: 0;
}

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

.transaction span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.amount {
  font-weight: 800;
}

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

.amount.out {
  color: var(--danger);
}

.form-panel {
  align-self: start;
}

.quick-form {
  display: grid;
  gap: 12px;
}

.quick-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quick-form input,
.quick-form select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f0;
  color: var(--ink);
}

.quick-form .primary-button {
  margin-top: 4px;
}

.choice-grid,
.behavior-list,
.chip-list {
  display: grid;
  gap: 10px;
}

.choice-card {
  width: 100%;
  min-height: 82px;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f0;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.choice-card:hover {
  border-color: rgba(22, 120, 93, 0.36);
  background: #edf7f0;
}

.choice-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.behavior-list > div {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.behavior-list > div:first-child {
  padding-top: 0;
}

.behavior-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.chip-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chip-list span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #e8f1eb;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.data-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: repeat(var(--columns, 5), minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.table-row:first-child {
  border-top: 0;
}

.table-row span {
  min-width: 0;
  padding: 13px 14px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

.table-row span:first-child,
.table-row b {
  color: var(--ink);
}

.table-head {
  background: #ebe4d6;
  font-weight: 800;
}

.table-head span {
  color: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.status.paid {
  background: #e8f1eb;
  color: var(--green);
}

.status.due {
  background: #f8e7e2;
  color: var(--danger);
}

.status.draft {
  background: #f4ecd7;
  color: var(--gold);
}

.detail-list,
.stack-list,
.statement-list,
.timeline,
.recommendation-list {
  display: grid;
  gap: 12px;
}

.account-panel {
  align-self: start;
}

.detail-list span {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.detail-list span:last-child {
  border-bottom: 0;
}

.detail-list b {
  color: var(--muted);
  font-size: 13px;
}

.detail-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.stack-list span {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.stack-list b {
  color: var(--ink);
}

.stack-list i {
  height: 10px;
  max-width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.statement-list span,
.timeline span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.statement-list span:last-child,
.timeline span:last-child {
  border-bottom: 0;
}

.statement-list b,
.timeline b {
  color: var(--ink);
}

.insight-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #eef4ed;
}

.insight-hero h2 {
  margin: 4px 0;
  font-size: 64px;
  line-height: 1;
}

.insight-hero p {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.55;
}

.score-ring {
  width: 148px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 54%, transparent 55%),
    conic-gradient(var(--green) 0 82%, #d8d1c5 82% 100%);
  color: var(--green);
  font-size: 26px;
  font-weight: 800;
}

.recommendation-list button {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f0;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.recommendation-list span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .auth-screen {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    align-self: end;
  }

  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .summary-grid,
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .setup-list {
    grid-template-columns: 1fr 1fr;
  }

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

  .table-row {
    min-width: 680px;
  }

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

@media (max-width: 680px) {
  .app-shell,
  .sidebar {
    padding: 18px;
  }

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

  .summary-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .setup-list {
    grid-template-columns: 1fr;
  }

  .setup-step {
    min-height: 0;
  }

  .topbar-actions,
  .primary-button {
    width: 100%;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .account-menu {
    width: 100%;
    justify-content: space-between;
  }

  .api-status {
    justify-content: center;
  }

  .icon-button {
    flex: 0 0 42px;
  }

  .table-row {
    min-width: 620px;
  }

  .stack-list span {
    grid-template-columns: 78px 1fr auto;
  }

  .statement-list span,
  .detail-list span,
  .timeline span {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .insight-hero h2 {
    font-size: 52px;
  }
}
