:root {
  --ink: #17152a;
  --ink-soft: #454158;
  --muted: #797588;
  --purple: #27105f;
  --purple-deep: #190842;
  --purple-soft: #f0edf8;
  --orange: #d8643a;
  --orange-dark: #b84d28;
  --mint: #9be0d6;
  --mint-soft: #e9f8f5;
  --lime: #ebf253;
  --line: #e7e4ec;
  --line-strong: #d6d1df;
  --page: #f7f7fa;
  --white: #fff;
  --success: #19764c;
  --danger: #a83b35;
  --shadow-sm: 0 5px 18px rgba(33, 8, 90, .055);
  --shadow-md: 0 16px 42px rgba(33, 8, 90, .09);
  --radius: 15px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 95% 0, rgba(155, 224, 214, .18), transparent 25rem),
    var(--page);
  font: 500 15px/1.5 "Jura", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
a { color: var(--purple); }
:focus-visible { outline: 3px solid rgba(216, 100, 58, .35); outline-offset: 2px; }

.admin-shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 17px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 0, rgba(155, 224, 214, .13), transparent 18rem),
    linear-gradient(170deg, var(--purple) 0%, var(--purple-deep) 100%);
  box-shadow: 8px 0 30px rgba(25, 8, 66, .08);
}
.sidebar-head { display: flex; align-items: center; }
.admin-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 7px;
  color: #fff;
  text-decoration: none;
}
.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 13px;
  background: var(--mint);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .14);
}
.brand-mark img { width: 40px; height: 34px; object-fit: contain; }
.admin-brand > span:last-child { min-width: 0; display: grid; }
.admin-brand strong { font-size: 19px; line-height: 1.15; letter-spacing: .08em; }
.admin-brand small { margin-top: 3px; color: #c9c2de; font-size: 10px; letter-spacing: .04em; }
.sidebar-close { display: none; margin-left: auto; border: 0; color: #fff; background: none; font-size: 28px; }

.admin-sidebar nav { display: grid; gap: 4px; margin-top: 28px; }
.nav-label {
  margin: 20px 13px 7px;
  color: #948bab;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.nav-label:first-child { margin-top: 0; }
.admin-sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #d8d2e8;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.admin-sidebar nav a:hover { color: #fff; background: rgba(255, 255, 255, .075); transform: translateX(2px); }
.admin-sidebar nav a.is-active {
  color: #1a1530;
  background: var(--mint);
  box-shadow: 0 7px 20px rgba(0, 0, 0, .13);
}
.admin-sidebar nav a.is-active::before {
  content: "";
  position: absolute;
  left: -17px;
  width: 3px;
  height: 23px;
  border-radius: 0 4px 4px 0;
  background: var(--lime);
}
.nav-icon { width: 21px; flex: 0 0 21px; text-align: center; font: 600 18px/1 "Segoe UI Symbol", sans-serif; }
.public-site-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 11px;
  color: #fff;
  background: rgba(255, 255, 255, .055);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}
.public-site-link:hover { background: rgba(255, 255, 255, .1); }
.sidebar-scrim { display: none; }

.admin-main { min-width: 0; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 76px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 34px;
  border-bottom: 1px solid rgba(231, 228, 236, .85);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
}
.topbar-title { display: grid; line-height: 1.2; }
.topbar-title small { color: var(--muted); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
.topbar-title strong { margin-top: 4px; font-size: 15px; }
.admin-identity { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.admin-identity > span:last-child { display: grid; line-height: 1.3; }
.admin-identity strong { max-width: 190px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.admin-identity small { color: var(--muted); font-size: 10px; }
.admin-avatar {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid #c9ece6;
  border-radius: 10px;
  color: var(--purple);
  background: var(--mint-soft);
  font-size: 14px;
  font-weight: 700;
}
.sidebar-toggle { display: none; }
.admin-content { width: min(100%, 1480px); margin: 0 auto; padding: 34px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 25px; }
.page-heading h1 { margin: 0; font-size: clamp(24px, 2vw, 30px); line-height: 1.18; letter-spacing: -.025em; }
.page-heading p:not(.eyebrow) { max-width: 650px; margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.eyebrow { margin: 0 0 5px; color: var(--orange); font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }

.btn {
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .015em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: var(--orange); box-shadow: 0 7px 18px rgba(216, 100, 58, .2); }
.btn-primary:hover { background: var(--orange-dark); }
.btn-ghost { color: var(--purple); border-color: var(--line-strong); background: #fff; }
.btn-ghost:hover { border-color: #bbb3cb; box-shadow: var(--shadow-sm); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stats-grid article, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .96); box-shadow: var(--shadow-sm); }
.stats-grid article { position: relative; min-height: 125px; padding: 21px; overflow: hidden; }
.stats-grid article::after {
  content: "";
  position: absolute;
  right: -25px;
  bottom: -34px;
  width: 95px;
  height: 95px;
  border-radius: 50%;
  background: var(--mint-soft);
}
.stats-grid article:nth-child(2)::after { background: #fbede8; }
.stats-grid article:nth-child(3)::after { background: #f6f8d9; }
.stats-grid article:nth-child(4)::after { background: var(--purple-soft); }
.stats-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .03em; }
.stats-grid strong { position: relative; z-index: 1; display: block; margin-top: 11px; color: var(--purple); font-size: 31px; line-height: 1; }

.panel { margin-bottom: 22px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 19px 22px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.panel-heading > a { font-size: 11px; font-weight: 700; text-decoration: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fbfafc; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
td { color: var(--ink-soft); font-size: 12px; }
tbody tr { transition: background-color .15s ease; }
tbody tr:hover { background: #fcfbfd; }
tbody tr:last-child td { border-bottom: 0; }
td strong { color: var(--ink); font-size: 12px; }
td small { display: block; max-width: 320px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 99px; font-size: 9px; font-weight: 700; letter-spacing: .03em; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-published { color: var(--success); background: #e4f6ed; }
.status-draft { color: #76610b; background: #fff5ca; }
.status-cancelled { color: var(--danger); background: #fae8e7; }
.row-actions { display: flex; align-items: center; gap: 11px; white-space: nowrap; }
.row-actions form { display: inline; }
.row-actions a, .link-button { border: 0; color: var(--purple); background: none; font-size: 11px; font-weight: 700; text-decoration: none; cursor: pointer; }
.row-actions a:hover, .link-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.danger { color: var(--danger); }
.empty-cell { padding: 42px; color: var(--muted); text-align: center; }

.filter-bar { display: flex; align-items: end; gap: 11px; padding: 16px 19px; border-bottom: 1px solid var(--line); background: #fdfcfe; }
label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input::placeholder, textarea::placeholder { color: #aaa6b4; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(33, 8, 90, .09); }
textarea { min-height: 90px; line-height: 1.55; resize: vertical; }
label small { color: var(--muted); font-size: 9px; font-weight: 500; }
.stack-form { display: grid; gap: 17px; }
.form-panel { padding-bottom: 22px; }
.form-panel > form, .form-panel.event-form { padding: 22px; }
.event-form .form-panel { padding: 0 22px 22px; }
.event-form .form-panel .panel-heading { margin: 0 -22px 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.form-grid-thirds { grid-template-columns: 2fr 110px 1fr; }
.check-row { min-height: 36px; display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 9px; }
.check-row input { width: 16px; min-height: 16px; accent-color: var(--orange); }
.check-bottom { min-height: 42px; align-self: end; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 21px; }
.form-panel > .stack-form { padding: 22px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .85fr); gap: 22px; }
.info-box { margin: 18px 22px 0; padding: 15px; border: 1px solid #dcefe9; border-radius: 10px; background: var(--mint-soft); font-size: 11px; }
.info-box p { margin: 4px 0 0; color: var(--ink-soft); }
.pagination { padding: 17px; }
.pagination ul { display: flex; gap: 5px; margin: 0; padding: 0; list-style: none; }
.pagination a { display: block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; text-decoration: none; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(155, 224, 214, .8), transparent 25rem),
    radial-gradient(circle at 90% 80%, rgba(235, 242, 83, .55), transparent 23rem),
    #f7f6fa;
}
.login-card { width: min(440px, 100%); padding: 37px; border: 1px solid rgba(255, 255, 255, .8); border-radius: 20px; background: rgba(255, 255, 255, .95); box-shadow: 0 24px 65px rgba(33, 8, 90, .16); }
.login-card > img { width: 165px; height: 65px; object-fit: contain; }
.login-card h1 { margin: 4px 0; font-size: 27px; line-height: 1.2; }
.login-card .muted { color: var(--muted); font-size: 12px; }
.login-card .stack-form { margin-top: 25px; }
.login-card .btn { width: 100%; }
.back-link { display: block; margin-top: 21px; font-size: 11px; font-weight: 700; text-align: center; text-decoration: none; }

@media (max-width: 1100px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: fixed; left: 0; width: 272px; transform: translateX(-105%); transition: transform .2s ease; }
  .admin-sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 35; border: 0; background: rgba(18, 9, 43, .48); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-scrim.open { display: block; opacity: 1; pointer-events: auto; }
  .sidebar-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
  .sidebar-toggle span { width: 3px; height: 3px; border-radius: 50%; background: var(--purple); }
  .sidebar-toggle b { margin-left: 3px; font-size: 10px; }
  .admin-content { padding: 26px; }
  .admin-topbar { padding: 0 26px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .admin-topbar { height: 66px; padding: 0 17px; }
  .topbar-title { display: none; }
  .admin-identity { margin-left: auto; }
  .admin-identity > span:last-child { display: none; }
  .admin-topbar .btn { min-height: 36px; padding: 7px 11px; }
  .admin-content { padding: 20px 16px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
  .page-heading h1 { font-size: 24px; }
  .page-heading .btn { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats-grid article { min-height: 105px; padding: 17px; }
  .stats-grid strong { font-size: 27px; }
  .panel { border-radius: 12px; }
  .panel-heading { padding: 17px; }
  th, td { padding: 12px 15px; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar .btn { width: 100%; }
  .form-grid, .form-grid-thirds { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .login-card { padding: 30px 23px; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
