:root {
  --task-col: 340px;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --accent: #2563eb;
  --accent-weak: #eff6ff;
  --green: #16a34a;
  --green-weak: #f0fdf4;
  --amber: #d97706;
  --amber-weak: #fffbeb;
  --red: #dc2626;
  --red-weak: #fef2f2;
  --slate: #64748b;
  --slate-weak: #f1f5f9;
  --teal: #0d9488;
  --row-h: 48px;
  --group-h: 42px;
  --header-h: 56px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

.icon {
  display: block;
  flex: none;
}

.app-bar {
  height: 58px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0;
}

.brand-text span {
  font-size: 12px;
  color: var(--text-2);
}

.project-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  min-width: 0;
}

.picker-icon {
  color: var(--text-3);
  display: grid;
  place-items: center;
  flex: none;
}

.project-select {
  min-width: 180px;
  max-width: 240px;
  font-weight: 600;
}

.btn-compact {
  padding: 0 10px;
  white-space: nowrap;
}

.app-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box > span {
  position: absolute;
  left: 10px;
  color: var(--text-3);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.search-box input {
  width: 190px;
  height: 34px;
  padding: 0 10px 0 34px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-2);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
  background: #fff;
}

.filter-select,
.zoom-level {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-2);
  outline: none;
}

.filter-select:focus,
.zoom-level:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  color: var(--text-2);
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.icon-btn.active {
  background: var(--accent-weak);
  color: var(--accent);
  border-color: rgba(37, 99, 235, .35);
}

.icon-btn:disabled {
  opacity: .38;
  cursor: default;
  pointer-events: none;
}

.icon-btn.mini {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.btn-primary,
.btn-secondary {
  height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
}

.action-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 2px;
}

.summary-strip {
  flex: none;
  height: 54px;
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.summary-item {
  min-width: 86px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  border-right: 1px solid var(--border);
}

.summary-item strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.summary-item span {
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.overdue-item strong {
  color: var(--red);
}

.open-item strong {
  color: var(--teal);
}

.summary-progress {
  min-width: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 18px;
  border-right: 1px solid var(--border);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-2);
}

.progress-meta strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  border-radius: 3px;
  background: var(--slate-weak);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #2563eb, #0d9488);
  transition: width .2s;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  margin-left: auto;
}

.zoom-level {
  width: 46px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
}

.board-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.board-scroll {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(90deg, #fff 0, #fff var(--task-col), transparent var(--task-col)),
    var(--bg);
}

.board-inner {
  width: 100%;
}

.board-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: var(--task-col) 1fr;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 1px 0 rgba(148, 163, 184, .2);
}

.header-task {
  position: sticky;
  left: 0;
  z-index: 21;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface);
  border-right: 1px solid var(--border-strong);
}

.header-count {
  color: var(--text-3);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.timeline-header {
  height: var(--header-h);
}

.month-row,
.day-row {
  display: grid;
  height: 28px;
}

.month-row {
  border-bottom: 1px solid var(--border);
}

.month-cell {
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  border-right: 1px solid var(--border);
  overflow: hidden;
  white-space: nowrap;
}

.day-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-2);
  border-right: 1px solid var(--border);
  user-select: none;
}

.day-cell.weekend {
  color: var(--text-3);
}

.day-cell.today {
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 700;
}

.day-cell .date-num {
  font-variant-numeric: tabular-nums;
}

.board-rows {
  position: relative;
}

.board-row {
  display: grid;
  grid-template-columns: var(--task-col) 1fr;
  height: var(--row-h);
}

.board-row.group-row {
  height: var(--group-h);
}

.task-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.board-row:hover .task-cell {
  background: #fbfdff;
}

.board-row.selected .task-cell {
  background: var(--accent-weak);
  box-shadow: inset 3px 0 0 var(--accent);
}

.board-row.group-row .task-cell {
  background: var(--slate-weak);
  font-weight: 700;
  cursor: default;
}

.group-toggle {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  border-radius: 5px;
}

.group-toggle:hover {
  background: rgba(100, 116, 139, .14);
}

.task-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

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

