:root {
  --bg: #f6f0e6;
  --panel: rgba(255, 252, 246, 0.92);
  --line: rgba(74, 50, 35, 0.14);
  --text: #241813;
  --muted: #66554b;
  --accent: #a44b27;
  --accent-strong: #7c3518;
  --ok: #2a6b4f;
  --warn: #a44b27;
  --fail: #8c2f39;
  --shadow: 0 18px 45px rgba(62, 37, 23, 0.11);
  --radius: 22px;
  --mono: "SFMono-Regular", "Menlo", "Monaco", monospace;
  --sans: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(244, 196, 138, 0.35), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(203, 102, 67, 0.16), transparent 22%),
    linear-gradient(180deg, #f8f1e7 0%, #f3ecdf 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  background: rgba(246, 240, 230, 0.84);
  border-bottom: 1px solid var(--line);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.header-nav {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-form {
  margin: 0;
}

.nav-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: none;
}

.nav-button:hover,
.header-nav a:hover,
.text-link:hover,
.primary-button:hover,
.ghost-button:hover {
  opacity: 0.9;
  text-decoration: none;
}

.header-nav a,
.text-link {
  color: var(--accent-strong);
  text-decoration: none;
}

.page-shell {
  padding: 32px 0 48px;
}

.hero-card,
.detail-grid {
  display: grid;
  gap: 24px;
}

.hero-card {
  grid-template-columns: 1.1fr 1fr;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.hero-copy {
  padding: 24px 12px 0 0;
}

.hero-copy h1,
.panel h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.05;
}

.hero-copy p,
.panel p,
.content-list dd,
.meta-grid dd {
  color: var(--muted);
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.form-panel,
.auth-panel {
  display: grid;
  gap: 16px;
}

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

.field span,
dt {
  font-size: 14px;
  font-weight: 700;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(96, 60, 38, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  padding: 14px 16px;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 320px;
  font-family: var(--mono);
  line-height: 1.55;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 12px 20px;
  font-weight: 700;
  text-decoration: none;
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.primary-button {
  color: #fff7f1;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.flash {
  border-radius: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
}

.flash-error {
  background: rgba(168, 59, 63, 0.08);
  color: var(--fail);
}

.flash-success {
  background: rgba(42, 107, 79, 0.08);
  color: var(--ok);
}

.auth-shell {
  display: flex;
  justify-content: center;
  padding-top: 48px;
}

.auth-panel {
  width: min(460px, 100%);
}

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

.panel-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.panel-actions form {
  margin: 0;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.row-actions form {
  margin: 0;
}

.row-reset-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.action-stack {
  display: grid;
  gap: 10px;
}

.inline-edit-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mini-button {
  padding: 10px 14px;
  font-size: 14px;
}

.admin-inline-input,
.admin-reset-input {
  width: 150px;
  padding: 10px 12px;
  border-radius: 14px;
}

.compact-copy {
  padding: 0;
}

.spaced-table {
  margin-top: 24px;
}

.table-shell {
  overflow-x: auto;
}

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

.submission-table-shell {
  overflow-x: visible;
}

.submission-list-table {
  min-width: 0;
  table-layout: fixed;
}

.student-overview-table {
  min-width: 860px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(74, 50, 35, 0.08);
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-cell,
.actions-cell {
  vertical-align: middle;
}

.actions-cell {
  min-width: 220px;
}

.student-cell,
.student-meta-cell,
.student-count-cell {
  vertical-align: middle;
}

.student-label {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.submission-list-table th,
.submission-list-table td {
  padding: 12px 8px;
}

.submission-primary-cell {
  width: 64%;
  vertical-align: middle;
}

.submission-primary-line {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.submission-primary-line > span {
  min-width: 0;
}

.submission-meta-line {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  white-space: nowrap;
}

.submission-meta-line > span {
  min-width: 0;
}

.submission-meta-line > span:not(:first-child)::before {
  content: "·";
  margin: 0 8px;
  color: var(--muted);
}

.submission-time,
.submission-student,
.submission-mode {
  flex: none;
  white-space: nowrap;
}

.submission-title-line {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
  color: var(--muted);
}

.submission-status-cell {
  width: 36%;
  vertical-align: middle;
}

.submission-status-panel {
  display: grid;
  gap: 8px;
  align-content: center;
}

.submission-status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.submission-status-list .status {
  padding: 4px 8px;
  font-size: 12px;
}

.submission-ops-line {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.submission-ops-line form {
  margin: 0;
}

.submission-ops-line .ghost-button,
.submission-ops-line button {
  width: auto;
}

.submission-ops-line .mini-button {
  padding: 6px 10px;
  font-size: 12px;
}

.student-name-cell {
  min-width: 240px;
}

.student-meta-cell {
  min-width: 150px;
  white-space: nowrap;
}

.student-count-cell {
  min-width: 72px;
  white-space: nowrap;
}

.student-summary {
  display: grid;
  gap: 6px;
}

.student-summary strong {
  font-size: 16px;
}

.table-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.detail-form-panel {
  max-width: 420px;
}

.student-detail-actions {
  display: grid;
  gap: 16px;
}

.student-detail-actions form {
  margin: 0;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  background: rgba(74, 50, 35, 0.08);
}

.status-success {
  color: var(--ok);
}

.status-failed {
  color: var(--fail);
}

.status-running,
.status-queued,
.status-pending {
  color: var(--warn);
}

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

.detail-grid > .panel:nth-child(1) {
  grid-column: 1 / -1;
}

.diagnosis-summary {
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid rgba(74, 50, 35, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.diagnosis-summary .eyebrow {
  margin-bottom: 10px;
}

.diagnosis-summary h2 {
  margin: 0 0 8px;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.diagnosis-summary-meta {
  margin: 0;
  font-size: 13px;
}

.diagnosis-program-panel .code-block {
  max-height: 720px;
  overflow: auto;
}

.diagnosis-program-panel {
  padding: 20px;
  background: rgba(255, 255, 255, 0.82);
}

.diagnosis-program-panel h3 {
  margin: 0 0 14px;
  font-size: 20px;
}

.meta-grid,
.content-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.meta-grid div,
.content-list div,
.issue-card,
.note-block {
  border-top: 1px solid rgba(74, 50, 35, 0.08);
  padding-top: 14px;
}

.code-block,
.inline-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
}

.issue-card h3,
.note-block h3 {
  margin: 0 0 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

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

.pagination-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.pagination-info {
  margin: 0;
  color: var(--muted);
}

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

.success-panel {
  max-width: 760px;
}

@media (max-width: 900px) {
  .hero-card,
  .detail-grid,
  .meta-grid,
  .content-list {
    grid-template-columns: 1fr;
  }

  .header-content,
  .panel-header {
    flex-direction: column;
  }
}
