﻿:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --line: #d7dde5;
  --text: #111827;
  --muted: #6b7280;
  --brand: #0f766e;
  --brand-2: #1f2937;
  --soft: #e8eef5;
  --warn: #f59e0b;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
button.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
button.ghost {
  background: transparent;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#app {
  min-height: 100%;
}

.shell {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  min-height: 100vh;
  padding: 8px;
}

.topbar {
  background: linear-gradient(90deg, var(--brand-2), #0f172a);
  color: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  display: grid;
  gap: 8px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.title-row h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.compact-toolbar {
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
}

.field {
  display: grid;
  gap: 4px;
}

.field label,
.mini-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
}

.field input,
.field select,
.field textarea {
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 7px 9px;
  background: rgba(255,255,255,0.96);
  color: var(--text);
}

.field input[readonly] {
  cursor: default;
  color: #334155;
}

.review-entry {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255,255,255,0.96);
  color: var(--text);
  text-align: left;
}

.review-entry:hover {
  background: #fff;
}

.review-shell {
  max-width: 1100px;
  margin: 0 auto;
}

.review-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--brand-2), #0f172a);
  color: #fff;
}

.review-topbar h1 {
  margin: 0;
  font-size: 22px;
}

.review-topbar .actions {
  margin-left: auto;
}

.review-panel {
  margin-top: 12px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  color: #1f2937;
  line-height: 1.7;
}

.review-panel p {
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.project-picker {
  position: relative;
  display: flex;
  align-items: stretch;
}

.project-picker > #projectName {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 42px;
}

.project-picker-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 38px;
  padding: 0;
  border: 0;
  border-left: 1px solid #d1d5db;
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: #111827;
}

.project-picker-toggle:hover {
  background: #f3f4f6;
}

.project-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.project-menu-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #111827;
  text-align: left;
}

