:root {
  --ink: #111111;
  --paper: #f7f3ea;
  --white: #ffffff;
  --muted: #6b6258;
  --red: #e63946;
  --yellow: #ffd166;
  --green: #2a9d8f;
  --line: rgba(17,17,17,.12);
  --shadow: 6px 6px 0 rgba(17,17,17,.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

a { color: inherit; text-decoration: none; }

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,209,102,.45), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(230,57,70,.12), transparent 26%),
    var(--paper);
}

.auth-card,
.panel,
.stat-card {
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--ink);
  color: var(--paper);
  padding: 24px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 34px;
  font-size: 20px;
}

.admin-brand span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 12px;
  font-weight: 900;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-nav a {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255,255,255,.78);
  font-weight: 800;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: var(--yellow);
  color: var(--ink);
}

.main-area {
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 3px solid var(--ink);
  background: rgba(247,243,234,.9);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.admin-user {
  padding: 10px 14px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-weight: 800;
}

.admin-content {
  padding: 32px;
}

.panel {
  padding: 24px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h2,
.panel h2 {
  margin: 0 0 12px;
  letter-spacing: -0.04em;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px;
}

.stat-card span {
  color: var(--muted);
  font-weight: 800;
}

.stat-card strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  margin-top: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  background: var(--white);
}

textarea {
  resize: vertical;
}

small,
.muted {
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  padding: 10px 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}

.btn.primary {
  background: var(--yellow);
}

.btn.danger {
  background: var(--red);
  color: var(--white);
}

.btn.small {
  padding: 7px 11px;
  font-size: 13px;
  box-shadow: none;
}

.form-actions,
.actions,
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar {
  margin-bottom: 18px;
}

.toolbar input {
  max-width: 320px;
}

.alert {
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  margin-bottom: 18px;
  font-weight: 800;
}

.alert.success {
  background: rgba(42,157,143,.16);
}

.alert.error {
  background: rgba(230,57,70,.14);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.badge {
  display: inline-flex;
  padding: 5px 9px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.thumb {
  width: 84px;
  height: 64px;
  object-fit: cover;
  border: 2px solid var(--ink);
  border-radius: 12px;
}

.preview {
  width: 220px;
  max-width: 100%;
  border: 2px solid var(--ink);
  border-radius: 16px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-label input {
  width: auto;
}

.admin-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.gallery-item {
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 10px;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .admin-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-grid,
  .grid-2,
  .admin-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .topbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-content {
    padding: 18px;
  }

  .stat-grid,
  .grid-2,
  .admin-gallery {
    grid-template-columns: 1fr;
  }
}
