:root {
  --bg: #f5f0ed;
  --surface: #fffaf7;
  --surface-strong: #ffffff;
  --text: #242326;
  --muted: #777174;
  --line: #ebe0dc;
  --coral: #ff6262;
  --coral-dark: #e74e50;
  --ink: #1f252b;
  --mint: #46c59b;
  --yellow: #f4be4f;
  --blue: #5b8def;
  --shadow: 0 18px 44px rgba(36, 35, 38, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Aptos", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 98, 98, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(70, 197, 155, 0.14), transparent 38%),
    var(--bg);
}

body.dark {
  --bg: #17191b;
  --surface: #202327;
  --surface-strong: #262a2f;
  --text: #f5f0ed;
  --muted: #b7afb1;
  --line: #363b40;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  background: rgba(255, 250, 247, 0.78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(145deg, var(--coral), #ff8580);
  box-shadow: 0 12px 24px rgba(255, 98, 98, 0.28);
}

.brand strong,
.brand small,
.section-title {
  display: block;
}

.brand strong {
  font-size: 20px;
}

.brand small,
.section-title,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
}

.nav-list,
.tag-list,
.task-list,
.subtask-fields {
  display: grid;
  gap: 10px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--muted);
  background: transparent;
}

.nav-item.is-active,
.nav-item:hover {
  color: #fff;
  background: var(--ink);
}

.tag-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--surface-strong);
  text-align: left;
}

.tag-pill.is-active {
  color: #fff;
  border-color: var(--coral);
  background: var(--coral);
}

.workspace {
  min-width: 0;
  padding: 30px clamp(22px, 4vw, 54px) 44px;
}

.topbar,
.topbar-actions,
.column-head,
.modal-head,
.subtask-top,
.calendar-head {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
}

.topbar h1,
.column-head h2,
.modal-head h2 {
  margin: 4px 0 0;
}

.topbar h1 {
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1;
}

.topbar-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-box {
  width: min(360px, 35vw);
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--surface-strong);
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: var(--coral);
}

.add-task-top {
  color: #fff;
  border-color: transparent;
  background: var(--coral);
}

.ghost-button {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-strong);
}

.danger-button {
  color: #fff;
  background: #d94a54;
}

.icon-button {
  width: 42px;
  padding: 0;
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-strong);
}

.stats-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.stat-card,
.controls-panel,
.task-column,
.detail-column > section,
.task-modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 132px;
  padding: 18px;
  overflow: visible;
  position: relative;
  z-index: 0;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -30px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.stat-card span,
.stat-card small {
  display: block;
  color: inherit;
  opacity: 0.74;
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  font-size: 38px;
}

