:root {
  --bg: #f3faf6;
  --card: #ffffff;
  --text: #0f211d;
  --muted: #687c76;
  --line: #d9e8e2;
  --green: #12b981;
  --green-dark: #046f55;
  --green-deep: #023d34;
  --green-soft: #dff8ec;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --gold: #c9a34f;
  --shadow: 0 16px 42px rgb(15 32 29 / 8%);
  --shadow-hover: 0 22px 58px rgb(15 32 29 / 12%);
  --font-base: "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
  --font-display: "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
  font-family: var(--font-base);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(120deg, rgb(18 185 129 / 13%), transparent 34%),
    linear-gradient(180deg, #edf9f2 0%, #f8fbfa 44%, #eff7f3 100%);
  color: var(--text);
  font-family: var(--font-base);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgb(18 185 129 / 28%);
  outline-offset: 2px;
}

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

.login-screen {
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-screen.active {
  display: grid;
}

.login-panel {
  width: min(100%, 430px);
  padding: 32px;
  border: 1px solid rgb(255 255 255 / 82%);
  border-radius: 24px;
  background: rgb(255 255 255 / 92%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand-badge {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  font-weight: 700;
  box-shadow: 0 16px 30px rgb(18 185 129 / 24%);
}

.login-panel .brand-badge {
  margin-right: auto;
  margin-left: auto;
}

.brand-badge.small {
  width: 44px;
  height: 44px;
  margin: 0;
  border-radius: 14px;
}

.finance-logo svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.finance-logo.small svg {
  width: 24px;
  height: 24px;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-panel h1 {
  margin: 8px 0 8px;
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.1;
}

.login-panel p {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.auth-form[hidden] {
  display: none;
}

.auth-form {
  margin-top: 22px;
}

.auth-switch {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 600;
  text-align: center;
}

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

.auth-switch button:hover {
  color: var(--green);
}

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

.form label {
  display: grid;
  gap: 8px;
  color: #28433d;
  font-weight: 650;
}

.form input,
.form select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  outline: none;
  background: white;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.form input:focus,
.form select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgb(16 185 129 / 14%);
}

.primary-button,
.secondary-button,
.ghost-button,
.link-button,
.chip {
  border: 0;
  border-radius: 12px;
  font-weight: 700;
}

.primary-button {
  height: 50px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  letter-spacing: 0;
  box-shadow: 0 14px 26px rgb(16 185 129 / 26%);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgb(16 185 129 / 30%);
}

.secondary-button {
  height: 50px;
  padding: 0 18px;
  border: 1px solid #cfe5dd;
  background: #f4fbf8;
  color: var(--green-dark);
  letter-spacing: 0;
}

.secondary-button:hover {
  border-color: #afd5c8;
  background: #e8f7f1;
  transform: translateY(-1px);
}

.ghost-button:hover,
.nav-link:hover {
  transform: translateY(-1px);
}

.primary-button.compact,
.secondary-button.compact {
  height: 46px;
  white-space: nowrap;
}

.ghost-button {
  height: 44px;
  background: #123d35;
  color: #e8fff6;
}

.link-button {
  padding: 0;
  background: transparent;
  color: var(--green-dark);
}

.link-button:hover {
  color: #024035;
}

.app-shell {
  display: none;
  min-height: 100vh;
}

.app-shell.active {
  display: block;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 26px;
  width: 236px;
  height: 100vh;
  padding: 28px 18px;
  background:
    linear-gradient(180deg, #06251f 0%, #041a16 100%);
  color: white;
  overflow: hidden;
}

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

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

.brand strong {
  font-weight: 720;
  letter-spacing: 0;
}

.brand span {
  margin-top: 2px;
  color: #b8cbc5;
  font-size: 0.86rem;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
  background: transparent;
  color: #cfe3dd;
  font-weight: 650;
  text-align: left;
}

.nav-link span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 720;
}

.nav-link.active,
.nav-link:hover {
  background: rgb(255 255 255 / 9%);
  color: white;
}

.sidebar .ghost-button {
  margin-top: auto;
}

.workspace {
  min-height: 100vh;
  margin-left: 236px;
  padding: 30px;
}

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

.topbar h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.05;
}

.topbar-actions {
  display: none;
  align-items: end;
  gap: 12px;
}

.app-shell[data-current-view="transactions"] .topbar-actions {
  display: flex;
}

.app-shell[data-current-view="goals"] .topbar-actions {
  display: flex;
  align-self: flex-end;
  padding-bottom: 6px;
}

.new-goal-control {
  display: none;
}

.new-user-control {
  display: none;
}

.import-transaction-control {
  display: none;
}

.app-shell[data-current-view="transactions"] .import-transaction-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-shell[data-current-view="goals"] .new-transaction-control {
  display: none;
}

.app-shell[data-current-view="goals"] .new-goal-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 122px;
  height: 42px;
  border-radius: 10px;
  padding: 0 16px;
  box-shadow: 0 10px 22px rgb(16 185 129 / 18%);
}

.app-shell[data-current-view="users"] .topbar-actions {
  display: flex;
  align-self: flex-end;
  padding-bottom: 6px;
}

.app-shell[data-current-view="users"] .new-user-control {
  display: inline-flex;
}

.app-shell[data-current-view="users"] .new-transaction-control {
  display: none;
}

.app-shell[data-current-view="goals"] .new-goal-control:hover {
  box-shadow: 0 14px 28px rgb(16 185 129 / 22%);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.metric-card:hover,
.panel:hover {
  border-color: #cbe0d8;
  box-shadow: var(--shadow-hover);
}

.metric-card {
  min-height: 144px;
  padding: 20px;
}

.metric-card.featured {
  background:
    linear-gradient(135deg, #024035 0%, #02614e 100%);
  color: white;
}

.metric-card.featured span,
.metric-card.featured small {
  color: #bddbd1;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-weight: 600;
}

.metric-card span {
  font-size: 0.92rem;
}

.metric-card small {
  font-size: 0.9rem;
  line-height: 1.45;
}

.metric-card strong {
  display: block;
  margin: 12px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.42rem, 2.5vw, 2.05rem);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.1;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title.wrap {
  align-items: flex-start;
  flex-wrap: wrap;
}

.section-title h3 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 720;
  letter-spacing: 0;
}

.chart-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-header-actions > strong {
  min-width: 104px;
  text-align: right;
}

.period-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.period-toggle .chip {
  height: 34px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.balance-evolution {
  display: grid;
  gap: 16px;
}

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

.chart-kpi {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e4f1eb;
  border-radius: 12px;
  background: #fbfefc;
}

.chart-kpi span,
.chart-kpi small {
  display: block;
}

.chart-kpi span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart-kpi strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.2;
}

.chart-kpi small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.chart-canvas {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid #e4f1eb;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgb(236 253 245 / 78%), #ffffff 76%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 45px,
      rgb(2 64 53 / 7%) 46px
    );
}

.chart-canvas svg {
  display: block;
  width: 100%;
  height: 260px;
}

.chart-grid-line {
  stroke: rgb(2 64 53 / 10%);
  stroke-width: 1;
}

.chart-axis-label {
  fill: #6b7f79;
  font-size: 11px;
  font-weight: 650;
}

.chart-area {
  fill: url("#balanceArea");
}

.chart-line {
  fill: none;
  stroke: var(--green-dark);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.chart-point {
  fill: #ffffff;
  stroke: var(--green-dark);
  stroke-width: 3;
}

.chart-point.latest {
  fill: var(--green);
  stroke: #ffffff;
  stroke-width: 4;
}

.chart-zero-line {
  stroke: rgb(2 64 53 / 22%);
  stroke-dasharray: 5 6;
  stroke-width: 1.5;
}

.chart-empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5efea;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.budget-panel p,
.goal-hero p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.budget-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.budget-panel .section-title,
.budget-panel p {
  margin-bottom: 0;
}

.budget-title-actions {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.budget-title-actions .link-button {
  font-size: 0.82rem;
}

.budget-summary {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid #e4f1eb;
  border-radius: 12px;
  background: #fbfefc;
}

.budget-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.budget-summary strong {
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.2;
}

.budget-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 2px;
  padding: 14px;
  border: 1px solid #e4f1eb;
  border-radius: 12px;
  background: #fbfefc;
}

.budget-form[hidden] {
  display: none;
}

.budget-form label {
  display: grid;
  gap: 7px;
  color: #385650;
  font-size: 0.84rem;
  font-weight: 700;
}

.budget-form input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: white;
}

.budget-form .primary-button.compact {
  height: 42px;
  box-shadow: 0 10px 22px rgb(16 185 129 / 18%);
}

.budget-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.budget-form-actions .link-button {
  height: 42px;
  padding: 0 6px;
}

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

.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.category-row strong,
.category-row small {
  display: block;
}

.category-row small {
  color: var(--muted);
}

.category-bar {
  grid-column: 1 / -1;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf5f1;
}

.category-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green-dark);
}

.transaction-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  border: 1px solid #e7f0ec;
  border-radius: 12px;
  background: #fbfefc;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.transaction-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.transaction-item:hover {
  border-color: #d4e6de;
  background: #ffffff;
  transform: translateY(-1px);
}

