/* =====================================================
   Finanse Bez Owijania — Stitch Subpages (ETAP 8b)
   Warstwa wizualna dla niezależnych, indeksowanych podstron,
   które mają własne, osobne dokumenty HTML i style:
     /privacy.html, /terms.html, /tools/*, /blog/* (osobny etap)
   Zasady identyczne jak w głównych etapach:
   Stitch = wzorzec UI, logika i treść (SEO) bez zmian.
   Nadpisujemy wygląd przez CSS po oryginalnych arkuszach.
   ===================================================== */

/* === STRONY PRAWNE (privacy/terms) === */
.privacy-page,
.terms-container {
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-body);
}
.privacy-page h1,
.terms-container h1 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-lg) !important;
  color: var(--stitch-primary) !important;
}
.privacy-page h2,
.terms-container h2 {
  font-family: var(--stitch-font-display);
  font-size: var(--stitch-font-display-md) !important;
  color: var(--stitch-on-surface) !important;
  border-left-color: var(--stitch-primary) !important;
}
.privacy-page h3,
.terms-container h3 {
  font-family: var(--stitch-font-display);
  color: var(--stitch-on-surface) !important;
}
.privacy-page p,
.privacy-page li,
.terms-container p,
.terms-container li {
  color: var(--stitch-on-surface-variant) !important;
  line-height: 1.7;
}
.privacy-page a,
.terms-container a { color: var(--stitch-primary) !important; }
.privacy-page .updated { color: var(--stitch-neutral-slate) !important; }

.privacy-nav,
.terms-nav,
.nav-privacy,
.nav-terms {
  background: var(--stitch-surface-container) !important;
  color: var(--stitch-on-surface) !important;
  border-bottom: 1px solid var(--stitch-outline-variant);
  box-shadow: none !important;
}
.privacy-nav a,
.terms-nav a,
.nav-privacy a,
.nav-terms a {
  color: var(--stitch-primary) !important;
}

/* === STRONA / BODY PODSTRON === */
body.body-subpage { background: var(--stitch-bg) !important; color: var(--stitch-on-background) !important; }
.privacy-page { background: transparent !important; }
.main-content,
.container.content { background: transparent !important; }

/* === TOOLS HUB (index) + strony narzędzi ===
   tools/_common.css redefiniuje jasne tokeny w :root — nadpisujemy
   istniejące zmienne (a nie tylko .tools-*), żeby wszystko, co ich
   używa, przeszło na ciemny motyw bez dotykania każdej strony. */
body {
  --primary: #88d982 !important;
  --primary-dark: #1b6d24 !important;
  --primary-light: #a3f69c !important;
  --primary-pale: #16201a !important;
  --accent: #ffb1c7 !important;
  --success: #10B981 !important;
  --success-pale: #16201a !important;
  --warning: #F59E0B !important;
  --warning-pale: #262b10 !important;
  --danger: #F43F5E !important;
  --danger-pale: #2a161b !important;
  --text: #e0e4da !important;
  --text-secondary: #bfcaba !important;
  --text-inverse: #e0e4da !important;
  --bg: #10150f !important;
  --bg-card: #111418 !important;
  --border: #40493d !important;
  --shadow: none !important;
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.4) !important;
  --radius: 8px !important;
  --radius-sm: 4px !important;
  --font: "JetBrains Mono", ui-monospace, monospace !important;
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif !important;
}
body {
  background: var(--stitch-bg) !important;
  color: var(--stitch-on-background) !important;
  font-family: var(--stitch-font-body) !important;
}

