/* ===== DESIGN TOKENS ===== */
:root {
  --bg-primary: #07071a;
  --bg-secondary: #0e0e2a;
  --bg-card: rgba(18, 18, 50, 0.7);
  --bg-card-solid: #12123280;
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-hover: rgba(255, 255, 255, 0.07);

  --text-primary: #f0f0ff;
  --text-secondary: #8888aa;
  --text-muted: #555577;

  --accent: #6366f1;
  --accent-light: #a78bfa;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a78bfa 100%);

  --positive: #22c55e;
  --positive-bg: rgba(34, 197, 94, 0.12);
  --negative: #ef4444;
  --negative-bg: rgba(239, 68, 68, 0.12);
  --neutral: #eab308;
  --neutral-bg: rgba(234, 179, 8, 0.12);

  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --nav-height: 68px;
  --header-height: 56px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== RESET ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

input,
textarea {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

ul {
  list-style: none;
}

.hidden {
  display: none !important;
}

/* ===== AUTH SCREEN ===== */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

#auth-screen {
  background: var(--bg-primary);
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#auth-screen::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 80vw;
  height: 80vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  animation: float 8s ease-in-out infinite;
}

#auth-screen::after {
  content: '';
  position: absolute;
  bottom: -30%;
  right: -20%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.1) 0%, transparent 70%);
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(30px, -20px);
  }
}

.auth-container {
  text-align: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
  max-width: 360px;
}

.auth-logo {
  position: relative;
  display: inline-block;
  margin-bottom: 1.5rem;
}

.logo-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: var(--accent-glow);
  filter: blur(20px);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.logo-icon {
  width: 72px;
  height: 72px;
  position: relative;
}

.auth-title {
  font-size: 2rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.8rem;
  background: #fff;
  color: #333;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
}

.btn-google:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-google:active {
  transform: translateY(0);
}

.auth-privacy {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== APP LAYOUT ===== */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 1rem;
  background: rgba(7, 7, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.avatar-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent);
  padding: 0;
}

.avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== APP MAIN ===== */
.app-main {
  flex: 1;
  padding-bottom: var(--nav-height);
  overflow-y: auto;
}

