/* =====================================================
   Finanse Bez Owijania — Stitch App Shell (ETAP 2)
   Warstwa wizualna nakładana na ISTNIEJĄCY App Shell i
   dashboard. Nie zmienia struktury DOM ani ID — JS
   (app.js/ui.js) re-query elementy po getElementById.
   Logika i dane bez zmian. Nadpisuje stary styl (legacy)
   po dołączeniu tego arkusza po starych CSS.
   ===================================================== */

/* === BODY / BACKGROUND — Deep Terminal === */
body {
  background: var(--stitch-bg);
  color: var(--stitch-on-background);
  font-family: var(--stitch-font-body);
}

/* Layout wrapper aplikacji (jeśli istnieje) */
#app-shell {
  background: var(--stitch-bg);
  color: var(--stitch-on-background);
  font-family: var(--stitch-font-body);
}
#app-shell .view-tab { padding: var(--stitch-spacing-3) 0; }

/* === HEADER (top nav desktop) === */
.app-header {
  background: var(--stitch-surface);
  color: var(--stitch-on-surface);
  border-bottom: 1px solid var(--stitch-outline-variant);
  box-shadow: none;
  height: var(--stitch-nav-height);
}
.app-header nav {
  height: var(--stitch-nav-height);
  padding: 0 var(--stitch-margin-mobile);
}
@media (min-width: 768px) {
  .app-header nav { padding: 0 var(--stitch-margin-desktop); }
  .app-header .container { max-width: var(--stitch-container-max); margin: 0 auto; }
}
.app-header .brand {
  color: var(--stitch-on-surface) !important;
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: var(--stitch-spacing-2);
}
.app-header .brand::before {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: var(--stitch-radius-full);
  background: var(--stitch-primary);
  box-shadow: var(--stitch-glow-primary);
}

/* Badge / lang switch w headerze */
.app-header .badge {
  background: var(--stitch-surface-container);
  color: var(--stitch-on-surface-variant);
  border: 1px solid var(--stitch-outline-variant);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.app-header .lang-switch {
  background: var(--stitch-terminal-black);
  color: var(--stitch-on-surface-variant);
  border: 1px solid var(--stitch-surface-light);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
}

/* === TAB NAV (desktop menu) === */
#tab-nav,
.tab-nav {
  background: var(--stitch-bg);
  border-bottom: 1px solid var(--stitch-outline-variant);
  top: var(--stitch-nav-height);
}
.tab-nav a {
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  font-weight: 500;
  padding: var(--stitch-spacing-3) var(--stitch-spacing-3);
  border-bottom: 2px solid transparent;
  text-transform: none;
  letter-spacing: normal;
}
.tab-nav a:hover { color: var(--stitch-primary); }
.tab-nav a.active {
  color: var(--stitch-primary);
  border-bottom-color: var(--stitch-primary);
  font-weight: 700;
}
.tab-nav a.nav-logout-btn { color: var(--stitch-danger); }
.tab-nav a.nav-logout-btn:hover { color: var(--stitch-danger); }

/* === MONTH SELECTOR === */
.global-month-selector {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  padding: var(--stitch-spacing-2) var(--stitch-spacing-3);
  display: inline-flex;
  align-items: center;
  gap: var(--stitch-spacing-2);
  margin: var(--stitch-spacing-3) auto;
}
.global-month-selector .btn-icon {
  background: var(--stitch-surface-container);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-outline-variant);
  border-radius: var(--stitch-radius-btn);
  width: 36px; height: 36px;
}
.global-month-selector .btn-icon:hover { color: var(--stitch-primary); border-color: var(--stitch-primary); }
.global-month-selector .month-label {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  color: var(--stitch-on-surface);
  min-width: 180px;
  text-align: center;
}

/* === BUTTONS === */
#app-shell .btn-primary {
  background: var(--stitch-primary-container);
  color: var(--stitch-on-primary-container);
  border: none;
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: none;
}
#app-shell .btn-primary:hover { background: var(--stitch-primary-fixed); color: var(--stitch-on-primary-fixed); }
#app-shell .btn-secondary {
  background: transparent;
  color: var(--stitch-secondary);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#app-shell .btn-secondary:hover { background: var(--stitch-surface-light); color: var(--stitch-secondary); }
#app-shell .btn-ghost {
  background: transparent;
  color: var(--stitch-on-surface-variant);
  border: 1px solid transparent;
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  letter-spacing: 0.08em;
}
#app-shell .btn-ghost:hover { background: var(--stitch-surface-bright); color: var(--stitch-on-surface); }

/* === CARDS === */
#app-shell .card {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
  color: var(--stitch-on-surface);
}
#app-shell .card h2,
#app-shell .card h3 {
  font-family: var(--stitch-font-display);
  color: var(--stitch-on-surface);
}
#app-shell .card p,
#app-shell .card label {
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-body);
}

/* === DASHBOARD HEADER === */
#app-shell .dashboard-header .view-header h2,
#app-shell .dashboard-header h2 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-lg);
  color: var(--stitch-on-surface);
  margin: 0;
}
#app-shell .dashboard-title-group { display: flex; flex-direction: column; gap: 2px; }
#app-shell .dashboard-title-meta {
  display: flex; align-items: center; gap: 6px;
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-body);
  font-size: 13px;
}
#app-shell .dashboard-title-meta .material-symbols-outlined { font-size: 16px; color: var(--stitch-primary); }

/* === DASHBOARD LAYOUT (wzorzec budget_dashboard_desktop) === */
#app-shell #view-dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--stitch-spacing-4);
  width: 100%;
}
/* Kontener kolumn: lewa szersza / prawa węższa */
#app-shell .dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--stitch-spacing-gutter);
  align-items: start;   /* karty nie rozciągają się na wysokość rzędu */
  width: 100%;
}
/* Każda kolumna układa karty jedna pod drugą */
#app-shell .dashboard-column {
  display: flex;
  flex-direction: column;
  gap: var(--stitch-spacing-4);
  min-width: 0;
}
@media (max-width: 1023px) {
  #app-shell .dashboard-columns { grid-template-columns: 1fr; }
}

/* Karty KPI — dokładnie 4 karty (wzorzec budget_dashboard_desktop).
   Równomierny układ: 4 kolumny wypełniające szeroki kontener (1280px). */
#app-shell .summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--stitch-spacing-gutter);
}
@media (max-width: 1050px) {
  #app-shell .summary-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  #app-shell .summary-cards { grid-template-columns: 1fr; }
}
#app-shell .summary-card {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
  padding: var(--stitch-spacing-4);
  gap: var(--stitch-spacing-1) var(--stitch-spacing-2);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;          /* nadpisuje align-items:center z app.css — treść do lewej */
  justify-content: flex-start;   /* bez rozbiegania — label+wartość u góry, delta na dole */
  overflow: visible;
  flex-wrap: nowrap;             /* kolumna — elementy jedna pod drugą bez zawijania */
}
#app-shell .summary-card .card-label {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--stitch-on-surface-variant);
  margin-bottom: var(--stitch-spacing-2);
}
#app-shell .summary-card .card-value {
  font-family: var(--stitch-font-body);
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: left;
  color: var(--stitch-on-surface);
  min-width: 0;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
  line-height: 1.1;
  margin-bottom: var(--stitch-spacing-1);
}
/* Karty KPI — kolory wartości jak wzorzec */
#app-shell .income-card .card-value { color: var(--stitch-primary); }
#app-shell .expenses-card .card-value { color: var(--stitch-danger); }
#app-shell .savings-card .card-value { color: var(--stitch-primary-fixed); }
#app-shell .balance-card .card-value { color: var(--stitch-on-surface); }
/* Pasek metryki (Przychody/Wydatki) — cienki, pod wartością */
#app-shell .summary-card .card-meter {
  height: 3px;
  width: 100%;
  background: var(--stitch-surface-container);
  border-radius: 999px;
  margin-top: auto;
  overflow: hidden;
}
#app-shell .summary-card .card-meter-fill {
  display: block;
  height: 100%;
  background: var(--stitch-primary);
  border-radius: 999px;
  transition: width 0.4s ease;
}
#app-shell .summary-card .card-meter-fill.fill-primary { background: var(--stitch-primary); }
#app-shell .summary-card .card-meter-fill.fill-danger { background: var(--stitch-danger); }
#app-shell .summary-card .card-secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;              /* nie rozciągaj się na wysokość karty */
  width: 100%;                 /* ale pełna szerokość */
  font-family: var(--stitch-font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--stitch-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Delta salda (balance) przypięta do dołu karty */
#app-shell .balance-card .card-secondary {
  margin-top: auto;
}
/* "Stopa:" w karcie Oszczędności — bezpośrednio pod liczbą */
#app-shell .savings-card .card-secondary {
  margin-top: 0;               /* nie odpychaj na dół — "Stopa…" pod kwotą */
}
#app-shell .summary-card .card-secondary .material-symbols-outlined { font-size: 14px; }
#app-shell .summary-card .card-secondary:not([hidden]) { display: flex; }
#app-shell .savings-card .card-secondary .savings-goal-label {
  color: var(--stitch-on-surface-variant);
  font-weight: 400;
  opacity: 0.75;
}
#app-shell .expenses-card .card-value.text-danger { color: var(--stitch-danger); }

