/* ── Site-wide navigation ── */
.site-nav {
  background: var(--purple);
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 48px;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.site-nav-brand {
  text-decoration: none;
  margin-right: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.site-nav-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  display: block;
  /* Make the white/dark logo visible on the purple bar */
  filter: brightness(0) invert(1);
}
.site-nav-links {
  display: flex;
  gap: 2px;
  flex: 1;
}
.site-nav-links a {
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 600;
  font-family: var(--font-title);
  padding: 5px 11px;
  border-radius: 6px;
  transition: background .13s, color .13s;
  white-space: nowrap;
}
.site-nav-links a:hover { background: rgba(255,255,255,.13); color: #fff; }
.site-nav-links a.active { background: rgba(255,255,255,.2); color: #fff; }
.site-nav-divider {
  width: 1px; height: 22px;
  background: rgba(255,255,255,.22);
  margin: 0 8px; flex-shrink: 0;
}

/* ── Profile dropdown (top-right of nav) ── */
.nav-profile {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-profile-btn {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 7px;
  color: white;
  font-size: .9rem;
  padding: 5px 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .12s;
  font-family: var(--font-title);
  font-weight: 600;
  line-height: 1;
}
.nav-profile-btn:hover { background: rgba(255,255,255,.28); }
.nav-profile-admin-tag {
  font-size: .62rem;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: .04em;
  margin-left: 1px;
}
.nav-profile-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  background: white;
  border: 1px solid #e5e5ea;
  border-radius: 11px;
  box-shadow: 0 10px 32px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.08);
  min-width: 190px;
  z-index: 9999;
  display: none;
  overflow: hidden;
}
.nav-profile-dropdown.open { display: block; }
.nav-profile-header {
  padding: 13px 16px 10px;
}
.nav-profile-username {
  font-family: var(--font-title);
  font-size: .9rem;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.2;
}
.nav-profile-role-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 7px;
  border-radius: 10px;
  background: #ede9fe;
  color: #6d28d9;
}
.nav-profile-sep {
  height: 1px;
  background: #f0f0f5;
  margin: 2px 0;
}
.nav-profile-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: .82rem;
  font-weight: 500;
  color: #333;
  text-decoration: none;
  transition: background .1s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
}
.nav-profile-item:hover { background: #f5f5fa; color: var(--purple); }
.nav-profile-item.signout:hover { background: #fef2f2; color: #b91c1c; }

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple: #5C2192;
  --purple-dark: #451878;
  --purple-light: #AB6FFF;
  --blue: #4681CA;
  --blue-dark: #3368ad;
  --red: #ED1944;
  --red-dark: #c8143a;
  --white: #ffffff;
  --gray-50: #f9f9fb;
  --gray-100: #f2f2f5;
  --gray-200: #e4e4ea;
  --gray-400: #a0a0b0;
  --gray-600: #555568;
  --gray-900: #1a1a2e;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-title: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.10);
}

body {
  font-family: var(--font-ui);
  color: var(--gray-900);
  background: var(--gray-50);
  min-height: 100vh;
}

/* ════════════════════════════════════
   INDEX PAGE
   ════════════════════════════════════ */
.index-page {
  background: var(--gray-50);
  min-height: calc(100vh - 48px);
  padding: 0;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2.25rem 2rem;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.card-logo img {
  height: 52px;
  object-fit: contain;
}
.logo-fallback {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: -0.5px;
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-900);
  text-align: center;
}
.card-subtitle {
  font-size: 0.9rem;
  color: var(--gray-600);
  text-align: center;
  margin-top: -0.5rem;
}

/* ── Form fields ── */
.field-group { width: 100%; }
.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.select-wrapper { position: relative; }
.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
  font-size: 0.85rem;
}

.styled-select, .styled-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--gray-900);
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  outline: none;
  appearance: none;
  transition: border-color 0.15s;
}
.styled-select:focus, .styled-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(92, 33, 146, 0.12);
}
.styled-select:disabled { opacity: 0.6; cursor: not-allowed; }
.styled-select { padding-right: 2rem; }

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: var(--purple);
  color: var(--white);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--purple-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  display: inline-block;
  padding: 0.55rem 1.2rem;
  background: var(--gray-100);
  color: var(--gray-900);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 7px;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--gray-200); }

/* ── Manage sponsors link ── */
.manage-sponsors-link {
  font-size: 0.78rem;
  color: var(--gray-400);
  text-decoration: none;
  text-align: center;
  margin-top: -0.5rem;
  transition: color 0.15s;
}
.manage-sponsors-link:hover { color: var(--purple); }

/* ── Alerts ── */
.alert {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: 7px;
  font-size: 0.875rem;
}
.alert-error {
  background: #fff0f2;
  color: #b91c3c;
  border: 1px solid #fca5b0;
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ════════════════════════════════════
   REPORT PAGE
   ════════════════════════════════════ */
.report-page {
  background: var(--gray-50);
}

/* ── Sticky header ── */
.report-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.5rem;
  gap: 1rem;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.back-link {
  font-size: 0.875rem;
  color: var(--purple);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.back-link:hover { text-decoration: underline; }

.report-header-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: center;
}
.header-logo { height: 30px; object-fit: contain; }
.sponsor-header-logo { height: 26px; }
.header-divider {
  color: var(--gray-200);
  font-size: 1.1rem;
  font-weight: 300;
  flex-shrink: 0;
}
.report-header-title {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--gray-900);
}