.task-priority {
  flex: none;
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.task-priority.high {
  color: var(--red);
}

.task-priority.medium {
  color: var(--amber);
}

.task-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 11px;
  color: var(--text-2);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.status-dot.doing {
  background: var(--accent);
}

.status-dot.todo {
  background: var(--slate);
}

.status-dot.review {
  background: var(--amber);
}

.status-dot.done {
  background: var(--green);
}

.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.assignee-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--teal);
  flex: none;
}

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

.group-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

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

.group-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  background: rgba(100, 116, 139, .14);
  padding: 1px 7px;
  border-radius: 10px;
  flex: none;
}

.group-add {
  width: 24px;
  height: 24px;
  margin-left: auto;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-2);
  opacity: .55;
  transition: background .15s, color .15s, opacity .15s;
}

.group-add:hover {
  background: var(--accent-weak);
  color: var(--accent);
  opacity: 1;
}

.group-row:hover .group-add {
  opacity: 1;
}

.gantt-cell {
  position: relative;
  display: grid;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.day-bg {
  border-right: 1px solid var(--border);
  background: transparent;
}

.day-bg.weekend {
  background: #f8fafc;
}

.day-bg.today {
  background: var(--accent-weak);
}

.group-row .gantt-cell {
  background: #eef1f5;
}

.group-row .day-bg.weekend {
  background: #e9edf2;
}

.phase-band {
  position: absolute;
  top: 13px;
  height: 16px;
  border-radius: 3px;
  background: rgba(37, 99, 235, .14);
  border: 1px solid rgba(37, 99, 235, .22);
  pointer-events: none;
}

.bar {
  isolation: isolate;
  position: absolute;
  top: 8px;
  height: 32px;
  border-radius: 6px;
  color: #fff;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .2);
  transition: box-shadow .15s;
}

.bar:hover {
  box-shadow: 0 3px 8px rgba(15, 23, 42, .28);
}

.bar.dragging {
  cursor: grabbing;
  box-shadow: 0 6px 14px rgba(15, 23, 42, .3);
  opacity: .9;
  z-index: 5;
}

.bar.open-ended::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: 0;
  width: 13px;
  border-radius: 0 6px 6px 0;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .6) 0 4px, transparent 4px 8px);
  pointer-events: none;
}

.bar-progress {
  z-index: 1;
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(255, 255, 255, .32);
  border-radius: 6px 0 0 6px;
  pointer-events: none;
}

.bar-label {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  text-shadow: 0 1px 1px rgba(15, 23, 42, .18);
}

.bar-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
  touch-action: none;
  z-index: 3;
}

.bar-handle.left {
  left: 0;
}

.bar-handle.right {
  right: 0;
}

.bar-handle::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, .7);
}

.bar.status-todo {
  background: var(--slate);
}

.bar.status-doing {
  background: var(--accent);
}

.bar.status-review {
  background: var(--amber);
}

.bar.status-done {
  background: var(--green);
}

.bar.milestone {
  background: transparent;
  overflow: visible;
  box-shadow: none;
  cursor: pointer;
  touch-action: auto;
}

.bar.milestone .milestone-diamond {
  position: absolute;
  top: 9px;
  left: -7px;
  width: 14px;
  height: 14px;
  background: var(--red);
  border: 2px solid #fff;
  border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
}

.bar.milestone .bar-label {
  position: absolute;
  left: 14px;
  top: -3px;
  height: 22px;
  padding: 0 8px;
  color: var(--red);
  text-shadow: none;
  font-weight: 700;
}

.deps-layer {
  position: absolute;
  top: 0;
  left: var(--task-col);
  pointer-events: none;
  z-index: 4;
}

.deps-layer path {
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.deps-layer .dep-arrow {
  fill: var(--text-3);
  stroke: none;
}

.drag-tip {
  position: fixed;
  z-index: 60;
  padding: 6px 10px;
  background: #1e293b;
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(12px, -50%);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .3);
}

.progress-tip {
  position: fixed;
  z-index: 65;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .32);
}

.progress-tip[hidden] {
  display: none;
}

.progress-tip .tip-date {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 5px;
}

.progress-tip .tip-entry {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 4px;
}

.progress-tip .tip-progress {
  flex: none;
  min-width: 34px;
  height: 18px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--accent);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-tip .tip-progress.high {
  background: var(--green);
}

.progress-tip .tip-progress.current {
  background: #475569;
}

.progress-tip .tip-text {
  min-width: 0;
  color: #f8fafc;
  word-break: break-word;
}

