* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --acc: #059669;
  --acc2: #34d399;
  --acc-light: #d1fae5;
  --bg: #f0f4f8;
  --surface: rgba(255, 255, 255, 0.75);
  --surface2: rgba(255, 255, 255, 0.44);
  --surface3: rgba(255, 255, 255, 0.22);
  --border: rgba(255, 255, 255, 0.85);
  --border2: rgba(0, 0, 0, 0.08);
  --text: #111827;
  --text2: #6b7280;
  --text3: #9ca3af;
  --red: #dc2626;
  --red-l: #fee2e2;
  --amber: #d97706;
  --amber-l: #fef3c7;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.05);
  --r: 12px;
  --r-sm: 8px;
  --r-xs: 6px;
}

.dark {
  --bg: #0d1117;
  --surface: rgba(255, 255, 255, 0.06);
  --surface2: rgba(255, 255, 255, 0.03);
  --surface3: rgba(255, 255, 255, 0.02);
  --border: rgba(255, 255, 255, 0.1);
  --border2: rgba(255, 255, 255, 0.06);
  --text: #f0f6fc;
  --text2: #8b949e;
  --text3: #484f58;
  --red: #f87171;
  --red-l: rgba(248, 113, 113, 0.12);
  --amber: #fbbf24;
  --amber-l: rgba(251, 191, 36, 0.12);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
}

body.th-ocean {
  --acc: #0ea5e9;
  --acc2: #38bdf8;
  --acc-light: #e0f2fe;
}

body.th-ocean.dark {
  --acc: #38bdf8;
  --acc-light: rgba(14, 165, 233, 0.15);
}

body.th-purple {
  --acc: #7c3aed;
  --acc2: #a78bfa;
  --acc-light: #ede9fe;
}

body.th-purple.dark {
  --acc: #a78bfa;
  --acc-light: rgba(124, 58, 237, 0.15);
}

body.th-rose {
  --acc: #e11d48;
  --acc2: #fb7185;
  --acc-light: #ffe4e6;
}

body.th-rose.dark {
  --acc: #fb7185;
  --acc-light: rgba(225, 29, 72, 0.15);
}

body.th-amber {
  --acc: #d97706;
  --acc2: #fbbf24;
  --acc-light: #fef3c7;
}

body.th-amber.dark {
  --acc: #fbbf24;
  --acc-light: rgba(217, 119, 6, 0.15);
}

body.th-teal {
  --acc: #0d9488;
  --acc2: #2dd4bf;
  --acc-light: #ccfbf1;
}

body.th-teal.dark {
  --acc: #2dd4bf;
  --acc-light: rgba(13, 148, 136, 0.15);
}

html,
body {
  min-height: 100vh;
  background: var(--bg);
  transition: background .35s;
}

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}

#lockscreen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

#lockscreen.hidden {
  display: none;
}

.lock-box {
  width: 100%;
  max-width: 360px;
}

.lock-logo {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 6px;
}

.lock-logo em {
  color: var(--acc);
  font-style: normal;
}

.lock-sub {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 2rem;
  line-height: 1.5;
}

.lock-step {
  animation: fadeUp .3s ease;
}

.lock-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .04em;
  margin-bottom: 6px;
}

.lock-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  transition: border .2s;
  margin-bottom: 10px;
}

.lock-input:focus {
  border-color: var(--acc);
}

.pin-dots {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 1.5rem 0 1rem;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text3);
  transition: all .2s;
}

.pin-dot.filled {
  background: var(--acc);
  border-color: var(--acc);
  transform: scale(1.1);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 1rem;
}

.pin-key {
  padding: 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 18px;
  font-weight: 500;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  text-align: center;
  color: var(--text);
  transition: all .15s;
  box-shadow: var(--shadow);
}

.pin-key:active {
  transform: scale(.94);
  background: var(--acc);
  color: #fff;
}

.pin-key.del {
  font-size: 14px;
}

.lock-btn {
  width: 100%;
  padding: 12px;
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 8px;
}

.lock-btn:hover {
  opacity: .88;
}

.lock-btn.outline {
  background: transparent;
  color: var(--text2);
  border: 0.5px solid var(--border);
}

