/* Modal palette */
:root {
  --popup-bg: #ffffff;
  --popup-bg-light: #ffffff;
  --popup-text: #2a1245;
  --popup-text-light: #2a1245;
  --popup-muted: #5b4778;
  --popup-muted-light: #5b4778;
  --popup-border: rgba(42, 18, 69, 0.16);
  --popup-border-light: rgba(42, 18, 69, 0.16);
  --popup-purple: #8b5cf6;
  --popup-purple-dark: #62298a;
  --popup-shadow: 0 24px 64px rgba(20, 8, 36, 0.48);
  --popup-radius: 20px;
}

/* Overlay and dialog surface */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 40);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 5, 12, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 180ms cubic-bezier(.2,.8,.2,1);
}

dialog.custom-modal-overlay.custom-popup-overlay[open] {
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  color: inherit;
}

dialog.custom-modal-overlay.custom-popup-overlay::backdrop {
  background: transparent;
}

body.teams-page dialog.custom-modal-overlay.custom-popup-overlay[open]:not(.no-team-dialog):not(.preferences-dialog):not(.team-dialog) {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 16px;
  border: 0;
  border-radius: 0;
  background: rgba(8, 5, 12, 0.72);
  color: inherit;
  box-shadow: none;
}

.custom-modal-overlay.active {
  opacity: 1;
}

.custom-modal {
  width: min(440px, calc(100vw - 32px));
  max-height: min(80vh, 640px);
  overflow-y: auto;
  padding: 28px;
  border: 2px solid #d9d0df;
  border-radius: var(--popup-radius);
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.14),
    inset 0 -4px 0 rgba(98,41,138,.10),
    0 8px 0 #62298a,
    var(--popup-shadow);
  color: #2a1245;
  text-align: center;
  transform: translateY(8px) scale(.96);
  transition: transform 230ms cubic-bezier(.2,.8,.2,1.08), opacity 190ms cubic-bezier(.2,.8,.2,1);
  opacity: 0;
}

.custom-modal-overlay.active .custom-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.custom-modal-overlay.is-closing { transition-duration: 140ms; }
.custom-modal-overlay.is-closing .custom-modal { transition-duration: 140ms; }

/* Status icons and message content */
.custom-modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.18);
}

.custom-modal-icon.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.custom-modal-icon.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.custom-modal-icon.success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.custom-modal-title {
  margin: 0 0 10px;
  color: #2a1245;
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 800;
}

