:root{
  --bg:#0b0a12;
  --panel:#141225;
  --text:#f1f1f7;
  --muted:#b5b3c7;
  --accent:#ff7a00;
  --danger:#ff3b6a;
  --oogie-green:#a6ff00;
  --border:rgba(255,255,255,.12);
  --shadow:0 14px 40px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
html{height:100%}
body{
  margin:0;
  min-height:100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 50% -20%, rgba(255,122,0,.25), transparent 60%),
              radial-gradient(900px 600px at 15% 10%, rgba(74,0,128,.25), transparent 55%),
              radial-gradient(900px 600px at 85% 20%, rgba(0,100,0,.22), transparent 55%),
              radial-gradient(1000px 700px at 95% 95%, rgba(166,255,0,0.12), transparent 60%),
              var(--bg);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  color:var(--text);
}

.app-header{
  position:sticky;
  top:0;
  z-index:10;
  background: linear-gradient(180deg, rgba(11,10,18,.95), rgba(11,10,18,.65));
  backdrop-filter: blur(8px);
  border-bottom:1px solid var(--border);
  padding:14px 14px 12px;
}

.app-title{
  margin:0;
  font-size:18px;
  letter-spacing:.3px;
}

.session-family{
  margin-top:6px;
  color:var(--muted);
  font-size:13px;
}

.app-root{
  padding:14px 14px 80px;
  max-width: 860px;
  margin:0 auto;
}

.panel-title{
  margin:0 0 10px;
  font-size:14px;
  color:var(--muted);
  letter-spacing:.4px;
  text-transform:uppercase;
}

.family-selector {
  background: rgba(0,0,0,0.5);
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  padding:14px;
  box-shadow: var(--shadow);
  color: #f1f1f7;
}

.range-editor {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(20, 18, 37, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  color: var(--text);
  transition: transform 0.3s ease;
}

.range-toggle-checkbox {
  display: none;
}

.range-header {
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

#range-toggle:checked ~ .range-header {
  border-bottom-color: var(--border);
}

.range-toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  cursor: pointer;
  user-select: none;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.range-toggle-title {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-count-badge {
  background: var(--accent);
  color: #000;
  font-weight: 800;
  font-size: 12px;
  border-radius: 999px;
  padding: 2px 8px;
  min-width: 20px;
  text-align: center;
}

.range-toggle-icon {
  width: 24px;
  height: 24px;
  position: relative;
  transition: transform 0.3s ease;
}

.range-toggle-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-top: 2px solid var(--muted);
  transform: translate(-50%, -25%) rotate(-45deg);
  transition: all 0.3s ease;
}

#range-toggle:checked ~ .range-header .range-toggle-icon {
  transform: rotate(0deg);
}

#range-toggle:checked ~ .range-header .range-toggle-icon::before {
  transform: translate(-50%, -75%) rotate(135deg);
  border-color: var(--text);
}

.range-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

#range-toggle:checked ~ .range-body {
  grid-template-rows: 1fr;
}

.range-body-inner {
  overflow: hidden;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

#range-toggle:checked ~ .range-body .range-body-inner {
  padding: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.family-selector{
  margin-top:12px;
}

.calendar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  transition: background-color 0.2s;
}

.legend-item.is-active {
  background: rgba(255, 255, 255, 0.12);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot-color);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
}

.legend-icon img {
  width: 16px;
  height: 16px;
  display: block;
}

.family-options{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}

.family-option{
  width:100%;
  text-align:left;
  border-radius:12px;
  padding:12px;
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  color:var(--text);
}

.family-option::before{
  content:"";
  display:inline-block;
  width:10px;
  height:10px;
  border-radius:999px;
  background: var(--family-color, var(--accent));
  margin-right:10px;
  box-shadow: 0 0 0 3px rgba(0,0,0,.25);
}

.family-option.is-disabled{
  opacity:.45;
}

.family-name{font-weight:650}

.error-banner{
  border:1px solid rgba(255,59,106,.55);
  background: rgba(255,59,106,.12);
  padding:10px 12px;
  border-radius:12px;
  margin:10px 0 12px;
  color:var(--text);
}

.instructions{
  border:1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.03);
  border-radius:12px;
  padding:12px;
  margin:10px 0 12px;
}

.instructions-title{
  font-weight:750;
  letter-spacing:.2px;
  margin:0 0 8px;
  color: #fff;
}

.instructions-list{
  margin:0;
  padding-left:18px;
  color:var(--muted);
  list-style: none;
}

.instructions-list li {
  margin: 4px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.bullet {
  font-size: 16px;
  line-height: 1.2;
}

.range-add{
  display:grid;
  grid-template-columns: 1fr 1fr auto;
  gap:8px;
  align-items:end;
  margin: 10px 0 14px;
}

.range-add.is-hidden{display:none}

.range-add input[type="date"]{
  width:100%;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.3);
  color:#fff;
  padding:9px 10px;
}

.range-add button{
  border-radius:10px;
  border:1px solid rgba(255,122,0,.35);
  background: rgba(255,122,0,.14);
  color:var(--text);
  padding:9px 12px;
  font-weight:650;
}

.range-list{list-style:none; padding:0; margin:0; display:flex; flex-wrap:wrap; gap:8px}

.range-item{
  border:1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.05);
  border-radius:20px;
  padding:6px 12px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
  color: #fff;
}

