:root {
  --bg:      oklch(97% 0.018 70);
  --surface: oklch(99% 0.008 70);
  --fg:      oklch(22% 0.02 50);
  --muted:   oklch(50% 0.018 50);
  --border:  oklch(90% 0.014 70);
  --accent:  oklch(64% 0.13 28);

  --font-display: 'Tiempos Headline', 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --font-body:    'Söhne', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Inter, sans-serif;

  --lavender:   oklch(75% 0.08 300);
  --sage:       oklch(71% 0.07 145);
  --sky:        oklch(74% 0.08 225);
  --rose:       oklch(76% 0.09 18);
  --amber:      oklch(79% 0.11 75);
  --peach:      oklch(80% 0.10 50);
  --mint:       oklch(80% 0.07 175);
  --periwinkle: oklch(76% 0.09 265);
  --blush:      oklch(82% 0.07 0);
  --cocoa:      oklch(60% 0.06 50);
  --lemon:      oklch(88% 0.13 95);
  --aqua:       oklch(80% 0.08 200);

  --shadow:      0 20px 60px oklch(42% 0.03 45 / 0.14);
  --soft-shadow: 0 10px 35px oklch(42% 0.03 45 / 0.09);
  --radius: 18px;

  --hour-height: 44px;
  --start-hour: 7;
  --end-hour: 19;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--fg);
  background:
    radial-gradient(circle at 10% 0%, oklch(92% 0.05 36 / 0.8), transparent 28rem),
    linear-gradient(135deg, var(--bg), oklch(95% 0.02 85));
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overflow: auto;
}

button, input, textarea { font: inherit; }
input, textarea { user-select: text; }

h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: 0; margin: 0; }

/* ------------------------------ Desktop frame ------------------------------ */

.desktop {
  width: 100vw;
  min-width: 1180px;
  height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: color-mix(in oklch, var(--surface) 90%, white);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: oklch(96% 0.018 72 / 0.9);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 4px 4px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 13px;
  color: white;
  background: var(--accent);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.35);
}
.check-glyph {
  width: 17px; height: 10px;
  border-left: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}
.brand h1 { font-size: 27px; line-height: 1; font-weight: 700; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.nav { display: grid; gap: 7px; }
.tab.is-hidden { display: none !important; }
.tab {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 42px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0; border-radius: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}
.tab:hover { background: oklch(100% 0 0 / 0.6); color: var(--fg); }
.tab.active {
  color: var(--fg);
  background: var(--surface);
  box-shadow: 0 1px 0 oklch(100% 0 0 / 0.8), 0 8px 22px oklch(42% 0.02 50 / 0.07);
}
.tab-icon {
  width: 25px; height: 25px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: oklch(94% 0.018 70);
  color: var(--muted);
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  position: relative;
}
.tab.active .tab-icon { background: oklch(87% 0.05 35); color: var(--muted); }
.tab-icon::before, .tab-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
}
.icon-schedule::before {
  width: 13px; height: 13px;
  border: 1.8px solid currentColor;
  border-radius: 4px;
  box-shadow: inset 0 4px 0 oklch(0% 0 0 / 0.10);
}
.icon-schedule::after {
  width: 9px; height: 1.6px;
  background: currentColor;
  transform: translateY(2px);
  box-shadow: 0 4px 0 currentColor;
  opacity: 0.75;
}
.icon-list::before {
  width: 12px; height: 1.7px;
  background: currentColor;
  transform: translateY(-4px);
  box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}
.icon-bridge::before, .icon-bridge::after {
  width: 8px; height: 12px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}
.icon-bridge::before { transform: translateX(-4px); }
.icon-bridge::after { transform: translateX(4px); opacity: 0.7; }
.icon-add::before { width: 13px; height: 1.8px; background: currentColor; }
.icon-add::after { width: 1.8px; height: 13px; background: currentColor; }
.icon-review::before {
  width: 13px; height: 13px;
  border-radius: 999px;
  border: 1.8px solid currentColor;
}
.icon-review::after {
  width: 7px; height: 4px;
  border-left: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg) translate(1px, -1px);
}
.icon-settings::before {
  width: 14px; height: 14px;
  border-radius: 999px;
  border: 2px dotted currentColor;
}
.icon-settings::after {
  width: 5px; height: 5px;
  border-radius: 999px;
  background: currentColor;
}
.icon-connect::before {
  width: 14px; height: 10px;
  border: 1.7px solid currentColor;
  border-radius: 4px;
}
.icon-connect::after {
  width: 6px; height: 1.7px;
  background: currentColor;
  transform: translateY(7px);
}