@media (prefers-reduced-motion: reduce) {
  #app-shell .summary-card .card-meter-fill { transition: none; }
}

/* === BUDŻET MIESIĘCZNY (wzorzec budget_dashboard_desktop) === */
#app-shell .monthly-budget-card {
  grid-column: 1 / -1;
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  padding: var(--stitch-spacing-4);
  display: flex;
  flex-direction: column;
  gap: var(--stitch-spacing-2);   /* zwarty układ */
}
#app-shell .monthly-budget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#app-shell .monthly-budget-head h3 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  color: var(--stitch-on-surface);
  margin: 0;
}
#app-shell .monthly-budget-badge {
  font-family: var(--stitch-font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--stitch-radius-btn);
  background: var(--stitch-surface-container);
  color: var(--stitch-on-surface-variant);
  border: 1px solid var(--stitch-outline-variant);
  white-space: nowrap;
}
#app-shell .monthly-budget-badge.status-ok {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--stitch-success);
  color: var(--stitch-success);
}
#app-shell .monthly-budget-badge.status-warn {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--stitch-warning);
  color: var(--stitch-warning);
}
#app-shell .monthly-budget-badge.status-over {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--stitch-danger);
  color: var(--stitch-danger);
}
#app-shell .monthly-budget-lines {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
#app-shell .monthly-budget-used {
  font-family: var(--stitch-font-body);
  font-size: 28px;
  font-weight: 500;
  color: var(--stitch-on-surface);
  letter-spacing: -0.01em;
}
#app-shell .monthly-budget-total {
  font-family: var(--stitch-font-body);
  font-size: 14px;
  color: var(--stitch-on-surface-variant);
}
#app-shell .monthly-budget-bar {
  height: 6px;
  background: var(--stitch-surface-container);
  border-radius: 999px;
  overflow: hidden;
}
#app-shell .monthly-budget-bar .progress-fill {
  height: 100%;
  background: var(--stitch-primary-container);
  border-radius: 999px;
  transition: width 0.4s ease;
}
#app-shell .monthly-budget-remaining {
  margin: 0;
  text-align: right;
  font-family: var(--stitch-font-body);
  font-size: 13px;
  color: var(--stitch-on-surface-variant);
}
@media (prefers-reduced-motion: reduce) {
  #app-shell .monthly-budget-bar .progress-fill { transition: none; }
}

/* === INFO KARTY NARZĘDZI / SEKCJE (wzorzec "Co możesz poprawić?") ===
   Każda karta informacyjna na dashboardzie dostaje lewy kolorowy pasek,
   nagłówek z ikoną (label-caps) i treść — każda w innym kolorze akcentu. */
#app-shell #view-dashboard .card,
#app-shell #view-dashboard section.card {
  position: relative;
  overflow: hidden;
}
#app-shell #view-dashboard .card > .section-heading {
  text-align: left;
  max-width: none;
  margin: 0 0 var(--stitch-spacing-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--stitch-spacing-2);
  flex-wrap: wrap;
}
#app-shell #view-dashboard .card > .section-heading h3 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  color: var(--stitch-on-surface);
  margin: 0;
  letter-spacing: 0;
}
#app-shell #view-dashboard .card > .section-heading .link-btn {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stitch-primary);
  text-decoration: none;
}
#app-shell #view-dashboard .card > .section-heading .link-btn:hover { text-decoration: underline; }

/* Nagłówek sekcji w stylu "Co możesz poprawić?" — ikona + label-caps */
#app-shell #view-dashboard .chf-section-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#app-shell #view-dashboard .chf-section-head .material-symbols-outlined {
  font-size: 18px;
  color: var(--stitch-primary);
}
#app-shell #view-dashboard .chf-label-caps {
  font-family: var(--stitch-font-body) !important;
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stitch-on-surface);
  margin: 0;
}
/* Nadpisz domyślną czcionkę display dla nagłówków wewnątrz tych sekcji */
#app-shell #view-dashboard .monthly-budget-head h3,
#app-shell #view-dashboard .month-progress-section h3,
#app-shell #view-dashboard .insights-section h3 { font-family: var(--stitch-font-body) !important; letter-spacing: 0.08em !important; }

/* Wyróżnione karty — kolorowy akcent po lewej */
#app-shell #view-dashboard .daily-safe-limit-card { border-left: 4px solid var(--stitch-success); }
#app-shell #view-dashboard .month-progress-section.card { border-left: 4px solid var(--stitch-warning); }
#app-shell #view-dashboard .category-budgets-section.card { border-left: 4px solid var(--stitch-secondary-container); }
#app-shell #view-dashboard .recent-transactions-section.card { border-left: 4px solid var(--stitch-success); }
#app-shell #view-dashboard .upcoming-payments-section.card { border-left: 4px solid var(--stitch-tertiary); }
#app-shell #view-dashboard .insights-section.card { border-left: 4px solid var(--stitch-primary-fixed); }

/* Metryki wewnątrz sekcji — czytelne etykiety */
#app-shell #view-dashboard .daily-safe-limit-card .safe-limit-text {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  color: var(--stitch-on-surface-variant);
  line-height: 1.5;
  margin: 0;
}
#app-shell #view-dashboard .budget-bar-label,
#app-shell #view-dashboard .progress-metrics .metric-label {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
}
#app-shell #view-dashboard .metric-value {
  font-family: var(--stitch-font-body);
  font-variant-numeric: tabular-nums;
  color: var(--stitch-on-surface);
  font-size: var(--stitch-font-body-md);   /* mniejsza czcionka jak w referencji */
}
/* Mniejszy (kompaktowy) tekst treści w kartach informacyjnych */
#app-shell #view-dashboard .progress-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
#app-shell #view-dashboard .progress-pace .pace-label {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  color: var(--stitch-on-surface-variant);
}
#app-shell #view-dashboard .progress-pace .pace-message {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  line-height: 1.5;
  margin: 6px 0 0;
}
#app-shell #view-dashboard .insights-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--stitch-spacing-2);
}
#app-shell #view-dashboard .insights-list li {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);   /* mniejsza czcionka jak w referencji */
  color: var(--stitch-on-surface-variant);
  line-height: 1.5;
}
/* Nagłówek sekcji — spójny z referencją (label-caps, mniejsza treść) */
#app-shell #view-dashboard .section-heading h3,
#app-shell #view-dashboard .chf-label-caps {
  font-size: var(--stitch-font-label-caps);
  letter-spacing: 0.08em;
}