.material-symbols-outlined,
.filled-icon {
  font-family: 'Material Symbols Outlined' !important;
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

.tools-nav,
.tools-header,
.hub-nav {
  background: var(--stitch-surface-container) !important;
  color: var(--stitch-on-surface) !important;
  box-shadow: none !important;
}
.tools-nav-brand,
.hub-nav-brand {
  color: var(--stitch-on-surface) !important;
  font-family: var(--stitch-font-display);
}
.tools-nav a,
.hub-nav a { color: var(--stitch-on-surface-variant) !important; }
.tools-nav a:hover,
.hub-nav a:hover { color: var(--stitch-primary) !important; }

.tools-container,
.hub-container,
.tool-page {
  background: transparent !important;
}
.tool-card,
.tools-card,
.hub-card,
.tool-result-card {
  background: var(--stitch-surface-deep) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  border-radius: var(--stitch-radius-card) !important;
  box-shadow: none !important;
  color: var(--stitch-on-surface) !important;
}
.tool-card:hover,
.tools-card:hover,
.hub-card:hover { box-shadow: none !important; border-color: var(--stitch-primary) !important; }
.tool-card h2,
.tool-card h3,
.tools-card h2,
.tools-card h3,
.hub-card h2,
.hub-card h3 {
  font-family: var(--stitch-font-display) !important;
  color: var(--stitch-on-surface) !important;
}
.tool-card p,
.tools-card p,
.hub-card p {
  color: var(--stitch-on-surface-variant) !important;
  font-family: var(--stitch-font-body);
}

/* Inputy / formularze w narzędziach */
.tool-page input,
.tool-page select,
.tools-container input,
.tools-container select,
.tools-search {
  background: var(--stitch-terminal-black) !important;
  color: var(--stitch-on-surface) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  border-radius: var(--stitch-radius-btn) !important;
  font-family: var(--stitch-font-body) !important;
}
.tool-page input:focus,
.tool-page select:focus,
.tools-container input:focus,
.tools-container select:focus,
.tools-search:focus {
  border-color: var(--stitch-primary) !important;
  outline: none !important;
  box-shadow: 0 0 0 1px var(--stitch-primary-container) !important;
}
.tools-search { color: var(--stitch-on-surface) !important; }

/* Tabele w narzędziach / hub */
.tool-page table,
.tools-container table,
.hub-container table {
  background: var(--stitch-surface-deep) !important;
  color: var(--stitch-on-surface-variant) !important;
  border-color: var(--stitch-outline-variant) !important;
}
.tool-page th,
.tools-container th,
.hub-container th {
  background: var(--stitch-surface-container-high) !important;
  color: var(--stitch-primary) !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--stitch-font-label-caps);
  font-family: var(--stitch-font-body);
}
.tool-page td,
.tools-container td,
.hub-container td {
  background: var(--stitch-surface-container) !important;
  color: var(--stitch-on-surface-variant) !important;
  border-color: var(--stitch-outline-variant) !important;
}

/* Filtry / pigułki kategorii */
.tools-filters button,
.hub-filters button,
.tool-page .filter-btn,
.pill-btn {
  background: var(--stitch-surface-deep) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  color: var(--stitch-on-surface-variant) !important;
  border-radius: var(--stitch-radius-full) !important;
  font-family: var(--stitch-font-body) !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--stitch-font-label-caps);
}
.filter-count {
  background: var(--stitch-surface-container) !important;
  color: var(--stitch-on-surface-variant) !important;
  border: 1px solid var(--stitch-outline-variant) !important;
}
.tools-filters button:hover,
.hub-filters button:hover,
.tool-page .filter-btn:hover,
.pill-btn:hover { border-color: var(--stitch-outline-variant) !important; color: var(--stitch-on-surface) !important; }
.tools-filters button.active,
.hub-filters button.active,
.tool-page .filter-btn.active,
.pill-btn.active {
  border-color: var(--stitch-primary) !important;
  background: var(--stitch-primary-container) !important;
  color: var(--stitch-on-primary-container) !important;
}
.tools-filters button.active .filter-count,
.hub-filters button.active .filter-count,
.tool-page .filter-btn.active .filter-count,
.pill-btn.active .filter-count {
  background: rgba(0, 0, 0, 0.25) !important;
  border-color: rgba(203, 255, 194, 0.4) !important;
  color: var(--stitch-on-primary-container) !important;
}

/* WHITE background boxes wewnątrz narzędzi (przeł. jasne) */
.tool-page .white-box,
.tools-container .white-box,
.tool-page .bg-white,
.tools-container .bg-white,
.result-box,
.calc-result {
  background: var(--stitch-surface-container) !important;
  color: var(--stitch-on-surface) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  border-radius: var(--stitch-radius-card) !important;
}

/* Stopka narzędzi */
.tools-footer,
.hub-footer {
  background: var(--stitch-surface-container-lowest) !important;
  color: var(--stitch-on-surface-variant) !important;
  border-top: 1px solid var(--stitch-outline-variant) !important;
}
.tools-footer a,
.hub-footer a { color: var(--stitch-on-surface-variant) !important; }
.tools-footer a:hover,
.hub-footer a:hover { color: var(--stitch-primary) !important; }

