@import url("/css/tokens.css");
*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 420px at 10% -5%, rgba(244, 114, 182, 0.18), transparent 65%),
    radial-gradient(900px 320px at 90% -8%, rgba(253, 186, 116, 0.14), transparent 66%),
    linear-gradient(180deg, #fff7fb 0%, var(--spark-bg) 44%, #f4f7fc 100%);
  color: var(--spark-text);
}

a { color: inherit; }

.admin-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

.section-card {
  max-width: 1240px;
  margin-top: 22px;
}

.card {
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0) 28%);
}

.card > * { position: relative; }

.admin-banner {
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ffe4ef 0%, #ffeef5 100%);
  color: #7f1d39;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(244, 114, 182, 0.16);
}

.admin-banner .name {
  color: var(--spark-pink-dark);
  font-weight: 800;
}

.admin-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-nav-sticky {
  position: sticky;
  top: 8px;
  z-index: 10;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--spark-border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.09);
}

.admin-brand {
  font-size: 31px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  text-decoration: none;
  color: #0f172a;
  margin-right: 6px;
  padding: 8px 2px;
}

.admin-nav a {
  text-decoration: none;
  color: #1e293b;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.admin-nav a:hover {
  border-color: var(--spark-border);
  background: #fff;
  transform: translateY(-1px);
}

.admin-nav a.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(120deg, var(--spark-pink), var(--spark-pink-dark));
  box-shadow: 0 12px 24px rgba(225, 29, 72, 0.26);
}

.admin-nav .back-link {
  margin-left: auto;
  border: 1px solid var(--spark-border);
  background: #fff;
}

.section-title {
  margin: 0 0 12px;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--spark-text-strong);
}

.subsection-title {
  margin: 0 0 12px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--spark-text-strong);
}

.title-tight {
  margin: 0;
}

.subtle { color: var(--spark-muted); font-size: 13px; }
.muted { color: var(--spark-muted); }

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.toolbar.formbar { align-items: flex-end; }
.toolbar.formbar .btn { align-self: flex-end; }
.toolbar .spacer { flex: 1; }
.toolbar.align-start { align-items: flex-start; }

.toolbar .field { min-width: 160px; }
.toolbar .field.field-sm { min-width: 120px; }
.toolbar .field.field-md { min-width: 180px; }
.toolbar .field.field-lg { min-width: 220px; }
.toolbar .field.field-xl { min-width: 260px; }
.toolbar .field.field-grow { flex: 1; min-width: 260px; }

.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }

.heading-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.event-link {
  font-weight: 800;
  color: #111827;
  text-decoration: none;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.participants-panel {
  display: none;
  margin-top: 12px;
}

.text-left { text-align: left; }

.adhoc-recipient-suggestions {
  margin-top: 4px;
  padding: 8px;
  max-height: 200px;
  overflow: auto;
}

.adhoc-recipient-option {
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 8px;
}

.adhoc-recipient-option:hover {
  background: #f8fafc;
}

.chip.chip-removable {
  margin: 4px 6px 4px 0;
}

.chip-remove {
  border: none;
  background: transparent;
  padding: 0 4px;
  font-size: 12px;
  color: inherit;
  cursor: pointer;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(203,213,225,0.1) 0%, rgba(203,213,225,0.9) 35%, rgba(203,213,225,0.1) 100%);
  margin: 14px 0;
}

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

.stack { display: flex; flex-direction: column; gap: 12px; }

.section-space { margin-bottom: 16px; }
.section-space-lg { margin-bottom: 24px; }

.shortcut-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-scroll { overflow-x: auto; }

.table {
  background: #fff;
  border: 1px solid #e6eaf3;
  border-radius: 14px;
}

.table th {
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fbfcff 0%, #f3f6fb 100%);
}

.table td { vertical-align: middle; }

.table tbody tr:nth-child(even) td {
  background: #fcfdff;
}

.table tr:hover td {
  background: #fff4f8;
}

.table-tight td, .table-tight th { white-space: nowrap; }
.text-ellipsis { max-width: 520px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tactions { display: flex; flex-wrap: wrap; gap: 8px; }

.pager-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.kpi-grid > .card,
.kpi-card {
  border-radius: 14px;
  border: 1px solid #e8edf7;
  background: linear-gradient(180deg, #ffffff 0%, #f9fcff 100%);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  padding: 12px 14px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.01em;
}

.kpi-value {
  margin-top: 2px;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.chart-card { min-height: 336px; }

.chart-wrap {
  position: relative;
  margin-top: 6px;
}

.chart-svg {
  width: 100%;
  height: 252px;
  display: block;
  border: 1px solid #e7eaf2;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.chart-svg.bars {
  height: 228px;
}

.chart-legend {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #334155;
  font-weight: 600;
}

.chart-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  min-width: 170px;
  max-width: 260px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.16);
  padding: 9px 10px;
  font-size: 12px;
  color: #0f172a;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.chart-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.chart-tooltip .date {
  margin-bottom: 6px;
  color: #475569;
  font-weight: 700;
}

.chart-tooltip .row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.chart-tooltip .name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  margin-bottom: 5px;
}

.bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #fb7185, #f43f5e);
}

