:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef3f4;
  --ink: #202124;
  --muted: #66707a;
  --line: #d9e0e7;
  --line-strong: #bcc8d3;
  --accent: #1f6f62;
  --accent-strong: #15584e;
  --danger: #b43b42;
  --milestone: #34383d;
  --control-bg: #fbfcfd;
  --control-bg-hover: #f3f7f8;
  --control-border: #c5d0da;
  --control-radius: 4px;
  --button-radius: 4px;
  --focus-ring: 0 0 0 3px rgba(31, 111, 98, 0.16);
  --shadow: 0 18px 45px rgba(32, 33, 36, 0.16);
  --sidebar-width: 360px;
  --topbar-height: 68px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

.app {
  display: grid;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.title-block {
  display: flex;
  align-items: baseline;
  flex: 1 1 260px;
  gap: 12px;
  min-width: 0;
}

.timeline-name {
  width: min(34vw, 520px);
  min-width: 180px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 720;
  letter-spacing: 0;
  outline: 0;
  padding: 8px 7px;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.timeline-name:hover {
  background: var(--control-bg-hover);
}

.timeline-name:focus {
  border-bottom-color: transparent;
  background: #ffffff;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.save-status {
  min-width: 74px;
  color: var(--muted);
  font-size: 0.84rem;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 2px;
  min-width: max-content;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: #e9eef2;
  padding: 2px;
}

.view-tab {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 0 16px;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
  white-space: nowrap;
}

.view-tab:hover {
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
}

.view-tab.active {
  background: #ffffff;
  border-color: rgba(102, 112, 122, 0.18);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(32, 33, 36, 0.08);
}

.view-tab:focus {
  outline: 0;
  box-shadow: var(--focus-ring);
}

.top-actions {
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.top-actions > button {
  min-width: 0;
}

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.editor-panel {
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.panel-section {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.panel-section h2 {
  margin: 0 0 14px;
  font-size: 0.86rem;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
}

.event-form,
.chart-entry-form,
.panel-section label {
  display: grid;
  gap: 7px;
}

.event-form {
  gap: 14px;
}

label span,
.color-field legend {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: var(--control-bg);
  color: var(--ink);
  outline: 0;
  padding: 10px 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

input:hover,
select:hover,
textarea:hover {
  background: var(--control-bg-hover);
}

input:disabled,
select:disabled,
textarea:disabled {
  border-color: var(--line);
  background: #eef3f4;
  color: var(--muted);
  cursor: not-allowed;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: var(--focus-ring);
}

input[type="range"] {
  border: 0;
  background: transparent;
  box-shadow: none;
}

input[type="range"]:hover,
input[type="range"]:focus {
  background: transparent;
  box-shadow: none;
}

input[type="color"] {
  background: var(--control-bg);
  overflow: hidden;
}

input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
  box-shadow: none;
}

input[type="checkbox"]:focus {
  box-shadow: var(--focus-ring);
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  align-self: end;
  min-height: 38px;
  gap: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 760;
}

.checkbox-field span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.color-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.color-field legend {
  margin-bottom: 9px;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(6, 32px);
  gap: 8px;
}

.category-form {
  display: grid;
  gap: 12px;
}

.category-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.category-group {
  display: grid;
  gap: 7px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.category-group:last-of-type {
  border-bottom: 0;
}

.category-subcategory-list,
.subcategory-list {
  display: grid;
  gap: 7px;
}

.category-list-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 42px auto;
  align-items: center;
  gap: 8px;
}

.category-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--category-color);
}

.category-name-input {
  min-width: 0;
  padding: 8px 9px;
}

.category-color-input {
  width: 42px;
  min-width: 42px;
  height: 34px;
  padding: 3px;
}

.subcategory-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-left: 28px;
}

.subcategory-category-select,
.subcategory-name-input {
  min-width: 0;
  padding: 8px 9px;
}

.add-list-button {
  min-height: 34px;
  width: 100%;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 860;
}

.category-subcategory-list .add-list-button {
  margin-left: 28px;
  width: calc(100% - 28px);
}

.swatch {
  width: 32px;
  height: 32px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}

.swatch.active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 2px #ffffff, 0 0 0 3px rgba(32, 33, 36, 0.1);
}

.form-message {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.primary-button,
.ghost-button,
.danger-button,
.tool-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--button-radius);
  padding: 0 13px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
  box-shadow: 0 1px 1px rgba(32, 33, 36, 0.08);
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease, transform 150ms ease;
}

