:root {
  --page: #FFFEFC;
  --panel: #FFFFFF;
  --line: #E9E9E7;
  --ink: #37352F;
  --muted: #9B9A97;
  --accent: #5B7F95;
  --accent-deep: #3D5D6E;
  --accent-soft: #E4ECF1;
  --hl-red-bg: #F9E8E5;
  --hl-red-text: #CE5242;
  --hl-orange-bg: #F9ECDF;
  --hl-orange-text: #D9730D;
  --hl-yellow-bg: #FAF3DC;
  --hl-yellow-text: #C29209;
  --hl-green-bg: #EDF3EC;
  --hl-green-text: #448361;
  --hl-blue-bg: #E7F3F8;
  --hl-blue-text: #337EA9;
  --hl-gray-bg: #F1F1EF;
  --hl-gray-text: #787774;
  --success: var(--hl-green-bg);
  --success-text: var(--hl-green-text);
  --warning: var(--hl-yellow-bg);
  --warning-text: var(--hl-yellow-text);
  --danger: var(--hl-red-bg);
  --danger-text: var(--hl-red-text);
  --shadow-ambient: 0 2px 10px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-full: 999px;
  color: var(--ink);
  font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background: var(--page);
}

body.dragging-active {
  user-select: none;
  cursor: grabbing;
}

