* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  background: #f4f5f7;
  color: #1f2430;
}
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}
nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  background: #22304a;
  padding: 0.75rem 1.5rem;
}
nav a {
  color: #cfd8ea;
  text-decoration: none;
  font-weight: 600;
}
nav a.active { color: #ffffff; }
nav .nav-user { margin-left: auto; color: #9fb0cc; }
nav button {
  background: transparent;
  border: 1px solid #5a6c8c;
  color: #cfd8ea;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}
.login-card {
  max-width: 360px;
  margin: 4rem auto;
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
form { display: flex; flex-direction: column; gap: 0.6rem; }
label { font-weight: 600; font-size: 0.9rem; }
input, select {
  padding: 0.5rem;
  border: 1px solid #c7cede;
  border-radius: 4px;
  font-size: 1rem;
}
button[type="submit"], .save-btn {
  background: #2c6fdb;
  color: #fff;
  border: none;
  padding: 0.6rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}
.error {
  background: #fde2e2;
  color: #9c1c1c;
  padding: 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}
.banner-danger {
  background: #fde2e2;
  color: #9c1c1c;
  padding: 0.75rem;
  border-radius: 4px;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.badges { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.badge {
  background: #fff;
  border: 1px solid #dde2ee;
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 140px;
}
.badge-danger { border-color: #e6a5a5; background: #fdecec; }
.badge-alert { color: #9c1c1c; font-size: 0.8rem; font-weight: 600; }
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid #e1e5ee; }
.filters { display: flex; gap: 1rem; align-items: flex-end; margin-bottom: 1rem; flex-wrap: wrap; }
.filters label { display: block; margin-bottom: 0.2rem; }
ul#expense-list { list-style: none; padding: 0; }
ul#expense-list li {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e1e5ee;
}
.threshold-row { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.6rem; }
.threshold-row label { min-width: 160px; }
.chart-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.chart-label {
  min-width: 110px;
  max-width: 110px;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.chart-bar-track {
  flex: 1;
  background: #e9ecf3;
  border-radius: 4px;
  height: 1rem;
  overflow: hidden;
}
.chart-bar {
  background: #2c6fdb;
  height: 100%;
  border-radius: 4px;
}
.chart-value { min-width: 90px; text-align: right; font-size: 0.9rem; }
.chart-empty { color: #6b7280; font-size: 0.9rem; }

.gain { color: #1a7f37; font-weight: 600; }
.loss { color: #9c1c1c; font-weight: 600; }
.investment-card {
  background: #fff;
  border: 1px solid #dde2ee;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.investment-header {
  display: flex;
  justify-content: space-between;
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}
.investment-figures {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.investment-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.investment-actions input { width: auto; flex: 1; min-width: 100px; }
.investment-history {
  margin-top: 0.5rem;
  border-top: 1px solid #e1e5ee;
  padding-top: 0.5rem;
}
.history-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}
.review-title {
  text-align: center;
  margin: 0.6rem 0 1rem;
}
.review-slide {
  background: rgba(128, 128, 128, 0.07);
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 1rem;
  padding: 1.1rem 1rem;
  margin: 0.8rem 0;
  text-align: center;
}
.review-slide:empty { display: none; }
.review-pair {
  display: flex;
  justify-content: space-evenly;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.review-big { font-size: 2rem; font-weight: 800; }
.review-mid { font-size: 1.5rem; font-weight: 700; }
.review-label { font-size: 0.85rem; opacity: 0.8; margin-top: 0.25rem; }
.review-sub { font-size: 0.9rem; margin: 0.5rem 0 0; }
.review-cat-row {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  padding: 0.3rem 0.6rem;
}
.review-grades { display: flex; justify-content: space-evenly; margin-top: 0.5rem; }
.review-grade-cell { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.review-grade { font-size: 1.6rem; font-weight: 800; }
.crore-bar-link {
  display: block;
  text-decoration: none;
  color: inherit;
  background: rgba(128, 128, 128, 0.08);
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 0.8rem;
  padding: 0.7rem 0.9rem;
  margin: 0.6rem 0;
}
.crore-bar-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.85rem;
}
.crore-bar {
  height: 0.7rem;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.25);
  overflow: hidden;
  margin-top: 0.45rem;
}
.crore-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16A34A, #EAB308);
  min-width: 2px;
}
.crore-bar-sub {
  font-size: 0.75rem;
  opacity: 0.75;
  margin-top: 0.3rem;
}
.report-grade {
  font-size: 1.3rem;
  font-weight: 700;
  min-width: 1.6rem;
  text-align: center;
}
.confetti-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}
.confetti-piece {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: 0.7; }
}
.milestone-banner {
  position: fixed;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 24rem);
  background: #16A34A;
  color: #fff;
  padding: 0.9rem 1.2rem;
  border-radius: 0.8rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  text-align: center;
  font-size: 0.95rem;
  z-index: 1000;
  cursor: pointer;
}
.whatif {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(128, 128, 128, 0.35);
  font-size: 0.85rem;
}
.whatif input[type="range"] {
  width: 100%;
  margin: 0.35rem 0;
}
#amfi-update-btn {
  display: block;
  clear: both;
  margin: 1.4rem 0 0.6rem;
}
.ask-answer {
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.4);
  border-radius: 0.6rem;
  padding: 0.7rem 0.9rem;
  margin: 0.5rem 0 0.9rem;
  font-size: 0.95rem;
}
#ask-input {
  width: 100%;
  margin-bottom: 0.4rem;
}
.trend-cat {
  margin: 0.8rem 0;
}
.wealth-inline-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
}
.wealth-inline-form input {
  width: 6.5rem;
}
.bal-summary {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 2px solid rgba(128, 128, 128, 0.35);
  font-size: 0.95rem;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.goal-card {
  background: #fff;
  border: 1px solid #dde2ee;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}
.goal-figures {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.goal-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.goal-actions input { width: auto; flex: 1; min-width: 100px; }
.goal-history {
  margin-top: 0.5rem;
  border-top: 1px solid #e1e5ee;
  padding-top: 0.5rem;
}

.income-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e1e5ee;
  flex-wrap: wrap;
}
.gift-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e1e5ee;
  flex-wrap: wrap;
}
.gift-dir {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.dir-given { background: #fde2e2; color: #9c1c1c; }
.dir-received { background: #e6f4ea; color: #1a7f37; }
.gift-name { font-weight: 600; }
.gift-value { margin-left: auto; }
#gold-fields { display: flex; flex-direction: column; gap: 0.6rem; }
#gold-fields[hidden] { display: none; }

/* ---------- Liquid Glass rings ---------- */
.liquid-orb { overflow: visible; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.22)); }
.orb-back { fill: rgba(128, 128, 128, 0.10); }
.orb-glass { pointer-events: none; }
.orb-rim { fill: none; stroke-width: 2.5; opacity: 0.85; }
.orb-shine { fill: rgba(255, 255, 255, 0.5); filter: blur(3px); pointer-events: none; }
.orb-shimmer {
  fill: none;
  stroke: rgba(212, 175, 55, 0.55);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 42 400;
  transform-origin: 72px 72px;
  animation: orb-spin 7s linear infinite;
}
.liquid {
  transform: translateY(146px);
  animation: liquid-rise 1.1s cubic-bezier(0.25, 0.9, 0.35, 1) forwards;
}
.wave { animation: wave-drift 5.5s linear infinite; }
.wave-back { animation-duration: 8.5s; animation-direction: reverse; }
.bubble { fill: rgba(255, 255, 255, 0.65); stroke: rgba(255, 255, 255, 0.35); stroke-width: 0.5; opacity: 0; animation: bubble-rise 9s linear infinite; }
.bubble.b2 { animation-delay: 3s; animation-duration: 11s; }
.bubble.b3 { animation-delay: 6s; animation-duration: 8s; }
@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes wave-drift { to { transform: translateX(-152px); } }
@keyframes liquid-rise { to { transform: translateY(var(--level)); } }
/* born at the orb's floor, drifting slowly up through the water to the surface */
@keyframes bubble-rise {
  0% { opacity: 0; transform: translate(0, 96px); }
  12% { opacity: 0.75; }
  40% { transform: translate(3px, 58px); }
  70% { transform: translate(-3px, 26px); }
  92% { opacity: 0.6; }
  100% { opacity: 0; transform: translate(1px, 2px); }
}
/* the orb reacts to touch like a physical object */
.inv-ringbtn:active .liquid-orb, .goal-ring:active .liquid-orb { transform: scale(0.96); filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3)) brightness(1.06); }
.liquid-orb { transition: transform 0.15s ease, filter 0.15s ease; }
/* frosted chip keeps the centre numbers readable above the water */
.inv-ring:has(.liquid-orb) .inv-ring-mid > *,
.goal-ring:has(.liquid-orb) .pct > * {
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.75), 0 0 8px rgba(255, 255, 255, 0.55);
}
[data-theme="dark"] .inv-ring:has(.liquid-orb) .inv-ring-mid > *,
[data-theme="dark"] .goal-ring:has(.liquid-orb) .pct > * {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 0, 0, 0.6);
}
@media (prefers-reduced-motion: reduce) {
  .wave, .orb-shimmer, .bubble { animation: none; }
  .liquid { animation: none; transform: translateY(var(--level)); }
}

/* liquid orbs are physical objects — never rotated like stroke rings */
.inv-ring svg.liquid-orb, .goal-ring svg.liquid-orb, .gift-sum-ring svg.liquid-orb { transform: none; }
.inv-ringbtn:active .liquid-orb, .goal-ring:active .liquid-orb { transform: scale(0.96); }

/* hand-blown glass: milky swirls drifting slowly inside the colour */
.glass-swirl { animation: swirl-drift 16s ease-in-out infinite alternate; }
@keyframes swirl-drift {
  from { transform: translate(-10px, 0) rotate(-2deg); }
  to { transform: translate(10px, 3px) rotate(2deg); }
}
.orb-sheen { pointer-events: none; mix-blend-mode: screen; }
@media (prefers-reduced-motion: reduce) {
  .glass-swirl { animation: none; }
}

/* printable month review: clean paper output */
@media print {
  nav, .filters, #print-btn, .no-print { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .review-slide { border: 1px solid #ccc; break-inside: avoid; background: #fff; }
  main { max-width: none; padding: 0; }
}