.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }

.cal-mini {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: oklch(99% 0.008 70 / 0.62);
}
.cal-mini b { display: block; font-size: 13px; margin-bottom: 8px; }
.layer-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  color: var(--muted); font-size: 12px;
  margin-top: 7px;
}
.swatch {
  width: 13px; height: 13px;
  border-radius: 5px;
  border: 1px solid oklch(0% 0 0 / 0.08);
  flex: 0 0 auto;
  display: inline-block;
}

/* ------------------------------ Main area ------------------------------ */

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    linear-gradient(90deg, oklch(100% 0 0 / 0.64), transparent 42%),
    var(--surface);
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
}
.topbar .no-drag { -webkit-app-region: no-drag; }

.topbar-main { min-width: 0; flex: 1 1 auto; }
.today-kicker {
  display: flex; align-items: center; gap: 9px;
  color: var(--muted); font-size: 13px;
}
.pulse {
  width: 9px; height: 9px;
  border-radius: 999px;
  background: var(--sage);
  box-shadow: 0 0 0 5px oklch(71% 0.07 145 / 0.16);
}
.topbar h2 {
  margin: 4px 0 0;
  font-size: clamp(26px, 2.9vw, 36px);
  line-height: 1;
}

.actions {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; justify-content: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
}
.button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--fg);
  background: oklch(100% 0 0 / 0.7);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border 160ms ease;
  white-space: nowrap;
  line-height: 1.1;
}
.button:hover { transform: translateY(-1px); background: white; }
.button.primary { color: white; border-color: transparent; background: var(--accent); }
.button.ghost { background: transparent; }

/* ------------------------------ Window controls ------------------------------ */

.window-controls {
  display: flex; align-items: stretch;
  height: 38px;
  margin-top: -22px;
  margin-right: -26px;
  align-self: flex-start;
  border-radius: 0 0 0 13px;
  overflow: hidden;
  background: oklch(98% 0.009 70 / 0.72);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.window-button {
  position: relative;
  width: 42px;
  border: 0;
  color: oklch(34% 0.018 50);
  background: transparent;
  cursor: default;
}
.window-button:hover { background: oklch(93% 0.014 70 / 0.7); }
.window-button.close:hover { color: white; background: oklch(62% 0.18 27); }
.window-button::before, .window-button::after {
  content: ""; position: absolute; inset: 0; margin: auto;
}
.window-button.minimize::before {
  width: 12px; height: 1.5px; background: currentColor; top: 11px;
}
.window-button.maximize::before {
  width: 11px; height: 9px; border: 1.5px solid currentColor; border-radius: 1px;
}
.window-button.close::before, .window-button.close::after {
  width: 13px; height: 1.5px; background: currentColor; transform: rotate(45deg);
}
.window-button.close::after { transform: rotate(-45deg); }

/* ------------------------------ Content / screens ------------------------------ */

.content {
  min-height: 0;
  position: relative;
  padding: 22px 26px 26px;
  overflow: auto;
}
.screen { display: none; min-height: 100%; animation: fadeIn 200ms ease; }
.screen.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel {
  background: oklch(100% 0 0 / 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
}

/* ------------------------------ Schedule view ------------------------------ */

.schedule-grid {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(320px, 0.76fr);
  gap: 18px;
  align-items: start;
}

/* The whole rail + timeline scrolls inside this pane. The visible
   height is fixed; scrolling the pane scrolls both columns together. */
.timeline-pane {
  position: relative;
  height: 600px;
  padding: 0;
  overflow: hidden;
}

.timeline-scroll {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  padding: 14px 14px 14px 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

/* Fade the very top and bottom of the scroll area so blocks don't
   collide with the panel border edge as they scroll past. */
.timeline-pane::before,
.timeline-pane::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 4;
}
.timeline-pane::before {
  top: 0;
  background: linear-gradient(180deg, oklch(100% 0 0 / 0.8), transparent);
}
.timeline-pane::after {
  bottom: 0;
  background: linear-gradient(0deg, oklch(100% 0 0 / 0.8), transparent);
}

.time-rail {
  display: grid;
  grid-template-rows: repeat(24, var(--hour-height));
  padding-top: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  height: calc(var(--hour-height) * 24);
}

.timeline {
  position: relative;
  height: calc(var(--hour-height) * 24);
  border-left: 1px solid var(--border);
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-height) - 1px), var(--border) var(--hour-height)),
    linear-gradient(180deg, oklch(99% 0.007 70), oklch(97% 0.015 80));
  border-radius: 16px;
  overflow: hidden;
  transition: background 180ms ease, box-shadow 180ms ease;
}
.timeline.drop-target {
  box-shadow: inset 0 0 0 2px oklch(74% 0.06 35);
}