.lock-err {
  font-size: 12px;
  color: var(--red);
  text-align: center;
  min-height: 18px;
  margin-bottom: 6px;
}

.lock-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--acc-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--acc);
  margin-bottom: 1rem;
}

#pwa-banner {
  display: none;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  align-items: center;
  gap: 12px;
}

#pwa-banner.show {
  display: flex;
}

.pwa-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.pwa-text {
  flex: 1;
}

.pwa-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.pwa-sub {
  font-size: 11px;
  color: var(--text2);
}

.pwa-btn {
  padding: 6px 12px;
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}

.pwa-dismiss {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 16px;
  padding: 2px;
}

/* SYNC BAR */
#sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 10px;
}

#sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
  transition: background .3s;
}

#sync-dot.ok {
  background: #22c55e;
}

#sync-dot.syncing {
  background: var(--amber);
  animation: pulse 1s infinite;
}

#sync-dot.err {
  background: var(--red);
}

#sync-msg {
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
}

.sync-stat {
  font-size: 10.5px;
  color: var(--text3);
  font-weight: 500;
  white-space: nowrap;
}

.sync-divider {
  color: var(--text3);
  font-size: 10px;
}

#sync-countdown {
  color: var(--acc);
  font-weight: 600;
}

#sync-lasttime {
  color: var(--text3);
}

@media(max-width:480px) {
  #sync-lasttime {
    display: none;
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .35;
  }
}

.app {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.25rem 1rem 5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--acc-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--acc);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .2s;
}

.user-avatar:hover {
  transform: scale(1.08);
}

.logo {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.5px;
  color: var(--text);
}

.logo em {
  color: var(--acc);
  font-style: normal;
}

.logo small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text3);
  margin-left: 4px;
}

.topbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.icon-btn {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text2);
  backdrop-filter: blur(10px);
  transition: all .2s;
  white-space: nowrap;
}

.icon-btn:hover {
  color: var(--text);
}

.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface2);
  backdrop-filter: blur(16px);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 3px;
  margin-bottom: 1.5rem;
}

.tab {
  flex: 1;
  padding: 7px 2px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  color: var(--text2);
  transition: all .2s;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow);
}

.sec {
  display: none;
}

.sec.active {
  display: block;
  animation: fadeUp .28s cubic-bezier(.22, 1, .36, 1);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .75rem;
}

.sec-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 1rem;
}

.metric {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 14px 12px;
  box-shadow: var(--shadow);
  transition: transform .2s;
}

.metric:hover {
  transform: translateY(-2px);
}

.mlabel {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 4px;
}

.mval {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  letter-spacing: -.5px;
}

.mval.acc {
  color: var(--acc);
}

.mval.red {
  color: var(--red);
}

.mval.amber {
  color: var(--amber);
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--text2);
}

.leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 60px;
  padding-top: 8px;
}

.trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.trend-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: var(--acc);
  opacity: .55;
  transition: all .4s cubic-bezier(.22, 1, .36, 1);
  min-height: 2px;
}

.trend-bar:hover {
  opacity: 1;
}

.trend-bar.today {
  opacity: 1;
}

.exp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  animation: fadeUp .22s ease;
  transition: all .2s;
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.exp-item:hover {
  transform: translateX(2px);
}

.exp-item.swipe-out {
  transform: translateX(-100%);
  opacity: 0;
  transition: all .25s ease;
}

.swipe-bg {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 70px;
  background: var(--red-l);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  opacity: 0;
  transition: opacity .15s;
}

.exp-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.exp-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.exp-sub {
  font-size: 11px;
  color: var(--text2);
}

.exp-amt {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-family: 'DM Mono', monospace;
}

.btn-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 16px;
  padding: 2px 5px;
  border-radius: 4px;
  transition: color .15s;
  line-height: 1;
}

.btn-del:hover {
  color: var(--red);
}

.empty {
  text-align: center;
  padding: 2rem;
  color: var(--text2);
  font-size: 13px;
}

.search-wrap {
  position: relative;
  margin-bottom: 10px;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border .2s;
  backdrop-filter: blur(10px);
}

.search-input:focus {
  border-color: var(--acc);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 14px;
  pointer-events: none;
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chip {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface2);
  border: 0.5px solid var(--border);
  color: var(--text2);
  transition: all .18s;
}

