:root {
  --paper: #f5f0e7;
  --paper-deep: #ebe2d3;
  --ink: #261f1a;
  --muted: #74685e;
  --line: #d8cbbc;
  --wine: #7b2f38;
  --wine-dark: #5f2028;
  --green: #376b50;
  --white: #fffdf9;
  --shadow: 0 4px 16px rgba(61, 42, 29, 0.07);
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, #f8f4ed 0, var(--paper) 22rem); }
a { color: var(--wine); text-underline-offset: 3px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #c5873d; outline-offset: 3px; }

.site-header { min-height: 68px; display: flex; align-items: center; gap: 28px; padding: 12px clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--line); background: rgba(255, 253, 249, .9); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; color: var(--white); background: var(--wine); border-radius: 50%; }
nav { display: flex; gap: 20px; flex: 1; }
nav a { color: var(--muted); font-weight: 620; text-decoration: none; }
nav a:hover { color: var(--wine); }
.account-block { display: flex; align-items: center; gap: 12px; color: var(--muted); white-space: nowrap; }
.account-block form { margin: 0; }
.link-button { border: 0; background: none; padding: 0; color: var(--wine); cursor: pointer; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 56px; }
.page-heading { margin-bottom: 20px; max-width: 820px; }
.page-heading h1, .document-card h1, .empty-state h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.2; margin: 0; letter-spacing: -.02em; }
.auth-intro h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.18; margin: 0; letter-spacing: -.03em; }
.page-heading p, .auth-intro p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.eyebrow { margin: 0; color: var(--wine); font-size: 13px !important; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.card, .document-card, .course-card, .empty-card, .credential-card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.card { padding: 20px; }
.card h2 { margin: 0 0 16px; font-size: 18px; }
.primary, .secondary { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; padding: 9px 16px; font-weight: 720; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.primary { color: white; background: var(--wine); }
.primary:hover { background: var(--wine-dark); }
.secondary { color: var(--wine); background: transparent; border-color: #b99296; }
.secondary:hover { background: #f7eaeb; }
button:disabled { opacity: .55; cursor: wait; }

.auth-layout { min-height: 70vh; display: grid; grid-template-columns: minmax(260px, 380px) minmax(320px, 420px); gap: clamp(40px, 7vw, 84px); align-items: center; justify-content: center; }
.auth-intro { max-width: 380px; }
.auth-card { padding: 28px; }
.auth-card h2 { margin-bottom: 2px; }
.auth-card .primary { width: 100%; min-height: 48px; border-radius: 9px; margin-top: 2px; transition: background-color 160ms ease, transform 160ms ease; }
.auth-card .primary:active { transform: translateY(1px); }
.form-stack { display: grid; gap: 18px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; font-weight: 650; }
input, select { width: 100%; min-height: 44px; border: 1px solid #cbbcab; border-radius: 9px; background: #fffefa; color: var(--ink); padding: 9px 12px; }
label small, td small { display: block; color: var(--muted); font-weight: 400; margin-top: 4px; }
.narrow-stack { max-width: 590px; margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  .auth-card .primary { transition: none; }
  .course-card, .course-cover-image { transition: none !important; }
}

.notice { margin-bottom: 22px; border-radius: 12px; padding: 14px 17px; border: 1px solid; }
.notice-error { background: #fff0ef; color: #7d2525; border-color: #e1b4b0; }
.notice-success { background: #edf8f1; color: #285e42; border-color: #b2d2bf; }
.credential-card { padding: 24px; margin-bottom: 24px; border-color: #d7b47d; background: #fff8e9; }
.credential-card code { display: inline-block; margin: 10px 0; padding: 11px 14px; background: #2e251f; color: #fff; border-radius: 8px; font-size: 18px; word-break: break-all; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-title h2 { margin: 0; font-size: 22px; }
.section-title span { color: var(--muted); }
.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.library-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.library-tools input { flex: 1 1 320px; }
.library-tools select { flex: 0 1 220px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.course-card { min-width: 0; padding: 0; overflow: hidden; transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease; }
.course-card:hover { border-color: #bda998; box-shadow: 0 10px 28px rgba(61, 42, 29, .12); transform: translateY(-2px); }
.course-cover-link { display: block; overflow: hidden; color: inherit; text-decoration: none; background: var(--paper-deep); }
.course-cover-link:focus-visible { outline-offset: -4px; }
.course-cover-frame { display: block; overflow: hidden; }
.course-cover-image { display: block; width: 100%; height: auto; transition: transform 220ms ease; }
.course-cover-link:hover .course-cover-image { transform: scale(1.018); }
.course-meta { min-height: 124px; padding: 13px 16px 17px; }
.course-card h3 { margin: 4px 0 0; font-size: 18px; line-height: 1.35; }
.course-card p { color: var(--muted); margin: 0; }
.course-sequence { color: var(--wine) !important; font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.course-summary { display: -webkit-box; margin-top: 9px !important; overflow: hidden; color: #766b62 !important; font-size: 13px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

.two-column { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 22px; align-items: start; }
.stack { display: grid; gap: 14px; }
.empty-card { padding: 30px; color: var(--muted); text-align: center; }
.empty-state { min-height: 58vh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; max-width: 680px; }
.empty-state p { color: var(--muted); font-size: 17px; line-height: 1.7; }

.table-card { padding: 0; overflow: hidden; }
.table-card > .section-title { padding: 22px 24px 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e6dbcf; text-align: left; vertical-align: top; }
th { background: #f5eee4; color: var(--muted); font-size: 12px; letter-spacing: .06em; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.row-actions form { margin: 0; }
.row-actions .secondary { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.status { display: inline-block; border-radius: 999px; padding: 4px 9px; background: #eee5d9; font-size: 12px; font-weight: 760; }
.status-active, .status-success, .status-published { color: var(--green); background: #e7f1ea; }
.status-disabled, .status-denied, .status-error { color: #7d3434; background: #f4e5e3; }
.status-hidden { color: #6b5d4f; background: #eee5d9; }
.status-ready { color: var(--green); background: #e7f1ea; }
.status-degraded, .status-unavailable { color: #7d3434; background: #f4e5e3; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; margin-bottom: 22px; }
.load-more { margin: 18px 24px 24px; }
.document-card { max-width: 820px; margin: 0 auto; padding: clamp(28px, 5vw, 62px); }
.document-card h2 { font-family: "Songti SC", serif; margin-top: 30px; }
.document-card p { color: #544a42; line-height: 1.85; }

.system-status { display: grid; gap: 22px; }
.status-heading { max-width: none; margin: 0; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.status-heading p:last-child { margin: 0; }
.status-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.status-card { min-width: 0; }
.status-card .section-title { margin-bottom: 12px; }
.status-card .section-title h2 { font-size: 18px; }
.status-facts { display: grid; margin: 0; }
.status-fact { min-width: 0; display: grid; grid-template-columns: minmax(110px, .42fr) minmax(0, 1fr); gap: 14px; padding: 10px 0; border-bottom: 1px solid #eee4d8; }
.status-fact:last-child { border-bottom: 0; }
.status-fact dt { color: var(--muted); font-size: 13px; }
.status-fact dd { min-width: 0; margin: 0; font-weight: 670; overflow-wrap: anywhere; }
.status-note, .status-disclaimer { color: var(--muted); font-size: 13px; line-height: 1.6; }
.status-note { margin: 12px 0 0; }
.status-course-table table { min-width: 720px; }
.status-disclaimer { margin: -4px 2px 0; }

@media (max-width: 900px) {
  .site-header { flex-wrap: wrap; gap: 12px 20px; }
  nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 3px; }
  .auth-layout, .two-column { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .page-shell { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .site-header { padding-inline: 14px; }
  .account-block > span { display: none; }
  .course-grid { grid-template-columns: 1fr; }
  .library-tools { align-items: stretch; flex-direction: column; }
  .library-tools input, .library-tools select { flex: 0 0 auto; }
  .filter-grid { grid-template-columns: 1fr; }
  .status-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .status-fact { grid-template-columns: 1fr; gap: 3px; }
  .card, .auth-card { padding: 20px; }
  .table-card { padding: 0; }
}