/* === ETAP 10 POLISH: /tools/ bliżej wzorca calculators_directory === */
.tools-nav {
  min-height: var(--stitch-nav-height);
  padding: 0 !important;
  border-bottom: 1px solid var(--stitch-outline-variant) !important;
  background: rgba(16, 21, 15, 0.96) !important;
  backdrop-filter: blur(12px);
}
.tools-nav-inner {
  width: 100%;
  max-width: var(--stitch-container-max);
  min-height: var(--stitch-nav-height);
  margin: 0 auto;
  padding: 0 var(--stitch-margin-mobile);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--stitch-spacing-4);
}
@media (min-width: 768px) {
  .tools-nav-inner { padding: 0 var(--stitch-margin-desktop); }
}
.tools-nav-brand {
  color: var(--stitch-on-surface) !important;
  font-family: var(--stitch-font-display) !important;
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255,255,255,0.08);
}
.tools-nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--stitch-spacing-3) !important;
}
.tools-nav-links a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: var(--stitch-spacing-1);
  border: 1px solid transparent;
  border-radius: var(--stitch-radius-btn);
  padding: 0 var(--stitch-spacing-2);
  color: var(--stitch-on-surface-variant) !important;
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-body-md);
  text-decoration: none !important;
}
.tools-nav-links a:hover,
.tools-nav-links a:focus-visible {
  color: var(--stitch-primary) !important;
  border-color: var(--stitch-outline-variant);
  background: var(--stitch-surface-container);
  text-decoration: none !important;
  outline: none;
}
.tools-nav-links a[aria-current="page"] {
  color: var(--stitch-primary) !important;
  font-weight: 700;
}
.tools-nav-links .nav-icon {
  font-size: 18px;
}
.tools-hub-header {
  max-width: var(--stitch-container-max);
  margin: 0 auto;
  padding: 56px var(--stitch-margin-mobile) var(--stitch-spacing-2) !important;
  background: transparent !important;
  color: var(--stitch-on-surface) !important;
  text-align: left !important;
}
@media (min-width: 768px) {
  .tools-hub-header { padding-left: var(--stitch-margin-desktop) !important; padding-right: var(--stitch-margin-desktop) !important; }
}
.tools-hub-header h1 {
  margin: 0 0 var(--stitch-spacing-2) !important;
  color: var(--stitch-on-surface) !important;
  font-family: var(--stitch-font-display) !important;
  font-size: clamp(36px, 4vw, 48px) !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  letter-spacing: -0.02em !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.08);
}
.tools-hub-header p {
  max-width: 672px;
  margin: 0 0 var(--stitch-spacing-5) !important;
  color: var(--stitch-on-surface-variant) !important;
  font-family: var(--stitch-font-body) !important;
  font-size: 18px !important;
  line-height: 1.6 !important;
}
.tools-search-wrap {
  width: min(100%, 672px);
  margin-left: 0 !important;
  margin-right: 0 !important;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--stitch-spacing-3);
  background: var(--stitch-surface-deep) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  border-radius: var(--stitch-radius-btn) !important;
  padding: 0 var(--stitch-spacing-3) !important;
}
.tools-search-icon {
  position: static !important;
  transform: none !important;
  color: var(--stitch-on-surface-variant) !important;
  font-size: 22px !important;
  flex: none;
}
.tools-search {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: 14px !important;
}
.tools-search::placeholder { color: var(--stitch-neutral-slate) !important; }
.tools-filters {
  max-width: var(--stitch-container-max);
  margin: 0 auto var(--stitch-spacing-5) !important;
  padding: 0 var(--stitch-margin-mobile) !important;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--stitch-spacing-2) !important;
}
@media (min-width: 768px) {
  .tools-filters { padding-left: var(--stitch-margin-desktop) !important; padding-right: var(--stitch-margin-desktop) !important; }
}
.tools-filters button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: var(--stitch-spacing-2);
  border-radius: var(--stitch-radius-full) !important;
  padding: 0 var(--stitch-spacing-3) !important;
  text-transform: none !important;
  letter-spacing: 0.1em !important;
}
.tools-filters .filter-icon {
  font-size: 18px !important;
  color: inherit;
}
.tools-grid {
  max-width: var(--stitch-container-max);
  margin: 0 auto var(--stitch-spacing-6) !important;
  padding: 0 var(--stitch-margin-mobile) !important;
  display: grid !important;
  grid-template-columns: 1fr;
  gap: var(--stitch-spacing-gutter) !important;
}
@media (min-width: 768px) {
  .tools-grid {
    padding-left: var(--stitch-margin-desktop) !important;
    padding-right: var(--stitch-margin-desktop) !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 1120px) {
  .tools-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
.tools-grid .tool-card {
  position: relative;
  min-height: 258px;
  display: flex !important;
  flex-direction: column;
  align-items: flex-start !important;
  gap: var(--stitch-spacing-3) !important;
  padding: var(--stitch-spacing-4) !important;
  text-align: left !important;
  text-decoration: none !important;
  transition: border-color .15s ease, background-color .15s ease !important;
}
.tools-grid .tool-card:hover {
  background: var(--stitch-surface-container-low) !important;
}
.tools-grid .tool-card-icon,
.related-card-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--stitch-surface-container);
  border: 1px solid var(--stitch-surface-light);
  border-radius: var(--stitch-radius-btn);
  color: var(--stitch-primary);
  font-size: 27px !important;
  flex: none;
}
.tools-grid .tool-card h2,
.tools-grid .tool-card h3 {
  margin: var(--stitch-spacing-2) 0 0 !important;
  color: var(--stitch-on-surface) !important;
  font-family: var(--stitch-font-display) !important;
  font-size: clamp(24px, 2vw, 32px) !important;
  line-height: 1.18 !important;
  letter-spacing: 0 !important;
}
.tools-grid .tool-card p {
  margin: 0 !important;
  color: #d1dacb !important;
  font-size: 16px !important;
  line-height: 1.55 !important;
}
.tools-grid .tool-card-cta {
  margin-top: auto;
  padding-top: var(--stitch-spacing-3);
  width: 100%;
  border-top: 1px solid var(--stitch-outline-variant);
  color: var(--stitch-primary) !important;
  font-family: var(--stitch-font-body);
  font-size: var(--stitch-font-label-caps);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tools-grid .tool-card-header {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--stitch-spacing-3);
}
.tool-badge-popular {
  position: static;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--stitch-spacing-1);
  background: var(--stitch-surface-container) !important;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: var(--stitch-radius-btn);
  color: var(--stitch-on-surface-variant) !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 8px;
}
.tool-badge-popular .material-symbols-outlined {
  font-size: 15px;
  color: var(--stitch-tertiary);
}
.tool-page h1,
.tool-page h2,
.tool-header h1 {
  letter-spacing: 0 !important;
}
.tool-page table,
.tools-container table,
.hub-container table,
.comparison-table table {
  border-collapse: collapse !important;
  font-variant-numeric: tabular-nums;
}
.tool-page th,
.tools-container th,
.hub-container th,
.comparison-table th,
.tool-page td,
.tools-container td,
.hub-container td,
.comparison-table td {
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--stitch-outline-variant) !important;
  line-height: 1.45;
}
.result-value,
.tool-page output,
.calc-result strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
@media (max-width: 640px) {
  .tools-hub-header h1 { font-size: clamp(30px, 9vw, 40px) !important; }
  .tools-grid .tool-card { min-height: 220px; }
}