.transaction-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 750;
}

.transaction-icon.expense {
  background: var(--red-soft);
  color: var(--red);
}

.transaction-item strong,
.transaction-item small {
  display: block;
}

.transaction-item strong {
  font-weight: 700;
}

.transaction-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.transaction-value {
  color: var(--green-dark);
  font-weight: 720;
  white-space: nowrap;
}

.transaction-value.expense {
  color: var(--red);
}

.delete-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #52635f;
  font-size: 0.86rem;
}

.delete-button:hover {
  background: #fee2e2;
  color: var(--red);
}

.compact-list .transaction-item {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.compact-list .delete-button {
  display: none;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  height: 36px;
  padding: 0 14px;
  background: #edf5f1;
  color: #385650;
  font-size: 0.92rem;
}

.chip:hover {
  background: #dcebe5;
}

.chip.active {
  background: #024035;
  color: white;
}

.goals-grid {
  display: grid;
  grid-template-columns: minmax(330px, 1.08fr) repeat(2, minmax(240px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.goal-hero {
  display: grid;
  gap: 18px;
  min-height: 272px;
  border: 0;
  background:
    radial-gradient(circle at 90% 0%, rgb(18 185 129 / 26%), transparent 30%),
    linear-gradient(135deg, #024035, #02614e);
  color: white;
}

.goal-hero .eyebrow {
  color: #bfe7dc;
}

.goal-hero p {
  margin: 0;
  color: #d9f3eb;
  font-size: 0.96rem;
  line-height: 1.5;
}

.goal-card {
  display: grid;
  gap: 16px;
  min-height: 240px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfefc 100%);
}

.goal-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.goal-card-top h3 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 760;
  line-height: 1.2;
}

.goal-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.goal-percent {
  display: grid;
  flex: 0 0 auto;
  min-width: 76px;
  height: 56px;
  place-items: center;
  border-radius: 16px;
  background: rgb(255 255 255 / 14%);
  color: white;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 780;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 16%);
}

.goal-percent.compact {
  min-width: 58px;
  height: 40px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.95rem;
  box-shadow: none;
}

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

.goal-money-row > span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 12px;
  background: rgb(255 255 255 / 9%);
}

.goal-money-row.compact > span {
  border-color: #e5f0eb;
  background: #f8fcfa;
}

.goal-money-row small {
  color: inherit;
  opacity: 0.72;
  font-size: 0.75rem;
  font-weight: 700;
}

.goal-money-row strong {
  overflow-wrap: anywhere;
  font-size: 0.96rem;
  line-height: 1.25;
}

.goal-card > small,
.goal-note {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.goal-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.goal-action-button {
  min-width: 84px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  background: #edf5f1;
  color: #31534c;
  font-weight: 700;
}

.goal-action-button:hover {
  background: var(--green-soft);
  color: var(--green-dark);
}

.goal-action-button.danger-action {
  background: #fff1f1;
  color: #a93636;
}

.goal-action-button.danger-action:hover {
  background: var(--red-soft);
  color: var(--red);
}

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

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid #e7f0ec;
  border-radius: 12px;
  background: #fbfefc;
}

.user-row strong,
.user-row small {
  display: block;
}

.user-row small {
  margin-top: 3px;
  color: var(--muted);
}

.role-badge {
  min-width: 76px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 750;
  text-align: center;
  text-transform: capitalize;
}

.role-badge.admin {
  background: #fff5d6;
  color: #8a640c;
}

.small-progress {
  height: 9px;
}

.mobile-nav {
  display: none;
}

.mobile-header {
  display: none;
}

.modal {
  width: min(100% - 32px, 520px);
  border: 0;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 28px 90px rgb(15 32 29 / 30%);
}

.modal::backdrop {
  background: rgb(15 32 29 / 52%);
}

.import-modal {
  width: min(100% - 32px, 720px);
}

.onboarding-modal {
  width: min(100% - 32px, 620px);
  padding: 0;
  overflow: hidden;
}

.onboarding-modal .form {
  gap: 0;
}

.onboarding-hero {
  padding: 28px 28px 22px;
  background:
    radial-gradient(circle at 90% 12%, rgb(18 185 129 / 24%), transparent 28%),
    linear-gradient(135deg, #06251f, #02614e);
  color: white;
}

.onboarding-hero .brand-badge {
  margin-bottom: 16px;
  box-shadow: 0 14px 26px rgb(0 0 0 / 18%);
}

.onboarding-hero .eyebrow,
.onboarding-hero p {
  color: #c7efe4;
}

.onboarding-hero h3 {
  margin: 8px 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.25rem);
  line-height: 1.05;
}

.onboarding-hero p {
  margin: 0;
  max-width: 420px;
}

.onboarding-steps {
  display: grid;
  gap: 14px;
  padding: 24px 28px 10px;
}

.onboarding-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 28px 28px;
}

