:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef4f3;
  --text: #182230;
  --muted: #667085;
  --line: #d9e2e7;
  --teal: #0f766e;
  --teal-strong: #0b5f59;
  --blue: #2563eb;
  --amber: #b7791f;
  --rose: #c2415a;
  --green: #168050;
  --ink: #101828;
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 24px 18px;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.brand-kicker,
.eyebrow,
.field-note,
.meta,
.sidebar-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.brand h1,
.topbar h2 {
  margin: 2px 0 0;
  color: var(--ink);
  letter-spacing: 0;
}

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

.topbar h2 {
  font-size: clamp(22px, 3vw, 32px);
}

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

.nav-item,
.segment,
.button,
.icon-button,
.chip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  min-height: 40px;
}

.nav-item {
  justify-content: flex-start;
  padding: 10px 12px;
  color: var(--muted);
  width: 100%;
}

.nav-item:hover,
.nav-item.is-active {
  background: #e8f3f1;
  color: var(--teal-strong);
}

.nav-item svg,
.button svg,
.icon-button svg,
.empty-state svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar-footer {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f9fbfc;
}

.sidebar-footer strong {
  display: block;
  margin-top: 4px;
  color: var(--teal-strong);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 0 4px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--teal-strong);
  text-decoration: underline;
}

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

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

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(68px, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #fff;
}

.segment {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
}

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

.user-picker {
  display: grid;
  gap: 4px;
  min-width: 168px;
  color: var(--muted);
  font-size: 12px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

select,
input {
  height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 10px 11px;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.icon-button {
  width: 40px;
  height: 40px;
  border-color: var(--line);
  background: #fff;
}

.button {
  min-height: 40px;
  padding: 0 14px;
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

.button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.button.warning {
  border-color: #e9c46a;
  background: #fff8e8;
  color: #8a5a00;
}

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

.view-root {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
}

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

.panel,
.item-card,
.composer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.composer {
  padding: 18px;
}

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

.panel-header h3,
.item-card h4,
.stat strong {
  margin: 0;
  color: var(--ink);
}

.panel-header h3 {
  font-size: 18px;
}

.item-card h4 {
  font-size: 16px;
}

.item-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.item-list {
  display: grid;
  gap: 12px;
}

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

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

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

.lab-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px solid #b9ddd9;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.1), rgba(37, 99, 235, 0.08)),
    #fff;
  padding: 18px;
}

.lab-strip h3 {
  margin: 0 0 6px;
  color: var(--ink);
}

.lab-strip p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.lab-visual {
  display: grid;
  width: 156px;
  grid-template-columns: repeat(4, 32px);
  gap: 8px;
  justify-content: end;
}

.mini-avatar-tile {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  color: var(--text);
  font-weight: 500;
}

.check-row input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.profile-row,
.title-row,
.meta-row,
.comment-row,
.timeline-item,
.feed-item,
.assignment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.title-row,
.meta-row,
.panel-header {
  flex-wrap: wrap;
}

.profile-row strong,
.title-row h4,
.assignment-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.avatar {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
  color: #fff;
  font-weight: 800;
}

.avatar.small {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-stack .avatar {
  margin-left: -8px;
}

.avatar-stack .avatar:first-child {
  margin-left: 0;
}

.pill,
.status-badge,
.priority {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 4px 8px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-badge.green {
  background: #e7f7ee;
  color: var(--green);
}

.status-badge.blue {
  background: #eaf1ff;
  color: var(--blue);
}

.status-badge.amber {
  background: #fff6df;
  color: var(--amber);
}

.status-badge.rose {
  background: #fff0f3;
  color: var(--rose);
}

.progress-wrap {
  display: grid;
  gap: 7px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e5eaf0;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.timeline,
.comments,
.feed-list {
  display: grid;
  gap: 10px;
}

.timeline-item,
.comment-row,
.feed-item {
  align-items: flex-start;
  border-left: 3px solid #b9ddd9;
  padding-left: 10px;
}

.timeline-item p,
.comment-row p,
.feed-item p {
  margin: 2px 0 0;
  color: var(--text);
  line-height: 1.55;
}

.comment-form,
.progress-form,
.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.progress-form {
  grid-template-columns: minmax(160px, 0.35fr) minmax(0, 1fr) auto;
}

.range-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

input[type="range"] {
  padding: 0;
}

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

.kanban-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.kanban-column h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mini-task {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.mini-task strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

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

.chore-list {
  display: grid;
  gap: 9px;
}

.chore-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text);
}

.chore-check input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
}

.chore-check.is-done span {
  color: var(--muted);
  text-decoration: line-through;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.chip-button {
  min-height: 34px;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0 12px;
}

.chip-button.is-active {
  border-color: var(--teal);
  background: #e8f3f1;
  color: var(--teal-strong);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.empty-state svg {
  color: var(--teal);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-showing {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

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

  .nav-item {
    justify-content: center;
  }

  .nav-item span {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .grid.two,
  .grid.three,
  .kanban,
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px 14px 28px;
  }

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

  .topbar-actions {
    justify-content: flex-start;
  }

  .grid.two,
  .grid.three,
  .kanban,
  .stats-grid,
  .form-grid,
  .lab-strip {
    grid-template-columns: 1fr;
  }

  .lab-visual {
    width: 100%;
    justify-content: start;
  }

  .comment-form,
  .progress-form,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(44px, 1fr));
  }
}