.view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== TODAY VIEW ===== */
.today-container {
  padding: 1.5rem 1rem;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.today-date-display {
  text-align: center;
  margin-bottom: 1rem;
}

.today-weekday {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-light);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.today-date-text {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.total-balance-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
}

.balance-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.balance-value {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.balance-value.positive {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  -webkit-background-clip: text;
  background-clip: text;
}

.balance-value.negative {
  background: linear-gradient(135deg, #ef4444, #f87171);
  -webkit-background-clip: text;
  background-clip: text;
}

.rating-section {
  width: 100%;
  margin-bottom: 1.5rem;
}

.rating-prompt {
  text-align: center;
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-weight: 500;
}

/* Two-row layout: negatives on top, zero+positives on bottom */
.rating-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.rating-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.rating-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  color: var(--text-secondary);
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
  min-height: 48px;
  min-width: 48px;
  flex: 1;
  max-width: 64px;
  user-select: none;
  -webkit-user-select: none;
}

/* Tinted backgrounds per rating value */
.rating-btn[data-rating="-5"] {
  background: hsla(0, 70%, 45%, 0.15);
}

.rating-btn[data-rating="-4"] {
  background: hsla(5, 65%, 48%, 0.13);
}

.rating-btn[data-rating="-3"] {
  background: hsla(15, 60%, 50%, 0.11);
}

.rating-btn[data-rating="-2"] {
  background: hsla(25, 55%, 52%, 0.10);
}

.rating-btn[data-rating="-1"] {
  background: hsla(35, 50%, 54%, 0.09);
}

.rating-btn[data-rating="0"] {
  background: hsla(48, 85%, 50%, 0.10);
}

.rating-btn[data-rating="1"] {
  background: hsla(100, 40%, 48%, 0.09);
}

.rating-btn[data-rating="2"] {
  background: hsla(120, 45%, 45%, 0.10);
}

.rating-btn[data-rating="3"] {
  background: hsla(135, 50%, 42%, 0.11);
}

.rating-btn[data-rating="4"] {
  background: hsla(145, 55%, 40%, 0.13);
}

.rating-btn[data-rating="5"] {
  background: hsla(150, 65%, 38%, 0.15);
}

.rating-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.rating-btn:active {
  transform: scale(0.93);
}

/* ── Selected state: bold ring + background fill, no translate ── */
.rating-btn.selected {
  color: #fff;
  font-size: 1rem;
}

.rating-btn[data-rating="-5"].selected {
  background: hsla(0, 70%, 50%, 0.85);
  border-color: hsl(0, 75%, 60%);
  box-shadow: 0 0 16px hsla(0, 70%, 50%, 0.4);
}

.rating-btn[data-rating="-4"].selected {
  background: hsla(5, 65%, 52%, 0.80);
  border-color: hsl(5, 70%, 62%);
  box-shadow: 0 0 14px hsla(5, 65%, 52%, 0.35);
}

.rating-btn[data-rating="-3"].selected {
  background: hsla(15, 60%, 54%, 0.75);
  border-color: hsl(15, 65%, 64%);
  box-shadow: 0 0 14px hsla(15, 60%, 54%, 0.3);
}

.rating-btn[data-rating="-2"].selected {
  background: hsla(25, 55%, 55%, 0.70);
  border-color: hsl(25, 60%, 65%);
  box-shadow: 0 0 12px hsla(25, 55%, 55%, 0.3);
}

.rating-btn[data-rating="-1"].selected {
  background: hsla(35, 50%, 56%, 0.65);
  border-color: hsl(35, 55%, 66%);
  box-shadow: 0 0 12px hsla(35, 50%, 56%, 0.25);
}

.rating-btn[data-rating="0"].selected {
  background: hsla(48, 85%, 50%, 0.70);
  border-color: hsl(48, 90%, 60%);
  box-shadow: 0 0 14px hsla(48, 85%, 50%, 0.35);
}

.rating-btn[data-rating="1"].selected {
  background: hsla(100, 45%, 45%, 0.65);
  border-color: hsl(100, 50%, 55%);
  box-shadow: 0 0 12px hsla(100, 45%, 45%, 0.25);
}

.rating-btn[data-rating="2"].selected {
  background: hsla(120, 50%, 42%, 0.70);
  border-color: hsl(120, 55%, 52%);
  box-shadow: 0 0 12px hsla(120, 50%, 42%, 0.3);
}

.rating-btn[data-rating="3"].selected {
  background: hsla(135, 55%, 40%, 0.75);
  border-color: hsl(135, 60%, 50%);
  box-shadow: 0 0 14px hsla(135, 55%, 40%, 0.3);
}

.rating-btn[data-rating="4"].selected {
  background: hsla(145, 60%, 38%, 0.80);
  border-color: hsl(145, 65%, 48%);
  box-shadow: 0 0 14px hsla(145, 60%, 38%, 0.35);
}

.rating-btn[data-rating="5"].selected {
  background: hsla(150, 70%, 36%, 0.85);
  border-color: hsl(150, 75%, 46%);
  box-shadow: 0 0 16px hsla(150, 70%, 36%, 0.4);
}

/* ===== NOTE SECTION ===== */
.note-section {
  width: 100%;
  margin-bottom: 0.75rem;
}

.note-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.note-optional {
  color: var(--text-muted);
  font-weight: 400;
}

.note-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  resize: none;
  transition: border-color 0.15s;
  outline: none;
}

.note-input:focus {
  border-color: var(--accent);
}

.note-input::placeholder {
  color: var(--text-muted);
}

.btn-save-note {
  margin-top: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all 0.15s;
}

.btn-save-note:hover {
  background: var(--accent-light);
}

/* Save Indicator */
.save-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--positive);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  background: var(--positive-bg);
  border-radius: var(--radius-full);
  animation: pop 0.3s ease;
}

