/* Life OS — routine timeline editor: library, toolbar, timeline, blocks and inspector. */

.ed {
  height: 100%;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: var(--gap);
  padding: var(--gap);
}
.ed-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(200px, 1fr) auto;
  gap: var(--gap);
  min-width: 0;
  min-height: 0;
}
.ed-timeline {
  position: relative;
  min-width: 0;
  min-height: 0;
}

/* ------------------------------------------------------------------ library */

.ed-lib {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 12px 12px;
}
.lib-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 12px;
}
.lib-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-2);
}
.lib-count {
  margin-inline-end: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 700;
}
.lib-new {
  width: 30px;
  height: 30px;
  background: rgba(var(--accent-rgb), 0.18);
  border-color: rgba(var(--accent-rgb), 0.55);
  color: #fff;
}
.lib-new:hover:not(:disabled) {
  background: rgba(var(--accent-rgb), 0.34);
  border-color: rgba(var(--accent-rgb), 0.9);
  box-shadow: 0 0 calc(18px * var(--glow)) rgba(var(--accent-rgb), 0.4);
}
.lib-search-wrap {
  display: none;
  align-items: center;
  gap: 8px;
  height: 34px;
  margin-bottom: 10px;
  padding: 0 10px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: rgba(4, 5, 16, 0.45);
  color: var(--ink-3);
}
.ed-lib.has-search .lib-search-wrap {
  display: flex;
}
.lib-search {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--ink);
  font-size: 12.5px;
}
.lib-search::-webkit-search-cancel-button {
  filter: invert(1) opacity(0.5);
}
.lib-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 -4px;
  padding: 4px 4px 8px;
  scrollbar-width: thin;
}
.lib-cat {
  padding: 8px 6px 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-4);
}
.lib-empty {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 26px 10px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
}
.lib-foot {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 8px 4px 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-4);
}
.lib-foot svg {
  margin-top: 1px;
}

