:root {
  --primary: #9F7C5E;
  --primary-dark: #805f47;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #e6e8ec;
  --text: #1f2933;
  --muted: #6b7280;
  --danger: #c2410c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 380px;
  padding: 34px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.login-box h1 {
  margin: 0;
  color: var(--primary);
  font-size: 26px;
}

.login-box p {
  margin: 10px 0 26px;
  color: var(--muted);
}

.admin-layout {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 230px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.brand {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 22px;
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

.menu {
  padding: 14px 10px;
}

.menu button {
  width: 100%;
  height: 42px;
  margin-bottom: 6px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #374151;
  text-align: left;
  cursor: pointer;
}

.menu button.active,
.menu button:hover {
  background: var(--primary);
  color: #fff;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

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

.content {
  padding: 24px;
  overflow: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

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

.stat-title {
  color: var(--muted);
  font-size: 14px;
}

.stat-value {
  margin-top: 12px;
  color: var(--primary);
  font-size: 34px;
  font-weight: 800;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 20px;
  margin-bottom: 18px;
}

.panel-title {
  margin: 0 0 16px;
  font-size: 18px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}

.toolbar-input {
  width: 220px;
}

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

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

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
}

.primary-btn,
.ghost-btn,
.danger-btn,
.small-btn {
  min-height: 36px;
  border-radius: 0;
  border: 1px solid transparent;
  padding: 0 14px;
  cursor: pointer;
}

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

.primary-btn:hover {
  background: var(--primary-dark);
}

.ghost-btn {
  background: #fff;
  border-color: var(--line);
  color: #374151;
}

.danger-btn {
  background: #fff;
  border-color: #fed7aa;
  color: var(--danger);
}

.small-btn {
  min-height: 30px;
  padding: 0 10px;
  background: #fff;
  border-color: var(--line);
  color: #374151;
}

.data-table,
.inner-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.data-table th,
.data-table td,
.inner-table th,
.inner-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.element-table {
  border: 1px solid #ebeef5;
}

.element-table th {
  background: #f9fafb;
  font-weight: 700;
  color: #606266;
}

.element-table td {
  color: #303133;
}

.element-table tr:hover td {
  background: #f5f7fa;
}

.inner-table td {
  padding: 8px 0;
  border-bottom: 1px solid #edf0f3;
}

.is-confirmed-row td,
.is-confirmed-row .muted {
  color: #d93025 !important;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vertical-actions {
  flex-direction: column;
  align-items: flex-start;
}

.confirm-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

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

.text-btn,
.text-danger,
.tag-btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--primary);
}

.text-danger {
  color: var(--danger);
}

.disease-tags {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.disease-tag {
  border: 1px solid #e5e7eb;
  padding: 4px 8px;
  background: #fafafa;
}

.tag-btn {
  margin-left: 6px;
  font-size: 12px;
}

.table-ellipsis {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.message {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.preview-img {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f3f4f6;
}

.avatar-img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--primary);
}

.field-title {
  display: block;
  margin-bottom: 8px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.schedule-grid {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-panel {
  width: min(920px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.modal-header {
  height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  font-size: 26px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
}

.detail-table th {
  width: 130px;
}

.detail-table td {
  white-space: pre-wrap;
}

.confirm-box p {
  margin: 0 0 18px;
  color: #374151;
  line-height: 1.7;
}

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

.nested-box {
  border: 1px solid var(--line);
  padding: 12px;
  margin-bottom: 12px;
}

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

.row > * {
  flex: 1;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  width: auto;
}

@media (max-width: 900px) {
  .sidebar {
    width: 190px;
  }

  .form-grid,
  .form-grid.two,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