.stat-popover {
  position: absolute;
  left: 14px;
  right: 14px;
  top: calc(100% - 10px);
  z-index: 8;
  padding: 12px;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: 0 18px 32px rgba(36, 35, 38, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.stat-card:hover {
  overflow: visible;
  z-index: 12;
}

.stat-card:hover .stat-popover {
  opacity: 1;
  transform: translateY(0);
}

.stat-popover strong {
  margin: 0;
  font-size: 14px;
}

.stat-popover ul {
  margin: 9px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.stat-popover li {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stat-popover li span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-popover p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.stat-card.coral,
.stat-card.ink,
.stat-card.mint {
  color: #fff;
}

.stat-card.coral {
  background: var(--coral);
}

.stat-card.ink {
  background: var(--ink);
}

.stat-card.mint {
  background: var(--mint);
}

.stat-card.paper {
  background: var(--surface-strong);
}

.controls-panel {
  margin-top: 16px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.segmented {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segment {
  border: 0;
  border-radius: var(--radius);
  padding: 9px 14px;
  color: var(--muted);
  background: transparent;
}

.segment.is-active {
  color: #fff;
  background: var(--ink);
}

.filter-row {
  display: flex;
  gap: 10px;
}

.custom-select {
  position: relative;
  min-width: 132px;
}

.custom-select-button {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 11px 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: 0 8px 18px rgba(36, 35, 38, 0.04);
}

.custom-select-button i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  font-style: normal;
  font-size: 0;
  color: var(--muted);
  background: rgba(36, 35, 38, 0.05);
  transition: transform 160ms ease, background 160ms ease;
}

.custom-select-button i::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
}

.custom-select.is-open .custom-select-button {
  border-color: rgba(255, 98, 98, 0.52);
  box-shadow: 0 0 0 3px rgba(255, 98, 98, 0.12);
}

.custom-select.is-open .custom-select-button i {
  transform: rotate(180deg);
  background: rgba(255, 98, 98, 0.12);
}

.custom-select-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: max(100%, 168px);
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 247, 0.96);
  box-shadow: 0 18px 36px rgba(36, 35, 38, 0.15);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

body.dark .custom-select-menu {
  background: rgba(38, 42, 47, 0.96);
}

.custom-select.is-open .custom-select-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.custom-select-menu button {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.custom-select-menu button::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.custom-select-menu button:hover {
  color: var(--text);
  background: rgba(255, 98, 98, 0.1);
}

.custom-select-menu button.is-selected {
  color: var(--coral-dark);
  background: rgba(255, 98, 98, 0.14);
  font-weight: 800;
}

.custom-select-menu button.is-selected::after {
  background: var(--coral);
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-strong);
}

select {
  height: 40px;
  padding: 0 10px;
}

textarea,
.task-modal input:not([type="checkbox"]) {
  width: 100%;
  padding: 11px 12px;
}

textarea:focus,
input:focus,
select:focus {
  outline: 0;
  border-color: rgba(255, 98, 98, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 98, 98, 0.15);
}

.main-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.task-column,
.detail-column > section {
  padding: 16px;
}

.column-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.column-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.column-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.task-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--coral);
  border-radius: var(--radius);
  background: var(--surface-strong);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(36, 35, 38, 0.1);
}

.task-card.dragging {
  opacity: 0.55;
}

.task-card.priority-medium {
  border-left-color: var(--yellow);
}

.task-card.priority-low {
  border-left-color: var(--mint);
}

.task-card.is-done {
  opacity: 0.66;
}

.task-check {
  width: 22px;
  height: 22px;
  accent-color: var(--coral);
}

.task-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-title-row h3 {
  margin: 0;
  font-size: 18px;
}

.priority-badge,
.status-badge,
.due-badge,
.repeat-badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(36, 35, 38, 0.06);
}

.pin-toggle {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  background: rgba(36, 35, 38, 0.04);
  font-size: 12px;
  font-weight: 800;
}

.pin-toggle span {
  font-weight: 700;
}

.pin-toggle:hover {
  color: var(--text);
  border-color: rgba(255, 98, 98, 0.34);
  background: rgba(255, 98, 98, 0.08);
}

.pin-toggle.is-pinned {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(145deg, var(--coral), #f06b72);
  box-shadow: 0 8px 16px rgba(255, 98, 98, 0.18);
}

.priority-badge.high {
  color: #fff;
  background: var(--coral);
}

.priority-badge.medium {
  color: #4f3710;
  background: #ffe3a0;
}

.priority-badge.low {
  color: #0d5d45;
  background: #d8f6eb;
}

.repeat-badge {
  color: #8c4f16;
  background: rgba(244, 190, 79, 0.22);
}

.task-desc {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.5;
}

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-expand {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 220ms ease, opacity 180ms ease, transform 180ms ease, margin-top 180ms ease;
}

.task-card:hover .task-expand,
.task-card:focus-within .task-expand {
  max-height: 180px;
  margin-top: 10px;
  opacity: 1;
  transform: translateY(0);
}

.task-tags,
.subtask-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.subtask-list {
  margin-top: 10px;
}

.subtask-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
}

.subtask-chip:hover {
  color: var(--text);
  border-color: rgba(255, 98, 98, 0.38);
  background: rgba(255, 98, 98, 0.08);
}

.subtask-chip.is-done {
  color: #6b8f7d;
  text-decoration: line-through;
}

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

.task-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-action {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
}

.empty-state {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
}

.detail-column {
  display: grid;
  gap: 16px;
}

.calendar-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 250, 247, 0.96)),
    var(--surface);
  overflow: visible;
}

.apple-calendar-head {
  gap: 12px;
}