.chip.active {
  background: var(--acc);
  border-color: var(--acc);
  color: #fff;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.fg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fg label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
}

.fg input,
.fg select {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  background: var(--surface2);
  border: 0.5px solid var(--border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  outline: none;
  transition: border .2s;
}

.fg input:focus,
.fg select:focus {
  border-color: var(--acc);
}

.fg select option {
  background: var(--bg);
  color: var(--text);
}

.btn-acc {
  width: 100%;
  padding: 11px;
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all .2s;
  margin-top: 4px;
}

.btn-acc:hover {
  opacity: .88;
}

.btn-acc:active {
  transform: scale(.99);
}

.budget-item {
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.budget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.budget-cat {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.budget-amounts {
  font-size: 11px;
  color: var(--text2);
  font-family: 'DM Mono', monospace;
}

.budget-bar-bg {
  height: 5px;
  background: var(--surface3);
  border-radius: 99px;
  overflow: hidden;
}

.budget-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .6s cubic-bezier(.22, 1, .36, 1);
}

.alert-banner {
  background: var(--red-l);
  border: 0.5px solid var(--red);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--red);
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-nav {
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-xs);
  padding: 5px 12px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day-label {
  font-size: 10px;
  color: var(--text3);
  text-align: center;
  padding: 3px 0;
  font-weight: 600;
}

.cal-day {
  min-height: 36px;
  border-radius: var(--r-xs);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text2);
  cursor: default;
  transition: all .15s;
  padding: 2px;
}

.cal-day.has-exp {
  background: var(--surface);
  border: 0.5px solid var(--border);
  cursor: pointer;
  color: var(--text);
  font-weight: 500;
}

.cal-day.has-exp:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow);
}

.cal-day.today {
  border: 1.5px solid var(--acc) !important;
  color: var(--acc);
  font-weight: 600;
}

.cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--acc);
  margin-top: 1px;
}

.cal-amt {
  font-size: 9px;
  color: var(--acc);
  font-family: 'DM Mono', monospace;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.theme-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .2s;
  position: relative;
}

.theme-swatch.active {
  border-color: var(--text);
  transform: scale(1.12);
}

.theme-swatch::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  opacity: 0;
  font-weight: 700;
}

.theme-swatch.active::after {
  opacity: 1;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border: 0.5px solid var(--border2);
  border-radius: 99px;
  transition: all .25s;
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text3);
  transition: all .25s;
}

.toggle input:checked+.toggle-slider {
  background: var(--acc);
  border-color: var(--acc);
}

.toggle input:checked+.toggle-slider::before {
  transform: translateX(18px);
  background: #fff;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  z-index: 10000;
  transition: transform .3s cubic-bezier(.22, 1, .36, 1), opacity .3s;
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.did-box {
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.did-label {
  font-size: 10px;
  color: var(--text3);
  margin-bottom: 3px;
  font-weight: 600;
  letter-spacing: .04em;
}

.did-val {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--text);
  word-break: break-all;
  line-height: 1.5;
}

/* ── AVATAR PHOTO ── */
.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.profile-avatar-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  cursor: pointer;
}

.profile-avatar-wrap .av-edit {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: var(--acc);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #fff;
  border: 2px solid var(--bg);
}

.topbar-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ── AVATAR MODAL ── */
#avatar-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 6000;
  align-items: flex-end;
  justify-content: center;
}

#avatar-modal.show {
  display: flex;
}

.avatar-sheet {
  background: var(--bg);
  border-radius: var(--r) var(--r) 0 0;
  padding: 1.5rem 1.25rem 2.5rem;
  width: 100%;
  max-width: 480px;
  animation: slideUp .3s cubic-bezier(.22, 1, .36, 1);
}

.avatar-sheet-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 1rem;
}

.preset-av {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: all .18s;
  background: var(--surface2);
}

.preset-av:hover {
  transform: scale(1.1);
}

.preset-av.selected {
  border-color: var(--acc);
  transform: scale(1.12);
}

.upload-zone {
  border: 1.5px dashed var(--border2);
  border-radius: var(--r-sm);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 10px;
}

.upload-zone:hover {
  border-color: var(--acc);
  background: var(--acc-light);
}