/* === KATEGORIE WYDATKÓW (wzorzec budget_dashboard_desktop) === */
#app-shell .category-bars { display: flex; flex-direction: column; gap: var(--stitch-spacing-3); }
#app-shell .category-bar { display: flex; flex-direction: column; gap: 4px; }
#app-shell .category-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--stitch-font-body);
  font-size: 14px;
}
#app-shell .category-bar-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--stitch-on-surface);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#app-shell .category-bar-name .material-symbols-outlined {
  font-size: 18px;
  color: var(--stitch-on-surface-variant);
}
#app-shell .category-bar-amt {
  color: var(--stitch-on-surface);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#app-shell .category-bar-track {
  height: 6px;
  width: 100%;
  background: var(--stitch-surface-container);
  border-radius: 999px;
  overflow: hidden;
}
#app-shell .category-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
@media (prefers-reduced-motion: reduce) {
  #app-shell .category-bar-fill { transition: none; }
}

/* === BUDGET RULE 50/30/20 === */
#app-shell .budget-rule-card .budget-bar-label {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  color: var(--stitch-on-surface-variant);
}
#app-shell .budget-rule-card .progress-bar {
  background: var(--stitch-surface-container);
  border-radius: 0;
  height: 2px;
}
#app-shell .budget-rule-card .progress-fill {
  border-radius: 0;
}
#app-shell .budget-rule-card .needs-fill { background: var(--stitch-primary-container); }
#app-shell .budget-rule-card .wants-fill { background: var(--stitch-secondary-container); }
#app-shell .budget-rule-card .savings-fill { background: var(--stitch-success); }

/* === CHARTS === */
#app-shell .chart-card {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
}

/* === FORM ROWS === */
#app-shell .form-row label,
#app-shell .form-card > h3 {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
}
#app-shell .form-row input,
#app-shell .form-row select,
#app-shell .form-row textarea {
  background: var(--stitch-terminal-black);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
}
#app-shell .form-row input:focus,
#app-shell .form-row select:focus,
#app-shell .form-row textarea:focus {
  border-color: var(--stitch-primary);
  outline: none;
  box-shadow: 0 0 0 1px var(--stitch-primary-container);
}

/* Duża kwota (wzorzec add_transaction: rozmiar data-display) */
#app-shell .form-row #expense-amount,
#app-shell .form-row #income-amount {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-display-md);
  font-weight: 500;
  letter-spacing: -0.01em;
  height: auto;
  padding: var(--stitch-spacing-3);
}

/* Akcje formularza — przyciski spójne */
#app-shell .form-actions {
  display: flex;
  gap: var(--stitch-spacing-2);
  flex-wrap: wrap;
  margin-top: var(--stitch-spacing-3);
}

/* === ENTRIES LIST (wydatki/przychody) === */
#app-shell .entries-list { gap: var(--stitch-spacing-2); }
#app-shell .entry-item {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
  /* jedna wyważona linia: ikona | treść | kwota | akcja */
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-width: 0;
}
#app-shell .entry-item .entry-body { min-width: 0; flex: 1 1 auto; align-self: center; }
#app-shell .entry-item .entry-amount {
  flex: 0 0 auto;
  white-space: nowrap;
  margin-left: auto;
  align-self: center;
}
#app-shell .entry-item .entry-actions { flex: 0 0 auto; align-self: center; margin-left: 4px; }
#app-shell .entry-item:hover { box-shadow: none; border-color: var(--stitch-primary); }
#app-shell .entry-item .entry-category-icon {
  font-size: 1.25rem;
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--stitch-surface-container);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
}
#app-shell .entry-item .entry-category-icon .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  color: var(--stitch-on-surface-variant);
}
#app-shell .entry-item .entry-category {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  font-weight: 700;
  color: var(--stitch-on-surface);
}
#app-shell .entry-item .entry-meta {
  font-family: var(--stitch-font-body);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--stitch-on-surface-variant);
  margin-top: 2px;
}
#app-shell .entry-item .entry-amount {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
}
#app-shell .entry-item .entry-amount.expense { color: var(--stitch-danger); }
#app-shell .entry-item .entry-amount.income { color: var(--stitch-success); }
#app-shell .entry-item .btn-delete {
  color: var(--stitch-on-surface-variant);
  background: var(--stitch-surface-container);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: color .15s ease, border-color .15s ease;
}
#app-shell .entry-item .btn-delete:hover {
  color: var(--stitch-danger);
  border-color: var(--stitch-danger);
  background: var(--stitch-surface-container-high);
}

/* === EMPTY STATE === */
#app-shell .empty-state {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-body);
}
#app-shell .empty-state p { color: var(--stitch-on-surface-variant); }

/* === STATYSTYKI (wzorzec net_worth_report / financial_health) === */
#app-shell .stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--stitch-spacing-4);
}
@media (min-width: 900px) {
  #app-shell .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 899px) and (min-width: 600px) {
  #app-shell .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
#app-shell .stats-grid .chart-card {
  margin: 0;
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  padding: var(--stitch-spacing-4);
  display: flex;
  flex-direction: column;
  gap: var(--stitch-spacing-3);
}
#app-shell .stats-grid .chart-card h3 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  color: var(--stitch-on-surface);
  margin: 0;
  letter-spacing: 0;
}
/* Podsumowanie liczbowe nad wykresem — wzorzec net_worth_report */
#app-shell .stats-grid .chart-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--stitch-spacing-2);
  border-bottom: 1px solid var(--stitch-outline-variant);
  padding-bottom: var(--stitch-spacing-2);
}
#app-shell .stats-grid .chart-summary .chart-summary-label {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
}
#app-shell .stats-grid .chart-summary .chart-summary-value {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-data-display);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--stitch-primary);
  white-space: nowrap;
}
/* Wykresy ECharts — wymagają jawnego rozmiaru kontenera (w>0, h>0) */
#app-shell .stats-grid .chart-card canvas {
  display: block;
  width: 100% !important;
  height: 220px !important;   /* zwarte, mniejsze niż 280px — czytelny układ */
}

/* === OSIĄGNIĘCIA + LOJALNOŚĆ (wzorzec savings_goals / investment_portfolio) === */
#app-shell .player-stats {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  display: flex;
  justify-content: space-around;
  gap: var(--stitch-spacing-3);
  padding: var(--stitch-spacing-4);
  box-shadow: none;
}
#app-shell .player-stat { text-align: center; }
#app-shell .stat-label {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
}
#app-shell .stat-value {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-display-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--stitch-primary);
  margin-top: var(--stitch-spacing-2);
}
#app-shell .achievements-grid,
#app-shell .rewards-grid {
  gap: var(--stitch-spacing-3);
}
#app-shell .achievement-card,
#app-shell .reward-card {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
}
#app-shell .achievement-card:hover,
#app-shell .reward-card:hover { box-shadow: none; border-color: var(--stitch-primary); transform: none; }
#app-shell .loyalty-section {
  gap: var(--stitch-spacing-3);
}
#app-shell .points-card,
#app-shell .referral-card {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
  padding: var(--stitch-spacing-4);
}
#app-shell .points-card { text-align: center; }
#app-shell .points-label {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
}
#app-shell .points-value {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-display-xl);
  font-weight: 700;
  color: var(--stitch-primary);
}
#app-shell .referral-card h4,
#app-shell .loyalty-section > h3,
#app-shell .view-osiagniecia h3 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  color: var(--stitch-on-surface);
}
#app-shell .referral-input {
  background: var(--stitch-terminal-black);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
}

