:root {
  --ink: #17211d;
  --muted: #66736d;
  --line: #dde5df;
  --paper: #ffffff;
  --wash: #f5f7f4;
  --accent: #2f7d68;
  --accent-dark: #18594a;
  --warning: #b45f12;
  --danger: #b63420;
  --shadow: 0 18px 48px rgba(35, 50, 43, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f8faf7 0%, #eef3ef 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0.72rem 1rem;
  color: #fff;
  background: var(--accent-dark);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(24, 89, 74, 0.16);
}

button:hover {
  background: #124739;
}

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

.ghost,
.tab {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
}

.ghost:hover,
.tab:hover {
  background: var(--wash);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem 0.8rem;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(47, 125, 104, 0.55);
  box-shadow: 0 0 0 3px rgba(47, 125, 104, 0.12);
}

.shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hidden {
  display: none !important;
}

.login-card {
  width: min(500px, 100%);
  margin: 10vh auto 0;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

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

.brand-row.compact h1 {
  font-size: 1.45rem;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #163f35);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  font-size: clamp(1.45rem, 2.4vw, 2.1rem);
}

.muted,
.intro,
.hint {
  color: var(--muted);
  line-height: 1.7;
}

.login-form,
.profile {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.login-form label,
.profile label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.error {
  min-height: 1.4em;
  margin: 0;
  color: var(--danger);
}

.hint {
  margin: 0;
  font-size: 0.85rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab.active {
  color: #fff;
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.page-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}

.panel,
.workspace,
.orders-view {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel {
  position: sticky;
  top: 112px;
  padding: 16px;
}

.panel-title {
  margin: 4px 0 12px;
  font-weight: 850;
}

.test-list {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.test-card {
  width: 100%;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
}

.test-card.active {
  color: #fff;
  border-color: var(--accent-dark);
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
}

.test-card strong,
.test-card span {
  display: block;
}

.test-card span {
  margin-top: 5px;
  color: inherit;
  opacity: 0.72;
  font-size: 0.86rem;
}

.workspace {
  min-height: 620px;
  overflow: hidden;
}

.empty-state {
  min-height: 620px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 40px;
  text-align: center;
}

.empty-state span {
  color: rgba(47, 125, 104, 0.16);
  font-size: 7rem;
  font-weight: 900;
  line-height: 0.85;
}

.quiz,
.result,
.orders-view {
  padding: 22px;
}

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

.inline-actions,
.pay-actions,
.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-chip {
  min-width: 82px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  text-align: center;
  font-weight: 850;
  background: var(--accent);
}

.questions {
  display: grid;
  gap: 14px;
}

.question {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.question-title {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 800;
  line-height: 1.55;
}

.question-no {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--wash);
}

.option:has(input:checked) {
  border-color: rgba(47, 125, 104, 0.68);
  background: rgba(47, 125, 104, 0.1);
}

.option input {
  width: auto;
  margin-top: 4px;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 20px -22px -22px;
  padding: 16px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.pay-lock {
  display: grid;
  gap: 12px;
}

.pay-lock code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--wash);
}

.dim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.dim {
  padding: 14px;
  border-radius: 10px;
  background: var(--wash);
  border: 1px solid var(--line);
}

.dim span {
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 900;
}

.report {
  padding: 20px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  line-height: 1.82;
}

.report table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 8px;
}

.report th,
.report td {
  padding: 12px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.report th {
  background: rgba(47, 125, 104, 0.1);
}

.report img {
  max-width: 100%;
}

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

.summary-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--wash);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.65rem;
}

.orders-list {
  display: grid;
  gap: 10px;
}

.order-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 100px 150px 90px auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.order-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  word-break: break-all;
}

.label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.status {
  display: inline-flex;
  justify-content: center;
  min-width: 72px;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 850;
}

.status.paid {
  color: #17624f;
  background: rgba(47, 125, 104, 0.12);
}

.status.pending {
  color: var(--warning);
  background: rgba(180, 95, 18, 0.12);
}

.empty-orders {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  background: var(--wash);
}

@media (max-width: 960px) {
  .topbar,
  .page-grid,
  .section-head {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .panel {
    position: static;
  }

  .order-row {
    grid-template-columns: 1fr;
  }

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

  .sticky-actions,
  .inline-actions {
    justify-content: stretch;
  }

  .sticky-actions button,
  .inline-actions button {
    flex: 1;
  }
}