.time-now {
  position: absolute;
  left: 0; right: 10px;
  display: flex; align-items: center; gap: 8px;
  z-index: 5;
  color: var(--rose);
  font-size: 12px; font-weight: 700;
  pointer-events: none;
}
.time-now::before {
  content: ""; width: 8px; height: 8px;
  border-radius: 999px; background: currentColor;
  margin-left: -4px;
}
.time-now::after {
  content: ""; height: 1.5px; flex: 1;
  background: currentColor; opacity: 0.55;
}

.block {
  position: absolute;
  left: 18px; right: 18px;
  min-height: 36px;
  padding: 11px 13px;
  border-radius: 15px;
  border: 1px solid oklch(0% 0 0 / 0.05);
  box-shadow: 0 8px 18px oklch(42% 0.02 50 / 0.06);
  cursor: grab;
  overflow: hidden;
}
.block.dragging { opacity: 0.5; cursor: grabbing; }
.block.resizing {
  cursor: ns-resize;
  box-shadow: 0 12px 24px oklch(42% 0.03 50 / 0.14);
}
.resize-handle {
  position: absolute;
  left: 44px;
  right: 44px;
  height: 10px;
  cursor: ns-resize;
  opacity: 0;
  transition: opacity 140ms ease, background 140ms ease;
}
.resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 42px;
  height: 2px;
  border-radius: 999px;
  background: oklch(42% 0.04 50 / 0.38);
  transform: translateX(-50%);
}
.resize-handle.top { top: 0; }
.resize-handle.bottom { bottom: 0; }
.block.planned:hover .resize-handle,
.block.resizing .resize-handle { opacity: 1; }
.block h3, .task h3, .review-card h3 {
  font-size: 14px; line-height: 1.2; font-weight: 700;
}
.block p, .task p, .review-card p {
  margin: 5px 0 0;
  color: oklch(35% 0.02 50 / 0.72);
  font-size: 12px; line-height: 1.35;
}
.block .block-time {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: oklch(38% 0.02 50 / 0.78);
  font-weight: 600;
}
.block.planned             { background: oklch(91% 0.035 78); }
.block.cal-sage            { background: oklch(91% 0.034 145); }
.block.cal-lavender        { background: color-mix(in oklch, var(--lavender) 28%, white); }
.block.cal-sky             { background: color-mix(in oklch, var(--sky) 28%, white); }
.block.cal-rose            { background: color-mix(in oklch, var(--rose) 28%, white); }
.block.cal-amber           { background: color-mix(in oklch, var(--amber) 32%, white); }
.block.cal-peach           { background: color-mix(in oklch, var(--peach) 30%, white); }
.block.cal-mint            { background: color-mix(in oklch, var(--mint) 30%, white); }
.block.cal-periwinkle      { background: color-mix(in oklch, var(--periwinkle) 28%, white); }
.block.cal-blush           { background: color-mix(in oklch, var(--blush) 30%, white); }
.block.cal-cocoa           { background: color-mix(in oklch, var(--cocoa) 26%, white); color: oklch(28% 0.04 50); }
.block.cal-lemon           { background: color-mix(in oklch, var(--lemon) 36%, white); }
.block.cal-aqua            { background: color-mix(in oklch, var(--aqua) 30%, white); }

