/* =================== AVAILABILITY CALENDAR =================== */
.cal { --cserif: 'Fraunces', Georgia, serif; }
.cal h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--accent2); margin: 16px 0 8px; font-weight: 800; }
.cal small { font-size: 12px; color: var(--mute); }

/* sub tabs */
.cal-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.cal-tabs button { padding: 13px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .04em; }
.cal-tabs button[data-tab=cal] { grid-column: 1 / -1; font-size: 19px; padding: 15px 10px; }
.cal-tabs button.on { background: #fff; border-color: #fff; color: #1b0b00; box-shadow: 3px 3px 0 #5b1f8a; }
.cal-tabs button[data-tab=me]:last-child { grid-column: 1 / -1; }

/* legend & bar */
.cal-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--mute); }
.cal-legend span { display: flex; align-items: center; gap: 5px; }
.cal-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.cal-legend i.tgt { background: transparent; border: 2px solid #c13cff; }
.cal-mylegend { margin: 0 0 14px; }
.cal-note { font-size: 12.5px; color: var(--mute); margin-top: 8px; }

/* months & days */
.cal-month { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 12px 6px; margin-bottom: 16px; }
.cal-mhead { display: flex; align-items: center; gap: 10px; font-family: var(--cserif); font-style: italic; font-weight: 700; font-size: 28px; color: #fff; margin: 2px 2px 10px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.cal-mhead small { font-style: normal; font-size: 13px; margin-left: auto; }
.cal-micon { font-style: normal; font-size: 24px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.cal-dow div { text-align: center; font-size: 12px; font-weight: 800; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; }
.cal-day { min-height: 80px; border-radius: 7px; padding: 7px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 2px;
  text-align: left; color: #fff; position: relative; border: 0; transition: transform .12s; font: inherit; }
button.cal-day:hover { transform: translateY(-2px); }
.cal-day.blank { background: transparent; }
.cal .c-none { background: var(--none); color: var(--mute); }
.cal .c-green { background: var(--green); }
.cal .c-yellow { background: var(--yellow); color: #2a2000; }
.cal .c-red { background: var(--red); }
.cal .c-open { background: var(--card2); color: var(--mute); box-shadow: inset 0 0 0 1px var(--line); }
.cal .c-block { background: repeating-linear-gradient(45deg, #4a4453 0 7px, #7a1f2e 7px 14px); color: #fff; }
.cal-legend i.c-block { background: repeating-linear-gradient(45deg, #4a4453 0 3px, #7a1f2e 3px 6px); }
.cal-legend i.c-open { box-shadow: inset 0 0 0 1px var(--mute); }
.cal-day.tgt { box-shadow: inset 0 0 0 3px #c13cff, 0 0 12px rgba(193,60,255,.7); }
.cal-day.sel { outline: 3px solid #fff; outline-offset: 2px; }
.cal-dn { font-family: var(--cserif); font-weight: 800; font-size: 19px; }
.cal-hicon { margin-left: 4px; font-size: 15px; }
.cal-bang { position: absolute; top: 5px; right: 6px; font-size: 15px; line-height: 1; animation: calGlow 1.2s ease-in-out infinite alternate; }
@keyframes calGlow { from { opacity: .65; } to { opacity: 1; } }
.cal-go, .cal-tb { font-size: 11px; font-weight: 800; padding: 2px 5px; border-radius: 5px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cal-go { background: #0b3b1c; color: #9dffbf; }
.cal-tb { background: #1b0b24; color: #ffb36b; }
.cal-sc { font-size: 10.5px; font-weight: 800; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cal-ct { font-size: 12px; font-weight: 800; opacity: .92; }
.cal-lc { opacity: .85; }
.cal-blk { font-size: 11px; font-weight: 800; background: rgba(0,0,0,.55); padding: 2px 5px; border-radius: 4px; line-height: 1.2; max-width: 100%; }
.cal-house { position: absolute; right: 5px; bottom: 5px; font-size: 10.5px; font-weight: 800; padding: 1px 4px; border-radius: 5px; line-height: 1.3; }
.cal-house.y { background: #0f3d1f; color: #7dffa8; }
.cal-house.n { background: #3d0a12; color: #ff8f98; }

/* day panels */
.cal-dpanel { position: relative; background: var(--card2); border: 1.5px solid var(--gold); border-radius: 8px; padding: 16px 18px; margin: 10px 0 12px;
  animation: calPop .22s ease-out both; transform-origin: calc((var(--col, 3) + .5) * 100% / 7) 0; }
.cal-dpanel::before { content: ""; position: absolute; top: -9px; left: calc((var(--col, 3) + .5) * 100% / 7 - 9px); border: 9px solid transparent; border-top: 0; border-bottom-color: var(--gold); }
@keyframes calPop { from { opacity: 0; transform: scaleY(.92) translateY(-4px); } to { opacity: 1; transform: none; } }
.cal-dhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.cal-dhead h3 { font-family: var(--cserif); font-size: 21px; font-weight: 800; margin: 0; }
.cal-x { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); color: var(--mute); font-size: 16px; }
.cal-sbanner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: center; border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-weight: 800; }
.cal-sbanner b { font-size: 16px; }
.cal-sbanner.go { background: rgba(63,191,95,.16); border: 1px solid var(--green); color: #9dffbf; }
.cal-sbanner.tg { background: rgba(193,60,255,.12); border: 1px solid #c13cff; color: #e7b8ff; }
.cal-sbanner.blk { background: repeating-linear-gradient(45deg, #3a3346 0 10px, #5e1824 10px 20px); color: #fff; }
.cal-warn { background: rgba(215,38,61,.15); border: 1px solid var(--red); color: #ffb0b8; border-radius: 8px; padding: 9px 12px; margin: 8px 0; font-size: 14px; }
.cal-info { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.cal-info b { display: block; margin-bottom: 3px; }
.cal-info ul { margin: 4px 0 0; padding-left: 20px; }
.cal-info.note { background: #2b1405; border: 1px dashed rgba(255,138,31,.7); transform: rotate(-.4deg); }
.cal-info.note b { color: #ffb36b; }
.cal-sum { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--mute); margin: 10px 0 4px; }
.cal-sum .g { color: var(--green); font-weight: 800; }
.cal-sum .r { color: var(--red); font-weight: 800; }
.cal-plist { list-style: none; margin: 0; padding: 0; }
.cal-plist li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.cal-plist li:last-child { border-bottom: 0; }
.cal-pill { font-size: 12px; font-weight: 800; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.cal-pill.g { background: rgba(47,191,113,.18); color: #5fe39b; }
.cal-pill.y { background: rgba(232,185,49,.18); color: var(--yellow); }
.cal-pill.r { background: rgba(229,72,77,.18); color: #ff7b7f; }

/* my availability */
.cal-step { margin: 4px 0 12px; font-size: 16px; }
.cal-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.cal-chip { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; text-align: left; display: flex; flex-direction: column; gap: 2px; position: relative; color: var(--ink); }
.cal-chip:hover { border-color: var(--accent2); }
.cal-chip b { font-size: 16px; }
.cal-chip i { position: absolute; top: 8px; right: 10px; font-style: normal; color: var(--green); font-weight: 800; }
.cal-who { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.cal-wholabel { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent2); margin-bottom: 2px; }
.cal-whoname { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.15; }
.cal-whoname span { font-family: var(--body); font-size: 15px; font-weight: 700; color: var(--accent2); }
.cal-switch { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 800; color: var(--mute); min-width: 200px; }
.cal-q { font-family: var(--cserif); font-size: 18px; font-weight: 700; margin: 12px 0 8px; }
.cal-yn { display: flex; gap: 6px; }
.cal-yn button { flex: 1; padding: 14px 10px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); font-weight: 800; color: var(--mute); font-size: 15px; }
.cal-yn button.y.on { background: var(--green); border-color: var(--green); color: #fff; }
.cal-yn button.n.on { background: var(--red); border-color: var(--red); color: #fff; }
.cal-times { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.cal-times label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mute); }
.cal-times select { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; color: var(--ink); min-width: 118px; }
.cal-pfoot { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.cal-savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(24,12,36,.96); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 13px; color: var(--mute); }
.cal-unsaved { color: var(--gold); }
.cal.is-busy [data-save] { opacity: .5; pointer-events: none; }

/* admin planner */
.cal-ad { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.cal-ad button { padding: 9px 12px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); font-weight: 800; color: var(--mute); font-size: 13.5px; }
.cal-ad button.tg.on { background: #3b1660; border-color: #c13cff; color: #fff; }
.cal-ad button.gl.on { background: var(--green); border-color: var(--green); color: #fff; }
.cal-ad button.nf.on { background: repeating-linear-gradient(45deg, #4a4453 0 7px, #7a1f2e 7px 14px); border-color: #7a1f2e; color: #fff; }
.cal-apanel .cal-times { margin-bottom: 12px; }
.cal-details { display: flex; flex-direction: column; gap: 12px; }
.cal-details label, .cal-field2 label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--mute); font-weight: 700; }
.cal-details input, .cal-details textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; color: var(--ink); width: 100%; resize: vertical; font-size: 14px; }
.cal-field2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.cal-memory { background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; min-height: 100%; }
.cal-memory small { display: block; color: #ffb36b; font-weight: 800; margin-bottom: 6px; }
.cal-memory p { font-size: 12.5px; }
.cal-mchips { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-mchip { background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 800; color: var(--ink); }
.cal-mchip:hover { border-color: var(--gold); color: #ffb36b; }

/* mobile modal */
.cal-modal { position: fixed; inset: 0; z-index: 2147482000; background: rgba(6,2,12,0); display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom)); transition: background .25s; }
.cal-modal.open { background: rgba(6,2,12,.78); }
.cal-mcard { width: 100%; max-width: 620px; max-height: min(86vh, 860px); overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: var(--card); border: 1.5px solid var(--gold); border-radius: 12px; padding: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6);
  transform: scale(.2); opacity: 0; transition: transform .34s cubic-bezier(.2,.9,.3,1.12), opacity .18s; }
.cal-modal.open .cal-mcard { transform: none; opacity: 1; }
.cal-mcard .cal-dhead { position: sticky; top: -14px; background: var(--card); margin: -14px -14px 0; padding: 12px 14px 8px; z-index: 1; }

@media (max-width: 700px) {
  .cal-month { padding: 8px 6px 4px; }
  .cal-mhead { font-size: 23px; }
  .cal-grid { gap: 4px; }
  .cal-day { min-height: 64px; padding: 4px 3px; border-radius: 6px; }
  .cal-dn { font-size: 15px; }
  .cal-go, .cal-tb { font-size: 9px; padding: 1px 2px; letter-spacing: -.02em; }
  .cal-go .ic, .cal-tb .ic { display: none; }
  .cal-ct { font-size: 10.5px; }
  .cal-sc, .cal-lc { display: none; }
  .cal-blk { font-size: 8.5px; padding: 1px 2px; }
  .cal-bang { font-size: 11px; top: 3px; right: 3px; }
  .cal-house { font-size: 8.5px; right: 2px; bottom: 2px; padding: 0 2px; }
  .cal-day.hol .cal-blk { display: none; }
  .cal-day.hol .cal-hicon { display: block; font-size: 22px; margin: 2px 0 0; line-height: 1; }
  .cal-day.hol .cal-dn { display: flex; flex-direction: column; }
  .cal-dpanel { margin: 8px -2px 10px; padding: 14px; }
  .cal-field2 { grid-template-columns: 1fr; }
  .cal-ad button { flex: 1 1 100%; padding: 12px; font-size: 15px; }
  .cal-times label { flex: 1 1 45%; }
  .cal-times select { min-width: 0; width: 100%; font-size: 16px; }
  .cal-details input, .cal-details textarea, .cal-switch select { font-size: 16px; }
  .cal-chips { grid-template-columns: 1fr 1fr; }
  .cal-savebar { bottom: 78px; }
  .cal-savebar .btn { flex: 1 1 100%; padding: 14px; }
  .cal-plist li { flex-wrap: wrap; }
  .cal-whoname { font-size: 20px; }
}
