:root {
  --ink: #17211f;
  --muted: #6f7f79;
  --line: #dde6e1;
  --soft: #f5f8f6;
  --panel: #ffffff;
  --green: #19735a;
  --green-2: #2da57d;
  --teal: #dff4eb;
  --blue: #315f8f;
  --amber: #cc8a2e;
  --red: #bd4c37;
  --shadow: 0 16px 42px rgba(29, 57, 47, .08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 244px;
  flex: 0 0 244px;
  display: flex;
  flex-direction: column;
  padding: 28px 18px;
  background: #17332c;
  color: #dcece4;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #91e0be;
  color: #17332c;
  font-size: 22px;
  font-weight: 800;
}

.brand b,
.brand small,
.aside-foot small,
.kpi span,
.kpi small {
  display: block;
}

.brand b {
  font-size: 15px;
}

.brand small,
.aside-foot small {
  color: #90aaa0;
  font-size: 11px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button {
  height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: transparent;
  color: #abc4b9;
  text-align: left;
  font-size: 13px;
}

.nav button:hover,
.nav button.active {
  background: #285447;
  color: #fff;
}

.aside-foot {
  margin-top: auto;
  border-top: 1px solid #315347;
  padding: 18px 12px 0;
  color: #c1d5cd;
  font-size: 12px;
  line-height: 1.8;
}

.sync-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 99px;
  background: #6ee5ae;
}

.main {
  flex: 1;
  min-width: 0;
  max-width: 1480px;
  width: auto;
  margin: 0 auto;
  padding: 34px 48px 58px;
}

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

.crumb {
  margin: 0 0 10px;
  color: #8a9692;
  font-size: 12px;
}

h1 {
  margin: 0 0 7px;
  font-size: 30px;
  line-height: 1.18;
}

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

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
}

.page-tabs .module-tabs {
  border: 1px solid #d9e6df;
  background: #f7faf8;
}

.page-tabs .module-tabs button {
  min-width: 104px;
  font-weight: 800;
}

