/* ==========================================================================
   EventFlo — Design System
   Apple-inspired: generous whitespace, restrained color, soft depth, motion
   ========================================================================== */

:root {
  /* Surfaces */
  --color-bg: #f5f5f7;
  --color-surface: #ffffff;
  --color-surface-alt: #fbfbfd;
  --color-sidebar: #fbfbfd;

  /* Text */
  --color-text-primary: #1d1d1f;
  --color-text-secondary: #6e6e73;
  --color-text-tertiary: #98989d;
  --color-text-on-accent: #ffffff;

  /* Borders */
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-strong: rgba(0, 0, 0, 0.14);

  /* Accent */
  --color-accent: #0071e3;
  --color-accent-hover: #0077ed;
  --color-accent-active: #0068d1;
  --color-accent-light: rgba(0, 113, 227, 0.1);

  /* Semantic */
  --color-success: #1d9a4a;
  --color-success-light: rgba(29, 154, 74, 0.12);
  --color-warning: #b96c0d;
  --color-warning-light: rgba(255, 159, 10, 0.14);
  --color-danger: #d70015;
  --color-danger-light: rgba(255, 59, 48, 0.1);
  --color-purple: #5e5ce6;
  --color-purple-light: rgba(94, 92, 230, 0.1);

  --color-gray-light: #f0f0f2;
  --color-gray-mid: #d2d2d7;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.07), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-focus: 0 0 0 4px var(--color-accent-light);

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "Segoe UI", Helvetica, Arial, sans-serif;

  /* Layout */
  --sidebar-width: 264px;
  --topbar-height: 68px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 340ms;
}

/* ---------- Reset ---------- */
* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
h1, h2, h3, h4, h5, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea, select, button { font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--color-accent-light); }

h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }

/* Fade-in page transition */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-content { animation: fadeInUp var(--t-slow) var(--ease) both; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: var(--color-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--t-base) var(--ease);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 26px 10px;
}
.sidebar-brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(155deg, #0071e3, #5e5ce6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 3px 10px rgba(0,113,227,0.35);
  flex-shrink: 0;
}
.sidebar-brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.sidebar-brand-sub { font-size: 11px; color: var(--color-text-tertiary); margin-top: -2px; }

.sidebar-org {
  margin: 4px 4px 18px 4px;
  padding: 10px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.sidebar-org:hover { box-shadow: var(--shadow-xs); border-color: var(--color-border-strong); }
.sidebar-org-avatar {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--color-gray-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--color-text-secondary);
  flex-shrink: 0;
}
.sidebar-org-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.sidebar-org-role { font-size: 11px; color: var(--color-text-tertiary); }
.sidebar-org-caret { margin-left: auto; color: var(--color-text-tertiary); }

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 12px 6px;
}
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  cursor: pointer;
  position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: rgba(0,0,0,0.04); color: var(--color-text-primary); }
.nav-item.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-item.disabled { color: var(--color-text-tertiary); cursor: default; }
.nav-item.disabled:hover { background: none; color: var(--color-text-tertiary); }
.nav-item-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-tertiary);
  background: var(--color-gray-light);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md);
  cursor: pointer; transition: background var(--t-fast) var(--ease);
}
.sidebar-user:hover { background: rgba(0,0,0,0.04); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(155deg, #5e5ce6, #0071e3);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; }
.sidebar-user-email { font-size: 11px; color: var(--color-text-tertiary); }

.identity-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--color-gray-light);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.identity-badge:hover { background: var(--color-border); }
.identity-badge.is-admin { background: var(--color-accent-light); }
.identity-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-text-tertiary); flex-shrink: 0; }
.identity-badge.is-admin .identity-badge-dot { background: var(--color-accent); }
.identity-badge-label { font-size: 11.5px; font-weight: 600; color: var(--color-text-secondary); flex: 1; }
.identity-badge.is-admin .identity-badge-label { color: var(--color-accent); }
.identity-badge-caret { color: var(--color-text-tertiary); flex-shrink: 0; }

.main { margin-left: var(--sidebar-width); flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-height);
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 0 40px;
  background: rgba(245, 245, 247, 0.78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--color-border);
}
.topbar-title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-text-tertiary); min-width: 0; overflow: hidden; }
.topbar-crumbs a:hover { color: var(--color-text-primary); }
.topbar-crumbs a,
.topbar-crumbs > span:not([data-icon]) {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.topbar-search {
  margin-left: 8px;
  display: flex; align-items: center; gap: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  width: 260px;
  color: var(--color-text-tertiary);
  transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.topbar-search:focus-within { border-color: var(--color-accent); box-shadow: var(--shadow-focus); }
.topbar-search input { border: none; outline: none; background: none; flex: 1; font-size: 13px; color: var(--color-text-primary); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mobile-nav-toggle {
  display: none;
  width: 34px; height: 34px; border-radius: 50%;
  align-items: center; justify-content: center;
  color: var(--color-text-secondary);
  background: transparent; border: none; cursor: pointer; flex-shrink: 0;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.mobile-nav-toggle:hover { background: rgba(0,0,0,0.05); color: var(--color-text-primary); }
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; background: rgba(29,29,31,0.4);
  z-index: 45; opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--ease);
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-secondary);
  background: transparent; border: none; cursor: pointer;
  transition: background var(--t-fast) var(--ease);
  position: relative;
}
.icon-btn:hover { background: rgba(0,0,0,0.05); color: var(--color-text-primary); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--color-danger); border: 1.5px solid var(--color-bg); }

