/* ═══════════════════════════════════════════
   DESIGN SYSTEM — DARK / LIGHT THEMES
═══════════════════════════════════════════ */
:root,
[data-theme="dark"] {
  --bg: #07070f;
  --bg2: #0d0d1a;
  --bg3: #13132a;
  --bg4: #1a1a38;
  --border: #1e1e3a;
  --border2: #2a2a52;
  --text: #e8e8f8;
  --text2: #8888b0;
  --text3: #44445a;
  --accent: #6c47ff;
  --accent2: #9d7dff;
  --accent3: #c4b0ff;
  --green: #00e5a0;
  --green2: #00b37d;
  --red: #ff4d6d;
  --red2: #cc3d57;
  --yellow: #ffc947;
  --teal: #00d4c8;
  --orange: #ff7940;
  --pink: #ff5fad;
  --mono: "JetBrains Mono", monospace;
  --sans: "Syne", sans-serif;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}
[data-theme="light"] {
  --bg: #f4f3ff;
  --bg2: #fafaf8;
  --bg3: #ede9ff;
  --bg4: #e0d8ff;
  --border: #d4ccff;
  --border2: #b8acee;
  --text: #1a1830;
  --text2: #5a5580;
  --text3: #9993c0;
  --accent: #6c47ff;
  --accent2: #5535dd;
  --accent3: #3a20b0;
  --green: #00a070;
  --green2: #007050;
  --red: #e0284a;
  --red2: #b01f3a;
  --yellow: #d4900a;
  --teal: #009990;
  --orange: #d45a20;
  --pink: #cc3380;
  --shadow: 0 4px 24px rgba(108, 71, 255, 0.1);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--text);
  transition:
    background 0.3s,
    color 0.3s;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  transition: background 0.5s;
}
#blob1 {
  width: 700px;
  height: 700px;
  background: #6c47ff0a;
  top: -250px;
  right: -150px;
}
#blob2 {
  width: 500px;
  height: 500px;
  background: #00e5a008;
  bottom: -200px;
  left: -100px;
}
[data-theme="light"] #blob1 {
  background: #6c47ff18;
}
[data-theme="light"] #blob2 {
  background: #00e5a015;
}

/* ═══ LAYOUT ═══ */
#app {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
  overflow: visible;
}
#sidebar {
  width: 64px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition:
    width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.3s;
  overflow: visible;
  position: relative;
  z-index: 20;
}
#sidebar.expanded {
  width: 230px;
}
#main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
#main::-webkit-scrollbar {
  width: 3px;
}
#main::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}

/* ═══ SIDEBAR ═══ */
.logo-area {
  padding: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 64px;
  position: relative;
}
/* Hamburger button — always at top of sidebar */
#hamburger {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text2);
  transition:
    color 0.15s,
    background 0.15s;
  position: relative;
  z-index: 1;
}
#hamburger:hover {
  color: var(--accent2);
  background: var(--bg3);
}
.hb-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hb-line {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition:
    transform 0.25s ease,
    opacity 0.2s ease,
    width 0.25s ease;
  transform-origin: center;
}
/* Animate hamburger → X when expanded */
#sidebar.expanded .hb-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
#sidebar.expanded .hb-line:nth-child(2) {
  opacity: 0;
  width: 0;
}
#sidebar.expanded .hb-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Logo text — shown only when expanded */
.logo-wordmark {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 800;
  color: var(--accent2);
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
  position: absolute;
  left: 72px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.logo-tag {
  font-size: 8px;
  color: var(--text3);
  letter-spacing: 3px;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  position: absolute;
  left: 72px;
  top: calc(50% + 13px);
  pointer-events: none;
}
#sidebar.expanded .logo-wordmark,
#sidebar.expanded .logo-tag {
  opacity: 1;
  transition-delay: 0.1s;
}

nav::-webkit-scrollbar {
  width: 2px;
}
nav::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 2px;
}

nav {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  flex: 1;
}
.nav-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 4px;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  align-items: stretch;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text2);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border: none;
  background: transparent;
  width: calc(100% - 2px);
  text-align: left;
  transition: background 0.15s, color 0.15s;
  font-family: var(--mono);
  position: relative;
  white-space: nowrap;
  overflow: visible;
}
.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}
.nav-item.active {
  background: linear-gradient(135deg, #6c47ff22, #00e5a010);
  color: var(--accent2);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
#sidebar .nav-item[data-tip],
#sidebar .theme-toggle[data-tip] {
  overflow: visible;
}

.nav-item[data-tip]::after,
.theme-toggle[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg3);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 999;
}