/* an activity chip: the reusable block you drag onto the timeline */
.act {
  --c: #8b5cff;
  --c-rgb: 139, 92, 255;
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--r-m);
  border: 1px solid rgba(var(--c-rgb), 0.34);
  background: linear-gradient(90deg, rgba(var(--c-rgb), 0.17), rgba(var(--c-rgb), 0.04));
  cursor: grab;
  outline: none;
  transition: transform 0.24s var(--ease), border-color 0.2s ease, box-shadow 0.25s ease, opacity 0.2s ease;
}
html[dir="rtl"] .act {
  background: linear-gradient(270deg, rgba(var(--c-rgb), 0.17), rgba(var(--c-rgb), 0.04));
}
.act:hover,
.act:focus-visible {
  transform: perspective(700px) translateZ(14px);
  border-color: rgba(var(--c-rgb), 0.85);
  box-shadow: 0 0 calc(22px * var(--glow)) rgba(var(--c-rgb), calc(0.3 * var(--glow))), 0 12px 24px -16px #000;
}
.act-icon {
  --icn: 20px;
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(180deg, rgba(var(--c-rgb), 0.8), rgba(var(--c-rgb), 0.42));
  border: 1px solid rgba(var(--c-rgb), 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 0 calc(12px * var(--glow)) rgba(var(--c-rgb), calc(0.5 * var(--glow)));
}
.act-icon .icn-img {
  --icn: 34px;
}
.act-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.act-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.act-meta {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.act-btn {
  width: 28px;
  height: 28px;
  opacity: 0;
}
.act:hover .act-btn,
.act:focus-within .act-btn {
  opacity: 1;
}
@media (hover: none) {
  .act-btn {
    opacity: 0.85;
  }
}
.act.is-source {
  opacity: 0.35;
}
.act-drag {
  position: absolute;
  top: 0;
  left: 0;
  cursor: grabbing;
  border-color: rgb(var(--c-rgb));
  background: linear-gradient(90deg, rgba(var(--c-rgb), 0.42), rgba(var(--c-rgb), 0.18)), var(--panel-solid);
  box-shadow: 0 24px 44px -16px #000, 0 0 calc(34px * var(--glow)) rgba(var(--c-rgb), 0.55);
  rotate: -2deg;
  transition: opacity 0.15s ease, scale 0.2s var(--ease);
}
.act-drag.is-over {
  opacity: 0.3;
  scale: 0.9;
}
.act-drag .act-btn {
  display: none;
}
html.is-dnd,
html.is-dnd * {
  cursor: grabbing !important;
}

/* ------------------------------------------------------------------ toolbar */

.ed-toolbar {
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 12px;
}
.tb-start,
.tb-end {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-width: 0;
}
.tb-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tb-end .tb-group + .tb-group {
  padding-inline-start: 14px;
  border-inline-start: 1px solid var(--line);
}
.tb-steps {
  display: flex;
  align-items: center;
  gap: 2px;
}
.tb-date {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: rgba(4, 5, 16, 0.4);
  cursor: pointer;
  transition: transform 0.22s var(--ease), border-color 0.2s ease, box-shadow 0.25s ease;
}
.tb-date:hover {
  transform: perspective(600px) translateZ(10px);
  border-color: rgba(var(--accent-rgb), 0.7);
  box-shadow: 0 0 calc(18px * var(--glow)) rgba(var(--accent-rgb), calc(0.25 * var(--glow)));
}
.tb-date svg {
  color: rgb(var(--accent-rgb));
}
.tb-date-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}
.tb-date-main {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tb-date-rel {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
}
.tb-date.is-today .tb-date-rel {
  background: rgba(var(--accent-rgb), 0.24);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.6);
}
.tb-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  max-width: 260px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px dashed var(--line-2);
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.tb-status > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tb-status:hover {
  border-color: rgba(var(--accent-rgb), 0.8);
  color: #fff;
}
.tb-status.is-template {
  border-style: solid;
  border-color: rgba(var(--accent2-rgb), 0.5);
  background: rgba(var(--accent2-rgb), 0.1);
}
.tb-status-icon {
  display: grid;
  flex: none;
}

/* template editing banner */
.tb-tpl {
  flex-wrap: wrap;
  gap: 8px 10px;
}
.tb-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(var(--accent2-rgb), 0.2);
  border: 1px solid rgba(var(--accent2-rgb), 0.7);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: var(--track);
  text-transform: uppercase;
  white-space: nowrap;
}
.tb-tpl-name {
  width: 190px;
  height: 34px;
  font-weight: 700;
  font-size: 14px;
}
.tb-tpl-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.tb-weekdays {
  display: flex;
  gap: 4px;
}
.tb-wd {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(4, 5, 16, 0.4);
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease);
}
.tb-wd:hover {
  transform: perspective(500px) translateZ(8px);
  color: #fff;
  border-color: var(--line-2);
}
.tb-wd.is-on {
  background: rgba(var(--accent-rgb), 0.4);
  border-color: rgb(var(--accent-rgb));
  color: #fff;
  box-shadow: 0 0 calc(12px * var(--glow)) rgba(var(--accent-rgb), 0.4);
}
.tb-wd.is-other {
  border-style: dashed;
  color: var(--ink-2);
}
.tb-wd-all {
  font-size: 10.5px;
  padding: 0 10px;
}

.tb-zoom-val {
  min-width: 46px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ timeline */

.tl {
  --ruler-h: 34px;
  --pad-t: 12px;
  --reflect: 44px;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  /* deliberately clear in the middle: the lanes are a window onto the 3D light layer */
  background: linear-gradient(180deg, rgba(5, 6, 18, 0.5), rgba(5, 6, 18, 0.16) 34%, rgba(5, 6, 18, 0.08) 80%, rgba(5, 6, 18, 0.16));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 30px 70px -40px #000;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.tl.is-drop-target {
  border-color: rgba(var(--accent-rgb), 0.8);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.5), 0 0 calc(40px * var(--glow)) rgba(var(--accent-rgb), 0.25);
}
.tl.is-template {
  border-color: rgba(var(--accent2-rgb), 0.55);
}

