@import url("https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;700;800&display=swap");

:root {
  color-scheme: light;
  font-family: "Heebo", Arial, sans-serif;
  background: #eef3f7;
  color: #162033;
  --ink: #162033;
  --muted: #687386;
  --line: #d9e1ea;
  --surface: #ffffff;
  --nav: #172033;
  --green: #2d9c72;
  --green-soft: #e8f7ef;
  --blue: #2f6fc4;
  --blue-soft: #eaf1ff;
  --amber: #c98922;
  --amber-soft: #fff4df;
  --red: #c84d4d;
  --red-soft: #fff0ef;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(45, 156, 114, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(47, 111, 196, 0.12), transparent 42%),
    #eef3f7;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

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

.auth-screen {
  min-height: 100vh;
  width: 100vw;
  padding: 48px;
  display: grid;
  grid-template-columns: minmax(520px, 760px) minmax(360px, 430px);
  justify-content: center;
  gap: clamp(40px, 6vw, 110px);
  align-items: center;
  background:
    linear-gradient(135deg, rgba(45, 156, 114, 0.16), transparent 42%),
    linear-gradient(315deg, rgba(47, 111, 196, 0.14), transparent 44%),
    #eef3f7;
}

.auth-hero,
.auth-card {
  min-width: 0;
}

.auth-hero {
  max-width: 820px;
  justify-self: end;
}

.auth-hero .brand {
  color: var(--ink);
  margin-bottom: 34px;
}

.auth-hero .brand small {
  color: var(--muted);
}

.auth-hero h1 {
  max-width: 760px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1.04;
  margin-bottom: 18px;
}

.auth-hero p {
  max-width: 680px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.75;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.auth-points span,
.user-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 700;
  padding: 0 13px;
}

.auth-card {
  justify-self: start;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(22, 32, 51, 0.14);
  padding: 20px;
}

.loading-card {
  grid-column: 1 / -1;
  width: min(430px, 100%);
  justify-self: center;
  text-align: center;
}

.loading-card .brand-mark {
  margin: 0 auto 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: #eef3f7;
}

.auth-tabs button {
  min-height: 42px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.auth-tabs button.active {
  background: white;
  color: var(--blue);
  box-shadow: 0 8px 20px rgba(22, 32, 51, 0.08);
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-form h2 {
  margin: 0;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.auth-form input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
  background: white;
}

.form-error {
  margin: 0;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid #f0c7c7;
  color: #9e3434;
  background: var(--red-soft);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: var(--nav);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #39b884, #5d86dc);
  font-weight: 800;
  font-size: 24px;
}

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

.brand small,
.tax-note small {
  color: #b6c1d0;
}

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

.nav button {
  height: 46px;
  border-radius: var(--radius);
  color: #dbe4ef;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  text-align: right;
}

.nav button.active,
.nav button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
}

.tax-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.tax-note span,
.tax-note strong,
.tax-note small {
  display: block;
}

.tax-note strong {
  margin: 6px 0;
  font-size: 22px;
}

.main {
  padding: 28px;
  max-width: none;
  min-width: 0;
  width: 100%;
}

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

.eyebrow {
  color: var(--blue);
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 34px;
  margin-bottom: 0;
}

h2 {
  font-size: 22px;
}

.top-actions,
.button-row,
.report-actions,
.card-actions,
.dialog-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.user-pill {
  background: var(--blue-soft);
  border-color: #cddbf4;
  color: #204e91;
}

.primary,
.ghost,
.text-button,
.icon-button {
  min-height: 40px;
  border-radius: var(--radius);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary {
  background: #2367be;
  color: white;
  box-shadow: 0 10px 18px rgba(35, 103, 190, 0.18);
}

.ghost {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost.danger {
  color: var(--red);
  border-color: #f0c7c7;
}

.text-button {
  background: transparent;
  color: var(--blue);
  padding: 0;
}

.icon-button {
  width: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 18px;
}

.danger-icon {
  color: var(--red);
  border-color: #f0c7c7;
}

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

.metric,
.panel,
.client-card,
.report-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 45px rgba(22, 32, 51, 0.08);
}

.metric {
  padding: 18px;
  border-top: 4px solid var(--blue);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 29px;
  line-height: 1.2;
  margin: 8px 0 6px;
}

.metric.green {
  border-top-color: var(--green);
}

.metric.red {
  border-top-color: var(--red);
}

.metric.amber {
  border-top-color: var(--amber);
}

.metric.blue {
  border-top-color: var(--blue);
}

.status-band {
  background: #102238;
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: center;
}

.status-band .eyebrow,
.status-band p {
  color: #bcd4ec;
}

.status-band h2 {
  margin-bottom: 8px;
}

.progress-wrap {
  height: 18px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
}

.progress-wrap span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38b27b, #f0c05d);
}

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

.expenses-layout {
  grid-template-columns: minmax(360px, 0.42fr) minmax(620px, 1fr);
}

.monthly-layout {
  grid-template-columns: minmax(340px, 0.38fr) minmax(640px, 1fr);
  margin-bottom: 18px;
}

.monthly-toolbar {
  min-height: 88px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.monthly-toolbar h2 {
  margin: 0;
}

.monthly-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.month-picker {
  display: grid;
  grid-template-columns: auto minmax(160px, 190px);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.month-picker input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 11px;
  color: var(--ink);
  background: white;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-title {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
}

.panel-subtitle {
  color: var(--muted);
  margin: 7px 0 0;
}

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

.list-row {
  min-height: 62px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
}

.list-row small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.list-row span {
  font-weight: 800;
  white-space: nowrap;
}

.work-description {
  min-width: 260px;
  white-space: normal;
}

.work-description strong,
.work-description small {
  display: block;
}

.work-description small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.empty-state-action {
  min-height: 220px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}

.empty-state-action p {
  margin: 0;
}

.empty {
  color: var(--muted);
  padding: 16px 0;
}

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

.client-card {
  padding: 16px;
}

.client-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.client-head strong {
  display: block;
  font-size: 18px;
}

.client-head small {
  color: var(--muted);
}

dl {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #edf1f5;
  padding-bottom: 7px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #1f5d42;
  background: var(--green-soft);
}

.badge.lead,
.badge.open {
  color: #7b5a1a;
  background: var(--amber-soft);
}

.badge.overdue {
  color: #9e3434;
  background: var(--red-soft);
}

.badge.paid {
  color: #1f5d42;
  background: var(--green-soft);
}

.badge.cancelled {
  color: #667085;
  background: #edf1f5;
}

.cancelled-row {
  color: var(--muted);
  background: #f8fafc;
}

.cancelled-row > td:not(.row-actions) {
  opacity: 0.72;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  background: #f7f9fc;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.table-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

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

.form input,
.form select,
.form textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  color: var(--ink);
  background: white;
}

.form textarea {
  resize: vertical;
}

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

.settings-form {
  max-width: 980px;
}

.info-box {
  padding: 14px;
  background: #f7fbf9;
  border: 1px solid #d5eadf;
  border-radius: var(--radius);
}

.info-box p {
  color: var(--muted);
  margin: 6px 0 0;
}

.recurring-expenses-panel {
  margin-top: 18px;
}

.recurring-title {
  align-items: flex-start;
}

.recurring-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.recurring-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 4px 0 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.recurring-summary > div {
  min-height: 74px;
  padding: 12px 14px;
  background: #f8fafc;
}

.recurring-summary span,
.recurring-summary strong {
  display: block;
}

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

.recurring-summary strong {
  margin-top: 5px;
  font-size: 19px;
}

.recurring-list {
  display: grid;
}

.recurring-row {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(110px, 0.55fr) minmax(150px, 0.75fr) minmax(230px, auto);
  align-items: center;
  gap: 16px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}

.recurring-row:last-child {
  border-bottom: 0;
}

.recurring-row span,
.recurring-row small {
  display: block;
  color: var(--muted);
}

.recurring-row strong {
  display: block;
  margin-top: 3px;
}

.recurring-vendor > strong {
  margin-top: 0;
  font-size: 17px;
}

.recurring-complete {
  color: #1f5d42;
}

.recurring-pending {
  color: #9e3434;
}

.compact-empty {
  min-height: 110px;
}

.month-summary-panel {
  margin-bottom: 18px;
}

.billing-list {
  display: grid;
}

.billing-row {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) repeat(3, minmax(110px, 0.7fr)) minmax(170px, auto);
  align-items: center;
  gap: 16px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}

.billing-row:last-child {
  border-bottom: 0;
}

.billing-row > div span,
.billing-row > div small {
  display: block;
  color: var(--muted);
}

.billing-row > div strong {
  display: block;
  margin-top: 3px;
}

.billing-client strong {
  font-size: 17px;
}

.category-bars {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.expense-guide-panel {
  margin-top: 18px;
}

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

.expense-guide {
  min-height: 196px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.expense-guide span {
  align-self: flex-start;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  color: #1f5d42;
  background: var(--green-soft);
}

.expense-guide.partial span {
  color: #7b5a1a;
  background: var(--amber-soft);
}

.expense-guide.mixed span,
.expense-guide.depreciation span {
  color: #204e91;
  background: var(--blue-soft);
}

.expense-guide h3 {
  font-size: 17px;
  margin: 0;
}

.expense-guide strong {
  line-height: 1.45;
}

.expense-guide p {
  color: var(--muted);
  line-height: 1.55;
  margin: auto 0 0;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 110px;
  align-items: center;
  gap: 12px;
}

.bar-row div {
  height: 11px;
  background: #eef3f7;
  border-radius: 99px;
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2d9c72, #2f6fc4);
}

.bar-row strong {
  text-align: left;
}

.report-hero {
  padding: 24px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.78)),
    url("/src/assets/hero.png") center/cover;
}

.report-hero p {
  max-width: 720px;
  color: var(--muted);
}

dialog {
  width: min(760px, calc(100vw - 28px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

dialog::backdrop {
  background: rgba(14, 22, 36, 0.55);
}

.modal-form {
  padding: 22px;
}

.modal-form h2 {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.document-form .receipt-only {
  display: none;
}

.document-form.is-receipt .receipt-only {
  display: grid;
}

.line-items {
  display: grid;
  gap: 8px;
}

.line-item-head,
.line-item {
  display: grid;
  grid-template-columns: 1fr 100px 130px;
  gap: 8px;
  align-items: center;
}

.line-item-head {
  grid-template-columns: 1fr auto;
}

@media (max-width: 1050px) {
  #app {
    grid-template-columns: 1fr;
  }

  .auth-screen {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .auth-hero,
  .auth-card {
    justify-self: stretch;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .tax-note {
    display: none;
  }

  .metrics-grid,
  .client-grid,
  .expense-guide-grid,
  .split-grid,
  .expenses-layout,
  .status-band {
    grid-template-columns: 1fr 1fr;
  }

  .billing-row {
    grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(100px, 0.7fr));
  }

  .billing-row button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .recurring-row {
    grid-template-columns: minmax(180px, 1fr) 120px 160px;
  }

  .recurring-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .auth-screen {
    padding: 18px;
  }

  .auth-hero h1 {
    font-size: 34px;
  }

  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .report-hero,
  .panel-title,
  .monthly-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  .metrics-grid,
  .client-grid,
  .expense-guide-grid,
  .split-grid,
  .expenses-layout,
  .status-band,
  .form {
    grid-template-columns: 1fr;
  }

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

  .line-item {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .month-picker {
    grid-template-columns: 1fr;
  }

  .monthly-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .recurring-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .recurring-row {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .recurring-row-actions {
    grid-column: auto;
  }

  .recurring-row-actions .primary {
    flex: 1;
  }

  .billing-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .billing-client,
  .billing-row button {
    grid-column: 1 / -1;
  }

  .billing-row button {
    width: 100%;
  }
}