.block.read-only { cursor: default; }
.block.read-only::after {
  content: "Calendar";
  position: absolute;
  top: 11px; right: 12px;
  color: oklch(38% 0.02 50 / 0.62);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.drag-hint {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: 18px;
  width: 220px;
  padding: 12px 13px;
  border-radius: 15px;
  background: oklch(100% 0 0 / 0.88);
  border: 1px dashed oklch(74% 0.06 35);
  box-shadow: var(--soft-shadow);
  color: var(--fg);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
  opacity: 0.85;
}
.drag-hint b { display: block; font-size: 13px; margin-bottom: 3px; }

/* ------------------------------ Task panel / cards ------------------------------ */

.task-panel { display: grid; gap: 13px; padding: 15px; align-content: start; }

.panel-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}
.panel-title h3 { font-size: 22px; line-height: 1; }
.count { color: var(--muted); font-size: 12px; }

.task {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px; align-items: start;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: oklch(100% 0 0 / 0.68);
  transition: opacity 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.task.draggable { cursor: grab; box-shadow: 0 7px 18px oklch(42% 0.02 50 / 0.06); }
.task.dragging { opacity: 0.4; cursor: grabbing; }
.task .body { min-width: 0; }
.task .body h3 { word-break: break-word; }
.task.scheduled { background: oklch(96% 0.022 78); }

.check {
  width: 23px; height: 23px;
  border-radius: 999px;
  border: 1.6px solid oklch(78% 0.02 70);
  background: white;
  display: grid; place-items: center;
  color: white;
  cursor: pointer;
  transition: background 180ms ease, border 180ms ease, transform 180ms ease;
}
.check:hover { border-color: var(--sage); }
.task.done .check {
  background: var(--sage);
  border-color: var(--sage);
  transform: scale(1.04);
}
.task.done h3 { text-decoration: line-through; color: var(--muted); }
.task.done .check::before {
  content: "";
  width: 9px; height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}

.tag {
  display: inline-flex; align-items: center;
  min-height: 24px; padding: 0 8px;
  border-radius: 999px;
  color: oklch(36% 0.02 50 / 0.76);
  background: oklch(94% 0.018 70);
  font-size: 11px; white-space: nowrap;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: flex-start;
  max-width: 100%;
}
.tags .tag { font-weight: 600; }

.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.task-meta .tags { display: contents; }
.tag-more { background: oklch(92% 0.01 70); color: var(--muted); }

.color-dot.random {
  background:
    conic-gradient(from 0deg,
      var(--rose), var(--amber), var(--lemon), var(--mint),
      var(--aqua), var(--sky), var(--periwinkle), var(--lavender),
      var(--blush), var(--peach), var(--rose));
  position: relative;
}
.color-dot.random::after {
  content: "?";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 1px 2px oklch(0% 0 0 / 0.4);
}

.soft-note {
  padding: 16px;
  border-radius: 16px;
  background: oklch(94% 0.025 78);
  border: 1px solid oklch(88% 0.025 78);
}
.soft-note h3 { margin: 0 0 6px; font-size: 21px; }
.soft-note p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* ------------------------------ List view ------------------------------ */

.list-shell {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  align-items: start;
}
.list-main { padding: 22px; }
.list-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.list-header h3 { font-size: 28px; line-height: 1; }
.list-header p { margin: 8px 0 0; color: var(--muted); max-width: 48ch; }

.task-list { display: grid; gap: 11px; padding-top: 17px; }

.empty-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 15px;
  background: oklch(99% 0.008 70 / 0.4);
}

/* ------------------------------ Bridge / split view ------------------------------ */

