:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #e4e9f1;
  --text: #182033;
  --muted: #758195;
  --blue: #2563eb;
  --blue-soft: #eef4ff;
  --blue-dark: #1d4ed8;
  --green: #15803d;
  --green-soft: #eafaf1;
  --orange: #b45309;
  --orange-soft: #fff7e8;
  --red: #dc2626;
  --red-soft: #fff1f0;
  --shadow: 0 8px 24px rgba(24, 32, 51, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 68px);
}

.sidebar {
  padding: 20px 12px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.nav-btn {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 6px;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-btn:hover {
  background: #f7f9fc;
  color: var(--text);
}

.nav-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 650;
}

.content {
  min-width: 0;
  padding: 24px 28px 44px;
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.metric {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 9px;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-size: 20px;
}

.panel-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.input {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.toolbar .input {
  min-width: 170px;
}

.toolbar input:first-child {
  min-width: 260px;
}

.primary-btn,
.outline-btn {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 9px;
  font-weight: 650;
}

.primary-btn {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.primary-btn:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

.outline-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.outline-btn:hover {
  border-color: #cbd4e1;
  background: #fafbfd;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #fafbfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.data-table tbody tr:hover {
  background: #fafcff;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.event-title {
  color: var(--text);
  font-weight: 700;
}

.cell-muted {
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f0f3f8;
  color: #667085;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.status.published {
  background: var(--green-soft);
  color: var(--green);
}

.status.pending_review {
  background: var(--orange-soft);
  color: var(--orange);
}

.status.draft {
  background: #eef2f7;
  color: #667085;
}

.status.archived {
  background: #f5f6f8;
  color: #8a94a6;
}

.action-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 4px;
  font-size: 13px;
}

.action-btn:hover {
  color: var(--blue-dark);
}

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

.action-btn.danger:hover {
  color: #b91c1c;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(24, 32, 51, 0.38);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 16px;
  background: var(--panel);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(24, 32, 51, 0.16);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-head h2 {
  margin: 0;
}

.close-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #47546a;
  font-size: 13px;
  font-weight: 600;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.textarea {
  min-height: 90px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  padding: 11px 18px;
  border-radius: 999px;
  background: #182033;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

  .sidebar {
    display: flex;
    overflow-x: auto;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-btn {
    width: auto;
    white-space: nowrap;
  }

  .overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2 {
    grid-column: span 1;
  }
}