.nav-item[data-tip]:hover::after,
.theme-toggle[data-tip]:hover::after {
  opacity: 1;
}

/* Hide tooltip when sidebar is expanded (label is already visible) */
#sidebar.expanded .nav-item[data-tip]:hover::after,
#sidebar.expanded .theme-toggle[data-tip]:hover::after {
  opacity: 0;
}

/* Label — hidden when collapsed */
.nav-label {
  opacity: 0;
  max-width: 0;
  transition: opacity 0.15s ease, max-width 0.15s ease;
  pointer-events: none;
  flex-shrink: 0;
  overflow: hidden;
}
#sidebar.expanded .nav-label {
  opacity: 1;
  max-width: 200px;
  transition-delay: 0.08s;
}
.nav-icon {
  width: 35px;
  height: 35px;
  font-size: medium;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  stroke: currentColor;
}
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 20px;
  font-weight: 700;
}

.sidebar-bottom {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
  letter-spacing: 0.5px;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: visible;
  position: relative;
}
.theme-toggle:hover {
  background: var(--bg3);
  color: var(--text);
}
.toggle-label {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, max-width 0.15s ease;
  pointer-events: none;
}
#sidebar.expanded .toggle-label {
  opacity: 1;
  max-width: 200px;
  transition-delay: 0.08s;
}
.sidebar-version {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 2px;
  padding: 4px 10px 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
#sidebar.expanded .sidebar-version {
  opacity: 1;
  transition-delay: 0.1s;
}

/* ═══ TOPBAR ═══ */
#topbar {
  height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background 0.3s;
}
.page-title {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.page-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.month-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.month-pill {
  font-size: 10px;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-family: var(--mono);
  letter-spacing: 0.5px;
  transition: all 0.15s;
}
.month-pill:hover {
  border-color: var(--accent);
  color: var(--accent2);
}
.month-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.quick-add-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  font-weight: 700;
}
.quick-add-btn:hover {
  background: #5a38e0;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px #6c47ff44;
}

.topbar-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  transition: all 0.15s;
}

.topbar-theme-toggle:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border);
}

/* ═══ PAGES ═══ */
.page {
  padding: 26px 32px;
  display: none;
  animation: fadeUp 0.2s ease;
}
.page.active {
  display: block;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══ CARDS ═══ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition:
    background 0.3s,
    border-color 0.3s;
}
.card-sm {
  padding: 16px 18px;
}
.sec-label {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* ═══ STAT GRID ═══ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: background 0.3s;
}
.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}
.stat-card.c-purple::after {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.stat-card.c-red::after {
  background: linear-gradient(90deg, var(--red), var(--orange));
}
.stat-card.c-green::after {
  background: linear-gradient(90deg, var(--green), var(--teal));
}
.stat-card.c-teal::after {
  background: linear-gradient(90deg, var(--teal), var(--accent2));
}
.stat-card.c-yellow::after {
  background: linear-gradient(90deg, var(--yellow), var(--orange));
}
.stat-label {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.stat-val {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-sub {
  font-size: 10px;
  color: var(--text2);
}

/* ═══ PROGRESS ═══ */
.prog-wrap {
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══ GRIDS ═══ */
.g2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.g3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.g21 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.g12 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 18px;
  margin-bottom: 18px;
}

/* ═══ TRANSACTION ROWS ═══ */
.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.tx-row:last-child {
  border-bottom: none;
}
.tx-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.tx-info {
  flex: 1;
  min-width: 0;
}
.tx-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-meta {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
}
.tx-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tx-amount {
  font-size: 13px;
  font-weight: 700;
}
.tx-recur {
  font-size: 9px;
  color: var(--teal);
  background: #00d4c815;
  padding: 2px 7px;
  border-radius: 10px;
}
.del-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text3);
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-family: var(--mono);
  transition: all 0.15s;
}
.del-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: #ff4d6d18;
}

