:root {
  --bg: #0a0c11;
  --panel: #11151d;
  --panel-2: #151a24;
  --line: #1f2734;
  --line-soft: #19202b;
  --text: #e9eef7;
  --muted: #8792a6;
  --accent: #7c9cff;
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(124, 156, 255, 0.11), transparent 62%),
    radial-gradient(900px 520px at 105% -5%, rgba(224, 67, 95, 0.08), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(10, 12, 17, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 34px;
  height: 34px;
  padding: 8px 7px;
  border-radius: 10px;
  background: linear-gradient(160deg, #1b2230, #0e131b);
  border: 1px solid #2a3446;
  box-shadow: 0 0 0 1px rgba(124, 156, 255, 0.08), 0 8px 20px -12px rgba(124, 156, 255, 0.7);
}
.brand-mark i { display: block; height: 3px; border-radius: 2px; }
.brand-mark i:nth-child(1) { width: 100%; background: var(--accent); }
.brand-mark i:nth-child(2) { width: 62%; background: #e0435f; }
.brand-mark i:nth-child(3) { width: 82%; background: #d9a13c; }

.brand-text h1 {
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.brand-text p {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- buttons ---------- */

.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 14px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease, transform 0.08s ease;
}
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: linear-gradient(180deg, #8da8ff, #6b8cf8);
  color: #0a0e17;
  box-shadow: 0 10px 22px -12px rgba(124, 156, 255, 0.95);
}
.btn.primary:hover { filter: brightness(1.07); }

.btn.ghost {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}
.btn.ghost:hover { border-color: #33405a; background: #182030; }

.btn.small { padding: 7px 11px; font-size: 12px; }

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: #0c1017;
  border: 1px solid var(--line);
}

.seg {
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  padding: 6px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.seg:hover { color: var(--text); }
.seg.is-active {
  background: #1c2434;
  color: var(--text);
  box-shadow: inset 0 0 0 1px #2b374b;
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 384px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 24px 24px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -50px #000;
}

/* ---------- task panel ---------- */

.tasks-panel {
  padding: 18px 18px 8px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a3547 transparent;
  position: sticky;
  top: 82px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-head h2,
.list-head h2,
.timeline-head h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #b9c4d6;
}

.hint { font-size: 11.5px; color: var(--muted); }

.task-form { display: flex; flex-direction: column; gap: 12px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field > span {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: #0c1017;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #7b879c 50%), linear-gradient(135deg, #7b879c 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.field textarea { resize: vertical; min-height: 54px; line-height: 1.45; }
.field input::placeholder,
.field textarea::placeholder { color: #5b6678; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(124, 156, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.14);
}

.field input[type="date"] { font-variant-numeric: tabular-nums; }
.field input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

.eta-line {
  font-size: 11.5px;
  line-height: 1.45;
  color: #a7b8d8;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(124, 156, 255, 0.07);
  border: 1px solid rgba(124, 156, 255, 0.16);
}
.eta-line strong { color: #cfd9ee; font-weight: 650; }

.form-actions { display: flex; gap: 8px; margin-top: 2px; }
.form-actions .btn { flex: 1; }

.list-head {
  margin: 22px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.task-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; }

.task {
  position: relative;
  display: grid;
  grid-template-columns: 3px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 6px 10px 0;
  border-radius: 11px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #141a24, #11161f);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.task:hover { border-color: #2b3648; background: linear-gradient(180deg, #171e2a, #121821); }
.task.is-selected { border-color: rgba(124, 156, 255, 0.55); box-shadow: 0 0 0 1px rgba(124, 156, 255, 0.25); }

.task-bar { width: 3px; border-radius: 3px; }

.task-main { min-width: 0; }

.task-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.task-top h3 {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.task-desc {
  margin-top: 5px;
  font-size: 12px;
  color: #a9b4c6;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-actions { display: flex; align-items: flex-start; gap: 2px; padding-right: 4px; }

.icon-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #7a8699;
  font-size: 13px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: #1d2634; color: var(--text); border-color: var(--line); }

.pill {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  color: #9aa6bb;
}
.pill[data-status="doing"] { color: #93abff; background: rgba(124, 156, 255, 0.15); }
.pill[data-status="blocked"] { color: #ff8fa0; background: rgba(224, 67, 95, 0.15); }
.pill[data-status="done"] { color: #7fd8a5; background: rgba(111, 207, 151, 0.13); }

.empty {
  font-size: 12.5px;
  color: var(--muted);
  padding: 14px 4px 18px;
  line-height: 1.55;
}

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

.timeline-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 108px);
  min-height: 440px;
  overflow: hidden;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.tl-head-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.tl-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.timeline-scroll {
  flex: 1 1 auto;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a3547 transparent;
}
.timeline-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.timeline-scroll::-webkit-scrollbar-thumb { background: #283345; border-radius: 8px; border: 2px solid var(--panel); }

.timeline { position: relative; }

/* ---------- calendar header ---------- */

.cal-head {
  position: sticky;
  top: 0;
  z-index: 8;
  background: linear-gradient(180deg, #161c26, #121721);
  border-bottom: 1px solid var(--line);
}

.months {
  position: relative;
  height: 26px;
  border-bottom: 1px solid var(--line-soft);
}

.month-band {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--line);
  overflow: hidden;
}
.month-band span {
  display: block;
  padding: 5px 0 0 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #b9c4d6;
  white-space: nowrap;
}

.days { position: relative; height: 34px; }

.day-cell {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  color: #93a0b6;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
.day-cell.is-weekend { color: #5f6a7d; background: rgba(255, 255, 255, 0.02); }
.day-cell.is-today { color: #cfd9ff; }
.day-num { font-weight: 650; }
.day-dow {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7d899e;
}

/* ---------- lanes ---------- */

.lanes { position: relative; }

.grid { position: absolute; inset: 0; z-index: 0; pointer-events: none; }

.grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-soft);
}
.grid-line.is-month { background: #28313f; }

.grid-weekend {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.022);
}

.grid-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(124, 156, 255, 0.95), rgba(124, 156, 255, 0.2));
  box-shadow: 0 0 12px rgba(124, 156, 255, 0.45);
}

.lane-empty {
  position: absolute;
  left: 18px;
  top: 24px;
  font-size: 12.5px;
  color: #6c778a;
}

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

.block {
  position: absolute;
  top: 0;
  height: 48px;
  padding: 6px 9px;
  border-radius: 9px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 2;
  background: linear-gradient(180deg, var(--c-soft), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c);
  box-shadow: 0 8px 20px -18px #000;
  transition: left 0.12s ease, top 0.12s ease, width 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.block:hover { border-color: var(--c); }
.block.is-selected { box-shadow: 0 0 0 2px rgba(124, 156, 255, 0.5), 0 12px 26px -16px #000; }
.block.is-dragging {
  cursor: grabbing;
  z-index: 40;
  transition: box-shadow 0.15s ease;
  box-shadow: 0 22px 40px -18px #000, 0 0 0 1px var(--c);
}
.block.is-done { opacity: 0.5; }
.block.is-done .block-name { text-decoration: line-through; text-decoration-thickness: 1px; }

.block-we { position: absolute; inset: 0; pointer-events: none; }
.block-we i {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.38) 0 4px, rgba(0, 0, 0, 0.1) 4px 8px);
}

.block-body { position: relative; z-index: 2; display: block; min-width: 0; }

.block-name {
  display: block;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-meta {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.3;
  color: #b3bfd3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  z-index: 3;
  cursor: ew-resize;
}
.handle-l { left: 0; }
.handle-r { right: 0; }
.handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 16px;
  border-radius: 2px;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.45);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.block:hover .handle::after { opacity: 1; }
.block.is-tiny .handle { display: none; }

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

@media (max-width: 1020px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .tasks-panel { position: static; max-height: none; }
  .timeline-panel { height: 68vh; min-height: 380px; }
}

@media (max-width: 560px) {
  .topbar { padding: 12px 14px; flex-wrap: wrap; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1; }
  .layout { padding: 14px; }
  .brand-text p { display: none; }
  .tl-controls { width: 100%; }
  .segmented { flex: 1; }
  .seg { flex: 1; }
}
