:root {
  --ink: #102a43;
  --ink-soft: #486581;
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --surface-tint: #f7fafc;
  --line: #e5edf5;
  --navy: #123353;
  --navy-deep: #0b2239;
  --teal: #0f9d8a;
  --teal-dark: #087a6d;
  --teal-pale: #e2f7f2;
  --gold: #e7a93f;
  --gold-pale: #fff4dc;
  --coral: #e46062;
  --coral-pale: #fff0f0;
  --purple: #7564c9;
  --purple-pale: #f0edff;
  --shadow-sm: 0 4px 18px rgba(26, 61, 95, 0.06);
  --shadow-md: 0 14px 38px rgba(26, 61, 95, 0.1);
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --font: "Segoe UI", "Arial", "Noto Sans Hebrew", sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 3%, rgba(80, 205, 181, 0.14), transparent 23rem),
    radial-gradient(circle at 28% 95%, rgba(117, 100, 201, 0.07), transparent 27rem),
    var(--canvas);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

body.modal-open,
body.menu-open { overflow: hidden; }

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

button { cursor: pointer; }

button:disabled { cursor: not-allowed; opacity: 0.55; }

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(15, 157, 138, 0.4);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.auth-gate { min-height: 100dvh; display: grid; place-items: center; padding: 36px 18px; }
.auth-card { width: min(100%, 460px); padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: var(--shadow-md); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; font-size: 26px; }
.auth-brand strong span { color: var(--teal); }
.auth-brand .brand-mark { background: var(--teal-pale); color: var(--teal-dark); }
.auth-card h1 { margin: 8px 0; font-size: 28px; letter-spacing: -.7px; }
#authTitle:focus { outline: none; }
.auth-card .auth-review-notice { background: var(--gold-pale); color: #785419; padding: 10px 12px; border-radius: 10px; font-size: 12px; }
.auth-card p { color: var(--ink-soft); }
.auth-card .eyebrow { color: var(--teal-dark); margin: 0; }
.auth-card #authIntro { margin: 0 0 22px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 5px; background: var(--canvas); border-radius: 12px; margin-bottom: 22px; }
.auth-tabs button { min-height: 44px; padding: 8px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-soft); font-weight: 600; }
.auth-tabs button[aria-pressed="true"] { background: white; color: var(--teal-dark); box-shadow: var(--shadow-sm); }
.auth-card form { display: grid; gap: 17px; }
.auth-profile-fields { display: grid; gap: 17px; }
.auth-profile-fields > p { margin: 0; }
.auth-name-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.auth-name-row .form-field { min-width: 0; }
.auth-profile-fields select { width: 100%; min-height: 48px; font-size: 16px; }
.auth-profile-fields small, .optional-label { font-size: 12px; color: var(--ink-soft); font-weight: 400; }
.auth-card .form-field .optional-label { color: var(--ink-soft); }
@media (max-width: 420px) { .auth-name-row { grid-template-columns: 1fr; } }
.auth-card .form-field input { width: 100%; min-height: 48px; font-size: 16px; }
.auth-card .button { width: 100%; min-height: 48px; justify-content: center; }
.auth-password { display: flex; align-items: stretch; gap: 7px; }
.auth-password input { min-width: 0; flex: 1; }
.auth-password button { min-width: 60px; background: var(--canvas); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 10px; }
.auth-text-button { display: block; margin: 13px auto; padding: 8px; min-height: 44px; border: 0; color: var(--teal-dark); background: none; text-decoration: underline; text-underline-offset: 3px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); margin: 13px 0; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.auth-message { padding: 12px 14px; background: var(--teal-pale); border-radius: 10px; font-size: 14px; }
.auth-card .auth-message.error { background: var(--coral-pale); color: #9c3032; }
.auth-card .auth-footnote { border-top: 1px solid var(--line); padding-top: 20px; margin: 22px 0 0; font-size: 12px; text-align: center; }
.auth-help, #passwordHint { font-size: 12px; }
.auth-email { overflow-wrap: anywhere; text-align: right; font-weight: 600; }
.account-email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--ink-soft); }
@media (max-width: 520px) {
  .auth-gate { padding: 20px 14px; }
  .auth-card { padding: 25px 20px; border-radius: 18px; }
  .auth-card h1 { font-size: 26px; }
  .auth-brand { margin-bottom: 20px; }
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  right: 12px;
  padding: 10px 15px;
  border-radius: 9px;
  color: #fff;
  background: var(--navy-deep);
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  color: #dce9f4;
  background: linear-gradient(168deg, #153c61 0%, #0d2b47 52%, #091e33 100%);
  box-shadow: -5px 0 24px rgba(9, 30, 51, 0.14);
  z-index: 30;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  top: -75px;
  left: -85px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(60, 203, 177, 0.21), rgba(60, 203, 177, 0));
  pointer-events: none;
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 9px 28px;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  color: #143d5d;
  border-radius: 13px;
  background: linear-gradient(135deg, #c9f6e9, #72d4c0);
  box-shadow: 0 8px 24px rgba(44, 202, 171, 0.25);
  font-size: 22px;
  font-weight: 800;
}

.brand strong {
  display: block;
  color: #fff;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: -0.5px;
}

.brand strong span { color: #79dcc6; }

.brand small {
  display: block;
  margin-top: 3px;
  color: #9db5c9;
  font-size: 11px;
}

.primary-nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #b5cadd;
  font-size: 14px;
  font-weight: 600;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-link span {
  width: 17px;
  color: #86d6c6;
  font-size: 18px;
  text-align: center;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.075);
  transform: translateX(-2px);
}

.nav-link.active {
  color: #fff;
  border-color: rgba(157, 230, 215, 0.3);
  background: rgba(44, 201, 171, 0.19);
  box-shadow: inset -3px 0 #79dcc6;
}

.sidebar-bottom {
  display: grid;
  gap: 15px;
  margin-top: auto;
  padding-top: 28px;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 13px;
  border: 1px solid rgba(160, 210, 227, 0.13);
  border-radius: 12px;
  color: #abc1d2;
  background: rgba(7, 24, 41, 0.28);
}

.privacy-note > span { color: #7cddc7; font-size: 20px; line-height: 1; }
.privacy-note p { margin: 0; font-size: 11px; line-height: 1.45; }
.privacy-note strong { display: block; color: #e6f1f8; font-size: 11px; }

.sidebar-action {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid rgba(228, 240, 249, 0.12);
  border-radius: 10px;
  color: #aec4d5;
  background: transparent;
  text-align: right;
  transition: all 160ms ease;
}

.sidebar-action:hover { color: #fff; border-color: rgba(228, 240, 249, 0.26); background: rgba(255,255,255,0.07); }
.sidebar-action span { margin-left: 7px; color: #ef9a9d; }

.page-wrap { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  width: 100%;
  max-width: 1660px;
  margin-inline: auto;
  display: grid;
  gap: 22px;
  padding: 28px clamp(22px, 3vw, 48px) 24px;
}

.topbar-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-title h1,
.section-heading h2,
.modal-head h2,
.data-actions h2 { margin: 0; letter-spacing: -0.35px; }

.page-title h1 { font-size: clamp(21px, 2.2vw, 29px); font-weight: 750; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.45px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.account-controls { display: flex; align-items: center; gap: 12px; padding-inline-start: 20px; border-inline-start: 1px solid var(--line); }
#addTransactionBtn { margin-inline-start: auto; flex-shrink: 0; }
.profile-switcher { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.profile-switcher > span { white-space: nowrap; }
.profile-switcher select { min-width: 165px; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-tint); color: var(--ink); padding: 0 12px; font-size: 14px; font-weight: 700; }

.sync-status { max-width: 240px; font-size: .78rem; color: var(--ink-soft); }
.sync-status.saving { color: var(--teal-dark); }
.sync-status.saved { color: #16866f; }
.sync-status.error { color: #b42318; }

.today-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.today-chip span:first-child { color: var(--teal); font-size: 16px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 750;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover { transform: translateY(-1px); }

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, #13a993, #078773);
  box-shadow: 0 9px 17px rgba(6, 135, 116, 0.2);
}

.button-primary:hover { box-shadow: 0 12px 24px rgba(6, 135, 116, 0.28); }

.button-secondary { color: var(--teal-dark); border-color: #bdeae0; background: #f0fcf9; }
.button-secondary:hover { background: #e2f8f2; }
.button-ghost-danger { color: #c34c52; border-color: #f2cfd1; background: #fff9f9; }
.button-ghost-danger:hover { background: var(--coral-pale); }
.button-icon { font-size: 20px; line-height: 0.8; font-weight: 400; }

.mobile-menu-btn, .nav-backdrop { display: none; }

main { flex: 1; width: 100%; max-width: 1660px; margin-inline: auto; padding: 4px clamp(22px, 3vw, 48px) 30px; }
main:focus, .page-section h2:focus { outline: none; }
.preview-notice { margin: 0 0 18px; padding: 10px 14px; border: 1px solid #e7d2a8; border-radius: 10px; background: #fff9ec; color: #765420; font-size: 12px; }

.page-section { min-height: calc(100dvh - 275px); padding-top: 6px; }
.page-section > .section-heading { padding-bottom: 18px; border-bottom: 1px solid #d9e4ed; }
.page-section .section-heading h2 { font-size: clamp(24px, 2.1vw, 30px); }
.section-heading .button { flex-shrink: 0; }
.workbench-panel { margin-bottom: 22px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.workbench-panel h3 { margin: 0 0 16px; font-size: 18px; }
.workbench-panel .panel-intro { margin: -7px 0 20px; color: var(--ink-soft); font-size: 13px; }
.management-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.management-link { display: flex; align-items: flex-start; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; transition: border-color 160ms, background 160ms; }
.management-link:hover { border-color: #87cfc1; background: #f7fcfa; }
.management-link-icon { display: grid; flex: 0 0 36px; height: 36px; place-items: center; border-radius: 10px; color: var(--teal-dark); background: var(--teal-pale); font-size: 20px; }
.management-link strong, .management-link small, .item-count { display: block; }
.management-link strong { font-size: 15px; }
.management-link small { margin: 4px 0 8px; color: var(--ink-soft); font-size: 13px; }
.management-link b { margin-inline-start: auto; color: var(--teal-dark); }
.item-count { color: var(--ink-soft); font-size: 11px; }
.data-settings { color: var(--ink-soft); font-size: 13px; }
.data-settings summary { cursor: pointer; padding: 10px 0; width: fit-content; }
.data-settings .data-actions { margin-top: 10px; }
.data-actions h3 { margin: 0; font-size: 15px; }
.management-surface { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }

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

.section-heading h2 { font-size: 23px; font-weight: 760; }
.dashboard-heading { align-items: center; margin-bottom: 18px; }
.updated-at { margin: 0; color: #7990a4; font-size: 11px; }

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

.summary-card {
  position: relative;
  min-height: 145px;
  padding: 17px 18px 15px;
  overflow: hidden;
  border: 1px solid rgba(222, 232, 240, 0.84);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.91);
  box-shadow: var(--shadow-sm);
  transition: transform 170ms ease, box-shadow 170ms ease;
}

.summary-card::after {
  content: "";
  position: absolute;
  width: 104px;
  height: 104px;
  left: -46px;
  bottom: -60px;
  border-radius: 50%;
  opacity: 0.44;
  pointer-events: none;
}

.summary-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.income-card::after { background: #d7f5ed; }
.expense-card::after { background: #ffe3e3; }
.balance-card::after { background: #dceafa; }
.savings-card::after { background: #fdf0cf; }
.budget-card::after { background: #e7e3ff; }
.forecast-card::after { background: #d8f2f3; }

.summary-card-top { display: flex; align-items: center; gap: 8px; min-height: 29px; }
.summary-label { color: var(--ink-soft); font-size: 12px; font-weight: 700; }

.summary-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 9px;
  font-size: 18px;
  font-weight: 800;
}

.summary-icon.income { color: #078d79; background: var(--teal-pale); }
.summary-icon.expense { color: #d34f56; background: var(--coral-pale); }
.summary-icon.balance { color: #356695; background: #e7f1fb; }
.summary-icon.savings { color: #c9871e; background: var(--gold-pale); }
.summary-icon.budget { color: #6654bb; background: var(--purple-pale); }
.summary-icon.forecast { color: #168a96; background: #e2f8f8; }

.trend,
.metric-status,
.live-dot {
  margin-right: auto;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.trend.good { color: #087a6d; background: var(--teal-pale); }
.trend.bad { color: #bb434a; background: var(--coral-pale); }
.trend.neutral { color: #6b7e90; background: #eef3f7; }
.metric-status { color: #546e85; background: #edf3f8; }
.metric-status.good { color: #087a6d; background: var(--teal-pale); }
.metric-status.warning { color: #b07013; background: var(--gold-pale); }
.metric-status.danger { color: #bd444b; background: var(--coral-pale); }
.metric-status.purple { color: #6251b8; background: var(--purple-pale); }

.live-dot { display: inline-flex; align-items: center; gap: 5px; color: #087a6d; background: #eafaf5; }
.live-dot i { width: 5px; height: 5px; border-radius: 50%; background: #16b890; box-shadow: 0 0 0 3px rgba(22,184,144,.13); }

.summary-value {
  display: block;
  margin: 18px 0 3px;
  direction: rtl;
  font-size: clamp(24px, 2.3vw, 31px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.summary-value.negative { color: #cb4f55; }
.summary-note { position: relative; z-index: 1; margin: 0; color: #7a8fa3; font-size: 11px; }
.mini-progress { height: 5px; margin: 14px 0 6px; overflow: hidden; border-radius: 999px; background: #eaedf4; }
.mini-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8d79db, #6551bf); transition: width 380ms ease; }
.mini-progress span.warning { background: linear-gradient(90deg, #efbd5b, #dc9b27); }
.mini-progress span.danger { background: linear-gradient(90deg, #ec888c, #d84f55); }

.insight-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 17px;
  padding: 14px 17px;
  border: 1px solid #d9ede8;
  border-radius: var(--radius-md);
  background: linear-gradient(100deg, #f3fffb, #f8fcff);
}

.insight-icon {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  place-items: center;
  border-radius: 11px;
  color: #d09226;
  background: #fff4d9;
  font-size: 17px;
}

.insight-banner .eyebrow { margin-bottom: 0; color: #71879b; }
.insight-banner p:last-child { margin: 2px 0 0; color: #35536d; font-size: 13px; font-weight: 600; }

.charts-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1.15fr;
  gap: 16px;
  margin-top: 18px;
}

.chart-card,
.transactions-card,
.management-surface,
.data-actions {
  border: 1px solid rgba(223, 233, 240, 0.9);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
}

.chart-card { min-width: 0; padding: 18px; }
.chart-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.chart-card h3 { margin: 0; font-size: 15px; font-weight: 780; }
.chart-card-head p { margin: 3px 0 0; color: #7b92a5; font-size: 11px; }

.chart-badge {
  padding: 4px 8px;
  border-radius: 999px;
  color: #577087;
  background: #eff4f8;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.chart-badge.success { color: #087a6d; background: #e7f8f2; }
.chart-badge.purple { color: #6653bb; background: #eeebff; }

.chart-area { position: relative; height: 215px; margin-top: 14px; }
.chart-area canvas { max-width: 100%; }
.chart-fallback { display: grid; height: 100%; place-items: center; margin: 0; padding: 20px; color: #758ca0; background: var(--surface-tint); border-radius: 12px; font-size: 12px; text-align: center; }

.transactions-card { overflow: hidden; }

.filters {
  display: grid;
  grid-template-columns: minmax(210px, 1.5fr) repeat(3, minmax(126px, .55fr)) auto;
  align-items: end;
  gap: 10px;
  padding: 17px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  padding: 0 11px;
  border: 1px solid #dbe6ee;
  border-radius: 10px;
  color: #7b92a5;
  background: #fff;
}

.search-field:focus-within { border-color: #68c7b6; box-shadow: 0 0 0 3px rgba(45, 181, 158, 0.12); }
.search-field span { font-size: 18px; line-height: 1; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-field input::placeholder, textarea::placeholder { color: #a2b1bf; }

.filter-field { display: grid; gap: 3px; }
.filter-field label { color: #70879b; font-size: 10px; font-weight: 750; }

select,
.filter-field select,
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid #d8e4ec;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

.filter-field select { min-height: 39px; padding: 0 9px; font-size: 12px; }

.text-button {
  min-height: 38px;
  padding: 0 4px;
  border: 0;
  color: #668196;
  background: transparent;
  font-size: 11px;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-button:hover { color: var(--teal-dark); }

.table-toolbar { display: flex; justify-content: space-between; gap: 15px; padding: 11px 17px; color: #71889c; background: #fff; font-size: 11px; }
.table-toolbar p { margin: 0; }
.table-toolbar p:first-child { color: #506b81; font-weight: 700; }

.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; text-align: right; }
th { padding: 11px 15px; color: #71879a; border-bottom: 1px solid var(--line); background: #f9fbfd; font-size: 10px; font-weight: 800; white-space: nowrap; }
td { padding: 13px 15px; border-bottom: 1px solid #edf2f6; color: #466076; font-size: 12px; vertical-align: middle; }
tbody tr { transition: background 130ms ease; }
tbody tr:hover { background: #f9fcfd; }
tbody tr:last-child td { border-bottom: 0; }
.transaction-description { color: var(--ink); font-weight: 720; }
.transaction-description small { display: block; max-width: 180px; margin-top: 2px; overflow: hidden; color: #8298aa; font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.date-cell { color: #7890a3; white-space: nowrap; }
.payment-cell { color: #71879a; white-space: nowrap; }
.amount { direction: ltr; font-weight: 800; white-space: nowrap; }
.amount.income { color: #098b75; }
.amount.expense { color: #d14d55; }

.type-pill,
.category-pill,
.budget-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.type-pill { min-width: 54px; padding: 4px 8px; }
.type-pill.income { color: #087b69; background: #e4f8f1; }
.type-pill.expense { color: #bd454d; background: #fff0f0; }
.category-pill { padding: 4px 8px; color: #526c83; background: #f0f4f8; }

.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.icon-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #607b90;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  transition: all 150ms ease;
}
.icon-button:hover { color: var(--teal-dark); border-color: #ccebe4; background: #f0fcf9; }
.icon-button.delete:hover { color: #c3444b; border-color: #f5d4d5; background: #fff3f3; }
.icon-button.circle { border-color: #bde8df; border-radius: 50%; color: var(--teal-dark); background: #effbf8; font-size: 21px; }
.empty-table td { padding: 34px; color: #7d94a6; text-align: center; }

.compact-heading { align-items: center; margin-bottom: 15px; }
.compact-heading h2 { font-size: 20px; }

.budget-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 13px;
  border-radius: 12px;
  color: #4f6680;
  background: #f6f9fc;
  font-size: 11px;
}

.budget-summary strong { color: var(--ink); font-size: 13px; }
.budget-list, .goal-list { display: grid; gap: 10px; }

.budget-item {
  padding: 12px 13px;
  border: 1px solid #e7eef4;
  border-radius: 13px;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.budget-item:hover { border-color: #d3e3ec; box-shadow: 0 5px 13px rgba(26, 61, 95, 0.045); }
.budget-item.is-over { border-color: #f6d1d2; background: #fffdfd; }

.budget-top { display: flex; align-items: center; gap: 8px; }
.budget-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.budget-title strong { color: #274762; font-size: 12px; }
.budget-title span { color: #8096a8; font-size: 10px; }
.budget-state { margin-right: auto; padding: 3px 7px; color: #087a6d; background: #e9f9f4; }
.budget-state.warning { color: #ad6d12; background: #fff4dd; }
.budget-state.danger { color: #bd434a; background: #fff0f0; }
.budget-item .row-actions { margin-right: 2px; }
.budget-item .icon-button { width: 27px; height: 27px; font-size: 15px; }

.progress-track { height: 7px; margin: 11px 0 7px; overflow: hidden; border-radius: 999px; background: #e9eff4; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #37bea6, #0d9986); transition: width 380ms ease; }
.progress-track.warning span { background: linear-gradient(90deg, #f0c35f, #df9f2b); }
.progress-track.danger span { background: linear-gradient(90deg, #ee9295, #d95359); }
.budget-values { display: flex; justify-content: space-between; gap: 8px; color: #7890a4; font-size: 10px; }
.budget-values strong { color: #466076; font-size: 11px; }

.goal-item {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border: 1px solid #e6eaf5;
  border-radius: 14px;
  background: linear-gradient(116deg, #fff, #faf9ff);
}
.goal-item::after { content: ""; position: absolute; width: 90px; height: 90px; left: -40px; bottom: -47px; border-radius: 50%; background: rgba(117,100,201,.08); }
.goal-top { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 9px; }
.goal-icon { display: grid; width: 31px; height: 31px; flex: 0 0 31px; place-items: center; border-radius: 10px; color: #6958bd; background: var(--purple-pale); font-size: 16px; }
.goal-title { min-width: 0; }
.goal-title strong { display: block; overflow: hidden; color: #314e68; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.goal-title small { display: block; margin-top: 2px; color: #8496aa; font-size: 10px; }
.goal-top .row-actions { margin-right: auto; }
.goal-top .icon-button { position: relative; z-index: 2; width: 26px; height: 26px; font-size: 14px; }
.goal-amounts { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 6px; margin-top: 14px; color: #758a9e; font-size: 10px; }
.goal-amounts strong { color: #455d78; font-size: 12px; }
.goal-progress { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.goal-progress .progress-track { flex: 1; margin: 0; height: 6px; background: #e7e4f4; }
.goal-progress .progress-track span { background: linear-gradient(90deg, #9a89e5, #6a58c1); }
.goal-progress b { color: #6654ba; font-size: 10px; }
.empty-state { padding: 24px 16px; border: 1px dashed #d7e1e9; border-radius: 13px; color: #7f95a7; background: #fbfdff; font-size: 12px; text-align: center; }
.empty-state strong { display: block; margin-bottom: 3px; color: #5f788e; }

.data-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 48px;
  padding: 18px 20px;
  background: linear-gradient(104deg, #fff, #f5fbfa);
}
.data-actions > div { display: flex; align-items: center; gap: 13px; }
.data-actions-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: #057e6b; background: #def5ed; font-size: 22px; }
.data-actions h2 { font-size: 14px; }
.data-actions p { margin: 2px 0 0; color: #71899d; font-size: 11px; }

.footer { display: flex; justify-content: space-between; gap: 12px; padding: 25px clamp(22px, 4vw, 56px); color: #8da0af; font-size: 11px; }
.footer p { margin: 0; }

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 22px;
  place-items: center;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(9, 30, 51, 0.57); backdrop-filter: blur(3px); }
.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 470px);
  max-height: min(720px, calc(100vh - 44px));
  overflow: auto;
  padding: 23px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 25px 80px rgba(4, 22, 38, 0.32);
  animation: modal-in 180ms ease-out;
}
.modal-large { width: min(100%, 690px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.modal-head h2 { font-size: 20px; }
.close-button { flex: 0 0 32px; font-size: 26px; font-weight: 300; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-field { min-width: 0; display: grid; gap: 6px; }
.form-field-wide { grid-column: 1 / -1; }
.form-field label { color: #536d84; font-size: 12px; font-weight: 750; }
.form-field label span { color: #d25459; }
.form-field input,
.form-field select,
.form-field textarea { min-height: 43px; padding: 9px 11px; outline: 0; font-size: 13px; transition: border-color 150ms ease, box-shadow 150ms ease; }
.form-field textarea { min-height: 78px; resize: vertical; }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: #56bca9; box-shadow: 0 0 0 3px rgba(37, 173, 150, 0.13); }
.currency-input { display: flex; align-items: center; overflow: hidden; border: 1px solid #d8e4ec; border-radius: 10px; background: #fff; }
.currency-input:focus-within { border-color: #56bca9; box-shadow: 0 0 0 3px rgba(37, 173, 150, 0.13); }
.currency-input span { padding: 0 12px; color: #668095; border-left: 1px solid #e2e9ef; font-weight: 800; }
.currency-input input { border: 0; border-radius: 0; box-shadow: none !important; }
.form-actions { display: flex; justify-content: flex-start; gap: 9px; margin-top: 4px; }

.toast {
  position: fixed;
  z-index: 150;
  bottom: 22px;
  right: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 16px;
  border: 1px solid #bde9df;
  border-radius: 12px;
  color: #fff;
  background: #143c5c;
  box-shadow: 0 14px 32px rgba(11, 34, 57, 0.2);
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 170ms ease, transform 170ms ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #e9a7aa; background: #9d3f46; }

@media (max-width: 1280px) {
  .charts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-trend { grid-column: 1 / -1; }
  .chart-trend .chart-area { height: 195px; }
  .filters { grid-template-columns: minmax(190px, 1.3fr) repeat(3, minmax(112px, .6fr)); }
  .filters .text-button { grid-column: 1 / -1; justify-self: start; min-height: 20px; }
}

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 232px minmax(0, 1fr); }
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-actions { flex-wrap: wrap; gap: 12px; }
  .profile-switcher > span { display: none; }
  .account-controls { padding-inline-start: 12px; flex-wrap: wrap; gap: 6px; }
  .account-controls .sync-status { width: 100%; font-size: 11px; }
}

@media (max-width: 850px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: min(276px, 82vw);
    transform: translateX(108%);
    transition: transform 210ms ease;
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .nav-backdrop { display: block; position: fixed; z-index: 25; inset: 0; border: 0; background: rgba(9,30,51,.42); }
  .mobile-menu-btn { display: grid; width: 38px; height: 38px; padding: 8px; gap: 4px; place-content: center; border: 1px solid #d8e5ee; border-radius: 10px; background: #fff; }
  .mobile-menu-btn span { display: block; width: 19px; height: 2px; border-radius: 4px; background: var(--navy); }
  .topbar { gap: 18px; padding-top: 18px; padding-bottom: 18px; }
  .page-title { flex: 1; }
  .today-chip { display: none; }
  .profile-switcher > span { display: block; }
  .account-controls { flex-wrap: nowrap; }
  .account-controls .sync-status { width: auto; }
  .topbar-actions { gap: 14px; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-trend { grid-column: auto; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .search-field { grid-column: 1 / -1; }
}

@media (max-width: 590px) {
  .topbar { gap: 16px; padding: 18px 16px; }
  .page-title .eyebrow { display: none; }
  .page-title h1 { font-size: 19px; }
  .topbar-greeting { gap: 12px; }
  .topbar-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px; }
  .profile-switcher { min-width: 0; display: grid; gap: 4px; }
  .profile-switcher > span { font-size: 10px; }
  .profile-switcher select { width: 100%; min-width: 0; padding-inline: 6px; font-size: 12px; }
  #addTransactionBtn { grid-column: 2; grid-row: 1; margin: 0; align-self: end; padding-inline: 10px; font-size: 12px; }
  .account-controls { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; border-inline-start: 0; border-top: 1px solid var(--line); padding: 10px 0 0; gap: 10px; }
  .account-controls .button { min-height: 36px; padding-inline: 10px; font-size: 11px; flex-shrink: 0; }
  main { padding: 0 16px 22px; }
  .page-section { min-height: calc(100dvh - 290px); }
  .page-section > .section-heading { align-items: flex-start; flex-wrap: wrap; gap: 12px; padding-bottom: 14px; }
  .workbench-panel, .management-surface { padding: 16px; }
  .management-links { grid-template-columns: 1fr; }
  .management-link { padding: 14px; }
  .section-heading h2 { font-size: 20px; }
  .updated-at { display: none; }
  .summary-grid { gap: 10px; }
  .summary-card { min-height: 133px; padding: 13px 13px 12px; border-radius: 14px; }
  .summary-card-top { gap: 5px; }
  .summary-icon { width: 25px; height: 25px; flex-basis: 25px; border-radius: 8px; font-size: 16px; }
  .summary-label { font-size: 10px; }
  .trend, .metric-status, .live-dot { padding: 2px 5px; font-size: 8px; }
  .summary-value { margin-top: 17px; font-size: 23px; }
  .summary-note { font-size: 9px; }
  .mini-progress { margin-top: 11px; }
  .insight-banner { align-items: flex-start; padding: 12px; }
  .insight-banner p:last-child { font-size: 12px; }
  .charts-grid { gap: 12px; margin-top: 13px; }
  .chart-card { padding: 14px; border-radius: 16px; }
  .chart-area { height: 205px; }
  .section-heading { align-items: center; margin-bottom: 13px; }
  .filters { grid-template-columns: 1fr 1fr; padding: 12px; }
  .filter-field { min-width: 0; }
  .filter-field select { width: 100%; }
  .table-toolbar { padding: 10px 12px; }
  .table-hint { display: none; }
  .transactions-card, .management-surface, .data-actions { border-radius: 16px; }
  .data-actions { align-items: flex-start; flex-direction: column; margin-top: 34px; padding: 15px; }
  .data-actions .button { width: 100%; }
  .footer { flex-direction: column; padding: 21px 16px; }
  .modal { padding: 12px; }
  .modal-dialog { max-height: calc(100vh - 24px); padding: 18px; border-radius: 17px; }
  .modal-head h2 { font-size: 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 11px; }
  .form-field-wide { grid-column: auto; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
}

@media (max-width: 390px) {
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 118px; }
  .summary-value { margin-top: 13px; }
  .filters { grid-template-columns: 1fr; }
  .filters .search-field { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Workbench actions and profile-specific content */
.quick-action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.quick-action { min-height: 144px; padding: 1.2rem; border: 1px solid #dbe8ec; border-radius: 12px; background: var(--surface-tint); color: var(--navy); text-align: right; cursor: pointer; transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease; }
.quick-action:hover { transform: translateY(-3px); border-color: #76cbbd; box-shadow: 0 12px 22px rgba(13, 61, 76, .11); }
.quick-action span { display: grid; width: 31px; height: 31px; place-items: center; margin-bottom: .65rem; border-radius: 9px; font-size: 1.25rem; }
.quick-action strong, .quick-action small { display: block; }
.quick-action strong { margin-bottom: .35rem; font-size: .95rem; }
.quick-action small { color: var(--muted, #64748b); font-size: .75rem; line-height: 1.38; }
.quick-income span { color: #087f5b; background: #e0f8ef; }.quick-expense span { color: #bd4b52; background: #fff0f0; }.quick-recurring span { color: #6751b8; background: #f0ecff; }.quick-client span { color: #286eb5; background: #e9f3ff; }
.business-profile .quick-client { border-color: #a6c6f1; }
.business-profile .summary-card.income-card { border-top-color: #326fbd; }
.client-list { display: grid; gap: .7rem; }
.client-item, .empty-clients { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; border: 1px solid #dce5ef; border-radius: 15px; background: #fff; box-shadow: 0 8px 20px rgba(15,23,42,.035); }
.client-item h3 { margin: 0; color: var(--navy); font-size: 1rem; }.client-item p, .client-item small { display: block; margin: .25rem 0 0; color: var(--muted, #64748b); font-size: .82rem; }.client-item-actions { display: grid; justify-items: end; gap: .55rem; color: #286eb5; font-size: .88rem; }.empty-clients { display: grid; justify-content: start; color: var(--muted, #64748b); }.empty-clients span { font-size: .88rem; }
.section-intro { max-width: 900px; margin: 0 0 24px; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.recurring-list { display: grid; gap: .8rem; }
.recurring-item { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: 1rem 1.15rem; background: #fff; border: 1px solid #dce5ef; border-radius: 16px; box-shadow: 0 8px 24px rgba(15,23,42,.04); }
.recurring-item h3 { margin: 0; color: var(--navy); font-size: 1rem; }
.recurring-meta { display: flex; flex-wrap: wrap; gap: .45rem .75rem; margin-top: .35rem; color: var(--muted, #64748b); font-size: .85rem; }
.recurring-amount { margin-top: .35rem; color: #087f5b; font-weight: 800; }
.recurring-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .45rem; }
.button.button-small { min-height: 34px; padding: .35rem .7rem; font-size: .82rem; }
.empty-recurring { padding: 1.35rem; border: 1px dashed #dce5ef; border-radius: 14px; color: var(--muted, #64748b); text-align: center; }
@media (max-width: 780px) { .quick-action-grid { grid-template-columns: 1fr; } .quick-action { min-height: auto; } .recurring-item { grid-template-columns: 1fr; } .recurring-actions { justify-content: start; } .client-item { align-items: flex-start; flex-direction: column; } .client-item-actions { justify-items: start; } }
