:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d8d8df;
  --blue: #0071e3;
  --blue-soft: #e8f2ff;
  --green: #188038;
  --red: #b3261e;
  --orange: #b25c00;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.dingtalk-status {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 22px clamp(16px, 3vw, 38px) 34px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  grid-column: 2;
  text-align: center;
}

.brand h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: 0;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.role-switcher,
.user-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.role-switcher {
  justify-self: start;
}

.role-switcher select,
.user-switcher select,
.field select,
.field input,
.field textarea,
.search input {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 40px;
  outline: none;
}

.role-switcher select:focus,
.user-switcher select:focus,
.field select:focus,
.field input:focus,
.field textarea:focus,
.search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.14);
}

.layout-7-3 {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(280px, 3fr);
  gap: 18px;
  align-items: stretch;
}

.stack-7-3 {
  display: grid;
  grid-template-rows: minmax(430px, auto) auto;
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-title h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

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

.score-form-heading {
  min-width: 0;
}

.score-meta {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}

.score-meta div {
  display: block;
  overflow-wrap: anywhere;
}

.score-meta span {
  color: var(--text);
}

.score-form-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
}

.score-form-actions .btn {
  font-size: 20px;
  line-height: 1.2;
}

.panel-body {
  padding: 18px 20px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.button-row.nowrap {
  flex-wrap: nowrap;
}

.annual-evaluation-panel .panel-body {
  display: grid;
  gap: 18px;
}

.annual-summary-table > tbody > tr > td {
  vertical-align: top;
}

.annual-summary-table textarea {
  width: 180px;
  min-height: 68px;
  margin-bottom: 6px;
}

.annual-project-detail > td {
  padding: 0 12px 16px;
  background: #f7f8fa;
}

.annual-project-detail table {
  margin-top: 10px;
  background: #fff;
}

.annual-exclusions {
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.annual-exclusions h3 {
  margin: 0 0 10px;
}

@media (max-width: 720px) {
  .annual-evaluation-panel .panel-header {
    align-items: flex-start;
  }

  .annual-evaluation-panel .panel-header > .button-row {
    width: 100%;
    justify-content: flex-end;
  }

  .annual-summary-table textarea {
    width: 140px;
  }

  .annual-project-detail > td {
    min-width: 760px;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 8px;
  background: #e9e9ee;
  color: var(--text);
  font-weight: 600;
}

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

.btn.danger {
  background: #ffe9e7;
  color: var(--red);
}

.btn.ghost {
  background: transparent;
  color: var(--blue);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.compact {
  min-height: 32px;
  padding: 6px 10px;
  margin-left: 8px;
}

.table-input {
  width: min(220px, 100%);
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

.table-wrap {
  overflow: auto;
}

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

.draft-table {
  min-width: 760px;
  table-layout: fixed;
}

.draft-table th:nth-child(1),
.draft-table td:nth-child(1) {
  width: 150px;
}

.draft-table th:nth-child(2),
.draft-table td:nth-child(2) {
  width: 250px;
}

.draft-table th:nth-child(3),
.draft-table td:nth-child(3) {
  width: auto;
}

.draft-table th:nth-child(4),
.draft-table td:nth-child(4) {
  width: 120px;
}

.draft-table th:nth-child(5),
.draft-table td:nth-child(5) {
  width: 160px;
}

.draft-actions .btn {
  min-height: 34px;
  padding: 7px 11px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.link {
  color: var(--blue);
  background: none;
  padding: 0;
  font-weight: 700;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #ececf1;
  color: var(--muted);
}

.status.submitted,
.status.summarized,
.status.completed {
  background: #e7f4ea;
  color: var(--green);
}

.status.returned,
.status.invalid {
  background: #ffe9e7;
  color: var(--red);
}

.status.draft,
.status.scoring {
  background: #fff4df;
  color: var(--orange);
}

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

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  background: transparent;
  color: var(--text);
}

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

.search {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

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

.form-column {
  display: grid;
  align-content: start;
  gap: 12px;
}

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

.form-column .field {
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 42px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.form-column .field label {
  line-height: 1.35;
}

.form-column .field > input,
.form-column .field > select,
.form-column .field > textarea,
.form-column .field > div,
.form-column .field > button {
  min-width: 0;
  width: 100%;
}

.evaluator-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.evaluator-row select,
.evaluator-row .btn {
  min-height: 40px;
}

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

.score-option {
  border-radius: 8px;
  min-height: 36px;
  background: #ededf2;
  color: var(--text);
  font-weight: 700;
}

.score-option.active {
  background: var(--blue);
  color: #fff;
}

.score-select {
  display: none;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  color: var(--text);
}

.score-table {
  min-width: 1020px;
  table-layout: fixed;
}

.score-table th:nth-child(1),
.score-table td:nth-child(1) {
  width: 130px;
}

.score-table th:nth-child(2),
.score-table td:nth-child(2) {
  width: 180px;
}

.score-table th:nth-child(3),
.score-table td:nth-child(3) {
  width: 72px;
}

.score-table th:nth-child(4),
.score-table td:nth-child(4) {
  width: 250px;
}

.score-table th:nth-child(5),
.score-table td:nth-child(5) {
  width: 270px;
}

.score-table th:nth-child(6),
.score-table td:nth-child(6) {
  width: 118px;
}

.score-table .score-grid {
  grid-template-columns: repeat(6, 38px);
  justify-content: start;
  gap: 7px;
}

.score-table .score-option {
  min-width: 38px;
  padding: 0;
}

.score-table textarea {
  width: 100%;
  min-width: 96px;
  resize: vertical;
}

.muted-input,
input:disabled {
  background: #f0f0f3;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 34px 16px;
  background: rgba(0, 0, 0, 0.38);
  overflow: auto;
}

.modal {
  width: min(1120px, 100%);
  background: var(--surface-strong);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.route-shell {
  padding-top: 28px;
}

.route-panel {
  width: min(1380px, 100%);
  max-height: none;
  margin: 0 auto;
}

.modal.small {
  width: min(720px, 100%);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--muted);
  text-align: center;
}

.notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #16456f;
  font-size: 14px;
}

.form-alert {
  background: #fff4df;
  color: var(--orange);
  font-weight: 700;
}

.flash {
  border-color: var(--red) !important;
  animation: flash-border 0.25s ease-in-out 0s 4 alternate;
}

@keyframes flash-border {
  from {
    box-shadow: 0 0 0 0 rgba(179, 38, 30, 0);
  }
  to {
    box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.22);
  }
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  padding: 14px;
  border-radius: 8px;
  background: #f7f7fa;
}

.metric strong {
  display: block;
  font-size: 26px;
}

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

.informer-picker {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.check-row:hover {
  background: #f7f7fa;
}

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

@media (max-width: 960px) {
  .app-shell {
    padding: 12px 10px 24px;
  }

  .topbar,
  .layout-7-3,
  .stack-7-3 {
    display: block;
  }

  .brand,
  .role-switcher,
  .top-actions {
    justify-content: center;
    margin-bottom: 12px;
  }

  .panel {
    margin-bottom: 16px;
  }

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

  .panel-header {
    align-items: flex-start;
    padding: 14px;
  }

  .panel-body {
    padding: 14px;
  }

  .table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 620px;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .score-table {
    min-width: 600px;
  }

  .score-table th:nth-child(1),
  .score-table td:nth-child(1) {
    width: 56px;
    word-break: break-all;
  }

  .score-table th:nth-child(2),
  .score-table td:nth-child(2) {
    width: 92px;
  }

  .score-table th:nth-child(3),
  .score-table td:nth-child(3) {
    width: 48px;
  }

  .score-table th:nth-child(4),
  .score-table td:nth-child(4) {
    width: 170px;
  }

  .score-table th:nth-child(5),
  .score-table td:nth-child(5) {
    width: 88px;
  }

  .score-table th:nth-child(6),
  .score-table td:nth-child(6) {
    width: 118px;
  }

  .evaluator-project-table {
    min-width: 520px;
    table-layout: fixed;
  }

  .evaluator-project-table th:nth-child(1),
  .evaluator-project-table td:nth-child(1) {
    width: 140px;
  }

  .evaluator-project-table th:nth-child(2),
  .evaluator-project-table td:nth-child(2),
  .evaluator-project-table th:nth-child(3),
  .evaluator-project-table td:nth-child(3) {
    width: 64px;
    text-align: center;
  }

  .evaluator-project-table th:nth-child(4),
  .evaluator-project-table td:nth-child(4) {
    width: 92px;
  }

  .evaluator-project-table th:nth-child(5),
  .evaluator-project-table td:nth-child(5) {
    width: 136px;
  }

  .score-form-panel .panel-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
  }

  .score-form-panel .panel-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .score-form-panel .score-form-actions {
    flex: 0 0 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: flex-end;
    margin-left: auto;
  }

  .score-form-panel .score-form-actions .btn {
    font-size: 18px;
    line-height: 1.2;
    min-width: auto;
    padding: 7px 9px;
    white-space: nowrap;
  }

  .score-table .score-grid {
    display: none;
  }

  .score-select {
    display: block;
  }

  .metric-row {
    gap: 8px;
    margin-bottom: 10px;
  }

  .metric {
    padding: 8px 10px;
    line-height: 1.3;
  }

  .metric strong {
    font-size: 13px;
    line-height: 1.3;
  }

  .metric span {
    font-size: 12px;
    line-height: 1.3;
  }

  .modal-backdrop {
    padding: 0;
  }

  .modal,
  .route-panel {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
  }

  .role-switcher,
  .user-switcher,
  .top-actions,
  .button-row {
    gap: 8px;
  }

  .btn {
    min-height: 36px;
    padding: 8px 11px;
  }
}

@media (max-width: 520px) {
  .brand h1 {
    font-size: 28px;
  }

  .panel-title h2 {
    font-size: 18px;
  }

  table {
    min-width: 560px;
  }

  .score-table {
    min-width: 540px;
  }

  .score-table th:nth-child(1),
  .score-table td:nth-child(1) {
    width: 46px;
    word-break: break-all;
  }

  .score-table th:nth-child(2),
  .score-table td:nth-child(2) {
    width: 78px;
  }

  .score-table th:nth-child(3),
  .score-table td:nth-child(3) {
    width: 44px;
  }

  .score-table th:nth-child(4),
  .score-table td:nth-child(4) {
    width: 145px;
  }

  .score-table th:nth-child(5),
  .score-table td:nth-child(5) {
    width: 82px;
  }

  .score-table th:nth-child(6),
  .score-table td:nth-child(6) {
    width: 105px;
  }

  .score-table textarea {
    min-width: 82px;
  }

  .evaluator-project-table {
    min-width: 470px;
  }

  .evaluator-project-table th:nth-child(1),
  .evaluator-project-table td:nth-child(1) {
    width: 120px;
  }

  .evaluator-project-table th:nth-child(2),
  .evaluator-project-table td:nth-child(2),
  .evaluator-project-table th:nth-child(3),
  .evaluator-project-table td:nth-child(3) {
    width: 56px;
  }

  .evaluator-project-table th:nth-child(4),
  .evaluator-project-table td:nth-child(4) {
    width: 82px;
  }

  .evaluator-project-table th:nth-child(5),
  .evaluator-project-table td:nth-child(5) {
    width: 120px;
  }

  .score-form-panel .score-form-actions {
    gap: 6px;
  }

  .score-form-panel .score-form-actions .btn {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 18px;
  }
}
