:root {
  --bg: #0b1020;
  --card: rgba(255,255,255,0.06);
  --line: rgba(255,255,255,0.10);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);

  --accent: #8bf0c6;
  --busy: #ff6b6b;
  --tentative: #ffd166;
  --oof: #6c8cff;
  --elsewhere: #b38bff;

  --slot: 20px; /* 30 minutes */
  --hour: calc(var(--slot) * 2);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(139,240,198,0.20), transparent 55%),
    radial-gradient(900px 700px at 110% 10%, rgba(108,140,255,0.18), transparent 60%),
    radial-gradient(900px 700px at 50% 120%, rgba(255,209,102,0.14), transparent 50%),
    var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

/* Animations */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); filter: blur(2px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0% { opacity: 0.55; }
  50% { opacity: 1; }
  100% { opacity: 0.55; }
}

/* Initial load reveal */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;

  animation: riseIn 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,0.35);

  animation: riseIn 520ms 80ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: conic-gradient(from 200deg, var(--accent), var(--oof), var(--tentative), var(--busy), var(--accent));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.14), 0 18px 50px rgba(0,0,0,0.45);
  display: grid;
  place-items: center;
}

.mark span {
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: rgba(15,20,35,0.86);
  user-select: none;
}


.mark img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.kicker {
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 13px;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.70);
}

.title {
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.2px;
  margin-top: 1px;
}

.sub {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.ctl {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

select {
  appearance: none;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.25);
  color: var(--text);
}

.btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(139,240,198,0.14);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.btn:hover { background: rgba(139,240,198,0.18); }

.status {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  color: var(--muted);
  font-size: 13px;
}

.status.isLoading {
  animation: pulse 900ms ease-in-out infinite;
}

.grid {
  display: grid;
  grid-template-columns: 64px 1fr;
  min-height: 420px;
}

.times {
  border-right: 1px solid rgba(255,255,255,0.10);
  padding-top: 44px;
  background: rgba(0,0,0,0.16);
}

.time {
  height: var(--hour);
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.days {
  overflow-x: auto;
  overflow-y: hidden;
}

.daysInner {
  display: flex;
  min-width: 700px;
}

.day {
  flex: 1 0 0;
  min-width: 180px;
  border-right: 1px solid rgba(255,255,255,0.10);
}

.day:last-child { border-right: 0; }

.dayHead {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
}

.dayHead .d1 { font-size: 13px; font-weight: 700; }
.dayHead .d2 { font-size: 12px; color: var(--muted); }

.dayBody {
  position: relative;
  height: calc(var(--hour) * var(--hours));
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.06) 0px,
      rgba(255,255,255,0.06) 1px,
      transparent 1px,
      transparent var(--hour)
    );
}

.block {
  position: absolute;
  left: 8px;
  right: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 10px 20px rgba(0,0,0,0.25);
  padding: 8px 10px;
  display: grid;
  gap: 4px;
  backdrop-filter: blur(6px);

  opacity: 0;
  animation: popIn 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--d, 0ms);
}

.block .lbl { font-size: 12px; font-weight: 750; letter-spacing: 0.2px; }
.block .tm  { font-size: 12px; color: rgba(255,255,255,0.75); }

.block.busy { background: rgba(255,107,107,0.22); }
.block.tentative { background: rgba(255,209,102,0.20); }
.block.oof { background: rgba(108,140,255,0.20); }
.block.workingElsewhere { background: rgba(179,139,255,0.20); }
.block.unknown { background: rgba(255,255,255,0.10); }

.muted { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .top, .card, .block { animation: none !important; }
  .status.isLoading { animation: none !important; }
}

@media (max-width: 720px) {
  .top { align-items: flex-start; flex-direction: column; }
  .daysInner { min-width: 600px; }
}

/* Segmented view control (Week/Month) */
.seg {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.20);
}

.segBtn {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.78);
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.segBtn:hover {
  background: rgba(255,255,255,0.06);
}