/* ═══ CAT ROWS ═══ */
.cat-row {
  padding: 9px 0;
}
.cat-row + .cat-row {
  border-top: 1px solid var(--border);
}
.cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.cat-name {
  font-size: 12px;
  display: flex;
  gap: 7px;
  align-items: center;
}
.cat-badge {
  font-size: 9px;
  color: var(--red);
  background: #ff4d6d18;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

/* ═══ FORMS ═══ */
.form-grid {
  display: grid;
  gap: 14px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 13px;
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition:
    border-color 0.15s,
    background 0.15s;
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  background: var(--bg4);
}
.field input.big {
  font-size: 26px;
  padding: 13px;
}
.field select option {
  background: var(--bg3);
}
.field .hint {
  font-size: 10px;
  color: var(--text3);
}

/* ═══ BUTTONS ═══ */
.btn {
  cursor: pointer;
  font-family: var(--mono);
  border: none;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
}
.btn-primary:hover {
  background: #5a38e0;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px #6c47ff44;
}
.btn-ghost {
  background: transparent;
  color: var(--accent2);
  border: 1px solid var(--border2);
  padding: 7px 14px;
  font-size: 10px;
}
.btn-ghost:hover {
  border-color: var(--accent);
  background: #6c47ff12;
}
.btn-ghost:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid #ff4d6d30;
  padding: 7px 14px;
  font-size: 10px;
}
.btn-danger:hover {
  background: #ff4d6d18;
  border-color: var(--red);
}
.btn-green {
  background: var(--green);
  color: #000;
  padding: 12px 24px;
  font-weight: 700;
}
.btn-green:hover {
  background: var(--green2);
  transform: translateY(-1px);
}

/* ═══ ANALYSIS BLOCKS ═══ */
.verdict-box {
  background: linear-gradient(135deg, #6c47ff14, #00e5a00a);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.verdict-label {
  font-size: 9px;
  color: var(--accent2);
  letter-spacing: 3px;
  margin-bottom: 7px;
}
.verdict-text {
  font-size: 13px;
  line-height: 1.65;
  font-style: italic;
}
.danger-box {
  background: #ff4d6d12;
  border: 1px solid #ff4d6d40;
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 12px;
}
.danger-label {
  font-size: 9px;
  color: var(--red);
  letter-spacing: 3px;
  margin-bottom: 5px;
}
.goal-box {
  background: #00e5a010;
  border: 1px solid #00e5a035;
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 12px;
}
.goal-label {
  font-size: 9px;
  color: var(--green);
  letter-spacing: 3px;
  margin-bottom: 5px;
}
.warn-box {
  background: #ffc94712;
  border: 1px solid #ffc94740;
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 12px;
}
.warn-label {
  font-size: 9px;
  color: var(--yellow);
  letter-spacing: 3px;
  margin-bottom: 5px;
}
.cutback-item {
  display: flex;
  gap: 9px;
  padding: 7px 0;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
}
.cutback-item:last-child {
  border-bottom: none;
}
.wins-item {
  font-size: 11px;
  color: var(--text2);
  padding: 4px 0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* ═══ GOAL TRACKER ═══ */
.goal-track-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.goal-track-item:last-child {
  border-bottom: none;
}
.goal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.goal-name {
  font-size: 12px;
  font-weight: 500;
}
.goal-pct {
  font-size: 11px;
  color: var(--accent2);
  font-weight: 700;
}
.goal-amounts {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text3);
  margin-top: 5px;
}
.goal-deadline {
  font-size: 10px;
  color: var(--text3);
  margin-top: 3px;
}

/* ═══ RECURRING ═══ */
.recur-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.recur-item:last-child {
  border-bottom: none;
}
.recur-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.recur-info {
  flex: 1;
}
.recur-name {
  font-size: 12px;
}
.recur-meta {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
}
.recur-amount {
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
}

/* ═══ CHART CONTAINERS ═══ */
.chart-wrap {
  position: relative;
}
.chart-wrap canvas {
  display: block;
}

/* ═══ HEATMAP ═══ */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.heatmap-day {
  aspect-ratio: 1;
  border-radius: 3px;
  cursor: default;
  transition: transform 0.1s;
  position: relative;
}
.heatmap-day:hover {
  transform: scale(1.3);
  z-index: 5;
}
.heatmap-day[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg4);
  border: 1px solid var(--border2);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  color: var(--text);
  font-family: var(--mono);
}
.heatmap-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 4px;
}
.heatmap-label {
  font-size: 8px;
  color: var(--text3);
  text-align: center;
  letter-spacing: 0.5px;
}