.tl-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 28, 0.6);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
}
.tl-mini {
  position: relative;
  flex: 1;
  height: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
}
.tl.is-zoomed .tl-mini {
  cursor: grab;
}
.tl-mini-blocks i {
  position: absolute;
  top: 3px;
  bottom: 3px;
  min-width: 2px;
  border-radius: 2px;
  opacity: 0.9;
}
.tl-mini-fill,
.tl-mini-now {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
}
.tl.is-today .tl-mini-fill,
.tl.is-today .tl-mini-now {
  display: block;
}
.tl-mini-fill {
  background: rgba(255, 255, 255, 0.08);
}
.tl-mini-now {
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 8px rgb(var(--accent-rgb));
}
.tl-mini-win {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.tl-day {
  display: none;
  align-items: baseline;
  gap: 7px;
  font-size: 10.5px;
  white-space: nowrap;
}
.tl.is-today .tl-day {
  display: flex;
}
.tl-day-label {
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-3);
}
.tl-day-val {
  min-width: 3ch;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: rgb(var(--accent-rgb));
}

.tl-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(160, 170, 255, 0.28) transparent;
}
.tl-content {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 100%;
}

.tl-ruler {
  position: relative;
  flex: none;
  height: var(--ruler-h);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 28, 0.5);
}
.tl-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transform: translateX(-50%);
  pointer-events: none;
}
.tl-tick i {
  order: 2;
  width: 1px;
  height: 6px;
  background: var(--line-2);
}
.tl-tick b {
  padding-bottom: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  unicode-bidi: plaintext;
}
.tl-tick.at-left {
  transform: none;
  align-items: flex-start;
}
.tl-tick.at-left b {
  padding-left: 6px;
}
.tl-tick.at-right {
  transform: translateX(-100%);
  align-items: flex-end;
}
.tl-tick.at-right b {
  padding-right: 6px;
}
.tl-tick.is-minor i,
.tl-tick.is-sub i {
  height: 4px;
  opacity: 0.6;
}
.tl-tick.is-sub b {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-4);
}

.tl-track {
  position: relative;
  flex: 1;
  min-height: 0;
}
.tl-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tl-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(150, 162, 255, 0.07);
}
.tl-line.is-major {
  background: rgba(150, 162, 255, 0.12);
}
.tl-line.is-noon {
  background: rgba(150, 162, 255, 0.24);
}
.tl-line.is-sub {
  background: rgba(150, 162, 255, 0.05);
}
.tl-line.is-quarter {
  opacity: 0.6;
}
/* the glossy "deck" the blocks stand on, where their light is reflected */
.tl-track::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--reflect);
  pointer-events: none;
  border-top: 1px solid rgba(var(--accent-rgb), 0.28);
  background: linear-gradient(180deg, rgba(4, 5, 16, 0.1), rgba(4, 5, 16, 0.3));
}
/* with no 3D floor behind it, the deck needs its own darker surface */
html:not(.fx-on) .tl-track::after {
  background: linear-gradient(180deg, rgba(4, 5, 16, 0.34), rgba(4, 5, 16, 0.6));
}

.tl-lanes {
  --lanes: 1;
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: pan-x;
}
.tl.is-zoomed .tl-lanes {
  cursor: grab;
}
.tl.is-panning .tl-lanes {
  cursor: grabbing;
}

/* ------------------------------------------------------------------ blocks */