.custom-modal-title.warning-text { color: #f59e0b; }
.custom-modal-title.error-text { color: #ef4444; }
.custom-modal-title.success-text { color: #10b981; }

.custom-modal-body {
  margin: 0 0 22px;
  color: #5b4778;
  font-size: .95rem;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.custom-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* Button base, interaction states, and color variants */
.custom-modal-btn {
  min-height: 42px;
  padding: 10px 18px;
  border: 2px solid transparent;
  border-radius: 10px;
  font: 800 14px/1 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.custom-modal-btn:hover {
  transform: translateY(-3px) scale(1.015);
}

.custom-modal-btn.primary:hover,
.custom-modal-btn.success:hover,
.custom-modal-btn.warning:hover,
.custom-modal-btn.error:hover,
.custom-modal-btn.secondary:hover {
  transform: translateY(-3px) scale(1.015);
}

.custom-modal-btn.primary:hover {
  background: linear-gradient(180deg, #c9a9ee 0%, #a77bcf 48%, #8b5cf6 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(98,41,138,.20), 0 8px 0 #62298a, 0 14px 24px rgba(42,18,69,.32);
}

.custom-modal-btn.success:hover {
  background: linear-gradient(180deg, #75d9ac 0%, #3fc58a 48%, #20a96f 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(20,112,72,.18), 0 8px 0 #16724a, 0 14px 24px rgba(20,112,72,.28);
}

.custom-modal-btn.warning:hover {
  background: linear-gradient(180deg, #ffd966 0%, #f6b84a 48%, #e69a20 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(145,91,10,.18), 0 8px 0 #b36a12, 0 14px 24px rgba(145,91,10,.28);
}

.custom-modal-btn.error:hover {
  background: linear-gradient(180deg, #ff8e99 0%, #ef5a67 48%, #dc3545 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(138,28,38,.18), 0 8px 0 #a61f2d, 0 14px 24px rgba(138,28,38,.28);
}

.custom-modal-btn.secondary:hover {
  background: linear-gradient(180deg, #c9a9ee 0%, #a77bcf 48%, #8b5cf6 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(98,41,138,.20), 0 8px 0 #62298a, 0 14px 24px rgba(42,18,69,.32);
}

.custom-modal-btn:active {
  transform: translateY(4px) scale(.985);
  box-shadow: inset 0 2px 5px rgba(42,18,69,.35), 0 1px 0 #4a1d6d, 0 2px 4px rgba(42,18,69,.25);
}

.custom-modal-btn.primary,
.custom-modal-btn.success,
.custom-modal-btn.secondary,
.custom-modal-btn.warning,
.custom-modal-btn.error {
  border-color: rgba(42,18,69,.72);
  color: #fff;
  text-shadow: 0 -1px 0 rgba(42,18,69,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(42,18,69,.18), 0 5px 0 #4a1d6d, 0 10px 18px rgba(42,18,69,.35);
}

.custom-modal-btn.primary,
.custom-modal-btn.secondary {
  background: linear-gradient(180deg, #c9a9ee 0%, #a77bcf 48%, #8b5cf6 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(98,41,138,.20), 0 5px 0 #62298a, 0 10px 18px rgba(42,18,69,.35);
}

.custom-modal-btn.warning {
  background: linear-gradient(180deg, #ffd966 0%, #f6b84a 48%, #e69a20 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(145,91,10,.18), 0 5px 0 #b36a12, 0 10px 18px rgba(145,91,10,.28);
}

.custom-modal-btn.error {
  background: linear-gradient(180deg, #ff8e99 0%, #ef5a67 48%, #dc3545 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(138,28,38,.18), 0 5px 0 #a61f2d, 0 10px 18px rgba(138,28,38,.28);
}

.custom-modal-btn.success {
  background: linear-gradient(180deg, #75d9ac 0%, #3fc58a 48%, #20a96f 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(20,112,72,.18), 0 5px 0 #16724a, 0 10px 18px rgba(20,112,72,.28);
}

.custom-modal-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

/* Footer information modal refinements */
.footer-info-modal .custom-modal {
  width: min(560px, calc(100vw - 32px));
  text-align: left;
}

.footer-info-modal .custom-modal-title {
  text-align: center;
}

.footer-info-modal .custom-modal-body {
  max-height: 55vh;
  overflow-y: auto;
  text-align: left;
  padding-right: 8px;
}

.footer-info-modal .custom-modal-body h4 {
  margin: 16px 0 6px;
  color: var(--popup-text);
}

.footer-info-modal .custom-modal-body p,
.footer-info-modal .custom-modal-body li {
  margin: 0 0 8px;
}

.footer-info-modal .custom-modal-body a {
  color: #a78bfa;
}

/* Shared Excel import/export dialog */
.schedule-excel-modal {
  width: min(620px, calc(100vw - 32px));
  padding: 26px;
  text-align: left;
}

.schedule-excel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.schedule-excel-heading h2 {
  margin: 0 0 6px;
  color: #2a1245;
  font-size: 1.3rem;
}

.schedule-excel-heading p {
  margin: 0;
  color: #5b4778;
  font-size: .92rem;
  line-height: 1.45;
}

.schedule-excel-close {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid rgba(42, 18, 69, .16);
  border-radius: 10px;
  background: #fff;
  color: #2a1245;
  font: 700 24px/1 sans-serif;
  cursor: pointer;
}

.schedule-excel-template {
  margin-bottom: 14px;
}

.schedule-excel-dropzone {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 104px;
  align-content: center;
  padding: 16px;
  border: 2px dashed rgba(98, 41, 138, .48);
  border-radius: 14px;
  background: #faf7fc;
  color: #2a1245;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.schedule-excel-dropzone.is-dragging,
.schedule-excel-dropzone:focus-within {
  border-color: #8b5cf6;
  background: #f2e8fa;
}

.schedule-excel-filename {
  overflow-wrap: anywhere;
  color: #5b4778;
  font-size: .85rem;
}

.schedule-excel-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.schedule-excel-status {
  margin: 12px 0 0;
  color: #5b4778;
  font-size: .9rem;
}

.schedule-excel-status.is-error {
  color: #b42332;
}

.schedule-excel-summary {
  max-height: 190px;
  margin-top: 12px;
  padding: 12px 14px;
  overflow: auto;
  border: 1px solid rgba(42, 18, 69, .12);
  border-radius: 12px;
  background: #faf7fc;
}

.schedule-excel-summary[hidden] {
  display: none;
}

.schedule-excel-summary h3 {
  margin: 0 0 8px;
  color: #2a1245;
  font-size: 1rem;
}

.schedule-excel-issues {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
  color: #5b4778;
  font-size: .85rem;
  line-height: 1.4;
}

.schedule-excel-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.schedule-excel-actions button {
  min-width: 96px;
}

@media (max-width: 520px) {
  .schedule-excel-modal { padding: 20px; }
  .schedule-excel-actions { justify-content: stretch; }
  .schedule-excel-actions button { flex: 1 1 100%; }
}

/* Light appearance defaults promoted from the former theme rules. */
.custom-modal {
border-color: #d9d0df;
  background: #ffffff;
  color: #2a1245;
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -4px 0 rgba(98,41,138,.12),
    0 8px 0 #62298a,
    0 24px 64px rgba(42, 18, 69, 0.18);
}

.custom-modal-title {
color: #2a1245;
}

.custom-modal-body {
color: #5b4778;
}

.custom-modal-btn.secondary:hover {
background: linear-gradient(180deg, #c9a9ee 0%, #a77bcf 48%, #8b5cf6 100%);
  border-color: rgba(42,18,69,.72);
}

.custom-modal-btn.primary,
.custom-modal-btn.success,
.custom-modal-btn.secondary,
.custom-modal-btn.warning,
.custom-modal-btn.error {
border-color: rgba(42,18,69,.72);
  color: #fff;
  text-shadow: 0 -1px 0 rgba(42,18,69,.35);
}

.custom-modal-btn.primary,
.custom-modal-btn.secondary {
background: linear-gradient(180deg, #c9a9ee 0%, #a77bcf 48%, #8b5cf6 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(98,41,138,.20), 0 5px 0 #62298a, 0 10px 18px rgba(42,18,69,.35);
}

.custom-modal-btn.warning {
background: linear-gradient(180deg, #ffd966 0%, #f6b84a 48%, #e69a20 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(145,91,10,.18), 0 5px 0 #b36a12, 0 10px 18px rgba(145,91,10,.28);
}

.custom-modal-btn.error {
background: linear-gradient(180deg, #ff8e99 0%, #ef5a67 48%, #dc3545 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(138,28,38,.18), 0 5px 0 #a61f2d, 0 10px 18px rgba(138,28,38,.28);
}

.custom-modal-btn.success {
background: linear-gradient(180deg, #75d9ac 0%, #3fc58a 48%, #20a96f 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(20,112,72,.18), 0 5px 0 #16724a, 0 10px 18px rgba(20,112,72,.28);
}

.footer-info-modal .custom-modal-body h4 {
color: var(--popup-text-light);
}