/* Przyciski ogólne */
.btn,
.btn-primary,
.tool-page .btn {
  background: var(--stitch-primary-container) !important;
  color: var(--stitch-on-primary-container) !important;
  border: none !important;
  border-radius: var(--stitch-radius-btn) !important;
  font-family: var(--stitch-font-body) !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: none !important;
}

/* === KALKULATORY (mieszkanie/energia — statyczne strony z inline style) === */
/* Nadpisujemy wspólne wzorce: białe tła -> dark surfaces, karty, tabele, faq */
body {
  background: var(--stitch-bg) !important;
  color: var(--stitch-on-background) !important;
  font-family: var(--stitch-font-body) !important;
}
.result-card,
.results-grid,
.calc-card,
.calculator-container,
.ru-card,
.chart-wrap,
.breakdown,
.entries,
.faq,
.calc-results,
.result-box,
.wg-karta,
.karta-wyniku,
.form-card,
.kalkulator-box,
.calculator .card,
.card,
.hero .card,
.calc-card {
  background: var(--stitch-surface-container) !important;
  color: var(--stitch-on-surface) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  border-radius: var(--stitch-radius-card) !important;
  box-shadow: none !important;
}
/* Kontenery wyników / kart z wykresem */
.chart-wrap,
.calc-chart,
.canvas-wrap {
  background: var(--stitch-surface-deep) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  border-radius: var(--stitch-radius-card) !important;
}
/* Wiersze rozbicia (breakdown) */
.breakdown-row,
.entries > div,
.result-row,
.summary-row {
  background: var(--stitch-surface-deep) !important;
  border-bottom: 1px solid var(--stitch-outline-variant) !important;
  color: var(--stitch-on-surface-variant) !important;
}
.breakdown-row:hover,
.entries > div:hover,
.result-row:hover { background: var(--stitch-surface-container-high) !important; }