/* === USTAWIENIA (wzorzec data_portability_review / system_logs) === */
#app-shell .settings-section,
#app-shell .user-info-card {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
  margin-bottom: var(--stitch-spacing-3);
  padding: var(--stitch-spacing-4);
}
#app-shell .settings-section h3,
#app-shell .user-info-card h3 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  color: var(--stitch-on-surface);
  margin-bottom: var(--stitch-spacing-3);
}
#app-shell .settings-grid { gap: var(--stitch-spacing-3); }
#app-shell .settings-group label,
#app-shell .settings-section label {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
}
#app-shell .settings-select,
#app-shell .settings-section select,
#app-shell .settings-section input {
  background: var(--stitch-terminal-black);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
}

/* === KURSY WALUT (dark Stitch) === */
#app-shell .exchange-rates-grid { gap: var(--stitch-spacing-2); margin: var(--stitch-spacing-3) 0; }
#app-shell .exchange-rate-item {
  background: var(--stitch-surface-container) !important;
  border: 1px solid var(--stitch-outline-variant) !important;
  border-radius: var(--stitch-radius-btn) !important;
  box-shadow: none !important;
  padding: var(--stitch-spacing-3) var(--stitch-spacing-2);
}
#app-shell .exchange-rate-currency {
  color: var(--stitch-on-surface-variant) !important;
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.1em;
}
#app-shell .exchange-rate-value {
  color: var(--stitch-primary) !important;
  font-family: var(--stitch-font-body);
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
#app-shell .user-info-header { gap: var(--stitch-spacing-3); }
#app-shell .user-avatar {
  width: 44px; height: 44px;
  border-radius: var(--stitch-radius-full);
  background: var(--stitch-surface-container);
  border: 1px solid var(--stitch-surface-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#app-shell .user-email,
#app-shell .user-mode {
  font-family: var(--stitch-font-body);
  color: var(--stitch-on-surface-variant);
}

/* === PARA (wspólny budżet) === */
#app-shell #view-para h2 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-lg);
  color: var(--stitch-on-surface);
}
#app-shell #view-para .card {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
}

/* === WSPARCIE === */
#app-shell #view-wsparcie h2 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-lg);
  color: var(--stitch-on-surface);
}
#app-shell .support-form-app .form-group { margin-bottom: var(--stitch-spacing-3); }
#app-shell .support-form-app label {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
  display: block;
  margin-bottom: var(--stitch-spacing-2);
}
#app-shell .support-form-app input,
#app-shell .support-form-app select,
#app-shell .support-form-app textarea {
  background: var(--stitch-terminal-black);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
  width: 100%;
  padding: var(--stitch-spacing-2) var(--stitch-spacing-3);
}
#app-shell .support-form-app input:focus,
#app-shell .support-form-app select:focus,
#app-shell .support-form-app textarea:focus {
  border-color: var(--stitch-primary);
  outline: none;
  box-shadow: 0 0 0 1px var(--stitch-primary-container);
}

/* === POMOCNICZE: help text, danger, toggle === */
#app-shell .settings-help {
  font-family: var(--stitch-font-body);
  color: var(--stitch-on-surface-variant);
}
#app-shell .btn-danger {
  background: var(--stitch-danger);
  color: var(--stitch-on-error);
  border: none;
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#app-shell .toggle-slider { border-color: var(--stitch-outline-variant); }

/* === AUTH (wzorzec unified_auth) === */
#view-landing .auth-form-section,
#view-landing #email-auth-section {
  max-width: 560px;
  margin: var(--stitch-spacing-5) auto;
  padding: 0 var(--stitch-margin-mobile);
}
#view-landing .auth-card {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
  padding: var(--stitch-spacing-4);
}
#view-landing .auth-tabs {
  display: flex;
  gap: var(--stitch-spacing-2);
  margin-bottom: var(--stitch-spacing-4);
  border-bottom: 1px solid var(--stitch-outline-variant);
  padding-bottom: var(--stitch-spacing-3);
}
#view-landing .auth-tab {
  background: transparent;
  color: var(--stitch-on-surface-variant);
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--stitch-spacing-2) var(--stitch-spacing-3);
  cursor: pointer;
}
#view-landing .auth-tab:hover { color: var(--stitch-primary); }
#view-landing .auth-tab.active {
  color: var(--stitch-primary);
  border-bottom-color: var(--stitch-primary);
}
#view-landing .auth-form h3 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  color: var(--stitch-on-surface);
  margin: 0 0 var(--stitch-spacing-3);
}
#view-landing .auth-form input {
  background: var(--stitch-terminal-black);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
  width: 100%;
  padding: var(--stitch-spacing-2) var(--stitch-spacing-3);
}
#view-landing .auth-form input:focus {
  border-color: var(--stitch-primary);
  outline: none;
  box-shadow: 0 0 0 1px var(--stitch-primary-container);
}
#view-landing .form-error,
#view-landing .form-success {
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  border-radius: var(--stitch-radius-btn);
  padding: var(--stitch-spacing-2) var(--stitch-spacing-3);
  margin: var(--stitch-spacing-2) 0;
}
#view-landing .form-error { color: var(--stitch-error); background: var(--stitch-error-container); }
#view-landing .form-success { color: var(--stitch-success); background: var(--stitch-surface-container); }
#view-landing .auth-divider { margin: var(--stitch-spacing-3) 0; color: var(--stitch-neutral-slate); }
#view-landing .btn-google {
  background: transparent !important;
  color: var(--stitch-on-surface-variant) !important;
  border: 1px solid var(--stitch-outline-variant) !important;
  border-radius: var(--stitch-radius-btn) !important;
  width: 100%;
  padding: var(--stitch-spacing-2) var(--stitch-spacing-3);
  font-family: var(--stitch-font-body);
  font-weight: 700;
  letter-spacing: 0.04em;
}
#view-landing .btn-google:hover { border-color: var(--stitch-primary) !important; color: var(--stitch-on-surface) !important; background: var(--stitch-surface-bright) !important; }
#view-landing .auth-close,
#view-landing .link-btn {
  color: var(--stitch-on-surface-variant) !important;
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  background: transparent;
  border: none;
  cursor: pointer;
}
#view-landing .auth-close:hover,
#view-landing .link-btn:hover { color: var(--stitch-primary) !important; }

/* === MODALE / DIALOGI (wzorzec add_transaction card/modal) === */
#app-shell dialog,
#view-landing dialog {
  background: var(--stitch-surface-deep);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
  font-family: var(--stitch-font-body);
}
#app-shell dialog::backdrop,
#view-landing dialog::backdrop {
  background: rgba(10, 12, 16, 0.8);
  backdrop-filter: blur(2px);
}
#app-shell dialog h2,
#app-shell dialog h3,
#view-landing dialog h2,
#view-landing dialog h3 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  color: var(--stitch-on-surface);
}
#app-shell dialog input,
#app-shell dialog select,
#app-shell dialog textarea,
#view-landing dialog input,
#view-landing dialog select,
#view-landing dialog textarea {
  background: var(--stitch-terminal-black);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
}

/* === VIEW HEADER === */
#app-shell .view-header h2 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-lg);
  color: var(--stitch-on-surface);
}
#app-shell .view-header .header-actions {
  display: flex;
  align-items: center;
  gap: var(--stitch-spacing-2);
}

