/* =====================================================
   Budżet Domowy — app.css
   Motyw: niebieski (#1565C0), Zero-build, knadh/oat
   ===================================================== */

/* === ZMIENNE === */
:root {
  --primary: #1565C0;
  --primary-dark: #0D47A1;
  --primary-light: #1976D2;
  --primary-pale: #E3F2FD;
  --accent: #FF6F00;
  --success: #2E7D32;
  --success-pale: #E8F5E9;
  --warning: #F57F17;
  --warning-pale: #FFF8E1;
  --danger: #C62828;
  --danger-pale: #FFEBEE;
  --text: #212121;
  --text-secondary: #757575;
  --text-inverse: #FFFFFF;
  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --border: #E0E0E0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --header-h: 60px;
  --tabnav-h: 48px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* === LAYOUT === */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

.view { display: block; }
.view[hidden] { display: none !important; }
.view-tab { display: block; padding: 24px 0; }
.view-tab[hidden] { display: none !important; }

/* === HEADER === */
.landing-header,
.app-header {
  background: var(--primary);
  color: var(--text-inverse);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.landing-header nav,
.app-header nav {
  display: flex;
  align-items: center;
  height: var(--header-h);
  gap: 12px;
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-inverse) !important;
  text-decoration: none;
  white-space: nowrap;
}

.spacer { flex: 1; }

/* === TAB NAV === */
.tab-nav {
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: var(--header-h);
  z-index: 90;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab-nav a {
  padding: 14px 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
  text-decoration: none;
}

.tab-nav a:hover { color: var(--primary); }
.tab-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* === BUTTONS === */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--primary-pale);
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover { background: #BBDEFB; }

.btn-ghost {
  background: transparent;
  color: var(--text-inverse);
  border: 1px solid rgba(255,255,255,0.5);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-ghost:hover { background: rgba(255,255,255,0.15); }

/* Ghost w kontekście jasnym */
.card .btn-ghost,
.modal .btn-ghost,
.settings-section .btn-ghost,
.view-header .btn-ghost {
  color: var(--text-secondary);
  border-color: var(--border);
}

.view-header .btn-ghost:hover {
  background: rgba(0,0,0,0.05);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.2s;
}

.btn-icon:hover { background: var(--primary-pale); }

.btn-hero {
  background: #fff;
  color: var(--primary);
  border: none;
  padding: 16px 36px;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 24px;
}

.btn-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* === LANG SWITCH === */
.lang-switch {
  background: rgba(255,255,255,0.15);
  color: var(--text-inverse);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  width: auto;
  min-width: 55px;
  flex-shrink: 0;
}

.lang-switch option { background: var(--primary); }

/* === CARDS === */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.info-card {
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* === LANDING === */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 80px 0 60px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 48px 16px;
}

.feature-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.feature-card:hover { transform: translateY(-4px); }

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.landing-footer {
  background: #212121;
  color: #9E9E9E;
  text-align: center;
  padding: 24px 16px;
  font-size: 0.9rem;
}

.landing-footer a { color: #BDBDBD; }

/* === DASHBOARD === */
.month-selector {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.global-month-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px;
  margin-bottom: 0;
}
.global-month-selector[hidden] { display: none; }

.month-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 160px;
  text-align: center;
  text-transform: capitalize;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.income-card { border-left: 4px solid var(--success); }
.expenses-card { border-left: 4px solid var(--danger); }
.savings-card { border-left: 4px solid var(--primary); }

.card-icon { font-size: 2rem; }
.card-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.card-value { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-top: 2px; }

/* Budget rule */
.budget-bars { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }

.budget-bar-item {}

.budget-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.needs-fill { background: var(--primary); }
.wants-fill { background: var(--accent); }
.savings-fill { background: var(--success); }
.progress-fill.over { background: var(--danger); }

.budget-status { font-size: 0.8rem; margin-top: 4px; color: var(--text-secondary); }
.budget-status.ok { color: var(--success); }
.budget-status.warn { color: var(--warning); }
.budget-status.over { color: var(--danger); }

/* === VIEW HEADER === */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* === FORMS === */
.form-card { margin-bottom: 20px; }

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.form-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s;
  font-family: var(--font);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
}

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

.input-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.input-group input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

/* === ENTRIES LIST === */
.entries-list { display: flex; flex-direction: column; gap: 8px; }

.entry-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.entry-item:hover { box-shadow: var(--shadow-lg); }

.entry-category-icon { font-size: 1.5rem; }
.entry-body { flex: 1; }
.entry-category { font-weight: 600; font-size: 0.95rem; }
.entry-meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.entry-amount { font-size: 1.1rem; font-weight: 700; }
.entry-amount.expense { color: var(--danger); }
.entry-amount.income { color: var(--success); }

.entry-actions { display: flex; gap: 8px; }

.btn-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 1rem;
  transition: background 0.2s;
}

.btn-delete:hover { background: var(--danger-pale); }

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
}

.empty-state p { font-size: 1.1rem; }

/* === CHARTS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.chart-card canvas { max-height: 280px; }

/* === BADGES (header) === */
.badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 50px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  gap: 4px;
  white-space: nowrap;
}