.content { padding: 36px 40px 80px; max-width: 1280px; width: 100%; margin: 0 auto; }
.content.wide { max-width: 1480px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-base) var(--ease),
    background var(--t-base) var(--ease), border-color var(--t-base) var(--ease), color var(--t-base) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { flex-shrink: 0; }

.btn-primary { background: var(--color-accent); color: #fff; box-shadow: 0 1px 2px rgba(0,113,227,0.25); }
.btn-primary:hover:not(:disabled) { background: var(--color-accent-hover); box-shadow: 0 4px 14px rgba(0,113,227,0.32); }

.btn-secondary { background: var(--color-surface); color: var(--color-text-primary); border-color: var(--color-border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--color-gray-light); }

.btn-ghost { background: transparent; color: var(--color-text-secondary); }
.btn-ghost:hover:not(:disabled) { background: rgba(0,0,0,0.05); color: var(--color-text-primary); }

.btn-danger { background: var(--color-danger-light); color: var(--color-danger); }
.btn-danger:hover:not(:disabled) { background: var(--color-danger); color: #fff; }

.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon-only { padding: 9px; border-radius: 50%; }

/* ==========================================================================
   Cards / surfaces
   ========================================================================== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: 26px 28px; }
.card-clickable { cursor: pointer; transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease), transform var(--t-base) var(--ease); }
.card-clickable:hover { box-shadow: var(--shadow-md); border-color: rgba(0,0,0,0.1); transform: translateY(-2px); }

.card-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; row-gap: 10px;
  padding: 20px 28px; border-bottom: 1px solid var(--color-border);
}
.card-header h3 { font-size: 15.5px; }
.card-body { padding: 24px 28px; }
.card-footer { padding: 16px 28px; border-top: 1px solid var(--color-border); background: var(--color-surface-alt); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ==========================================================================
   Stat cards
   ========================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.stat-label { font-size: 12.5px; color: var(--color-text-secondary); font-weight: 500; }
.stat-trend { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.stat-trend.up { color: var(--color-success); }
.stat-trend.down { color: var(--color-danger); }

/* ==========================================================================
   Badges / pills
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.01em;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-draft { background: var(--color-gray-light); color: var(--color-text-secondary); }
.badge-draft .dot { background: var(--color-text-tertiary); }
.badge-published { background: var(--color-success-light); color: var(--color-success); }
.badge-published .dot { background: var(--color-success); }
.badge-closed { background: rgba(0,0,0,0.06); color: var(--color-text-secondary); }
.badge-closed .dot { background: var(--color-text-tertiary); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge-warning .dot { background: var(--color-warning); }
.badge-paid { background: var(--color-purple-light); color: var(--color-purple); }
.badge-free { background: var(--color-warning-light); color: var(--color-warning); }
.tag {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: var(--radius-sm);
  background: var(--color-gray-light); color: var(--color-text-secondary);
}
.tag-accent { background: var(--color-accent-light); color: var(--color-accent); }

/* ==========================================================================
   Forms
   ========================================================================== */
.field-group { margin-bottom: 22px; }
.field-row { display: grid; gap: 18px; }
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.field-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--color-text-primary);
  margin-bottom: 7px;
}
.field-label .optional { font-weight: 500; color: var(--color-text-tertiary); font-size: 11.5px; }
.field-hint { font-size: 12px; color: var(--color-text-tertiary); margin-top: 6px; line-height: 1.5; }
.field-hint.warn { color: var(--color-warning); }

.input, .textarea, .select {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
  font-size: 13.5px;
}
.input::placeholder, .textarea::placeholder { color: var(--color-text-tertiary); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--color-accent); box-shadow: var(--shadow-focus); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2398989d' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 32px; }
.input-with-prefix { display: flex; align-items: center; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease); }
.input-with-prefix:focus-within { border-color: var(--color-accent); box-shadow: var(--shadow-focus); }
.input-with-prefix .prefix { padding: 10px 12px; background: var(--color-surface-alt); color: var(--color-text-tertiary); font-size: 13px; border-right: 1px solid var(--color-border); font-weight: 600; }
.input-with-prefix input { border: none; outline: none; padding: 10px 13px; flex: 1; background: none; font-size: 13.5px; }

