:root {
  --ink: #202328;
  --muted: #646b73;
  --line: #dfe4e0;
  --paper: #fbfbf8;
  --surface: #ffffff;
  --green: #2f7d5b;
  --green-dark: #1f5f45;
  --saffron: #d69737;
  --coral: #d65f4b;
  --aqua: #2c7888;
  --shadow: 0 18px 50px rgba(28, 36, 32, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

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

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 248, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.brand span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--green);
}

.topnav {
  display: inline-flex;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.topnav a {
  padding: 8px 10px;
  border-radius: 7px;
}

.topnav a:hover {
  background: #eef3ef;
  color: var(--ink);
}

.app-shell,
.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 44px;
}

.query-shell {
  max-width: 920px;
}

.announcement-banner {
  margin-bottom: 10px;
  padding: 11px 14px;
  border: 1px solid #cfd9d0;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  color: var(--green-dark);
  background: #f1f7f1;
  font-weight: 700;
  white-space: pre-wrap;
  box-shadow: var(--shadow);
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: -26px auto 34px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow);
}

.site-footer strong {
  color: var(--green-dark);
}

.login-panel h1 {
  max-width: 760px;
  margin: 0;
  font-size: 34px;
  line-height: 1.16;
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.main-column,
.side-column,
.admin-side,
.admin-grid {
  display: grid;
  gap: 22px;
}

.admin-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

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

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

.section-head.compact {
  margin-top: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
}

.pill {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid #cfd9d0;
  border-radius: 999px;
  color: var(--green-dark);
  background: #f1f7f1;
  font-size: 13px;
  font-weight: 700;
}

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

.category-card {
  display: grid;
  gap: 8px;
  min-height: 130px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.category-card:hover,
.category-card.active {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.category-card strong {
  font-size: 18px;
}

.category-card span {
  color: var(--muted);
  font-size: 13px;
}

.category-card b {
  color: var(--coral);
  font-size: 19px;
}

.course-form,
.order-query-form,
.checkout-form,
.login-form,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checkout-form,
.login-form {
  grid-template-columns: 1fr;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #d5ddd7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 91, 0.14);
}

.wide-field,
.primary-button.full {
  grid-column: 1 / -1;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 800;
}

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

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

.secondary-button {
  border: 1px solid #ccd8ce;
  color: var(--green-dark);
  background: #f4f8f4;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.danger-button {
  border: 1px solid #f0c6bd;
  color: #9f3d2d;
  background: #fff4f1;
}

.result-list,
.status-list,
.cart-list,
.order-list-admin {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.course-row,
.status-row,
.cart-item,
.admin-order {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.course-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}

.status-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.status-remarks,
.retry-message {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.retry-message {
  color: var(--green-dark);
  font-weight: 700;
}

.course-title,
.cart-title {
  min-width: 0;
  font-weight: 800;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.price {
  color: var(--coral);
  font-weight: 900;
}

.empty-state {
  padding: 22px;
  border: 1px dashed #ccd8ce;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfb;
  text-align: center;
}

.cart-panel {
  position: sticky;
  top: 82px;
}

.cart-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.cart-summary {
  display: grid;
  gap: 9px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.cart-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.cart-summary .total {
  font-size: 20px;
}

.cart-summary small {
  color: var(--muted);
}

.coupon-field {
  margin: 2px 0;
}

.coupon-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
}

.coupon-field input {
  padding: 10px 12px;
}

.coupon-control .secondary-button {
  min-height: 46px;
  padding: 0 12px;
  white-space: nowrap;
}

.order-box {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #cfd9d0;
  border-radius: 8px;
  background: #f6faf6;
}

.order-provider-line {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #cfd9d0;
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.order-provider-line.failed {
  border-color: #f0c6bd;
  background: #fff4f1;
  color: #9f3d2d;
}

.pay-form {
  display: grid;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 32, 28, 0.42);
}

.modal-panel {
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(14, 20, 17, 0.28);
  padding: 22px;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 1px solid #ccd8ce;
  border-radius: 7px;
  background: #f7faf7;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.modal-count {
  color: var(--muted);
  font-size: 14px;
}

.modal-status-list {
  max-height: 580px;
  overflow: auto;
  padding-right: 4px;
}

.modal-result-list {
  max-height: 580px;
  overflow: auto;
  padding-right: 4px;
}

.admin-shell {
  max-width: 1180px;
}

.login-panel {
  max-width: 520px;
  margin: 8vh auto 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact-table {
  margin-top: 12px;
}

.section-action {
  margin-top: 12px;
}

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  background: #f7faf7;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

.notice {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.admin-order small {
  color: var(--muted);
}

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

.coupon-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.coupon-row,
.admin-order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.coupon-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.coupon-row div {
  display: grid;
  gap: 3px;
}

.coupon-row small {
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.pagination:empty {
  display: none;
}

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

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

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

  .cart-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .topbar {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .topnav {
    flex: 0 0 auto;
    display: inline-flex;
    width: auto;
    gap: 6px;
    font-size: 13px;
  }

  .topnav a {
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    background: #fff;
    text-align: center;
  }

  .app-shell,
  .admin-shell {
    width: min(100% - 16px, 1180px);
    padding-top: 10px;
    padding-bottom: 28px;
  }

  .panel {
    padding: 14px;
  }

  .announcement-banner {
    margin-bottom: 8px;
    padding: 10px 12px;
  }

  .site-footer {
    width: min(100% - 16px, 1180px);
    margin: -12px auto 24px;
    padding: 12px;
    text-align: left;
  }

  .login-panel h1 {
    font-size: 26px;
  }

  .course-form,
  .order-query-form,
  .coupon-form,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .layout,
  .main-column,
  .side-column,
  .admin-side,
  .admin-grid {
    gap: 14px;
  }

  .section-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }

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

  .category-card {
    min-height: 104px;
    padding: 12px;
  }

  .category-card strong {
    font-size: 16px;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    min-height: 42px;
    padding: 0 12px;
  }

  .result-toolbar,
  .pagination {
    flex-wrap: wrap;
  }

  .pagination span {
    order: -1;
    flex: 1 0 100%;
    text-align: center;
  }

  .pagination button {
    flex: 1 1 0;
  }

  .course-row,
  .status-row,
  .cart-item {
    grid-template-columns: 1fr;
  }

  .course-row .meta-line:last-child,
  .status-row > button,
  .cart-item > button {
    width: 100%;
  }

  .course-row .meta-line:last-child .secondary-button {
    width: 100%;
  }

  .coupon-control {
    grid-template-columns: minmax(0, 1fr) 72px;
  }

  .table-wrap {
    border-radius: 7px;
  }
}

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