/* HERO */
.hero {
  padding: 64px 32px 48px;
  border-bottom: 1px solid var(--rule);
  position: relative;
  max-width: 1480px;
  margin: 0 auto;
}
.hero__eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero__eyebrow::before {
  content: ''; width: 24px; height: 1px; background: var(--ink); display: block;
}
.hero__title {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  color: var(--ink);
  max-width: 920px;
}
.hero__title em { font-style: normal; font-weight: 300; color: var(--muted); }
.hero__sub {
  font-size: 16px;
  max-width: 680px;
  color: var(--ink-2);
  line-height: 1.55;
  margin-bottom: 40px;
}
.hero__sub .lead { font-family: 'Inter', system-ui, sans-serif; font-weight: 500; color: var(--ink); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.stat {
  padding: 24px 28px 20px 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 130px;
}
.stat + .stat {
  padding-left: 28px;
  border-left: 1px solid var(--rule);
}
.stat__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat__num {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-feature-settings: "tnum";
  color: var(--ink);
}
.stat--accent .stat__num { color: var(--emerald); }
.stat--accent .stat__label { color: var(--emerald); }
.stat--accent .stat__label span:first-child { background: var(--emerald) !important; }
.stat__num .unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--muted);
  margin-left: 8px;
  letter-spacing: 0;
  font-weight: 400;
  vertical-align: middle;
}
.stat__bar {
  height: 2px;
  background: var(--rule-2);
  margin-top: 14px;
  position: relative;
  overflow: hidden;
}
.stat__bar::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--ink);
  width: var(--pct, 0%);
  animation: fill 1.4s cubic-bezier(.4,0,.2,1) forwards;
  transform-origin: left;
}
.stat--accent .stat__bar::after { background: var(--emerald); }
.stat--rose .stat__bar::after { background: var(--rose); }
@keyframes fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* FILTERS */
.filters {
  padding: 0 32px 24px;
  max-width: 1480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filters__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: stretch;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--rule);
  transition: border-color .12s, box-shadow .12s;
}
.search:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(5,150,105,0.12);
}
.search__icon {
  padding: 0 14px 0 18px;
  color: var(--muted);
  display: flex;
  align-items: center;
}
.search__icon svg { width: 18px; height: 18px; }
.search input {
  flex: 1;
  padding: 14px 16px 14px 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  min-height: 52px;
}
.search input::placeholder { color: var(--muted-2); }
.search__hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted-2);
  letter-spacing: 0.06em;
  padding: 0 18px;
  border-left: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}
.search__hint kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 2px 6px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--ink);
}

.select-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--rule);
  padding: 0 14px;
  transition: border-color .12s;
}
.select-box:hover, .select-box:focus-within { border-color: var(--ink); }
.select-box__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 10px;
  pointer-events: none;
}
.select-box select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 24px 14px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  min-width: 140px;
}
.select-box::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.api-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  background: var(--ink);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  transition: all .12s;
  border: 1px solid var(--ink);
}
.api-btn:hover { background: var(--emerald); border-color: var(--emerald); }
.api-btn .arrow { transition: transform .12s; }
.api-btn:hover .arrow { transform: translateX(3px); }

.chip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.chip-row__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 6px;
  min-width: 52px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--rule);
  background: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .1s;
  text-transform: uppercase;
  user-select: none;
  white-space: nowrap;
  border-radius: 2px;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip .count {
  font-size: 10px;
  color: var(--muted);
  padding-left: 7px;
  margin-left: 1px;
  border-left: 1px solid var(--rule);
  font-feature-settings: "tnum";
  letter-spacing: 0;
}
.chip:hover .count { color: var(--ink-2); border-left-color: var(--ink-2); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 500;
}
.chip.active .count { color: rgba(255,255,255,0.65); border-left-color: rgba(255,255,255,0.3); }

.chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
}
.chip .dot--active { background: var(--emerald); }
.chip .dot--expired { background: var(--muted-2); }
.chip .dot--withdrawn { background: var(--rose); }

.chip.active--emerald {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}
.chip.active--emerald .count { color: rgba(255,255,255,0.75); border-left-color: rgba(255,255,255,0.3); }
.chip.active--rose {
  background: var(--rose);
  border-color: var(--rose);
  color: #fff;
}
.chip.active--rose .count { color: rgba(255,255,255,0.75); border-left-color: rgba(255,255,255,0.3); }

.chip-row__clear {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  padding: 7px 10px;
  cursor: pointer;
  transition: color .1s;
  margin-left: auto;
}
.chip-row__clear:hover { color: var(--ink); }

/* TABLE */
.table-wrap {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 32px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  border-top: 2px solid var(--ink);
}
.table thead th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--rule);
}
.table thead th.num-col { text-align: right; width: 40px; padding-right: 20px; }