.calendar-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-nav,
.calendar-today {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-strong);
}

.calendar-nav {
  width: 30px;
  padding: 0;
  font-size: 19px;
  line-height: 1;
}

.calendar-today {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-weekdays {
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.calendar-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  overflow: visible;
}

.calendar-day {
  min-width: 0;
  aspect-ratio: 0.92;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 2px 8px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(36, 35, 38, 0.035);
  position: relative;
  overflow: visible;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.calendar-day:hover {
  z-index: 40;
  transform: translateY(-1px);
  background: rgba(255, 98, 98, 0.09);
}

.calendar-day.has-task {
  color: var(--text);
  background: rgba(36, 35, 38, 0.045);
}

.calendar-day.has-task.task-priority-high:not(.is-selected) {
  color: #bf3038;
  background: rgba(255, 98, 98, 0.17);
}

.calendar-day.has-task.task-priority-medium:not(.is-selected) {
  color: #8c640f;
  background: rgba(244, 190, 79, 0.22);
}

.calendar-day.has-task.task-priority-low:not(.is-selected) {
  color: #0f7a59;
  background: rgba(70, 197, 155, 0.18);
}

.calendar-day.is-rest-day:not(.is-selected) {
  background: rgba(255, 98, 98, 0.07);
}

.calendar-day.is-rest-day.has-task.task-priority-high:not(.is-selected) {
  background: linear-gradient(145deg, rgba(255, 98, 98, 0.2), rgba(255, 98, 98, 0.1));
}

.calendar-day.is-rest-day.has-task.task-priority-medium:not(.is-selected) {
  background: linear-gradient(145deg, rgba(244, 190, 79, 0.25), rgba(255, 98, 98, 0.08));
}

.calendar-day.is-rest-day.has-task.task-priority-low:not(.is-selected) {
  background: linear-gradient(145deg, rgba(70, 197, 155, 0.2), rgba(255, 98, 98, 0.08));
}

.calendar-day.is-work-day:not(.is-selected).has-holiday,
.calendar-day.is-work-day:not(.is-selected) {
  background: rgba(31, 37, 43, 0.055);
}

.calendar-day.is-today {
  color: var(--coral-dark);
  box-shadow: inset 0 0 0 1.5px rgba(255, 98, 98, 0.72);
}

.calendar-day.is-selected {
  color: #fff;
  border-color: var(--coral);
  background: linear-gradient(160deg, #ff6b6b, #e84f58);
  box-shadow: 0 10px 20px rgba(255, 98, 98, 0.25);
  transform: translateY(-1px);
}

.calendar-day.is-selected.task-priority-medium {
  border-color: #f4be4f;
  background: linear-gradient(160deg, #f8c85c, #d99b28);
  box-shadow: 0 10px 20px rgba(244, 190, 79, 0.25);
}

.calendar-day.is-selected.task-priority-low {
  border-color: var(--mint);
  background: linear-gradient(160deg, #58d3a9, #25a97b);
  box-shadow: 0 10px 20px rgba(70, 197, 155, 0.24);
}

.calendar-day.is-selected.is-today {
  box-shadow:
    0 10px 20px rgba(255, 98, 98, 0.25),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.76);
}

.calendar-day.is-muted {
  opacity: 0.35;
}

.calendar-day.has-holiday:not(.is-selected) {
  color: var(--coral-dark);
}

.calendar-number {
  font-weight: 800;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.calendar-day small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  line-height: 1.1;
  min-height: 10px;
}

.calendar-day i {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  font-size: 0;
  line-height: 0;
  background: currentColor;
  transform: translateX(-50%);
  opacity: 0.72;
}

.calendar-day.is-selected i {
  background: #fff;
  opacity: 0.9;
}

.calendar-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 30;
  width: 230px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 250, 247, 0.96);
  box-shadow: 0 18px 34px rgba(36, 35, 38, 0.18);
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(16px);
}

.calendar-popover::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 247, 0.96);
  transform: translateX(-50%) rotate(45deg);
}

.calendar-day:hover .calendar-popover,
.calendar-day:focus-visible .calendar-popover {
  opacity: 1;
  transform: translate(-50%, 0);
}