/* === FINANCIAL HEALTH PANEL === */
#app-shell .financial-health-panel {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  position: relative;
  overflow: hidden;
}
/* Dekoracyjny akcent w tle (motyw z referencji) */
#app-shell .financial-health-panel::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  border-radius: 9999px;
  background: var(--stitch-primary-container);
  opacity: 0.08;
  pointer-events: none;
}
#app-shell .financial-health-panel h2 {
  font-family: var(--stitch-font-display);
  color: var(--stitch-on-surface);
  position: relative;
  z-index: 1;
}
#app-shell .financial-health-panel .fhs-local-badge {
  background: var(--stitch-surface-container);
  color: var(--stitch-on-surface-variant);
  border: 1px solid var(--stitch-outline-variant);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: normal;          /* nie wypada za krawędź karty */
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  text-align: right;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}
/* Wynik liczbowy + opis + przycisk wg referencji */
#app-shell .financial-health-panel .fhs-score-display {
  position: relative; z-index: 1;
  margin-bottom: var(--stitch-spacing-2);
}
#app-shell .financial-health-panel .fhs-score-display .fhs-result-score {
  font-size: 48px !important;
  color: var(--stitch-success) !important;
}
/* Brak danych → neutralny kolor zamiast zielonej kreski */
#app-shell .financial-health-panel .fhs-score-display .fhs-result-score.fhs-empty-score {
  color: var(--stitch-on-surface-variant) !important;
}
#app-shell .financial-health-panel .fhs-score-display .fhs-score-unit {
  font-size: 22px !important;
  color: var(--stitch-neutral-slate);
  padding-bottom: 4px;
}
#app-shell .financial-health-panel .fhs-score-verdict {
  position: relative; z-index: 1;
  font-size: 14px;
  color: var(--stitch-on-surface-variant);
  font-weight: 500;
}
#app-shell .financial-health-panel .fhs-empty { position: relative; z-index: 1; }
#app-shell .financial-health-panel #fhs-components { position: relative; z-index: 1; }
/* Główny przycisk "Zobacz analizę" na całą szerokość (jak w referencji) */
#app-shell .financial-health-panel #btn-fhs-full-analysis {
  position: relative; z-index: 1;
  width: 100%;
  border: 1px solid var(--stitch-surface-light);
  color: var(--stitch-primary);
  padding: 10px 14px;
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
#app-shell .financial-health-panel #btn-fhs-full-analysis:hover,
#app-shell .financial-health-panel #btn-fhs-full-analysis:focus-visible {
  background: var(--stitch-surface-light);
  outline: none;
}
#app-shell .financial-health-panel input {
  background: var(--stitch-terminal-black);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
}

/* === BOTTOM NAV (mobile) === */
#bottom-nav {
  background: var(--stitch-surface-container);
  border-top: 1px solid var(--stitch-outline-variant);
}
#bottom-nav .bn-item {
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-body);
}
#bottom-nav .bn-item:hover { background: var(--stitch-surface-bright); }
#bottom-nav .bn-item.active,
#bottom-nav .bn-item.active:focus {
  background: var(--stitch-primary-container);
  color: var(--stitch-on-primary-container);
}
#bottom-more-menu {
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
}

/* === GLOBALNE JASNE ELEMENTY (też w app shell) → dark ===
   .rodo-banner / .guest-banner / .compare-table / .btn-google /
   .settings-rodo — pojawiają się w całym dokumencie (landing+app),
   a w app.css mają sztywno białe tło (#fff / #fff8e1 / #fff3e0). */
.rodo-banner,
#app-shell .rodo-banner,
#view-landing .rodo-banner,
.guest-banner,
#app-shell .guest-banner,
#view-landing .guest-banner,
.settings-rodo,
#app-shell .settings-rodo,
#view-landing .settings-rodo,
.compare-table,
#app-shell .compare-table,
#view-landing .compare-table,
.btn-google,
#app-shell .btn-google,
#view-landing .btn-google,
.btn-icon-google,
#app-shell .btn-icon-google,
#view-landing .btn-icon-google {
  background: var(--stitch-surface-container) !important;
  color: var(--stitch-on-surface-variant) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  box-shadow: none !important;
}
.rodo-banner,
.guest-banner {
  border-color: var(--stitch-primary) !important;
}
.compare-table th,
#app-shell .compare-table th,
#view-landing .compare-table th {
  background: var(--stitch-surface-container-high) !important;
  color: var(--stitch-primary) !important;
}
.compare-table td,
#app-shell .compare-table td,
#view-landing .compare-table td {
  background: var(--stitch-surface-container) !important;
  color: var(--stitch-on-surface-variant) !important;
  border-color: var(--stitch-outline-variant) !important;
}
/* QR / pliki / toggles — ciemny motyw Stitch */
#app-shell .qr-code-container {
  background: var(--stitch-surface-container) !important;
  border: 1px solid var(--stitch-outline-variant) !important;
  border-radius: var(--stitch-radius-card) !important;
}
#app-shell .qr-code-container canvas {
  background: transparent !important;   /* ciemne tło z QRCode (colorLight) */
  border: 1px solid var(--stitch-outline-variant) !important;
  border-radius: 6px;
  padding: 8px;
}
#app-shell .qr-code-label {
  color: var(--stitch-on-surface-variant) !important;
}

/* === BOTTOM NAV (mobile — wzorzec SideNavBar Stitch) === */
@media (max-width: 768px) {
  /* Zabezpieczenie: żaden ancestral transform/filter nie może "rozbić"
     position:fixed (tworzyłoby nowy containing block i nav by uciekał). */
  #app-shell,
  #app-shell main,
  #app-shell .view-tab {
    transform: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    perspective: none !important;
  }
  #bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1002 !important;
  }
  #bottom-nav.bottom-nav {
    background: var(--stitch-surface-container);
    border-top: 1px solid var(--stitch-outline-variant);
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav .bn-item {
    color: var(--stitch-on-surface-variant);
    border-radius: var(--stitch-radius-xl);
    min-height: 52px;
    flex-direction: column;        /* ikona nad etykietą — nie obok siebie */
  }
  .bottom-nav .bn-item:hover { background: var(--stitch-surface-bright); color: var(--stitch-on-surface); }
  .bottom-nav .bn-item.active {
    color: var(--stitch-on-primary-container);
    background: var(--stitch-primary-container);
    font-weight: 700;
  }
  .bottom-nav .bn-item.active .bn-icon { transform: none; }
  .bottom-nav .bn-item .bn-icon { color: inherit; }
  .bottom-nav .bn-item .bn-label {
    font-family: var(--stitch-font-body);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  /* Material Symbols w pozycjach nav — rozmiar i wariant jak wzorzec */
  .bottom-nav .bn-item .bn-icon.material-symbols-outlined,
  .bottom-nav .bn-more-toggle .bn-icon.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-size: 24px;
    font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    line-height: 1;
  }
  .bottom-nav .bn-item.active .bn-icon.material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  }
  /* Czysto: na bardzo wąskich ekranach pokazuj si─ę tylko ikony (bez etykiet) */
  @media (max-width: 480px) {
    .bottom-nav .bn-item .bn-label { display: none; }
    .bottom-nav .bn-item .bn-icon { font-size: 1.4rem; }
  }

  .bottom-more-menu {
    background: var(--stitch-surface-deep);
    border: 1px solid var(--stitch-surface-light);
    border-radius: var(--stitch-radius-card);
    box-shadow: none;
  }
  .bottom-more-link {
    color: var(--stitch-on-surface-variant);
    font-family: var(--stitch-font-body);
  }
  .bottom-more-link:hover,
  .bottom-more-link:focus { background: var(--stitch-surface-bright); color: var(--stitch-on-surface); outline: none; }
  .bottom-more-link.active { color: var(--stitch-primary); background: var(--stitch-primary-container); }
  .bottom-more-danger { color: var(--stitch-danger); }

  /* Dół strony pod fixed bottom-nav */
  .app-shell #app-content,
  section#app-shell main,
  section#app-shell main#app-content { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* === SZERSZY KONTENER APLIKACJI (wzorzec budget_dashboard_desktop, max-w-7xl=1280px) ===
   Tylko wewnątrz app-shell (dashboard, wydatki, itd.) — nie dotyczy strony głównej/landing. */