/* === SETTINGS === */
.settings-section { margin-bottom: 16px; }
.settings-section h3 { margin-bottom: 12px; font-size: 1rem; }
.settings-help { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 10px; }

/* User Info Card */
.user-info-card {
  background: linear-gradient(135deg, var(--primary) 0%, rgba(21, 101, 192, 0.8) 100%);
  color: white;
  padding: 20px;
  border-radius: var(--radius);
}

.user-info-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-avatar {
  font-size: 2.5rem;
  min-width: 60px;
  text-align: center;
}

.user-details {
  flex: 1;
}

.user-email {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}

.user-mode {
  margin: 4px 0 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Settings Grid for Language & Currency */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.settings-select {
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.settings-select:hover {
  border-color: var(--primary);
  background-color: var(--bg-hover);
}

.settings-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

/* === ACHIEVEMENTS === */
.player-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.player-stat { text-align: center; flex: 1; min-width: 80px; }
.stat-label { display: block; font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-top: 4px; }

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.achievement-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.achievement-card.unlocked { border: 2px solid var(--primary); }
.achievement-card.locked { opacity: 0.5; filter: grayscale(1); }
.achievement-card:hover { transform: translateY(-2px); }

.achievement-icon { font-size: 2.5rem; margin-bottom: 8px; }
.achievement-name { font-size: 0.85rem; font-weight: 700; margin-bottom: 4px; }
.achievement-desc { font-size: 0.75rem; color: var(--text-secondary); }
.achievement-unlocked-badge {
  display: inline-block;
  background: var(--primary-pale);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 50px;
  margin-top: 6px;
}

/* Achievement unlock modal */
.achievement-unlock {
  text-align: center;
  padding: 16px;
}

.achievement-unlock h3 { font-size: 1.5rem; margin-bottom: 8px; }
.achievement-unlock h4 { font-size: 1.1rem; color: var(--primary); margin-bottom: 8px; }
.achievement-unlock p { color: var(--text-secondary); margin-bottom: 16px; }

/* === LOYALTY === */
.loyalty-section { display: flex; flex-direction: column; gap: 16px; }

.points-card { text-align: center; }
.points-balance { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.points-label { font-size: 0.9rem; color: var(--text-secondary); font-weight: 500; }
.points-value { font-size: 3rem; font-weight: 800; color: var(--primary); }

.referral-link-section { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.referral-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text-secondary);
}

.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.reward-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reward-title { font-weight: 700; font-size: 0.95rem; }
.reward-cost { color: var(--primary); font-weight: 700; }
.reward-type { font-size: 0.8rem; color: var(--text-secondary); }

/* === PAIR === */
.pair-status-card { margin-bottom: 20px; }
.pair-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
}

.pair-status-badge.connected { background: var(--success-pale); color: var(--success); }
.pair-status-badge.pending { background: var(--warning-pale); color: var(--warning); }
.pair-status-badge.none { background: var(--primary-pale); color: var(--primary); }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* === MODALS === */
dialog.modal,
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: calc(100% - 32px);
  background: var(--bg-card);
  z-index: 1000;
}

