* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  color: #172026;
  background: #f5f7f8;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

body.portal-layout {
  grid-template-columns: 220px 1fr;
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  color: #f7fbfb;
  background: #12343b;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar h1,
.topbar h2,
.panel h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: #7fd1c3;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: #dcefed;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
}

nav a.active,
nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.workspace {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.admin-section {
  display: grid;
  gap: 16px;
  scroll-margin-top: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.topbar-field {
  min-width: 170px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.section-heading h3 {
  margin: 0;
}

.panel {
  background: #ffffff;
  border: 1px solid #d9e2e4;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(14, 30, 37, 0.06);
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.tight {
  gap: 10px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid #cbd7da;
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
}

button {
  width: auto;
  min-width: 96px;
  color: #ffffff;
  background: #0f766e;
  border-color: #0f766e;
  cursor: pointer;
}

button:hover {
  background: #0b5f59;
}

.secondary-button,
.small-button {
  color: #0f766e;
  background: #eef8f6;
  border-color: #b9dfd9;
}

.secondary-button:hover,
.small-button:hover {
  color: #ffffff;
}

.small-button {
  min-width: auto;
  padding: 7px 9px;
  font-size: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #3d4d52;
}

.stack {
  display: grid;
  gap: 12px;
}

.meta-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 14px;
  margin: 0;
}

.meta-list dt {
  color: #5b6b70;
}

.meta-list dd {
  margin: 0;
  font-weight: 600;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

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

.metric-tile {
  min-height: 88px;
  padding: 14px;
  border: 1px solid #cfe1df;
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.metric-tile span,
.summary-item span {
  color: #5b6b70;
  font-size: 12px;
}

.metric-tile strong {
  color: #12343b;
  font-size: 24px;
  line-height: 1;
}

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

.summary-item {
  min-height: 58px;
  padding: 10px 12px;
  border-left: 3px solid #7fd1c3;
  background: #f4faf9;
  display: grid;
  gap: 4px;
}

.summary-item strong {
  color: #12343b;
}

.bar-list {
  display: grid;
  gap: 11px;
}

.bar-row {
  display: grid;
  gap: 5px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #405157;
  font-size: 13px;
}

.bar-track {
  height: 6px;
  overflow: hidden;
  border-radius: 4px;
  background: #e5efee;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

.record-id {
  color: #728287 !important;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  word-break: break-all;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #24544e;
  background: #e5f4f0;
  font-size: 12px;
  white-space: nowrap;
}

.status-pending {
  color: #805b00;
  background: #fff4cf;
}

.status-in_progress {
  color: #1c527a;
  background: #e3f1fb;
}

.status-completed {
  color: #24613e;
  background: #e4f4e8;
}

.status-rejected {
  color: #8b3c3c;
  background: #fbe8e8;
}

.mini-card,
.item-card {
  border: 1px solid #d9e2e4;
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfd;
}

.mini-card h4,
.item-card h4 {
  margin: 0 0 8px;
}

.mini-card p,
.item-card p,
.hint {
  margin: 0;
  color: #526268;
  line-height: 1.6;
}

.item-list {
  display: grid;
  gap: 12px;
}

.expert-task {
  background: #ffffff;
}

.result-box {
  min-height: 160px;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  background: #102022;
  color: #d7f7ef;
  border-radius: 8px;
}

@media (max-width: 860px) {
  body,
  body.portal-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

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

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

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

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-field {
    min-width: 0;
  }

  .topbar,
  .section-title,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }
}