section#app-shell main#app-content {
  max-width: var(--stitch-container-max, 1280px) !important;
  padding-top: var(--stitch-spacing-4);
}
#app-shell main#app-content .view-tab {
  max-width: 100%;
}
@media (min-width: 1024px) {
  section#app-shell main#app-content {
    padding-left: var(--stitch-margin-desktop, 48px) !important;
    padding-right: var(--stitch-margin-desktop, 48px) !important;
  }
}
@media (max-width: 1023px) {
  section#app-shell main#app-content {
    padding-left: var(--stitch-margin-mobile, 16px) !important;
    padding-right: var(--stitch-margin-mobile, 16px) !important;
  }
}

/* === TOASTS / DIALOGS === */
#toast-container .toast { border-radius: var(--stitch-radius-card); }
#app-shell dialog,
#app-shell .modal {
  background: var(--stitch-surface-deep);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
}
#app-shell dialog h2,
#app-shell dialog h3 { font-family: var(--stitch-font-display); color: var(--stitch-on-surface); }

/* === DEFERRED: celowo nie dotykamy sekcji publicznej (landing) === */
/* ETAP 3 przyniesie własny arkusz landing-stylu. */

/* =====================================================
   ETAP 6 — Centralny przycisk „+ (FAB) + bottom sheet
   ===================================================== */
/* FAB w dolnej nawigacji mobile */
.bn-fab-wrap { display: flex; align-items: center; justify-content: center; flex: 1; }
.bn-fab {
  width: 56px; height: 56px;
  border-radius: var(--stitch-radius-full);
  background: var(--stitch-primary);
  color: var(--stitch-on-primary);
  border: 2px solid var(--stitch-surface-container);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--stitch-font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: transform .15s ease, box-shadow .15s ease;
}
.bn-fab:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(136,217,130,0.2); }
.bn-fab:active { transform: scale(0.96); }
.bn-fab[aria-expanded="true"] { transform: rotate(45deg); }

/* Bottom sheet (mobile) — szybkie dodawanie */
#add-quick-menu.bottom-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1003;
  margin: 0 auto;
  max-width: 480px;
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-top-left-radius: var(--stitch-radius-xl);
  border-top-right-radius: var(--stitch-radius-xl);
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 32px rgba(0,0,0,0.35);
  font-family: var(--stitch-font-body);
}
#add-quick-menu.bottom-sheet[hidden] { display: none; }
.bottom-sheet-handle {
  width: 44px; height: 4px;
  border-radius: 4px;
  background: var(--stitch-surface-bright);
  margin: 4px auto 10px;
}
.bottom-sheet-title {
  text-align: center;
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md);
  font-weight: 600;
  color: var(--stitch-on-surface);
  margin: 0 0 12px;
}
.bottom-sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.sheet-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--stitch-surface-container);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  cursor: pointer;
  min-height: 64px;
}
.sheet-option:hover { border-color: var(--stitch-primary); color: var(--stitch-primary); }
.sheet-option .sheet-icon { font-size: 24px; }
.bottom-sheet-close {
  margin-top: 12px;
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--stitch-on-surface-variant);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.bottom-sheet-close:hover { background: var(--stitch-surface-bright); }

.app-header .lang-selector { display: inline-flex; }

/* ------------------------------------------------------------
   WYBÓR JĘZYKA PL/EN — dyskretny, spójny z ciemnym UI
   - desktop: przycisk „🌐 PL ▾" + popover
   - mobile:  przycisk „🌐" + bottom sheet
   Wykorzystuje istniejące tokeny Stitch (bez nowych kolorów).
   ------------------------------------------------------------ */
.lang-selector { position: relative; flex-shrink: 0; }

.lang-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;                 /* touch target mobile */
  padding: 0 10px;
  background: var(--stitch-surface-container);
  color: var(--stitch-on-surface);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.lang-selector-btn:hover { background: var(--stitch-surface-container-high); border-color: var(--stitch-surface-bright); }
.lang-selector-btn:active { transform: scale(0.97); }
.lang-selector-btn:focus-visible { outline: 2px solid var(--stitch-primary); outline-offset: 2px; }
.lang-selector-btn[aria-expanded="true"] { border-color: var(--stitch-primary); }

.lang-globe { font-size: 15px; line-height: 1; }
.lang-code   { text-transform: uppercase; font-weight: 700; }
.lang-caret  { font-size: 10px; color: var(--stitch-on-surface-variant); }

/* Chip: na bardzo małych ekranach pokaż tylko ikonę globusa */
@media (max-width: 419px) {
  .lang-selector-btn .lang-code,
  .lang-selector-btn .lang-caret { display: none; }
  .lang-selector-btn { padding: 0 9px; }
}

/* Popover (desktop) */
.lang-popover {
  position: absolute;
  z-index: 1100;
  min-width: 180px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-card);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  font-family: var(--stitch-font-body);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.lang-popover.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.lang-popover-title {
  padding: 8px 10px 6px;
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  background: transparent;
  border: none;
  border-radius: var(--stitch-radius-btn);
  color: var(--stitch-on-surface);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.lang-option:hover { background: var(--stitch-surface-container-high); }
.lang-option.active {
  color: var(--stitch-primary);
  font-weight: 700;
}
.lang-option.active .lang-option-check { color: var(--stitch-primary); }
.lang-option:focus-visible { outline: 2px solid var(--stitch-primary); outline-offset: -1px; }
.lang-option-check { width: 14px; display: inline-block; text-align: center; font-weight: 700; }

/* Bottom sheet (mobile) */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 1002;
  background: rgba(0,0,0,0.55);
  animation: sheetFadeIn 0.18s ease;
}
@keyframes sheetFadeIn { from { opacity: 0; } to { opacity: 1; } }

.language-sheet {
  z-index: 1003;
}
/* Bottom sheet języka — pozycjonowanie mobilne (jak #add-quick-menu.bottom-sheet) */
.language-sheet.bottom-sheet,
.language-sheet.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  max-width: 480px;
  background: var(--stitch-surface-deep);
  border: 1px solid var(--stitch-surface-light);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.75);
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
.language-sheet-list { display: flex; flex-direction: column; gap: 4px; padding: 4px 0 8px; }
.language-sheet .lang-option {
  padding: 14px 12px;
  border: 1px solid transparent;
  border-radius: var(--stitch-radius-card);
}
.language-sheet .lang-option:hover { border-color: var(--stitch-surface-light); background: var(--stitch-surface-container-high); }

/* Wyłącz animacje dla prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .lang-popover, .language-sheet, .bottom-sheet-overlay, .lang-selector-btn { transition: none !important; animation: none !important; }
}

/* ETAP 10b — selektor języka i piktogramy: czytelnie, bez czarnego tła pod globem */
.material-symbols-outlined,
.material-symbols-outlined.filled-icon {
  font-feature-settings: "liga";
  text-shadow: none;
}

.material-symbols-outlined.filled-icon {
  font-variation-settings: "FILL" 1, "wght" 560, "GRAD" 0, "opsz" 24;
}

.lang-selector-btn {
  justify-content: center;
  min-width: 68px;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: var(--stitch-on-surface) !important;
}

.lang-selector-btn:hover,
.lang-selector-btn:focus-visible {
  background: rgba(136, 217, 130, 0.08) !important;
  border-color: var(--stitch-outline-variant) !important;
}

.lang-selector-btn[aria-expanded="true"] {
  background: #16201a !important;
  border-color: #2e7d32 !important;
}

.lang-globe {
  color: var(--stitch-primary) !important;
  font-family: "Material Symbols Outlined" !important;
  font-size: 22px !important;
  line-height: 1 !important;
}