.onboarding-actions .link-button {
  height: 44px;
  padding: 0 8px;
}

.file-drop {
  padding: 16px;
  border: 1px dashed #b9d8ce;
  border-radius: 14px;
  background: #f7fcfa;
}

.file-drop input {
  height: auto;
  padding: 12px;
  border-style: dashed;
  background: white;
}

.file-drop span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.import-summary {
  padding: 12px 14px;
  border-radius: 12px;
  background: #edf5f1;
  color: #385650;
  font-weight: 700;
}

.import-preview {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.import-preview-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e7f0ec;
  border-radius: 12px;
  background: white;
}

.import-preview-item strong,
.import-preview-item small {
  display: block;
}

.import-preview-item small {
  color: var(--muted);
  font-size: 0.84rem;
}

.import-preview-value {
  color: var(--green-dark);
  font-weight: 760;
  white-space: nowrap;
}

.import-preview-value.expense {
  color: var(--red);
}

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

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border-radius: 14px;
  background: #edf5f1;
}

.type-toggle label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-radius: 10px;
  color: #385650;
  font-weight: 700;
}

.type-toggle input {
  width: auto;
  height: auto;
  margin-right: 8px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #06251f;
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .summary-grid,
  .dashboard-grid,
  .goals-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell.active {
    display: block;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    min-height: auto;
    display: none;
  }

  .workspace {
    margin-left: 0;
    padding: 22px 16px 100px;
  }

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

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

  .mobile-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: min(100%, 520px);
    height: 76px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: white;
    box-shadow: 0 -16px 32px rgb(15 32 29 / 10%);
  }

  .mobile-link,
  .mobile-add {
    border: 0;
    font-weight: 700;
  }

  .mobile-link {
    background: transparent;
    color: var(--muted);
  }

  .mobile-link.active {
    color: var(--green-dark);
  }

  .mobile-add {
    width: 56px;
    height: 56px;
    margin-top: -32px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 14px 24px rgb(16 185 129 / 30%);
  }

  body[data-view="dashboard"] .mobile-add {
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .login-panel {
    padding: 26px 20px;
  }

  .topbar h2 {
    font-size: 2.15rem;
  }

  .chart-header-actions,
  .period-toggle,
  .budget-form,
  .budget-form-actions {
    width: 100%;
  }

  .chart-header-actions {
    align-items: stretch;
    justify-content: flex-start;
  }

  .chart-header-actions > strong {
    text-align: left;
  }

  .period-toggle .chip {
    flex: 1;
  }

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

  .budget-title-actions {
    justify-items: start;
  }

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

  .primary-button.compact,
  .secondary-button.compact {
    width: 100%;
  }

  .metric-card {
    min-height: 126px;
  }

  .chart-kpis {
    grid-template-columns: 1fr;
  }

  .chart-canvas {
    min-height: 220px;
  }

  .chart-canvas svg {
    height: 220px;
  }

  .transaction-item {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .delete-button,
  .transaction-actions {
    grid-column: 2 / 4;
    width: 100%;
  }

  .transaction-actions .goal-action-button {
    flex: 1;
  }

  .user-row {
    grid-template-columns: 1fr;
  }

  .compact-list .transaction-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .compact-list .transaction-value {
    grid-column: 2;
  }

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

  .onboarding-actions {
    grid-template-columns: 1fr;
  }

  .import-preview-item {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .import-preview-value {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    background:
      linear-gradient(180deg, #e8f8f1 0%, #f7fbf9 42%, #eef7f3 100%);
  }

  .login-screen {
    align-items: start;
    min-height: 100dvh;
    padding: 18px;
  }

  .login-panel {
    width: 100%;
    margin-top: max(10px, env(safe-area-inset-top));
    padding: 26px 22px;
    border-radius: 22px;
  }

  .login-panel h1 {
    font-size: 2rem;
  }

  .app-shell.active {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 72px;
    padding: max(12px, env(safe-area-inset-top)) 16px 12px;
    border-bottom: 1px solid rgb(217 232 226 / 78%);
    background: rgb(248 252 250 / 90%);
    backdrop-filter: blur(18px);
  }

  .mobile-header .brand {
    min-width: 0;
  }

  .mobile-header .brand strong {
    color: var(--text);
    font-size: 0.98rem;
  }

  .mobile-header .brand span {
    color: var(--muted);
    font-size: 0.78rem;
  }

  .mobile-header .brand-badge.small {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .mobile-header .ghost-button {
    width: auto;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: #e8f4ef;
    color: var(--green-dark);
    box-shadow: none;
  }

  .workspace {
    width: 100%;
    min-height: auto;
    margin-left: 0;
    padding: 20px 16px calc(100px + env(safe-area-inset-bottom));
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
  }

  .topbar h2 {
    max-width: 100%;
    font-size: clamp(2rem, 10vw, 2.75rem);
    line-height: 1;
    overflow-wrap: anywhere;
  }

  .topbar-actions {
    width: 100%;
    gap: 10px;
  }

  .app-shell[data-current-view="transactions"] .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .app-shell[data-current-view="goals"] .topbar-actions,
  .app-shell[data-current-view="users"] .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-self: stretch;
    padding-bottom: 0;
  }

  .app-shell[data-current-view="transactions"] .import-transaction-control,
  .app-shell[data-current-view="transactions"] .new-transaction-control,
  .app-shell[data-current-view="goals"] .new-goal-control,
  .app-shell[data-current-view="users"] .new-user-control {
    width: 100%;
    min-width: 0;
    height: 44px;
  }

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

  .metric-card.featured {
    grid-column: 1 / -1;
  }

  .metric-card,
  .panel {
    border-radius: 16px;
    box-shadow: 0 10px 28px rgb(15 32 29 / 7%);
  }

  .metric-card {
    min-height: 118px;
    padding: 16px;
  }

  .metric-card strong {
    margin: 10px 0 6px;
    font-size: clamp(1.32rem, 7vw, 1.78rem);
  }

  .metric-card small {
    font-size: 0.83rem;
  }

  .dashboard-grid,
  .goals-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  .panel {
    padding: 16px;
  }

  .section-title {
    gap: 12px;
    margin-bottom: 14px;
  }

  .section-title.wrap {
    flex-direction: column;
  }

  .section-title h3 {
    font-size: 1.08rem;
  }

  .chart-header-actions {
    width: 100%;
    align-items: stretch;
    justify-content: flex-start;
  }

  .chart-header-actions > strong {
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .period-toggle {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .period-toggle .chip {
    width: 100%;
    padding: 0 8px;
  }

  .chart-kpis {
    grid-template-columns: repeat(3, minmax(104px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .chart-kpi {
    padding: 10px;
  }

  .chart-kpi span,
  .chart-kpi small {
    font-size: 0.7rem;
  }

  .chart-kpi strong {
    font-size: 0.9rem;
  }

  .chart-canvas {
    min-height: 210px;
    border-radius: 16px;
  }

  .chart-canvas svg {
    height: 210px;
  }

  .transaction-list,
  .category-list,
  .users-list {
    gap: 9px;
  }

  .transaction-item {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    min-height: 0;
    padding: 12px;
  }

  .transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .transaction-value {
    grid-column: 2;
    justify-self: start;
    white-space: normal;
  }

  .transaction-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .transaction-actions .goal-action-button {
    flex: 1;
    min-width: 0;
  }

  .compact-list .transaction-item {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .compact-list .transaction-value {
    grid-column: 2;
  }

  .category-row {
    gap: 8px;
  }

  .budget-form,
  .budget-form-actions,
  .form-grid,
  .onboarding-actions {
    grid-template-columns: 1fr;
  }

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

  .budget-title-actions {
    justify-items: start;
  }

  .goal-card,
  .goal-hero {
    min-height: 0;
    gap: 14px;
  }

  .goal-card-top {
    gap: 12px;
  }

  .goal-percent {
    min-width: 62px;
    height: 46px;
    border-radius: 14px;
    font-size: 1.16rem;
  }

  .goal-money-row {
    gap: 8px;
  }

  .goal-money-row > span {
    padding: 10px;
  }

  .goal-card-actions {
    justify-content: stretch;
  }

  .goal-action-button {
    flex: 1;
    min-width: 0;
  }

  .user-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .role-badge {
    justify-self: start;
  }

  .mobile-nav {
    position: fixed;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: auto;
    height: 70px;
    transform: none;
    border: 1px solid rgb(217 232 226 / 86%);
    border-radius: 22px;
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 -10px 34px rgb(15 32 29 / 14%);
    backdrop-filter: blur(18px);
  }

  .mobile-link,
  .mobile-add {
    border: 0;
    font-weight: 800;
  }

  .mobile-link {
    min-width: 72px;
    height: 44px;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
  }

  .mobile-link.active {
    background: #edf8f3;
    color: var(--green-dark);
  }

  .mobile-add {
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    margin-top: -28px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: white;
    font-size: 1.8rem;
    line-height: 1;
    box-shadow: 0 14px 24px rgb(16 185 129 / 30%);
  }

  body[data-view="dashboard"] .mobile-add {
    display: none;
  }

  .modal {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 18px);
    margin: 0;
    overflow: auto;
    border-radius: 24px 24px 0 0;
    padding: 20px 18px max(20px, env(safe-area-inset-bottom));
  }

  .modal .section-title {
    align-items: flex-start;
  }

  .modal::backdrop {
    background: rgb(15 32 29 / 58%);
  }

  .import-preview {
    max-height: 240px;
  }

  .import-preview-item {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .import-preview-value {
    grid-column: 2;
    white-space: normal;
  }

  .onboarding-modal {
    padding: 0;
  }

  .onboarding-hero,
  .onboarding-steps,
  .onboarding-actions {
    padding-right: 20px;
    padding-left: 20px;
  }

  .toast {
    right: 12px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 380px) {
  .workspace {
    padding-right: 12px;
    padding-left: 12px;
  }

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

  .mobile-link {
    min-width: 64px;
    padding: 0 6px;
    font-size: 0.78rem;
  }

  .mobile-add {
    width: 52px;
    height: 52px;
  }
}