.btn-export {
  padding: 0.5rem 1.1rem;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-export:hover { background: var(--red-dark); }

/* ── Main content ── */
.report-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.section { margin-bottom: 2.5rem; }
.section-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--purple);
  border-bottom: 2px solid var(--purple);
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
}

/* ── Project cards ── */
.project-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.project-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  color: var(--white);
}
.header-webinar { background: var(--purple); }
.header-email   { background: var(--blue); }

.type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255,255,255,0.22);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.project-name {
  flex: 1;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
}
.project-date {
  font-size: 0.85rem;
  opacity: 0.85;
  white-space: nowrap;
}

/* ── Task table ── */
.task-table-wrap { overflow-x: auto; }
.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.845rem;
}
.task-table thead tr { background: var(--gray-100); }
.task-table th {
  text-align: left;
  padding: 0.45rem 0.75rem;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.task-table td {
  padding: 0.42rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.task-table tbody tr:last-child td { border-bottom: none; }
.task-table tbody tr:hover { background: var(--gray-50); }

.row-overdue  { background: #fff5f6 !important; }
.row-today    { background: #fff1f2 !important; }
.row-upcoming { background: #fff7ed !important; }
.row-due-soon { background: #fffdf0 !important; }

.subtask-row { opacity: 0.9; }
.subtask-name { padding-left: 1.4rem; color: var(--gray-600); }

.task-table  { table-layout: fixed; }
.task-name   { width: 38%; overflow-wrap: break-word; }
.task-due    { width: 13%; white-space: nowrap; }
.task-days   { width: 8%;  text-align: center; }
.task-biz    { width: 8%;  text-align: center; }
.task-assignee { width: 21%; }
.task-status { width: 12%; text-align: center; }

.status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.status-overdue  { background: #fde8ec; color: #9b1c34; }
.status-today    { background: #dc2626; color: #ffffff; }
.status-upcoming { background: #ea580c; color: #ffffff; }
.status-due-soon { background: #fef3c7; color: #78350f; }
.task-due    { white-space: nowrap; }
.task-assignee { color: var(--gray-600); }

.no-tasks {
  padding: 0.75rem 1rem;
  color: var(--gray-400);
  font-style: italic;
  font-size: 0.875rem;
}
.tasks-pending {
  padding: 0.8rem 1rem;
  color: var(--purple);
  font-size: 0.875rem;
  background: rgba(92,33,146,0.05);
  border-left: 3px solid var(--purple);
}

/* ── Gantt ── */
.gantt-section { margin-top: 1rem; }
#gantt-container {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
}
#gantt-container svg { display: block; }

/* Frappe Gantt overrides */
.gantt .bar-wrapper.gantt-webinar .bar { fill: var(--purple) !important; }
.gantt .bar-wrapper.gantt-email      .bar { fill: var(--red)    !important; }
.gantt .bar-wrapper.gantt-overdue    .bar { fill: #FF6B35       !important; }

.gantt-popup {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.82rem;
  box-shadow: var(--shadow);
  max-width: 220px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray-600);
}
.empty-state p { margin-bottom: 1.25rem; font-size: 1rem; }

/* ── Floating export button ── */
.fab-export {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: none; /* shown on small screens */
}
.btn-export-fab {
  padding: 0.7rem 1.4rem;
  background: var(--red);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(237,25,68,0.35);
  transition: background 0.15s;
}
.btn-export-fab:hover { background: var(--red-dark); }

/* ── Days-until badge (webinar cards) ── */
.days-until-badge {
  font-size: .72rem;
  font-weight: 700;
  background: rgba(255,255,255,.22);
  color: white;
  border-radius: 5px;
  padding: 2px 9px;
  white-space: nowrap;
  letter-spacing: .02em;
  flex-shrink: 0;
}

/* ── Sponsorship history section ── */
.history-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: .85rem;
}
.history-stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.history-period-label {
  font-family: var(--font-title);
  font-size: .9rem;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: .2rem;
}
.history-date-range {
  font-size: .75rem;
  color: var(--gray-400);
  margin-bottom: .75rem;
}
.history-counts {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.history-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 600;
}
.history-pill-webinar { background: rgba(92,33,146,.1);  color: var(--purple); }
.history-pill-email   { background: rgba(70,129,202,.1); color: var(--blue); }
.history-pill-none    { background: var(--gray-100); color: var(--gray-400); font-style: italic; font-weight: 400; }
.history-trend {
  font-size: .84rem;
  color: var(--gray-600);
  padding: .65rem 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 7px;
}
.trend-up   { color: #16a34a; font-weight: 600; }
.trend-down { color: var(--red); font-weight: 600; }
.trend-same { color: var(--gray-600); font-weight: 600; }
.history-loading { color: var(--gray-400); font-size: .875rem; font-style: italic; padding: .5rem 0; }
.history-sub-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: .5rem;
}
.history-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

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

@media (max-width: 700px) {
  .fab-export { display: block; }
  .report-header .btn-export { display: none; }
  .report-main { padding: 1rem 0.75rem 5rem; }
  .task-table th, .task-table td { padding: 0.35rem 0.5rem; font-size: 0.78rem; }
}