.upload-zone-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.upload-zone-text {
  font-size: 12px;
  color: var(--text2);
}

/* ── SOUND TOGGLE ── */
.sound-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.sound-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.sound-sub {
  font-size: 11px;
  color: var(--text2);
}

/* ════ MOBILE RESPONSIVE ════ */

/* Small phones: 320px–480px */
@media(max-width:480px) {
  .app {
    padding: 0.75rem 0.65rem 6rem;
  }

  /* Topbar */
  .topbar {
    margin-bottom: 1rem;
  }

  .logo {
    font-size: 17px;
  }

  .logo small {
    display: none;
  }

  .icon-btn {
    padding: 5px 7px;
    font-size: 11px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  /* Tabs — bottom nav on mobile */
  .tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    border-radius: 0;
    border-bottom: none;
    padding: 6px 4px env(safe-area-inset-bottom, 8px);
    background: var(--bg);
    border-top: 0.5px solid var(--border2);
    backdrop-filter: blur(20px);
    gap: 0;
  }

  .tab {
    font-size: 9.5px;
    padding: 6px 2px;
    border-radius: 6px;
  }

  .tab.active {
    box-shadow: none;
  }

  /* Metrics */
  .metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .metric {
    padding: 10px 8px;
  }

  .mlabel {
    font-size: 9.5px;
  }

  .mval {
    font-size: 17px;
  }

  /* Charts */
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Cards */
  .card {
    padding: 0.9rem;
    border-radius: 10px;
  }

  .card-title {
    font-size: 12.5px;
  }

  /* Forms */
  .form-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .fg input,
  .fg select {
    font-size: 14px;
    padding: 10px 10px;
  }

  /* Expense list */
  .exp-name {
    font-size: 12.5px;
  }

  .exp-sub {
    font-size: 10.5px;
  }

  .exp-amt {
    font-size: 13px;
  }

  .exp-icon {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }


  /* Calendar */
  .cal-day {
    min-height: 30px;
    font-size: 10px;
  }

  .cal-day-label {
    font-size: 9px;
  }

  .cal-amt {
    font-size: 8px;
  }


  /* PIN pad — bigger tap targets */
  .pin-key {
    padding: 16px;
    font-size: 20px;
  }

  .lock-box {
    padding: 0 0.25rem;
  }

  /* Topbar buttons — hide text, keep icons on tiny screens */
  .icon-btn .btn-text {
    display: none;
  }

  /* Sync bar */
  #sync-bar {
    font-size: 10px;
    padding: 6px 10px;
  }

  /* Avatar modal */
  .avatar-sheet {
    padding: 1.25rem 1rem 2rem;
  }

  .preset-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .preset-av {
    font-size: 20px;
  }

  /* Toast */
  .toast {
    font-size: 12px;
    padding: 9px 16px;
    bottom: 80px;
  }

  /* Share sheet */

  /* Theme grid */
  .theme-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  /* Budget */
  .budget-amounts {
    font-size: 10px;
  }

  /* Filter chips */
  .chip {
    font-size: 10.5px;
    padding: 4px 9px;
  }

  /* Search */
  .search-input {
    font-size: 14px;
  }
}

/* Medium phones: 481px–600px */
@media(min-width:481px) and (max-width:600px) {
  .app {
    padding: 1rem 0.85rem 5.5rem;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    border-radius: 0;
    padding: 6px 6px env(safe-area-inset-bottom, 8px);
    background: var(--bg);
    border-top: 0.5px solid var(--border2);
    backdrop-filter: blur(20px);
  }

  .toast {
    bottom: 80px;
  }
}