.lang-code {
  color: var(--stitch-on-surface) !important;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.lang-caret {
  color: var(--stitch-on-surface-variant) !important;
  font-family: "Material Symbols Outlined" !important;
  font-size: 18px !important;
  line-height: 1 !important;
}

.lang-popover {
  z-index: 5000;
  min-width: 220px;
  padding: 8px;
  background: #111418 !important;
  border: 1px solid #40493d !important;
  border-radius: 8px !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
  transform: translateY(-4px);
}

.lang-popover,
.lang-popover *,
.language-sheet,
.language-sheet * {
  text-shadow: none !important;
}

.lang-popover-title {
  padding: 8px 10px 10px;
  color: #bfcaba !important;
  font-size: 11px;
}

.lang-option {
  min-height: 50px;
  gap: 12px;
  padding: 10px 12px !important;
  background: #0a0c10 !important;
  border: 1px solid #1b2026 !important;
  border-radius: 6px !important;
  color: #e0e4da !important;
}

.lang-option + .lang-option {
  margin-top: 6px;
}

.lang-option:hover,
.lang-option:focus-visible {
  background: #181d17 !important;
  border-color: #40493d !important;
  color: #ffffff !important;
}

.lang-option.active {
  background: #16201a !important;
  border-color: #2e7d32 !important;
  color: #88d982 !important;
}

.lang-option-check {
  width: 22px !important;
  height: 22px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: #88d982 !important;
  font-family: "Material Symbols Outlined" !important;
  font-size: 20px !important;
  line-height: 1;
}

.lang-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lang-option-code {
  color: #e0e4da;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.lang-option-name {
  color: #bfcaba;
  font-size: 12px;
  font-weight: 600;
}

.bottom-sheet-overlay {
  background: rgba(0, 0, 0, 0.76) !important;
  backdrop-filter: none !important;
}

.language-sheet.bottom-sheet,
.language-sheet {
  background: #111418 !important;
  border: 1px solid #40493d !important;
  border-bottom: 0 !important;
  border-radius: 12px 12px 0 0 !important;
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.75) !important;
}

.language-sheet-list {
  gap: 8px;
}

.bottom-sheet-close {
  background: #0a0c10 !important;
  border-color: #40493d !important;
  color: #e0e4da !important;
}

/* ============================================================
   Tło strony jest ciemne, a część sekcji (tool cards, blog, FAQ,
   porównanie, warianty PSEO) dziedziczy ciemne tło, choć ich tekst
   był zaprojektowany pod tło jasne → szare/ciemne napisy ledwo
   widoczne. Nadpisujemy tylko elementy w CIEMNYCH sekcjach na jasne,
   NIE ruszając kart z białym tłem (kalkulatory miasto/energia) —
   tam oryginalne ciemne kolory (#212121 na #fff) są prawidłowe.
   ============================================================ */

/* Karty narzędzi w sekcji „Najczęściej wybierane" (tło ciemne rgb(24,29,23)) */
#view-landing .tool-card-title { color: #eef4ea; }
#view-landing .featured-tools-section p,
#view-landing .featured-tools-section li { color: #c6cfc1; }
#view-landing .tool-card { background: var(--stitch-surface-container); }

/* Blog — tytuły, opisy, meta, kategorie (sekcja transparentna = ciemne tło) */
#view-landing .blog-preview-section h3.lbc-title { color: #eef4ea; }
#view-landing .lbc-desc { color: #c6cfc1; }
#view-landing .lbc-meta { color: #aeb9b0; }
#view-landing .lbc-category { color: #ffb4a8; }

/* Challenge Budżetowy (chf) — nagłówki, listy, akcenty */
#view-landing .chf h3,
#view-landing .chf p,
#view-landing .chf li,
#view-landing .challenge-rules li { color: #c6cfc1; }
#view-landing .chf-cat,
#view-landing .chf-play { color: var(--stitch-primary); }

/* FAQ — kolorowe „+” były ciemnoniebieskie na ciemnym tle */
#view-landing .faq-toggle-icon { color: #8ab4ff; }

/* Sekcja porównania / „Zacznij bez rejestracji" + warianty PSEO */
#view-landing .compare-section h2.section-title,
#view-landing .compare-section p,
#view-landing .pseo-variants-section h2,
#view-landing .pseo-variants-section p { color: #eef4ea; }
#view-landing .compare-section h2.section-title { text-wrap: balance; }

/* „Zacznij bez rejestracji" / CTA gościa → biały, wyraźny, w kontrastowym tle */
#view-landing .entry-point-cta,
#view-landing a.entry-point-cta,
#view-landing .btn-hero-primary,
#view-landing a.btn-hero-primary {
  color: #ffffff;
  font-weight: 700;
}
#view-landing .btn-hero-primary,
#view-landing a.btn-hero-primary { background: #2f7f4f; }

/* Większa i jaśniejsza czcionka nagłówków kart narzędzi */
#view-landing .tool-card-title,
#view-landing h3.lbc-title {
  font-size: 18px;
}
#view-landing h3.lbc-title { font-size: 20px; }
.fhs-empty {
  background: var(--stitch-surface-container);
  color: var(--stitch-on-surface-variant);
  border: 1px solid var(--stitch-outline-variant);
  border-radius: var(--stitch-radius-btn);
  padding: var(--stitch-spacing-3) var(--stitch-spacing-3);
  font-family: var(--stitch-font-body);
  font-size: 13px;
  line-height: 1.5;
}
.fhs-compact { display: flex; flex-direction: column; gap: 12px; }
.fhs-score-display {
  display: flex;
  align-items: baseline;
  gap: var(--stitch-spacing-2);
  /* wzorzec hero-score z landing (tylko mniejsza, zachowana wielkość) */
  border-bottom: 1px solid var(--stitch-outline-variant);
  padding-bottom: var(--stitch-spacing-4);
}
.fhs-score-display .fhs-result-score {
  font-family: var(--stitch-font-body) !important;
  font-size: 48px !important;
  line-height: 1;
  font-weight: 700;
  color: var(--stitch-primary) !important;
  /* usuń starą "kulę": brak tła, okrągłości i wymiarów */
  width: auto !important;
  height: auto !important;
  min-width: 0;
  background: transparent !important;
  border-radius: 0 !important;
  display: inline !important;
}
.fhs-score-display .fhs-result-score::after { content: none !important; }
.fhs-score-unit {
  font-family: var(--stitch-font-body);
  font-size: 24px !important;
  color: var(--stitch-on-surface-variant);
  font-weight: 600;
}
.fhs-score-verdict { font-family: var(--stitch-font-body); font-size: var(--stitch-font-body-lg); color: var(--stitch-on-surface); font-weight: 600; }
.fhs-components-compact { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fhs-components-compact li { font-family: var(--stitch-font-body); font-size: 13px; color: var(--stitch-on-surface-variant); }
.fhs-components-compact li strong { color: var(--stitch-on-surface); }
.fhs-compact-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.fhs-disclaimer { font-size: 11px; color: var(--stitch-neutral-slate); margin: 0; }

/* Style list celów (ETAP 5) */
.goal-item { display: flex; flex-direction: column; gap: 6px; }
.goal-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.goal-line strong { color: var(--stitch-on-surface); }
.goal-meta { display: flex; justify-content: space-between; align-items: center; color: var(--stitch-on-surface-variant); font-size: 12px; }
.cat-progress-bar { height: 6px; background: var(--stitch-surface-container); border-radius: 4px; overflow: hidden; }
.cat-progress-fill { height: 100%; background: var(--stitch-primary-container); border-radius: 4px; transition: width .3s ease; }

/* === ETAP 10 POLISH: ostrzejszy, bardziej czytelny dashboard === */
#app-shell .app-header,
#app-shell .tab-nav,
#tab-nav {
  backdrop-filter: blur(12px);
}
#app-shell .brand {
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255,255,255,0.08);
}
.tab-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  letter-spacing: 0;
}
.tab-nav a:hover,
.tab-nav a:focus-visible {
  background: var(--stitch-surface-container);
  border-left-color: var(--stitch-outline-variant);
  border-right-color: var(--stitch-outline-variant);
  outline: none;
}
.tab-nav a.active {
  background: linear-gradient(180deg, rgba(46,125,50,0.18), rgba(46,125,50,0.04));
}
#app-shell .summary-card .card-meter,
#app-shell .summary-card .card-meter-fill,
#app-shell .progress-bar,
#app-shell .progress-fill,
.cat-progress-bar,
.cat-progress-fill {
  border-radius: 0 !important;
}
#app-shell .summary-card .card-meter {
  height: 3px;
}
#app-shell .card,
#app-shell .summary-card,
#app-shell .chart-card,
#app-shell .settings-section,
#app-shell .entry-item {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025);
}
#app-shell .summary-card .card-value,
#app-shell .entry-item .entry-amount,
#app-shell .stat-value,
#app-shell .points-value,
#app-shell .result-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
#app-shell table,
#app-shell .comparison-table table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--stitch-outline-variant);
  background: var(--stitch-surface-deep);
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-body);
  font-variant-numeric: tabular-nums;
}
#app-shell th,
#app-shell .comparison-table th {
  background: var(--stitch-surface-container-high);
  color: var(--stitch-primary);
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#app-shell td,
#app-shell .comparison-table td {
  color: var(--stitch-on-surface-variant);
  border-bottom: 1px solid var(--stitch-outline-variant);
}
#app-shell th,
#app-shell td {
  padding: 12px 14px;
}
#bottom-nav .bn-item,
.bottom-nav .bn-item {
  border: 1px solid transparent;
}
#bottom-nav .bn-item:hover,
.bottom-nav .bn-item:hover {
  border-color: var(--stitch-outline-variant);
}
#bottom-nav .bn-item.active,
.bottom-nav .bn-item.active {
  border-color: var(--stitch-primary-container);
}