.range-item.is-invalid {
  border-color: var(--danger);
  background: rgba(255, 59, 106, 0.15);
}

.range-warning {
  margin-right: 4px;
  font-size: 14px;
  vertical-align: middle;
}

.range-dates{font-weight:600}

.range-actions{
  display:flex;
  gap:6px;
  align-items:center;
  margin-top:0;
}

.range-actions select{
  border-radius:6px;
  border:1px solid rgba(0,0,0,.15);
  background: #f1f1f7;
  color:#111;
  padding:2px 4px;
  font-size:11px;
  height: 24px;
}

.range-delete{
  margin-left:0;
  border-radius:6px;
  width: 28px;
  height: 28px;
  padding:0;
  display:grid;
  place-items:center;
  border:1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.1);
  color: #ccc;
  cursor:pointer;
  transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23cccccc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'%3E%3C/path%3E%3Cpath d='M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6'%3E%3C/path%3E%3Cpath d='M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.range-delete:hover {
  background-color: rgba(255, 59, 106, 0.2);
  border-color: rgba(255, 59, 106, 0.5);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ff3b6a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'%3E%3C/path%3E%3Cpath d='M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6'%3E%3C/path%3E%3Cpath d='M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2'%3E%3C/path%3E%3C/svg%3E");
}

.range-delete span, .range-delete text { display: none; } /* Hide text "Delete" if present */

.range-empty{color:var(--muted)}

.calendar{margin:14px 0}
.calendar-placeholder{color:var(--muted)}

.calendar-grid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap:8px;
}

.month-separator{
  grid-column: 1 / -1;
  text-align:center;
  font-weight:750;
  font-size:13px;
  color: var(--muted);
  margin:4px 0 8px;
  letter-spacing:.3px;
  text-transform:uppercase;
  border-bottom:1px solid rgba(255,255,255,.1);
  padding-bottom:4px;
}

.weekday{
  font-size:12px;
  color:var(--muted);
  text-align:center;
  padding:6px 0;
  border-bottom:1px solid var(--border);
}

.day-cell{
  position:relative;
  border:1px solid rgba(255,255,255,.1);
  border-radius:12px;
  background: rgba(255,255,255,.03);
  color: #fff;
  min-height:78px;
  padding:10px;
  overflow:hidden;
}

.day-cell:not(.is-padding):hover{
  border-color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.08);
}

.day-cell.is-selected{
  border-color: rgba(255,122,0,.65);
  box-shadow: 0 0 0 2px rgba(255,122,0,.22) inset, 0 0 0 1px rgba(0,0,0,.35);
}

.day-cell.is-in-range{
  border-color: rgba(255,122,0,.45);
  box-shadow: 0 0 0 2px rgba(255,122,0,.14) inset;
}

.day-cell.is-range-start,
.day-cell.is-range-end{
  border-color: rgba(255,122,0,.75);
  box-shadow: 0 0 0 3px rgba(255,122,0,.22) inset, 0 0 0 2px rgba(241,241,247,.7);
}

.day-cell.is-padding{
  opacity:.35;
}

.day-cell.is-filler {
  border: 0;
  background: transparent;
  box-shadow: none;
}


.day-top{
  display:flex;
  align-items:center;
  gap:8px;
}

.day-number{
  font-weight:700;
  font-size:14px;
}

.month-label{
  font-size:11px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.candidate-icon{
  position: absolute;
  bottom: 14px;
  right: 4px;
  line-height:0;
  pointer-events:none;
  opacity:.95;
  z-index: 2;
}

.candidate-icon img{
  width:18px;
  height:18px;
  display:block;
}

.overlay-bands{
  position:absolute;
  left:2px;
  right:2px;
  bottom:4px;
  height:6px;
  display:flex;
  gap:1px;
}

.overlay-band{
  flex:1;
  border-radius:1px;
  background: var(--band-color);
  opacity:.9;
}

.overlay-band.is-cap-start{
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.overlay-band.is-cap-end{
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.priority-badge{
  position:absolute;
  top:4px;
  right:4px;
  min-width:18px;
  height:18px;
  border-radius:999px;
  display:grid;
  place-items:center;
  font-weight:800;
  font-size:10px;
  color:var(--bg);
  background: rgba(255,211,106,.92);
  border:1px solid rgba(255,255,255,.25);
}

.event-modal{
  width:min(980px, 96vw);
  height:min(720px, 86vh);
  border:1px solid var(--border);
  border-radius:14px;
  padding:0;
  background: rgba(11,10,18,.98);
  color:var(--text);
}

.event-modal::backdrop{background: rgba(0,0,0,.65)}

.event-modal-inner{height:100%; display:grid; grid-template-rows: auto 1fr}

.event-modal-close{
  border:0;
  border-bottom:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 12px;
  text-align:left;
}

.event-modal-iframe{width:100%; height:100%; border:0; background:#fff}

.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

@keyframes pulse-select {
  0% { box-shadow: 0 0 0 0 rgba(255,122,0, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(255,122,0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255,122,0, 0); }
}

.day-cell.is-range-start {
  animation: pulse-select 2s infinite;
}

@media (min-width: 700px){
  .family-options{grid-template-columns: 1fr 1fr}
  .app-title{font-size:20px}
}