.progress-tip .tip-muted {
  color: #94a3b8;
}

.progress-tip .tip-latest {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.progress-tip .tip-footer {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, .28);
  font-size: 11px;
  color: #94a3b8;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(245, 247, 250, .92);
  z-index: 10;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
}

.empty-state strong {
  font-size: 16px;
}

.empty-state p {
  margin: 0 0 6px;
  color: var(--text-2);
}

.empty-actions {
  display: flex;
  gap: 8px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .28);
  z-index: 40;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 430px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: -12px 0 32px rgba(15, 23, 42, .12);
  z-index: 41;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform .22s ease;
}

.drawer[hidden] {
  display: flex;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
}

.drawer-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}

.title-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--surface-2);
  outline: none;
}

.title-input:hover {
  border-color: var(--border);
}

.title-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 20px;
}

.drawer-section {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 10px;
}

.field-row {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

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

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

.field > span {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  justify-content: space-between;
}

.field output {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.field input[type="text"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #fff;
  outline: none;
}

.field textarea {
  height: auto;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.field input[type="date"]:disabled {
  background: var(--slate-weak);
  color: var(--text-3);
}

.field input[type="range"] {
  width: 100%;
  height: 22px;
  accent-color: var(--accent);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.dep-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dep-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  background: var(--surface-2);
}

.dep-option:hover {
  border-color: var(--border-strong);
}

.dep-option input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  flex: none;
}

.dep-option .task-title {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
}

.dep-option .dep-date {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dep-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
}

.drawer-footer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.btn-danger {
  height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--red);
  border: 1px solid rgba(220, 38, 38, .35);
  background: var(--red-weak);
  font-weight: 600;
}

.btn-danger:hover {
  background: #fee2e2;
}

.drawer-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
}

.yanji-fields {
  display: grid;
  gap: 10px;
}

.yanji-field {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 8px;
}

.yanji-tag {
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.yanji-tag.t-time {
  background: var(--accent);
}

.yanji-tag.t-person {
  background: var(--teal);
}

.yanji-tag.t-place {
  background: #7c3aed;
}

.yanji-tag.t-money {
  background: #d97706;
}

.yanji-tag.t-event {
  background: #dc2626;
}

.yanji-tag.t-other {
  background: var(--slate);
}

.yanji-field input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-2);
  outline: none;
}

.yanji-field input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.source-block {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--slate-weak);
  border-radius: 7px;
}

.source-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 5px;
}

.source-text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-2);
  max-height: 90px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.update-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.update-suggest {
  padding: 7px 10px;
  border-radius: 7px;
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.update-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.update-actions .check-row {
  font-size: 12px;
}

.update-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.update-item {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
}

.update-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.update-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.update-progress-chip {
  height: 18px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.update-progress-chip.high {
  background: var(--green);
}

.update-delete {
  width: 24px;
  height: 24px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--text-3);
}

.update-delete:hover {
  background: var(--red-weak);
  color: var(--red);
}

.update-text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.update-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
}

.update-badge {
  flex: none;
  height: 18px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.yanji-badge {
  flex: none;
  height: 18px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  border-radius: 9px;
  background: var(--teal);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .34);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: 620px;
  max-width: 100%;
  max-height: min(720px, 92vh);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .24);
}

.modal-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.modal-title strong {
  font-size: 15px;
}

.modal-title span {
  font-size: 12px;
  color: var(--text-2);
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
}

.modal-footer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.record-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.record-status {
  font-size: 12px;
  color: var(--text-2);
}

.record-status.listening {
  color: var(--red);
  font-weight: 700;
}

.record-project-check {
  margin-bottom: 10px;
}

.modal-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  resize: vertical;
  line-height: 1.6;
  outline: none;
}

.modal-body textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.record-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.count-badge {
  height: 20px;
  min-width: 20px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--slate-weak);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.record-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.record-preview .preview-empty {
  width: 100%;
  padding: 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
}

.preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
}

.preview-chip .chip-type {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-2);
}

.preview-chip .chip-value {
  color: var(--text);
}

.preview-chip.todo-chip {
  border-color: rgba(37, 99, 235, .3);
  background: var(--accent-weak);
}