.table tbody tr { border-bottom: 1px solid var(--rule-2); transition: background .12s; }
.table tbody tr:hover { background: #f0fdf4; }
.table tbody tr.expanded { background: var(--paper-2); border-bottom-color: var(--rule); }

.table td {
  padding: 14px 16px 14px 0;
  vertical-align: middle;
  font-size: 13.5px;
}
.row-num {
  text-align: right;
  padding-right: 20px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted-2);
  font-size: 11px;
  width: 40px;
}

.cell-id {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 340px;
  max-width: 440px;
}
.cell-id__flag {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 48px;
}
.cell-id__flag .fi {
  width: 24px;
  height: 18px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.cell-id__flag .iso {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.cell-id__text { min-width: 0; flex: 1; }
.cell-id__cn {
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cell-id__tsp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 2px;
  white-space: nowrap;
}
.badge--qualified { color: #047857; border-color: #059669; background: #d1fae5; }
.badge--qualified-ts { color: var(--indigo); border-color: var(--indigo); background: var(--indigo-bg); }
.badge--root { color: var(--slate); border-color: var(--slate); background: var(--slate-bg); }
.badge--timestamp { color: var(--amber); border-color: var(--amber); background: var(--amber-bg); }
.badge--other { color: var(--muted); border-color: var(--rule); background: var(--paper-2); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.03em;
}
.status__dot {
  width: 8px; height: 8px; border-radius: 50%;
  position: relative;
}
.status--active .status__dot { background: var(--emerald); }
.status--active .status__dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid var(--emerald);
  animation: pulse 2.4s ease-out infinite;
  opacity: 0.6;
}
.status--expired .status__dot { background: var(--muted-2); }
.status--withdrawn .status__dot { background: var(--rose); }

.timeline { min-width: 160px; }
.timeline__bar {
  position: relative;
  height: 4px;
  background: var(--rule-2);
  margin-bottom: 8px;
}
.timeline__fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--emerald); }
.timeline__marker {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 2px;
  background: var(--emerald);
}
.timeline__marker::after {
  content: 'teraz';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--emerald);
  text-transform: uppercase;
  white-space: nowrap;
}
.timeline--expired .timeline__fill { background: var(--muted-2); }
.timeline--expired .timeline__marker { background: var(--muted-2); }
.timeline--expired .timeline__marker::after { color: var(--muted-2); content: 'wygasł'; }
.timeline--warn .timeline__marker { background: var(--amber); }
.timeline--warn .timeline__marker::after { color: var(--amber); content: 'wygasa'; }
.timeline__dates {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.expand-btn {
  background: transparent;
  border: 1px solid var(--rule);
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all .12s;
  border-radius: 2px;
}
.expand-btn:hover { border-color: var(--ink); color: var(--ink); }
.expanded .expand-btn { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.expand-btn svg { width: 14px; height: 14px; transition: transform .2s; }
.expanded .expand-btn svg { transform: rotate(180deg); }

.expand-row td { padding: 0; }
.expand-row .panel {
  background: var(--paper);
  border-top: 1px solid var(--rule-2);
  padding: 24px 32px 28px;
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 48px;
  align-items: start;
}
.panel__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel__label::before {
  content: ''; width: 14px; height: 1px; background: var(--ink-2);
}
.panel__value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-2);
  word-break: break-all;
  line-height: 1.6;
}
.panel__value strong { color: var(--ink); font-weight: 500; }
.panel__cta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.panel__cta a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  transition: all .12s;
  text-transform: uppercase;
  white-space: nowrap;
}
.panel__cta a:hover { background: var(--ink); color: var(--paper); }
.panel__cta a.primary { background: var(--ink); color: var(--paper); }
.panel__cta a.primary:hover { background: var(--ink-2); }

/* PAGINATION */
.paginate {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 32px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.paginate nav { display: flex; gap: 4px; }
.paginate nav a, .paginate nav span {
  padding: 6px 12px;
  border: 1px solid var(--rule);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  min-width: 32px;
  text-align: center;
  transition: all .1s;
}
.paginate nav a:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.paginate nav .active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.paginate nav .disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

footer.colophon {
  max-width: 1480px;
  margin: 80px auto 0;
  padding: 60px 32px 48px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--muted);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  align-items: start;
}
footer .colophon__brand {
  font-family: 'Inter', system-ui, sans-serif;
  font-style: normal;
  font-weight: 300;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 8px;
}
footer .colophon__block {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.03em;
}
footer .colophon__block dt {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
footer .colophon__block dd { color: var(--ink); margin-bottom: 4px; }
footer .colophon__block a:hover { text-decoration: underline; }

/* Staggered entry */
.fade-in { opacity: 0; transform: translateY(8px); animation: entry 0.6s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes entry { to { opacity: 1; transform: translateY(0); } }
.fade-in:nth-child(1) { animation-delay: 0.04s; }
.fade-in:nth-child(2) { animation-delay: 0.08s; }
.fade-in:nth-child(3) { animation-delay: 0.12s; }
.fade-in:nth-child(4) { animation-delay: 0.16s; }

@media (max-width: 1200px) {
  .cell-tsp, .timeline__dates span:first-child { display: none; }
}
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters__row { grid-template-columns: 1fr; }
}
