:root {
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: #172033;
  background: #f3f6fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f6fb; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(400px, 1.2fr);
  background: #fff;
}
.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 24px;
  padding: 64px;
  color: #fff;
  background: linear-gradient(145deg, #111b38, #173d86 62%, #127a79);
}
.login-brand img { width: min(340px, 90%); height: 110px; object-fit: contain; object-position: left center; }
.login-brand span { font-size: 26px; font-weight: 800; }
.admin-login-form { width: min(440px, calc(100% - 48px)); margin: auto; }
.login-heading { margin-bottom: 36px; }
.login-heading p, .section-heading span { margin: 0 0 8px; color: #2373df; font-size: 12px; font-weight: 900; }
.login-heading h1 { margin: 0 0 12px; font-size: 38px; }
.login-heading span { color: #71809b; }
.admin-login-form label, .course-form label { display: grid; gap: 9px; margin-bottom: 18px; font-weight: 700; }
.admin-login-form input, .course-form input, .course-form select, .course-form textarea, .table-tools input, .table-tools select {
  width: 100%; border: 1px solid #d6deeb; border-radius: 6px; background: #fff; color: #172033; outline: none;
}
.admin-login-form input, .course-form input, .course-form select, .table-tools input, .table-tools select { min-height: 48px; padding: 0 14px; }
.course-form textarea { padding: 13px 14px; resize: vertical; }
.admin-login-form input:focus, .course-form input:focus, .course-form select:focus, .course-form textarea:focus, .table-tools input:focus, .table-tools select:focus { border-color: #2373df; box-shadow: 0 0 0 3px rgba(35,115,223,.12); }
.admin-login-form button, .course-form button { width: 100%; min-height: 50px; border: 0; border-radius: 6px; color: #fff; background: #1768d5; font-weight: 800; cursor: pointer; }
.admin-login-form button:disabled, .course-form button:disabled { opacity: .6; cursor: wait; }
.login-message, .course-message { min-height: 22px; margin: 12px 0; color: #d7343e; font-weight: 700; }
.login-message.success, .course-message.success { color: #15845d; }
.back-link { color: #65728b; text-decoration: none; }

.dashboard { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px; color: #fff; background: #121c35; }
.sidebar-brand { display: grid; gap: 8px; margin: 0 10px 40px; color: #fff; text-decoration: none; }
.sidebar-brand img { width: 150px; height: 42px; object-fit: contain; object-position: left center; }
.sidebar-brand span { font-size: 13px; color: #aebad0; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item, .logout-btn { min-height: 44px; padding: 0 14px; border: 0; border-radius: 6px; color: #c8d2e5; background: transparent; text-align: left; font-weight: 700; cursor: pointer; }
.nav-item:hover, .nav-item.active { color: #fff; background: #2373df; }
.logout-btn { margin-top: auto; border: 1px solid #40506d; text-align: center; }
.dashboard-main { min-width: 0; padding: 32px clamp(20px, 4vw, 56px) 64px; }
.dashboard-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.dashboard-header p { margin: 0 0 6px; color: #6e7b93; font-size: 13px; }
.dashboard-header h1 { margin: 0; font-size: 28px; }
.dashboard-header a, .refresh-btn { min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px; border: 1px solid #cad5e6; border-radius: 6px; color: #25405f; background: #fff; text-decoration: none; font-weight: 700; cursor: pointer; }
.panel-section { margin-bottom: 26px; padding: 26px; border: 1px solid #e0e6f0; border-radius: 8px; background: #fff; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 22px; }
.section-note { margin: -8px 0 20px; color: #738097; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-grid article { min-height: 130px; display: grid; align-content: space-between; padding: 20px; border-left: 4px solid #2373df; background: #f6f8fc; }
.stat-grid article:nth-child(2) { border-color: #13a48a; }
.stat-grid article:nth-child(3) { border-color: #f2a324; }
.stat-grid .income-stat { border-color: #dd4758; }
.stat-grid span, .stat-grid small { color: #77849b; }
.stat-grid strong { font-size: 30px; }
.table-tools { display: grid; grid-template-columns: minmax(260px, 1fr) 190px; gap: 12px; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; border: 1px solid #e2e7ef; border-radius: 6px; }
table { width: 100%; min-width: 820px; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e7ebf2; text-align: left; white-space: nowrap; }
th { color: #62708a; background: #f7f9fc; font-size: 13px; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
.status-badge, .category-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; color: #13795b; background: #e5f7ef; font-size: 12px; font-weight: 800; }
.status-badge.unpaid { color: #9b6620; background: #fff2d7; }
.course-layout { display: grid; grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr); gap: 28px; }
.course-form { padding-right: 28px; border-right: 1px solid #e2e7ef; }
.upload-history h3 { margin: 0 0 16px; }
.course-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 16px 0; border-bottom: 1px solid #e7ebf2; }
.course-item h4 { margin: 0; font-size: 15px; }
.course-item p { grid-column: 1 / -1; margin: 0; color: #748198; font-size: 13px; line-height: 1.6; }
.course-item time { color: #8b96a9; font-size: 12px; }
.empty-state { padding: 38px 18px; color: #8290a6; background: #f7f9fc; text-align: center; }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-layout { grid-template-columns: 1fr; }
  .course-form { padding-right: 0; border-right: 0; }
}
@media (max-width: 720px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { min-height: 180px; justify-content: center; padding: 28px; }
  .login-brand img { width: 220px; height: 65px; }
  .login-brand span { font-size: 18px; }
  .admin-login-form { padding: 38px 0; }
  .dashboard { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px; }
  .sidebar-brand { margin-bottom: 16px; }
  .sidebar nav { grid-template-columns: repeat(2, 1fr); }
  .logout-btn { margin-top: 14px; }
  .dashboard-header { align-items: flex-start; flex-direction: column; }
  .panel-section { padding: 18px; }
  .stat-grid { grid-template-columns: 1fr; }
  .table-tools { grid-template-columns: 1fr; }
}
