:root {
  /* American Councils brand: PMS 301 primary, PMS 7461 secondary (accent only) */
  --ac-blue: #004e7d;
  --ac-sky: #007db7;
  --ac-gold: #cd8b2a;
  --ink: #12263a;
  --muted: #566578;
  --faint: #8792a2;
  --line: #e1e6ed;
  --bg: #f3f5f8;
  --card: #ffffff;
  --accent: var(--ac-blue);
  --accent-soft: #e5eff6;
  --ok: #3f873f;
  --ok-soft: #e7f2e7;
  --warn: #a8691b;
  --warn-soft: #fbf2e2;
  --bad: #ca3625;
  --bad-soft: #fbe9e7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 40, 70, 0.05), 0 4px 16px rgba(0, 40, 70, 0.06);
  --font: "Montserrat", Arial, "Helvetica Neue", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- layout */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; letter-spacing: -0.01em; }
.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.spacer { flex: 1; }
.wrap { max-width: 880px; margin: 0 auto; padding: 24px 20px 64px; }
.wrap.wide { max-width: 1180px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } .wrap { padding: 16px 12px 56px; } .card { padding: 18px; } }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; margin: 0 0 8px; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; color: var(--faint); }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer;
  font-weight: 560;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { border-color: #c9cfda; }
.btn:focus-visible, .opt:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #9db5f0; outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2549ad; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 14px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }

label.field { display: block; }
label.field > span { display: block; font-size: 14px; font-weight: 560; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid #cdd3dd; border-radius: 8px; background: #fff;
}
textarea { min-height: 260px; resize: vertical; line-height: 1.6; }
input.code { font-size: 22px; letter-spacing: 0.12em; text-transform: uppercase; text-align: center; font-variant-numeric: tabular-nums; }

.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.langs button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.langs button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.notice { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); font-size: 15px; }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.notice.ok { background: var(--ok-soft); }

/* ---------------------------------------------------------------- test screens */
.testbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.secname { font-weight: 650; }
.secstep { color: var(--muted); font-size: 14px; }
.progress { flex: 1; min-width: 120px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.3s; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; padding: 4px 10px; border-radius: 6px; background: var(--bg); }
.timer.low { background: var(--warn-soft); color: var(--warn); }