dialog.modal::backdrop,
.modal::backdrop {
  background: rgba(0,0,0,0.5) !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.modal-close {
  display: block;
  width: 100%;
  margin-top: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 12px;
  text-align: center;
}

/* === AD SLOTS === */
.ad-slot { margin: 16px 0; }

.ad-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.ad-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.ad-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.ad-card h4 { margin-bottom: 6px; font-size: 1rem; }
.ad-card p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 12px; }

.ad-card a {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s;
}

.ad-card a:hover { background: var(--primary-dark); }

/* === TOAST NOTIFICATIONS === */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  min-width: 280px;
  max-width: calc(100vw - 32px);
}

.toast {
  background: #323232;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === LOADING OVERLAY === */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.loading-overlay[hidden] { display: none !important; }

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* === RESPONSIVE === */
/* ===== TABLET (768px and down) ===== */
@media (max-width: 768px) {
  body { font-size: 15px; }

  header nav {
    gap: 8px;
    flex-wrap: wrap;
  }

  .brand { font-size: 1.1rem; }

  .container { padding: 12px; }
  .card { padding: 16px; margin: 10px 0; }

  .summary-cards {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .summary-card { padding: 14px; }

  .tab-nav {
    gap: 8px;
    padding: 8px 12px;
    overflow-x: auto;
  }
  .tab-nav a {
    padding: 10px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  .hero {
    padding: 32px 16px 24px;
    text-align: center;
  }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 0.95rem; }

  .form-group { margin: 12px 0; }
  input, select, textarea {
    padding: 10px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .btn, button {
    padding: 10px 16px;
    font-size: 0.95rem;
    min-height: 44px; /* Touch target size */
  }

  .stats-grid { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .achievements-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .rewards-grid { grid-template-columns: 1fr; }

  table { font-size: 0.85rem; }
  th, td { padding: 8px 6px; }

  .entry-item {
    gap: 8px;
    padding: 10px;
  }
}

/* ===== MOBILE (480px and down) ===== */
@media (max-width: 480px) {
  html { font-size: 14px; }
  body { font-size: 14px; }

  header { padding: 8px 0; }
  header nav {
    gap: 4px;
    padding: 0 8px;
  }

  .brand {
    font-size: 0.95rem;
    flex: 1;
    min-width: 0;
  }

  .container { padding: 8px; }
  .card { padding: 12px; margin: 8px 0; }

  .summary-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .summary-card {
    padding: 12px;
    text-align: center;
  }
  .summary-card-value { font-size: 1.4rem; }
  .summary-card-label { font-size: 0.75rem; }

  .tab-nav {
    gap: 4px;
    padding: 6px 8px;
  }
  .tab-nav a {
    padding: 8px 10px;
    font-size: 0.75rem;
    flex: 1;
    text-align: center;
  }

  .guest-banner {
    padding: 8px 12px;
    gap: 8px;
    font-size: 0.85rem;
  }
  .guest-banner .btn-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .hero {
    padding: 24px 12px 16px;
  }
  .hero h1 {
    font-size: 1.5rem;
    margin: 12px 0;
  }
  .hero p {
    font-size: 0.9rem;
    margin: 8px 0;
  }

  .form-group { margin: 10px 0; }
  label { font-size: 0.85rem; }
  input, select, textarea {
    padding: 10px 8px;
    font-size: 16px;
    border-radius: 4px;
  }

  .btn, button {
    padding: 10px 12px;
    font-size: 0.85rem;
    width: 100%;
    min-height: 44px;
    border-radius: 4px;
  }

  .btn-group {
    display: flex;
    gap: 8px;
  }
  .btn-group .btn {
    flex: 1;
  }

  .modal-content {
    padding: 16px;
    margin: 16px;
  }

  table {
    font-size: 0.75rem;
    display: block;
    overflow-x: auto;
  }
  th, td {
    padding: 6px 4px;
  }

  .entry-item {
    gap: 6px;
    padding: 8px;
    flex-direction: column;
  }
  .entry-amount {
    align-self: flex-end;
  }

  .budget-rule-bar { height: 24px; }
  .budget-rule-label { font-size: 0.75rem; }

  .achievements-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
  }

  .rewards-grid {
    grid-template-columns: 1fr;
  }
  .reward-item { padding: 12px; }
}

/* ===== SMALL PHONES (360px and down) ===== */
@media (max-width: 360px) {
  .tab-nav a {
    font-size: 0.65rem;
    padding: 6px 8px;
  }

  .hero h1 { font-size: 1.3rem; }

  .summary-card-value { font-size: 1.2rem; }

  input, select, textarea { padding: 8px 6px; }

  .btn, button {
    padding: 9px 10px;
    font-size: 0.8rem;
  }
}

/* === UTILITY === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-secondary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* === PHASE 6: DARK MODE, OFFLINE, EXCHANGE RATES === */

/* Dark mode toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle {
  position: relative;
  display: inline-flex;
  width: 50px;
  height: 28px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  border-radius: 14px;
  transition: 0.3s;
}

.toggle-slider::before {
  position: absolute;
  content: '';
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* Exchange rates display */
.exchange-rates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.exchange-rate-item {
  background: var(--primary-pale);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.exchange-rate-currency {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.exchange-rate-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

/* Offline status indicator */
#offline-indicator {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}

#offline-indicator.online {
  background: var(--success-pale);
  color: var(--success);
}

#offline-indicator.offline {
  background: var(--warning-pale);
  color: var(--warning);
}

#offline-queue-info {
  margin-top: 12px;
  padding: 12px;
  background: var(--warning-pale);
  border-radius: var(--radius-sm);
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== AUTH FORMS (email/password + guest) ===== */

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.btn-hero-secondary {
  background: #f5f5f5;
  color: #1565C0;
  border: 2px solid #ddd;
  padding: 16px 36px;
  border-radius: var(--radius-md, 8px);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 260px;
  display: block;
  margin: 0 auto;
}
.btn-hero-secondary:hover {
  background: #e8e8e8;
  color: #1565C0;
  border-color: #1565C0;
}

.auth-form-section {
  margin: 0 auto 48px;
  max-width: 420px;
}

.auth-card {
  padding: 32px 28px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border, #e0e0e0);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted, #888);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.auth-tab.active {
  color: #1565C0;
  border-bottom-color: #1565C0;
  font-weight: 700;
}

.auth-form h3 {
  margin: 0 0 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main, #1a1a1a);
}

.form-error {
  background: #ffebee;
  color: #c62828;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.875rem;
  margin: 8px 0;
}
.form-success {
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.875rem;
  margin: 8px 0;
}

.form-links {
  text-align: center;
  margin-top: 12px;
}
.link-btn {
  background: none;
  border: none;
  color: #1565C0;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.auth-divider {
  text-align: center;
  margin: 20px 0 12px;
  position: relative;
  color: var(--text-muted, #888);
  font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border, #e0e0e0);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.btn-google {
  width: 100%;
  padding: 12px;
  background: #fff;
  color: #333;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: var(--radius-md, 8px);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: box-shadow 0.2s;
}
.btn-google:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.google-icon {
  font-weight: 800;
  color: #4285F4;
  font-size: 1rem;
}

.auth-close {
  width: 100%;
  margin-top: 12px;
  text-align: center;
}

/* Baner trybu gościa */
.guest-banner {
  background: #fff8e1;
  border-bottom: 2px solid #ffc107;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: #5d4037;
}
.guest-banner[hidden] {
  display: none !important;
}
.guest-banner .btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ===== LANDING PAGE v2 ===== */

.hero-badge {
  display: inline-block;
  background: #e3f2fd;
  color: #1565C0;
  border: 1px solid #90caf9;
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.hero-login-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 32px;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.login-option {
  width: 100%;
  text-align: center;
}
.login-option button {
  width: 100%;
  min-width: unset;
}
.login-option-primary {}

.login-option-desc {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.75);
  margin: 6px 0 0;
}

.login-options-divider {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  padding: 10px 0;
  font-weight: 500;
}

.btn-hero-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1rem;
  min-width: 280px;
}
.btn-icon-google {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 50%;
  padding: 3px;
}

.btn-ghost-landing {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.3);
  min-width: 280px;
  padding: 12px 28px;
  font-size: 0.95rem;
}
.btn-ghost-landing:hover {
  background: rgba(255,255,255,0.22);
}

/* Features grid */
.features-section {
  padding: 64px 0 48px;
}

.section-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.feature-card {
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 12px;
  padding: 24px 20px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.feature-card:hover {
  box-shadow: 0 4px 20px rgba(21,101,192,0.12);
  transform: translateY(-2px);
}
.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}
.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1565C0;
  margin: 0 0 8px;
}
.feature-card p {
  font-size: 0.875rem;
  color: #555;
  line-height: 1.5;
  margin: 0;
}

/* Compare table */
.compare-section {
  padding: 0 0 64px;
}

.compare-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.9rem;
}
.compare-table th {
  background: #1565C0;
  color: #fff;
  padding: 14px 16px;
  text-align: center;
  font-weight: 700;
}
.compare-table th:first-child {
  text-align: left;
  border-radius: 12px 0 0 0;
}
.compare-table th:last-child {
  border-radius: 0 12px 0 0;
}
.compare-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  text-align: center;
  color: #333;
}
.compare-table td:first-child {
  text-align: left;
  color: #555;
  font-weight: 500;
}
.compare-table tr:last-child td {
  border-bottom: none;
}
.compare-table tr:hover td {
  background: #f5f9ff;
}

