:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #20242b;
  --muted: #626b78;
  --line: #e3e7ed;
  --accent: #1464d2;
  --accent-soft: #e8f1ff;
  --green: #1f8a5b;
  --green-soft: #e7f6ef;
  --red: #c9352b;
  --red-soft: #fdebea;
  --amber: #a86407;
  --amber-soft: #fff3d6;
  --shadow: 0 14px 34px rgba(21, 31, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #20242b;
  font-weight: 760;
}

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

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.module-nav {
  display: grid;
  gap: 6px;
}

.module-nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 7px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.module-nav button:hover,
.module-nav button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.module-nav strong {
  min-width: 28px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
  background: #eef1f5;
  color: var(--muted);
}

.module-nav button.active strong {
  background: #d7e7ff;
  color: var(--accent);
}

.sidebar-note {
  margin-top: auto;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  background: var(--panel-soft);
}

.sidebar-note strong {
  color: var(--text);
  word-break: break-all;
}

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

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

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 680;
}

h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.subtitle {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.primary-button,
.ghost-button {
  height: 36px;
  border-radius: 7px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.metric-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.metric-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.control-band {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-wrap,
.select-wrap {
  display: grid;
  gap: 6px;
}

.search-wrap {
  flex: 1 1 320px;
}

.select-wrap {
  flex: 0 0 160px;
}

label {
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  height: 38px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 100, 210, 0.12);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.task-panel,
.insight-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.task-panel {
  padding: 15px;
}

.insight-panel {
  position: sticky;
  top: 18px;
  padding: 15px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.section-heading h3,
.section-heading h4 {
  margin: 0;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-heading.compact {
  display: block;
}

.view-toggle {
  display: flex;
  padding: 3px;
  border-radius: 7px;
  background: #eef1f5;
}

.view-toggle button {
  border: 0;
  background: transparent;
  border-radius: 5px;
  padding: 6px 10px;
  color: var(--muted);
}

.view-toggle button.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.module-section + .module-section {
  margin-top: 18px;
}

.module-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.module-title h4 {
  margin: 0;
  font-size: 16px;
}

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

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

.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 13px;
}

.task-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.status-pill,
.priority-pill,
.risk-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 650;
}

.status-pill.neutral {
  color: var(--muted);
  background: #eef1f5;
}

.status-pill.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.status-pill.blocked,
.risk-pill.high {
  color: var(--red);
  background: var(--red-soft);
}

.status-pill.done,
.risk-pill.low {
  color: var(--green);
  background: var(--green-soft);
}

.priority-pill {
  color: #5b4b00;
  background: #fff7c2;
}

.risk-pill.medium {
  color: var(--amber);
  background: var(--amber-soft);
}

.task-card h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.task-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 11px;
  color: var(--text);
  font-size: 12px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--muted);
  background: #f3f5f7;
  font-size: 12px;
}

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

.insight-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.insight-card strong {
  display: block;
  font-size: 14px;
}

.insight-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 650;
}

td small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 13px;
  border-radius: 7px;
  color: #ffffff;
  background: #20242b;
  box-shadow: var(--shadow);
  transition: 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .sidebar-note {
    margin-top: 0;
  }

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

  .insight-panel {
    position: relative;
    top: auto;
  }
}

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

  .topbar {
    display: block;
  }

  .top-actions {
    justify-content: flex-start;
    margin-top: 14px;
  }

  h2 {
    font-size: 24px;
  }

  .metrics-grid,
  .task-list,
  .module-nav {
    grid-template-columns: 1fr;
  }

  .select-wrap {
    flex: 1 1 150px;
  }
}