/* ═══ MOM TABLE ═══ */
.mom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.mom-table th {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.mom-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}
.mom-table tr:last-child td {
  border-bottom: none;
}
.mom-table tr:hover td {
  background: var(--bg3);
}
.delta {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
}
.delta.up {
  background: #ff4d6d18;
  color: var(--red);
}
.delta.dn {
  background: #00e5a015;
  color: var(--green);
}
.delta.fl {
  background: var(--bg4);
  color: var(--text3);
}

/* ═══ QUICK-ADD MODAL ═══ */
#quick-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: #00000080;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
#quick-modal.open {
  display: flex;
}
#csv-export-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: #00000080;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
#csv-export-modal.open {
  display: flex;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 18px;
  padding: 28px;
  width: 440px;
  max-width: 95vw;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.modal-title {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
}
.modal-close:hover {
  color: var(--text);
}
.nlp-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.nlp-bar input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
}
.nlp-bar input:focus {
  border-color: var(--accent);
}
.nlp-hint {
  font-size: 10px;
  color: var(--text3);
  margin-bottom: 14px;
  font-style: italic;
}
.nlp-parsed {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 9px;
  padding: 12px;
  margin-bottom: 14px;
  display: none;
}
.nlp-parsed.show {
  display: block;
}
.nlp-field {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 11px;
}
.nlp-key {
  color: var(--text3);
}
.nlp-val {
  color: var(--accent2);
  font-weight: 500;
}

/* ═══ WEEKLY CHECKIN ═══ */
.checkin-banner {
  background: linear-gradient(135deg, #6c47ff18, #00e5a010);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.checkin-banner:hover {
  background: linear-gradient(135deg, #6c47ff25, #00e5a018);
}
.checkin-icon {
  font-size: 24px;
}
.checkin-text {
  flex: 1;
}
.checkin-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 2px;
}
.checkin-sub {
  font-size: 10px;
  color: var(--text2);
}
.checkin-arrow {
  font-size: 16px;
  color: var(--accent2);
}
.checkin-output {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
}
.checkin-output strong {
  color: var(--accent2);
}

/* ═══ PROJECTION ═══ */
.projection-box {
  background: var(--bg3);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.proj-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
}
.proj-key {
  color: var(--text2);
}
.proj-val {
  font-weight: 700;
}

/* ═══ TOAST ═══ */
#toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}
.toast {
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.5px;
  animation: toastIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.ok {
  background: var(--bg3);
  border: 1px solid var(--green);
  color: var(--green);
}
.toast.err {
  background: var(--bg3);
  border: 1px solid var(--red);
  color: var(--red);
}
.toast.inf {
  background: var(--bg3);
  border: 1px solid var(--accent2);
  color: var(--accent2);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast .toast-msg {
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

.toast .toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}

.toast .toast-close:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Offline banner close button */
#offline-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
#offline-banner .offline-msg {
  flex: 1;
}
#offline-banner .offline-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  transition: all 0.2s ease;
  font-weight: 600;
  line-height: 1;
}
#offline-banner .offline-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.08);
}
#offline-banner .offline-close:active {
  transform: scale(0.96);
}

/* ═══ SCROLLABLE LIST ═══ */
.scroll-list {
  max-height: 300px;
  overflow-y: auto;
}
.scroll-list::-webkit-scrollbar {
  width: 2px;
}
.scroll-list::-webkit-scrollbar-thumb {
  background: var(--border2);
}

/* ═══ EMPTY ═══ */
.empty {
  text-align: center;
  padding: 40px 0;
  color: var(--text3);
  font-size: 12px;
}
.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.25;
}

/* ═══ ANOMALY BADGE ═══ */
.anomaly-card {
  border-color: var(--yellow) !important;
}
.anomaly-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.anomaly-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation: blink 1.5s infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
.anomaly-item {
  font-size: 11px;
  color: var(--text2);
  padding: 4px 0;
  display: flex;
  gap: 8px;
}
.anomaly-item .arrow {
  color: var(--red);
}

/* ═══════════════════════════════════════════
   RESPONSIVE — 3-TIER BREAKPOINTS
   Sidebar expands/collapses via hamburger toggle.
═══════════════════════════════════════════ */