.primary-button,
.ghost-button,
.danger-button,
.tool-button {
  overflow-wrap: anywhere;
  white-space: normal;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 3px 8px rgba(21, 88, 78, 0.22);
  transform: translateY(-1px);
}

.ghost-button,
.tool-button {
  background: var(--control-bg);
  border-color: var(--control-border);
  color: var(--ink);
}

.ghost-button:hover,
.tool-button:hover,
.icon-button:hover {
  border-color: var(--accent);
  background: #eef6f4;
  box-shadow: 0 3px 8px rgba(32, 33, 36, 0.08);
  transform: translateY(-1px);
}

.danger-button {
  background: var(--control-bg);
  border-color: rgba(180, 59, 66, 0.38);
  color: var(--danger);
}

.danger-button:hover {
  background: #fff2f3;
  border-color: rgba(180, 59, 66, 0.62);
  box-shadow: 0 3px 8px rgba(180, 59, 66, 0.12);
  transform: translateY(-1px);
}

.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  background: var(--control-bg);
  border-color: var(--control-border);
  color: var(--ink);
}

.primary-button:active,
.ghost-button:active,
.danger-button:active,
.tool-button:active,
.icon-button:active {
  box-shadow: 0 1px 1px rgba(32, 33, 36, 0.08);
  transform: translateY(0);
}

.wide {
  width: 100%;
}

.slim {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.85rem;
}

.grow {
  flex: 1;
}

.hidden {
  display: none !important;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.zoom-range {
  padding: 0;
  accent-color: var(--accent);
}

.count-pill {
  min-width: 28px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--control-bg);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 8px;
  text-align: center;
}

.event-list {
  display: grid;
  gap: 9px;
}

.event-list-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.event-list-item:last-child {
  border-bottom: 0;
}

.event-list-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--event-color);
}

.event-list-title {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-list-date {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.event-list-actions {
  display: flex;
  gap: 6px;
}

.event-list-actions button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.timeline-shell,
.gantt-shell,
.my-tasks-shell {
  display: grid;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(90deg, rgba(31, 111, 98, 0.08), rgba(196, 77, 86, 0.06)),
    var(--bg);
}

.timeline-shell,
.gantt-shell {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.gantt-shell {
  background:
    linear-gradient(90deg, rgba(47, 128, 237, 0.07), rgba(31, 111, 98, 0.06)),
    var(--bg);
}

.my-tasks-shell {
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--bg);
}

.timeline-toolbar,
.gantt-toolbar,
.my-tasks-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.my-tasks-person-field {
  display: grid;
  grid-template-columns: auto minmax(160px, 220px);
  align-items: center;
  gap: 10px;
}

.my-tasks-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 720;
}

.my-tasks-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.my-tasks-list {
  display: grid;
  gap: 10px;
  max-width: 920px;
}

.my-task-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(220px, 1.2fr) minmax(190px, auto);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--task-color);
  border-radius: var(--control-radius);
  background: var(--surface);
  cursor: pointer;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(32, 33, 36, 0.06);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.my-task-card:hover {
  border-color: var(--control-border);
  box-shadow: 0 6px 16px rgba(32, 33, 36, 0.09);
  transform: translateY(-1px);
}

.my-task-card:focus {
  outline: 0;
  box-shadow: var(--focus-ring), 0 6px 16px rgba(32, 33, 36, 0.09);
}

.my-task-title {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
  font-size: 0.98rem;
  font-weight: 840;
  overflow-wrap: anywhere;
}