/* Logout Modal Styling */
.logout-modal {
  max-width: 420px;
}

.logout-modal .modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.logout-modal .modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.logout-modal .modal-body {
  padding: 24px;
}

.logout-modal .modal-body p {
  margin: 0 0 12px 0;
  color: var(--text-primary);
  line-height: 1.6;
}

.logout-modal .logout-warning-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.logout-modal .modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.logout-modal .modal-footer button {
  flex: 1;
  max-width: 140px;
}

/* Navigation logout button styling */
.nav-logout-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #e74c3c;
  font-weight: 500;
  font-size: inherit;
  cursor: pointer;
  padding: 8px 16px;
  transition: color 0.2s, opacity 0.2s;
}

.nav-logout-btn:hover {
  color: #c0392b;
  opacity: 0.8;
}

/* === QR CODE STYLES === */
.qr-code-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f5f5f5;
  border-radius: var(--radius);
  margin: 16px 0;
}

.qr-code-container canvas {
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.qr-code-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
}

.qr-code-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.qr-code-actions button {
  flex: 1;
  min-width: 120px;
}

/* ── Blog preview section (landing page) ─────────────────── */
.blog-preview-section {
  background: #F8FAFC;
  padding: 64px 0;
  border-top: 1px solid #E2E8F0;
}

