:root {
  --bg: #0b0f0c;
  --panel: rgba(22, 31, 24, .9);
  --panel-soft: rgba(229, 221, 192, .08);
  --line: rgba(229, 221, 192, .18);
  --text: #f4ecd8;
  --muted: #aaa48f;
  --sand: #d6c491;
  --danger: #cc4d3f;
  --green: #7fb06b;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(214,196,145,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214,196,145,.035) 1px, transparent 1px),
    radial-gradient(circle at 20% 0, rgba(143,154,99,.22), transparent 30%),
    linear-gradient(135deg, #080c09, #101711 50%, #090d0a);
  background-size: 38px 38px, 38px 38px, auto, auto;
  font-family: Arial, Helvetica, sans-serif;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.topbar {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}
.brand { display: grid; grid-template-columns: 48px auto; column-gap: 12px; align-items: center; }
.brand span { grid-row: span 2; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--sand); border-radius: 50%; font-weight: 900; }
.brand strong { text-transform: uppercase; font-size: 1.25rem; }
.brand small { color: var(--muted); font-weight: 800; }
nav { display: flex; flex-wrap: wrap; gap: 10px; }
nav a, .button, button, .secondary {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(229,221,192,.08);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-weight: 900;
}
button, .button { background: var(--sand); color: #11150f; border-color: var(--sand); }
.danger { background: rgba(204,77,63,.18); color: #fff; border-color: rgba(204,77,63,.5); }
.secondary { background: rgba(229,221,192,.08); color: var(--text); }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 12px 0 64px; }
.panel, .event-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255,255,255,.055), transparent 45%), var(--panel);
  box-shadow: 0 28px 80px rgba(0,0,0,.42);
}
.hero { min-height: 430px; display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: end; padding: clamp(24px, 5vw, 56px); }
.eyebrow { color: var(--sand); font-size: .78rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 10px; }
h1 { margin: 0; font-size: clamp(2.8rem, 8vw, 6.5rem); line-height: .86; text-transform: uppercase; }
h2, p { margin: 0; }
.hero p:not(.eyebrow), .admin-head p, .event-hero p:not(.eyebrow) { color: var(--muted); line-height: 1.55; max-width: 680px; }
.hero-stat { border: 1px solid var(--line); border-radius: 10px; background: rgba(229,221,192,.08); padding: 22px; }
.hero-stat strong { display: block; font-size: 4rem; color: var(--sand); line-height: 1; }
.hero-stat span { color: var(--muted); font-weight: 900; }

.filters { margin: 20px 0 28px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 16px; align-items: end; }
label { display: grid; gap: 8px; color: var(--muted); font-size: .82rem; font-weight: 900; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8,12,9,.72);
  color: var(--text);
  outline: none;
  padding: 11px 12px;
}
textarea { resize: vertical; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.event-card { min-height: 360px; grid-column: span 4; position: relative; overflow: hidden; padding: 18px; display: grid; align-content: end; gap: 8px; }
.event-card:nth-child(4n+1) { grid-column: span 5; }
.event-card:nth-child(4n+2) { grid-column: span 7; }
.event-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; transition: transform .45s ease; }
.event-card:after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 36%, rgba(6,10,7,.92)); z-index: 1; }
.event-card > *:not(img) { position: relative; z-index: 2; }
.event-card:hover img { transform: scale(1.045); }
.event-card span, .event-card small, .meta { color: var(--muted); font-weight: 800; }
.event-card strong { font-size: 1.55rem; line-height: 1.05; }
.empty { grid-column: 1 / -1; padding: 24px; color: var(--muted); }

.event-hero { display: grid; grid-template-columns: 1fr minmax(280px, 420px); gap: 22px; padding: 22px; margin-bottom: 24px; }
.event-hero img { width: 100%; height: 360px; object-fit: cover; border-radius: 8px; }
.back { color: var(--sand); font-weight: 900; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.photo-tile { min-height: 220px; padding: 0; overflow: hidden; background: #050705; border-color: var(--line); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }

.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 22px; margin-bottom: 18px; }
.admin-head h1 { font-size: clamp(2rem, 5vw, 4rem); }
.admin-list { display: grid; gap: 14px; }
.admin-card { display: grid; grid-template-columns: 210px 1fr; overflow: hidden; }
.admin-card img { width: 100%; height: 180px; object-fit: cover; }
.admin-card > div { padding: 16px; display: grid; gap: 12px; }
.pill { width: fit-content; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: .78rem; font-weight: 900; }
.pill.ok { color: #dff6d4; background: rgba(127,176,107,.14); }
.pill.draft { color: #ffe2a3; background: rgba(196,154,58,.12); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions form { margin: 0; }

.edit-section { display: grid; gap: 16px; padding: 20px; margin-bottom: 18px; }
.section-title { display: flex; justify-content: space-between; }
.upload-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.dropzone { border: 1px dashed var(--line); border-radius: 10px; background: rgba(8,12,9,.42); padding: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 20px; min-height: 20px; }
.photo-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.photo-admin-card { position: relative; border: 1px solid var(--line); border-radius: 10px; background: rgba(8,12,9,.48); padding: 10px; display: grid; gap: 10px; }
.photo-admin-card.dragging { opacity: .45; }
.photo-admin-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.trash, .drag { position: absolute; top: 18px; width: 36px; min-height: 36px; padding: 0; }
.drag { left: 18px; background: rgba(8,12,9,.78); color: var(--text); }
.trash { right: 18px; background: var(--danger); color: #fff; border-color: var(--danger); }
.cover { background: rgba(229,221,192,.08); color: var(--text); border-color: var(--line); }
.cover.active { background: var(--sand); color: #11150f; }

.auth-shell { min-height: calc(100vh - 100px); display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(440px, 100%); display: grid; gap: 16px; padding: 22px; }
.login-panel h1 { font-size: 2.4rem; }
.error { color: #ffd4cc; font-weight: 900; }

.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(3,5,4,.9); padding: 24px; }
.modal[hidden] { display: none; }
.modal img { max-width: min(1100px, 100%); max-height: 86vh; object-fit: contain; }
.modal button { position: absolute; background: rgba(8,12,9,.76); color: var(--text); border-color: var(--line); }
.modal-close { top: 20px; right: 20px; width: 44px; padding: 0; }
.modal-prev { left: 20px; width: 50px; padding: 0; font-size: 2rem; }
.modal-next { right: 20px; width: 50px; padding: 0; font-size: 2rem; }

@media (max-width: 820px) {
  .topbar, .admin-head, .hero, .event-hero, .admin-card, .upload-form { grid-template-columns: 1fr; display: grid; }
  .filters, .form-grid { grid-template-columns: 1fr; }
  .event-card, .event-card:nth-child(4n+1), .event-card:nth-child(4n+2) { grid-column: 1 / -1; }
  h1 { font-size: clamp(2.5rem, 15vw, 4.5rem); }
}