.calendar-popover strong,
.calendar-popover em {
  display: block;
}

.calendar-popover em,
.calendar-popover p,
.calendar-popover li {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.calendar-popover ul {
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.calendar-popover li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.calendar-popover p {
  margin: 10px 0 0;
}

.achievement-card {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.calendar-head {
  justify-content: space-between;
}

.history-block {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 98, 98, 0.08), rgba(70, 197, 155, 0.07)),
    var(--surface-strong);
  box-shadow: var(--shadow);
}

.history-block > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-block strong {
  display: block;
  margin-top: 3px;
}

.history-stats {
  display: flex;
  gap: 8px;
}

.history-stats span {
  min-width: 56px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 11px;
  text-align: center;
}

.history-stats b {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.completion-history {
  min-height: 92px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.completion-history ul {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  list-style: none;
}

.completion-history li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.completion-history strong,
.completion-history span {
  display: block;
}

.completion-history strong {
  font-size: 13px;
}

.completion-history span,
.completion-history p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.completion-history p {
  margin: 0;
}

.preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.preview-dot.high {
  background: var(--coral);
}

.preview-dot.medium {
  background: var(--yellow);
}

.preview-dot.low {
  background: var(--mint);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 98, 98, 0.12), rgba(70, 197, 155, 0.1)),
    rgba(25, 27, 30, 0.46);
  backdrop-filter: blur(10px);
}

.modal-backdrop.is-open {
  display: flex;
}

.task-modal {
  width: min(660px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  display: grid;
  gap: 15px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 250, 247, 0.98)),
    var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 30px 72px rgba(31, 37, 43, 0.28);
  animation: modal-in 180ms ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 98, 98, 0.38) transparent;
}

.modal-head,
.subtask-top,
.modal-actions {
  justify-content: space-between;
}

.modal-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head .eyebrow {
  color: var(--coral-dark);
  font-weight: 800;
}

.modal-head h2 {
  font-size: 26px;
}

.modal-head .icon-button {
  border-color: rgba(255, 98, 98, 0.16);
  background: rgba(255, 98, 98, 0.08);
}

.task-modal label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.task-modal input:not([type="checkbox"]),
.task-modal select,
.task-modal textarea {
  border-color: rgba(36, 35, 38, 0.1);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.task-modal textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
}

.native-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 5px;
  border: 1px solid rgba(36, 35, 38, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
}

.choice-group.repeat-choice {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-group button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.choice-group button:hover {
  color: var(--text);
  background: rgba(255, 98, 98, 0.08);
}

.choice-group button.is-selected {
  color: #fff;
  background: linear-gradient(145deg, var(--coral), #f06b72);
  box-shadow: 0 8px 18px rgba(255, 98, 98, 0.22);
  transform: translateY(-1px);
}

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

.check-row {
  display: flex !important;
  grid-template-columns: unset;
  align-items: center;
  gap: 10px !important;
  width: fit-content;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

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

.subtask-editor {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
}

.subtask-top {
  margin-bottom: 10px;
}

.subtask-top span {
  font-weight: 900;
}

.subtask-top .ghost-button {
  min-height: 34px;
  border-color: rgba(255, 98, 98, 0.2);
  color: var(--coral-dark);
  background: rgba(255, 98, 98, 0.08);
}

.subtask-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border-radius: var(--radius);
  background: rgba(255, 250, 247, 0.82);
}

.subtask-field + .subtask-field {
  margin-top: 8px;
}

.subtask-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--coral);
}

.subtask-field input[type="text"] {
  width: 100%;
  padding: 9px 10px;
  background: #fff;
}

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

.modal-actions .danger-button {
  margin-right: auto;
}

.modal-actions .primary-button,
.modal-actions .danger-button {
  min-width: 112px;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  transform: translate(-50%, 12px);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 20px 14px 34px;
  }

  .topbar,
  .controls-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .filter-row {
    width: 100%;
  }

  .search-box {
    width: 100%;
  }

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

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .column-head {
    align-items: stretch;
    flex-direction: column;
  }

  .column-actions {
    justify-content: stretch;
  }

  .column-actions button {
    flex: 1;
  }

  .task-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
