:root {
  --bg: #f5f7fb;
  --bg-deep: #e8edf6;
  --ink: #172033;
  --muted: #667085;
  --line: #d8e0ec;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --accent: #2457c5;
  --accent-deep: #183f96;
  --olive: #1d6b63;
  --gold: #a46a18;
  --ocean: #1463a5;
  --danger: #b42318;
  --shadow: 0 10px 28px rgba(16, 24, 40, 0.08);
  --radius-xl: 8px;
  --radius-lg: 8px;
  --radius-md: 8px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

.ambient {
  display: none;
}

.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 0;
  min-height: 100vh;
  padding: 0;
  transition: grid-template-columns 180ms ease;
}

.sidebar-collapsed .shell {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar,
.panel,
.hero {
  box-shadow: var(--shadow);
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #11203d 0%, #16243a 58%, #1d3d49 100%);
  color: #f3f7ff;
  transition: padding 180ms ease;
}

.sidebar-toggle {
  position: absolute;
  top: 22px;
  right: -15px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: #2457c5;
  color: white;
  font-size: 18px;
  box-shadow: 0 10px 24px rgba(34, 72, 160, 0.2);
}

.sidebar-collapsed .sidebar {
  padding: 18px 12px;
}

.sidebar-collapsed .brand {
  justify-content: center;
}

.sidebar-collapsed .brand > div:not(.brand-mark),
.sidebar-collapsed .sidebar-card {
  display: none;
}

.sidebar-collapsed .nav-link {
  justify-items: center;
  padding: 12px 8px;
}

.sidebar-collapsed .nav-link span {
  display: none;
}

.sidebar-collapsed .nav-link strong {
  font-size: 12px;
  text-align: center;
}

.brand {
  display: grid;
  gap: 8px;
  align-items: start;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 122px;
  height: 40px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.brand-logo {
  display: block;
  width: 112px;
  max-width: none;
  height: auto;
}

.sidebar-collapsed .brand-mark {
  width: 48px;
  height: 32px;
}

.sidebar-collapsed .brand-logo {
  width: 72px;
}

.brand h1,
.brand p,
.hero h2,
.hero p,
.panel h3,
.panel h4 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.25;
}

.brand-copy {
  margin-top: 4px;
  color: rgba(243, 247, 255, 0.74);
  line-height: 1.45;
  font-size: 12px;
}

.overline {
  color: rgba(186, 208, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.nav-link span {
  color: rgba(224, 234, 255, 0.76);
  font-size: 12px;
}

.nav-link strong {
  font-size: 16px;
  font-weight: 700;
}

.nav-link.active {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-card {
  padding: 14px;
  border: 1px solid rgba(196, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(243, 247, 255, 0.06);
}

.sidebar-label {
  margin: 0 0 12px;
  color: rgba(186, 208, 255, 0.9);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.role-switches {
  display: grid;
  gap: 10px;
}

.role-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(196, 214, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
}

.role-pill.active {
  background: rgba(164, 192, 255, 0.16);
  border-color: rgba(164, 192, 255, 0.28);
}

.current-role-pill {
  cursor: default;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  color: rgba(243, 247, 255, 0.8);
  line-height: 1.7;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 18px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.hero h2 {
  font-size: 24px;
  line-height: 1.2;
}

.hero-copy {
  max-width: 720px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.identity-card {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 260px;
  padding: 12px 14px;
  border: 1px solid rgba(71, 48, 28, 0.12);
  border-radius: 8px;
  background: #f8fafc;
}

.identity-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2457c5, #1d6b63);
  color: white;
  font-weight: 800;
}

.identity-card p {
  font-weight: 700;
}

.identity-card small {
  color: var(--muted);
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
  border: 0;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #1d6b63);
  color: white;
}

.ghost-button {
  border: 1px solid rgba(71, 48, 28, 0.12);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.danger-button {
  border: 1px solid rgba(180, 35, 24, 0.2);
  background: rgba(255, 247, 245, 0.95);
  color: var(--danger);
}

.view {
  display: none;
  gap: 22px;
  min-width: 0;
}

.view.active {
  display: grid;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
}

.auth-required .nav-link:not([data-view-target="dashboard"]) {
  display: none;
}

.auth-required-card {
  grid-column: 1 / -1;
  min-height: 180px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.auth-required-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.auth-required-card h3 {
  margin: 10px 0 8px;
  font-size: 24px;
}

.auth-required-card p {
  max-width: 560px;
  margin: 0 0 18px;
  color: var(--muted);
}

.metric-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.metric-card span {
  display: block;
  font-size: 30px;
  font-weight: 800;
  color: var(--accent-deep);
}

.metric-card p {
  margin: 10px 0 0;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.dashboard-grid.bottom {
  grid-template-columns: 1fr 1fr;
}

.panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.panel-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 700;
}

.panel h3 {
  font-size: 20px;
}

.toolbar-actions,
.message-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tracking-sort-actions {
  align-items: center;
  justify-content: flex-end;
}

.segmented-control {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid rgba(35, 87, 216, 0.18);
  border-radius: 8px;
  background: #ffffff;
}

.segment-button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid rgba(35, 87, 216, 0.12);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.segment-button:last-child {
  border-right: 0;
}

.segment-button.active {
  background: rgba(35, 87, 216, 0.1);
  color: var(--accent-deep);
}

.tracking-clear-filter {
  min-height: 36px;
  padding: 0 12px;
}

.closed-stage-toggle {
  min-height: 36px;
  padding: 0 12px;
}

.closed-stage-toggle.active {
  border-color: rgba(35, 87, 216, 0.24);
  background: rgba(35, 87, 216, 0.1);
  color: var(--accent-deep);
}

.spotlight-list,
.timeline,
.mini-list {
  display: grid;
  gap: 12px;
}

.attention-card,
.timeline-item,
.mini-item,
.message-card,
.automation-grid button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.attention-card {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 18px;
  color: inherit;
  text-align: left;
}

.empty-card {
  padding: 18px;
  color: var(--muted);
}

.attention-top,
.attention-bottom,
.message-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.attention-card h4,
.message-card h4 {
  margin: 0;
  font-size: 20px;
}

.attention-card p,
.timeline-item p,
.message-card p,
.automation-grid p,
.form-note,
.mini-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.pill,
.status-badge,
.table-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill {
  background: rgba(35, 87, 216, 0.1);
  color: var(--ocean);
}

.pill.urgent {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.status-badge {
  background: rgba(35, 87, 216, 0.1);
  color: var(--ocean);
}

.status-badge.alert {
  background: rgba(212, 155, 46, 0.18);
  color: #8b5c00;
}

.muted-text {
  color: var(--muted);
  font-size: 12px;
}

.timeline-item,
.mini-item {
  padding: 14px;
}

.timeline-item strong,
.mini-item strong {
  display: block;
  margin-bottom: 6px;
}

.timeline-more {
  justify-self: center;
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.mini-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mini-item-top strong {
  margin-bottom: 6px;
}

.mini-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mini-link {
  border: 0;
  background: transparent;
  color: var(--ocean);
  cursor: pointer;
  font-weight: 700;
  padding: 0;
}

.integration-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.data-management {
  display: grid;
  gap: 14px;
}

.data-management p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.integration-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill.success {
  color: #067647;
  background: rgba(6, 118, 71, 0.1);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.status-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
}

.status-grid span {
  color: var(--muted);
  font-size: 12px;
}

.capability-list {
  display: grid;
  gap: 6px;
}

.capability-list p {
  margin: 0;
  color: var(--muted);
}

.reminder-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.reminder-list {
  display: grid;
  gap: 10px;
}

.reminder-section {
  display: grid;
  gap: 10px;
}

.reminder-section h4,
.reminder-handled h4 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.reminder-item {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(180, 35, 24, 0.14);
  border-radius: 8px;
  background: #fff7f5;
}

.reminder-item.handled {
  border-color: var(--line);
  background: #f8fafc;
}

.reminder-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.reminder-item > div:nth-child(2),
.reminder-item > div:nth-child(3) {
  display: grid;
  gap: 6px;
}

.reminder-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.reminder-handled {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.link-button:hover,
.mini-link:hover {
  color: var(--accent);
}

.grouped-info-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 180px;
}

.info-chip {
  max-width: 180px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-chip.more {
  color: var(--muted);
}

.project-doc-cell {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.project-doc-summary,
.project-doc-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.project-doc-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.project-doc-actions {
  display: flex;
}

.doc-chip {
  max-width: 160px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-chip.link {
  border-color: rgba(36, 87, 197, 0.24);
  background: #f7fbff;
  color: var(--accent-deep);
  text-decoration: none;
}

.doc-chip.file {
  cursor: pointer;
}

.doc-chip.more {
  color: var(--muted);
}

.doc-chip:hover {
  border-color: rgba(36, 87, 197, 0.42);
  background: #eef5ff;
}

.danger-link {
  color: var(--danger);
}

.automation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.automation-grid button {
  padding: 18px;
  color: inherit;
  text-align: left;
}

.metric-card {
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.metric-card:hover,
.attention-card:hover,
.automation-grid button:hover {
  border-color: rgba(36, 87, 197, 0.38);
  background: #f8fbff;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

#customersTable,
#projectsTable,
#trackingTable {
  max-height: min(70vh, 720px);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #ffffff;
}

table[data-table-id] {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #344054;
  font-weight: 800;
}

td[data-editable="true"] {
  position: relative;
  cursor: text;
}

td[data-editable="true"]:hover {
  background: rgba(35, 87, 216, 0.06);
}

td[data-editable="true"]:hover::after {
  content: "双击编辑";
  position: absolute;
  right: 8px;
  bottom: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(35, 87, 216, 0.1);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

td.editing-cell:hover::after {
  display: none;
}

.editing-cell {
  background: rgba(234, 242, 255, 0.96);
}

.inline-editor {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.inline-editor input,
.inline-editor select {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(35, 87, 216, 0.24);
  border-radius: 8px;
  background: #fff;
  padding: 6px 8px;
  color: var(--ink);
  font: inherit;
}

.inline-editor select[multiple] {
  min-height: 96px;
}

.checkbox-dropdown {
  position: relative;
}

.checkbox-dropdown-trigger {
  position: relative;
  width: 100%;
  min-height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid rgba(35, 87, 216, 0.24);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkbox-dropdown-trigger::after {
  content: "▾";
  position: absolute;
  right: 10px;
  color: var(--muted);
  font-size: 11px;
}

.checkbox-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 10;
  display: grid;
  gap: 4px;
  width: 260px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(35, 87, 216, 0.18);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(34, 72, 160, 0.16);
}

.checkbox-dropdown-menu label {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1.35;
}

.checkbox-dropdown-menu label:hover {
  background: rgba(35, 87, 216, 0.06);
}

.checkbox-dropdown-menu input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.checkbox-dropdown-menu span {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.checkbox-group label {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--ink);
  font-weight: 600;
}

.checkbox-group label:hover {
  background: rgba(35, 87, 216, 0.06);
}

.checkbox-group input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.checkbox-group span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(234, 242, 255, 0.98);
  color: #35508a;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

th[data-key] {
  position: sticky;
}

table[data-table-id] th:first-child,
table[data-table-id] td:not(.empty-row):first-child {
  position: sticky;
  left: 0;
  box-shadow: 1px 0 0 var(--line);
}

table[data-table-id] th:first-child {
  z-index: 6;
}

table[data-table-id] td:not(.empty-row):first-child {
  z-index: 3;
  background: rgba(255, 255, 255, 0.98);
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 2;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.col-resizer::after {
  content: "";
  position: absolute;
  top: 25%;
  right: 3px;
  width: 1px;
  height: 50%;
  background: rgba(35, 87, 216, 0.22);
}

body.resizing-column {
  cursor: col-resize;
  user-select: none;
}

tbody tr:hover {
  background: rgba(240, 246, 255, 0.84);
}

tbody tr:hover td:not(.empty-row):first-child {
  background: rgba(240, 246, 255, 0.98);
}

tbody tr.stale-row {
  background: rgba(180, 35, 24, 0.1);
  box-shadow: inset 4px 0 0 rgba(180, 35, 24, 0.72);
}

tbody tr.stale-row td:not(.empty-row):first-child {
  background: rgb(253, 239, 238);
}

tbody tr.stale-row:hover {
  background: rgba(180, 35, 24, 0.15);
}

tbody tr.stale-row:hover td:not(.empty-row):first-child {
  background: rgb(251, 231, 229);
}

tbody tr.selected-row {
  outline: 2px solid rgba(35, 87, 216, 0.38);
  outline-offset: -2px;
  background: rgba(35, 87, 216, 0.08);
}

tbody tr.selected-row td:not(.empty-row):first-child {
  background: rgb(235, 242, 255);
}

.table-title {
  font-weight: 700;
  min-width: 120px;
}

.table-subtle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.history-list {
  display: grid;
  gap: 6px;
  min-width: 260px;
  max-width: 420px;
  max-height: 148px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.history-list p {
  margin: 0;
  padding: 6px 8px;
  border-left: 3px solid rgba(35, 87, 216, 0.28);
  border-radius: 8px;
  background: rgba(35, 87, 216, 0.04);
  line-height: 1.45;
}

.history-list.muted {
  color: var(--muted);
}

.history-list::-webkit-scrollbar {
  width: 8px;
}

.history-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(35, 87, 216, 0.24);
}

.history-list::-webkit-scrollbar-track {
  background: rgba(35, 87, 216, 0.06);
  border-radius: 999px;
}

.tracking-mobile-list {
  display: none;
}

.tracking-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(35, 87, 216, 0.14);
  border-radius: 8px;
  background: #fff;
}

.tracking-list-card {
  cursor: default;
}

.tracking-card.stale-card {
  border-color: rgba(180, 35, 24, 0.2);
  background: rgba(180, 35, 24, 0.03);
}

.tracking-card.empty-card {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.tracking-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.tracking-card h4 {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
}

.tracking-card p {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.tracking-card-head p,
.tracking-card-section span,
.tracking-card-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tracking-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.tracking-card-meta div {
  display: grid;
  gap: 4px;
}

.tracking-card-meta dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.tracking-card-section {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.tracking-card-clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tracking-card-clamp.one-line {
  -webkit-line-clamp: 1;
}

.tracking-card-section .history-list {
  max-width: none;
  max-height: 150px;
  min-width: 0;
}

.tracking-card textarea,
.tracking-card select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}

.tracking-card textarea {
  min-height: 116px;
  resize: vertical;
}

.tracking-card textarea:focus,
.tracking-card select:focus {
  outline: 2px solid rgba(35, 87, 216, 0.18);
  border-color: rgba(35, 87, 216, 0.45);
}

.tracking-card textarea:disabled,
.tracking-card select:disabled {
  background: #f6f8fc;
  color: var(--muted);
  cursor: not-allowed;
}

.tracking-mobile-detail {
  display: none;
}

.tracking-detail-card {
  max-width: 760px;
}

.tracking-detail-quick-card {
  gap: 16px;
}

.tracking-detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tracking-detail-title h4 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.tracking-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rules-edit-table td[data-rule-key] {
  position: relative;
  cursor: text;
}

.rules-edit-table td[data-rule-key]:hover {
  background: rgba(35, 87, 216, 0.06);
}

.rules-edit-table td[data-rule-key]:hover::after {
  content: "双击编辑";
  position: absolute;
  right: 8px;
  bottom: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(35, 87, 216, 0.1);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

.rules-edit-table td.editing-cell:hover::after {
  display: none;
}

.rules-edit-table {
  min-width: 1120px;
}

.rule-preview {
  min-width: 260px;
  color: var(--muted);
  line-height: 1.45;
}

.table-tag {
  background: rgba(35, 87, 216, 0.1);
  color: var(--accent-deep);
}

.table-tag.success {
  background: rgba(23, 128, 90, 0.12);
  color: #16735b;
}

.table-tag.muted {
  background: rgba(92, 111, 150, 0.12);
  color: var(--muted);
}

.table-tag.done {
  background: rgba(54, 100, 122, 0.12);
  color: var(--olive);
}

.table-tag.alert {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.row-action {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(35, 87, 216, 0.16);
  border-radius: 999px;
  background: rgba(35, 87, 216, 0.08);
  color: var(--accent-deep);
  font-weight: 800;
}

.tracking-layout,
.settings-grid {
  display: grid;
  gap: 18px;
}

.tracking-layout {
  grid-template-columns: minmax(0, 1fr);
}

td[data-editable="true"] {
  cursor: text;
}

td[data-editable="true"]:hover {
  background: rgba(35, 87, 216, 0.06);
}

td.focus-ring {
  box-shadow: inset 0 0 0 2px rgba(35, 87, 216, 0.26);
}

.mock-form {
  display: grid;
  gap: 14px;
}

.side-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.side-summary div {
  padding: 10px;
  border: 1px solid rgba(35, 87, 216, 0.12);
  border-radius: 12px;
  background: rgba(35, 87, 216, 0.05);
}

.side-summary span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.side-summary strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-text {
  color: var(--danger) !important;
}

.mock-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mock-form input,
.mock-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
}

.tracking-editor textarea {
  min-height: 110px;
  padding: 8px 10px;
  resize: vertical;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-grid .settings-wide {
  grid-column: 1 / -1;
}

.settings-danger-zone {
  border-color: rgba(180, 35, 24, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 245, 0.8));
}

.settings-danger-zone .panel-kicker {
  color: var(--danger);
}

.dictionary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.chip-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
}

.dictionary-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chip-delete {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
  font-weight: 800;
  line-height: 1;
}

.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.filter-head span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-head.compact span {
  flex: 1;
}

.filter-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(35, 87, 216, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 12px;
}

.filter-icon.active {
  border-color: rgba(35, 87, 216, 0.42);
  background: rgba(35, 87, 216, 0.12);
  color: var(--accent-deep);
}

.filter-popover {
  position: fixed;
  z-index: 20;
  width: min(280px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid rgba(25, 42, 70, 0.12);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(17, 32, 61, 0.16);
}

.modal {
  width: min(780px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
}

.modal::backdrop {
  background: rgba(9, 21, 50, 0.44);
  backdrop-filter: blur(4px);
}

.modal-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 20px;
  background: rgba(252, 254, 255, 0.98);
  box-shadow: 0 28px 70px rgba(17, 32, 61, 0.24);
}

.modal-head,
.modal-actions,
.inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 24px;
}

.modal-body {
  display: grid;
  gap: 16px;
}

.project-document-modal {
  width: min(920px, calc(100vw - 32px));
}

.project-document-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.document-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.document-section-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.document-section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.document-url-list,
.document-file-list {
  display: grid;
  gap: 10px;
}

.document-url-row {
  display: grid;
  grid-template-columns: 24px minmax(220px, 1.3fr) minmax(180px, 0.7fr);
  align-items: center;
  gap: 10px;
}

.document-url-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.document-url-row input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.document-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.document-file-row > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.document-file-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-file-row span {
  color: var(--muted);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.single,
.form-stack {
  grid-template-columns: 1fr;
}

.form-span-all {
  grid-column: 1 / -1;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.form-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
}

.people-picker {
  position: relative;
  display: grid;
}

.people-select {
  cursor: text;
}

.people-picker-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  display: grid;
  gap: 6px;
  width: min(360px, 80vw);
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid rgba(35, 87, 216, 0.18);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(34, 72, 160, 0.18);
}

.people-picker-panel[hidden] {
  display: none;
}

.people-picker-status {
  padding: 4px 6px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.people-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.people-option:hover {
  background: rgba(35, 87, 216, 0.07);
}

.people-option strong,
.people-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.people-option strong {
  font-size: 14px;
}

.people-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.people-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #2f61dd;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.muted-option {
  display: block;
  min-height: 34px;
  color: var(--muted);
  font-weight: 800;
}

.form-field select[multiple] {
  min-height: 120px;
}

.form-field textarea {
  min-height: 120px;
  padding-top: 12px;
  resize: vertical;
}

.repeatable-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.repeatable-head,
.repeatable-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.repeatable-head {
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.repeatable-list {
  display: grid;
  gap: 8px;
}

.repeatable-row {
  align-items: stretch;
}

.repeatable-row input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.picker-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.picker-input button,
.mini-button {
  border: 1px solid rgba(35, 87, 216, 0.16);
  border-radius: 12px;
  background: rgba(35, 87, 216, 0.08);
  color: var(--accent-deep);
  font-weight: 800;
}

.picker-input button {
  padding: 0 12px;
}

.mini-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
}

.ai-preview {
  padding: 14px;
  border: 1px solid rgba(35, 87, 216, 0.12);
  border-radius: 14px;
  background: rgba(35, 87, 216, 0.06);
}

.ai-preview p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.filter-popover-head,
.filter-popover-actions,
.range-inputs {
  display: flex;
  gap: 8px;
}

.filter-popover-head {
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 8px;
}

.filter-popover-head strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.filter-popover-head button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(25, 42, 70, 0.06);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.filter-popover-head button:hover {
  background: rgba(35, 87, 216, 0.1);
  color: var(--accent-deep);
}

.filter-control input,
.filter-control select {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
}

.multi-options {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
  padding: 2px;
}

.filter-option {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
}

.filter-option:hover {
  background: rgba(35, 87, 216, 0.06);
}

.filter-option input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.option-check {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(35, 87, 216, 0.28);
  border-radius: 5px;
  background: #ffffff;
}

.option-check::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
}

.filter-option input[type="checkbox"]:checked + .option-check {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
}

.filter-option input[type="checkbox"]:checked + .option-check::after {
  opacity: 1;
}

.option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.filter-popover-actions {
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(25, 42, 70, 0.08);
}

.compact-button {
  min-height: 36px;
  border-radius: 10px;
}

.empty-row {
  height: 120px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  padding: 12px 16px;
  border: 1px solid rgba(35, 87, 216, 0.18);
  border-radius: 14px;
  background: rgba(17, 32, 61, 0.94);
  color: white;
  box-shadow: 0 18px 36px rgba(17, 32, 61, 0.22);
}

.compact table {
  min-width: 680px;
}

@media (max-width: 1200px) {
  .shell,
  .tracking-layout,
  .dashboard-grid,
  .dashboard-grid.bottom,
  .settings-grid,
  .dictionary-grid,
  .reminder-item {
    grid-template-columns: 1fr;
  }

  .sidebar-collapsed .shell {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 16px;
    gap: 16px;
  }

  .sidebar {
    position: static;
    border-radius: 8px;
  }

  .sidebar-toggle {
    display: none;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  #trackingTable .tracking-table-view {
    display: none;
  }

  #trackingTable .tracking-mobile-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
  }

  #trackingTable .tracking-mobile-detail {
    display: grid;
    gap: 12px;
  }
}

@media (max-width: 760px) {
  .shell {
    gap: 16px;
  }

  .hero,
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero h2 {
    font-size: 24px;
  }

  .metric-grid,
  .automation-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .document-url-row {
    grid-template-columns: 24px 1fr;
  }

  .document-url-row input[data-document-title] {
    grid-column: 2;
  }

  .document-file-row {
    align-items: stretch;
    flex-direction: column;
  }

  .repeatable-row {
    flex-direction: column;
  }

  .panel,
  .hero,
  .sidebar {
    padding: 18px;
  }

  #trackingTable .tracking-mobile-list {
    grid-template-columns: 1fr;
  }

  .tracking-card-meta {
    grid-template-columns: 1fr;
  }
}
