:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-strong: #f0f2f5;
  --line: #dfe3e8;
  --line-strong: #c8ced7;
  --text: #1f252e;
  --muted: #737d8c;
  --blue: #3268ff;
  --blue-soft: #e8efff;
  --gold: #b98925;
  --green: #1f8f61;
  --red: #cf3f45;
  --shadow: 0 18px 40px rgba(30, 38, 51, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(50, 104, 255, 0.08), transparent 34%),
    var(--bg);
}

.login-view[hidden] {
  display: none;
}

.login-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.login-brand p {
  margin: 0;
  font-weight: 800;
}

.login-brand span,
.login-copy .eyebrow {
  color: var(--muted);
}

.login-copy {
  margin-bottom: 24px;
}

.login-copy h1 {
  margin-top: 4px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  outline: 0;
}

.login-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(50, 104, 255, 0.12);
}

.login-error {
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

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

.app-shell.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.sidebar {
  background: #f2f4f7;
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: hidden;
  transition: padding 180ms ease;
}

.sidebar-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #1f252e;
  color: #f5d37f;
  font-weight: 800;
}

.brand p,
.brand span,
.eyebrow,
.section-label {
  margin: 0;
}

.brand p {
  font-weight: 800;
}

.brand span,
.section-label,
.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: #5d6674;
  font-size: 22px;
  line-height: 1;
}

.sidebar-toggle:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 22px 10px;
  align-items: center;
}

