:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --line: #eceef3;
  --line-strong: #dfe4ee;
  --text: #172033;
  --muted: #7b8497;
  --muted-soft: #9ba3b4;
  --primary: #1d6bff;
  --primary-dark: #1458e8;
  --primary-soft: #edf4ff;
  --danger: #ee6845;
  --danger-soft: #fff0ec;
  --warning: #be8500;
  --warning-soft: #fff7df;
  --success: #23b26d;
  --success-soft: #edf8f3;
  --violet: #7658e8;
  --violet-soft: #f1edff;
  --shadow-blue: 0 12px 26px rgba(29, 107, 255, 0.24);
  --shadow-card: 0 20px 60px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.boot-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

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

.logo {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #ffffff;
  font-weight: 800;
  background: linear-gradient(135deg, #1d6bff, #8eb8ff);
  border-radius: 13px;
  box-shadow: 0 14px 28px rgba(29, 107, 255, 0.22);
}

.brand h1,
.brand p,
.hello h2,
.hello p,
.stat-card h3,
.stat-card p,
.board-header h3,
.board-header p,
.task-card h4,
.task-card p,
.profile h4,
.profile p,
.panel-card h3,
.focus-card h3,
.focus-card p,
.modal h2,
.eyebrow,
.muted {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.15;
}

.brand p {
  margin-top: 2px;
  color: var(--muted-soft);
  font-size: 12px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-title {
  margin: 0 6px 4px;
  color: var(--muted-soft);
  font-size: 12px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 42px;
  gap: 11px;
  padding: 0 13px;
  color: #657086;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 14px;
}

.nav-item:hover,
.nav-item.active-soft,
.nav-item.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #7b8497;
  background: #f1f3f7;
  border-radius: 8px;
}

.nav-item.active .nav-icon {
  color: #ffffff;
  background: var(--primary);
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
}

.nav-dot.all {
  background: #9ba3b4;
}

.nav-dot.blue {
  background: var(--primary);
}

.nav-dot.violet {
  background: var(--violet);
}

.nav-dot.green {
  background: var(--success);
}

.nav-dot.orange {
  background: var(--danger);
}

.focus-card {
  position: relative;
  margin-top: auto;
  overflow: hidden;
  padding: 20px;
  color: #ffffff;
  background: linear-gradient(160deg, #172033, #2b3a58);
  border-radius: 24px;
}

.focus-card::after {
  position: absolute;
  top: -32px;
  right: -38px;
  width: 120px;
  height: 120px;
  content: "";
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.focus-card h3,
.focus-card p,
.focus-card button,
.focus-symbol {
  position: relative;
  z-index: 1;
}

.focus-symbol {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

.focus-card h3 {
  margin-top: 12px;
  font-size: 15px;
}

.focus-card p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.55;
}

.focus-card button {
  height: 36px;
  padding: 0 14px;
  margin-top: 18px;
  color: var(--text);
  font-weight: 800;
  background: #ffffff;
  border: 0;
  border-radius: 12px;
}

.main {
  min-width: 0;
  padding: 30px 34px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.hello h2 {
  font-size: 28px;
  line-height: 1.15;
}

.hello p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

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

.search-box {
  display: flex;
  align-items: center;
  width: min(280px, 32vw);
  height: 44px;
  gap: 10px;
  padding: 0 14px;
  color: var(--muted-soft);
  background: var(--surface);
  border: 1px solid #e5e8ef;
  border-radius: 16px;
}

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

.search-box input::placeholder {
  color: var(--muted-soft);
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  gap: 8px;
  border: 0;
  border-radius: 16px;
  font-weight: 800;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--primary);
  box-shadow: var(--shadow-blue);
}

.secondary-button {
  padding: 0 18px;
  color: #657086;
  background: #f1f3f7;
}

.ghost-button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 11px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #657086;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.icon-button:hover {
  color: var(--primary);
  border-color: #d4e2ff;
  background: #f7fbff;
}

.icon-button.danger:hover {
  color: var(--danger);
  border-color: #ffd8ce;
  background: var(--danger-soft);
}

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

.stat-card {
  position: relative;
  min-height: 132px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.stat-card h3 {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin-bottom: 8px;
  font-size: 30px;
  font-weight: 850;
  line-height: 1;
}

.stat-card p {
  color: #99a1b2;
  font-size: 12px;
  line-height: 1.45;
}

.mini-pill {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 6px 9px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  background: #f2f7ff;
  border-radius: 999px;
}

.mini-pill.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.filter-group,
.category-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

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

.filter-chip,
.category-chip,
.date-input {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.filter-chip.active,
.category-chip.active {
  color: #ffffff;
  background: var(--text);
  border-color: var(--text);
}

.date-input {
  color: #657086;
  outline: 0;
}

.error-banner {
  padding: 12px 14px;
  margin-bottom: 14px;
  color: #b3462b;
  font-size: 13px;
  font-weight: 700;
  background: var(--danger-soft);
  border: 1px solid #ffd8ce;
  border-radius: 16px;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0 16px;
}

.board-header h3 {
  font-size: 19px;
  line-height: 1.25;
}

.board-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.tab {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 11px;
}

.tab.active {
  color: #ffffff;
  background: var(--text);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 17px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
}

.task-card.done .task-content h4,
.task-card.done .task-content p {
  color: #9ba3b4;
}

.check-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #dfe4ee;
  background: #ffffff;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
}

.task-card.done .check-button {
  color: #ffffff;
  background: var(--success);
  border-color: var(--success);
}

.task-content {
  min-width: 0;
}

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

.task-card h4 {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
}

.task-card p {
  color: #8b94a8;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.task-footnote {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  color: #a1a8b7;
  font-size: 11px;
  font-weight: 700;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag,
.status-badge,
.date-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  gap: 5px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  border-radius: 999px;
}

.tag.high {
  color: var(--danger);
  background: var(--danger-soft);
}

.tag.medium {
  color: var(--warning);
  background: var(--warning-soft);
}

.tag.low {
  color: #239260;
  background: var(--success-soft);
}

.status-badge.todo {
  color: #657086;
  background: #f1f3f7;
}

.status-badge.in_progress {
  color: var(--primary);
  background: var(--primary-soft);
}

.status-badge.done {
  color: #239260;
  background: var(--success-soft);
}

.date-pill {
  color: #7b8497;
  background: #f7f9fc;
  border: 1px solid #edf0f5;
}

.task-tools {
  display: flex;
  gap: 6px;
}

.task-tools .icon-button {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.empty-state {
  display: grid;
  min-height: 230px;
  place-items: center;
  gap: 12px;
  padding: 28px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed #dfe4ee;
  border-radius: 22px;
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-weight: 800;
}

.right-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 30px 24px;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.avatar-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #ffffff;
  font-weight: 850;
  background: linear-gradient(135deg, #ffcb69, #ff8f70);
  border-radius: 15px;
}

.profile h4 {
  font-size: 14px;
}

.profile p {
  margin-top: 4px;
  color: #8b94a8;
  font-size: 12px;
}

.panel-card {
  padding: 20px;
  background: var(--surface-soft);
  border: 1px solid #edf0f5;
  border-radius: 26px;
}

.panel-card h3 {
  margin-bottom: 16px;
  font-size: 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

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

.day-name {
  color: #a1a8b7;
  font-size: 12px;
  font-weight: 800;
}

.day-placeholder,
.day-button {
  aspect-ratio: 1;
}

.day-button {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  color: #5f687b;
  font-size: 12px;
  font-weight: 800;
  background: #ffffff;
  border: 0;
  border-radius: 12px;
}

.day-button.has-task::after {
  position: absolute;
  right: 7px;
  bottom: 6px;
  width: 4px;
  height: 4px;
  content: "";
  background: var(--primary);
  border-radius: 999px;
}

.day-button.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 10px 22px rgba(29, 107, 255, 0.24);
}

.day-button.active::after {
  background: #ffffff;
}

.focus-panel {
  background: linear-gradient(160deg, #edf4ff, #ffffff);
}

.progress {
  height: 9px;
  margin: 12px 0 10px;
  overflow: hidden;
  background: #e3e8f1;
  border-radius: 999px;
}

.bar {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #8b94a8;
  font-size: 12px;
  font-weight: 800;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.time-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.time {
  padding-top: 5px;
  color: #8b94a8;
  font-size: 12px;
  font-weight: 800;
}

.event {
  padding: 13px 14px;
  background: #ffffff;
  border: 1px solid #eef1f6;
  border-radius: 18px;
}

.event strong {
  display: block;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.event span,
.muted {
  color: #8b94a8;
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.32);
  backdrop-filter: blur(10px);
}

.modal {
  width: min(640px, 100%);
  max-height: min(92vh, 760px);
  padding: 24px;
  overflow: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-card);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
}

.modal h2 {
  font-size: 22px;
  line-height: 1.2;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  color: #657086;
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid #e5e8ef;
  border-radius: 14px;
  outline: 0;
}

.field textarea {
  min-height: 112px;
  padding-top: 12px;
  line-height: 1.5;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #bcd2ff;
  box-shadow: 0 0 0 4px rgba(29, 107, 255, 0.1);
}

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

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

.saving {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .right-panel {
    display: none;
  }

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

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

  .sidebar {
    display: none;
  }

  .main {
    padding: 22px;
  }

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

  .search-box {
    width: 100%;
  }

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

  .filter-bar,
  .board-header {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
  }

  .tab {
    flex: 1 0 auto;
  }

  .task-card {
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: start;
  }

  .task-meta {
    grid-column: 2 / 3;
    flex-wrap: wrap;
  }

  .task-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-tools {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .main {
    padding: 18px 14px;
  }

  .hello h2 {
    font-size: 25px;
  }

  .stat-value {
    font-size: 28px;
  }

  .filter-group,
  .category-chips {
    width: 100%;
  }

  .filter-chip,
  .category-chip {
    flex: 1 1 auto;
  }

  .date-input {
    width: 100%;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal {
    border-radius: 24px;
  }

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

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .primary-button,
  .modal-actions .secondary-button {
    width: 100%;
  }
}

/* FlowTask V1.1 */
.app-shell.no-right {
  grid-template-columns: 248px minmax(0, 1fr);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  font-weight: 850;
}

.primary-btn {
  min-height: 44px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--primary);
  border-radius: 16px;
  box-shadow: var(--shadow-blue);
}

.ghost-btn {
  min-height: 36px;
  padding: 0 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  color: #657086;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

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

.stat-card > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.stat-card h3 {
  margin: 16px 0 8px;
  color: var(--text);
  font-size: 32px;
  line-height: 1;
}

.filters-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
}

.library-filters {
  justify-content: flex-start;
}

.filter-group label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.filter-group select,
.filters-card input,
.modal input,
.modal textarea,
.modal select {
  min-height: 40px;
  padding: 0 12px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid #e5e8ef;
  border-radius: 14px;
  outline: 0;
}

.filters-card input[type="date"] {
  min-width: 156px;
}

.hidden {
  display: none !important;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px;
  background: #f1f3f7;
  border-radius: 15px;
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 11px;
}

.segmented button.active {
  color: #ffffff;
  background: var(--text);
}

.task-board,
.calendar-card,
.day-panel {
  padding: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 28px;
}

.check-btn {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #ffffff;
  background: #ffffff;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
}

.check-btn.checked {
  background: var(--success);
  border-color: var(--success);
}

.priority-pill,
.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  border-radius: 999px;
}

.priority-pill.high {
  color: var(--danger);
  background: var(--danger-soft);
}

.priority-pill.medium {
  color: var(--warning);
  background: var(--warning-soft);
}

.priority-pill.low {
  color: #239260;
  background: var(--success-soft);
}

.category-pill.blue {
  color: var(--primary);
  background: var(--primary-soft);
}

.category-pill.violet {
  color: var(--violet);
  background: var(--violet-soft);
}

.category-pill.green {
  color: var(--success);
  background: var(--success-soft);
}

.category-pill.orange {
  color: var(--danger);
  background: var(--danger-soft);
}

.task-meta {
  flex-wrap: wrap;
  margin-top: 10px;
  color: #a1a8b7;
  font-size: 11px;
  font-weight: 750;
}

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

.task-actions button {
  min-height: 34px;
  padding: 0 10px;
  color: #657086;
  font-size: 12px;
  font-weight: 850;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.task-actions .danger-link {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #ffd8ce;
}

.progress-card {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  align-items: stretch;
}

.progress-card .task-content {
  align-self: center;
}

.task-progress-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #edf0f5;
  border-radius: 18px;
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #657086;
  font-size: 12px;
  font-weight: 850;
}

.progress-head strong {
  color: var(--text);
  font-size: 18px;
}

.progress-slider {
  width: 100%;
  accent-color: var(--primary);
}

.progress-scale {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  color: #a1a8b7;
  font-size: 9px;
  font-weight: 800;
}

.status-badge.pending,
.status-badge.todo {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-badge.completed {
  color: #239260;
  background: var(--success-soft);
}

.range-note {
  color: #8b94a8;
  font-size: 12px;
  font-weight: 800;
}

.timeline-item small {
  display: block;
  margin-top: 5px;
  color: #8b94a8;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.4;
}

.schedule-task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.schedule-task-card h4,
.schedule-task-card p {
  margin: 0;
}

.schedule-task-card h4 {
  font-size: 14px;
}

.schedule-task-card p {
  margin-top: 6px;
  color: #8b94a8;
  font-size: 12px;
}

.schedule-task-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.profile-card {
  padding: 20px;
  background: var(--surface-soft);
  border: 1px solid #edf0f5;
  border-radius: 26px;
}

.profile {
  justify-content: flex-start;
}

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

.panel-title-row h3 {
  margin: 0;
}

.panel-title-row button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
  background: #ffffff;
  border: 1px solid #dbe7ff;
  border-radius: 11px;
}

.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
}

.mini-calendar span {
  color: #a1a8b7;
  font-size: 12px;
  font-weight: 850;
}

.mini-calendar button {
  aspect-ratio: 1;
  min-width: 0;
  color: #5f687b;
  font-size: 12px;
  font-weight: 850;
  background: #ffffff;
  border: 0;
  border-radius: 12px;
}

.mini-calendar button.selected,
.mini-calendar button.today {
  color: #ffffff;
  background: var(--primary);
}

.mini-calendar button.blank {
  background: transparent;
}

.timeline-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 12px;
}

.timeline-item > span {
  width: 8px;
  height: 8px;
  margin-top: 8px;
  background: var(--primary);
  border-radius: 999px;
}

.timeline-item strong {
  color: #8b94a8;
  font-size: 12px;
}

.timeline-item p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.calendar-header h3 {
  margin: 0;
  font-size: 20px;
}

.calendar-grid.large {
  gap: 10px;
  text-align: left;
}

.weekday {
  color: #a1a8b7;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.calendar-cell {
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow: hidden;
  color: var(--text);
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.calendar-cell.blank {
  background: transparent;
  border: 0;
}

.calendar-cell.selected {
  border-color: #9dc0ff;
  box-shadow: 0 0 0 4px rgba(29, 107, 255, 0.08);
}

.calendar-cell.today .cell-date {
  color: #ffffff;
  background: var(--primary);
}

.cell-date {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  border-radius: 10px;
}

.calendar-cell-tasks {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
}

.calendar-task-chip,
.more-chip {
  display: block;
  min-width: 0;
  overflow: hidden;
  padding: 5px 7px;
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 9px;
}

.calendar-task-chip.high {
  color: var(--danger);
  background: var(--danger-soft);
}

.calendar-task-chip.medium {
  color: var(--warning);
  background: var(--warning-soft);
}

.calendar-task-chip.low,
.more-chip {
  color: var(--primary);
  background: var(--primary-soft);
}

.compact-list .task-card {
  grid-template-columns: 30px minmax(0, 1fr);
}

.compact-list .task-actions {
  grid-column: 2;
}

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

.kanban-column {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
}

.kanban-column.blue {
  background: linear-gradient(180deg, #f2f7ff, #ffffff);
}

.kanban-column.yellow {
  background: linear-gradient(180deg, #fff8e6, #ffffff);
}

.kanban-column.green {
  background: linear-gradient(180deg, #effaf4, #ffffff);
}

.kanban-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kanban-title h3,
.project-card h4,
.project-card p {
  margin: 0;
}

.kanban-title h3 {
  font-size: 16px;
}

.kanban-title span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #657086;
  font-size: 12px;
  font-weight: 900;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 11px;
}

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

.project-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
}

.project-card h4 {
  font-size: 15px;
}

.project-card p {
  margin-top: 7px;
  color: #8b94a8;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.progress-label,
.project-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #8b94a8;
  font-size: 12px;
  font-weight: 850;
}

.progress-line {
  height: 8px;
  margin-top: 9px;
  overflow: hidden;
  background: #e8edf5;
  border-radius: 999px;
}

.progress-line span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.project-meta {
  flex-direction: column;
}

.empty-state.small {
  min-height: 88px;
  padding: 18px;
  font-size: 12px;
}

.modal label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  color: #657086;
  font-size: 13px;
  font-weight: 850;
}

.modal textarea {
  min-height: 112px;
  padding-top: 12px;
  line-height: 1.5;
  resize: vertical;
}

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

.full-span {
  grid-column: 1 / -1;
}

@media (max-width: 1280px) {
  .app-shell.no-right {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .schedule-layout,
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid.compact,
  .kanban-board,
  .schedule-layout {
    grid-template-columns: 1fr;
  }

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

  .segmented {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .task-actions {
    grid-column: 2 / 3;
  }

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

  .task-progress-panel,
  .task-actions {
    grid-column: auto;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    flex: 0 0 auto;
  }

  .brand p,
  .nav-title {
    display: none;
  }

  .nav-section {
    flex: 0 0 auto;
    flex-direction: row;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .calendar-grid.large {
    gap: 6px;
  }

  .calendar-cell {
    min-height: 82px;
    padding: 7px;
    border-radius: 12px;
  }

  .calendar-task-chip {
    padding: 4px 5px;
  }

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

  .modal-actions .primary-btn,
  .modal-actions .ghost-btn {
    width: 100%;
  }
}

/* V1.1 layout bug fixes */
#app {
  min-width: 0;
}

.app-shell {
  width: 100%;
  min-width: 0;
}

.main {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.sidebar {
  width: 248px;
  min-width: 0;
}

.right-panel {
  width: 360px;
  min-width: 0;
}

.hello h2,
.board-header h3,
.task-card h4 {
  writing-mode: horizontal-tb;
}

.library-filters {
  align-items: stretch;
  flex-direction: column;
  justify-content: flex-start;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.filter-row > span {
  flex: 0 0 42px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.filter-row .segmented {
  min-width: 0;
}

@media (min-width: 1121px) {
  .app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr) 360px;
  }

  .app-shell.no-right {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    display: flex;
    flex-direction: column;
    width: 248px;
    padding: 28px 20px;
    overflow: visible;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .right-panel {
    display: flex;
  }
}

@media (min-width: 768px) and (max-width: 1120px) {
  .app-shell,
  .app-shell.no-right {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    display: flex;
    flex-direction: column;
    width: 220px;
    padding: 24px 16px;
    overflow: visible;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .right-panel {
    display: none;
  }
}

@media (max-width: 767px) {
  .app-shell,
  .app-shell.no-right {
    display: block;
    grid-template-columns: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    width: 100%;
    flex-direction: row;
    gap: 12px;
    padding: 12px 14px;
    overflow-x: auto;
    background: var(--surface);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-section {
    flex: 0 0 auto;
    flex-direction: row;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .main {
    width: 100%;
    padding: 20px;
  }

  .right-panel {
    display: none;
  }

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

  .search-box,
  .primary-btn {
    width: 100%;
  }

  .segmented {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .progress-scale {
    font-size: 8px;
  }

  .schedule-task-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .filter-row > span {
    flex-basis: auto;
  }
}

/* V1.2 modal and controls */
.modal {
  display: flex;
  max-height: 86vh;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  padding: 24px 24px 18px;
  margin-bottom: 0;
  background: #ffffff;
  border-bottom: 1px solid #f0f2f6;
}

.modal-body {
  min-height: 0;
  flex: 1 1 auto;
  padding: 20px 24px 128px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #cfd6e3 transparent;
  scrollbar-width: thin;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #cfd6e3;
  border-radius: 999px;
}

.modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-shrink: 0;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), #ffffff 26%);
  border-top: 1px solid #f0f2f6;
}

.custom-field {
  position: relative;
}

.custom-select,
.date-range-control {
  position: relative;
}

.custom-select-trigger,
.date-range-trigger {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 13px;
  color: var(--text);
  font-weight: 850;
  text-align: left;
  background: #ffffff;
  border: 1px solid #e5e8ef;
  border-radius: 14px;
}

.custom-select-trigger:focus,
.date-range-trigger:focus,
.modal input:focus,
.modal textarea:focus {
  border-color: #bcd2ff;
  box-shadow: 0 0 0 4px rgba(29, 107, 255, 0.1);
  outline: 0;
}

.select-arrow {
  color: #9ba3b4;
  font-size: 14px;
}

.calendar-symbol {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 8px;
}

.custom-select-menu,
.date-range-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 15;
  width: min(100%, 360px);
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

.custom-select.open .custom-select-menu,
.date-range-control.open .date-range-panel {
  position: static;
  width: 100%;
  margin-top: 8px;
}

.custom-select.open .popover-safe-space,
.date-range-control.open .popover-safe-space {
  display: none;
}

.custom-select-menu {
  max-height: 220px;
  overflow-y: auto;
  scrollbar-color: #cfd6e3 transparent;
  scrollbar-width: thin;
}

.custom-select-menu::-webkit-scrollbar {
  width: 6px;
}

.custom-select-menu::-webkit-scrollbar-thumb {
  background: #cfd6e3;
  border-radius: 999px;
}

.popover-safe-space {
  pointer-events: none;
}

.popover-safe-space.select-space {
  height: 156px;
}

.popover-safe-space.range-space {
  height: 430px;
}

.custom-select-menu button {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  padding: 0 11px;
  color: #657086;
  font-weight: 850;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 12px;
}

.custom-select-menu button:hover,
.custom-select-menu button.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.date-range-panel {
  width: min(360px, calc(100vw - 48px));
  padding: 14px;
}

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

.range-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  text-align: center;
}

.range-calendar-grid span {
  color: #a1a8b7;
  font-size: 12px;
  font-weight: 850;
}

.range-calendar-grid button {
  display: grid;
  aspect-ratio: 1;
  min-width: 0;
  place-items: center;
  color: #5f687b;
  font-size: 12px;
  font-weight: 850;
  background: transparent;
  border: 0;
  border-radius: 12px;
}

.range-calendar-grid button:hover {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.range-calendar-grid button.today {
  box-shadow: inset 0 0 0 1px #9dc0ff;
}

.range-calendar-grid button.in-range {
  color: var(--primary-dark);
  background: #edf4ff;
  border-radius: 8px;
}

.range-calendar-grid button.range-start,
.range-calendar-grid button.range-end {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 10px 22px rgba(29, 107, 255, 0.22);
}

.progress-slider {
  cursor: grab;
}

.progress-slider:active {
  cursor: grabbing;
}

@media (max-width: 560px) {
  .modal-backdrop {
    padding: 8px;
  }

  .modal {
    width: 100%;
    max-height: 90vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .primary-btn,
  .modal-footer .ghost-btn {
    width: 100%;
  }

  .custom-select-menu,
  .date-range-panel {
    width: min(100%, calc(100vw - 44px));
  }
}
