:root {
  --primary: #0d3b66;
  --secondary: #1d4e89;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #cbd5e1;
  --focus: #2563eb;
  --danger: #e11d48;
  --danger-hover: #be123c;
  --success: #059669;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 40px;
}

/* --- GŁÓWNY KONTENER I NAGŁÓWEK --- */
.container {
  width: 100%;
  max-width: 1250px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 15px 0;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1000;
  margin-bottom: 25px;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo a {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
}

.main-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: color 0.2s;
}

.main-nav a:hover {
  color: var(--focus);
}

/* --- NAGŁÓWEK STRON PANELA --- */
.header {
  background: var(--card);
  padding: 20px 25px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.header h1 {
  font-size: 20px;
  color: var(--primary);
}

/* --- PRZYCISKI I AKCJE ---
   Ujednolicone klasy dla spójnego wyglądu przycisków w całym systemie */
.btn, .submit-btn, .admin-btn, .save-btn, .delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
}

.btn, .submit-btn {
  background-color: var(--secondary);
  color: #fff;
  width: 100%;
}
.btn:hover, .submit-btn:hover {
  background-color: var(--primary);
}

.admin-btn {
  background-color: var(--primary);
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 20px;
}
.admin-btn:hover {
  background-color: var(--secondary);
}

.save-btn {
  background-color: var(--focus);
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
}
.save-btn:hover {
  background-color: #1d4ed8;
}

.delete-btn {
  background-color: var(--danger);
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
}
.delete-btn:hover {
  background-color: var(--danger-hover);
}

.logout-btn {
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.logout-btn:hover {
  text-decoration: underline;
}

/* --- FORMULARZE I KARTY --- */
.form-wrapper, .login-card {
  width: 100%;
  max-width: 450px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  padding: 35px 40px;
  margin: 40px auto;
}

.form-group {
  margin-bottom: 18px;
}

.field-label, label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select,
.search-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: #fafafa;
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}

input:focus, textarea:focus, select:focus, .search-input:focus {
  border-color: var(--focus);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
  resize: vertical;
  min-height: 75px;
}

/* --- TABELE --- */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 10px;
  flex-wrap: wrap;
}

.search-form {
  display: flex;
  gap: 10px;
  flex-grow: 1;
  max-width: 400px;
}

.table-card {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow-x: auto;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

th {
  background: #f8fafc;
  padding: 14px 12px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

td:last-child {
  white-space: nowrap;
  text-align: center;
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

/* --- KOMUNIKATY I ALERTY --- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error, .error {
  background-color: #ffe4e6;
  color: var(--danger);
  border: 1px solid #fecdd3;
  text-align: center;
}

/* --- PAGINACJA --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 25px;
}

.page-link {
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}

.page-link.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* --- INNE ELEMENTY --- */
.hp-field {
  display: none !important;
}

.test-env-banner {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 10px 15px;
  margin-bottom: 15px;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  font-weight: bold;
}

img.qr-preview {
  width: 45px;
  height: 45px;
  object-fit: contain;
}