.split-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.mini-schedule, .mini-list { min-height: 590px; padding: 16px; }
.mini-schedule { display: flex; flex-direction: column; }
.mini-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.mini-title h3 { font-size: 25px; }
.mini-agenda {
  display: grid;
  gap: 8px;
  margin: -2px 0 12px;
}
.mini-agenda-item {
  min-height: 38px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid oklch(0% 0 0 / 0.05);
  border-radius: 12px;
  background: oklch(96% 0.018 78);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.mini-agenda-item span {
  color: oklch(40% 0.06 35);
  font-size: 12px;
  font-weight: 700;
}
.mini-agenda-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.mini-agenda-item.planned { background: oklch(91% 0.035 78); }
.mini-agenda-item.cal-sage { background: oklch(91% 0.034 145); }
.mini-agenda-item.cal-lavender { background: color-mix(in oklch, var(--lavender) 28%, white); }
.mini-agenda-item.cal-sky { background: color-mix(in oklch, var(--sky) 28%, white); }
.mini-agenda-item.cal-rose { background: color-mix(in oklch, var(--rose) 28%, white); }
.mini-agenda-item.cal-amber { background: color-mix(in oklch, var(--amber) 32%, white); }
.mini-agenda-item.cal-peach { background: color-mix(in oklch, var(--peach) 30%, white); }
.mini-agenda-item.cal-mint { background: color-mix(in oklch, var(--mint) 30%, white); }
.mini-agenda-item.cal-periwinkle { background: color-mix(in oklch, var(--periwinkle) 28%, white); }
.mini-agenda-item.cal-blush { background: color-mix(in oklch, var(--blush) 30%, white); }
.mini-agenda-item.cal-cocoa { background: color-mix(in oklch, var(--cocoa) 26%, white); }
.mini-agenda-item.cal-lemon { background: color-mix(in oklch, var(--lemon) 36%, white); }
.mini-agenda-item.cal-aqua { background: color-mix(in oklch, var(--aqua) 30%, white); }
.mini-scroll {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 15px;
  scrollbar-gutter: stable;
  border: 1px solid var(--border);
  background: oklch(99% 0.008 70 / 0.65);
}
.mini-time-rail {
  display: grid;
  grid-template-rows: repeat(24, var(--hour-height));
  min-height: calc(var(--hour-height) * 24);
  padding: 8px 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}
.mini-time-rail span { min-height: var(--hour-height); }
.mini-track {
  position: relative;
  height: calc(var(--hour-height) * 24);
  border-radius: 14px;
  background: repeating-linear-gradient(to bottom, oklch(98% 0.008 70), oklch(98% 0.008 70) calc(var(--hour-height) - 1px), var(--border) var(--hour-height));
  overflow: hidden;
}
.mini-block {
  position: absolute;
  left: 14px; right: 14px;
  padding: 10px 12px;
  border-radius: 13px;
  font-size: 12px; font-weight: 700;
  min-height: 36px;
  box-shadow: 0 7px 16px oklch(42% 0.02 50 / 0.08);
  overflow: hidden;
}
.mini-block.planned             { background: oklch(91% 0.035 78); }
.mini-block.cal-sage            { background: oklch(91% 0.034 145); }
.mini-block.cal-lavender        { background: color-mix(in oklch, var(--lavender) 28%, white); }
.mini-block.cal-sky             { background: color-mix(in oklch, var(--sky) 28%, white); }
.mini-block.cal-rose            { background: color-mix(in oklch, var(--rose) 28%, white); }
.mini-block.cal-amber           { background: color-mix(in oklch, var(--amber) 32%, white); }
.mini-block.cal-peach           { background: color-mix(in oklch, var(--peach) 30%, white); }
.mini-block.cal-mint            { background: color-mix(in oklch, var(--mint) 30%, white); }
.mini-block.cal-periwinkle      { background: color-mix(in oklch, var(--periwinkle) 28%, white); }
.mini-block.cal-blush           { background: color-mix(in oklch, var(--blush) 30%, white); }
.mini-block.cal-cocoa           { background: color-mix(in oklch, var(--cocoa) 26%, white); }
.mini-block.cal-lemon           { background: color-mix(in oklch, var(--lemon) 36%, white); }
.mini-block.cal-aqua            { background: color-mix(in oklch, var(--aqua) 30%, white); }

.bridge-card {
  margin: 12px 0;
  padding: 13px;
  border-radius: 15px;
  border: 1px solid oklch(83% 0.035 35);
  background: oklch(99% 0.01 70);
  box-shadow: var(--soft-shadow);
}
.bridge-card small {
  display: block; margin-top: 6px;
  color: var(--muted);
}

/* ------------------------------ Add flow ------------------------------ */

.add-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}
.add-stage {
  min-height: 598px;
  padding: 22px;
  display: grid; place-items: center;
  background:
    linear-gradient(135deg, oklch(96% 0.022 76), oklch(99% 0.008 70));
}
.modal {
  width: min(520px, 100%);
  padding: 20px;
  border-radius: 24px;
  background: oklch(100% 0 0 / 0.84);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 14px; font-size: 30px; line-height: 1; }