.my-task-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.my-task-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-task-details {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.my-task-pill,
.my-task-progress-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 3px;
  background: var(--task-color);
  color: #ffffff;
  padding: 0 9px;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.my-task-pill.muted {
  background: var(--control-bg-hover);
  color: var(--muted);
}

.my-task-pill.milestone {
  background: var(--milestone);
}

.my-task-progress-label {
  background: var(--accent);
}

.my-task-progress-track {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 3px;
  background: #dfe7eb;
}

.my-task-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.chart-entry-form {
  display: grid;
  align-items: end;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.timeline-entry-form {
  grid-template-columns: minmax(150px, 1.15fr) minmax(120px, 0.8fr) minmax(136px, 0.88fr) minmax(220px, 1fr) minmax(204px, auto) auto;
}

.gantt-task-form {
  grid-template-columns: minmax(140px, 1.2fr) minmax(116px, 0.8fr) minmax(128px, 0.85fr) minmax(108px, 0.72fr) minmax(112px, 0.78fr) minmax(94px, 0.55fr) minmax(204px, 0.95fr) auto;
}

.chart-entry-form .form-message {
  grid-column: 1 / -1;
  margin: -2px 0 0;
}

.color-field.inline {
  align-self: end;
  min-width: 204px;
}

.color-field.inline legend {
  margin-bottom: 7px;
}

.color-field.inline .color-swatches {
  grid-template-columns: repeat(6, 28px);
  gap: 6px;
}

.color-field.inline .swatch {
  width: 28px;
  height: 28px;
}

.form-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.form-actions .primary-button,
.form-actions .ghost-button {
  min-width: 104px;
}

.field-row.compact {
  grid-template-columns: repeat(2, minmax(104px, 1fr));
  gap: 8px;
}

.range-label {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 760;
}

.empty-hint {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.timeline-zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 190px;
}

.zoom-range.compact {
  width: 112px;
}

.timeline-viewport,
.gantt-viewport {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  outline: 0;
  overscroll-behavior: contain;
}

.timeline-viewport {
  --timeline-label-offset: 0px;
}

.gantt-viewport {
  --gantt-label-offset: 0px;
}

.timeline-viewport.is-dragging,
.gantt-viewport.is-dragging {
  cursor: grabbing;
}

.timeline-viewport:focus,
.gantt-viewport:focus {
  box-shadow: inset 0 0 0 3px rgba(31, 111, 98, 0.16);
}

.timeline-canvas,
.gantt-canvas {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.lane-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.lane-band {
  position: absolute;
  left: 0;
  border-top: 1px solid rgba(102, 112, 122, 0.14);
}

.lane-band::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: rgba(102, 112, 122, 0.14);
}

.lane-label,
.lane-label-cover {
  position: absolute;
  left: 0;
  width: 176px;
  border-right: 1px solid rgba(102, 112, 122, 0.2);
  z-index: 8;
  pointer-events: auto;
  transform: translate3d(var(--timeline-label-offset), 0, 0);
  will-change: transform;
}

.lane-label-cover {
  top: 0;
  background: #f6f7f9;
}

.lane-label-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 176px;
  height: 100%;
  padding: 0 14px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.lane-label-dot {
  width: 12px;
  min-width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--category-color);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.lane-label-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.axis-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.axis-line {
  position: absolute;
  top: 88px;
  left: 0;
  height: 1px;
  background: var(--line-strong);
}

.month-block {
  position: absolute;
  top: 16px;
  height: 30px;
  border-left: 1px solid rgba(102, 112, 122, 0.32);
}

.month-label {
  position: absolute;
  inset: 0 4px 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tick {
  position: absolute;
  top: 50px;
  width: 1px;
  height: calc(100% - 88px);
  background: rgba(102, 112, 122, 0.18);
}

.tick.major {
  background: rgba(102, 112, 122, 0.28);
}

.tick-label {
  position: absolute;
  top: 8px;
  transform: translateX(-50%) rotate(-58deg);
  transform-origin: center top;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 720;
  white-space: nowrap;
}

.week-tick.major .tick-label {
  color: var(--ink);
  font-weight: 820;
}

.today-marker {
  position: absolute;
  top: 48px;
  z-index: 2;
  width: 2px;
  height: calc(100% - 76px);
  background: #c44d56;
}

.today-marker span {
  position: absolute;
  top: -5px;
  left: 8px;
  color: #96343d;
  font-size: 0.76rem;
  font-weight: 800;
}

.event-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

body:not(.embed) .event-layer {
  cursor: crosshair;
}

.timeline-event {
  position: absolute;
  z-index: 4;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: stretch;
  min-height: 54px;
  border: 1px solid rgba(32, 33, 36, 0.12);
  border-radius: var(--control-radius);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 6px 14px rgba(32, 33, 36, 0.1);
  overflow: hidden;
  text-align: left;
  user-select: none;
}

.timeline-event.event-development-cycle {
  z-index: 2;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--event-color);
  color: #ffffff;
  box-shadow: none;
}

.timeline-event.event-lead-time {
  z-index: 5;
  border-color: rgba(163, 92, 0, 0.58);
  border-style: dashed;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(240, 166, 41, 0.2) 0,
      rgba(240, 166, 41, 0.2) 7px,
      rgba(255, 255, 255, 0.35) 7px,
      rgba(255, 255, 255, 0.35) 14px
    ),
    #fff3d7;
  color: #4d3205;
}

.timeline-event.event-tasks {
  z-index: 6;
}

body:not(.embed) .timeline-event {
  cursor: grab;
  touch-action: none;
}

.timeline-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(32, 33, 36, 0.14);
}