/* ── Medium (≤1100px) ── */
@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .g3 {
    grid-template-columns: 1fr 1fr;
  }
  .topbar-right .month-pills {
    display: none;
  }
  #topbar {
    height: 60px;
    padding: 0 20px;
  }
  .page {
    padding: 20px;
  }
}

/* ── Tablet (≤768px) ── */
@media (max-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .g2,
  .g21,
  .g12 {
    grid-template-columns: 1fr;
  }
  .g3 {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .page {
    padding: 14px;
  }
  #topbar {
    padding: 10px 14px;
  }
  .page-title {
    font-size: 18px;
  }
  .page-sub {
    display: none;
  }
  .quick-add-btn {
    padding: 7px 12px;
    font-size: 10px;
  }
  .stat-val {
    font-size: 20px;
  }
  .card {
    padding: 14px;
  }
  .modal-box {
    padding: 20px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .chart-wrap {
    height: 200px !important;
  }
  .scroll-list {
    max-height: 240px;
  }
  .nav-container {
    padding: 8px 6px;
  }
  .nav-group {
    gap: 4px;
  }
  .nav-item {
    padding: 7px 6px;
    gap: 9px;
  }
  .sidebar-bottom {
    padding: 8px 6px;
    gap: 4px;
  }
  .theme-toggle {
    padding: 7px 8px;
    gap: 10px;
  }
  .field input.big {
    font-size: 20px;
  }
  #quick-modal {
    align-items: flex-end;
  }
  .modal-box {
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 20px 16px 28px;
    max-height: 90vh;
    overflow-y: auto;
  }
  .mom-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mom-table {
    min-width: 380px;
    font-size: 10px;
  }
  .tx-icon {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
  .tx-name {
    font-size: 11px;
  }
  .tx-meta {
    font-size: 9px;
  }
  .tx-amount {
    font-size: 12px;
  }
  #toast-container {
    right: 12px;
    left: 12px;
    bottom: 16px;
  }
  .toast {
    justify-content: center;
  }
  #year-pills {
    flex-wrap: wrap;
  }
  .highlight-val {
    font-size: 17px;
  }
  .nav-container {
    padding: 6px 4px;
  }
  .nav-group {
    gap: 3px;
  }
  .nav-item {
    padding: 6px;
    gap: 8px;
  }
  .sidebar-bottom {
    padding: 6px 4px;
    gap: 3px;
  }
  .theme-toggle {
    padding: 5px 6px;
    gap: 8px;
  }
}

