/* ==========================================================================
   VARIABLES & RESET
   ========================================================================== */
:root {
  --color-black: #050505;
  --color-white: #ffffff;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  --neutral-950: #0a0a0a;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-figma: 'Archivo', var(--font-sans);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  /* scroll-behavior: smooth; */
  scrollbar-color: var(--neutral-800) var(--color-black);
  scrollbar-width: thin;
}

body {
  background-color: var(--color-black);
  color: var(--color-white);
  font-family: var(--font-sans);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
button { border: none; background: none; cursor: pointer; font-family: inherit; padding: 0; color: inherit; }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* LAYOUT & HEADER */
.container {
  width: 100%;
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (min-width: 1440px) { .container { max-width: 1200px; } }
@media (min-width: 1920px) { .container { max-width: 1280px; } }

header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 14px 0;
  background-color: rgba(5, 5, 5, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.04em; }
.logo span { color: var(--neutral-500); font-weight: 400; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--neutral-800);
  background: var(--neutral-950);
  border-radius: 9999px;
  color: var(--neutral-300);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.nav-back:hover {
  background: var(--neutral-900);
  border-color: var(--neutral-600);
  color: var(--color-white);
}

.main-wrap { padding-top: 24px; padding-bottom: 32px; flex: 1; }

h1 {
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0 0 16px 0;
}
h1 span { color: var(--neutral-500); }

/* BOXES & FORMS */
.box {
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  border-radius: 14px;
  overflow: hidden;
}
.box-header {
  padding: 11px 18px;
  border-bottom: 1px solid var(--neutral-900);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--neutral-500);
}
.box-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--neutral-900);
  gap: 12px;
}
.box-row:last-child { border-bottom: none; }
.box-row.is-disabled { opacity: 0.35; }
.box-row.is-disabled .picker-group,
.box-row.is-disabled .field-wrap { pointer-events: none; }

.row-label { font-size: 0.86rem; color: var(--neutral-300); white-space: nowrap; }

.toggle-pill {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--neutral-900);
  border: 1px solid var(--neutral-800);
  color: var(--neutral-400);
  font-weight: 600;
  transition: all 0.2s ease;
  line-height: 1.2;
}
.toggle-pill.active { background: var(--neutral-800); color: var(--color-white); border-color: var(--neutral-600); }

.field-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--neutral-900);
  border: 1px solid var(--neutral-800);
  padding: 5px 12px;
  border-radius: 9999px;
}
.field-wrap:focus-within { border-color: var(--neutral-500); }

.field-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-white);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  width: 65px;
  padding: 0;
  font-family: inherit;
}
.field-unit { color: var(--neutral-500); font-size: 0.78rem; font-weight: 500; }

.picker-group {
  display: inline-flex;
  gap: 3px;
  background: var(--neutral-900);
  padding: 3px;
  border: 1px solid var(--neutral-800);
  border-radius: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.picker-btn {
  background: transparent;
  border: none;
  color: var(--neutral-400);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 9999px;
  transition: all 0.15s ease;
  line-height: 1.1;
  white-space: nowrap;
}
.picker-btn:hover { color: var(--color-white); }
.picker-btn.active { background: var(--neutral-800); color: var(--color-white); font-weight: 600; }

.display-metric {
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  border-radius: 14px;
  padding: 20px 16px;
  text-align: center;
}
.metric-digits {
  font-size: clamp(2.4rem, 4.5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--color-white);
}
.metric-sub {
  color: var(--neutral-400);
  font-size: 0.82rem;
  margin-top: 6px;
  font-weight: 300;
}

.grid-pct {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.card-pct {
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}
.pct-tag { font-size: 0.7rem; color: var(--neutral-500); font-weight: 500; }
.pct-val { font-size: 1.05rem; font-weight: 700; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 18px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--neutral-500);
  border-bottom: 1px solid var(--neutral-900);
  text-align: left;
}
td {
  padding: 10px 18px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--neutral-900);
  color: var(--neutral-300);
}
tr:last-child td { border-bottom: none; }
.meta-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  border: 1px solid var(--neutral-800);
  background: rgba(255, 255, 255, 0.03);
  color: var(--neutral-400);
}

/* HUB / DASHBOARD GRID */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 24px;
  margin-bottom: 48px;
}
.hub-card {
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  text-decoration: none;
}
.hub-card:hover {
  border-color: var(--neutral-600);
  background: #111111;
  transform: translateY(-2px);
}
.hub-card.highlight {
  border-color: rgba(255, 255, 255, 0.15);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(10, 10, 10, 1) 100%);
}
.hub-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.hub-icon { font-size: 1.4rem; }
.hub-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--neutral-400);
  background: var(--neutral-900);
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid var(--neutral-800);
}
.badge-new {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 9999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  letter-spacing: 0.05em;
}
.hub-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.hub-desc {
  font-size: 0.86rem;
  color: var(--neutral-400);
  line-height: 1.45;
  margin-bottom: 18px;
  flex: 1;
}
.hub-cta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--neutral-300);
  display: flex;
  align-items: center;
  gap: 4px;
}
.hub-card:hover .hub-cta { color: var(--color-white); }

/* FAQ ACCORDION (SEO) */
.faq-section {
  margin-top: 48px;
  border-top: 1px solid var(--neutral-900);
  padding-top: 32px;
}
.faq-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.faq-item {
  background: #0a0a0a;
  border: 1px solid var(--neutral-800);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-question {
  padding: 14px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.faq-answer {
  padding: 0 18px 16px 18px;
  font-size: 0.84rem;
  color: var(--neutral-400);
  line-height: 1.6;
}

/* FOOTER */
footer {
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid var(--neutral-900);
  background: var(--neutral-950);
  color: var(--neutral-500);
  font-size: 0.8rem;
}
.footer-content { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.footer-brand { font-weight: 700; color: var(--color-white); }

/* Zabezpieczenie logo i przycisków przed łamaniem wiersza */
.logo {
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-back {
  white-space: nowrap;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* --- RESPONSYWNOŚĆ MOBILNA DLA PASKU GÓRNEGO (< 640px) --- */
@media (max-width: 639px) {
  header {
    padding: 10px 0; /* odchudzenie wysokości paska */
  }

  .header-content {
    gap: 8px;
  }

  /* Zmniejszenie logo, by nie rozpychało lewej strony */
  .logo {
    font-size: 0.92rem;
  }

  /* Dopasowanie przełącznika języka */
  .lang-switcher {
    padding: 2px;
  }
  .lang-btn {
    padding: 5px 8px;
    font-size: 0.7rem;
  }

  /* Skrócenie przycisku powrotu */
  .nav-back {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  /* Podmiana długiego tekstu na zwięzłe "Narzędzia" na mobile */
  .nav-back-text::before {
    content: "Narzędzia";
  }
  .nav-back-text {
    font-size: 0; /* ukrywa bazowy tekst "Wszystkie narzędzia" */
  }
  .nav-back-text::before {
    font-size: 0.75rem; /* przywraca rozmiar dla podmienionego słowa */
  }
}

@media (max-width: 639px) {
  /* Zmniejszenie rozmiaru i marginesu głównego tytułu narzędzia */
  h1 {
    font-size: 1.45rem !important;
    letter-spacing: -0.03em;
  }

  /* Zmniejszenie pigułki z tagiem obok tytułu */
  .meta-tag {
    font-size: 0.65rem;
    padding: 2px 7px;
  }

  /* Zmniejszenie odstępu pod nagłówkiem narzędzia */
  .main-wrap > div:first-child {
    margin-bottom: 14px !important;
    gap: 8px !important;
  }
}