/* Panel administratora — swiadomy-lider.pl
   Prosty, utilitariany interfejs. Bez frameworków. */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1c2530;
  --muted: #5d6b7a;
  --line: #dde3ea;
  --line-strong: #c3ccd7;
  --accent: #1f513f;
  --accent-hover: #173f31;
  --accent-soft: #e8f1ec;
  --danger: #a4232b;
  --danger-soft: #fbeaec;
  --ok: #1c6b45;
  --ok-soft: #e6f4ec;
  --warn: #8a5a00;
  --warn-soft: #fdf3e0;
  --info: #24557f;
  --info-soft: #e9f1f8;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.55rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: #eef1f5; padding: .1em .35em; border-radius: 4px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Nagłówek ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.brand-text { font-size: 1rem; }

.mainnav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  flex: 1 1 auto;
}
.navlink {
  padding: 6px 11px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 500;
  white-space: nowrap;
}
.navlink:hover { background: #eef2f5; color: var(--ink); }
.navlink.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.topbar-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user { font-size: .88rem; color: var(--muted); }

.inline-form { display: inline; margin: 0; }

/* ---------- Układ ---------- */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 24px 40px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 { margin-bottom: .15rem; }
.page-head-meta { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.subtitle { color: var(--muted); margin: 0; max-width: 70ch; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.panel-flush { padding: 0; overflow: hidden; }
.panel-narrow { max-width: 560px; margin: 40px auto; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.panel-head h2 { margin: 0; }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.stack { display: flex; flex-direction: column; gap: 18px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  display: block;
}
a.card:hover { border-color: var(--line-strong); background: #fbfcfd; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .88rem; }

.footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 30px;
  color: var(--muted);
  font-size: .82rem;
}
.footer p { margin: 0; }

/* ---------- Formularze ---------- */

.form { margin: 0; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-grow { flex: 1 1 260px; }

label {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  margin-bottom: 5px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: .93rem;
  line-height: 1.4;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  margin: 0;
  vertical-align: middle;
}

.hint { color: var(--muted); font-size: .82rem; margin: 5px 0 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }

.form-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.form-upload .field { flex: 1 1 220px; margin-bottom: 0; }
.form-upload { align-items: flex-end; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 6px;
}

/* ---------- Przyciski ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: #eef1f5;
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover { background: #e4e9ef; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--accent-soft); color: var(--accent); border-color: #cfe0d7; }
.btn-secondary:hover { background: #ddeae2; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line-strong); }
.btn-ghost:hover { background: #f1f4f7; color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: .84rem; }
.btn-block { width: 100%; }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Komunikaty ---------- */

.alerts { margin-bottom: 16px; }
.alert {
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 10px;
  font-size: .92rem;
}
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert-ok { background: var(--ok-soft); border-color: #bfe0cd; border-left-color: var(--ok); color: #14503a; }
.alert-error { background: var(--danger-soft); border-color: #f0c3c7; border-left-color: var(--danger); color: #7c1a21; }
.alert-info { background: var(--info-soft); border-color: #c7dcee; border-left-color: var(--info); color: #1c4568; }

/* ---------- Tabele ---------- */

.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.table th {
  text-align: left;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  background: #f7f9fb;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table tr:last-child td { border-bottom: 0; }
.table input[type="text"],
.table input[type="url"],
.table input[type="number"],
.table input[type="date"],
.table textarea { font-size: .88rem; }
.table .col-price { width: 120px; }
.table .col-check { width: 74px; text-align: center; }
.table .col-date { width: 150px; }
.table th.col-check { text-align: center; }
.cell-check { text-align: center; }
.table-compact td, .table-compact th { padding: 8px 10px; }
.table-compact code { white-space: nowrap; }
.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 26px 12px;
  background: #fbfcfd;
}

.thumb-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- Listy statusów ---------- */

.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.status-item { display: flex; gap: 10px; align-items: flex-start; }
.status-dot {
  width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto;
}
.status-dot.is-ok { background: var(--ok); }
.status-dot.is-warn { background: #c2410c; }
.status-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.status-label { font-weight: 600; font-size: .88rem; }
.status-value { font-size: .88rem; }
.status-hint { flex-basis: 100%; color: var(--muted); font-size: .8rem; }

.check-list { margin: 0 0 10px; padding-left: 20px; font-size: .9rem; }
.check-list li { margin-bottom: 5px; }

.backup-list { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.backup-list li {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.backup-list li:last-child { border-bottom: 0; }

.info-list { list-style: none; margin: 0 0 12px; padding: 0; }
.info-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .89rem;
}
.info-list li:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); }

.details { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.details summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.code-block {
  max-height: 420px;
  overflow: auto;
  background: #1f2530;
  color: #e6ebf2;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  line-height: 1.5;
  margin: 10px 0 0;
}

/* ---------- Karty wpisów / przełączniki ---------- */

.item-card { padding: 18px; }
.item-card-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  font-size: .88rem;
  margin-bottom: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.switch-danger span { color: var(--danger); }

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

tr.is-deleted td,
.item-card.is-deleted {
  background: #fdf1f2;
  opacity: .72;
}
tr.is-deleted input[type="text"],
tr.is-deleted textarea {
  text-decoration: line-through;
}

/* ---------- Logowanie ---------- */

.page-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, #e6efe9 0%, rgba(230, 239, 233, 0) 65%),
    var(--bg);
}
.auth-wrap { width: 100%; max-width: 430px; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .08);
  padding: 28px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.auth-site { margin: 0; color: var(--muted); font-size: .82rem; letter-spacing: .02em; }
.auth-brand h1 { font-size: 1.2rem; margin: 0; }
.auth-lead { color: var(--muted); font-size: .92rem; margin-bottom: 18px; }
.auth-note { color: var(--muted); font-size: .8rem; margin: 18px 0 0; }
.auth-card .field { margin-bottom: 14px; }

/* ---------- Błąd ---------- */

.page-error {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.error-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 520px;
}
.error-box h1 { font-size: 1.3rem; }

/* ---------- Responsywność ---------- */

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .page-head-meta { text-align: left; }
  .topbar-inner { padding: 10px 16px; gap: 10px; }
  .container { padding: 18px 16px 32px; }
  .mainnav { order: 3; flex-basis: 100%; flex-wrap: wrap; overflow: visible; padding-bottom: 2px; }
  .table .col-price, .table .col-date { width: auto; }
}

@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .panel { padding: 15px; }
  .table th, .table td { padding: 8px; }
  .form-actions .btn { width: 100%; }
  .item-card-head { gap: 10px; }
}