.timeline-event:focus {
  outline: 0;
  box-shadow: var(--focus-ring), 0 10px 22px rgba(32, 33, 36, 0.14);
  outline-offset: 2px;
}

.timeline-event.dragging {
  z-index: 12;
  cursor: grabbing;
  opacity: 0.94;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(32, 33, 36, 0.2);
}

.timeline-event.event-development-cycle:hover,
.timeline-event.event-development-cycle.dragging {
  transform: none;
  box-shadow: none;
}

.resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 18px;
  cursor: ew-resize;
}

.resize-handle::after {
  content: "";
  position: absolute;
  top: 13px;
  bottom: 13px;
  width: 3px;
  border-radius: 999px;
  background: rgba(32, 33, 36, 0.18);
  opacity: 0;
  transition: opacity 140ms ease, background 140ms ease;
}

.resize-left {
  left: 0;
}

.resize-left::after {
  left: 5px;
}

.resize-right {
  right: 0;
}

.resize-right::after {
  right: 5px;
}

.timeline-event:hover .resize-handle::after,
.timeline-event:focus .resize-handle::after,
.timeline-event.dragging .resize-handle::after {
  opacity: 1;
}

.resize-handle:hover::after {
  background: var(--accent);
}

.event-stripe {
  background: var(--event-color);
}

.event-development-cycle .event-stripe {
  display: none;
}

.event-lead-time .event-stripe {
  background: #f0a629;
}

.event-content {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 8px 10px;
}

.compact-event .event-content {
  padding: 8px 7px;
}

.tiny-event {
  grid-template-columns: 1fr;
}

.tiny-event .event-stripe {
  width: 100%;
}

.tiny-event .event-content,
.tiny-event .resize-handle {
  display: none;
}

.event-title {
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 820;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-date {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-development-cycle .event-content {
  padding: 0 12px;
}

.event-development-cycle .event-title {
  color: #ffffff;
}

.event-development-cycle .event-date {
  color: rgba(255, 255, 255, 0.84);
}

.event-development-cycle .resize-handle::after {
  background: rgba(255, 255, 255, 0.74);
}

.event-lead-time .event-date {
  color: #7b560d;
}

.compact-event .event-date {
  display: none;
}

.duration-event::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--event-color), transparent 86%);
  opacity: 0.08;
  pointer-events: none;
}

.event-development-cycle.duration-event::before {
  display: none;
}

.event-lead-time.duration-event::before {
  background: linear-gradient(90deg, #f0a629, transparent 86%);
  opacity: 0.16;
}

.gantt-grid-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gantt-task-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
}

body:not(.embed) .gantt-task-layer {
  cursor: crosshair;
}

.gantt-category-header,
.gantt-subcategory-header,
.gantt-row-band,
.gantt-bottom-pad {
  position: absolute;
  left: 0;
}