.segBtn.isActive {
  background: rgba(139,240,198,0.14);
  color: rgba(255,255,255,0.92);
  box-shadow: 0 0 0 1px rgba(139,240,198,0.18) inset;
}

/* Month calendar view */
.isMonth .grid { grid-template-columns: 1fr; }
.isMonth .times { display: none; }

.month {
  width: 100%;
  grid-column: 1 / -1;
}

.monthHead {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
}

.monthHeadCell {
  padding: 10px 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.70);
  letter-spacing: 0.2px;
}

.monthGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.monthCell {
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px;
  min-height: 92px;
  border-right: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
  cursor: default;
}

.monthCell:nth-child(7n) { border-right: 0; }

.monthCell.isOtherMonth {
  opacity: 0.45;
}

.monthCell.isToday {
  box-shadow: 0 0 0 1px rgba(139,240,198,0.22) inset;
  background: rgba(139,240,198,0.05);
}

.monthCell.hasBlocks {
  background: rgba(255,255,255,0.02);
}

.monthCell.hasBlocks:hover {
  background: rgba(255,255,255,0.05);
  transform: translateY(-1px);
}

.monthDate {
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,0.88);
}

.monthDots {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.16);
}

.dot.busy { background: rgba(255,107,107,0.85); }
.dot.tentative { background: rgba(255,209,102,0.85); }
.dot.oof { background: rgba(108,140,255,0.85); }
.dot.workingElsewhere { background: rgba(179,139,255,0.85); }
.dot.unknown { background: rgba(255,255,255,0.55); }

.monthNav {
  display: none;
  align-items: center;
  gap: 8px;
}

.isMonth .monthNav {
  display: inline-flex;
}
.iconBtn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.20);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.iconBtn:hover { background: rgba(255,255,255,0.06); }

.monthLabel {
  min-width: 160px;
  text-align: center;
  font-weight: 800;
  color: rgba(255,255,255,0.86);
}

.monthSelect {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.20);
  border-radius: 10px;
  height: 34px;
  padding: 0 30px 0 10px;
  cursor: pointer;
}

.monthSelect:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139,240,198,0.16);
}

@media (max-width: 720px) {
  .monthCell { min-height: 78px; padding: 8px; }
  .monthLabel { min-width: 130px; }
  .monthSelect { padding-right: 24px; }
}

.monthCell.isPast {
  opacity: 0.35;
}

.monthCell.isPast .monthDots {
  display: none;
}

.iconBtn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}


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


.dateCheck {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
}

.dateInput {
  appearance: none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  font-size: 13px;
}

.dateInput:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139,240,198,0.14);
}

.btn.btnGhost {
  background: rgba(255,255,255,0.06);
}

.btn.btnGhost:hover {
  background: rgba(255,255,255,0.09);
}

.checkResult {
  min-width: 112px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  color: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
}

.checkResult.isOk {
  border-color: rgba(139,240,198,0.22);
  background: rgba(139,240,198,0.10);
}

.checkResult.isBusy {
  border-color: rgba(255,107,107,0.22);
  background: rgba(255,107,107,0.10);
}

.checkResult.isLoading {
  animation: pulse 900ms ease-in-out infinite;
}


.foot {
  margin-top: 14px;
  padding: 10px 14px;
  text-align: center;
  color: rgba(255,255,255,0.40);
  font-size: 12px;
}


.rangeSep {
  color: rgba(255,255,255,0.42);
  font-weight: 800;
  padding: 0 2px;
}


.dateInput[type="date"] {
  min-width: 148px;
}

@media (max-width: 720px) {
  .dateInput[type="date"] {
    min-width: 140px;
  }
}


button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139,240,198,0.18);
}


.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.10);
}

.legendItem {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  letter-spacing: 0.1px;
}


.checkResult.isError {
  border-color: rgba(255,166,87,0.28);
  background: rgba(255,166,87,0.12);
}

/* Interaction polish */
.btn,
.btn.btnGhost,
.segBtn,
.iconBtn,
.monthSelect,
.dateInput,
.checkResult,
.legendItem,
.dateCheck,
.monthCell {
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, color 180ms ease;
}

