/* Business hours and reply reminders (Settings › Business hours and Notifications). */
.routing-page h2 {
  font-size: var(--text-md);
  margin: 0;
}
.routing-page h2 + p {
  color: var(--muted);
  font-size: var(--text-sm);
  margin: 5px 0 14px;
}

/* Business hours, holidays, reminders */
.routing-schedule {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(250px, 1fr);
  gap: 18px;
  align-items: start;
}
.routing-week {
  padding: 16px 18px;
}
.routing-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.routing-chip-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 99px;
  padding: 4px 11px;
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.routing-chip-button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
  font-weight: 600;
}
/* Hour bars: solid graphite capsules with thin grip rods. The fill mixes ink into the surface
   rather than using transparency, so the hour grid never shows through a bar. */
.routing-week {
  --hour-fill: color-mix(in srgb, var(--ink) 9%, var(--surface));
  --hour-line: color-mix(in srgb, var(--ink) 16%, var(--surface));
  --hour-line-strong: color-mix(in srgb, var(--ink) 40%, var(--surface));
  --hour-ink: var(--ink);
  --hour-grip: color-mix(in srgb, var(--ink) 45%, var(--surface));
  --hour-grid: #1720330f;
}
html[data-theme="dark"] .routing-week {
  --hour-fill: color-mix(in srgb, var(--ink) 14%, var(--surface));
  --hour-line: color-mix(in srgb, var(--ink) 22%, var(--surface));
  --hour-line-strong: color-mix(in srgb, var(--ink) 45%, var(--surface));
  --hour-grip: color-mix(in srgb, var(--ink) 55%, var(--surface));
  --hour-grid: #ffffff0f;
}
.routing-day,
.routing-axis {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 24px 112px;
  align-items: center;
  gap: 10px;
}
.routing-day {
  margin-top: 8px;
}
.routing-day-toggle {
  border: 0;
  background: none;
  padding: 3px 0;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.routing-day.is-closed .routing-day-toggle {
  color: var(--muted);
  font-weight: 500;
}
.routing-day-toggle:hover {
  color: var(--hour-line-strong);
}
.routing-track {
  position: relative;
  height: 30px;
  border-radius: 10px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 calc(100% / 24 - 1px),
    var(--hour-grid) calc(100% / 24 - 1px) calc(100% / 24)
  );
  touch-action: none;
}
.routing-day.is-closed .routing-track {
  cursor: pointer;
}
.routing-closed {
  padding-left: 10px;
  line-height: 30px;
  font-size: var(--text-sm);
  color: var(--muted);
}
.routing-block {
  position: absolute;
  top: 1px;
  bottom: 1px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--hour-fill);
  box-shadow: inset 0 0 0 1px var(--hour-line);
  color: var(--hour-ink);
  cursor: grab;
  transition: box-shadow 0.15s ease;
}
.routing-block:hover,
.routing-block.is-dragging {
  box-shadow: inset 0 0 0 1px var(--hour-line-strong), 0 4px 12px #0f172a1f;
}
.routing-block.is-dragging {
  cursor: grabbing;
}
.routing-block-label {
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}
.routing-block.is-small .routing-block-label {
  visibility: hidden;
}
.routing-block-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 5;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
/* Monday's tooltip opens downwards so it doesn't cover the preset chips. */
.routing-day:first-child .routing-block-tip {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translate(-50%, -3px);
}
.routing-block.is-small:hover .routing-block-tip,
.routing-block.is-small.is-dragging .routing-block-tip,
.routing-block.is-small:focus-within .routing-block-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}
.routing-block-remove {
  position: absolute;
  top: -9px;
  right: -9px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 2px 6px #0f172a40;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.14s ease, transform 0.18s cubic-bezier(0.2, 1.4, 0.4, 1),
    background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.routing-block-remove svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
}
.routing-block:hover .routing-block-remove,
.routing-block-remove:focus-visible {
  opacity: 1;
  transform: none;
}
.routing-block-remove:hover,
.routing-block-remove:focus-visible {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--surface);
  outline: none;
}
.routing-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  cursor: ew-resize;
  border-radius: 6px;
  outline: none;
  z-index: 2;
}
.routing-handle[data-edge="start"] {
  left: 0;
}
.routing-handle[data-edge="end"] {
  right: 0;
}
.routing-handle::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 2px;
  height: 12px;
  margin-top: -6px;
  border-radius: 2px;
  background: var(--hour-grip);
  transition: height 0.12s ease, margin 0.12s ease;
}
.routing-handle:hover::after,
.routing-block.is-dragging .routing-handle::after {
  height: 18px;
  margin-top: -9px;
}
.routing-handle:focus-visible::after {
  height: 18px;
  margin-top: -9px;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--hour-line-strong);
}
.routing-add {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: 500 var(--text-md)/1 var(--font, inherit);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.routing-add:hover,
.routing-add:focus-visible {
  border-style: solid;
  border-color: var(--hour-line-strong);
  background: var(--hour-fill);
  color: var(--hour-ink);
}
.routing-add:disabled {
  opacity: 0.3;
  cursor: default;
  background: none;
  border-style: dashed;
  border-color: var(--line);
  color: var(--muted);
}
.routing-now-line {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--warning);
  pointer-events: none;
  z-index: 3;
}
/* Split days wrap onto two lines instead of being cut off. */
.routing-day-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: var(--text-sm);
  line-height: 1.3;
  white-space: pre-line;
  color: var(--muted);
  text-align: right;
}
.routing-axis {
  margin-top: 5px;
}
.routing-axis div {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* Live clock header */
.routing-clock {
  --clock-tone: var(--warning);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.routing-clock.is-open {
  --clock-tone: var(--green);
}
.routing-clock-time {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}
.routing-clock-time b {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.routing-clock-time small {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
}
.routing-clock-sep {
  align-self: stretch;
  width: 1px;
  background: var(--line);
}
.routing-clock-where {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}
.routing-clock-where strong {
  color: var(--ink);
  font-weight: 600;
}
.routing-clock-state {
  display: grid;
  justify-items: end;
  gap: 3px;
  margin-left: auto;
  text-align: right;
}
.routing-clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clock-tone);
}
.routing-clock-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clock-tone);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--clock-tone) 25%, transparent);
}
.routing-clock-next {
  font-size: var(--text-sm);
  color: var(--muted);
}
.routing-zone {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.routing-zone .timezone-picker {
  max-width: 360px;
}
.routing-holidays {
  padding: 6px 16px 14px;
}
.routing-holiday-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.routing-holiday-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
}
.routing-holiday-list li.is-past {
  opacity: 0.55;
}
.routing-holiday-empty {
  color: var(--muted);
}
.routing-date {
  flex: none;
  width: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
  line-height: 1.15;
  padding: 3px 0;
  font-size: var(--text-sm);
  text-transform: none;
  color: var(--muted);
}
.routing-date b {
  display: block;
  font-size: var(--text-md);
  color: var(--ink);
}
.routing-holiday-text {
  flex: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
}
.routing-holiday-text span {
  color: var(--muted);
  font-size: var(--text-sm);
}
.routing-remove {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: var(--text-md);
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.routing-remove:hover {
  color: var(--danger);
  background: var(--soft);
}
.routing-holiday-add {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 12px;
}
.routing-holiday-add input {
  font-size: var(--text-sm);
}
.routing-holiday-add .button {
  justify-self: start;
}
.routing-reminders {
  max-width: 620px;
  padding: 14px 16px 16px;
}
.routing-reminders p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.routing-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--text-md);
  cursor: pointer;
}
.routing-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.routing-switch-track {
  position: relative;
  flex: none;
  width: 30px;
  height: 17px;
  border-radius: 99px;
  background: var(--line);
  transition: background-color 0.15s var(--ease);
}
.routing-switch-track::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px #0003;
  transition: transform 0.15s var(--ease);
}
.routing-switch input:checked + .routing-switch-track {
  background: var(--blue);
}
.routing-switch input:checked + .routing-switch-track::after {
  transform: translateX(13px);
}
.routing-switch input:focus-visible + .routing-switch-track {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.routing-wait {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}
.routing-chip {
  position: relative;
  cursor: pointer;
}
.routing-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.routing-chip span {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 11px;
  font-size: var(--text-sm);
}
.routing-chip input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
  font-weight: 600;
}
.routing-chip input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.routing-reminders:has([name="reminders_enabled"]:not(:checked)) .routing-wait {
  opacity: 0.55;
}
@media (max-width: 900px) {
  .routing-schedule {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .routing-day,
  .routing-axis {
    grid-template-columns: 34px minmax(0, 1fr) 24px;
  }
  .routing-day-summary,
  .routing-axis > span:last-child {
    display: none;
  }
  .routing-clock {
    flex-wrap: wrap;
  }
  .routing-clock-sep {
    display: none;
  }
  .routing-clock-state {
    width: 100%;
    justify-items: start;
    margin-left: 0;
    text-align: left;
  }
}
