:root {
  --gold: #c9a24b;
  --gold-dark: #a5822f;
  --ink: #1a1712;
  --bg: #f7f4ee;
  --card: #ffffff;
  --border: #e7e0d0;
}

* { box-sizing: border-box; }

/* Zabezpieczenie: kilka elementow ponizej ma wlasna regule "display: flex",
   a jednoczesnie sa pokazywane/ukrywane atrybutem HTML "hidden" z JS. Bez tej
   reguly wlasny "display: flex" wygrywalby z domyslnym "[hidden] { display: none }"
   przegladarki (regula autora ma pierwszenstwo nad domyslna regula przegladarki),
   przez co np. ekran logowania zostawalby widoczny nawet po zalogowaniu. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.muted { color: #746a55; font-size: 14px; line-height: 1.5; }
.error { color: #c0392b; font-size: 14px; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top, #fdf6e3 0%, var(--bg) 70%);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}
.login-card h1 { margin-top: 0; }
.login-card input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  margin: 16px 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  display: inline-block;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  margin: 6px 0 4px;
}
.switch-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.field-row {
  margin-bottom: 14px;
}
.field-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.field-row label .muted {
  font-weight: 400;
  font-size: 12px;
  margin-bottom: 0;
}
.field-row input[type="text"],
.field-row textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.btn-danger {
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { font-size: 18px; margin: 0; }

main { max-width: 1000px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 24px;
}
.card h2 { margin-top: 0; }

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0;
}
.inline-form input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #555;
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.table-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.table-item img {
  width: 100%;
  max-width: 170px;
  aspect-ratio: 900 / 1260;
  object-fit: contain;
  margin: 8px auto;
  display: block;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.table-item .label-row {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.table-item input[type="text"] {
  font-weight: 600;
  border: none;
  border-bottom: 1px solid transparent;
  text-align: center;
  background: transparent;
  width: 100%;
  font-size: 14px;
  padding: 2px;
}
.table-item input[type="text"]:focus {
  border-bottom: 1px solid var(--gold);
  outline: none;
}
.table-item .badge {
  display: inline-block;
  font-size: 11px;
  color: var(--gold-dark);
  background: #fbf1dc;
  border-radius: 999px;
  padding: 2px 8px;
  margin-top: 4px;
}
.table-item .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}
.table-item .actions button, .table-item .actions a {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.gallery-controls { display: flex; gap: 8px; }
.gallery-controls select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.gallery-grid .photo-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  background: #eee;
}
.gallery-grid .photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-grid .photo-item .tag {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 20;
  padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: 8px; }