.btn:hover {
  background: rgba(139,240,198,0.22);
  border-color: rgba(139,240,198,0.38);
  transform: translateY(-1px);
}

.btn.btnGhost:hover {
  background: rgba(255,255,255,0.11);
  border-color: rgba(255,255,255,0.28);
}

.btn:active,
.iconBtn:active,
.segBtn:active {
  transform: translateY(0);
}

.segBtn:hover {
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.94);
}

.iconBtn:hover:not([disabled]) {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.26);
  transform: translateY(-1px);
}

.monthSelect:hover,
.dateInput:hover {
  border-color: rgba(139,240,198,0.28);
  background: rgba(0,0,0,0.33);
}

.dateCheck:hover {
  border-color: rgba(255,255,255,0.20);
  background: rgba(0,0,0,0.24);
}

.checkResult:hover {
  border-color: rgba(255,255,255,0.22);
  box-shadow: 0 6px 18px rgba(0,0,0,0.16);
}

.legendItem:hover {
  color: rgba(255,255,255,0.92);
}

.monthCell:hover:not(.isPast):not(.isOtherMonth) {
  background: rgba(255,255,255,0.04);
}

.monthCell.hasBlocks:hover {
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 1px rgba(139,240,198,0.16) inset;
}

/* Week clarity: all-day lane */
.times {
  padding-top: 44px;
}

.timeAllDay {
  height: 34px;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 700;
  color: rgba(255,255,255,0.64);
}

.dayAllDay {
  min-height: 34px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 4px 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.00));
}

.allDayChip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1px;
  color: rgba(255,255,255,0.92);
  animation: popIn 320ms ease both;
  animation-delay: var(--d, 0ms);
}

.allDayChip.busy { background: rgba(255,107,107,0.20); }
.allDayChip.tentative { background: rgba(255,209,102,0.20); }
.allDayChip.oof { background: rgba(108,140,255,0.22); }
.allDayChip.workingElsewhere { background: rgba(179,139,255,0.24); }
.allDayChip.unknown { background: rgba(255,255,255,0.12); }

/* Month UX enhancements */
.monthCell {
  overflow: hidden;
}

.monthCell.isSelected {
  box-shadow: 0 0 0 1px rgba(139,240,198,0.45) inset, 0 12px 26px rgba(0,0,0,0.22);
}

.monthCount {
  position: absolute;
  right: 8px;
  top: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255,255,255,0.96);
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(139,240,198,0.20);
  display: grid;
  place-items: center;
}

.monthSummary {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 10px 14px;
  font-size: 12px;
  color: rgba(255,255,255,0.78);
  background: rgba(0,0,0,0.12);
  letter-spacing: 0.1px;
}

/* Natural-language checker */
.dateNatural {
  min-width: 320px;
  flex: 1 1 260px;
}

.dateNatural::placeholder {
  color: rgba(255,255,255,0.45);
}

@media (max-width: 940px) {
  .dateCheck {
    width: 100%;
    flex-wrap: wrap;
  }

  .dateNatural {
    min-width: 220px;
    width: 100%;
  }
}

/* Brand polish */
.title {
  background: linear-gradient(95deg, rgba(255,255,255,0.98), rgba(184,244,224,0.94), rgba(255,255,255,0.95));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.kicker {
  text-shadow: 0 1px 12px rgba(139,240,198,0.24);
}

.card {
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.card:hover {
  transform: translateY(-1px);
  border-color: rgba(139,240,198,0.22);
  box-shadow: 0 22px 70px rgba(0,0,0,0.40);
}

.foot {
  transition: color 180ms ease;
}

.foot:hover {
  color: rgba(255,255,255,0.64);
}

/* Checker advanced date toggle */
.btnSlim {
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.dateAdvanced {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dateAdvanced[hidden] {
  display: none !important;
}

@media (max-width: 940px) {
  .dateAdvanced {
    width: 100%;
  }
}