button,
input,
a {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  width: min(708px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 60px;
  transition: width 200ms ease-out;
}

.app-shell.full-width {
  width: calc(100% - 56px);
}

.hero-card,
.stat-card,
.panel {
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding: 32px 36px;
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.hero-copy {
  max-width: 780px;
}

.hero-actions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-text,
.section-copy,
.hint-text,
.task-time,
.empty-state,
.quadrant-description {
  color: var(--muted);
}

.hero-text {
  max-width: 56ch;
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.5;
}

.ghost-link,
.pill-button,
.primary-button,
.task-form button,
.day-add-form button,
.task-action,
.calendar-nav button,
.calendar-day,
.drag-handle {
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.ghost-link,
.pill-button,
.primary-button,
.task-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--radius-full);
}

.ghost-link {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 150ms ease-out;
}

.ghost-link:hover {
  background: rgba(55, 53, 47, 0.06);
}

.pill-button,
.primary-button,
.task-form button,
.day-add-form button {
  background: var(--accent);
  color: #fff;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.stat-card {
  border-radius: var(--radius-md);
  padding: 20px 24px;
  background: var(--panel);
}

.stat-label {
  display: block;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.stat-card strong {
  font-size: 36px;
  line-height: 1;
  font-weight: 300;
}

.desktop-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.app-shell.full-width .desktop-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(420px, 1fr);
}

.workspace-column,
.sidebar-column {
  display: grid;
  gap: 24px;
}

.panel {
  border-radius: var(--radius-md);
  padding: 28px;
  background: var(--panel);
  transition: background 150ms ease-out;
}

.panel:hover {
  background: var(--page);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

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

h1 {
  font-size: clamp(40px, 4vw, 48px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

label {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 16px;
}

input {
  width: 100%;
  border: none;
  outline: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 150ms ease-out;
}

input:focus {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.section-head,
.quadrant-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-copy {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.5;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  font-size: 12px;
  color: var(--accent-deep);
  white-space: nowrap;
}

.mini-chip.warm {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.quadrant-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.quadrant-column {
  border-radius: var(--radius-md);
  padding: 16px;
}

.quadrant-column.urgent-important {
  background: var(--hl-red-bg);
}

.quadrant-column.important {
  background: var(--hl-blue-bg);
}

.quadrant-column.urgent {
  background: var(--hl-orange-bg);
}

.quadrant-column.backlog {
  background: var(--hl-gray-bg);
}

.quadrant-tag {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.quadrant-description {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.quadrant-list,
.log-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quadrant-list {
  min-height: 96px;
}

.task-card,
.log-item,
.task-placeholder,
.drag-ghost {
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.task-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  align-items: start;
}

.task-title {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  word-break: break-word;
}

.task-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.task-time {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.task-action {
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 150ms ease-out;
}

.task-action.complete {
  background: var(--success);
  color: var(--success-text);
}

.task-action.undo {
  background: var(--warning);
  color: var(--warning-text);
}

.task-action.delete {
  background: var(--danger);
  color: var(--danger-text);
}

.task-action.edit-date {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.drag-handle {
  grid-row: 1 / 3;
  align-self: start;
  margin-top: 3px;
  flex-shrink: 0;
  width: 14px;
  cursor: grab;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: -2px;
  user-select: none;
  border-radius: 2px;
  padding: 1px 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.drag-handle:hover {
  background: rgba(55, 53, 47, 0.06);
}

.pending-card.drag-source {
  opacity: 0.2;
}

.task-placeholder {
  border: 2px dashed var(--accent);
  background: var(--accent-soft);
}

.drag-ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  margin: 0;
  opacity: 0.96;
  box-shadow: var(--shadow-ambient);
}

.quadrant-empty,
.empty-state {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--page);
  line-height: 1.5;
  font-size: 14px;
}

.calendar-panel {
  min-width: 0;
  overflow-x: auto;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-nav button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 150ms ease-out;
}

.calendar-nav button:hover {
  background: rgba(55, 53, 47, 0.06);
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekday-row {
  margin-bottom: 10px;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}

.calendar-day {
  min-height: 92px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  transition: background 150ms ease-out;
  min-width: 0;
}

.calendar-day:hover {
  background: rgba(55, 53, 47, 0.04);
}

.calendar-day.selected {
  background: var(--accent-soft);
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.calendar-day.muted {
  opacity: 0.42;
}

.day-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.day-badge {
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.day-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 14px;
  max-height: 54px;
  overflow-y: auto;
}

.day-preview-item {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.day-log {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.day-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 14px 0 16px;
}

.day-add-form button {
  min-height: 44px;
  border-radius: var(--radius-sm);
  padding: 0 22px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 150ms ease-out;
}

.day-add-form button:hover {
  background: var(--accent-deep);
}

.sync-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.hint-text {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.date-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  display: grid;
  place-items: center;
  z-index: 1200;
}

.date-modal {
  width: min(380px, calc(100vw - 24px));
  border-radius: var(--radius-lg);
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.date-modal-title {
  font-size: 15px;
  line-height: 1.5;
}

.date-modal-input {
  border: none;
  outline: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--page);
  font-size: 16px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.date-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.date-modal-button {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 8px 22px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 150ms ease-out;
}

.date-modal-button.neutral {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.date-modal-button.primary {
  background: var(--accent);
  color: #fff;
}

.date-modal-button.primary:hover {
  background: var(--accent-deep);
}

.tab-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
}

.tab-button {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-full);
  padding: 10px 26px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: all 180ms ease-out;
}

.tab-button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.tab-button:not(.active):hover {
  background: rgba(55, 53, 47, 0.06);
}

.width-toggle-btn {
  padding: 10px 14px;
  font-size: 16px;
  line-height: 1;
}

.projects-panel {
  padding: 28px;
  grid-column: 1 / -1;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.project-card {
  background: var(--panel);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 150ms ease-out;
}

.project-card:hover {
  background: var(--page);
}

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.project-card-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.project-card-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 24px;
  cursor: grab;
  color: var(--muted);
  opacity: 0.3;
  font-size: 14px;
  letter-spacing: -2px;
  user-select: none;
  flex-shrink: 0;
  border-radius: 4px;
}

.project-card-drag-handle:hover {
  opacity: 0.6;
  background: rgba(55, 53, 47, 0.06);
}

.project-card.dragging {
  opacity: 0.35;
  transition: opacity 150ms ease-out;
}

.project-card.drop-above {
  box-shadow: 0 -3px 0 var(--accent);
}

.project-card.drop-below {
  box-shadow: 0 3px 0 var(--accent);
}

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

.project-card-actions button {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line);
  background: transparent;
  color: var(--ink);
  transition: background 150ms ease-out;
}

.project-card-actions .project-btn-edit:hover {
  background: rgba(55, 53, 47, 0.06);
}

.project-card-actions .project-btn-delete:hover {
  background: var(--danger);
  color: var(--danger-text);
}

.schedule-table {
  width: 100%;
}

.schedule-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 0.6fr 0.6fr 0.5fr;
  gap: 8px;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 0.6fr 0.6fr 0.5fr;
  gap: 8px;
  padding: 8px 4px;
  align-items: center;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.schedule-row:last-child {
  border-bottom: none;
}

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

.schedule-cell.name {
  font-weight: 500;
}

.progress-bar {
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  pointer-events: none;
}

.priority-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.priority-tag.p0 {
  background: var(--hl-red-bg);
  color: var(--hl-red-text);
}

.priority-tag.p1 {
  background: var(--hl-yellow-bg);
  color: var(--hl-yellow-text);
}

.priority-tag.p2 {
  background: var(--hl-gray-bg);
  color: var(--hl-gray-text);
}

.schedule-cell-actions {
  display: flex;
  gap: 4px;
}

.schedule-cell-actions button {
  border: none;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  background: transparent;
  color: var(--muted);
  transition: background 150ms ease-out, color 150ms ease-out;
}

.schedule-cell-actions button:hover {
  background: rgba(55, 53, 47, 0.06);
  color: var(--ink);
}

.add-ptask-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 0.6fr 0.8fr;
  gap: 10px;
  padding: 10px 4px;
  margin-top: 6px;
  align-items: end;
}

.add-ptask-form input,
.add-ptask-form select {
  border: none;
  background: var(--page);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  transition: box-shadow 150ms ease-out;
}

.add-ptask-form input:focus,
.add-ptask-form select:focus {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.add-ptask-form button {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--accent);
  color: #fff;
  transition: background 150ms ease-out;
}

.add-ptask-form button:hover {
  background: var(--accent-deep);
}

.project-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 16px;
}

@media (max-width: 1120px) {
  .schedule-table-header,
  .schedule-row {
    font-size: 11px;
    gap: 4px;
  }
  .add-ptask-form {
    gap: 6px;
  }
  .desktop-layout {
    grid-template-columns: 1fr;
  }
  .app-shell.full-width .desktop-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100%, calc(100% - 24px));
    padding-top: 28px;
  }
  .app-shell.full-width {
    width: min(100%, calc(100% - 24px));
  }
  .hero-card {
    flex-direction: column;
    padding: 28px 24px;
  }
  .hero-actions {
    justify-content: flex-start;
  }
  .stats-strip,
  .quadrant-board {
    grid-template-columns: 1fr;
  }
  .calendar-grid,
  .weekday-row {
    gap: 6px;
  }
  .calendar-day {
    min-height: 78px;
  }
}

@media (max-width: 560px) {
  .task-form,
  .day-add-form {
    grid-template-columns: 1fr;
  }
  .ghost-link,
  .pill-button,
  .primary-button,
  .task-form button,
  .day-add-form button {
    width: 100%;
  }
  .stats-strip {
    grid-template-columns: 1fr;
  }
  .calendar-day {
    min-height: 72px;
    padding: 8px 6px;
  }
}

.panel-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 24px;
  margin-right: 10px;
  cursor: grab;
  color: var(--muted);
  opacity: 0.3;
  font-size: 14px;
  letter-spacing: -2px;
  user-select: none;
  flex-shrink: 0;
  border-radius: 4px;
}

.panel-drag-handle:hover {
  opacity: 0.6;
  background: rgba(55, 53, 47, 0.06);
}

.panel-drag-handle:active {
  cursor: grabbing;
}

.panel.dragging {
  opacity: 0.35;
  transition: opacity 150ms ease-out;
}

.panel.drop-above {
  box-shadow: 0 -3px 0 var(--accent), inset 0 0 0 1px var(--line);
}

.panel.drop-below {
  box-shadow: 0 3px 0 var(--accent), inset 0 0 0 1px var(--line);
}

.icp-footer {
  text-align: center;
  padding: 24px 16px 32px;
}

.icp-footer a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 150ms ease-out;
}

.icp-footer a:hover {
  color: var(--ink);
}
