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

:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --bg-soft: #ffffff;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(250, 252, 255, 0.96);
  --text: #1e1e1e;
  --muted: #5f6b7a;
  --primary: #007bff;
  --primary-strong: #005fd1;
  --primary-soft: rgba(0, 123, 255, 0.14);
  --income: #00c896;
  --expense: #e34d5f;
  --border: rgba(30, 30, 30, 0.13);
  --border-strong: rgba(30, 30, 30, 0.22);
  --sidebar-start: #ffffff;
  --sidebar-end: #f6faff;
  --menu-text: #435062;
  --menu-text-strong: #1e1e1e;
  --menu-accent: #007bff;
  --menu-accent-soft: #00c896;
  --menu-border-soft: rgba(30, 30, 30, 0.1);
  --shadow-sm: 0 10px 24px rgba(17, 32, 52, 0.09);
  --shadow-md: 0 16px 34px rgba(17, 32, 52, 0.14);
  --app-background:
    radial-gradient(900px 620px at 10% -5%, rgba(0, 123, 255, 0.18), transparent 60%),
    radial-gradient(950px 700px at 15% 105%, rgba(0, 255, 198, 0.18), transparent 58%),
    linear-gradient(145deg, #f5f5f5, #eef6ff 46%, #f8fcff);
  --sidebar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.96));
  --sidebar-inset-shadow: inset -1px 0 0 rgba(0, 123, 255, 0.04);
  --sidebar-orb-1: rgba(0, 123, 255, 0.2);
  --sidebar-orb-2: rgba(0, 255, 198, 0.17);
  --sidebar-logo-shadow: drop-shadow(0 10px 18px rgba(0, 123, 255, 0.16));
  --auth-logo-shadow: drop-shadow(0 10px 24px rgba(0, 123, 255, 0.16));
  --menu-group-title-color: rgba(95, 107, 122, 0.85);
  --menu-group-border: rgba(30, 30, 30, 0.1);
  --menu-group-bg: rgba(255, 255, 255, 0.88);
  --menu-group-toggle-color: rgba(30, 30, 30, 0.86);
  --menu-group-toggle-hover-bg: rgba(0, 123, 255, 0.08);
  --menu-group-caret-color: rgba(95, 107, 122, 0.86);
  --menu-link-hover-border: rgba(0, 123, 255, 0.28);
  --menu-link-hover-bg: rgba(0, 123, 255, 0.08);
  --menu-link-active-border: rgba(0, 123, 255, 0.42);
  --menu-link-active-bg: linear-gradient(120deg, rgba(0, 123, 255, 0.12), rgba(0, 255, 198, 0.1));
  --menu-link-active-shadow: inset 3px 0 0 rgba(0, 123, 255, 0.85);
  --topbar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 252, 255, 0.9));
  --user-badge-bg: rgba(255, 255, 255, 0.88);
  --user-badge-border: rgba(0, 123, 255, 0.22);
  --tab-border: rgba(30, 30, 30, 0.16);
  --input-bg: rgba(255, 255, 255, 0.94);
  --input-hover-border: rgba(0, 123, 255, 0.42);
  --input-focus-border: rgba(0, 123, 255, 0.72);
  --input-focus-shadow: 0 0 0 3px rgba(0, 123, 255, 0.16);
  --password-icon-filter: brightness(0) saturate(100%);
  --btn-secondary-bg: linear-gradient(180deg, #ffffff, #f5f9ff);
  --btn-secondary-border: rgba(0, 123, 255, 0.25);
  --btn-secondary-text: #1e1e1e;
  --toggle-row-hover-border: rgba(0, 123, 255, 0.34);
  --toggle-row-hover-bg: rgba(0, 123, 255, 0.06);
  --summary-card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 250, 255, 0.98) 100%);
  --chart-canvas-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 249, 255, 0.98) 100%);
  --thead-bg: rgba(0, 123, 255, 0.1);
  --thead-color: #1e3550;
  --row-hover-bg: rgba(0, 123, 255, 0.05);
  --message-border: rgba(0, 123, 255, 0.22);
  --message-bg: rgba(255, 255, 255, 0.92);
  --help-backdrop-bg: rgba(30, 30, 30, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]),
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #040a12;
    --bg-soft: #0b1422;
    --surface: rgba(10, 18, 29, 0.78);
    --surface-soft: rgba(8, 14, 24, 0.92);
    --text: #f3fbff;
    --muted: #b7c8d8;
    --primary: #3b82f6;
    --primary-strong: #7c3aed;
    --primary-soft: rgba(59, 130, 246, 0.2);
    --income: #40f3b6;
    --expense: #ff7f86;
    --border: rgba(119, 184, 210, 0.28);
    --border-strong: rgba(126, 170, 196, 0.42);
    --sidebar-start: #050c14;
    --sidebar-end: #070f19;
    --menu-text: #b7c8d8;
    --menu-text-strong: #f3fbff;
    --menu-accent: #2aeef5;
    --menu-accent-soft: #67e8f9;
    --menu-border-soft: rgba(108, 164, 187, 0.24);
    --shadow-sm: 0 12px 28px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 18px 36px rgba(0, 0, 0, 0.36);
    --app-background:
      radial-gradient(900px 620px at 10% -5%, rgba(124, 58, 237, 0.45), transparent 60%),
      radial-gradient(950px 700px at 15% 105%, rgba(42, 238, 245, 0.35), transparent 58%),
      linear-gradient(145deg, #050913, #0b1422 46%, #091321);
    --sidebar-bg: linear-gradient(180deg, rgba(5, 12, 20, 0.95), rgba(7, 15, 25, 0.85));
    --sidebar-inset-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
    --sidebar-orb-1: rgba(6, 182, 212, 0.23);
    --sidebar-orb-2: rgba(124, 58, 237, 0.22);
    --sidebar-logo-shadow: drop-shadow(0 8px 18px rgba(42, 238, 245, 0.22));
    --auth-logo-shadow: drop-shadow(0 10px 24px rgba(42, 238, 245, 0.2));
    --menu-group-title-color: rgba(166, 198, 221, 0.82);
    --menu-group-border: rgba(126, 170, 196, 0.24);
    --menu-group-bg: rgba(13, 22, 35, 0.62);
    --menu-group-toggle-color: rgba(226, 232, 240, 0.9);
    --menu-group-toggle-hover-bg: rgba(30, 47, 66, 0.4);
    --menu-group-caret-color: rgba(166, 198, 221, 0.9);
    --menu-link-hover-border: rgba(142, 202, 231, 0.35);
    --menu-link-hover-bg: rgba(30, 47, 66, 0.4);
    --menu-link-active-border: rgba(113, 213, 230, 0.52);
    --menu-link-active-bg: linear-gradient(120deg, rgba(42, 238, 245, 0.2), rgba(42, 238, 245, 0.08));
    --menu-link-active-shadow: inset 3px 0 0 rgba(139, 246, 255, 0.84);
    --topbar-bg: linear-gradient(180deg, rgba(10, 18, 29, 0.9), rgba(8, 14, 24, 0.86));
    --user-badge-bg: rgba(15, 27, 42, 0.92);
    --user-badge-border: rgba(126, 170, 196, 0.38);
    --tab-border: rgba(126, 170, 196, 0.38);
    --input-bg: rgba(8, 17, 27, 0.85);
    --input-hover-border: rgba(126, 170, 196, 0.7);
    --input-focus-border: rgba(42, 238, 245, 0.8);
    --input-focus-shadow: 0 0 0 3px rgba(42, 238, 245, 0.16);
    --password-icon-filter: brightness(0) invert(1);
    --btn-secondary-bg: linear-gradient(180deg, #3e556d, #2a3e52);
    --btn-secondary-border: rgba(126, 170, 196, 0.34);
    --btn-secondary-text: #dbe8f4;
    --toggle-row-hover-border: rgba(126, 170, 196, 0.58);
    --toggle-row-hover-bg: rgba(17, 31, 47, 0.88);
    --summary-card-bg: linear-gradient(180deg, rgba(11, 22, 36, 0.88) 0%, rgba(8, 16, 26, 0.9) 100%);
    --chart-canvas-bg: linear-gradient(180deg, rgba(11, 22, 36, 0.88) 0%, rgba(8, 16, 26, 0.9) 100%);
    --thead-bg: rgba(17, 33, 52, 0.86);
    --thead-color: #b7d5ea;
    --row-hover-bg: rgba(49, 74, 93, 0.22);
    --message-border: rgba(119, 184, 210, 0.32);
    --message-bg: rgba(15, 28, 44, 0.86);
    --help-backdrop-bg: rgba(15, 23, 42, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #040a12;
  --bg-soft: #0b1422;
  --surface: rgba(10, 18, 29, 0.78);
  --surface-soft: rgba(8, 14, 24, 0.92);
  --text: #f3fbff;
  --muted: #b7c8d8;
  --primary: #3b82f6;
  --primary-strong: #7c3aed;
  --primary-soft: rgba(59, 130, 246, 0.2);
  --income: #40f3b6;
  --expense: #ff7f86;
  --border: rgba(119, 184, 210, 0.28);
  --border-strong: rgba(126, 170, 196, 0.42);
  --sidebar-start: #050c14;
  --sidebar-end: #070f19;
  --menu-text: #b7c8d8;
  --menu-text-strong: #f3fbff;
  --menu-accent: #2aeef5;
  --menu-accent-soft: #67e8f9;
  --menu-border-soft: rgba(108, 164, 187, 0.24);
  --shadow-sm: 0 12px 28px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 18px 36px rgba(0, 0, 0, 0.36);
  --app-background:
    radial-gradient(900px 620px at 10% -5%, rgba(124, 58, 237, 0.45), transparent 60%),
    radial-gradient(950px 700px at 15% 105%, rgba(42, 238, 245, 0.35), transparent 58%),
    linear-gradient(145deg, #050913, #0b1422 46%, #091321);
  --sidebar-bg: linear-gradient(180deg, rgba(5, 12, 20, 0.95), rgba(7, 15, 25, 0.85));
  --sidebar-inset-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
  --sidebar-orb-1: rgba(6, 182, 212, 0.23);
  --sidebar-orb-2: rgba(124, 58, 237, 0.22);
  --sidebar-logo-shadow: drop-shadow(0 8px 18px rgba(42, 238, 245, 0.22));
  --auth-logo-shadow: drop-shadow(0 10px 24px rgba(42, 238, 245, 0.2));
  --menu-group-title-color: rgba(166, 198, 221, 0.82);
  --menu-group-border: rgba(126, 170, 196, 0.24);
  --menu-group-bg: rgba(13, 22, 35, 0.62);
  --menu-group-toggle-color: rgba(226, 232, 240, 0.9);
  --menu-group-toggle-hover-bg: rgba(30, 47, 66, 0.4);
  --menu-group-caret-color: rgba(166, 198, 221, 0.9);
  --menu-link-hover-border: rgba(142, 202, 231, 0.35);
  --menu-link-hover-bg: rgba(30, 47, 66, 0.4);
  --menu-link-active-border: rgba(113, 213, 230, 0.52);
  --menu-link-active-bg: linear-gradient(120deg, rgba(42, 238, 245, 0.2), rgba(42, 238, 245, 0.08));
  --menu-link-active-shadow: inset 3px 0 0 rgba(139, 246, 255, 0.84);
  --topbar-bg: linear-gradient(180deg, rgba(10, 18, 29, 0.9), rgba(8, 14, 24, 0.86));
  --user-badge-bg: rgba(15, 27, 42, 0.92);
  --user-badge-border: rgba(126, 170, 196, 0.38);
  --tab-border: rgba(126, 170, 196, 0.38);
  --input-bg: rgba(8, 17, 27, 0.85);
  --input-hover-border: rgba(126, 170, 196, 0.7);
  --input-focus-border: rgba(42, 238, 245, 0.8);
  --input-focus-shadow: 0 0 0 3px rgba(42, 238, 245, 0.16);
  --password-icon-filter: brightness(0) invert(1);
  --btn-secondary-bg: linear-gradient(180deg, #3e556d, #2a3e52);
  --btn-secondary-border: rgba(126, 170, 196, 0.34);
  --btn-secondary-text: #dbe8f4;
  --toggle-row-hover-border: rgba(126, 170, 196, 0.58);
  --toggle-row-hover-bg: rgba(17, 31, 47, 0.88);
  --summary-card-bg: linear-gradient(180deg, rgba(11, 22, 36, 0.88) 0%, rgba(8, 16, 26, 0.9) 100%);
  --chart-canvas-bg: linear-gradient(180deg, rgba(11, 22, 36, 0.88) 0%, rgba(8, 16, 26, 0.9) 100%);
  --thead-bg: rgba(17, 33, 52, 0.86);
  --thead-color: #b7d5ea;
  --row-hover-bg: rgba(49, 74, 93, 0.22);
  --message-border: rgba(119, 184, 210, 0.32);
  --message-bg: rgba(15, 28, 44, 0.86);
  --help-backdrop-bg: rgba(15, 23, 42, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "Avenir Next", sans-serif;
  background: var(--app-background);
  color: var(--text);
  line-height: 1.4;
}

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

h1,
h2 {
  font-family: "Poppins", "Inter", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}

label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

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

.app-layout.has-context-panel {
  grid-template-columns: 264px 290px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  background: var(--sidebar-bg);
  color: var(--menu-text);
  padding: 22px 16px 22px;
  border-right: 1px solid var(--menu-border-soft);
  box-shadow: var(--sidebar-inset-shadow);
  backdrop-filter: blur(6px);
  overflow-x: hidden;
}

.sidebar::before,
.sidebar::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 999px;
  z-index: 0;
}

.sidebar::before {
  width: 180px;
  height: 180px;
  right: -84px;
  top: -70px;
  background: radial-gradient(circle at center, var(--sidebar-orb-1), transparent 70%);
}

.sidebar::after {
  width: 200px;
  height: 200px;
  left: -100px;
  bottom: -95px;
  background: radial-gradient(circle at center, var(--sidebar-orb-2), transparent 72%);
}

.sidebar h2 {
  position: relative;
  z-index: 1;
  font-size: 19px;
  margin-bottom: 0;
  letter-spacing: 0.02em;
  color: var(--menu-text-strong);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 22px;
  margin-top: 2px;
  margin-bottom: 6px;
}

.sidebar-brand-logo {
  width: 186px;
  height: 52px;
  object-fit: cover;
  object-position: center;
  display: block;
  filter: var(--sidebar-logo-shadow);
  opacity: 0.96;
}

.sidebar-brand-fallback {
  display: none;
  font-family: "Poppins", "Inter", "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  font-size: 22px;
  color: var(--menu-text-strong);
}

.sidebar-brand-fallback.show {
  display: inline-block;
}

.menu {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

.main-nav {
  display: grid;
  gap: 10px;
}

.main-nav-link {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--menu-text);
  background: transparent;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
}

.main-nav-link:hover {
  border-color: var(--menu-link-hover-border);
  background: var(--menu-link-hover-bg);
  color: var(--menu-text-strong);
  transform: translateX(1px);
}

.main-nav-link.active {
  color: var(--menu-text-strong);
  font-weight: 700;
  border-color: var(--menu-link-active-border);
  background: var(--menu-link-active-bg);
  box-shadow: var(--menu-link-active-shadow);
}

.context-panel {
  display: none;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px;
  gap: 14px;
  background: linear-gradient(180deg, var(--bg-soft), var(--surface-soft));
  border-right: 1px solid var(--menu-border-soft);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.app-layout.has-context-panel .context-panel {
  display: flex;
  flex-direction: column;
  animation: context-panel-in 0.15s ease-out;
}

@keyframes context-panel-in {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.context-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--menu-group-border);
}

.context-header h3 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--menu-text-strong);
}

.context-header p {
  margin: 4px 0 0;
  color: var(--menu-group-title-color);
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.35;
}

.context-close {
  display: none;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 10px;
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  width: 30px;
  height: 30px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.context-nav {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.context-link,
.menu-link {
  display: block;
  text-decoration: none;
  color: var(--menu-text);
  border: 1px solid transparent;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  transition: all 0.16s ease;
}

.context-panel::before,
.context-panel::after {
  display: none;
}

.context-link:hover,
.menu-link:hover {
  color: var(--menu-text-strong);
  border-color: var(--menu-link-hover-border);
  background: var(--menu-link-hover-bg);
  transform: translateX(1px);
}

.context-link.active,
.menu-link.active {
  color: var(--menu-text-strong);
  font-weight: 700;
  border-color: var(--menu-link-active-border);
  background: var(--menu-link-active-bg);
  box-shadow: var(--menu-link-active-shadow);
}

.main-area {
  min-width: 0;
}

.topbar-actions #logoutBtn {
  display: none;
}

.topbar-actions #helpBtn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--user-badge-border);
  background: transparent;
  color: transparent;
  font-size: 0;
  line-height: 0;
  position: relative;
  overflow: hidden;
  box-shadow: none;
}

.topbar-actions #helpBtn::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  padding: 3px;
  background: linear-gradient(180deg, var(--menu-accent-soft), var(--primary));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.topbar-actions #helpBtn::after {
  content: "?";
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Poppins", "Inter", "Segoe UI", sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg, var(--menu-accent-soft), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar-actions #helpBtn:hover {
  border-color: var(--input-hover-border);
  background: var(--surface-soft);
  box-shadow: none;
}

.topbar-actions #helpBtn:hover::before {
  transform: scale(1.04);
  filter: drop-shadow(0 0 6px var(--primary-soft));
}

