:root {
  color-scheme: light dark;
  --page: #f5f7fa;
  --surface: #ffffff;
  --text: #18212b;
  --muted: #536170;
  --line: #dce2e8;
  --accent: #176b45;
  --accent-soft: #e8f4ee;
  --max: 860px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}
main {
  width: min(calc(100% - 32px), var(--max));
  margin: 32px auto;
  padding: clamp(24px, 5vw, 48px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}
a { color: var(--accent); }
nav a, .button {
  display: inline-block;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 650;
}
.button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
h1 { margin: 0 0 8px; line-height: 1.18; font-size: clamp(2rem, 7vw, 3rem); }
h2 { margin-top: 34px; line-height: 1.28; }
p, li { max-width: 75ch; }
.meta, footer { color: var(--muted); }
.notice {
  margin: 24px 0;
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  color: #173d2d;
}
code {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
footer {
  margin-top: 42px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #11161c;
    --surface: #1b222b;
    --text: #edf2f6;
    --muted: #b3bec8;
    --line: #394552;
    --accent: #7bd6aa;
    --accent-soft: #19382b;
  }
  .notice { color: #dff8ec; }
  .button { color: #10251b; }
}
@media (max-width: 560px) {
  main { width: 100%; margin: 0; min-height: 100vh; border: 0; border-radius: 0; }
}

/* Formularze usuwania konta i panel administratora */
.auth-card, .panel-card, .danger-zone {
  margin: 22px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, var(--accent) 8%);
}
.danger-zone { border-color: #b3261e; }
.status-box {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--page);
}
.status-box.error { border-color: #b3261e; }
.status-box.success { border-color: var(--accent); }
.hidden { display: none !important; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
button, input, select, textarea { font: inherit; }
button, .secondary-button, .danger-button {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  cursor: pointer;
  font-weight: 700;
}
button { background: var(--accent); color: #fff; }
.secondary-button { background: transparent; color: var(--accent); }
.danger-button { background: #b3261e; border-color: #b3261e; color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }
label { display: block; margin: 12px 0 6px; font-weight: 650; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; }
.checkbox-row input { width: auto; margin-top: 5px; }
.checkbox-row label { margin: 0; font-weight: 500; }
.user-badge { display: flex; gap: 12px; align-items: center; }
.user-badge img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.admin-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr); gap: 20px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.admin-tabs button[aria-selected="true"] { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr[data-clickable="true"] { cursor: pointer; }
tr[data-clickable="true"]:hover { background: var(--accent-soft); }
.code, .uid { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.metric-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.metric-list div { padding: 8px 0; border-bottom: 1px solid var(--line); }
.small { font-size: .9rem; color: var(--muted); }
@media (max-width: 820px) {
  .admin-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .metric-list { grid-template-columns: 1fr; }
}