.form-section { margin-bottom: 40px; }
.form-section-header { margin-bottom: 20px; }
.form-section-header h3 { margin-bottom: 4px; }
.form-section-header p { font-size: 13px; color: var(--color-text-secondary); }

fieldset { border: none; padding: 0; margin: 0; }

/* Toggle switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--color-border); }
.switch-copy h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.switch-copy p { font-size: 12.5px; color: var(--color-text-secondary); line-height: 1.5; }
.switch { position: relative; display: inline-block; width: 42px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--color-gray-mid); border-radius: var(--radius-pill);
  transition: background var(--t-base) var(--ease); cursor: pointer;
}
.switch .track::before {
  content: ""; position: absolute; height: 21px; width: 21px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: transform var(--t-base) var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.switch input:checked + .track { background: var(--color-success); }
.switch input:checked + .track::before { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: var(--shadow-focus); }

/* Segmented control */
.segmented { display: inline-flex; flex-wrap: wrap; background: var(--color-gray-light); border-radius: var(--radius-md); padding: 3px; gap: 2px; }
.segmented button {
  border: none; background: none; padding: 8px 16px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--color-text-secondary);
  cursor: pointer; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-base) var(--ease);
  display: flex; align-items: center; gap: 6px;
}
.segmented button.active { background: var(--color-surface); color: var(--color-text-primary); box-shadow: var(--shadow-sm); }
.segmented.block { display: flex; }
.segmented.block button { flex: 1; justify-content: center; }

/* Radio / checkbox cards */
.choice-cards { display: grid; gap: 12px; }
.choice-cards.cols-2 { grid-template-columns: 1fr 1fr; }
.choice-card {
  border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-md);
  padding: 16px 18px; cursor: pointer; position: relative;
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease);
  display: flex; gap: 12px; align-items: flex-start;
}
.choice-card:hover { border-color: var(--color-text-tertiary); }
.choice-card.selected { border-color: var(--color-accent); background: var(--color-accent-light); }
/* Keyboard-highlighted row in the owner switcher — distinct from .selected
   (which marks the currently active workspace) so the two states can be
   visible on different rows at the same time without looking contradictory. */
.owner-switch-option.kbd-focus { border-color: var(--color-accent); background: var(--color-accent-light); }
.choice-card-radio {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--color-border-strong);
  flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center;
  transition: border-color var(--t-base) var(--ease);
}
.choice-card.selected .choice-card-radio { border-color: var(--color-accent); }
.choice-card.selected .choice-card-radio::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--color-accent); }
.choice-card-title { font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }
.choice-card-desc { font-size: 12px; color: var(--color-text-secondary); line-height: 1.5; }

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 32px;
  position: sticky; top: var(--topbar-height); z-index: 20;
  background: var(--color-bg);
}
.tab {
  padding: 12px 4px; margin-right: 24px; font-size: 13.5px; font-weight: 600;
  color: var(--color-text-secondary); border-bottom: 2px solid transparent; cursor: pointer;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--color-text-primary); }
.tab.active { color: var(--color-text-primary); border-color: var(--color-accent); }
.tab .lock { color: var(--color-text-tertiary); }

/* ==========================================================================
   Tables
   ========================================================================== */
/* table-wrap shares its border-radius with the card it sits flush inside
   (no card-pad, no gap on any side) so the scroll container clips the
   header's background into the same rounded corners as the card itself —
   symmetric on the left and right, not just one side. */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
/* Long registrant/roster lists get their own vertical scroll instead of
   stretching the whole page — the header stays put via a sticky thead so
   column labels are still visible while scrolling through rows, and the
   page itself stays a normal, scrollable length around the card. */
.table-wrap.table-wrap-scroll { max-height: 560px; overflow-y: auto; }
.table-wrap.table-wrap-scroll thead th { position: sticky; top: 0; z-index: 1; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--color-text-tertiary);
  text-transform: uppercase; letter-spacing: 0.05em; padding: 20px 20px 18px;
  background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border-strong);
}
.data-table tbody td { padding: 16px 20px; border-bottom: 1px solid var(--color-border); font-size: 13.5px; vertical-align: middle; }
.data-table tbody tr { transition: background var(--t-fast) var(--ease); cursor: pointer; }
.data-table tbody tr:hover { background: var(--color-surface-alt); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ==========================================================================
   Event cards (dashboard / list)
   ========================================================================== */
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.event-card { padding: 20px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.event-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.event-card-cover {
  height: 84px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 20px; letter-spacing: -0.02em;
  position: relative; overflow: hidden; margin-bottom: 2px;
}
.event-card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 3px; }
.event-card-meta { font-size: 12px; color: var(--color-text-secondary); display: flex; align-items: center; gap: 6px; }
.event-card-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--color-border); font-size: 12px; color: var(--color-text-secondary); }
.event-card-stat { display: flex; align-items: center; gap: 5px; font-weight: 600; color: var(--color-text-primary); }

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 70px 30px; }
.empty-state-icon {
  width: 56px; height: 56px; border-radius: 16px; background: var(--color-gray-light);
  display: flex; align-items: center; justify-content: center; color: var(--color-text-tertiary); margin-bottom: 18px;
}
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--color-text-secondary); max-width: 340px; margin-bottom: 20px; }