/* ETAP 10c — selektor miesiąca przeniesiony do menu */
#tab-nav {
  align-items: center;
  gap: 0;
  padding-right: var(--stitch-spacing-3);
}

#tab-nav .global-month-selector {
  align-self: center;
  flex: 0 0 auto;
  min-height: 44px;
  margin: 0 var(--stitch-spacing-3);
  padding: 4px;
  gap: 4px;
  background: #111418 !important;
  border: 1px solid #40493d !important;
  border-radius: 8px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04) !important;
}

#tab-nav .global-month-selector[hidden] {
  display: none !important;
}

#tab-nav .global-month-selector .btn-icon {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  color: #bfcaba !important;
  box-shadow: none !important;
}

#tab-nav .global-month-selector .btn-icon:hover,
#tab-nav .global-month-selector .btn-icon:focus-visible {
  background: rgba(136, 217, 130, 0.08) !important;
  border-color: #2e7d32 !important;
  color: #88d982 !important;
  outline: none;
}

#tab-nav .global-month-selector .btn-icon:disabled {
  opacity: 0.55;
  cursor: wait;
}

#tab-nav .global-month-selector .btn-icon .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
}

#tab-nav .global-month-selector .month-label {
  min-width: 148px;
  padding: 0 var(--stitch-spacing-2);
  color: #e0e4da !important;
  font-family: var(--stitch-font-display) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 36px;
  letter-spacing: 0;
  text-align: center;
  text-transform: capitalize;
  white-space: nowrap;
}

@media (max-width: 768px) {
  /* Mobile: menu przeniesione do dolnej nawigacji — ukrywamy górne tab-nav w całości */
  #tab-nav {
    display: none !important;
  }

  /* Selektor miesiąca na końcu treści (przenoszony tam w app.js) */
  #global-month-selector.month-selector {
    width: min(100%, 360px);
    min-height: 46px;
    margin: var(--stitch-spacing-4) auto var(--stitch-spacing-6) !important;
    justify-content: space-between;
  }
  #global-month-selector.month-selector .btn-icon {
    width: 42px;
    height: 38px;
    min-height: 38px;
  }
  #global-month-selector.month-selector .month-label {
    flex: 1;
    min-width: 0;
    font-size: 14px !important;
    line-height: 38px;
  }
}

/* ETAP 10c — local-first: osiągnięcia i para */
#app-shell .achievements-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

#app-shell .achievement-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--stitch-spacing-2);
  padding: var(--stitch-spacing-4);
  position: relative;
  color: var(--stitch-on-surface);
}

#app-shell .achievement-card.unlocked {
  border-color: #2e7d32;
  background: #16201a;
}

#app-shell .achievement-card.locked {
  opacity: 1;
  filter: none;
}

#app-shell .achievement-card.locked .achievement-icon,
#app-shell .achievement-card.locked .achievement-name,
#app-shell .achievement-card.locked .achievement-desc {
  opacity: 0.58;
}

#app-shell .achievement-icon,
#app-shell .achievement-unlock-icon {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: #111418;
  border: 1px solid #40493d;
  border-radius: 8px;
  color: #bfcaba;
  font-family: "Material Symbols Outlined";
  font-size: 30px;
  font-feature-settings: "liga";
  font-variation-settings: "FILL" 1, "wght" 560, "GRAD" 0, "opsz" 30;
  line-height: 1;
  text-shadow: none;
}

#app-shell .achievement-card.unlocked .achievement-icon,
#app-shell .achievement-unlock-icon {
  background: #0a0c10;
  border-color: #2e7d32;
  color: #88d982;
}

#app-shell .achievement-name {
  color: var(--stitch-on-surface);
  font-family: var(--stitch-font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

#app-shell .achievement-desc {
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-body);
  font-size: 13px;
  line-height: 1.45;
}

#app-shell .achievement-unlocked-badge,
#app-shell .achievement-locked-badge {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #40493d;
  border-radius: 6px;
  color: #bfcaba;
  font-family: var(--stitch-font-body);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#app-shell .achievement-unlocked-badge {
  border-color: #2e7d32;
  color: #88d982;
}

#app-shell .pair-local-card {
  display: grid;
  gap: var(--stitch-spacing-3);
  max-width: 100%;             /* pełna szerokość jak dashboard (było 760px) */
  background: #111418;
  border-color: #40493d;
}

#app-shell .pair-local-card h3 {
  margin: 0;
  color: var(--stitch-on-surface);
  font-family: var(--stitch-font-display);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.15;
}

#app-shell .pair-local-card p {
  margin: 0;
  color: var(--stitch-on-surface-variant);
  line-height: 1.6;
}

#app-shell .pair-local-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--stitch-spacing-2);
}

#app-shell .pair-local-actions .referral-input {
  flex: 1 1 240px;
  min-height: 44px;
}

#app-shell .pair-local-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--stitch-spacing-2);
}

#app-shell .pair-local-grid > div {
  min-height: 88px;
  padding: var(--stitch-spacing-3);
  background: #0a0c10;
  border: 1px solid #1b2026;
  border-radius: 8px;
}

#app-shell .pair-local-grid span {
  display: block;
  margin-bottom: 8px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#app-shell .pair-local-grid strong {
  color: #e0e4da;
  font-family: var(--stitch-font-display);
  font-size: 17px;
  line-height: 1.25;
}

#app-shell .pair-local-danger {
  color: #ffb4ab !important;
  border-color: #93000a !important;
}

@media (max-width: 720px) {
  #app-shell .achievements-grid {
    grid-template-columns: 1fr;
  }

  #app-shell .achievement-card {
    min-height: 0;
  }

  #app-shell .pair-local-actions,
  #app-shell .pair-local-actions .btn-primary,
  #app-shell .pair-local-actions .btn-secondary,
  #app-shell .pair-local-actions .btn-ghost {
    width: 100%;
  }

  #app-shell .pair-local-grid {
    grid-template-columns: 1fr;
  }
}
