:root {
  --blue: #1a73e8;
  --red: #d93025;
  --grid: #e8eaed;
  --text-muted: #70757a;
  --axis: 56px;
  --header: 60px;
  --hour: 54px;
  --slot: calc(var(--hour) / 2);
  --divider: 2px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #fff;
  color: #202124;
  font-family: Roboto, Arial, Helvetica, sans-serif;
}

body {
  overflow-x: hidden;
}

.calendar-shell {
  width: 100vw;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: #fff;
}

.day-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: var(--axis) 1fr 1fr;
  height: calc(var(--header) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: #fff;
  box-shadow: 0 2px 5px rgba(60, 64, 67, 0.3);
}

.date-rail {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
  border-right: 1px solid var(--grid);
  padding-top: 6px;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: #fff;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.date-rail:focus {
  outline: none;
}

.weekday {
  color: var(--blue);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 600;
}

.date-bubble {
  width: 36px;
  height: 36px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 23px;
  line-height: 1;
  font-weight: 400;
}

.vehicle-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 18px;
  color: #5f6368;
  font-size: 17px;
  line-height: 1;
  font-weight: 300;
  min-width: 0;
}

.vehicle-heading svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: #9aa0a6;
}

.sedan-heading::after {
  content: "";
  position: absolute;
  top: 0;
  right: calc(var(--divider) / -2);
  width: 1px;
  height: calc(100vh + 1000px);
  background: var(--grid);
}

.days {
  position: relative;
  background: #fff;
}

.list-view {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  min-height: 100vh;
  padding: calc(env(safe-area-inset-top) + 78px) 18px 32px;
  background: #fff;
}

.close-list-button {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 0;
  z-index: 45;
  width: var(--axis);
  height: 48px;
  border: 0;
  background: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.close-list-button span {
  grid-area: 1 / 1;
  width: 17px;
  height: 1.5px;
  border-radius: 2px;
  background: #5f6368;
}

.close-list-button span:first-child {
  transform: rotate(45deg);
}

.close-list-button span:last-child {
  transform: rotate(-45deg);
}

.close-list-button:focus {
  outline: none;
}

.clear-list-button {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 16px);
  right: 14px;
  z-index: 45;
  min-width: 0;
  height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: var(--red);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.clear-list-button:active {
  background: #b3261e;
}

.clear-list-button:focus {
  outline: none;
}

.confirm-clear,
.confirm-sleep {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 18px) 20px calc(env(safe-area-inset-bottom) + 18px);
  background: rgba(32, 33, 36, 0.18);
}

.confirm-clear[hidden],
.confirm-sleep[hidden] {
  display: none;
}

.confirm-clear-dialog,
.confirm-sleep-dialog {
  width: min(100%, 340px);
  border-radius: 12px;
  padding: 22px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(60, 64, 67, 0.3);
}

.confirm-clear-title,
.confirm-sleep-title {
  color: #202124;
  font-size: 19px;
  line-height: 1.35;
  font-weight: 600;
}

.confirm-clear-actions,
.confirm-sleep-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.sleep-time-control {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.sleep-time-step {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 12px;
  background: #f1f3f4;
  color: #3c4043;
  font-family: inherit;
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.sleep-time-step:active {
  background: #e2e5e8;
}

.sleep-time-step:focus {
  outline: none;
}

.sleep-time-value {
  height: 56px;
  border-radius: 12px;
  background: #f8fafd;
  color: #202124;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0;
}

.confirm-clear-actions button,
.confirm-sleep-actions button {
  height: 46px;
  border: 0;
  border-radius: 10px;
  padding: 0 18px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.confirm-clear-cancel,
.confirm-sleep-cancel {
  background: #f1f3f4;
  color: #3c4043;
}

.confirm-clear-confirm {
  background: var(--red);
  color: #fff;
}

.confirm-sleep-confirm {
  background: #7b3ff2;
  color: #fff;
}

.confirm-clear-confirm:active {
  background: #b3261e;
}

.confirm-sleep-confirm:active {
  background: #6230c8;
}

.confirm-clear-actions button:focus,
.confirm-sleep-actions button:focus {
  outline: none;
}

.exclusions-list {
  margin: 0;
  color: #202124;
  font-family: Roboto, Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  font-weight: 300;
  letter-spacing: 0;
  white-space: pre-wrap;
}

.calendar-shell.is-list-mode .days,
.calendar-shell.is-list-mode .day-header,
.calendar-shell.is-list-mode .sleep-button,
.calendar-shell.is-list-mode .today-button {
  display: none;
}

.calendar-shell.is-list-mode .list-view {
  display: block;
}

.calendar-day {
  position: relative;
  display: grid;
  grid-template-columns: var(--axis) 1fr;
  height: calc(var(--hour) * 24);
  background: #fff;
}

.time-rail {
  position: relative;
  border-right: 1px solid var(--grid);
  background: #fff;
}

.time-label {
  position: absolute;
  right: 9px;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  font-weight: 300;
}

.slots {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-auto-rows: var(--slot);
}

.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--grid);
  pointer-events: none;
}

.slot {
  position: relative;
  z-index: 4;
  border: 0;
  background: transparent;
  padding: 0;
  appearance: none;
  cursor: pointer;
  touch-action: manipulation;
}

.slot.is-excluded::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 2px;
  bottom: 2px;
  border-radius: 3px;
  background: var(--red);
}

.slot:focus {
  outline: none;
}

.current-time {
  position: absolute;
  left: var(--axis);
  right: 10px;
  z-index: 15;
  height: 1.5px;
  background: #202124;
  pointer-events: none;
}

.current-dot {
  position: absolute;
  left: -7px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #202124;
  transform: translateY(-50%);
}

.today-button {
  position: fixed;
  right: max(16px, calc((100vw - 480px) / 2 + 16px));
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: #0b57d0;
  color: #fff;
  box-shadow: 0 4px 12px rgba(60, 64, 67, 0.32);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 160ms ease, transform 160ms ease;
}

.today-button svg,
.sleep-button svg {
  width: 24px;
  height: 24px;
}

.sleep-button {
  position: fixed;
  right: max(16px, calc((100vw - 480px) / 2 + 16px));
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: #7b3ff2;
  color: #fff;
  box-shadow: 0 4px 12px rgba(60, 64, 67, 0.28);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms ease;
}

.sleep-button:active {
  background: #6230c8;
  transform: translateY(1px);
}

.sleep-button:focus {
  outline: none;
}

.today-button:active {
  background: #0842a0;
  transform: translateY(1px);
}

.today-button:focus {
  outline: none;
}

@media (min-width: 481px) {
  body {
    background: #f1f3f4;
  }

  .calendar-shell {
    box-shadow: 0 0 0 1px rgba(60, 64, 67, 0.08);
  }
}
