:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #66747c;
  --line: #d8e2dd;
  --panel: #ffffff;
  --soft: #f2f7f3;
  --accent: #1b5e20;
  --accent-2: #2e7d32;
  --accent-3: #66bb6a;
  --gold: #c59b45;
  --danger: #b43333;
  --shadow: 0 18px 48px rgba(23, 33, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: #edf3ef;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body {
  margin: 0;
  min-width: 320px;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 12px clamp(16px, 3vw, 40px);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.brand {
  align-items: center;
  color: inherit;
  display: inline-flex;
  gap: 12px;
  font-weight: 900;
  text-decoration: none;
}

.brand img {
  border-radius: 6px;
  height: 42px;
  object-fit: cover;
  width: 42px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button {
  align-items: center;
  border: 0;
  border-radius: 6px;
  display: inline-flex;
  font-weight: 850;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.secondary-button {
  background: #dfece2;
  color: var(--accent);
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent);
}

.full-button {
  width: 100%;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.auth-view {
  align-items: center;
  display: grid;
  gap: clamp(24px, 5vw, 70px);
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 440px);
  min-height: calc(100vh - 67px);
  padding: clamp(28px, 6vw, 80px);
}

.auth-copy h1,
.topbar h1 {
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 1.02;
  margin: 0;
  max-width: 900px;
}

.auth-copy p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
  max-width: 720px;
}

.auth-card,
.settings-panel,
.forms-panel,
.chart-panel,
.table-panel,
.summary-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.segmented,
.tabs {
  background: var(--soft);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
}

.segmented button,
.tabs button,
.period-filter button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 850;
  min-height: 38px;
}

.segmented button.is-active,
.tabs button.is-active,
.period-filter button.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(23, 33, 38, 0.08);
}

label {
  color: #2c393f;
  display: grid;
  gap: 7px;
  font-size: 0.92rem;
  font-weight: 800;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
  width: 100%;
}

.password-field {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.password-field button {
  background: #eef6ef;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  font-weight: 850;
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
}

.status,
.hint {
  color: var(--muted);
  margin: 0;
}

.dashboard-view {
  padding: clamp(16px, 3vw, 38px);
}

.topbar,
.launch-header {
  align-items: end;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 22px;
}

.launch-header {
  margin-inline: auto;
  max-width: 760px;
}

.period-filter {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.period-filter label {
  min-width: 150px;
}

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

.summary-grid article {
  box-shadow: none;
  display: grid;
  gap: 8px;
  padding: 18px;
}

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

.summary-grid strong {
  font-size: clamp(1.35rem, 2.2vw, 2.1rem);
}

.tax-card {
  background: #f2faef !important;
  border-color: #cce7c9 !important;
}

.workspace {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
  margin-bottom: 18px;
}

.settings-panel,
.forms-panel {
  box-shadow: none;
  padding: 18px;
}

.settings-panel h2,
.forms-panel h2,
.chart-panel h2,
.table-panel h2 {
  margin: 0 0 14px;
}

.settings-panel {
  align-self: start;
  display: grid;
  gap: 13px;
}

.entry-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

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

.full-field,
.check-row {
  grid-column: 1 / -1;
}

.check-row {
  align-items: center;
  display: flex;
  flex-direction: row;
}

.check-row input {
  min-height: auto;
  width: auto;
}

.calculation-line {
  align-items: center;
  background: var(--soft);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 14px;
}

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

.report-view {
  margin-inline: auto;
  max-width: 1180px;
}

.chart-panel,
.table-panel {
  box-shadow: none;
  padding: 18px;
}

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

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 86px minmax(0, 1fr) 90px;
  align-items: center;
}

.bar-track {
  background: #eef3ef;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.bar-fill {
  background: var(--accent-2);
  height: 100%;
}

.bar-fill.expense {
  background: var(--gold);
}

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

.split-item {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
}

.table-header {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.table-header input {
  max-width: 360px;
}

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

table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
}

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

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

.negative {
  color: var(--danger);
}

@media (max-width: 980px) {
  .auth-view,
  .topbar,
  .launch-header,
  .workspace,
  .report-layout,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .period-filter {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .auth-view,
  .dashboard-view {
    padding: 16px;
  }

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

  .table-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media print {
  .app-header,
  .launch-header,
  .workspace,
  .period-filter,
  #searchInput {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .dashboard-view {
    padding: 0;
  }

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

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