.blk {
  --c: #8b5cff;
  --c-rgb: 139, 92, 255;
  --lane: 0;
  position: absolute;
  top: calc(var(--pad-t) + (100% - var(--pad-t) - var(--reflect)) / var(--lanes) * var(--lane));
  height: calc((100% - var(--pad-t) - var(--reflect)) / var(--lanes) - 7px);
  min-width: 6px;
  padding: 0 1.5px;
  z-index: 1;
  outline: none;
  cursor: grab;
  touch-action: none;
  transition: left 0.3s var(--ease), width 0.3s var(--ease), top 0.3s var(--ease), height 0.3s var(--ease), transform 0.28s var(--ease);
}
.blk-face {
  position: relative;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 10px 9px;
  border-radius: 11px;
  border: 1px solid rgba(var(--c-rgb), 0.88);
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0) 44%),
    linear-gradient(180deg, rgba(var(--c-rgb), 0.52), rgba(var(--c-rgb), 0.22));
  /* inner sheen, the slab's extruded lower edge, then a tight glow */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -12px 18px -12px rgba(0, 0, 0, 0.38),
    0 4px 0 0 rgba(var(--c-rgb), 0.34),
    0 0 calc(9px * var(--glow)) rgba(var(--c-rgb), calc(0.32 * var(--glow)));
  transition: box-shadow 0.28s ease, border-color 0.25s ease, filter 0.25s ease;
}
/* without the WebGL light layer, CSS carries the whole glow and the reflection */
html:not(.fx-live) .blk-face {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -12px 18px -12px rgba(0, 0, 0, 0.38),
    0 4px 0 0 rgba(var(--c-rgb), 0.34),
    0 0 calc(26px * var(--glow)) rgba(var(--c-rgb), calc(0.46 * var(--glow)));
}
html:not(.fx-live) .blk.is-last-lane::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: calc(100% + 9px);
  height: calc(var(--reflect) - 16px);
  border-radius: 6px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(var(--c-rgb), 0.34), transparent);
  filter: blur(5px);
}

.blk-icon {
  --icn: 22px;
  display: grid;
  filter: drop-shadow(0 0 6px rgba(var(--c-rgb), 0.95));
}
.blk-icon .icn-img {
  --icn: 26px;
}
.blk-title {
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.22;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}
.blk-time {
  margin-top: auto;
  max-width: 100%;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.86);
  font-variant-numeric: tabular-nums;
}
.blk-dur {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.62);
}
.blk[data-size="m"] .blk-face {
  padding: 9px 7px 8px;
}
.blk[data-size="m"] .blk-time {
  font-size: 9.5px;
  white-space: normal;
  line-height: 1.25;
}
.blk[data-size="s"] .blk-face {
  align-items: center;
  padding: 9px 3px 8px;
}
.blk[data-size="s"] .blk-icon {
  --icn: 18px;
}
.blk[data-size="s"] .blk-title,
.blk[data-size="s"] .blk-time {
  display: none;
}
.blk[data-size="s"] .blk-dur {
  margin-top: auto;
  font-size: 9px;
}
.blk[data-size="xs"] .blk-face {
  padding: 0;
  border-radius: 5px;
}
.blk[data-size="xs"] .blk-face > * {
  display: none;
}

/* hover: the slab rises toward the viewer */
.blk:hover {
  z-index: 3;
  transform: perspective(900px) translateZ(18px) translateY(-2px);
}
.blk:hover .blk-face {
  border-color: rgb(var(--c-rgb));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    inset 0 -12px 18px -12px rgba(0, 0, 0, 0.3),
    0 7px 0 0 rgba(var(--c-rgb), 0.36),
    0 16px 26px -14px rgba(0, 0, 0, 0.8),
    0 0 calc(22px * var(--glow)) rgba(var(--c-rgb), calc(0.5 * var(--glow)));
}

