:root {
  --ink: #352924;
  --muted: #7b6c60;
  --paper: #fffaf0;
  --panel: #fffdf8;
  --line: #ead8bf;
  --brand: #8f140f;
  --brand-2: #bf3527;
  --gold: #f3b23f;
  --blue: #2d82a5;
  --blue-soft: #e4f6ff;
  --green: #2f8662;
  --green-soft: #e5f5ed;
  --red-soft: #ffe9e3;
  --shadow: 0 16px 38px rgba(95, 47, 22, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  background: #fff7e8;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #8f140f 0%, #b83a28 58%, #e7a740 100%);
  color: #fff;
  padding: 24px 18px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-logo,
.login-logo {
  background: #fff;
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  height: 54px;
  object-fit: cover;
  width: 54px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.25;
}

.brand span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  margin-top: 5px;
}

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

.nav-item {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  padding: 13px 14px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #fff7d8;
  color: var(--brand);
}

.side-note {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  bottom: 24px;
  left: 18px;
  line-height: 1.55;
  padding: 14px;
  position: sticky;
  right: 18px;
  top: calc(100vh - 150px);
}

.side-note strong,
.side-note span {
  display: block;
}

.side-note span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  margin-top: 6px;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 7px;
}

.api-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  margin: 10px 0 0;
  padding: 6px 10px;
}

.api-status.online {
  background: var(--green-soft);
  color: var(--green);
}

.api-status.offline {
  background: var(--red-soft);
  color: var(--brand-2);
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 26px;
}

h3 {
  font-size: 18px;
}

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

.primary-btn,
.ghost-btn,
.danger-btn,
.small-btn {
  border-radius: 8px;
  font-weight: 900;
  min-height: 40px;
  padding: 0 14px;
}

.primary-btn {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
  width: 100%;
}

.ghost-btn,
.small-btn {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--brand);
}

.danger-btn {
  background: var(--red-soft);
  border: 1px solid #f1b4a8;
  color: var(--brand-2);
}

.small-btn {
  min-height: 34px;
  padding: 0 10px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 18px;
}

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

.panel-subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0 0;
}

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

.metric {
  background: #fff8df;
  border: 1px solid #f0dfbd;
  border-radius: 8px;
  padding: 16px;
}

.metric:nth-child(2n) {
  background: var(--blue-soft);
  border-color: #c7e7f4;
}

.metric-value {
  color: var(--brand);
  display: block;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.metric-label {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-top: 8px;
}

.split-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.class-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 90px minmax(0, 1fr) 72px;
  padding: 12px 0;
}

.class-row + .class-row {
  border-top: 1px solid #eee4d6;
}

.progress {
  background: #f1e3cf;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.progress span {
  background: linear-gradient(90deg, var(--brand-2), var(--gold));
  display: block;
  height: 100%;
}

.text-input,
.select,
.roster-textarea {
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 40px;
  padding: 0 12px;
}

.text-input {
  width: 230px;
}

.login-panel .text-input {
  width: 100%;
}

.import-box {
  background: #fff8df;
  border: 1px dashed #e5bf7c;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
}

.single-student-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.1fr) minmax(110px, 0.8fr) auto;
}

.single-student-grid .text-input {
  width: 100%;
}

.roster-textarea {
  line-height: 1.55;
  min-height: 118px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.file-input {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  min-height: 40px;
  padding: 8px 10px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

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

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

th {
  color: #6b574d;
  font-size: 13px;
  white-space: nowrap;
}

td {
  font-size: 14px;
}

.pill {
  background: #fff0bd;
  border-radius: 999px;
  color: var(--brand);
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  margin: 2px 4px 2px 0;
  padding: 5px 9px;
}

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

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

.pill.red {
  background: var(--red-soft);
  color: var(--brand-2);
}

.review-list,
.award-list,
.photo-grid,
.public-preview {
  display: grid;
  gap: 12px;
}

.review-item,
.award-item,
.photo-item,
.preview-item {
  background: var(--paper);
  border: 1px solid #eee0c9;
  border-radius: 8px;
  padding: 14px;
}

.review-item {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.review-item.labor-item {
  grid-template-columns: 1fr;
}

.vertical-actions {
  display: grid;
  gap: 8px;
  min-width: 118px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.review-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0;
}

.status-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 8px;
}

.review-note {
  line-height: 1.65;
  margin: 0;
}

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

.photo-item {
  display: grid;
  gap: 12px;
  grid-template-columns: 132px minmax(0, 1fr);
}

.photo-item img {
  border-radius: 8px;
  height: 116px;
  object-fit: cover;
  width: 132px;
}

.photo-caption {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0 10px;
}

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

.compact-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 16px;
}

.labor-review-box {
  background: #fffdf8;
  border: 1px dashed #e6c58c;
  border-radius: 8px;
  margin-top: 12px;
  padding: 12px;
}

.labor-review-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

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

.labor-score-chip {
  background: #fff8df;
  border: 1px solid #f0dfbd;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  padding: 9px 10px;
}

.labor-score-chip strong {
  color: var(--brand);
  display: block;
  margin-bottom: 3px;
}

.labor-stars {
  color: var(--gold);
  display: block;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  margin-bottom: 2px;
}

.preview-item img {
  border-radius: 8px;
  height: 118px;
  margin-bottom: 10px;
  object-fit: cover;
  width: 100%;
}

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

.empty {
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.login-overlay {
  align-items: center;
  background: rgba(53, 41, 36, 0.46);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 20;
}

.login-overlay.hidden {
  display: none;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(38, 22, 16, 0.2);
  max-width: 420px;
  padding: 26px;
  width: 100%;
}

.login-logo {
  display: block;
  height: 68px;
  margin-bottom: 16px;
  width: 68px;
}

.login-copy {
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 0 16px;
}

.toast {
  background: var(--ink);
  border-radius: 8px;
  bottom: 22px;
  color: #fff;
  left: 50%;
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .side-note {
    display: none;
  }

  .metric-grid,
  .compact-metrics,
  .split-grid,
  .photo-grid,
  .single-student-grid,
  .public-preview {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .panel-head,
  .labor-review-head,
  .review-item,
  .photo-item {
    display: block;
  }

  .top-actions,
  .toolbar {
    margin-top: 12px;
  }

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

  .text-input,
  .select {
    width: 100%;
  }

  .photo-item img {
    height: 180px;
    margin-bottom: 10px;
    width: 100%;
  }
}