.field { display: grid; gap: 7px; margin-top: 12px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0 13px;
  color: var(--fg);
  background: white;
  outline: none;
}
.input:focus { border-color: oklch(74% 0.06 35); }
textarea.input { min-height: 84px; padding-top: 12px; resize: none; }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: oklch(95% 0.015 70);
}
.segmented button {
  min-height: 34px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.segmented button.active {
  color: var(--fg);
  background: white;
  box-shadow: 0 4px 13px oklch(42% 0.02 50 / 0.08);
}

.choice-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.choice {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 12px;
  background: white;
  color: var(--fg);
  cursor: pointer;
  transition: background 160ms ease, border 160ms ease;
  white-space: nowrap;
}
.choice:hover { background: oklch(98% 0.012 70); }
.choice.selected {
  border-color: oklch(74% 0.06 35);
  background: oklch(94% 0.03 42);
}

/* ------------------------------ Review ------------------------------ */

.review-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}
.review-summary { padding: 20px; position: sticky; top: 0; }
.review-summary h3 { font-size: 28px; line-height: 1; }
.review-summary p { color: var(--muted); line-height: 1.45; }

.soft-meter {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.meter-card {
  padding: 12px;
  border-radius: 15px;
  background: oklch(96% 0.015 70);
  border: 1px solid var(--border);
}
.meter-card b {
  display: block;
  font-family: var(--font-display);
  font-size: 26px; line-height: 1;
  margin-bottom: 4px;
}
.meter-card span { color: var(--muted); font-size: 11px; }

.review-list { display: grid; gap: 13px; }
.review-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: oklch(100% 0 0 / 0.72);
}
.review-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.review-card-head p { margin-top: 4px; }
.undo-button {
  min-height: 32px;
  padding: 0 11px;
  color: var(--muted);
}

.partial-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: oklch(96% 0.018 70);
  border: 1px solid var(--border);
}
.partial-box strong { font-family: var(--font-display); }

.slider-row {
  display: grid;
  grid-template-columns: 42px 1fr 56px;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.slider-wrap {
  position: relative;
  display: grid;
  align-items: center;
}
.slider-fill {
  position: absolute;
  left: 0;
  width: var(--partial-pct);
  height: 8px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--sage) 68%, white);
  pointer-events: none;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--sage);
  position: relative;
  z-index: 1;
}

/* ------------------------------ Settings ------------------------------ */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.settings-main { padding: 20px; }
.calendar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-top: 1px solid var(--border);
}
.calendar-row:first-of-type { border-top: 0; }
.calendar-row h3 { margin: 0 0 4px; font-size: 15px; font-family: var(--font-body); font-weight: 600; }
.calendar-row p { margin: 0; color: var(--muted); font-size: 12px; }

.color-picker { display: flex; align-items: center; gap: 8px; }
.color-dot {
  width: 28px; height: 28px;
  border-radius: 10px;
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--border);
  display: inline-block;
  cursor: pointer;
}
.color-dot.selected { box-shadow: 0 0 0 2px var(--sage); }

.palette-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  font-size: 12px; color: var(--muted);
}
.toggle input { appearance: none; width: 32px; height: 18px; border-radius: 999px; background: oklch(88% 0.012 70); position: relative; cursor: pointer; transition: background 160ms ease; outline: none; }
.toggle input::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white; border-radius: 999px;
  transition: transform 160ms ease;
  box-shadow: 0 1px 3px oklch(0% 0 0 / 0.2);
}
.toggle input:checked { background: var(--sage); }
.toggle input:checked::after { transform: translateX(14px); }

/* ------------------------------ First-run / Connect ------------------------------ */

