:root {
  --me-ink: #15243a;
  --me-muted: #6c7a8f;
  --me-line: #dce4ed;
  --me-soft: #f5f8fc;
  --me-card: #ffffff;
  --me-navy: #003b70;
  --me-navy-dark: #00264d;
  --me-orange: #ff8400;
  --me-danger: #b42318;
  --me-success: #087a52;
  --me-brand: radial-gradient(circle at top right, rgba(255, 132, 0, 0.14), transparent 32%), linear-gradient(135deg, rgba(0, 38, 77, 0.96), rgba(0, 59, 112, 0.96));
}

.manage-events-v2 {
  min-height: 100vh;
  background: #f4f7fb;
  color: var(--me-ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.manage-events-v2 form,
.me-modal form {
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.manage-events-v2 button,
.manage-events-v2 input,
.manage-events-v2 select,
.manage-events-v2 textarea,
.me-modal button,
.me-modal input,
.me-modal select,
.me-modal textarea {
  font: inherit;
  margin: 0;
}

.manage-events-v2 button,
.me-modal button {
  width: auto;
}

.me-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.me-page-header h1 {
  margin: 2px 0 5px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.me-page-header p,
.me-modal-head p {
  color: var(--me-muted);
  margin: 0;
  line-height: 1.45;
}

.me-eyebrow {
  color: var(--me-navy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.me-header-actions,
.me-event-actions,
.me-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.me-btn,
.me-action-btn,
.me-icon-btn {
  appearance: none;
  border: 0;
  text-decoration: none !important;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.me-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
  white-space: nowrap;
}

.me-btn-primary {
  color: #fff !important;
  background: var(--me-brand);
  box-shadow: 0 7px 20px rgba(0, 59, 112, .17);
}

.me-btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }

.me-btn-secondary {
  color: var(--me-navy) !important;
  background: #fff;
  border: 1px solid var(--me-line);
}

.me-btn-secondary:hover,
.me-btn-quiet:hover {
  border-color: #9bb8d4;
  background: #f8fbff;
}

.me-btn-quiet {
  color: var(--me-muted);
  background: transparent;
  border: 1px solid transparent;
}

.me-btn-small { min-height: 34px; padding: 0 11px; font-size: 13px; }

.me-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 650;
  border: 1px solid;
}

.me-alert-success { color: #065f46; background: #ecfdf3; border-color: #b7ead2; }
.me-alert-error { color: #8a1c13; background: #fff1f0; border-color: #f2c3bf; }

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

.me-stat {
  background: #fff;
  border: 1px solid var(--me-line);
  border-radius: 12px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 3px 12px rgba(21, 36, 58, .035);
}

.me-stat span { color: var(--me-muted); font-size: 13px; font-weight: 650; }
.me-stat strong { color: var(--me-navy); font-size: 22px; }

.me-controls {
  background: #fff;
  border: 1px solid var(--me-line);
  border-radius: 13px;
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: 0 4px 15px rgba(21, 36, 58, .04);
}

.me-tabs {
  display: flex;
  gap: 4px;
  padding-bottom: 11px;
  margin-bottom: 11px;
  border-bottom: 1px solid #e9eef4;
  overflow-x: auto;
}

.me-tab {
  border: 0;
  background: transparent;
  color: var(--me-muted);
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.me-tab span {
  display: inline-flex;
  min-width: 21px;
  height: 21px;
  margin-left: 4px;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  background: #edf2f7;
  font-size: 11px;
}

.me-tab.active {
  color: #fff;
  background: var(--me-brand);
}

.me-tab.active span { color: var(--me-navy); background: #fff; }

.me-filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(130px, .55fr) minmax(130px, .55fr) minmax(150px, .65fr) auto;
  gap: 8px;
  align-items: end;
}

.me-search {
  position: relative;
  display: block;
}

.me-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #8b9aab;
  pointer-events: none;
}

.me-search input,
.me-compact-field input,
.me-compact-field select,
.me-field input,
.me-field select,
.me-field textarea {
  width: 100%;
  border: 1px solid var(--me-line);
  background: #fff;
  color: var(--me-ink);
  border-radius: 9px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.me-search input { height: 42px; padding: 0 12px 0 36px; }

.me-search input:focus,
.me-compact-field input:focus,
.me-compact-field select:focus,
.me-field input:focus,
.me-field select:focus,
.me-field textarea:focus {
  border-color: #6b9bc7;
  box-shadow: 0 0 0 3px rgba(0, 59, 112, .09);
}

.me-compact-field { display: grid; gap: 4px; }
.me-compact-field > span { color: var(--me-muted); font-size: 11px; font-weight: 750; }
.me-compact-field input,
.me-compact-field select { height: 42px; padding: 0 9px; }

.me-result-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
  color: var(--me-muted);
  font-size: 12px;
}

.me-event-list { display: grid; gap: 11px; }

.me-event-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 15px;
  align-items: start;
  background: var(--me-card);
  border: 1px solid var(--me-line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 3px 14px rgba(21, 36, 58, .045);
  scroll-margin-top: 16px;
}

.me-event-card.me-focus {
  border-color: var(--me-orange);
  box-shadow: 0 0 0 3px rgba(255, 132, 0, .12), 0 5px 18px rgba(21, 36, 58, .08);
}

.me-date-block {
  width: 72px;
  min-height: 76px;
  border-radius: 11px;
  background: var(--me-brand);
  color: #fff;
  display: grid;
  place-items: center;
  align-content: center;
  line-height: 1;
  box-shadow: 0 7px 18px rgba(0, 59, 112, .15);
}

.me-date-block strong { font-size: 27px; margin: 3px 0; }
.me-date-block span { font-size: 11px; font-weight: 800; letter-spacing: .07em; }
.me-date-month { color: #ffd2a1; }

.me-event-main { min-width: 0; }
.me-event-main h2 { margin: 6px 0 4px; font-size: 20px; line-height: 1.15; letter-spacing: -.015em; }

.me-event-meta,
.me-event-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 12px;
  color: var(--me-muted);
  font-size: 12px;
  font-weight: 650;
}

.me-event-description {
  max-width: 850px;
  color: #536176;
  margin: 0 0 7px;
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.me-muted { color: #9aa6b5; font-style: italic; }

.me-status {
  padding: 4px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.me-status-live { color: #06613f; background: #dff7eb; }
.me-status-upcoming { color: #07538f; background: #e3f1ff; }
.me-status-past { color: #687586; background: #edf1f5; }

.me-event-actions {
  justify-content: flex-end;
  max-width: 390px;
}

.me-inline-form { margin: 0; padding: 0; }

.me-action-btn {
  min-height: 34px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid #e0e7ef;
  color: #33455b !important;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 750;
}
.me-action-btn:hover { color: var(--me-navy) !important; border-color: #9bb8d4; background: #f7fbff; }
.me-action-danger { color: var(--me-danger) !important; }
.me-action-danger:hover { color: #fff !important; border-color: var(--me-danger); background: var(--me-danger); }

.me-options {
  grid-column: 1 / -1;
  border-top: 1px solid #edf1f5;
  padding-top: 11px;
}

.me-options > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #32445b;
  font-size: 13px;
  font-weight: 750;
  user-select: none;
}
.me-options > summary::-webkit-details-marker { display: none; }
.me-options > summary b {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  border-radius: 99px;
  background: #eaf2fb;
  color: var(--me-navy);
  font-size: 11px;
}
.me-summary-hint { color: #93a0af; font-size: 11px; font-weight: 600; }

.me-options-body { padding-top: 13px; }
.me-options-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.me-options-toolbar > div { display: grid; gap: 2px; }
.me-options-toolbar strong { font-size: 13px; }
.me-options-toolbar span { color: var(--me-muted); font-size: 11px; }

.me-option-list { display: grid; gap: 6px; }
.me-option-row {
  display: grid;
  grid-template-columns: 5px minmax(170px, 1.5fr) minmax(110px, .55fr) minmax(140px, .7fr) minmax(90px, .45fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  background: #f9fbfd;
  border: 1px solid #e6ecf3;
  border-radius: 10px;
  padding: 8px 9px 8px 0;
}
.me-option-colour { align-self: stretch; width: 5px; border-radius: 8px 0 0 8px; background: var(--option-colour, #003b70); }
.me-option-name,
.me-option-chip { display: grid; min-width: 0; }
.me-option-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.me-option-name span,
.me-option-chip span { color: var(--me-muted); font-size: 10px; }
.me-option-chip strong { color: #293a50; font-size: 12px; }
.me-no-options {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed #cdd8e4;
  background: #fafcff;
  border-radius: 10px;
  padding: 13px;
}
.me-no-options > div:first-child { color: var(--me-navy); font-size: 20px; }
.me-no-options > div:last-child { display: grid; gap: 2px; }
.me-no-options strong { font-size: 13px; }
.me-no-options span { color: var(--me-muted); font-size: 11px; }

.me-empty {
  min-height: 260px;
  background: #fff;
  border: 1px dashed #c9d5e2;
  border-radius: 14px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 25px;
}
.me-empty > i { color: #6e92b5; font-size: 28px; margin-bottom: 8px; }
.me-empty h2 { margin: 0 0 5px; font-size: 18px; }
.me-empty p { margin: 0 0 12px; color: var(--me-muted); }

.me-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 18, 31, .58);
  backdrop-filter: blur(3px);
}
.me-modal.open { display: flex; }
body.me-modal-open { overflow: hidden; }

.me-modal-dialog {
  width: min(620px, 100%);
  max-height: min(90vh, 850px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: 0 24px 70px rgba(0, 22, 45, .28);
  padding: 20px;
}
.me-modal-wide { width: min(760px, 100%); }
.me-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 15px;
  border-bottom: 1px solid #edf1f5;
}
.me-modal-head h2 { margin: 2px 0 3px; font-size: 22px; }
.me-icon-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #5f6d7d;
  background: #f3f6f9;
}
.me-icon-btn:hover { color: var(--me-navy); background: #eaf2fb; }

.me-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.me-field { display: grid; gap: 5px; min-width: 0; }
.me-field > span { color: #34465c; font-size: 12px; font-weight: 750; }
.me-field small { color: var(--me-muted); font-weight: 550; }
.me-field input,
.me-field select { height: 42px; padding: 0 10px; }
.me-field textarea { min-height: 70px; padding: 10px; resize: vertical; }
.me-span-2 { grid-column: 1 / -1; }
.me-colour-input { padding: 4px !important; cursor: pointer; }

.me-time-summary {
  margin-top: -3px;
  padding: 8px 10px;
  color: #516176;
  background: #f7f9fc;
  border-radius: 8px;
  font-size: 11px;
}

.me-rule-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid #cfe0f0;
  border-radius: 9px;
  background: #f3f8fd;
  color: #40536a;
  font-size: 11px;
  line-height: 1.4;
}
.me-rule-note i { color: var(--me-navy); margin-top: 2px; }

.me-advanced {
  border: 1px solid #e2e9f0;
  border-radius: 10px;
  background: #fafcfe;
  overflow: hidden;
}
.me-advanced > summary {
  cursor: pointer;
  padding: 11px 12px;
  color: #3d5067;
  font-size: 12px;
  font-weight: 750;
}
.me-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  padding: 0 12px 12px;
}
.me-advanced-note { margin: 0; color: var(--me-muted); font-size: 11px; }

.me-modal-actions {
  justify-content: flex-end;
  padding-top: 13px;
  margin-top: 2px;
  border-top: 1px solid #edf1f5;
}

.me-day-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.me-day { position: relative; }
.me-day input { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.me-day span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--me-line);
  border-radius: 8px;
  color: #5c6c80;
  background: #fff;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.me-day input:checked + span { color: #fff; background: var(--me-brand); border-color: transparent; }

.me-check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.me-check input { width: auto; height: auto; padding: 0; margin: 3px 0 0; accent-color: var(--me-navy); }
.me-check span { display: grid; gap: 2px; }
.me-check strong { font-size: 12px; }
.me-check small { color: var(--me-muted); font-size: 11px; line-height: 1.35; }

@media (max-width: 1180px) {
  .me-filter-row { grid-template-columns: minmax(200px, 1.2fr) repeat(3, minmax(120px, .6fr)); }
  .me-filter-row > .me-btn { grid-column: 1 / -1; justify-self: start; }
  .me-event-card { grid-template-columns: 72px minmax(0, 1fr); }
  .me-event-actions { grid-column: 1 / -1; justify-content: flex-start; padding-left: 87px; }
  .me-option-row { grid-template-columns: 5px minmax(160px, 1.4fr) repeat(3, minmax(90px, .6fr)) auto; }
}

@media (max-width: 900px) {
  .me-page-header { align-items: flex-start; flex-direction: column; }
  .me-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .me-filter-row { grid-template-columns: 1fr 1fr; }
  .me-search { grid-column: 1 / -1; }
  .me-sort-field { grid-column: 1 / 2; }
  .me-filter-row > .me-btn { grid-column: 2 / 3; justify-self: stretch; }
  .me-option-row { grid-template-columns: 5px minmax(150px, 1fr) 1fr 1fr auto; }
  .me-option-capacity { display: none; }
}

@media (max-width: 680px) {
  .manage-events-v2 { padding: 15px 10px !important; }
  .me-header-actions { width: 100%; }
  .me-header-actions .me-btn { flex: 1; }
  .me-stats { grid-template-columns: 1fr 1fr; }
  .me-stat { padding: 11px; }
  .me-stat strong { font-size: 19px; }
  .me-controls { padding: 9px; }
  .me-filter-row { grid-template-columns: 1fr; }
  .me-search, .me-sort-field, .me-filter-row > .me-btn { grid-column: auto; }
  .me-filter-hint { display: none; }
  .me-event-card { grid-template-columns: 58px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .me-date-block { width: 58px; min-height: 65px; }
  .me-date-block strong { font-size: 23px; }
  .me-event-main h2 { font-size: 17px; }
  .me-event-actions { padding-left: 0; }
  .me-action-btn span { display: none; }
  .me-action-btn { width: 36px; padding: 0; }
  .me-options-toolbar { align-items: flex-start; flex-direction: column; }
  .me-options-toolbar .me-btn { width: 100%; }
  .me-option-row { grid-template-columns: 5px minmax(0, 1fr) auto; gap: 8px; }
  .me-option-chip { display: none; }
  .me-option-row .me-btn { min-height: 32px; font-size: 11px; padding: 0 9px; }
  .me-summary-hint { display: none; }
  .me-form, .me-advanced-grid { grid-template-columns: 1fr; }
  .me-span-2 { grid-column: auto; }
  .me-day-grid { grid-template-columns: repeat(4, 1fr); }
  .me-modal { padding: 8px; }
  .me-modal-dialog { padding: 15px; max-height: 94vh; border-radius: 13px; }
}
