:root {
  --bg: #eef3f5;
  --panel: #ffffff;
  --line: #d7e1e4;
  --ink: #173136;
  --muted: #667b82;
  --brand: #0f5f68;
  --brand-dark: #0a4248;
  --warn: #8a5400;
  --warn-bg: #fff1d6;
  --danger: #9a2f22;
  --danger-bg: #ffe2df;
  --ok: #21643b;
  --ok-bg: #e4f4ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfb;
  color: var(--ink);
  min-height: 34px;
  padding: 0 12px;
  font: inherit;
}

button {
  cursor: pointer;
  font-weight: 700;
}

.login-panel {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.login-box label {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

.login-box input,
.login-box button {
  width: 100%;
}

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

.topbar {
  min-height: 76px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  margin-top: 4px;
}

h2 {
  font-size: 17px;
}

p {
  color: var(--muted);
  margin-top: 4px;
}

.top-actions,
.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.button-row.compact {
  justify-content: flex-end;
}

.workspace {
  display: grid;
  grid-template-columns: 460px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

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

.task-pane {
  min-height: calc(100vh - 108px);
  overflow: hidden;
}

.section-head {
  min-height: 64px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
}

.task-table {
  width: 100%;
  border-collapse: collapse;
}

.task-table th,
.task-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e7edef;
  vertical-align: top;
}

.task-table th {
  color: var(--muted);
  font-size: 12px;
  background: #f8fbfb;
}

.task-table tr {
  cursor: pointer;
}

.task-table tr:hover,
.task-table tr.selected {
  background: #eef8f9;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  gap: 16px;
}

.panel {
  min-height: 120px;
}

.panel > .definition-list,
.panel > .issue-list,
.panel > .compact-list,
.panel > .template-list {
  padding: 14px 16px;
}

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

.definition-list dt {
  color: var(--muted);
  font-size: 12px;
}

.definition-list dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: #e7f1f2;
  color: var(--brand);
  font-weight: 700;
}

.status-pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-pill.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.issue-list,
.compact-list,
.template-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.issue-item,
.log-item,
.template-item {
  border: 1px solid #e4ecef;
  border-radius: 6px;
  padding: 10px;
  background: #fbfdfd;
}

.issue-item strong,
.log-item strong,
.template-item strong {
  display: block;
  margin-bottom: 4px;
}

.report-panel {
  grid-column: 1 / -1;
}

.report-box {
  min-height: 360px;
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  line-height: 1.7;
  overflow: auto;
  font-family: "FangSong", "仿宋", "Microsoft YaHei", serif;
  background: #fbfdfd;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--brand-dark);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 95, 104, 0.2);
}

.detail-actions,
.module-actions {
  padding: 12px 16px;
}

.module-editor {
  grid-column: 1 / -1;
}

.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px 0;
}

.module-tabs .tab {
  background: #f1f6f7;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 700;
  color: var(--muted);
}

.module-tabs .tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.module-tabs .tab .badge {
  margin-left: 6px;
  font-size: 11px;
  color: var(--danger);
}

.module-tabs .tab.active .badge {
  color: #ffd9d3;
}

.module-form {
  padding: 14px 16px;
}

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

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

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

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

.field .req {
  color: var(--danger);
  margin-left: 2px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
}

.field textarea {
  min-height: 64px;
  padding: 8px 12px;
  line-height: 1.5;
  resize: vertical;
}

.empty-hint {
  color: var(--muted);
  padding: 8px 0;
}

.list-table {
  width: 100%;
  border-collapse: collapse;
}

.list-table th,
.list-table td {
  border-bottom: 1px solid #e7edef;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.list-table th {
  color: var(--muted);
  font-size: 12px;
  background: #f8fbfb;
  white-space: nowrap;
}

.list-table input,
.list-table select,
.list-table textarea {
  width: 100%;
  min-width: 110px;
}

.list-table textarea {
  min-height: 36px;
  padding: 6px 8px;
}

.row-del {
  min-width: 0;
  padding: 0 10px;
  color: var(--danger);
  border-color: var(--danger-bg);
  background: var(--danger-bg);
}

.is-readonly .module-actions,
.is-readonly .detail-actions .needs-edit {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 49, 54, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal-box {
  width: min(620px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.modal-box .button-row {
  padding: 0 16px 16px;
}

@media (max-width: 1100px) {
  .workspace,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .task-pane {
    min-height: auto;
  }

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