/* ── Mobile (≤480px) — PHONE OPTIMIZATION ── */
@media (max-width: 480px) {
  /* ═══ VIEWPORT & LAYOUT ═══ */
  html,
  body {
    font-size: 16px; /* Prevent zoom on input focus */
  }
  #app {
    flex-direction: column;
  }
  /* ═══ SIDEBAR — FULL SCREEN MODAL ON MOBILE ═══ */
  #sidebar {
    width: 100%;
    max-height: 50vh;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-right: none;
    border-top: 1px solid var(--border);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 25;
    overflow-y: auto;
  }
  #sidebar.expanded {
    width: 100%;
    transform: translateY(0);
  }
  /* ═══ TOPBAR ═══ */
  #topbar {
    height: 56px;
    padding: 0 12px;
    gap: 8px;
  }
  .page-title {
    font-size: 16px;
    flex: 1;
    min-width: 0;
  }
  .page-sub {
    display: none !important;
  }
  /* ═══ MAIN CONTENT ═══ */
  #main {
    overflow-y: auto;
    overflow-x: hidden;
  }
  .page {
    padding: 12px;
  }
  /* ═══ BUTTONS & TOUCH TARGETS ═══ */
  .btn,
  .quick-add-btn,
  #hamburger,
  .theme-toggle,
  .month-pill,
  .btn-primary,
  .btn-ghost,
  .btn-danger,
  .btn-green,
  .notif-bell,
  .del-btn {
    min-height: 44px; /* iOS touch target minimum */
    min-width: 44px;
    padding: 10px 16px;
  }
  .quick-add-btn {
    width: auto;
    padding: 10px 14px;
    font-size: 11px;
  }
  .btn-primary {
    width: 100%;
    padding: 14px 16px;
    font-size: 13px;
  }
  /* ═══ STAT CARDS ═══ */
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .stat-card {
    padding: 12px 14px;
  }
  .stat-val {
    font-size: 18px;
  }
  .stat-label {
    font-size: 8px;
  }
  .stat-sub {
    font-size: 9px;
  }
  /* ═══ GRIDS ═══ */
  .g2,
  .g3,
  .g21,
  .g12,
  .summary-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }
  /* ═══ CARDS ═══ */
  .card {
    padding: 12px 14px;
    border-radius: 10px;
  }
  .card-sm {
    padding: 12px 14px;
  }
  .sec-label {
    font-size: 8px;
    margin-bottom: 10px;
  }
  /* ═══ FORMS ═══ */
  .form-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .field input,
  .field select,
  .field textarea {
    padding: 12px;
    font-size: 16px; /* Prevent zoom on iOS */
    min-height: 44px;
  }
  .field input.big {
    font-size: 24px;
    padding: 12px;
  }
  .field label {
    font-size: 8px;
    margin-bottom: 6px;
  }
  /* ═══ MODALS ═══ */
  #quick-modal {
    align-items: flex-end;
  }
  #quick-modal.open,
  #csv-export-modal.open {
    display: flex !important;
  }
  .modal-box {
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 18px 14px 24px;
    max-height: 85vh;
    overflow-y: auto;
  }
  .modal-title {
    font-size: 16px;
    margin-bottom: 16px;
  }
  .modal-close {
    padding: 6px;
    font-size: 20px;
  }
  /* ═══ PIN MODAL ═══ */
  .pin-modal {
    padding: 32px 16px;
    border-radius: 16px;
  }
  .pin-header {
    margin-bottom: 24px;
  }
  .pin-title {
    font-size: 24px;
  }
  .pin-input {
    padding: 14px;
    font-size: 26px;
    letter-spacing: 6px;
  }
  .pin-submit-btn {
    padding: 12px 14px;
    font-size: 13px;
  }
  /* ═══ TRANSACTIONS ═══ */
  .tx-row {
    padding: 12px 0;
    gap: 10px;
  }
  .tx-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .tx-name {
    font-size: 12px;
  }
  .tx-meta {
    font-size: 9px;
  }
  .tx-amount {
    font-size: 13px;
  }
  /* ═══ CATEGORIES ═══ */
  .cat-row {
    padding: 10px 0;
  }
  .cat-name {
    font-size: 12px;
  }
  /* ═══ NOTIFICATIONS ═══ */
  #notif-panel {
    width: 100%;
    max-width: 100%;
    z-index: 100;
    border-left: none;
    border-top: 1px solid var(--border);
    transform: translateY(100%);
  }
  #notif-panel.open {
    transform: translateY(0);
  }
  .notif-header {
    padding: 16px;
  }
  .notif-bell {
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
  }
  .notif-perm-btn {
    padding: 12px;
    font-size: 12px;
    min-height: 44px;
  }
  /* ═══ CHARTS ═══ */
  .chart-wrap {
    height: 240px !important;
  }
  .heatmap-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
  }
  .heatmap-day {
    border-radius: 2px;
  }
  /* ═══ TABLES ═══ */
  .mom-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mom-table {
    min-width: 100%;
    font-size: 10px;
    border-collapse: collapse;
  }
  .mom-table th,
  .mom-table td {
    padding: 8px;
    font-size: 10px;
  }
  /* ═══ SCROLLABLE LISTS ═══ */
  .scroll-list {
    max-height: 300px;
    -webkit-overflow-scrolling: touch;
  }
  /* ═══ ANALYSIS BOXES ═══ */
  .verdict-box,
  .danger-box,
  .goal-box,
  .warn-box,
  .dup-banner {
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  .verdict-text {
    font-size: 12px;
    line-height: 1.6;
  }
  /* ═══ GOALS & RECURRING ═══ */
  .goal-track-item {
    padding: 12px 0;
  }
  .goal-name {
    font-size: 12px;
  }
  .goal-pct {
    font-size: 11px;
  }
  .recur-item {
    padding: 10px 0;
    gap: 10px;
  }
  .recur-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  /* ═══ TOASTS ═══ */
  #toast-container {
    left: 8px;
    right: 8px;
    bottom: 12px;
  }
  .toast {
    padding: 12px 14px;
    font-size: 12px;
    min-height: 44px;
  }
  /* ═══ PROJECTION ═══ */
  .projection-box {
    padding: 12px 14px;
  }
  .proj-row {
    font-size: 11px;
    padding: 6px 0;
  }
  /* ═══ SPACING & MARGINS ═══ */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    margin-bottom: 10px;
  }
  .sec-head {
    margin-bottom: 10px;
  }
  /* ═══ EMPTY STATE ═══ */
  .empty {
    padding: 30px 14px;
  }
  .empty-icon {
    font-size: 32px;
  }
  /* ═══ SETTINGS ═══ */
  .setting-item {
    padding: 14px 0;
  }
  .setting-header {
    gap: 12px;
  }
  .setting-title {
    font-size: 13px;
  }
  .setting-desc {
    font-size: 10px;
  }
  /* ═══ CHECKIN ═══ */
  .checkin-banner {
    padding: 12px 14px;
    gap: 12px;
    flex-direction: column;
  }
  .checkin-icon {
    font-size: 20px;
  }
  .checkin-title {
    font-size: 12px;
  }
  .checkin-sub {
    font-size: 10px;
  }
  /* ═══ HIGHLIGHT CARD ═══ */
  .highlight-card {
    padding: 12px 14px;
  }
  .highlight-val {
    font-size: 18px;
  }
  .highlight-label {
    font-size: 8px;
  }
}