/* ==========================================================================
   Misc utility
   ========================================================================== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--color-border); border: none; margin: 28px 0; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 30px; gap: 20px; }
.page-header p { color: var(--color-text-secondary); margin-top: 6px; font-size: 14px; }
.pill-select { display: inline-flex; gap: 8px; }

/* Save bar */
.save-bar {
  position: sticky; bottom: 20px; margin-top: 30px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(29,29,31,0.92);
  backdrop-filter: blur(14px);
  color: #fff; padding: 14px 20px 14px 24px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(120%);
  opacity: 0;
  transition: transform var(--t-slow) var(--ease), opacity var(--t-slow) var(--ease);
}
.save-bar.visible { transform: translateY(0); opacity: 1; }
.save-bar span { font-size: 13px; color: rgba(255,255,255,0.75); }
.save-bar .btn-secondary { background: rgba(255,255,255,0.12); color: #fff; border-color: transparent; }
.save-bar .btn-secondary:hover { background: rgba(255,255,255,0.2); }
.save-bar .btn-primary { background: #fff; color: #1d1d1f; box-shadow: none; }
.save-bar .btn-primary:hover { background: #f0f0f2; }

/* Toast */
.toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: #1d1d1f; color: #fff; padding: 12px 18px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn var(--t-slow) var(--ease) both;
}
.toast .tick { color: var(--color-success); flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(29,29,31,0.4); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 150;
  opacity: 0; pointer-events: none; transition: opacity var(--t-base) var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 440px; max-width: 90vw; padding: 28px; transform: scale(0.95) translateY(8px); transition: transform var(--t-base) var(--ease);
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal h3 { margin-bottom: 10px; }
.modal p { font-size: 13.5px; color: var(--color-text-secondary); line-height: 1.6; margin-bottom: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; border: 2.5px solid var(--color-bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .field-row.cols-2, .field-row.cols-3 { grid-template-columns: 1fr; }
}
/* ==========================================================================
   Progress bars / capacity meters
   ========================================================================== */
.progress-track { height: 6px; border-radius: var(--radius-pill); background: var(--color-gray-light); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-pill); background: var(--color-accent); transition: width var(--t-slow) var(--ease); }
.progress-fill.warn { background: var(--color-warning); }
.progress-fill.full { background: var(--color-danger); }

/* Provider / client cards */
.provider-card, .client-card { display: flex; flex-direction: column; gap: 14px; }
.provider-card-top, .client-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.provider-logo {
  width: 42px; height: 42px; border-radius: 11px; background: var(--color-gray-light);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: var(--color-text-secondary);
}
.kv-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-size: 12.5px; border-top: 1px solid var(--color-border); }
.kv-row:first-child { border-top: none; }
.kv-label { color: var(--color-text-tertiary); }
.kv-value { font-weight: 600; text-align: right; }

/* Revenue display (used on any report/payments page showing money by currency) */
.revenue-card .stat-value { font-size: 17px; line-height: 1.5; }
.revenue-line { display: flex; align-items: baseline; gap: 6px; }
.revenue-line .amt { font-size: 20px; font-weight: 700; }
.revenue-line .cur { font-size: 11px; color: var(--color-text-tertiary); font-weight: 600; }

/* Report/table section headers (heading + search or filter control on one line) */
.stats-section-head { display: flex; align-items: center; justify-content: space-between; margin: 44px 0 16px; flex-wrap: wrap; gap: 12px; }
.stats-section-head:first-of-type { margin-top: 0; }

/* Chart containers */
.chart-card { padding: 24px 26px; }
.chart-card canvas { max-height: 240px; }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); z-index: 50; }
  .main { margin-left: 0; }
  .content { padding: 24px 20px 60px; }
  .topbar { padding: 0 20px; }
  .topbar-search { display: none; }
  .mobile-nav-toggle { display: flex; }
  .sidebar-backdrop.open { display: block; opacity: 1; pointer-events: auto; }
  .topbar-crumbs a,
  .topbar-crumbs > span:not([data-icon]) { max-width: 110px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .choice-cards.cols-2 { grid-template-columns: 1fr; }
  .modal { padding: 22px; }
}