.topbar-actions #helpBtn:focus-visible {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: var(--input-focus-shadow);
}

.sidebar-logout-btn {
  margin-top: auto;
  width: 100%;
  border: 1px solid var(--menu-link-active-border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--menu-text-strong);
  background: linear-gradient(120deg, var(--menu-link-hover-bg), var(--menu-link-active-bg));
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.16s ease;
  position: relative;
  z-index: 1;
}

.sidebar-logout-btn:hover {
  border-color: var(--menu-link-active-border);
  background: var(--menu-link-active-bg);
  color: var(--menu-text-strong);
  box-shadow: var(--menu-link-active-shadow);
  transform: translateY(-1px);
}

.auth-container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

.auth-container .card {
  width: min(500px, 100%);
  padding: 16px 16px 14px;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.auth-brand-logo {
  width: min(310px, 68vw);
  height: 92px;
  object-fit: cover;
  object-position: center;
  display: block;
  filter: var(--auth-logo-shadow);
}

.auth-brand-subtitle {
  margin-top: -2px;
  margin-bottom: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.auth-header h1 {
  font-size: clamp(25px, 3.4vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.auth-container .subtitle {
  margin-top: 6px;
  margin-bottom: 6px;
  text-align: center;
  font-size: 15px;
}

.auth-container .tabs {
  margin: 12px 0 10px;
}

.auth-container .form {
  gap: 6px;
}

.auth-container .message {
  margin-top: 10px;
}

.dashboard-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 16px 30px;
  display: grid;
  gap: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 25px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--user-badge-bg);
  border: 1px solid var(--user-badge-border);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  max-width: min(280px, 75vw);
}

.user-badge strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-badge::before {
  content: "";
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #007bff, #00ffc6);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.sidebar-user-badge {
  width: 100%;
  margin-top: 8px;
  border-radius: 12px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  grid-template-areas:
    "icon label"
    "icon name";
  gap: 1px 8px;
  max-width: none;
}

.sidebar-user-badge::before {
  width: 20px;
  height: 20px;
  grid-area: icon;
  align-self: center;
}

.sidebar-user-badge span {
  grid-area: label;
  font-size: 11px;
  color: var(--muted);
}

.sidebar-user-badge strong {
  grid-area: name;
  font-size: 13px;
  color: var(--menu-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-picker {
  position: relative;
  display: inline-flex;
}

.theme-picker .theme-picker-trigger {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--user-badge-border);
  background: var(--input-bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
}

.theme-picker .theme-picker-trigger:hover {
  border-color: var(--input-hover-border);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.theme-picker .theme-picker-trigger:focus-visible {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: var(--input-focus-shadow);
}

.theme-picker .theme-picker-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-picker .theme-picker-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-picker .theme-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(170deg, var(--surface), var(--surface-soft));
  box-shadow: var(--shadow-sm);
  display: none;
  z-index: 25;
}

.theme-picker.open .theme-picker-menu {
  display: grid;
  gap: 4px;
}

.theme-picker .theme-picker-option {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  box-shadow: none;
}

.theme-picker .theme-picker-option:hover {
  background: var(--menu-link-hover-bg);
  border-color: var(--menu-link-hover-border);
  color: var(--menu-text-strong);
  transform: none;
}

.theme-picker .theme-picker-option.active {
  background: var(--menu-link-active-bg);
  border-color: var(--menu-link-active-border);
  color: var(--menu-text-strong);
}

.card {
  background: linear-gradient(170deg, var(--surface), var(--surface-soft));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  animation: fade-up 0.28s ease both;
}

.subtitle {
  margin-top: 6px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.tab {
  flex: 1;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--tab-border);
}

.tab.active {
  background: linear-gradient(135deg, var(--primary), #00ffc6);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(0, 123, 255, 0.28);
}

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

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  width: 100%;
  padding-right: 40px;
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none !important;
  background: transparent !important;
  color: var(--text);
  padding: 0;
  width: 20px;
  min-width: 20px;
  height: 20px;
  font-size: 0;
  line-height: 0;
  border-radius: 0;
  box-shadow: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  cursor: pointer;
}

.password-toggle-btn:hover {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  filter: none !important;
  opacity: 0.9;
  transform: translateY(-50%);
}

.password-toggle-btn:active {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  filter: none !important;
  transform: translateY(-50%);
}

.password-toggle-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.password-toggle-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: var(--password-icon-filter);
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.hidden {
  display: none !important;
}

input,
select,
button {
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

input,
select {
  background: var(--input-bg);
  color: var(--text);
}

input:hover,
select:hover {
  border-color: var(--input-hover-border);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: var(--input-focus-shadow);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  border-color: var(--input-focus-border) !important;
  transition: background-color 99999s ease-in-out 0s;
}

input:autofill,
input:autofill:hover,
input:autofill:focus,
textarea:autofill,
textarea:autofill:hover,
textarea:autofill:focus,
select:autofill,
select:autofill:hover,
select:autofill:focus {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  border-color: var(--input-focus-border) !important;
}

input:-moz-autofill,
textarea:-moz-autofill,
select:-moz-autofill {
  box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  -moz-text-fill-color: var(--text) !important;
}

button {
  background: linear-gradient(135deg, var(--primary) 0%, #00ffc6 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

button.secondary {
  background: var(--btn-secondary-bg);
  border: 1px solid var(--btn-secondary-border);
  color: var(--btn-secondary-text);
}

button.danger {
  background: linear-gradient(180deg, #ff7c8a, #f35769);
  color: #ffffff;
}

.actions-row {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
  flex-wrap: wrap;
}

.pagination-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 13px;
  color: var(--muted);
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-controls select {
  width: auto;
  min-width: 82px;
}

.analysis-toggles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.analysis-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
}

.analysis-toggles input {
  width: 16px;
  height: 16px;
}

.alerts-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.alerts-list li {
  margin: 4px 0;
}

.display-panel summary {
  cursor: pointer;
  font-size: 17px;
  font-weight: 800;
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.display-panel summary::-webkit-details-marker {
  display: none;
}

.display-panel summary::after {
  content: "▼";
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.display-panel[open] summary::after {
  transform: rotate(180deg);
}

.display-panel[open] .analysis-toggles {
  margin-top: 12px;
}

.toggle-section-title {
  margin: 8px 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-soft);
  cursor: grab;
}

.toggle-row:hover {
  border-color: var(--toggle-row-hover-border);
  background: var(--toggle-row-hover-bg);
}

.toggle-row.dragging {
  opacity: 0.55;
}

.toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-weight: 600;
  color: var(--text);
}

.toggle-row-title {
  display: inline-block;
  max-width: 90%;
}

.toggle-row-actions {
  display: inline-flex;
  gap: 6px;
}

.toggle-row-actions button {
  min-width: 32px;
  padding: 6px 8px;
}

.dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 8px;
  gap: 14px;
  align-items: start;
}

.dashboard-widgets > .dashboard-widget,
.dashboard-widgets > .analysis-widget {
  grid-column: span 6;
}

.dashboard-widgets > .widget-full {
  grid-column: 1 / -1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 10px;
  align-items: stretch;
}

.summary-card {
  background: var(--summary-card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  grid-column: span 3;
}

.summary-card h2 {
  font-size: 16px;
}

.summary-card p {
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.summary-card.income p {
  color: var(--income);
}

.summary-card.expense p {
  color: var(--expense);
}

.two-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

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

.chart-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
  margin-top: 12px;
}

.chart-wrap canvas {
  width: 100%;
  min-width: 900px;
  background: var(--chart-canvas-bg);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: rgba(20, 35, 54, 0.95);
  color: #ffffff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.28);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 10px 6px;
  font-size: 14px;
}

thead th {
  background: var(--thead-bg);
  font-weight: 800;
  color: var(--thead-color);
}

tbody tr:hover {
  background: var(--row-hover-bg);
}

.amount-income {
  color: var(--income);
  font-weight: 700;
}

.amount-expense {
  color: var(--expense);
  font-weight: 700;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  padding: 6px 8px;
  font-size: 12px;
}

.message {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--message-border);
  background: var(--message-bg);
  border-radius: 10px;
  font-size: 14px;
  color: var(--muted);
}

.text-link {
  color: var(--menu-accent-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.text-link:hover {
  text-decoration: underline;
}

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.help-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--help-backdrop-bg);
}

.help-modal-content {
  position: relative;
  margin: 8vh auto 0;
  width: min(700px, calc(100% - 24px));
  background: linear-gradient(170deg, var(--surface), var(--surface-soft));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  z-index: 1;
  box-shadow: var(--shadow-md);
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.help-list {
  margin: 14px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 640px) {
  .topbar h1 {
    font-size: 20px;
  }

  .dashboard-widgets > .dashboard-widget,
  .dashboard-widgets > .analysis-widget {
    grid-column: 1 / -1;
  }

  .summary-card {
    grid-column: 1 / -1;
  }

  .summary-card p {
    font-size: 26px;
  }
}

@media (max-width: 1100px) {
  .summary-card {
    grid-column: span 6;
  }
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .app-layout.has-context-panel {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px 14px;
    border-right: none;
    border-bottom: 1px solid var(--menu-border-soft);
  }

  .sidebar-brand {
    margin-top: 0;
  }

  .context-panel {
    position: static;
    height: auto;
    padding: 14px;
    border-right: none;
    border-bottom: 1px solid var(--menu-border-soft);
  }

  .app-layout.has-context-panel .context-panel {
    display: flex;
  }

  .context-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .main-nav-link,
  .context-link {
    font-size: 13px;
    padding: 9px 10px;
  }

  .sidebar-logout-btn {
    margin-top: 8px;
  }

  .topbar {
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-actions {
    justify-content: flex-end;
  }

  .topbar-actions .theme-picker .theme-picker-menu {
    right: 0;
  }
}