/* selected: stronger glow and a light that travels around the outline */
.blk.is-selected {
  z-index: 4;
}
.blk.is-selected .blk-face {
  border-color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 0 22px rgba(var(--c-rgb), 0.35),
    0 6px 0 0 rgba(var(--c-rgb), 0.42),
    0 0 calc(28px * var(--glow)) rgba(var(--c-rgb), calc(0.7 * var(--glow)));
}
.blk.is-selected::before {
  content: "";
  position: absolute;
  inset: -4px -2.5px;
  padding: 2px;
  border-radius: 14px;
  pointer-events: none;
  background: conic-gradient(from var(--ang), rgba(var(--c-rgb), 0) 0deg, rgb(var(--c-rgb)) 70deg, #fff 100deg, rgb(var(--c-rgb)) 130deg, rgba(var(--c-rgb), 0) 200deg, rgba(var(--c-rgb), 0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: blk-orbit 3.2s linear infinite;
}
@keyframes blk-orbit {
  to {
    --ang: 360deg;
  }
}

.blk.is-dragging {
  z-index: 6;
  cursor: grabbing;
  transition: transform 0.2s var(--ease);
  transform: perspective(900px) translateZ(30px) translateY(-4px);
}
.blk.is-dragging .blk-face {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 9px 0 0 rgba(var(--c-rgb), 0.34),
    0 26px 36px -14px rgba(0, 0, 0, 0.85),
    0 0 calc(40px * var(--glow)) rgba(var(--c-rgb), calc(0.75 * var(--glow)));
}

.blk.is-conflict .blk-face {
  border-color: var(--danger);
  background:
    repeating-linear-gradient(45deg, rgba(255, 84, 112, 0.42) 0 7px, rgba(255, 84, 112, 0.1) 7px 14px),
    linear-gradient(180deg, rgba(var(--c-rgb), 0.4), rgba(var(--c-rgb), 0.18));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 0 0 rgba(255, 84, 112, 0.4), 0 0 calc(24px * var(--glow)) rgba(255, 84, 112, 0.55);
}

.blk.is-dropped .blk-face {
  animation: blk-drop 0.65s var(--ease-out);
}
@keyframes blk-drop {
  0% {
    transform: scale(1.07);
    filter: brightness(1.9) saturate(1.3);
  }
  100% {
    transform: none;
    filter: none;
  }
}

/* resize grips */
.blk-h {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 10px;
  cursor: ew-resize;
}
.blk-h-s {
  left: -2px;
}
.blk-h-e {
  right: -2px;
}
.tl[data-dir="rtl"] .blk-h-s {
  left: auto;
  right: -2px;
}
.tl[data-dir="rtl"] .blk-h-e {
  right: auto;
  left: -2px;
}
.blk-h::after {
  content: "";
  position: absolute;
  top: 30%;
  bottom: 30%;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #fff;
  opacity: 0;
  box-shadow: 0 0 8px rgb(var(--c-rgb));
  transition: opacity 0.2s ease;
}
.blk:hover .blk-h::after,
.blk.is-selected .blk-h::after {
  opacity: 0.8;
}
.blk[data-size="xs"] .blk-h {
  width: 4px;
}
.blk[data-size="xs"] .blk-h::after {
  display: none;
}
.tl.is-dragging[data-drag="start"],
.tl.is-dragging[data-drag="end"],
.tl.is-dragging[data-drag="start"] .blk,
.tl.is-dragging[data-drag="end"] .blk {
  cursor: ew-resize;
}

/* static preview used inside the activity editor */
.blk.is-static {
  position: relative;
  top: auto;
  width: 210px;
  height: 96px;
  cursor: default;
  transform: none !important;
}

/* where a block will land */
.tl-ghost {
  --c-rgb: var(--accent-rgb);
  position: absolute;
  top: var(--pad-t);
  bottom: calc(var(--reflect) + 7px);
  z-index: 5;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  border-radius: 11px;
  border: 1.5px dashed rgb(var(--c-rgb));
  background: rgba(var(--c-rgb), 0.14);
  box-shadow: 0 0 calc(24px * var(--glow)) rgba(var(--c-rgb), 0.38), inset 0 0 24px rgba(var(--c-rgb), 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}
.tl-ghost.is-on {
  opacity: 1;
}
.tl-ghost-label {
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* live playhead */
.tl-now {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  z-index: 7;
  pointer-events: none;
}
.tl.is-today .tl-now {
  display: block;
}
.tl-now::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: linear-gradient(180deg, #fff, rgb(var(--accent-rgb)) 28%, rgba(var(--accent-rgb), 0.55));
  box-shadow: 0 0 calc(12px * var(--glow)) rgba(var(--accent-rgb), 0.95), 0 0 2px #fff;
}
.tl-now::after {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  border: 5px solid transparent;
  border-top: 7px solid #fff;
  filter: drop-shadow(0 0 6px rgb(var(--accent-rgb)));
}
.tl-now-tag {
  position: absolute;
  top: 6px;
  left: 9px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgb(var(--accent-rgb));
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  unicode-bidi: plaintext;
  box-shadow: 0 0 calc(14px * var(--glow)) rgba(var(--accent-rgb), 0.7);
}
.tl-now.is-flip .tl-now-tag {
  left: auto;
  right: 9px;
}

/* time readout that follows a dragged block */
.tl-bubble {
  position: absolute;
  top: 4px;
  z-index: 9;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--panel-solid);
  border: 1px solid var(--line-2);
  font-size: 11.5px;
  font-weight: 700;
  white-space: pre;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: 0 10px 24px -8px #000;
}
.tl-bubble.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tl-empty {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(34px + var(--ruler-h));
  bottom: var(--reflect);
  z-index: 3;
  place-items: center;
  pointer-events: none;
}
.tl.is-empty .tl-empty {
  display: grid;
}
.tl-empty-card {
  display: grid;
  gap: 6px;
  justify-items: center;
  max-width: 480px;
  padding: 12px;
  text-align: center;
}
.tl-empty-card strong {
  font-size: 15px;
  font-weight: 700;
}
.tl-empty-card > span {
  font-size: 12.5px;
  color: var(--ink-3);
}
.tl-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  pointer-events: auto;
}

/* ------------------------------------------------------------------ inspector */

/* fixed height: selecting a block must not make the timeline above it jump */
.ed-insp {
  height: 236px;
  padding: 14px 16px;
  overflow: hidden;
}
.insp-form {
  --c: #8b5cff;
  --c-rgb: 139, 92, 255;
  display: grid;
  grid-template-columns: minmax(230px, 1.25fr) auto minmax(190px, 1fr);
  grid-template-areas: "id times color" "id times actions";
  align-items: start;
  gap: 12px 22px;
}
.insp-id {
  grid-area: id;
  display: flex;
  gap: 12px;
  min-width: 0;
}
.insp-icon,
.ae-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 15px;
  color: #fff;
  border: 1px solid rgb(var(--c-rgb));
  background: linear-gradient(180deg, rgba(var(--c-rgb), 0.78), rgba(var(--c-rgb), 0.36));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 5px 0 0 rgba(var(--c-rgb), 0.3), 0 0 calc(22px * var(--glow)) rgba(var(--c-rgb), calc(0.5 * var(--glow)));
  cursor: pointer;
  transition: transform 0.24s var(--ease), box-shadow 0.25s ease;
}
.insp-icon:hover,
.ae-icon:hover {
  transform: perspective(600px) translateZ(14px) translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 7px 0 0 rgba(var(--c-rgb), 0.32), 0 0 calc(32px * var(--glow)) rgba(var(--c-rgb), calc(0.7 * var(--glow)));
}
.insp-icon .icn-img,
.ae-icon .icn-img {
  --icn: 46px !important;
}
.insp-id-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 8px;
}
.insp-title {
  height: 38px;
  font-size: 16px;
  font-weight: 700;
}
.insp-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.insp-link .dd {
  flex: 1;
  min-width: 0;
  height: 30px;
}
.insp-link .btn-icon {
  width: 30px;
  height: 30px;
}
.insp-detached {
  font-size: 12px;
  color: var(--ink-4);
}
.insp-times {
  grid-area: times;
  display: flex;
  gap: 8px;
}
.insp-times .field {
  width: 96px;
}
.insp-color {
  grid-area: color;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.insp-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.insp-summary {
  display: grid;
  gap: 10px;
}
.sum-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 22px;
}
.sum-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-2);
}
.sum-stats {
  display: flex;
  gap: 22px;
}
.sum-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.sum-stat-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink-4);
}
.sum-stat b {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sum-bar {
  display: flex;
  gap: 2px;
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}
.sum-bar i {
  min-width: 2px;
  border-radius: 2px;
  transition: flex-grow 0.4s var(--ease);
}
.sum-bar i.is-free {
  background: transparent;
}
.sum-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 62px;
  overflow: hidden;
}
.sum-chip {
  --c-rgb: 139, 92, 255;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 220px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(var(--c-rgb), 0.45);
  background: rgba(var(--c-rgb), 0.12);
  font-size: 12px;
  font-weight: 600;
}
.sum-chip .icn {
  color: rgb(var(--c-rgb));
}
.sum-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sum-chip b {
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sum-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--ink-4);
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1320px) {
  .insp-form {
    grid-template-columns: minmax(200px, 1fr) auto;
    grid-template-areas: "id times" "color actions";
  }
  .insp-color .color-presets {
    display: none;
  }
}
@media (max-width: 1180px) {
  .ed {
    grid-template-columns: 224px minmax(0, 1fr);
  }
  .tb-date-main {
    font-size: 14px;
  }
}
@media (max-width: 860px) {
  #view-timeline {
    overflow-y: auto;
  }
  .ed {
    height: auto;
    min-height: 100%;
    grid-template-columns: minmax(0, 1fr);
  }
  .ed-main {
    grid-template-rows: auto 300px auto;
  }
  .ed-lib {
    order: 2;
    max-height: none;
  }
  .lib-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
  }
  .lib-list .act {
    width: 200px;
  }
  .lib-cat {
    align-self: center;
    padding: 0 4px;
    white-space: nowrap;
  }
  .ed-insp {
    height: auto;
    min-height: 150px;
  }
  .insp-form {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "id" "times" "color" "actions";
  }
  .insp-times .field {
    flex: 1;
    width: auto;
  }
  .insp-actions {
    justify-content: flex-start;
  }
  .tb-end .tb-group + .tb-group {
    padding-inline-start: 0;
    border-inline-start: 0;
  }
  .tb-start,
  .tb-end,
  .tb-daynav {
    width: 100%;
  }
  .tb-daynav,
  .tb-end .tb-group {
    flex-wrap: wrap;
  }
  .tb-date {
    flex: 1;
    min-width: 200px;
  }
  #view-timeline {
    overflow-x: hidden;
  }
  .tb-date-text {
    min-width: 0;
    overflow: hidden;
  }
  .sum-chips {
    max-height: none;
  }
  .sum-stats {
    gap: 14px;
  }
}

