:root {
  --ink: #0a193d;
  --muted: #687896;
  --paper: #f4f7ff;
  --white: #fff;
  --line: #dfe7f8;
  --orange: #002fa7;
  --orange-soft: #e8efff;
  --blue: #002fa7;
  --green: #18876a;
  --red: #d64545;
  --shadow: 0 18px 50px rgba(0, 47, 167, .10);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.brand-logo { display: block; width: min(300px, 82%); height: auto; }
.auth-logo { margin-bottom: 24px; }
.sidebar-logo { display: block; width: 38px; height: 38px; object-fit: contain; }

.landing,
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 78% 8%, rgba(0, 47, 167, .14) 0, transparent 30%), radial-gradient(circle at 8% 92%, rgba(0, 47, 167, .08) 0, transparent 36%), var(--paper);
}

.landing-card,
.auth-card { width: min(460px, 100%); background: rgba(255, 255, 255, .96); padding: 48px; border: 1px solid var(--line); border-radius: 32px; box-shadow: var(--shadow); }
.landing-card h1,
.auth-card h1 { font-size: 36px; margin: 20px 0 10px; }
.landing-card small { display: block; color: var(--muted); margin-top: 20px; }
.primary-link,
.primary { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 13px; background: var(--blue); color: #fff; text-decoration: none; padding: 13px 20px; font-weight: 750; cursor: pointer; box-shadow: 0 9px 22px rgba(0, 47, 167, .16); }
.landing-card .primary-link { margin-top: 20px; }
.auth-card label { display: block; color: var(--muted); font-size: 13px; margin-top: 18px; }
.auth-card input { display: block; width: 100%; margin-top: 7px; }
.auth-card .primary { width: 100%; margin-top: 24px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, #002fa7, #001e70); color: #fff; padding: 26px 18px; display: flex; flex-direction: column; }
.logo-row { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; font-size: 18px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav button,
.text-button { appearance: none; border: 0; background: transparent; color: #c6d4fa; padding: 12px 14px; text-align: left; border-radius: 12px; cursor: pointer; font: inherit; }
.sidebar nav button:hover,
.sidebar nav button.active { background: rgba(255, 255, 255, .14); color: #fff; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .18); padding: 20px 8px 0; display: flex; justify-content: space-between; align-items: center; }
.sidebar-foot .text-button { padding: 4px; color: #dbe5ff; }

.content { padding: 32px 40px; max-width: 1500px; width: 100%; margin: auto; }
.content > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.content h1 { margin: 0; font-size: 29px; }
.state-pill,
.badge { display: inline-flex; border-radius: 99px; padding: 6px 11px; background: #e8efff; color: var(--blue); font-size: 12px; font-weight: 750; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(145px, 1fr)); gap: 14px; }
.metric,
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 19px; padding: 20px; box-shadow: 0 8px 25px rgba(0, 47, 167, .045); }
.metric strong { display: block; font-size: 32px; margin-top: 8px; color: var(--blue); }
.metric span { color: var(--muted); }
.panel { margin-bottom: 16px; }
.panel h2 { margin: 0 0 16px; font-size: 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
button,
select,
input,
textarea { font: inherit; }
button.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 14px; border-radius: 10px; cursor: pointer; }
button.primary { padding: 10px 15px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
table { border-collapse: collapse; width: 100%; min-width: 720px; }
th,
td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f9fe; color: var(--muted); font-size: 12px; white-space: nowrap; }
tr:last-child td { border: 0; }
.status-green { color: var(--green); }
.status-yellow { color: #a86d00; }
.status-orange { color: var(--blue); }
.status-red { color: var(--red); }
.flash { margin: -12px 0 18px; background: #eef3ff; border: 1px solid #cbd9f8; padding: 12px 15px; border-radius: 12px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.course-card { background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 18px; }
.course-card h3 { margin: 0 0 6px; }
.course-card .row { display: flex; gap: 10px; justify-content: space-between; margin-top: 15px; }
.message-content { white-space: pre-wrap; max-width: 720px; max-height: 220px; overflow: auto; background: #f7f9fe; padding: 12px; border-radius: 10px; }
.tabs { display: flex; gap: 8px; overflow: auto; margin-bottom: 14px; }
.tabs button.active { background: var(--orange-soft); border-color: #9bb3ee; color: var(--blue); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid label { font-size: 12px; color: var(--muted); }
input,
select,
textarea { width: 100%; min-height: 44px; border: 1px solid #cdd9f0; background: #fff; border-radius: 11px; padding: 11px 13px; color: var(--ink); outline: none; }
textarea { min-height: 120px; }
input:focus,
select:focus,
textarea:focus { border-color: #002fa7; box-shadow: 0 0 0 3px #e8efff; }
.form-actions { display: flex; align-items: end; }
.empty { text-align: center; padding: 45px; color: var(--muted); }
.import-panel { border-top: 4px solid var(--blue); }
.import-panel .toolbar h2 { margin-bottom: 4px; }
.import-panel .toolbar p { margin: 0; }
.import-form { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; gap: 10px; align-items: end; }
.file-picker { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.file-picker input { padding: 8px; background: #f9fbff; }
.import-result { margin-top: 16px; padding: 16px; border-radius: 14px; }
.import-result h3 { margin: 0 0 12px; font-size: 16px; }
.import-result.passed { background: #effaf6; border: 1px solid #bfe9da; }
.import-result.has-errors { background: #fff6f6; border: 1px solid #f1cccc; }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px; }
  .logo-row { padding-bottom: 12px; }
  .sidebar nav { display: flex; overflow: auto; }
  .sidebar nav button { white-space: nowrap; }
  .sidebar-foot { display: none; }
  .content { padding: 22px 16px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .import-form { grid-template-columns: 1fr; }
  .landing-card,
  .auth-card { padding: 32px; }
  .content > header { align-items: flex-start; }
  .state-pill { margin-top: 6px; }
}