.stem { font-size: 20px; line-height: 1.5; margin: 6px 0 18px; }
.stem .gap { display: inline-block; min-width: 72px; border-bottom: 2px solid var(--ink); margin: 0 4px; }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  min-height: 52px; padding: 12px 16px;
  border: 1.5px solid #cfd5df; border-radius: 9px;
  background: #fff; cursor: pointer; font-size: 17px;
}
.opt:hover { border-color: #9fb0d6; }
.opt .key { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid #b8c0cd; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.opt[aria-checked=true] { border-color: var(--accent); background: var(--accent-soft); }
.opt[aria-checked=true] .key { background: var(--accent); border-color: var(--accent); color: #fff; }

.q { padding: 16px 0; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; padding-top: 0; }
.q .qstem { font-weight: 580; margin-bottom: 10px; }
.q .opt { min-height: 44px; font-size: 16px; padding: 9px 14px; }

.reading { display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: start; }
.passage { white-space: pre-wrap; font-size: 17px; line-height: 1.7; padding: 20px; background: #fbfbfc; border: 1px solid var(--line); border-radius: 9px; max-height: 70vh; overflow: auto; }
.passage h3 { white-space: normal; }
@media (max-width: 900px) { .reading { grid-template-columns: 1fr; } .passage { max-height: none; } }

.player { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fbfbfc; margin-bottom: 18px; }
.player .play { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 20px; cursor: pointer; flex: none; }
.player .play[disabled] { background: #b8c0cd; cursor: not-allowed; }
.player .track { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.player .track > i { display: block; height: 100%; width: 0; background: var(--accent); }

.prompt { padding: 16px 18px; background: #fbfbfc; border: 1px solid var(--line); border-radius: 9px; }
.prompt ul { margin: 8px 0 0; padding-left: 22px; }
.wordcount { font-variant-numeric: tabular-nums; }

.rec { display: grid; place-items: center; gap: 14px; padding: 28px 12px; text-align: center; }
.rec .big { font-size: 44px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rec .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--bad); display: inline-block; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.meter { width: 220px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--ok); transition: width 0.08s; }

.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid #cfd5df; border-radius: 9px; cursor: pointer; background: #fff; text-align: left; width: 100%; }
.choice[aria-checked=true] { border-color: var(--accent); background: var(--accent-soft); }
.choice b { display: block; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.check { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--line); color: var(--muted); flex: none; }
.check.ok { background: var(--ok); color: #fff; }
.check.bad { background: var(--bad); color: #fff; }

.spinner { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 8px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- report */
.hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.badge-level { width: 112px; height: 112px; border-radius: 20px; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.badge-level b { font-size: 40px; line-height: 1; }
.badge-level span { font-size: 13px; opacity: 0.85; }
.skillrow { display: grid; grid-template-columns: 170px 1fr 92px; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.skillrow:first-child { border-top: 0; }
.skillrow .name { font-weight: 580; }
.skillrow .lvl { text-align: right; font-weight: 650; }
.skillrow .lvl small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.scale { position: relative; height: 28px; }
.scale .bands { position: absolute; inset: 9px 0; display: grid; grid-template-columns: repeat(7, 1fr); border-radius: 5px; overflow: hidden; }
.scale .bands i { border-right: 1px solid #fff; background: #e6eaf2; }
.scale .bands i:nth-child(n+2) { background: #dfe5f0; }
.scale .bar { position: absolute; left: 0; top: 9px; height: 10px; border-radius: 5px; background: var(--accent); }
.scale .ci { position: absolute; top: 6px; height: 16px; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); opacity: 0.35; }
.scale-labels { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 11px; color: var(--faint); text-align: center; margin-left: 184px; margin-right: 106px; }
@media (max-width: 640px) {
  .skillrow { grid-template-columns: 1fr 80px; }
  .skillrow .scale { grid-column: 1 / -1; grid-row: 2; }
  .scale-labels { margin: 0; }
}
.rec-list { list-style: none; margin: 0; padding: 0; counter-reset: rec; }
.rec-list li { position: relative; padding: 14px 0 14px 44px; border-top: 1px solid var(--line); counter-increment: rec; }
.rec-list li:first-child { border-top: 0; }
.rec-list li::before { content: counter(rec); position: absolute; left: 0; top: 14px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 650; font-size: 14px; }
.rec-list .tip { color: var(--muted); font-size: 15px; margin-top: 4px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------------------------------------------------------------- tables (admin) */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: #fafbfc; position: sticky; top: 0; cursor: pointer; user-select: none; }
table.data tr:hover td { background: #fafbfd; }
table.data td.num { font-variant-numeric: tabular-nums; }
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; max-height: 70vh; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; font-weight: 560; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--muted); }
dialog { border: 0; border-radius: 12px; padding: 0; max-width: 960px; width: calc(100% - 24px); box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
dialog::backdrop { background: rgba(20, 26, 38, 0.45); }
dialog .dhead { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
dialog .dbody { padding: 20px; max-height: 78vh; overflow: auto; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.group { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 14px; }
.group h3 { display: flex; justify-content: space-between; }
.group ol { margin: 6px 0 0; padding-left: 20px; font-size: 14px; }

/* ---------------------------------------------------------------- print: login slips and reports */
.slips { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.slip { border: 1px dashed #999; padding: 14px 16px; page-break-inside: avoid; font-size: 14px; }
.slip .cred { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: 0.08em; }
@media print {
  body { background: #fff; }
  .topbar, .noprint, .tabs { display: none !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .wrap { max-width: none; padding: 0; }
}


/* ================================================================ corporate theme */
body { color: var(--ink); }
h1, h2, h3 { color: #0b2a44; font-weight: 700; letter-spacing: -0.015em; }
.card { border-color: #e4e9ef; }

.topbar { padding: 12px 28px; min-height: 68px; box-shadow: 0 1px 0 rgba(0, 40, 70, 0.04); }
.topbar::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--ac-blue); }
.brandmark { display: flex; align-items: center; padding: 6px 0; }
.brandmark img { height: 40px; width: auto; display: block; }
.product { margin-left: 4px; padding-left: 16px; border-left: 1px solid var(--line); color: var(--ac-blue); font-weight: 600; font-size: 15px; line-height: 1.25; }
.product small { display: block; color: var(--faint); font-weight: 500; font-size: 12px; margin: 0; }
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .brandmark img { height: 30px; }
  .product { font-size: 13px; padding-left: 10px; }
  .product small { display: none; }
}
@media (max-width: 480px) {
  .product { display: none; }
  .langs button { padding: 6px 9px; }
}

.btn { border-radius: 8px; font-weight: 600; }
.btn.primary { background: var(--ac-blue); border-color: var(--ac-blue); }
.btn.primary:hover { background: var(--ac-sky); border-color: var(--ac-sky); }
.langs button[aria-pressed=true] { background: var(--ac-blue); color: #fff; }
.progress > i { background: var(--ac-sky); }
.opt[aria-checked=true] { border-color: var(--ac-sky); background: #eaf4fa; }
.opt[aria-checked=true] .key { background: var(--ac-sky); border-color: var(--ac-sky); }
.choice[aria-checked=true] { border-color: var(--ac-sky); background: #eaf4fa; }
.player .play { background: var(--ac-blue); }
.passage { font-family: var(--serif); font-size: 18px; line-height: 1.75; color: #1b2733; }
.passage h3 { font-family: var(--font); }
.stem { font-family: var(--serif); font-size: 21px; }
.badge-level { background: var(--ac-blue); border-radius: 16px; box-shadow: inset 0 -6px 0 var(--ac-sky); }
.scale .bar { background: var(--ac-sky); }
.rec-list li::before { background: var(--ac-blue); color: #fff; }
.tabs button[aria-selected=true] { color: var(--ac-blue); border-bottom-color: var(--ac-blue); }
.kpi { border-top: 3px solid var(--ac-blue); }
table.data th { color: #3d5166; }

/* sign-in pages: two-panel layout */
.auth { display: grid; grid-template-columns: 1.15fr 1fr; max-width: 1080px; width: calc(100% - 40px); margin: 40px auto; background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 24px 64px rgba(0, 40, 70, 0.14); }
.auth-hero { position: relative; background: var(--ac-blue); color: #fff; padding: 56px 52px 64px; }
.auth-hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--ac-sky); }
.auth-hero .kicker { text-transform: uppercase; letter-spacing: 0.16em; font-size: 12px; font-weight: 600; color: #cfe3f0; }
.auth-hero h1 { color: #fff; font-size: 38px; line-height: 1.15; margin: 14px 0 16px; }
.auth-hero p { color: #e3eef6; font-size: 16.5px; line-height: 1.6; margin-bottom: 26px; }
.auth-hero ul { list-style: none; padding: 0; margin: 0 0 30px; display: grid; gap: 14px; }
.auth-hero li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: #f2f7fb; }
.auth-hero li i { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--ac-sky); display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 700; }
.cefr-row { display: flex; gap: 6px; flex-wrap: wrap; }
.cefr-row span { border: 1px solid rgba(255, 255, 255, 0.45); color: #fff; border-radius: 6px; padding: 4px 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; }
.auth-form { padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.auth-form h2 { font-size: 24px; margin: 0; }
.auth-form .lead { color: var(--muted); margin: 0 0 6px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; margin: 0; width: 100%; border-radius: 0; box-shadow: none; }
  .auth-hero { padding: 32px 22px 40px; }
  .auth-hero h1 { font-size: 27px; }
  .auth-hero ul { display: none; }
  .auth-form { padding: 28px 22px 40px; }
}

.site-footer { text-align: center; color: var(--faint); font-size: 12.5px; padding: 28px 16px 36px; }
.site-footer b { color: var(--muted); font-weight: 600; }
.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.site-footer a:hover { color: var(--ac-blue); }

/* printed reports and slips carry the logo */
.print-head { display: none; }
.slip-logo { height: 22px; width: auto; display: block; margin-bottom: 8px; }
@media print {
  .print-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 3px solid var(--ac-blue); }
  .print-head img { height: 34px; }
  .print-head b { color: var(--ac-blue); }
  .site-footer { display: none; }
}