/* ------------------------------------------------------------------ notes & routines */

/* the note of a block, under its name */
.blk-note {
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.82);
}
.blk[data-size="m"] .blk-note {
  -webkit-line-clamp: 1;
  line-clamp: 1;
  font-size: 9.5px;
}
.blk[data-size="s"] .blk-note,
.blk[data-size="xs"] .blk-note {
  display: none;
}

/* marks a block that repeats */
.blk-rt {
  display: none;
  position: absolute;
  top: 7px;
  inset-inline-end: 7px;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  color: #fff;
}
.blk.is-routine .blk-rt {
  display: grid;
}
.blk.is-routine[data-size="s"] .blk-rt,
.blk.is-routine[data-size="xs"] .blk-rt {
  display: none;
}

.insp-note {
  height: 50px;
  min-height: 50px;
  padding: 6px 10px;
  font-size: 12.5px;
  line-height: 1.45;
  resize: none;
}
.blk-note {
  white-space: pre-line;
}
.insp-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.insp-links .field-label {
  margin-inline-end: 4px;
}
.insp-link-slot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border: 1px dashed var(--line-2);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.insp-link-slot:hover {
  transform: perspective(500px) translateZ(8px);
  color: #fff;
  border-color: rgb(var(--c-rgb));
}
.insp-link-slot.is-on {
  border-style: solid;
  border-color: rgb(var(--c-rgb));
  background: rgba(var(--c-rgb), 0.28);
  color: #fff;
  box-shadow: 0 0 calc(12px * var(--glow)) rgba(var(--c-rgb), calc(0.4 * var(--glow)));
}