.connect-state {
  min-height: 598px;
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 18px;
  align-items: stretch;
}
.connect-hero {
  padding: 34px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, oklch(95% 0.03 76), oklch(99% 0.008 70));
}
.connect-hero h3 {
  font-size: 46px; line-height: 0.95; max-width: 10ch;
}
.connect-hero p {
  max-width: 48ch;
  color: var(--muted);
  line-height: 1.5;
  font-size: 16px;
}
.permission-card {
  padding: 18px;
  border-radius: 20px;
  background: oklch(100% 0 0 / 0.72);
  border: 1px solid var(--border);
}
.permission-list { display: grid; gap: 12px; margin-top: 16px; }
.permission { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; }
.permission .check { background: var(--sage); border-color: var(--sage); cursor: default; }
.permission .check::before {
  content: ""; width: 9px; height: 5px;
  border-left: 2px solid white; border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

.preview-stack {
  padding: 22px;
  display: grid; gap: 14px; align-content: center;
}
.floating-day {
  padding: 17px;
  border-radius: 22px;
  background: oklch(100% 0 0 / 0.72);
  border: 1px solid var(--border);
  box-shadow: var(--soft-shadow);
}
.floating-day h4 { margin: 0 0 12px; font-size: 14px; font-family: var(--font-body); font-weight: 600; }

.small-event {
  display: flex; align-items: center; gap: 10px;
  margin-top: 9px;
  color: var(--muted); font-size: 12px;
}
.small-event .swatch { width: 9px; height: 26px; border-radius: 999px; }

/* ------------------------------ Toast ------------------------------ */

.toast {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translate(-50%, 30px);
  padding: 10px 18px;
  border-radius: 999px;
  background: oklch(22% 0.02 50);
  color: white;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 240ms ease, transform 240ms ease;
  pointer-events: none;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------ Task badges & time row ------------------------------ */

.task .task-time {
  margin: 5px 0 0;
  color: oklch(40% 0.06 35);
  font-size: 12px;
  font-weight: 700;
}

.task-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: oklch(91% 0.04 35);
  color: oklch(36% 0.06 35);
  font-size: 11px;
  font-weight: 600;
  text-transform: lowercase;
}

.task.maybe { background: oklch(99% 0.005 250 / 0.55); border-style: dashed; }
.task.maybe .task-badge { background: color-mix(in oklch, var(--lavender) 28%, white); color: oklch(38% 0.05 290); }

.calendar-row.selected { box-shadow: inset 4px 0 0 var(--sage); border-radius: 6px; }

.empty-cal-note { background: oklch(96% 0.018 70 / 0.7); }

.review-hint { margin-top: 14px; font-size: 12px; }
.review-hint.review-done { color: var(--sage); font-weight: 700; }

.time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.time-row .muted { color: var(--muted); font-size: 12px; }

.input.small {
  min-height: 36px;
  width: 80px;
  padding: 0 10px;
}

.input.time-input {
  min-width: 160px;
  width: 160px;
  padding: 0 10px;
}

.button.danger {
  color: oklch(48% 0.16 27);
  border-color: oklch(86% 0.06 27);
  background: oklch(98% 0.012 30);
}
.button.danger:hover { background: oklch(95% 0.04 30); }

.cursor-grab { cursor: grab; }

/* ------------------------------ Modal ------------------------------ */

.modal-root {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 200;
}
.modal-root.open { pointer-events: auto; }

.modal-overlay {
  position: absolute; inset: 0;
  background: oklch(28% 0.02 50 / 0.42);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn 140ms ease;
  -webkit-app-region: no-drag;
}

.modal-shell {
  width: min(560px, 100%);
  max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  border-radius: 22px;
  background: oklch(99% 0.008 70);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 10px;
  gap: 14px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  margin: 0;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: 999px;
  border: 0;
  background: oklch(95% 0.012 70);
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.modal-close:hover { background: oklch(91% 0.018 70); color: var(--fg); }

.modal-content {
  padding: 6px 20px 20px;
  overflow-y: auto;
}

.modal-body { display: grid; gap: 12px; }
.modal-body .field { margin-top: 6px; }
.modal-body .field:first-child { margin-top: 0; }
.modal-body .input { background: white; }

.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.modal-lead {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.event-detail h2 {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.05;
  margin: 0 0 6px;
}
.event-detail .muted { color: var(--muted); margin: 4px 0 0; }
.event-detail p { margin: 6px 0 0; line-height: 1.5; }

[data-clickable="task"], [data-clickable="event"] { cursor: pointer; }
[data-clickable="task"]:hover { box-shadow: 0 10px 22px oklch(42% 0.03 50 / 0.10); }

/* ------------------------------ Responsive ------------------------------ */

@media (max-width: 760px) {
  .desktop { grid-template-columns: 1fr; }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 12px 14px;
    gap: 12px;
  }
  .brand { padding: 0; }
  .nav { display: flex; gap: 7px; flex: 1 1 auto; }
  .tab { min-width: 110px; }
  .sidebar-footer { display: none; }

  .schedule-grid, .list-shell, .add-layout, .review-layout, .settings-grid, .connect-state, .split-preview {
    grid-template-columns: 1fr;
  }
  .task-panel { order: -1; }
  .review-summary { position: static; }
}