@keyframes pop {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Missed Days */
.missed-days-prompt {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-missed {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-glass);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.82rem;
  transition: all 0.15s;
  text-align: left;
}

.btn-missed:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(7, 7, 26, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
  letter-spacing: 0.02em;
}

.nav-btn:hover {
  color: var(--text-secondary);
}

.nav-btn.active {
  color: var(--accent-light);
}

.nav-btn.active svg {
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

/* ===== DASHBOARD ===== */
.dashboard-container {
  padding: 1.25rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.metric-card {
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}

.metric-card-wide {
  grid-column: 1 / -1;
}

.metric-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
}

.trend-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.trend-icon {
  font-size: 1.4rem;
}

.trend-label {
  font-size: 1rem;
  font-weight: 700;
}

.trend-value {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.trend-improving .trend-icon,
.trend-improving .trend-label {
  color: var(--positive);
}

.trend-declining .trend-icon,
.trend-declining .trend-label {
  color: var(--negative);
}

.trend-stable .trend-icon,
.trend-stable .trend-label {
  color: var(--neutral);
}

/* ===== CHARTS ===== */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.chart-wrapper {
  position: relative;
  height: 200px;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ===== RECOMMENDATIONS ===== */
.reco-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.reco-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.reco-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.reco-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 400px) {
  .reco-columns {
    grid-template-columns: 1fr;
  }
}

.reco-col-title {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.reco-good .reco-col-title {
  color: var(--positive);
}

.reco-bad .reco-col-title {
  color: var(--negative);
}

.reco-list li {
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.reco-good .reco-list li:not(.reco-empty) {
  background: var(--positive-bg);
  color: var(--positive);
}

.reco-bad .reco-list li:not(.reco-empty) {
  background: var(--negative-bg);
  color: var(--negative);
}

.reco-empty {
  color: var(--text-muted) !important;
  font-style: italic;
  background: none !important;
}

.reco-list .reco-avg {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-left: 0.25rem;
}

/* ===== HISTORY ===== */
.history-container {
  padding: 1.25rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.history-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.history-view-toggle {
  display: flex;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.toggle-btn {
  padding: 0.35rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
  border-radius: var(--radius-full);
}

.toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.history-item:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.history-item-rating {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.history-item-rating.pos {
  background: var(--positive-bg);
  color: var(--positive);
}

.history-item-rating.neg {
  background: var(--negative-bg);
  color: var(--negative);
}

.history-item-rating.zero {
  background: var(--neutral-bg);
  color: var(--neutral);
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-date {
  font-size: 0.85rem;
  font-weight: 600;
}

.history-item-reason {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-edit {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* History Calendar */
.history-calendar {
  /* Will be rendered by JS */
}

.cal-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.cal-month-title {
  font-size: 1rem;
  font-weight: 700;
}

.cal-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.cal-nav-btn:hover {
  background: var(--bg-hover);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.cal-weekday {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.25rem 0;
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s;
  position: relative;
  border: 1px solid transparent;
}

.cal-day.empty {
  cursor: default;
}

.cal-day.has-rating {
  color: #fff;
  font-weight: 700;
}

.cal-day.has-rating.pos {
  background: var(--positive-bg);
  color: var(--positive);
  border-color: rgba(34, 197, 94, 0.2);
}

.cal-day.has-rating.neg {
  background: var(--negative-bg);
  color: var(--negative);
  border-color: rgba(239, 68, 68, 0.2);
}

.cal-day.has-rating.zero {
  background: var(--neutral-bg);
  color: var(--neutral);
  border-color: rgba(234, 179, 8, 0.2);
}

.cal-day:not(.empty):hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.cal-day.today {
  border-color: var(--accent) !important;
  box-shadow: 0 0 8px var(--accent-glow);
}

.cal-day-num {
  font-size: 0.7rem;
}

.cal-day-rating {
  font-size: 0.55rem;
  font-weight: 800;
  margin-top: 1px;
}

.history-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.25rem;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.modal-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.modal-rating-grid {
  margin-bottom: 1rem;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.btn-primary {
  padding: 0.6rem 1.5rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-full);
  transition: all 0.15s;
}

.btn-primary:hover {
  background: var(--accent-light);
}

.btn-delete {
  padding: 0.6rem 1.5rem;
  background: var(--negative-bg);
  color: var(--negative);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-full);
  transition: all 0.15s;
}

.btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ===== INSTALL BANNER ===== */
.install-banner {
  position: fixed;
  bottom: calc(var(--nav-height) + 8px);
  left: 1rem;
  right: 1rem;
  z-index: 90;
  animation: slideUp 0.3s ease;
}

.install-content {
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--shadow-glow);
}

.install-text {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.install-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-dismiss {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-radius: var(--radius-full);
}

.btn-install {
  padding: 0.4rem 1rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all 0.15s;
}

.btn-install:hover {
  background: var(--accent-light);
}

/* iOS Modal */
.ios-body {
  padding: 0.5rem 0;
}

.ios-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
}

.ios-step-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.ios-step p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.ios-step p strong {
  color: var(--text-primary);
}

.ios-got-it {
  width: 100%;
}

/* ===== USER MENU ===== */
.user-menu {
  position: fixed;
  top: var(--header-height);
  right: 0.5rem;
  z-index: 200;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.15s ease;
}

.user-menu-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
}

.menu-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.menu-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.menu-email {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.menu-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 0.5rem;
  font-size: 0.85rem;
  text-align: left;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.1s;
}

.menu-item:hover {
  background: var(--bg-hover);
  color: var(--negative);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .today-container {
    padding: 2rem;
  }

  .rating-btn {
    min-height: 48px;
    font-size: 1rem;
  }

  .modal-content {
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
  }

  .modal {
    align-items: center;
  }
}

/* Loading spinner for auth */
.btn-google.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-google.loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}