.gantt-category-header {
  border-top: 1px solid rgba(102, 112, 122, 0.16);
  border-bottom: 1px solid rgba(102, 112, 122, 0.16);
}

.gantt-subcategory-header {
  border-bottom: 1px solid rgba(102, 112, 122, 0.12);
  background: #fbfcfd;
}

.gantt-row-band {
  border-bottom: 1px solid rgba(102, 112, 122, 0.14);
  background: #ffffff;
}

.gantt-row-band:nth-of-type(odd) {
  background: rgba(246, 247, 249, 0.72);
}

.gantt-row-band.empty {
  background: repeating-linear-gradient(
    -45deg,
    rgba(102, 112, 122, 0.06) 0,
    rgba(102, 112, 122, 0.06) 8px,
    rgba(255, 255, 255, 0.5) 8px,
    rgba(255, 255, 255, 0.5) 16px
  );
}

.gantt-category-label,
.gantt-subcategory-label,
.gantt-row-label,
.gantt-label-cover {
  position: absolute;
  left: 0;
  width: 300px;
  border-right: 1px solid rgba(102, 112, 122, 0.22);
  z-index: 8;
  pointer-events: auto;
  transform: translate3d(var(--gantt-label-offset), 0, 0);
  will-change: transform;
}

.gantt-label-cover {
  top: 0;
  background: #f6f7f9;
}

.gantt-category-label-inner,
.gantt-subcategory-label-inner,
.gantt-row-label-inner {
  width: 300px;
  height: 100%;
  background: #ffffff;
}

.gantt-category-label-inner {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: #f6f7f9;
}

.gantt-subcategory-label-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 34px;
  background: #ffffff;
}

