:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #5c6b73;
  --line: #c9d6dc;
  --paper: #f7faf8;
  --panel: #ffffff;
  --accent: #155e75;
  --accent-strong: #0f4a5c;
  --accent-soft: #d9eef2;
  --green-soft: #e5f3dd;
  --warn: #b45309;
  --bad: #b42318;
  --bad-soft: #fee4e2;
  --ok: #087443;
  --ok-soft: #dcfae6;
  --shadow: 0 10px 30px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px clamp(16px, 4vw, 40px) 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 17px;
}

.app-header p,
.section-head p,
.status {
  color: var(--muted);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.demo-notice {
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid #f0b35b;
  border-radius: 8px;
  background: #fff7e8;
  color: #7a3e00;
}

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

.panel {
  padding: clamp(16px, 3vw, 28px);
}

.subpanel {
  padding: 18px;
  box-shadow: none;
}

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

.action-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.account-bar strong {
  min-width: 0;
  max-width: min(52vw, 420px);
  overflow: hidden;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f2f7f8;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-row,
.toolbar,
.add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  color: #34434b;
  font-weight: 600;
}

input,
textarea {
  border: 1px solid #b8c8cf;
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
}

input {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 9px 10px;
}

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  padding: 8px 14px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

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

button.secondary:hover {
  background: var(--accent-soft);
}

button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}

button.ghost:hover {
  background: var(--accent-soft);
}

button.danger {
  color: var(--bad);
}

button.danger:hover {
  background: var(--bad-soft);
}

.hidden {
  display: none !important;
}

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

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  background: var(--green-soft);
  text-align: center;
  padding: 13px 10px;
}

tbody th {
  width: 140px;
  background: #eef6f7;
  text-align: center;
  white-space: pre-line;
  vertical-align: middle;
  font-weight: 700;
  padding: 10px;
}

td {
  background: #ffffff;
  padding: 0;
}

td textarea {
  display: block;
  border: 0;
  border-radius: 0;
  min-height: 108px;
}

.status {
  min-height: 24px;
  margin-top: 12px;
}

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

.leader-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.file-picker input {
  max-width: 320px;
}

.list {
  display: grid;
  gap: 8px;
}

.person-row,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfd;
}

.person-row button {
  min-height: 32px;
  padding: 4px 9px;
}

.person-row span {
  display: grid;
}

.status-block {
  display: grid;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

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

.pill.missing {
  background: var(--bad-soft);
  color: var(--bad);
}

.summary-line {
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  background: #f2f7f8;
}

.help-dialog {
  width: min(92vw, 560px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.help-dialog::backdrop {
  background: rgb(17 24 39 / 42%);
}

.help-dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h3 {
  margin: 0;
  font-size: 20px;
}

.help-body {
  display: grid;
  gap: 12px;
}

.help-body section {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfd;
}

.help-body h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.help-body p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  main {
    width: min(100% - 20px, 1180px);
    margin-top: 12px;
  }

  .panel {
    padding: 14px;
  }

  .section-head {
    flex-direction: column;
  }

  .action-group {
    width: 100%;
  }

  .toolbar,
  .login-row,
  .add-row {
    align-items: stretch;
    flex-direction: column;
  }

  button,
  input {
    width: 100%;
  }

  .account-bar {
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
  }

  .account-bar strong {
    max-width: calc(100vw - 130px);
    font-size: 14px;
  }

  .account-bar button {
    flex: 0 0 auto;
    width: auto;
  }

  .bottom-actions {
    flex-direction: column;
  }

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

  h1 {
    font-size: 20px;
    line-height: 1.25;
  }
}