/* ===== TOAST STYLE OVERRIDE - enforce consistent look ===== */
#toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 10px;
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.2px;
  box-shadow: 0 8px 24px rgba(16, 16, 32, 0.12);
  background: var(--bg3);
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text);
  animation: toastIn 180ms ease;
}
.toast.ok {
  border-color: var(--green);
  color: var(--green);
}
.toast.err {
  border-color: var(--red);
  color: var(--red);
}
.toast.inf {
  border-color: var(--accent2);
  color: var(--accent2);
}

/* small icon slot if present */
.toast svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

/* ═══ PRINT / PDF STYLES ═══ */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    overflow: visible !important;
  }
  #sidebar,
  #topbar,
  .quick-add-btn,
  .btn-primary,
  #year-pills,
  #toast-container,
  #quick-modal,
  .del-btn,
  .btn-ghost,
  .btn-danger {
    display: none !important;
  }
  #app {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }
  #main {
    overflow: visible !important;
    height: auto !important;
  }
  .page {
    display: none !important;
  }
  #page-yearly {
    display: block !important;
    padding: 0 !important;
  }
  #yearly-report {
    display: block !important;
  }
  .card {
    border: 1px solid #ddd !important;
    background: #fff !important;
    break-inside: avoid;
    margin-bottom: 16px !important;
  }
  .stat-card {
    border: 1px solid #ddd !important;
    background: #f9f9f9 !important;
  }
  .stat-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .g2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }
  .g3 {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .stat-val,
  .stat-label,
  .sec-label,
  .cat-name,
  td,
  th {
    color: #000 !important;
  }
  .mom-table th {
    background: #f0f0f0 !important;
  }
  .prog-wrap {
    background: #eee !important;
  }
  canvas {
    max-width: 100% !important;
  }
  @page {
    margin: 1.5cm;
    size: A4;
  }
}

.dup-banner {
  background: #ffc94715;
  border: 1px solid var(--yellow);
  border-radius: 10px;
  padding: 12px 16px;
}
.dup-title {
  font-size: 10px;
  color: var(--yellow);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.dup-item {
  font-size: 11px;
  color: var(--text2);
  padding: 3px 0;
  display: flex;
  gap: 8px;
}

/* ═══ YEARLY HIGHLIGHTS ═══ */
.highlight-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.highlight-label {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.highlight-val {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.highlight-sub {
  font-size: 10px;
  color: var(--text2);
}

/* ═══ NOTIFICATION PANEL ═══ */
#notif-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 95vw;
  background: var(--bg2);
  border-left: 1px solid var(--border2);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}
#notif-panel.open {
  transform: translateX(0);
}
.notif-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.notif-title {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
}
.notif-close {
  background: transparent;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
}
.notif-close:hover {
  color: var(--text);
}
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notif-list::-webkit-scrollbar {
  width: 2px;
}
.notif-list::-webkit-scrollbar-thumb {
  background: var(--border2);
}
.notif-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  position: relative;
  animation: fadeUp 0.2s ease;
}
.notif-item.unread {
  border-color: var(--accent);
}
.notif-item.unread::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.notif-type {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.notif-msg {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
}
.notif-time {
  font-size: 10px;
  color: var(--text3);
  margin-top: 5px;
}
/* NOTIFICATION COUNT */
.notif-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: var(--red);
  color: #fff;
  border-radius: 8px;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  padding: 0 3px;
}
.notif-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}
.notif-perm-btn {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.notif-perm-btn:hover {
  background: #5a38e0;
}
.notif-perm-btn.granted {
  background: var(--green2);
}
.notif-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: none;
}
.notif-backdrop.show {
  display: block;
}

