:root {
  --ink: #172033;
  --muted: #667085;
  --line: #dde3ee;
  --paper: #f3f6fb;
  --card: #ffffff;
  --navy: #173b63;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #087a55;
  --green-soft: #e8f7f1;
  --amber: #9a5a00;
  --amber-soft: #fff4db;
  --red: #b42318;
  --red-soft: #ffebe9;
  --shadow: 0 16px 45px rgba(27, 45, 78, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 90% 0, #e8f0ff 0, transparent 35rem), var(--paper); font: 15px/1.55 Inter, "Segoe UI", Arial, sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, .button { border: 0; border-radius: 11px; background: var(--blue); color: white; padding: 11px 17px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
button:hover, .button:hover { filter: brightness(.96); text-decoration: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary, .button.secondary { background: var(--navy); }
button.ghost, .button.ghost { color: var(--navy); background: white; border: 1px solid var(--line); }

.shell { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.topbar { min-height: 82px; display: flex; align-items: center; gap: 28px; border-bottom: 1px solid rgba(23, 59, 99, .12); }
.brand { margin-right: auto; display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 43px; height: 43px; border-radius: 13px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--navy), var(--blue)); font-weight: 800; letter-spacing: -.02em; box-shadow: 0 8px 20px rgba(37, 99, 235, .24); }
.brand strong { display: block; font-size: 17px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.topbar nav { display: flex; gap: 18px; }
.topbar nav a { color: #344054; font-weight: 650; }
.version { padding: 5px 9px; border-radius: 999px; color: var(--navy); background: var(--blue-soft); font-size: 12px; font-weight: 800; }
main { padding: 38px 0 60px; }
footer { padding: 22px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.hero { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: end; margin-bottom: 24px; }
.hero h1 { margin: 4px 0 12px; max-width: 820px; font-size: clamp(30px, 4vw, 48px); line-height: 1.08; letter-spacing: -.04em; }
.hero p { max-width: 780px; margin: 0; color: var(--muted); font-size: 17px; }
.hero-facts { display: grid; gap: 8px; min-width: 210px; }
.hero-facts span { padding: 11px 14px; border: 1px solid rgba(37, 99, 235, .15); border-radius: 12px; background: rgba(255,255,255,.72); color: #475467; }
.hero-facts b { color: var(--blue); font-size: 18px; margin-right: 5px; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 12px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }

.card { border: 1px solid rgba(23, 59, 99, .12); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.connection-card { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.connection-card p { margin: 7px 0 0; color: var(--muted); }
.connection-card .guide-status { margin-top: 10px; font-size: 12px; }
.guide-status.updated { color: var(--green); }
.guide-status.cached, .guide-status.bundled { color: var(--amber); }
.connection-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.pill i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px currentColor; opacity: .88; }
.pill.ready { color: var(--green); }
.pill.waiting { color: var(--amber); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled { opacity: .62; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; align-items: start; }
.form-stack { display: grid; gap: 22px; }
.form-section { padding: 25px; }
.form-section header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.form-section header h2, .action-panel h2 { margin: 0; font-size: 22px; }
.form-section header p { margin: 3px 0 0; color: var(--muted); }
.step { flex: 0 0 auto; width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 11px; color: white; background: var(--navy); font-weight: 850; }
.step.large { width: 45px; height: 45px; font-size: 18px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: grid; gap: 7px; margin-bottom: 16px; color: #344054; font-weight: 700; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; border: 1px solid #cfd7e6; border-radius: 11px; color: var(--ink); background: #fff; padding: 11px 12px; outline: none; }
input, select, textarea { font-weight: 400; }
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, .11); }
input[readonly] { background: #f7f9fc; color: var(--muted); }
.curriculum-picker { margin: -2px 0 22px; padding: 18px; border: 1px solid #cddcf7; border-radius: 14px; background: linear-gradient(145deg, #f6f9ff, #fbfdff); }
.curriculum-picker label:last-of-type { margin-bottom: 10px; }
.picker-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.picker-heading strong { display: block; color: var(--navy); font-size: 16px; }
.picker-heading small { display: block; margin-top: 2px; color: var(--muted); }
.source-badge { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: 11px; font-weight: 850; }
.curriculum-status { margin: 0; padding: 10px 12px; border-radius: 9px; color: #475467; background: #fff; border: 1px solid var(--line); font-size: 12px; }
.curriculum-status.success { color: var(--green); background: var(--green-soft); border-color: #b6e7d5; }
.curriculum-status.warning { color: var(--amber); background: var(--amber-soft); border-color: #f2d28c; }
.action-panel { position: sticky; top: 18px; padding: 24px; background: linear-gradient(160deg, #fff, #f7faff); }
.action-panel h2 { margin: 15px 0 12px; }
.action-panel ul { margin: 18px 0 24px; padding: 0; list-style: none; display: grid; gap: 10px; }
.action-panel li { display: flex; gap: 8px; color: #475467; }
.action-panel li::before { content: "✓"; color: var(--green); font-weight: 900; }
.primary-action { width: 100%; padding: 14px 17px; font-size: 16px; }
.primary-action span { margin-left: auto; }
.hint { margin: 13px 0 0; color: var(--muted); font-size: 12px; }

.alert { padding: 13px 15px; border-radius: 11px; margin: 12px 0; }
.alert.error { color: var(--red); background: var(--red-soft); border: 1px solid #ffc7c1; }
.alert.warn { color: var(--amber); background: var(--amber-soft); border: 1px solid #f2d28c; }
.status-card { padding: 28px; }
.status-head { display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.status-head h1 { margin: 3px 0 8px; font-size: 32px; }
.status-head p:last-child { margin: 0; color: var(--muted); }
.percent { color: var(--blue); font-size: 34px; letter-spacing: -.04em; }
progress { width: 100%; height: 13px; margin: 24px 0 10px; border: 0; border-radius: 999px; overflow: hidden; }
progress::-webkit-progress-bar { background: #e8edf5; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--navy), var(--blue)); border-radius: 999px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--navy), var(--blue)); }
.status-meta { display: flex; justify-content: space-between; color: var(--muted); }
.status-card details { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.status-card summary { cursor: pointer; font-weight: 750; }
.events { color: var(--muted); }
.process-note { margin-top: 22px; padding: 24px; }
.process-note h2 { margin-top: 0; }
.result-actions, .preview-toolbar, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 18px; }
.result-card { padding: 22px; }
.result-card h2 { margin: 12px 0 4px; }
.result-card > p { margin: 0 0 16px; color: var(--muted); }
.result-top { display: flex; justify-content: space-between; align-items: center; }
.set-number { color: var(--blue); font-weight: 850; }
.status-badge { display: inline-flex; border-radius: 999px; padding: 4px 9px; color: var(--navy); background: var(--blue-soft); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.status-badge.approved { color: var(--green); background: var(--green-soft); }
.status-badge.revise, .status-badge.manual_review { color: var(--amber); background: var(--amber-soft); }
.status-badge.rejected, .status-badge.error { color: var(--red); background: var(--red-soft); }
.download-group { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 13px; display: flex; flex-wrap: wrap; gap: 8px 13px; align-items: center; }
.download-group h3 { width: 100%; margin: 0; font-size: 14px; }
.download-group a { font-weight: 700; font-size: 13px; }

.preview-card { padding: 28px; }
.preview-card pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.65 "Segoe UI", Arial, sans-serif; }
.page-heading { align-items: end; }
.page-heading h1 { margin: 3px 0 6px; font-size: 38px; }
.page-heading p:last-child { margin: 0; color: var(--muted); }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #475467; background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td { font-size: 13px; }
.empty { padding: 50px 24px; text-align: center; }
.empty h2 { margin: 0 0 7px; }
.empty p { color: var(--muted); }
.error-page { max-width: 620px; margin: 50px auto; padding: 42px; text-align: center; }
.error-icon { width: 52px; height: 52px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--red-soft); color: var(--red); font-size: 25px; font-weight: 900; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 14px 0; gap: 12px; }
  .brand { width: 100%; }
  .topbar nav { margin-right: auto; }
  .hero { grid-template-columns: 1fr; }
  .hero-facts { grid-template-columns: repeat(3, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .action-panel { position: static; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 20px, 1240px); }
  main { padding-top: 25px; }
  .hero h1 { font-size: 34px; }
  .hero-facts, .grid.two, .grid.three { grid-template-columns: 1fr; }
  .connection-card, .status-head, .status-meta, .page-heading { align-items: stretch; flex-direction: column; }
  .picker-heading { align-items: stretch; flex-direction: column; }
  .source-badge { align-self: flex-start; }
  .form-section { padding: 19px; }
  .result-actions, .preview-toolbar { flex-wrap: wrap; }
}