.blog-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.blog-preview-header h2 {
  font-size: 1.7rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: #1A202C;
}

.blog-preview-header p {
  font-size: .95rem;
  color: #64748B;
  margin: 0;
}

.blog-preview-all {
  font-size: .9rem;
  font-weight: 600;
  color: #1565C0;
  text-decoration: none;
  white-space: nowrap;
  padding-top: 6px;
}

.blog-preview-all:hover { text-decoration: underline; }

.blog-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.landing-blog-card {
  display: flex;
  gap: 16px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: #1A202C;
  transition: box-shadow .2s, transform .2s;
}

.landing-blog-card:hover {
  box-shadow: 0 8px 32px rgba(21,101,192,.12);
  transform: translateY(-2px);
  text-decoration: none;
}

.lbc-icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: #EBF4FF;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lbc-body { display: flex; flex-direction: column; gap: 4px; }

.lbc-category {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.lbc-title {
  font-size: .95rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
  color: #1A202C;
}

.lbc-desc {
  font-size: .82rem;
  color: #64748B;
  margin: 2px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lbc-meta {
  font-size: .75rem;
  color: #94A3B8;
  margin-top: 6px;
}

@media (max-width: 600px) {
  .blog-preview-section { padding: 40px 0; }
  .blog-preview-grid { grid-template-columns: 1fr; }
}
