:root {
  --line: #dfe3e8;
  --text: #1f2733;
  --muted: #6b7683;
  --brand: #1d5c94;
  --warn: #a4551a;
  --warn-bg: #fdf3e6;
  --ok: #226b3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #f5f6f8;
}

.hidden {
  display: none;
}

.muted {
  color: var(--muted);
}

.center {
  text-align: center;
  padding: 18px 0;
}

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

.login-card {
  max-width: 340px;
  margin: 12vh auto 0;
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 18px;
}

.login-card label,
.filters label {
  display: block;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.login-card input {
  width: 100%;
  margin-top: 4px;
}

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

input,
select {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

button {
  cursor: pointer;
  border-radius: 5px;
  border: 1px solid var(--line);
  padding: 7px 14px;
  background: #fff;
}

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

.login-card button.primary {
  margin-top: 6px;
}

button.ghost:hover,
button.link:hover {
  border-color: var(--brand);
  color: var(--brand);
}

button:disabled {
  color: var(--muted);
  cursor: default;
  border-color: var(--line);
  background: #f2f3f5;
}

button.link {
  border: none;
  background: none;
  padding: 0;
  color: var(--brand);
  text-decoration: underline;
}

.error {
  color: #b3261e;
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 13px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 600;
}

.spacer {
  flex: 1;
}

.banner {
  margin: 14px 18px 0;
  padding: 9px 12px;
  border: 1px solid #e8cfae;
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 6px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 18px 0;
}

.filters label {
  margin: 0;
}

.filters input,
.filters select {
  display: block;
  margin-top: 4px;
  min-width: 150px;
}

.filters input[type="search"] {
  min-width: 210px;
}

.counts {
  margin: 14px 18px 6px;
  color: var(--muted);
}

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

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

th,
td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td.wrap {
  white-space: normal;
  min-width: 130px;
  max-width: 240px;
}

td.time,
td.phone {
  font-variant-numeric: tabular-nums;
}

th {
  font-weight: 600;
  color: var(--muted);
  background: #fafbfc;
}

tbody tr:last-child td {
  border-bottom: none;
}

td.hosp {
  font-weight: 600;
}

.st {
  color: var(--muted);
}

.st-pending {
  color: var(--ok);
}

.st-cancelled,
.st-suspended,
.st-missed,
.st-changed {
  color: var(--warn);
}

.flag {
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 12px;
  color: var(--muted);
  cursor: help;
}

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 18px 26px;
}

.refresh {
  font-size: 12px;
}

.jumps-label {
  margin: 14px 18px 4px;
  font-size: 12px;
}

.jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 18px;
}

button.jump {
  padding: 5px 12px;
  font-size: 13px;
}

td.notes {
  cursor: pointer;
  color: var(--brand);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

td.code-link {
  cursor: pointer;
  color: var(--brand);
  text-decoration: underline;
}

.note-panel {
  margin: 16px 18px 28px;
}

.note-panel.disabled-notes {
  display: none;
}

.note-list {
  margin: 8px 0 12px;
  padding-left: 0;
  list-style: none;
}

.note-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}

.note-list li span {
  flex: 1;
  white-space: pre-wrap;
}

.note-panel label {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

.note-panel textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  resize: vertical;
}

.note-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.note-actions button.primary {
  width: auto;
  margin-top: 0;
}

/* 窄屏改成一条一卡：每个字段带标签，保证 14 个字段在小屏也齐全可读 */
@media (max-width: 960px) {
  .filters input,
  .filters select {
    min-width: 120px;
  }

  .table-wrap {
    margin: 0 12px;
    overflow-x: visible;
    background: transparent;
    border: none;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 4px 0;
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 12px;
    white-space: normal;
    text-align: right;
  }

  td.wrap {
    max-width: none;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    flex: 0 0 auto;
    text-align: left;
  }

  td.hosp {
    font-size: 15px;
  }
}
