* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

/* Topbar */
.topbar { background: #0f172a; }
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { color: #fff; font-weight: 700; font-size: 16px; text-decoration: none;
         display: flex; align-items: center; gap: 10px; }
.brand-accent { width: 4px; height: 20px; background: #6366f1; border-radius: 2px; }
.nav { display: flex; align-items: center; gap: 16px; }
.nav-user { color: #94a3b8; font-size: 13px; }
.nav-link { color: #e2e8f0; font-size: 13px; text-decoration: none; }
.nav-link:hover { color: #fff; }
.nav-btn {
  background: #6366f1; color: #fff; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.nav-btn:hover { background: #4f46e5; }
.nav-btn:disabled { opacity: 0.6; cursor: default; }

/* Modal (popup logów odświeżania) */
.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.modal[hidden] { display: none; }
.modal-card {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  box-shadow: 0 12px 48px rgba(15, 23, 42, 0.25); overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #e2e8f0;
  font-weight: 700; font-size: 15px;
}
.modal-close {
  background: none; border: none; font-size: 22px; line-height: 1;
  color: #94a3b8; cursor: pointer;
}
.modal-close:hover { color: #0f172a; }
.modal-log {
  margin: 0; padding: 18px 20px; max-height: 60vh; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.6; color: #334155;
  white-space: pre-wrap; word-break: break-word;
}

/* Layout */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }

/* Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.input {
  padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 14px; background: #fff; min-width: 180px;
}
.input:focus { outline: none; border-color: #6366f1; }
.btn {
  padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
}
.btn-primary { background: #6366f1; color: #fff; }
.btn-primary:hover { background: #4f46e5; }
.btn-ghost { background: #fff; color: #475569; border-color: #cbd5e1; }
.btn-ghost:hover { background: #f1f5f9; }

.result-count { font-size: 13px; color: #64748b; margin-bottom: 10px; }

/* Table */
.listings { width: 100%; border-collapse: collapse; background: #fff;
            border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.listings th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; color: #94a3b8; font-weight: 600;
  padding: 12px 14px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.listings td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.listings tr:last-child td { border-bottom: none; }
.listings .num { text-align: right; white-space: nowrap; }
.listings .muted { color: #64748b; font-size: 13px; }
.listings .cat { color: #475569; font-size: 13px; }
.listings .name a { color: #4f46e5; text-decoration: none; font-weight: 600; }
.listings .name a:hover { text-decoration: underline; }
.thumb { width: 48px; }
.thumb img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; }
.empty { text-align: center; color: #94a3b8; padding: 32px; }
.badge {
  display: inline-block; min-width: 28px; padding: 2px 7px; border-radius: 6px;
  font-size: 12px; font-weight: 700; color: #fff; text-align: center;
  text-decoration: none;
}
.badge.good { background: #16a34a; }
.badge.ok { background: #d97706; }
.badge.bad { background: #dc2626; }
.badge:hover { opacity: 0.9; }

/* Niedostępne pozycje (zniknęły z CEX) — wyszarzone, ale nadal widoczne */
.listings tr.unavailable td { opacity: 0.5; }
.listings tr.unavailable .name a { color: #64748b; }
.tag-gone {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 5px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: #64748b; background: #e2e8f0; opacity: 1;
}

/* Login */
.login-wrap { display: flex; justify-content: center; padding-top: 60px; }
.login-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 32px; width: 100%; max-width: 360px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}
.login-title { margin: 0 0 20px; font-size: 20px; }
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: #475569;
               margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1;
  border-radius: 8px; font-size: 14px;
}
.field input:focus { outline: none; border-color: #6366f1; }
.login-card .btn-primary { width: 100%; justify-content: center; }
.alert {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}

/* Telefon: filtry na całą szerokość + tabela jako karty */
@media (max-width: 640px) {
  .topbar-inner { padding: 14px 16px; }
  .container { padding: 20px 16px; }
  .nav { gap: 10px; }
  .nav-btn { padding: 6px 10px; font-size: 12px; }

  .filters { flex-direction: column; gap: 8px; }
  .filters .input,
  .filters .btn { width: 100%; min-width: 0; }

  .listings { border: none; background: transparent; }
  .listings thead { display: none; }
  .listings tr {
    display: block; background: #fff; border: 1px solid #e2e8f0;
    border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
  }
  .listings td { display: block; padding: 4px 0; border: none; font-size: 14px; }
  .listings td.thumb { width: auto; }
  .listings td.thumb img { width: 56px; height: 56px; }
  .listings td.name { font-size: 15px; margin-bottom: 4px; }
  .listings td.num { text-align: left; white-space: normal; }
  .listings td[data-label] {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 6px 0; border-top: 1px solid #f1f5f9;
  }
  .listings td[data-label]::before {
    content: attr(data-label); color: #94a3b8; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
  }
  .listings td.empty { display: block; }
}