/* Tablets: 601px–768px */
@media(min-width:601px) and (max-width:768px) {
  .app {
    padding: 1.1rem 1.2rem 5rem;
  }

  .charts-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop: 769px+ — already looks good, just ensure max-width */
@media(min-width:769px) {
  .app {
    padding: 1.5rem 1.25rem 5rem;
  }

  .tabs {
    position: static;
    border-radius: var(--r);
  }
}

/* Safe area for iPhone notch/home bar */
@supports(padding-bottom:env(safe-area-inset-bottom)) {
  .tabs {
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }
}

/* Touch — remove hover effects on mobile */
@media(hover:none) {
  .metric:hover {
    transform: none;
  }

  .exp-item:hover {
    transform: none;
  }

  .cal-day.has-exp:hover {
    transform: none;
  }

  .icon-btn:hover {
    color: var(--text2);
  }
}

/* Landscape phone */
@media(max-width:768px) and (orientation:landscape) {
  .app {
    padding: 0.6rem 1rem 4.5rem;
  }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .pin-key {
    padding: 10px;
  }

  .lock-box {
    max-width: 420px;
  }
}

/* ════ CLOCK + WEATHER WIDGET ════ */
.hw-widget {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border-radius: var(--r);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
}

.hw-widget::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.hw-widget::after {
  content: '';
  position: absolute;
  bottom: -40px;
  right: 60px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.hw-left {
  flex: 1;
}

.hw-time {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  font-family: 'DM Mono', monospace;
  letter-spacing: -1px;
  line-height: 1;
}

.hw-date {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 3px;
  font-weight: 500;
}

.hw-day {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

.hw-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.hw-weather-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
}

.hw-temp {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  font-family: 'DM Mono', monospace;
  line-height: 1;
}

.hw-icon {
  font-size: 32px;
  line-height: 1;
}

.hw-desc {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
  text-align: right;
  font-weight: 500;
  text-transform: capitalize;
}

.hw-city {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65);
  text-align: right;
}

.hw-feels {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65);
  text-align: right;
}

.hw-weather-err {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-align: right;
  cursor: pointer;
}

@media(max-width:480px) {
  .hw-time {
    font-size: 28px;
  }

  .hw-temp {
    font-size: 22px;
  }

  .hw-icon {
    font-size: 26px;
  }

  .hw-widget {
    padding: 0.9rem 1rem;
  }
}

/* ════ TODAY SPEND + OFFLINE BADGE ════ */
.today-spend-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--acc-light);
  border: 0.5px solid var(--acc);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: all .2s;
  min-width: 54px;
}

.today-spend-badge:hover {
  background: var(--acc);
  color: #fff;
}

.today-spend-badge:hover .today-spend-label,
.today-spend-badge:hover .today-spend-amt {
  color: #fff;
}

.today-spend-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--acc);
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1;
}

.today-spend-amt {
  font-size: 12px;
  font-weight: 700;
  color: var(--acc);
  font-family: 'DM Mono', monospace;
  line-height: 1.3;
}

.offline-badge {
  display: none;
  align-items: center;
  gap: 4px;
  background: var(--red-l);
  border: 0.5px solid var(--red);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
  animation: pulse 1.5s infinite;
}

.offline-badge.show {
  display: flex;
}

@media(max-width:480px) {
  .today-spend-badge {
    padding: 3px 7px;
    min-width: 46px;
  }

  .today-spend-amt {
    font-size: 11px;
  }

  .offline-badge {
    font-size: 10px;
    padding: 3px 6px;
  }
}

/* ════ ADMIN PANEL ════ */
.admin-header {
  text-align: center;
  margin-bottom: 1rem;
}

.admin-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.admin-sub {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 1rem;
}

.admin-stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s;
}

.admin-stat-card:hover {
  transform: translateY(-2px);
}

.admin-stat-icon {
  font-size: 24px;
  margin-bottom: 6px;
}

.admin-stat-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--acc);
  font-family: 'DM Mono', monospace;
  line-height: 1;
}

.admin-stat-label {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
  font-weight: 500;
}

.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border2);
}

.admin-user-row:last-child {
  border-bottom: none;
}

.admin-user-id {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--text2);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  font-family: 'DM Mono', monospace;
}

.admin-user-amt {
  font-size: 11px;
  color: var(--acc);
  font-weight: 600;
}

@media(max-width:480px) {
  .admin-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .admin-stat-val {
    font-size: 22px;
  }
}

/* ════ GOOGLE LOGIN ════ */
.google-btn {
  width: 100%;
  padding: 13px 16px;
  background: #fff;
  border: 1.5px solid #dadce0;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #3c4043;
  transition: all .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 10px;
}

.google-btn:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-color: #c0c0c0;
}

.google-btn:active {
  transform: scale(.98);
}

.dark .google-btn {
  background: #2d2d2d;
  border-color: #444;
  color: #e0e0e0;
}