.page-tabs .module-tabs button.selected {
  background: #17332c;
  color: #fff;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.icon-button,
.primary,
.ghost {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

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

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  margin-top: 30px;
  padding: 27px 30px;
  border: 1px solid #cae6dc;
  border-radius: 14px;
  background: linear-gradient(112deg, #def4eb 0%, #eef5f8 56%, #fff7e8 100%);
}

.eyebrow {
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

.hero h2 {
  margin: 9px 0 6px;
  font-size: 24px;
  line-height: 1.25;
}

.hero p {
  margin: 0;
  color: #566c66;
  font-size: 13px;
}

.hero-stat {
  min-width: 220px;
  text-align: right;
}

.hero-stat small,
.hero-stat span {
  color: #617870;
  font-size: 12px;
}

.hero-stat strong {
  display: block;
  margin: 3px 0;
  color: #155f49;
  font-size: 40px;
  line-height: 1;
}

.hero-stat em {
  color: var(--amber);
  font-style: normal;
  font-weight: 700;
}

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

.kpi {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--panel);
}

.kpi span,
.kpi small {
  color: var(--muted);
  font-size: 11px;
}

.kpi strong {
  display: block;
  margin: 9px 0 5px;
  font-size: 24px;
  line-height: 1.18;
}

.kpi small.good {
  color: var(--green);
}

.kpi small.warn {
  color: var(--amber);
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 45px;
  margin: 24px 0 13px;
}

.seg {
  display: flex;
  padding: 3px;
  border-radius: 8px;
  background: #eaf0ec;
}

.seg button {
  height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 13px;
  background: transparent;
  color: #7a8983;
  font-size: 12px;
}

.seg button.selected {
  background: #fff;
  color: var(--green);
  box-shadow: 0 1px 4px rgba(42, 80, 66, .16);
}

.dimension-level {
  border: 1px solid #d9e6df;
  background: #f7faf8;
}

.dimension-level button {
  min-width: 84px;
  font-weight: 700;
}

.time-range button {
  min-width: 60px;
  font-weight: 700;
}

.dimension-level button.selected {
  background: #17332c;
  color: #fff;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar .sort-filter {
  margin-left: auto;
}

.toolbar .team-filter {
  margin-left: 0;
}

.toolbar select,
.search input {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.toolbar select {
  padding: 0 28px 0 10px;
}

.sort-direction {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  background: #fff;
  color: #1f7157;
  font-size: 12px;
  font-weight: 700;
}

.sort-direction:hover {
  border-color: #9fd0bc;
  background: #f2faf6;
}

.search input {
  width: 180px;
  padding: 0 11px;
}

.table-card,
.source-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-card + .table-card {
  margin-top: 18px;
}

.issue-panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.issue-form {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-field input,
.form-field select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.form-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.form-field input[type="file"] {
  height: auto;
  min-height: 38px;
  padding: 7px 10px;
  cursor: pointer;
}

.issue-submit {
  min-width: 112px;
  font-weight: 800;
}

.issue-submit:disabled {
  opacity: .68;
  cursor: not-allowed;
}

.form-message {
  margin: 12px 0 0;
  border-radius: 8px;
  padding: 9px 12px;
  background: #eef5f1;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.form-message.good {
  background: #e8f6ef;
  color: var(--green);
}

.form-message.warn {
  background: #fff0e3;
  color: #b77324;
}

.form-message.danger {
  background: #fdecea;
  color: var(--red);
}

.form-message.quota {
  background: #eef5f1;
  color: var(--green);
}

.form-message.quota.danger {
  background: #fdecea;
  color: var(--red);
}

.taskbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.task-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.task-card h3 {
  margin: 6px 0 5px;
  font-size: 17px;
}

.task-card p,
.task-lines {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.task-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.task-metrics div {
  min-height: 58px;
  border-radius: 8px;
  padding: 9px 8px;
  background: #f5f9f7;
  text-align: center;
}

.task-metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.task-metrics b {
  display: block;
  margin-top: 5px;
  color: #155f49;
  font-size: 18px;
}

.task-lines {
  display: grid;
  gap: 4px;
}

.table-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 14px;
}

.table-head h3,
.source-panel h3 {
  margin: 0 0 5px;
  font-size: 17px;
}

.table-head p,
.source-panel p,
.source-panel li {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.updated {
  color: var(--green);
  font-size: 11px;
  white-space: nowrap;
}

.table-wrap {
  max-height: min(72vh, 760px);
  overflow: auto;
}

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

th,
td {
  height: 48px;
  border-top: 1px solid #edf2ef;
  padding: 10px 14px;
  text-align: center;
  white-space: nowrap;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fbf9;
  color: #7a8983;
  font-weight: 600;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
}

.sort-header:hover,
.sort-header.active {
  color: var(--green);
}

.sort-header i {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #eaf2ee;
  color: #729086;
  font-style: normal;
  font-size: 10px;
  line-height: 1;
}

.sort-header.active i {
  background: var(--green);
  color: #fff;
}

td:first-child {
  color: #225c49;
  font-weight: 700;
}

.team-toggle {
  border: 0;
  background: transparent;
  color: #20684f;
  font: inherit;
  font-weight: 700;
  padding: 0;
}

.team-toggle:hover {
  text-decoration: underline;
}

.chev {
  display: inline-block;
  width: 16px;
  color: #789087;
}

.open .chev {
  transform: rotate(90deg);
}

.person-row {
  background: #f8fbf9;
}

.district-row {
  background: #f3f8ff;
}

.district-row td {
  color: #23547d;
  font-weight: 700;
}

.person-row td {
  height: 34px;
  padding-top: 6px;
  padding-bottom: 6px;
  color: #60766c;
  font-size: 11px;
}

.person-row td:first-child {
  padding-left: 36px;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  background: #e7f2ec;
  color: #1e6b52;
  font-weight: 800;
}

.rank.top {
  background: #fff0d6;
  color: #a66d14;
}

.bar-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.bar {
  width: 84px;
  height: 7px;
  border-radius: 99px;
  background: #e9eeeb;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: var(--width);
  border-radius: inherit;
  background: var(--color);
}

.badge {
  display: inline-block;
  min-width: 58px;
  border-radius: 6px;
  padding: 4px 7px;
  background: #e8f6ef;
  color: var(--green);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
}

.badge.warn {
  background: #fff0e3;
  color: #b77324;
}

.badge.danger {
  background: #fdecea;
  color: var(--red);
}

.badge.muted {
  background: #eef2f0;
  color: #7a8983;
}

.todo-detail,
.referral-detail {
  min-width: 300px;
  max-width: 460px;
  white-space: normal;
  line-height: 1.6;
  word-break: break-word;
}

.source-panel {
  padding: 24px 26px;
}

.transfer-panel {
  display: grid;
  gap: 10px;
}

.transfer-panel h3,
.transfer-panel p {
  margin: 0;
}

.transfer-form {
  display: grid;
  grid-template-columns: minmax(220px, 420px) auto;
  align-items: end;
  gap: 14px;
  margin-top: 6px;
}

.transfer-form .primary {
  min-width: 100px;
  height: 48px;
}

@media (max-width: 720px) {
  .transfer-form {
    grid-template-columns: 1fr;
  }

  .transfer-form .primary {
    width: 100%;
  }
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0 20px;
}

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

.source-card b {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 13px;
}

.source-panel code {
  color: var(--blue);
  word-break: break-all;
}

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

@media (max-width: 1160px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: auto;
    min-height: auto;
  }

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

  .main {
    padding: 26px 20px 46px;
  }

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

.knowledge-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.knowledge-intro h3 {
  margin: 0 0 7px;
  font-size: 18px;
}

.knowledge-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.knowledge-intro span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 11px;
  background: #edf5f1;
  color: var(--green);
  font-size: 12px;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 18px;
}

.knowledge-category {
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.knowledge-category:nth-child(2) {
  border-top-color: var(--amber);
}

.knowledge-category:nth-child(3) {
  border-top-color: var(--blue);
}

.knowledge-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #e8efeb;
  padding: 19px 22px;
  background: #fbfcfb;
}

.knowledge-category-head h3 {
  margin: 0;
  font-size: 18px;
}

.knowledge-category-head p {
  margin: 0;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef5f1;
  color: var(--muted);
  font-size: 11px;
}

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

.knowledge-item {
  border: 1px solid #e0e9e4;
  border-radius: 9px;
  background: #fff;
}

.knowledge-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 15px 17px;
  color: #184c3d;
  font-weight: 800;
  cursor: pointer;
}

.knowledge-item summary small {
  flex: 0 0 auto;
  color: #87968f;
  font-size: 11px;
  font-weight: 400;
}

.knowledge-body {
  border-top: 1px solid #edf3f0;
  padding: 16px 17px 18px;
  color: #263b34;
  font-size: 13px;
  line-height: 1.8;
  word-break: break-word;
}

.knowledge-body a {
  color: var(--green);
  font-weight: 700;
}

.knowledge-text {
  margin-bottom: 12px;
}

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

.knowledge-file-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f1f8f4;
  color: #27634f;
  text-decoration: none;
}

.knowledge-file-list a:hover {
  background: #e3f2ea;
}

.knowledge-file-list span {
  white-space: normal;
}

.knowledge-file-list em {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.knowledge-empty {
  grid-column: 1 / -1;
  padding: 26px;
  border-radius: 9px;
  background: #f8fbf9;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

@media (max-width: 760px) {
  .topbar,
  .hero,
  .toolbar,
  .task-card-head,
  .table-head,
  .knowledge-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions button {
    flex: 1;
  }

  .page-tabs .seg {
    width: 100%;
  }

  .page-tabs .seg button {
    flex: 1;
  }

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

  .hero-stat {
    min-width: 0;
    text-align: left;
  }

  .kpis,
  .task-metrics,
  .source-grid,
  .knowledge-list {
    grid-template-columns: 1fr;
  }

  .toolbar label {
    margin-left: 0;
  }

  .toolbar select {
    width: 100%;
  }

  .search input {
    width: 100%;
  }

  .sort-direction {
    width: 100%;
  }

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

  .issue-submit {
    width: 100%;
  }
}