/* Nagłówki w kalkulatorach (tylko wewnątrz kontenerów kalkulatora) */
.calculator-container h1,
.calculator-container h2,
.calculator-container h3,
.calculator-container h4,
.result-card h1,
.result-card h2,
.result-card h3,
.result-card h4,
.results-grid h1,
.results-grid h2,
.results-grid h3,
.results-grid h4,
.calc-card h1,
.calc-card h2,
.calc-card h3,
.calc-card h4,
.calc-form h1,
.calc-form h2,
.calc-form h3,
.calc-form h4 {
  font-family: var(--stitch-font-display) !important;
  color: var(--stitch-on-surface) !important;
}
/* Paragrafy / etykiety (tylko wewnątrz kontenerów kalkulatora) */
.calculator-container p,
.calculator-container label,
.calculator-container small,
.result-card p,
.result-card label,
.results-grid p,
.results-grid label,
.calc-card p,
.calc-card label,
.calc-form p,
.calc-form label,
.calc-form small {
  color: var(--stitch-on-surface-variant) !important;
  font-family: var(--stitch-font-body);
}

/* Formularze kalkulatorów (tylko wewnątrz kontenerów kalkulatora) */
.calculator-container input,
.calculator-container select,
.calculator-container textarea,
.calc-form input,
.calc-form select,
.calc-form textarea,
.result-card input,
.result-card select {
  background: var(--stitch-terminal-black) !important;
  color: var(--stitch-on-surface) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  border-radius: var(--stitch-radius-btn) !important;
  font-family: var(--stitch-font-body) !important;
}
.calculator-container input:focus,
.calculator-container select:focus,
.calculator-container textarea:focus,
.calc-form input:focus,
.calc-form select:focus,
.calc-form textarea:focus {
  border-color: var(--stitch-primary) !important;
  outline: none !important;
  box-shadow: 0 0 0 1px var(--stitch-primary-container) !important;
}

/* FAQ akordeon */
.faq details,
.faq-item {
  background: var(--stitch-surface-deep) !important;
  border: 1px solid var(--stitch-surface-light) !important;
  border-radius: var(--stitch-radius-card) !important;
}
.faq summary,
.faq-question {
  color: var(--stitch-on-surface) !important;
  font-family: var(--stitch-font-display);
  cursor: pointer;
}
.faq p,
.faq-answer { color: var(--stitch-on-surface-variant) !important; }

/* Przyciski / linki w kalkulatorach */
.btn-primary,
.btn-secondary,
.btn,
button[type="submit"] {
  background: var(--stitch-primary-container) !important;
  color: var(--stitch-on-primary-container) !important;
}
a { color: var(--stitch-primary) !important; }
a:hover { color: var(--stitch-primary-fixed) !important; }

/* Media queries */
@media (max-width: 768px) {
  .container {
    padding-left: var(--stitch-margin-mobile) !important;
    padding-right: var(--stitch-margin-mobile) !important;
  }
}

/* === MEDIA QUERIES / mobile === */
@media (max-width: 768px) {
  .tools-nav { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .tools-container { padding-left: var(--stitch-margin-mobile) !important; padding-right: var(--stitch-margin-mobile) !important; }
  .tools-filters { overflow-x: auto; }
}