.preview-chip.todo-chip .chip-type {
  color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 70;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 8px;
  background: #1e293b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .28);
  animation: toast-in .2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.deadline-legend { display:flex; align-items:center; gap:8px; flex:none; min-height:34px; padding:5px 16px; border-bottom:1px solid var(--border); background:#fff; color:var(--text-2); font-size:11px; overflow-x:auto; white-space:nowrap; }
.delay-key,.delay-badge { display:inline-flex; align-items:center; border-radius:5px; padding:3px 6px; font-size:10px; font-weight:700; white-space:nowrap; }
.delay-key-1 { background:#fff1d6; color:#92400e; }
.delay-key-2 { background:#ffddd0; color:#9a3412; }
.delay-key-3 { background:#fee2e2; color:#991b1b; }
.bar-delay-segments { position:absolute; inset:0; z-index:0; overflow:hidden; border-radius:inherit; pointer-events:none; }
.bar-delay-segment { position:absolute; top:0; bottom:0; pointer-events:auto; border-left:1px solid #ffffff66; }
.extension-1 { background:#c4770b; }
.extension-2 { background:#c2410c; }
.extension-3 { background:#991b1b; }
.milestone-delay-trail { position:absolute; inset:0; z-index:0; pointer-events:none; }
.milestone-delay-segment { position:absolute; top:14px; height:4px; pointer-events:auto; border-left:1px solid #ffffff66; }
.milestone-plan-marker { position:absolute; top:11px; width:10px; height:10px; border:2px solid var(--red); background:#fff; transform:rotate(45deg); pointer-events:auto; }
.bar.milestone .milestone-diamond { z-index:1; }
.deadline-baseline,.deadline-empty { color:var(--text-2); line-height:1.7; font-size:12px; }
.deadline-entry { margin-top:9px; padding:11px; border-left:3px solid #c4770b; border-radius:5px; background:#fff8ed; font-size:12px; }
.deadline-entry strong { line-height:1.7; }
.deadline-entry p { margin:6px 0; white-space:pre-wrap; overflow-wrap:anywhere; }
.deadline-entry small { color:var(--text-2); }
.deadline-modal { position:fixed; inset:0; z-index:120; display:grid; place-items:center; background:#0f172a88; padding:20px; }
.deadline-modal[hidden] { display:none; }
.deadline-dialog { width:min(100%,510px); max-height:90dvh; overflow:auto; background:#fff; border-radius:14px; padding:24px; box-shadow:0 20px 60px #0f172a33; }
.deadline-dialog h2 { font-size:20px; margin:0 0 12px; }
.deadline-dialog>p { color:var(--text-2); line-height:1.7; }
.deadline-dialog label { display:block; font-weight:700; margin:18px 0 8px; }
.deadline-dialog textarea { width:100%; padding:11px; border:1px solid var(--border-strong); border-radius:8px; resize:vertical; font-size:16px; }
.deadline-dialog-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; margin-top:20px; }
.deadline-dialog-actions button { min-height:42px; }
.deadline-dialog-hint { font-size:12px; }

@media (max-width: 1180px) {
  .hide-md {
    display: none;
  }

  .search-box input {
    width: 150px;
  }
}

@media (max-width: 900px) {
  :root {
    --task-col: 280px;
  }

  .app-bar {
    height: 54px;
    padding: 0 10px;
    gap: 10px;
  }

  .project-picker {
    padding-left: 8px;
    gap: 4px;
  }

  .project-select {
    min-width: 120px;
    max-width: 160px;
  }

  .brand-text span,
  .hide-sm {
    display: none;
  }

  .search-box input {
    width: 120px;
  }

  .summary-item {
    min-width: 76px;
    padding: 0 10px;
  }

  .summary-progress {
    min-width: 160px;
    padding: 0 12px;
  }

  .drawer {
    width: 100%;
  }

  .modal {
    border-radius: 0;
  }

  .modal-backdrop {
    padding: 0;
  }
}

@media (max-width: 560px) {
  :root {
    --task-col: 220px;
  }

  .picker-icon {
    display: none;
  }

  .project-select {
    min-width: 104px;
    max-width: 140px;
  }

  .btn-compact {
    padding: 0 8px;
  }

  .search-box {
    display: none;
  }

  .hide-text-sm span {
    display: none;
  }

  .summary-item {
    min-width: 68px;
    padding: 0 8px;
  }

  .summary-item strong {
    font-size: 16px;
  }

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