.app-shell.sidebar-collapsed .sidebar-head {
  flex-direction: column;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand > div:not(.brand-mark),
.app-shell.sidebar-collapsed .mini-calendar,
.app-shell.sidebar-collapsed .owner-list {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.app-shell.sidebar-collapsed .side-nav {
  width: 100%;
}

.app-shell.sidebar-collapsed .nav-item {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  white-space: nowrap;
  text-indent: 52px;
  position: relative;
}

.app-shell.sidebar-collapsed .nav-item::before {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-indent: 0;
  font-weight: 800;
}

.app-shell.sidebar-collapsed .nav-item[data-view="cases"]::before {
  content: "案";
}

.app-shell.sidebar-collapsed .nav-item[data-view="projects"]::before {
  content: "项";
}

.app-shell.sidebar-collapsed .nav-item[data-view="calendar"]::before {
  content: "日";
}

.app-shell.sidebar-collapsed .nav-item[data-view="users"]::before {
  content: "员";
}

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

.nav-item {
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 12px 14px;
  text-align: left;
  color: #485160;
}

.nav-item.active,
.nav-item:hover {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.mini-calendar {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.mini-head,
.calendar-head,
.calendar-tools,
.top-actions,
.table-toolbar {
  display: flex;
  align-items: center;
}

.mini-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.mini-head button,
.icon-btn {
  border: 0;
  background: transparent;
  color: #5d6674;
  font-size: 24px;
}

.mini-weekdays,
.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px 4px;
  text-align: center;
  font-size: 14px;
  width: 100%;
  min-width: 0;
}

.mini-weekdays {
  color: #98a1ad;
  margin-bottom: 10px;
}

.mini-day {
  width: 30px;
  height: 30px;
  max-width: 100%;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #343b46;
  line-height: 1;
  padding: 0;
}

.mini-day:hover {
  background: #e8edf5;
}

.mini-day.dim {
  color: #a1a9b4;
}

.mini-day.today,
.mini-day.selected {
  background: var(--blue);
  color: #fff;
}

.lawyer-filters {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.lawyer-filter {
  border: 0;
  background: transparent;
  display: flex;
  justify-content: space-between;
  padding: 8px 2px;
  color: #485160;
}

.lawyer-filter.active {
  color: var(--blue);
  font-weight: 700;
}

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

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 22px;
}

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

.user-menu {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.user-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1f252e;
  color: #f5d37f;
  font-weight: 800;
  flex: 0 0 30px;
}

.user-copy {
  display: grid;
  gap: 1px;
  line-height: 1.2;
}

.user-copy strong {
  font-size: 13px;
}

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

.auth-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -8px 0 18px;
  padding: 12px 14px;
  border: 1px solid #f4c15d;
  border-radius: 8px;
  background: #fff8e8;
  color: #7c560f;
}

.auth-banner[hidden] {
  display: none;
}

.auth-banner strong {
  color: #4f390c;
  white-space: nowrap;
}

.search-box {
  width: 280px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.segment {
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 9px 14px;
  min-height: 38px;
}

.primary-btn {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.primary-btn:disabled,
.secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.secondary-btn,
.ghost-btn,
.segment {
  background: var(--panel);
  color: var(--text);
}

.danger-btn {
  background: #fff1f1;
  color: var(--red);
  border-color: #ffd2d2;
  margin-right: auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.admin-only[hidden] {
  display: none;
}

.member-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.member-head span {
  color: var(--muted);
}

.member-table td:last-child {
  white-space: nowrap;
}

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

.link-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 4px 0;
  font-weight: 700;
}

.link-btn.danger-link {
  color: var(--red);
}

.table-toolbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

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

.segmented {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  display: flex;
}

.segment {
  border: 0;
  border-radius: 7px;
}

.segment.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.case-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1120px;
}

.case-table th,
.case-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.case-table th {
  position: sticky;
  top: 0;
  background: #fbfcfd;
  color: #4a5260;
  font-weight: 700;
  z-index: 1;
}

.case-table tr:hover td {
  background: #fbfcff;
}

.case-table tr {
  cursor: pointer;
}

.case-name {
  font-weight: 700;
  color: #202733;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  background: #f5e9d9;
  color: #704b1a;
}

.pill.blue {
  background: #e7efff;
  color: #245fe8;
}

.pill.green {
  background: #dff5ea;
  color: #166842;
}

.pill.red {
  background: #ffe6e8;
  color: #a92d34;
}

.progress-cell {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-title-block {
  display: grid;
  gap: 4px;
}

.calendar-title-block span {
  color: var(--muted);
  font-size: 13px;
}

.calendar-tools {
  gap: 8px;
}

.calendar-tools select {
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--panel);
}

.calendar-grid {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 14px;
}

.fc {
  --fc-border-color: var(--line);
  --fc-button-bg-color: var(--panel);
  --fc-button-border-color: var(--line);
  --fc-button-text-color: var(--text);
  --fc-button-hover-bg-color: var(--blue-soft);
  --fc-button-hover-border-color: #b9c9ff;
  --fc-button-active-bg-color: var(--blue);
  --fc-button-active-border-color: var(--blue);
  --fc-today-bg-color: #f4f7ff;
  color: var(--text);
  font-size: 14px;
}

.fc .fc-toolbar {
  gap: 12px;
  align-items: center;
}

.fc .fc-toolbar-title {
  font-size: 22px;
  letter-spacing: 0;
}

.fc .fc-button {
  border-radius: 8px;
  box-shadow: none;
  padding: 8px 12px;
  min-height: 36px;
}

.fc .fc-button-primary:disabled {
  opacity: 0.65;
  background: var(--panel-strong);
  color: var(--muted);
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
  color: var(--text);
  text-decoration: none;
}

.fc .fc-event {
  border: 1px solid currentColor;
  border-left-width: 4px;
  border-radius: 5px;
  padding: 2px 4px;
  cursor: pointer;
  box-shadow: none;
}

.fc .fc-event-main {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: inherit;
}

.fc .fc-event-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

.fc .fc-event-title,
.fc .fc-event-time {
  color: inherit;
}

.fc .task-event-normal {
  background: #f7faff;
  color: #3268ff;
}

.fc .task-event-important {
  background: #fff9eb;
  color: #b98925;
}

.fc .task-event-urgent {
  background: #fff5f5;
  color: #cf3f45;
}

.fc .task-event-done {
  background: #f4fbf7;
  color: #1f8f61;
}

.calendar-fallback {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

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

.project-head > div:first-child {
  display: grid;
  gap: 4px;
}

.project-head span {
  color: var(--muted);
  font-size: 13px;
}

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

.project-tab {
  border: 0;
  border-radius: 7px;
  background: transparent;
  min-height: 38px;
  padding: 8px 16px;
  color: #4b5563;
  font-weight: 700;
}

.project-tab.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.project-panel {
  display: none;
}

.project-panel.active {
  display: block;
}

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

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

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

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

.project-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.project-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 980px;
}

.project-table th,
.project-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
  text-align: left;
  vertical-align: middle;
}

.project-table th {
  background: #fbfcfd;
  color: #4a5260;
}

.project-table tr {
  cursor: pointer;
}

.project-table tr:hover td {
  background: #fbfcff;
}

.progress-stack {
  display: grid;
  gap: 7px;
  min-width: 160px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  color: #4b5563;
  font-size: 13px;
}

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

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

.risk-ok {
  color: var(--green);
  font-weight: 800;
}

.risk-watch {
  color: var(--gold);
  font-weight: 800;
}

.risk-hot {
  color: var(--red);
  font-weight: 800;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 14px;
  overflow-x: auto;
}

.kanban-column {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 520px;
  padding: 12px;
}

.kanban-column h3 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 12px;
  font-size: 16px;
}

.kanban-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
  text-align: left;
  margin-bottom: 10px;
}