.project-menu-select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px 0 0 5px;
  background: transparent;
  color: inherit;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-menu-delete {
  flex: 0 0 36px;
  width: 36px;
  height: 32px;
  padding: 7px 4px;
  border: 0;
  border-radius: 0 5px 5px 0;
  background: transparent;
  color: #dc2626;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.project-menu-delete:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.project-menu-option:hover,
.project-menu-option.selected {
  background: #eef2ff;
  color: #3730a3;
}

.project-menu-option:hover .project-menu-select,
.project-menu-option.selected .project-menu-select {
  color: #3730a3;
}

.project-menu-empty {
  padding: 8px 10px;
  color: #64748b;
  font-size: 12px;
}

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

.confirm-modal {
  width: min(360px, 100%);
  padding: 22px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
  text-align: center;
}

.confirm-modal h2 {
  margin: 0;
  color: #111827;
  font-size: 18px;
}

.confirm-modal p {
  margin: 12px 0 18px;
  color: #475569;
  font-size: 14px;
  word-break: break-all;
}

.confirm-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.confirm-modal-actions button {
  min-width: 72px;
}

.confirm-modal-actions button:first-child {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}

.confirm-modal-actions button:last-child {
  background: #fff;
  color: #334155;
}

.trash-modal {
  width: min(620px, 100%);
  max-height: min(620px, 86vh);
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
}

.trash-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.trash-modal-head h2 {
  margin: 0;
  color: #111827;
  font-size: 18px;
}

.trash-close {
  min-width: 34px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 22px;
  line-height: 1;
}

.trash-close:hover {
  background: #f1f5f9;
  color: #111827;
}

.trash-list {
  display: grid;
  gap: 8px;
  max-height: calc(min(620px, 86vh) - 78px);
  overflow-y: auto;
  padding-top: 12px;
}

.trash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.trash-item-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.trash-item-info strong {
  color: #1e293b;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trash-item-info span {
  color: #64748b;
  font-size: 11px;
}

.trash-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.trash-actions button {
  flex: 0 0 auto;
  padding: 5px 10px;
}

.trash-delete {
  border-color: #fecaca;
  color: #b91c1c;
}

.trash-delete:hover {
  background: #fee2e2;
}

.trash-empty {
  padding: 28px 10px;
  color: #64748b;
  text-align: center;
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 6px;
  align-items: end;
  justify-content: flex-end;
  margin-left: auto;
  white-space: nowrap;
}

.actions button {
  background: rgba(255,255,255,0.95);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 10px;
  box-shadow: var(--shadow);
  line-height: 1.15;
}

.kpi-interactive {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.kpi-interactive:hover {
  border-color: #94a3b8;
}

.kpi-interactive:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.kpi-interactive.active.completed {
  border-color: #16a34a;
  background: #f0fdf4;
}

.kpi-interactive.active.progress {
  border-color: #f97316;
  background: #fff7ed;
}

.kpi-interactive.active.due-soon {
  border-color: #ef4444;
  background: #fef2f2;
}

.kpi-interactive.active.overdue {
  border-color: #9333ea;
  background: #faf5ff;
}

.kpi .label {
  color: var(--muted);
  font-size: 11px;
}

.kpi .value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

.subline {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.main {
  display: block;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 10px 12px;
  background: #eef3f8;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head-main {
  display: grid;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.panel-head h2 {
  margin: 0;
  font-size: 14px;
}

.panel-head > .current-task-board {
  flex: 0 1 46%;
  max-width: 46%;
}

.reminder-board {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 6px 10px;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  background: linear-gradient(90deg, #fff1f2, #fff);
  min-width: 0;
}

.reminder-board.idle {
  border-color: #dbe2ea;
  background: #f8fafc;
}

.reminder-board-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: #b91c1c;
}

.reminder-board.idle .reminder-board-label {
  color: #64748b;
}

.reminder-track {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.reminder-empty {
  color: #64748b;
  font-size: 12px;
}

.current-task-board {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 6px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: linear-gradient(90deg, #eff6ff, #fff);
  min-width: 0;
}

.current-task-board.idle {
  border-color: #dbe2ea;
  background: #f8fafc;
}

.current-task-board-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
}

.current-task-board.active .current-task-board-label {
  color: #1d4ed8;
}

.current-task-board.idle .current-task-board-label {
  color: #64748b;
}

.current-task-track {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.current-task-empty {
  color: #64748b;
  font-size: 12px;
}

.current-task-chip {
  border: 1px solid #bfdbfe;
  background: #fff;
  color: #1e3a8a;
  border-radius: 10px;
  padding: 6px 10px;
  display: inline-grid;
  gap: 2px;
  min-width: 220px;
  max-width: 420px;
  text-align: left;
}

.current-task-section {
  color: #2563eb;
  font-size: 10px;
  font-weight: 700;
}

.current-task-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.current-task-meta {
  color: #64748b;
  font-size: 11px;
  line-height: 1.2;
}

.reminder-chip {
  border: 1px solid #fca5a5;
  background: #fff;
  color: #7f1d1d;
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-grid;
  gap: 2px;
  min-width: 180px;
  text-align: left;
}

.reminder-chip.animate {
  animation: reminderPulse 1s steps(2, end) 2;
}

.reminder-chip.start {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}

.reminder-chip.completion {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #92400e;
}

.reminder-chip.read {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
  animation: none;
}

.reminder-tag {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.8;
}

.reminder-text {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.reminder-meta {
  font-size: 11px;
  opacity: 0.85;
  line-height: 1.2;
}

@keyframes reminderPulse {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.35; }
}

.filters {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.filters input, .filters select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
}

.table-wrap {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  min-height: calc(100vh - 220px);
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

th, td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 6px 7px;
  vertical-align: middle;
  font-size: 12px;
}

th:last-child, td:last-child {
  border-right: 0;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #dbe7f3;
  color: #111827;
  text-align: center;
  font-weight: 700;
}

tbody tr.section-row td {
  background: #475569;
  color: #fff;
  font-weight: 700;
  text-align: center;
}

tbody tr.task-highlight-completed td {
  background: #dcfce7;
  color: #166534;
}

tbody tr.task-highlight-progress td {
  background: #ffedd5;
  color: #9a3412;
}

tbody tr.task-highlight-due-soon td {
  background: #fee2e2;
  color: #b91c1c;
}

tbody tr.task-highlight-overdue td {
  background: #f3e8ff;
  color: #7e22ce;
}

tbody tr[data-row-type="task"] {
  cursor: grab;
}

tbody tr[data-row-type="task"]:active {
  cursor: grabbing;
}

tbody tr[data-row-type="task"] input,
tbody tr[data-row-type="task"] select,
tbody tr[data-row-type="task"] textarea {
  cursor: auto;
  user-select: text;
}

tbody tr[data-row-type="task"] button {
  cursor: pointer;
  user-select: none;
}

tbody tr[data-row-type="task"] input[type="date"],
tbody tr[data-row-type="task"] input[type="number"],
tbody tr[data-row-type="task"] input[type="text"] {
  cursor: text;
}

tbody tr.task-dragging td {
  opacity: 0.45;
}

tbody tr.task-drop-before td {
  border-top: 3px solid #2563eb;
}

tbody tr.task-drop-after td {
  border-bottom: 3px solid #2563eb;
}

tbody tr.section-row .cell-input {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
}

tbody tr.section-row .cell-input:focus {
  background: rgba(255, 255, 255, 0.08);
}

tbody tr.hidden-row {
  display: none;
}

.cell-input, .cell-select {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 5px 4px;
  border-radius: 6px;
  font-size: 12px;
}

.cell-input[type="number"] {
  min-width: 54px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cell-input[type="date"] {
  width: 100%;
  min-width: 0;
  text-align: left;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
  padding-left: 8px;
  padding-right: 20px;
  font-size: 11px;
}

tbody tr[data-row-type="task"] td:nth-child(5) .cell-input[type="date"] {
  min-width: 126px;
}

.cell-input:focus, .cell-select:focus, textarea:focus {
  border-color: #94a3b8;
  background: #fff;
  outline: none;
}

.readonly {
  display: block;
  min-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.completion-status {
  display: block;
  min-height: 20px;
  padding: 4px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.completion-status.empty {
  color: #94a3b8;
}

.completion-status.early {
  color: #047857;
  background: #ecfdf5;
}

.completion-status.on-time {
  color: #1d4ed8;
  background: #eff6ff;
}

.completion-status.late {
  color: #b91c1c;
  background: #fef2f2;
}

.task-name-cell {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 3px 6px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}
.status.done { background: #dcfce7; color: #166534; }
.status.progress { background: #dbeafe; color: #1d4ed8; }
.status.due-soon { background: #fef3c7; color: #92400e; }
.status.overdue { background: #fee2e2; color: #991b1b; }
.status.ok { background: #ecfeff; color: #155e75; }

.mini {
  font-size: 12px;
  color: var(--muted);
}

.side {
  display: grid;
  gap: 14px;
}

.side-block {
  padding: 14px;
}

.side-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.summary-text {
  line-height: 1.6;
  color: #1f2937;
  font-size: 13px;
}

.reminder-list {
  display: grid;
  gap: 8px;
}

.reminder-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
  display: grid;
  gap: 6px;
}

.reminder-item .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.reminder-item .name {
  font-weight: 700;
}

.reminder-item .meta {
  color: var(--muted);
  font-size: 12px;
}

.reminder-item button {
  padding: 5px 8px;
  font-size: 12px;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-head {
  display: grid;
  grid-template-columns: 160px repeat(14, minmax(18px, 1fr));
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
}

.timeline-track {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2px;
  align-items: center;
}

.timeline-name {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-span {
  position: relative;
  display: grid;
  grid-template-columns: repeat(14, minmax(18px, 1fr));
  gap: 2px;
  min-height: 18px;
}

.timeline-cell {
  height: 18px;
  border-radius: 4px;
  background: #edf2f7;
}

.timeline-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
}

.summary-editor {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  resize: vertical;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  padding: 4px 8px;
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

@media (max-width: 1200px) {
  .toolbar, .compact-toolbar, .kpis, .main {
    grid-template-columns: 1fr;
  }
  .table-wrap {
    max-height: none;
    min-height: 60vh;
  }
  .timeline-head, .timeline-track {
    grid-template-columns: 200px repeat(14, minmax(18px, 1fr));
  }
}