.gantt-category-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-subcategory-name {
  overflow: hidden;
  color: #3c444b;
  font-size: 0.8rem;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-category-count {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.gantt-row-label-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 14px;
}

.gantt-row-label.empty .gantt-row-label-inner {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.gantt-row-title {
  display: grid;
  min-width: 0;
  border: 0;
  border-radius: 3px;
  background: var(--task-progress-bg, #ffffff);
  color: var(--task-progress-text, var(--ink));
  padding: 5px 7px;
  text-align: left;
}

.gantt-row-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.gantt-row-task-code {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 18px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(102, 112, 122, 0.24);
  color: inherit;
  font-size: 0.68rem;
  font-weight: 880;
  line-height: 1;
  padding: 0 5px;
}

.gantt-row-task-code.milestone {
  background: var(--milestone);
  box-shadow: none;
  color: #ffffff;
}

.gantt-row-title-text {
  min-width: 0;
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-row-title-meta {
  overflow: hidden;
  margin-top: 2px;
  color: var(--task-progress-meta, var(--muted));
  font-size: 0.74rem;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-row-title-input {
  min-width: 0;
  width: 100%;
  height: 42px;
  border-radius: var(--control-radius);
  padding: 5px 7px;
  font-size: 0.88rem;
  font-weight: 820;
}

.gantt-row-actions {
  display: flex;
  gap: 5px;
}

.gantt-row-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.72rem;
}

.gantt-task-bar {
  position: absolute;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 1px;
  border: 1px solid rgba(32, 33, 36, 0.12);
  border-radius: var(--control-radius);
  background: var(--task-color);
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(32, 33, 36, 0.15);
  overflow: hidden;
  padding: 0 22px;
  text-align: left;
  user-select: none;
}

body:not(.embed) .gantt-task-bar {
  cursor: grab;
  touch-action: none;
}

.gantt-task-bar:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(32, 33, 36, 0.19);
}

.gantt-task-bar:focus {
  outline: 0;
  box-shadow: var(--focus-ring), 0 9px 20px rgba(32, 33, 36, 0.19);
  outline-offset: 2px;
}

.gantt-task-bar.dragging {
  z-index: 12;
  cursor: grabbing;
  opacity: 0.94;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(32, 33, 36, 0.22);
}

.gantt-task-bar.milestone {
  grid-template-columns: 1fr;
  border-color: rgba(32, 33, 36, 0.18);
  border-radius: var(--control-radius);
  background: var(--milestone);
  box-shadow: 0 5px 14px rgba(32, 33, 36, 0.16);
  overflow: hidden;
  padding: 0;
}

.gantt-task-bar.milestone:hover,
.gantt-task-bar.milestone:focus,
.gantt-task-bar.milestone.dragging {
  box-shadow: var(--focus-ring), 0 8px 18px rgba(32, 33, 36, 0.2);
}

.gantt-task-bar.milestone .gantt-task-title,
.gantt-task-bar.milestone .gantt-task-assignee {
  display: none;
}

.gantt-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 6;
  width: 18px;
  cursor: ew-resize;
}

.gantt-resize-handle::after {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  opacity: 0;
  transition: opacity 140ms ease, background 140ms ease;
}

.gantt-resize-left {
  left: 0;
}

.gantt-resize-left::after {
  left: 5px;
}

.gantt-resize-right {
  right: 0;
}

.gantt-resize-right::after {
  right: 5px;
}

.gantt-task-bar:hover .gantt-resize-handle::after,
.gantt-task-bar:focus .gantt-resize-handle::after,
.gantt-task-bar.dragging .gantt-resize-handle::after {
  opacity: 1;
}

.gantt-resize-handle:hover::after {
  background: #ffffff;
}

.gantt-task-title,
.gantt-task-assignee {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-task-title {
  font-size: 0.82rem;
  font-weight: 850;
}

.gantt-task-assignee {
  max-width: 110px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  font-weight: 760;
}

.gantt-task-bar.compact {
  grid-template-columns: minmax(0, 1fr);
  padding: 0 22px;
}

.gantt-task-bar.compact .gantt-task-assignee,
.gantt-task-bar.tiny .gantt-task-title,
.gantt-task-bar.tiny .gantt-task-assignee {
  display: none;
}

.detail-assignee {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 760;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
  background: rgba(32, 33, 36, 0.34);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.detail-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 50vw;
  min-width: 0;
  max-width: none;
  height: 100vh;
  overflow: hidden;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.modal-backdrop.open .detail-page {
  transform: translateX(0);
}

@media (max-width: 760px) {
  .detail-page {
    width: 100vw;
    border-radius: 0;
  }
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  margin: 8px 0 5px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.detail-color {
  display: inline-block;
  width: 38px;
  height: 6px;
  border-radius: 2px;
  background: var(--event-color);
}

.detail-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.detail-units {
  overflow: auto;
  padding: 22px 24px;
}

.detail-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.unit-card {
  display: grid;
  gap: 12px;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--line);
}

.unit-card:first-child {
  padding-top: 0;
}

.unit-card:last-child {
  border-bottom: 0;
}

.unit-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.unit-title {
  min-width: 0;
  margin: 0;
  color: #34383d;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  cursor: text;
}

.unit-title:focus {
  outline: 0;
  box-shadow: var(--focus-ring);
  outline-offset: 3px;
}

.unit-title-input {
  min-width: 0;
  padding: 8px 9px;
  font-weight: 760;
}

.unit-description-view {
  min-height: 124px;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: var(--control-bg);
  color: var(--ink);
  cursor: text;
  line-height: 1.55;
  overflow-wrap: anywhere;
  padding: 10px 11px;
}

.unit-description-view:focus {
  outline: 0;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: var(--focus-ring);
}

.unit-description-view p {
  margin: 0 0 8px;
}

.unit-description-view p:last-child,
.unit-description-view ul:last-child {
  margin-bottom: 0;
}

.unit-description-view ul {
  margin: 0 0 8px;
  padding-left: 21px;
}

.unit-description-view .unit-description-hollow-list {
  list-style-type: circle;
  padding-left: 38px;
}

.unit-description-view li {
  margin: 2px 0;
}

.unit-description-placeholder {
  color: var(--muted);
}

.unit-description-spacer {
  height: 9px;
}

.unit-description {
  min-height: 124px;
  overflow: hidden;
  resize: none;
  line-height: 1.55;
}

.gantt-detail-card {
  display: grid;
  gap: 12px;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--line);
}

.gantt-detail-card + .gantt-detail-card {
  padding-top: 22px;
}

.gantt-detail-card:last-child {
  border-bottom: 0;
}

.gantt-detail-heading {
  margin: 0;
  color: #34383d;
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.25;
}

.gantt-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gantt-detail-field {
  display: grid;
  gap: 7px;
}

.gantt-detail-field:first-child {
  grid-column: 1 / -1;
}

.gantt-detail-checkbox {
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
}

.gantt-task-description-view {
  min-height: 174px;
}

.gantt-progress-control {
  display: grid;
  gap: 14px;
}

.gantt-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gantt-progress-value {
  color: var(--accent-strong);
  font-size: 1.15rem;
  font-weight: 880;
}

.gantt-progress-range {
  width: 100%;
  padding: 0;
  accent-color: var(--accent);
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 24px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body.editor-collapsed {
  --sidebar-width: 0px;
}

body.editor-collapsed .editor-panel {
  display: none;
}

body.embed {
  background: var(--bg);
}

body.embed .app {
  grid-template-rows: minmax(0, 1fr);
}

body.embed .topbar,
body.embed .editor-panel {
  display: none;
}

body.embed .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.embed .timeline-toolbar {
  min-height: 48px;
  padding: 10px 14px;
}

body.embed .timeline-shell {
  height: 100vh;
}

@media (max-width: 1180px) {
  :root {
    --topbar-height: auto;
  }

  .app {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .topbar {
    align-items: center;
    flex-wrap: wrap;
    row-gap: 10px;
    padding-block: 10px;
  }

  .title-block {
    flex: 1 1 360px;
  }

  .timeline-name {
    width: min(100%, 520px);
  }

  .view-tabs {
    display: grid;
    align-items: stretch;
    flex: 1 0 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    order: 3;
    width: 100%;
    min-width: 0;
  }

  .view-tab {
    min-width: 0;
    width: 100%;
    min-height: 38px;
    line-height: 1.15;
    white-space: normal;
  }

  .top-actions {
    flex: 0 1 auto;
  }

  .gantt-task-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .gantt-task-form .field-row.compact {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  :root {
    --topbar-height: auto;
  }

  .app {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .title-block,
  .view-tabs,
  .top-actions {
    width: 100%;
  }

  .view-tabs {
    justify-content: stretch;
    order: 0;
  }

  .view-tab {
    flex: 1;
  }

  .timeline-name {
    width: 100%;
    min-width: 0;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .editor-panel {
    max-height: 52vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chart-entry-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-entry-form .primary-button,
  .chart-entry-form .ghost-button {
    width: 100%;
  }

  .form-actions {
    align-items: stretch;
  }

  body.editor-collapsed .workspace {
    grid-template-rows: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .panel-section {
    padding: 16px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .color-swatches {
    grid-template-columns: repeat(6, minmax(26px, 1fr));
  }

  .swatch {
    width: 30px;
    height: 30px;
  }

  .top-actions {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    grid-template-columns: 1fr;
  }

  .top-actions > button {
    width: 100%;
  }

  .timeline-name {
    max-width: calc(100vw - 24px);
  }

  .timeline-toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 12px;
  }

  .gantt-toolbar,
  .my-tasks-toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 12px;
  }

  .my-tasks-person-field {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .my-tasks-content {
    padding: 12px;
  }

  .my-task-card {
    grid-template-columns: 1fr;
  }

  .my-task-details {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .timeline-zoom-controls {
    width: 100%;
    min-width: 0;
  }

  .zoom-range.compact {
    flex: 1;
    width: auto;
  }

  .detail-header,
  .detail-units,
  .detail-actions {
    padding-left: 18px;
    padding-right: 18px;
  }

  .detail-page {
    width: 100vw;
    min-width: 0;
    max-width: none;
    border-radius: 0;
  }

  .chart-entry-form {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .gantt-task-form .field-row.compact {
    grid-column: auto;
  }

  .gantt-detail-grid {
    grid-template-columns: 1fr;
  }

  .field-row.compact {
    grid-template-columns: 1fr;
  }

  .view-tab {
    padding: 0 8px;
    white-space: normal;
  }
}