.kanban-card:hover {
  border-color: #b9c9ff;
  background: #f7faff;
}

.kanban-card-title {
  font-weight: 800;
  line-height: 1.35;
}

.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.kanban-empty {
  color: var(--muted);
  padding: 20px 6px;
  text-align: center;
}

.gantt-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
}

.gantt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.gantt-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.gantt-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-normal {
  background: var(--blue);
}

.legend-important {
  background: var(--gold);
}

.legend-urgent {
  background: var(--red);
}

.legend-done {
  background: var(--green);
}

.gantt-zoom {
  display: flex;
  grid-auto-flow: column;
  grid-template-columns: auto 160px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.gantt-zoom input {
  width: 160px;
  padding: 0;
}

.gantt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.gantt-toggle input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.gantt-scale {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.gantt-scale-btn {
  border: 0;
  border-radius: 6px;
  background: transparent;
  min-width: 38px;
  min-height: 32px;
  padding: 6px 10px;
  color: #4b5563;
  font-weight: 800;
}

.gantt-scale-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.gantt-board {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.gantt-inner {
  min-width: var(--gantt-width, 1268px);
}

.gantt-header,
.gantt-row {
  display: grid;
  grid-template-columns: 260px repeat(var(--gantt-day-count, 14), var(--gantt-day-width, 72px));
}

.gantt-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.gantt-header div,
.gantt-label,
.gantt-cell {
  border-right: 1px solid var(--line);
}

.gantt-header div {
  padding: 10px 8px;
  color: #4a5260;
  font-weight: 800;
  text-align: center;
}

.gantt-header div:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fbfcfd;
}

.gantt-label {
  padding: 12px 14px;
  background: #fff;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 100%;
  position: sticky;
  left: 0;
  z-index: 1;
}

.gantt-row {
  border-bottom: 1px solid var(--line);
}

.gantt-track {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(var(--gantt-day-count, 14), var(--gantt-day-width, 72px));
  position: relative;
}

.gantt-cell {
  min-height: 100%;
  background: linear-gradient(#fff, #fff);
}

.gantt-bar {
  position: absolute;
  height: 26px;
  border-radius: 6px;
  border: 1px solid currentColor;
  border-left-width: 4px;
  color: var(--blue);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gantt-bar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-bar.normal {
  background: #f7faff;
  color: var(--blue);
}

.gantt-bar.important {
  background: #fff9eb;
  color: var(--gold);
}

.gantt-bar.urgent {
  background: #fff5f5;
  color: var(--red);
}

.gantt-bar.done {
  background: #f4fbf7;
  color: var(--green);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin: -4px 0 18px;
}

.breadcrumb button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
}

.breadcrumb button:hover {
  color: var(--blue);
}

.breadcrumb strong {
  color: #4b5563;
}

.detail-hero,
.detail-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.detail-hero {
  min-height: 160px;
  padding: 28px 32px;
  position: relative;
}

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

.detail-title-row h2 {
  font-size: 24px;
  line-height: 1.35;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  color: var(--muted);
  margin-top: 16px;
}

.detail-meta span {
  display: inline-flex;
  gap: 6px;
}

.detail-meta strong {
  color: #495160;
}

.detail-actions {
  position: absolute;
  right: 32px;
  bottom: 24px;
  display: flex;
  gap: 10px;
}

.detail-tabs {
  display: flex;
  gap: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 16px 0;
  padding: 0 32px;
}

.detail-tab {
  border: 0;
  background: transparent;
  min-height: 58px;
  padding: 0;
  color: #4b5563;
  border-bottom: 3px solid transparent;
  font-weight: 700;
}

.detail-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.detail-panel {
  display: none;
}

.detail-panel.active {
  display: block;
}

.detail-section {
  min-height: 360px;
  padding: 28px 32px;
  margin-bottom: 16px;
}

.detail-section h3 {
  margin: 0 0 22px;
  font-size: 22px;
}

.detail-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.detail-section-head h3 {
  margin: 0;
}

.activity-timeline {
  display: grid;
  gap: 0;
  max-width: 920px;
}

.activity-item {
  display: grid;
  grid-template-columns: 104px 28px minmax(0, 1fr);
  column-gap: 14px;
  min-height: 58px;
  color: #596272;
}

.activity-date {
  text-align: right;
  color: #4b5563;
  font-weight: 700;
}

.activity-dot {
  position: relative;
  display: flex;
  justify-content: center;
}

.activity-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border: 3px solid var(--blue);
  border-radius: 999px;
  background: var(--panel);
  z-index: 1;
}

.activity-dot::after {
  content: "";
  position: absolute;
  top: 20px;
  bottom: -12px;
  border-left: 1px dashed var(--line-strong);
}

.activity-item:last-child .activity-dot::after {
  display: none;
}

.activity-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding-bottom: 18px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e8efff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 30px;
}

.activity-copy {
  padding-top: 4px;
  font-weight: 700;
}

.activity-copy span {
  color: var(--muted);
  font-weight: 500;
}

.empty-state {
  color: var(--muted);
  padding: 20px 0;
}

.detail-task-list {
  display: grid;
  gap: 10px;
}

.strategy-summary-section {
  min-height: 0;
}

.strategy-status {
  display: grid;
  grid-template-columns: auto minmax(220px, 360px);
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.strategy-summary-grid,
.strategy-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

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

.strategy-card strong {
  display: block;
  color: #4a5260;
  margin-bottom: 8px;
}

.strategy-card p {
  margin: 0;
  color: #222936;
  line-height: 1.6;
  white-space: pre-wrap;
}

.detail-task-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px 110px 110px 90px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfcfd;
  text-align: left;
}

.detail-task-row:hover {
  border-color: #b9c9ff;
  background: #f7faff;
}

.detail-task-title {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-task-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-status-icon {
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 14px;
  border-radius: 4px;
  border: 2px solid currentColor;
  color: #7b8492;
}

.task-status-icon.done {
  color: var(--green);
  background: var(--green);
  border-color: var(--green);
}

.task-status-icon.done::before {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.task-status-icon.doing {
  color: var(--blue);
  border-radius: 50%;
  border-color: var(--blue);
  position: relative;
}

.task-status-icon.doing::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

.task-status-icon.todo {
  color: #8a93a1;
  background: #fff;
}

.gantt-bar .task-status-icon,
.fc .task-status-icon {
  width: 12px;
  height: 12px;
  flex-basis: 12px;
  color: currentColor;
  border-color: currentColor;
}

.gantt-bar .task-status-icon.todo,
.fc .task-status-icon.todo {
  background: transparent;
}

.gantt-bar .task-status-icon.done,
.fc .task-status-icon.done {
  background: currentColor;
  border-color: currentColor;
}

.gantt-bar .task-status-icon.done::before,
.fc .task-status-icon.done::before {
  border-color: #fff;
  width: 6px;
  height: 3px;
}

.gantt-bar .task-status-icon.doing,
.fc .task-status-icon.doing {
  background: transparent;
}

.gantt-bar .task-status-icon.doing::before,
.fc .task-status-icon.doing::before {
  width: 5px;
  height: 5px;
  background: currentColor;
}

.detail-task-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog {
  border: 0;
  border-radius: 14px;
  width: min(760px, calc(100vw - 28px));
  box-shadow: var(--shadow);
  padding: 0;
}

.small-dialog {
  width: min(460px, calc(100vw - 28px));
}

.dialog::backdrop {
  background: rgba(15, 20, 29, 0.42);
}

.dialog form {
  padding: 22px;
}

.dialog header,
.dialog footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.dialog footer {
  justify-content: flex-end;
  margin-top: 18px;
}

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

label {
  display: grid;
  gap: 6px;
  color: #485160;
  font-weight: 700;
  font-size: 14px;
}

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

.field-hidden {
  display: none;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

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

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .app-shell.sidebar-collapsed .sidebar {
    display: none;
  }

  .topbar,
  .calendar-head,
  .table-toolbar,
  .project-head,
  .detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .kanban-board {
    grid-template-columns: repeat(4, 260px);
  }

  .detail-actions {
    position: static;
    margin-top: 20px;
  }

  .detail-task-row {
    grid-template-columns: 1fr 1fr;
  }

  .strategy-status,
  .strategy-summary-grid,
  .strategy-detail-grid {
    grid-template-columns: 1fr;
  }

  .search-box,
  .calendar-tools select {
    width: 100%;
  }

  .calendar-grid {
    overflow-x: auto;
  }

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

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 20px 14px 28px;
  }

  .top-actions,
  .calendar-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .user-menu {
    border-radius: 8px;
    justify-content: flex-start;
  }

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

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

  .project-tabs {
    overflow-x: auto;
  }

  .detail-hero,
  .detail-section {
    padding: 22px 18px;
  }

  .detail-tabs {
    padding: 0 18px;
  }

  .activity-item {
    grid-template-columns: 70px 24px minmax(0, 1fr);
    column-gap: 10px;
  }

  .detail-task-row {
    grid-template-columns: 1fr;
  }
}