.util {
  position: relative;
  min-width: 120px;
  height: 20px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.util-fill {
  height: 100%;
  background: linear-gradient(90deg, #f43f5e, #fb7185);
}

.util span {
  position: absolute;
  right: 8px;
  top: 2px;
  font-size: 11px;
  color: #0f172a;
  font-weight: 700;
}

.state-msg { color: #15803d; }
.state-msg.error { color: #dc2626; }
.state-msg:empty { display: none; }

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  display: none;
}

.toast.show { display: block; }

/* Selection/feedback helpers */
#editor-card,
#udetail,
#phases-card,
#registrations-card,
#coupons-card { scroll-margin-top: 96px; }

.admin-flash { animation: adminFlash 650ms ease-out; }

@keyframes adminFlash {
  0% { box-shadow: var(--shadow-soft), 0 0 0 0 rgba(244,63,94,0.0); border-color: var(--spark-border); }
  35% { box-shadow: var(--shadow-soft), 0 0 0 6px rgba(244,63,94,0.22); border-color: #fb7185; }
  100% { box-shadow: var(--shadow-soft); border-color: var(--spark-border); }
}

/* Compact actions */
.admin-actions-desktop { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-actions-mobile { display: none; }
.admin-actions-mobile .admin-actions-primary { width: 100%; }
.admin-actions-mobile .admin-actions-primary .btn,
.admin-actions-mobile .admin-actions-primary a.btn { width: 100%; }
.admin-actions-mobile .admin-actions-more { margin-top: 8px; width: 100%; }
.admin-actions-mobile .admin-actions-more > summary { width: 100%; }
.admin-actions-mobile .admin-actions-more .admin-actions-more-body { flex-direction: column; }
.admin-actions-mobile .admin-actions-more .btn,
.admin-actions-mobile .admin-actions-more a.btn { width: 100%; }
.admin-actions-primary { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-actions-more > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--spark-border);
  background: #fff;
  color: var(--spark-text);
  cursor: pointer;
  user-select: none;
}

.admin-actions-more > summary::-webkit-details-marker { display: none; }
.admin-actions-more[open] > summary { box-shadow: var(--focus-ring); }
.admin-actions-more .admin-actions-more-body { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Phase builder layout */
.phase-builder {
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border: 1px solid #e8edf7;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.phase-builder .inline-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.phase-builder .inline-controls > div { min-width: 140px; }
.phase-builder .inline-controls button { height: 44px; }
.phase-status { font-size: 13px; color: #6b7280; margin-left: 8px; }
.phases-table { border: 1px solid #e8edf7; border-radius: 12px; overflow: hidden; }
.phases-table .table-row { display: grid; grid-template-columns: 130px 1fr 200px 200px 70px; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f1f5f9; }
.phases-table .table-head { background: #f8fafc; font-weight: 700; }
.phases-table input { width: 100%; }
.phase-actions { display: flex; justify-content: flex-end; }

/* Confirmation modal helper classes */
.admin-confirm-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}

.admin-confirm-body {
  margin-bottom: 14px;
}

.admin-confirm-input-wrap {
  display: none;
  margin: 10px 0 14px;
}

.admin-confirm-input-hint {
  margin-top: 6px;
}

.table-empty-row td {
  text-align: center;
  color: #6b7280;
}

.table-error-row td {
  text-align: center;
  color: #dc2626;
}

/* Mobile-friendly table rendering (table -> card list) */
@media (max-width: 720px) {
  .admin-shell { padding: 12px; }

  .admin-nav-sticky {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 14px;
    padding: 10px;
  }

  .admin-nav-sticky::-webkit-scrollbar { display: none; }

  .admin-brand {
    font-size: 25px;
    flex: 0 0 auto;
    margin-right: 4px;
  }

  .admin-nav a { white-space: nowrap; flex: 0 0 auto; font-size: 13px; padding: 8px 11px; }
  .admin-nav .back-link { margin-left: 0; }

  .section-title { font-size: 22px; }
  .subsection-title { font-size: 18px; }

  .grid.two { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .chart-card { min-height: 300px; }
  .chart-svg { height: 224px; }

  .table.table-mobile-cards,
  .table.table-mobile-cards thead,
  .table.table-mobile-cards tbody,
  .table.table-mobile-cards tr,
  .table.table-mobile-cards th,
  .table.table-mobile-cards td { display: block; }

  .table.table-mobile-cards { border-collapse: separate; border-spacing: 0; }
  .table.table-mobile-cards thead { display: none; }
  .table.table-mobile-cards tbody { display: flex; flex-direction: column; gap: 12px; }
  .table.table-mobile-cards tr {
    background: var(--spark-surface);
    border: 1px solid var(--spark-border);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
  }
  .table.table-mobile-cards td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    font-size: 14px;
  }
  .table.table-mobile-cards td:last-child { border-bottom: none; }
  .table.table-mobile-cards td::before {
    content: attr(data-label);
    font-size: 12px;
    color: var(--spark-muted);
    padding-top: 2px;
    min-width: 92px;
    flex: 0 0 auto;
  }
  .table.table-mobile-cards td[data-label="Actions"]::before { padding-top: 10px; }
  .table.table-mobile-cards .tactions { display: flex; flex-direction: column; gap: 8px; width: 100%; }
  .table.table-mobile-cards .tactions .btn,
  .table.table-mobile-cards .tactions a.btn { width: 100%; }
  .table.table-mobile-cards td { white-space: normal; }
  .table.table-mobile-cards td .badge { white-space: nowrap; }

  .admin-actions-desktop { display: none; }
  .admin-actions-mobile { display: block; width: 100%; }

  .phases-table .table-head { display: none; }
  .phases-table .table-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  .phases-table .phase-cell {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
  }
  .phases-table .phase-cell::before {
    content: attr(data-label);
    font-size: 12px;
    color: var(--spark-muted);
    padding-top: 2px;
    min-width: 80px;
    flex: 0 0 auto;
  }
  .phases-table .phase-cell input { width: 100%; }

  #editor-card,
  #udetail,
  #phases-card,
  #registrations-card,
  #coupons-card { scroll-margin-top: 118px; }
}