/* ═══ HELP PAGE ═══ */
.help-content {
  max-width: 1200px;
}
.help-content ul {
  list-style: disc;
  padding-left: 16px;
}
.help-content li {
  padding: 4px 0;
  line-height: 1.6;
}
.help-content p {
  margin-bottom: 8px;
}
.help-content p:last-child {
  margin-bottom: 0;
}

/* ═══ PIN MODAL ═══ */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s,
    visibility 0.3s;
}
.pin-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}
.pin-modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow);
  animation: pinSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pinSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.pin-header {
  text-align: center;
  margin-bottom: 32px;
}
.pin-title {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.pin-subtitle {
  font-size: 13px;
  color: var(--text2);
}
.pin-mode-label {
  font-size: 11px;
  color: var(--accent2);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 24px;
}
.pin-input-group {
  margin-bottom: 28px;
}
.pin-input {
  width: 100%;
  padding: 18px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 32px;
  color: var(--accent);
  text-align: center;
  letter-spacing: 8px;
  transition: border-color 0.2s;
  margin-bottom: 16px;
}
.pin-input:focus {
  outline: none;
  border-color: var(--accent2);
}
.pin-input.error {
  border-color: var(--red);
  animation: shake 0.3s;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.pin-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}
.pin-dot.filled {
  background: var(--accent);
}
.pin-message {
  text-align: center;
  font-size: 12px;
  color: var(--text2);
  height: 18px;
  margin-bottom: 24px;
}
.pin-message.error {
  color: var(--red);
}
.pin-message.success {
  color: var(--green);
}
.pin-submit-btn {
  width: 100%;
  padding: 14px;
  font-size: 13px;
  font-weight: 600;
}

/* ═══ RECOVERY PHRASE ═══ */
.recovery-phrase-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
#recovery-words > div {
  font-family: var(--mono);
  user-select: all;
}

@media (max-width: 768px) {
  .pin-modal {
    padding: 36px 28px;
    border-radius: 16px;
  }
  .pin-title {
    font-size: 22px;
  }
  .pin-input {
    padding: 16px;
    font-size: 28px;
  }
}

/* ═══════════════════════════════════════════
   MONTHLY SUMMARY STYLES
═══════════════════════════════════════════ */
.summary-header {
  margin-bottom: 20px;
}

.summary-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.summary-period {
  font-size: 11px;
  color: var(--text3);
  margin: 4px 0 0 0;
  letter-spacing: 1px;
  text-transform: uppercase;
}

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

.summary-stat {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.summary-stat-label {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.summary-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.summary-details {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 20px;
}

.summary-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.summary-detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--text2);
}

.detail-value {
  color: var(--accent2);
  font-weight: 600;
}

.summary-breakdown {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.pin-submit-btn {
  padding: 12px;
  font-size: 12px;
}

/* ═══ SETTINGS PAGE ═══ */
.setting-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.setting-item:last-child {
  border-bottom: none;
}
.setting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.setting-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.setting-desc {
  font-size: 11px;
  color: var(--text3);
}
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid #ff4d6d30;
  padding: 8px 18px;
  font-size: 11px;
  transition: all 0.15s;
}
.btn-danger:hover {
  background: #ff4d6d18;
  border-color: var(--red);
}

/* ═══ ONLINE STATUS INDICATOR ═══ */
#online-status { font-size: 12px; font-weight: 700; letter-spacing: 1px; }
#online-status.is-online  { color: #22c55e; animation: blink-status 1.4s ease-in-out infinite; }
#online-status.is-offline { color: #ef4444; animation: blink-status 1.4s ease-in-out infinite; }
@keyframes blink-status {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}