/* Academy shell: login, dashboard, course viewer. Kandiq design system tokens. */
:root {
  color-scheme: light;
  --canvas: #edf1f8;
  --glow-1: rgb(143 176 255 / 55%);
  --glow-2: rgb(47 91 224 / 18%);
  --glass: rgb(255 255 255 / 64%);
  --glass-strong: rgb(255 255 255 / 86%);
  --glass-border: rgb(255 255 255 / 92%);
  --surface-1: #fff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #e1e6ef;
  --border-strong: #7f8ba1;
  --fg: #0f172a;
  --fg-muted: #4e5b72;
  --fg-subtle: #5f6b82;
  --accent: #2f5be0;
  --accent-hover: #244bc4;
  --accent-soft: rgb(47 91 224 / 10%);
  --danger: #b42f25;
  --danger-soft: #fce8e6;
  --sidebar: #0e1726;
  --sidebar-accent: #8fb0ff;
  --radius-control: .75rem;
  --radius-card: 1rem;
  --radius-glass: 1.375rem;
  --radius-panel: 1.75rem;
  --shadow-glass: 0 10px 30px rgb(15 23 42 / 6%);
  --shadow-card: 0 1px 2px rgb(15 23 42 / 5%);
  --shadow-pop: 0 24px 64px rgb(15 23 42 / 18%);
  --blur-glass: blur(24px) saturate(160%);
  --control-md: 2.75rem;
  --font-sans: "Manrope", system-ui, sans-serif;
}

html { font-size: clamp(15px, 0.3vw + 10.7px, 18px); }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font: 400 1rem/1.47 var(--font-sans);
  color: var(--fg);
  background-color: var(--canvas);
  background-image: radial-gradient(60rem 40rem at 88% -12%, var(--glow-1), transparent 60%), radial-gradient(50rem 35rem at 6% 112%, var(--glow-2), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); font-weight: 600; }
h1, h2 { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* brand */
.brand-mark { display: inline-grid; place-items: center; width: 2.13rem; height: 2.13rem; border-radius: .6rem; background: var(--accent); color: #fff; font-weight: 800; font-size: .867rem; letter-spacing: .02em; }
.brand-mark.lg { width: 3.2rem; height: 3.2rem; border-radius: .9rem; font-size: 1.2rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--control-md); padding: 0 1.33rem; border-radius: var(--radius-control); border: 0; background: var(--accent); color: #fff; font: inherit; font-size: .933rem; font-weight: 600; cursor: pointer; transition: background-color .15s; }
.btn:hover { background: var(--accent-hover); }
.btn-ghost { min-height: 2.4rem; padding: 0 .9rem; border-radius: var(--radius-control); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--fg); font: inherit; font-size: .867rem; font-weight: 600; cursor: pointer; }
.btn-ghost:hover { background: var(--surface-3); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.login-card { width: 100%; max-width: 27rem; padding: 2.4rem 2rem; background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: var(--radius-panel); box-shadow: var(--shadow-pop); -webkit-backdrop-filter: var(--blur-glass); backdrop-filter: var(--blur-glass); }
.login-head { text-align: center; margin-bottom: 1.6rem; }
.login-head h1 { font-size: 1.6rem; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; margin-top: 1rem; }
.login-head p { color: var(--fg-muted); margin: .4rem 0 0; }
.stack { display: flex; flex-direction: column; gap: 1.07rem; }
label { display: flex; flex-direction: column; gap: .4rem; font-size: .933rem; font-weight: 600; }
input[type="email"], input[type="password"], .login input[type="text"] { width: 100%; min-height: var(--control-md); padding: 0 .93rem; border-radius: var(--radius-control); border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--fg); font: inherit; font-size: 1rem; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.alert { margin: 0 0 1rem; padding: .9rem 1rem; border-radius: var(--radius-control); background: var(--danger-soft); color: var(--fg); font-size: .933rem; }
.alert::before { content: "✗ "; color: var(--danger); font-weight: 800; }

/* top bar */
.topbar { position: sticky; top: .75rem; z-index: 10; display: flex; align-items: center; gap: 1rem; min-height: 3.6rem; margin: .75rem; padding: .5rem .6rem .5rem 1rem; background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: var(--radius-glass); box-shadow: var(--shadow-glass); -webkit-backdrop-filter: var(--blur-glass); backdrop-filter: var(--blur-glass); }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--fg); text-decoration: none; font-weight: 700; font-size: 1.067rem; }
.crumbs { display: flex; align-items: center; gap: .4rem; min-width: 0; overflow: hidden; font-size: .933rem; font-weight: 600; }
.crumbs a { text-decoration: none; white-space: nowrap; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { color: var(--fg-subtle); }
.crumbs strong { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.topbar-right form { margin: 0; }
.who { font-size: .933rem; color: var(--fg-muted); font-weight: 500; }

/* dashboard */
.container { max-width: calc(82rem + 5rem); margin: 0 auto; padding: 1.6rem 2.5rem 4rem; }
.page-head { margin-bottom: 2rem; }
.page-head h1 { font-size: 2rem; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: .45rem 0 0; color: var(--fg-muted); font-size: 1.067rem; }
.count { display: inline-flex; align-items: center; min-height: 1.73rem; padding: 0 .67rem; margin-left: .4rem; border-radius: 9999px; background: var(--surface-3); color: var(--fg-muted); font-size: .867rem; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 1.07rem; }

.course { display: flex; flex-direction: column; overflow: hidden; color: var(--fg); text-decoration: none; font-weight: 400; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-glass); box-shadow: var(--shadow-glass); -webkit-backdrop-filter: var(--blur-glass); backdrop-filter: var(--blur-glass); transition: box-shadow .15s; }
.course:hover { box-shadow: var(--shadow-pop); }
.course-cover { aspect-ratio: 16 / 9; display: grid; place-items: center; background: var(--accent-soft); margin: .6rem .6rem 0; border-radius: var(--radius-card); overflow: hidden; }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-cover svg { width: 3.6rem; height: 3.6rem; fill: var(--accent); }
.course-body { padding: 1.1rem 1.4rem 1.4rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.course-body h2 { font-size: 1.333rem; line-height: 1.4; font-weight: 700; letter-spacing: -.01em; }
.course-body p { margin: 0; color: var(--fg-muted); }
.course-cta { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--control-md); padding: 0 1.2rem; border-radius: var(--radius-control); background: var(--accent); color: #fff; font-size: .933rem; font-weight: 600; }
/* The button's link covers the whole card; the certificate link sits above it. */
.course { position: relative; }
.course-actions { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.course-actions .course-cta { margin-top: 0; text-decoration: none; }
.course-cta::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-glass); }
.course-cert { position: relative; z-index: 1; font-size: .933rem; font-weight: 600; }
.course-badges { margin: 0 !important; display: flex; flex-wrap: wrap; gap: .4rem; }
.course-langs { margin: 0 !important; font-size: .733rem; font-weight: 700; letter-spacing: .06em; color: var(--accent); }
.course-cell { display: flex; align-items: center; gap: .75rem; }
.course-thumb { flex: none; width: 4rem; aspect-ratio: 16 / 9; border-radius: 6px; object-fit: cover; background: var(--accent-soft); display: block; }
.thumb-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem 1.5rem; margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.thumb-row h3 { margin: 0; font-size: 1rem; }
.thumb-row > .stack { flex: 1 1 18rem; }
.thumb-preview { flex: 0 0 15rem; max-width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius-card); overflow: hidden; background: var(--accent-soft); display: grid; place-items: center; }
.thumb-preview img { width: 100%; height: 100%; object-fit: cover; }
.course:hover .course-cta { background: var(--accent-hover); }
.empty { color: var(--fg-muted); }

/* ---------- progress (dashboard cards, results) ---------- */
/* ---------- billing ---------- */
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem 2rem; margin: 1rem 0 .6rem; }
.usage { display: grid; gap: .4rem; }
.usage-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .933rem; }
.usage-head strong { font-variant-numeric: tabular-nums; }
.meter.full > span { background: var(--danger); }
.plans-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin-bottom: 1rem; }
.plans-head h2 { margin: 0; }
.seg { display: inline-flex; padding: .2rem; border-radius: 9999px; background: var(--surface-2); border: 1px solid var(--border); }
.seg a { padding: .3rem .85rem; border-radius: 9999px; font-size: .867rem; font-weight: 600; color: var(--fg-muted); text-decoration: none; }
.seg a[aria-current] { background: var(--surface-1); color: var(--fg); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.plan-card { display: flex; flex-direction: column; gap: .6rem; padding: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface-1); }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card h3 { margin: 0; font-size: 1.2rem; }
.plan-card .ticks { margin: 0; flex: 1; }
.plan-card form { margin: 0; }
.plan-price { margin: 0; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-price span { font-size: .933rem; font-weight: 500; color: var(--fg-muted); }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.plan-card .ticks { list-style: none; padding: 0; display: grid; gap: .35rem; font-size: .933rem; }
.plan-card .ticks li { position: relative; padding-left: 1.3rem; }
.plan-card .ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.billing-actions { gap: .2rem .8rem; margin-top: .3rem; }
.billing-actions .link-btn { font-size: .8rem; }
.plans-edit input[type="number"], .plans-edit input[type="text"] { width: 100%; min-width: 4.5rem; }
.plans-edit td { padding: .5rem .5rem; }
.plans-edit td:first-child input { min-width: 9rem; }
.plans-edit input[name="price_idr"] { min-width: 8.5rem; }
.plans-edit input[type="checkbox"] { width: auto; min-width: 0; }

/* ---------- language picker ---------- */
.page-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; }
.lang-picker label { position: relative; display: inline-flex; align-items: center; }
.lang-picker svg { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); width: 1.05rem; height: 1.05rem; fill: none; stroke: var(--fg-muted); stroke-width: 1.6; pointer-events: none; }
.lang-picker select { min-height: 2.4rem; padding: 0 2rem 0 2.1rem; border-radius: var(--radius-control); border: 1px solid var(--border-strong); background-color: var(--surface-1); color: var(--fg); font: inherit; font-size: .867rem; font-weight: 600; cursor: pointer; }
.topbar .lang-picker { margin-left: .4rem; }

.meter { position: relative; height: .5rem; border-radius: 9999px; background: var(--border); overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--accent); }
.meter.ok > span { background: #1c7a4b; }
.course-progress { margin-top: auto; display: flex; flex-direction: column; gap: .35rem; }
.course-progress.done { flex-direction: row; }
.course-progress + .course-actions { margin-top: .5rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat { padding: 1rem 1.1rem; border-radius: var(--radius-card); background: var(--glass); border: 1px solid var(--glass-border); }
.stat strong { display: block; font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: .867rem; color: var(--fg-muted); font-weight: 500; }
.rate { display: flex; align-items: center; gap: .6rem; min-width: 9rem; }
.rate .meter { flex: 1; }
.rate .caption { min-width: 2.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.verify-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 2rem; margin: 1rem 0 0; }
.verify-facts dt { font-size: .867rem; color: var(--fg-muted); }
.verify-facts dd { margin: 0; font-weight: 700; }
.missed { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.missed li { display: grid; gap: .3rem; }

/* ---------- admin ---------- */
.admin-link { display: inline-flex; align-items: center; min-height: 2.4rem; padding: 0 .9rem; border-radius: var(--radius-control); background: var(--accent-soft); color: var(--accent); text-decoration: none; font-size: .867rem; }
.admin h2 { font-size: 1.333rem; line-height: 1.4; font-weight: 700; letter-spacing: -.01em; margin: 0 0 .8rem; }
.admin .card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 1.6rem; margin-bottom: 1.07rem; }
.admin .page-head p a { text-decoration: none; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: .3rem 1.8rem; border-bottom: 1px solid var(--border); margin: -.6rem 0 1.6rem; }
.admin-tabs a { position: relative; padding: .65rem 0 .8rem; font-size: .933rem; font-weight: 600; color: var(--fg-muted); text-decoration: none; }
.admin-tabs a:hover { color: var(--fg); }
.admin-tabs a[aria-current="page"] { color: var(--fg); }
.admin-tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

.msg { padding: .95rem 1.1rem; border-radius: var(--radius-control); margin: 0 0 1.07rem; color: var(--fg); }
.msg.ok { background: #e5f4eb; }
.msg.bad { background: var(--danger-soft); }
.msg.warn { background: #fff1d2; }
.msg.info { background: var(--accent-soft); }
.ok-text { color: #1c7a4b; font-weight: 600; }
.bad-text { color: var(--danger); font-weight: 600; }

.table-wrap { padding: 0 !important; overflow: hidden; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 1rem; }
.table th { text-align: left; font-size: .867rem; font-weight: 600; color: var(--fg-muted); background: var(--surface-2); padding: .7rem 1.07rem; border-bottom: 1px solid var(--border); }
.table td { padding: .9rem 1.07rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.caption { font-size: .867rem; line-height: 1.38; color: var(--fg-muted); font-weight: 500; }
code { font-size: .9em; background: var(--surface-3); padding: .1rem .4rem; border-radius: .35rem; }

.pill { display: inline-flex; align-items: center; min-height: 1.73rem; padding: 0 .67rem; border-radius: 9999px; font-size: .867rem; font-weight: 600; white-space: nowrap; background: #eef1f5; color: var(--fg-muted); }
.pill.ok { background: #e5f4eb; color: #1c7a4b; }
.pill.info { background: #e9effe; color: var(--accent); }
.pill.warn { background: #fff1d2; color: #955800; }
.pill.bad { background: var(--danger-soft); color: var(--danger); }

.btn-sm { display: inline-flex; align-items: center; justify-content: center; min-height: 2.4rem; padding: 0 .9rem; border-radius: var(--radius-control); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--fg); font: inherit; font-size: .867rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-sm:hover { background: var(--surface-3); }
.btn-sm.danger, .btn-danger { color: var(--danger); border: 1.5px solid var(--danger); background: var(--surface-2); }
.btn-danger { display: inline-flex; align-items: center; min-height: var(--control-md); padding: 0 1.33rem; border-radius: var(--radius-control); font: inherit; font-size: .933rem; font-weight: 600; cursor: pointer; }
.btn-danger:hover, .btn-sm.danger:hover { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { font-size: .933rem; margin-left: .6rem; text-decoration: none; }
.danger-zone { border-color: #f1c9c5 !important; }

.admin .field, .admin label.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.07rem; font-size: .933rem; font-weight: 600; min-width: 0; }
.admin .help { font-size: .867rem; font-weight: 500; color: var(--fg-muted); }
.admin input[type="text"], .admin input[type="email"], .admin input[type="password"], .admin input[type="number"], .admin input[type="date"], .admin select, .admin textarea {
  width: 100%; min-height: var(--control-md); padding: .55rem .93rem; border-radius: var(--radius-control); border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--fg); font: inherit; font-size: 1rem; font-weight: 400;
}
.admin textarea { line-height: 1.47; resize: vertical; }
.admin textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .867rem; min-height: 28rem; }
.admin input[type="file"] { font: inherit; padding: .6rem; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-control); background: var(--surface-2); }
.admin input:focus, .admin select:focus, .admin textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.check { display: flex !important; flex-direction: row !important; align-items: center; gap: .65rem; font-weight: 500 !important; cursor: pointer; }
.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.07rem; }
.span-2 { grid-column: 1 / -1; }
.form-inline { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.form-inline .field { flex: 1 1 18rem; margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 1.07rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.pw-row { display: flex; gap: .5rem; }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.actions details { display: inline-block; position: relative; text-align: left; }
.actions .menu { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; width: 20rem; display: flex; flex-direction: column; gap: .7rem; padding: 1rem; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-pop); white-space: normal; }
.actions .menu form { display: flex; flex-direction: column; gap: .5rem; margin: 0; }
.actions .menu .field { margin-bottom: 0; }

.job { margin-top: 1.2rem; }
.job-step { display: flex; align-items: center; gap: .7rem; padding: .95rem 1.1rem; border-radius: var(--radius-control); background: #e9effe; font-weight: 600; }
.spinner { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid rgb(47 91 224 / 25%); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* content editor */
.ed-module { border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: .75rem; background: var(--surface-1); }
.ed-module > summary { display: flex; align-items: center; gap: .8rem; padding: .9rem 1.07rem; font-weight: 700; }
.ed-module[open] > summary { border-bottom: 1px solid var(--border); }
.ed-num { width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: .867rem; flex: none; }
.ed-title { flex: 1; min-width: 0; }
.ed-body { padding: 1.07rem; display: flex; flex-direction: column; gap: .8rem; background: var(--surface-2); border-radius: 0 0 var(--radius-card) var(--radius-card); }
.ed-module-head { display: flex; gap: .75rem; align-items: flex-end; }
.ed-module-head .field { flex: 1; margin-bottom: 0; }
.ed-block, .ed-item { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-control); padding: .9rem 1rem .2rem; }
.ed-item { background: var(--surface-2); margin-bottom: .6rem; }
.ed-item-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.ed-tools { display: inline-flex; gap: .3rem; }
.icon-btn { width: 2.2rem; height: 2.2rem; border-radius: 9999px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; font: inherit; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.danger { color: var(--danger); }
.ed-repeat { margin-bottom: .9rem; }
.ed-thumb { display: block; max-width: 16rem; max-height: 10rem; object-fit: cover; border-radius: var(--radius-control); margin: -.4rem 0 1rem; border: 1px solid var(--border); }
.ed-savebar { position: sticky; bottom: .75rem; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; padding: .6rem .6rem .6rem 1.07rem; background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: var(--radius-glass); box-shadow: var(--shadow-pop); -webkit-backdrop-filter: var(--blur-glass); backdrop-filter: var(--blur-glass); }
.ed-body select { width: auto; }

@media (max-width: 760px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--border); padding: .6rem 0; }
  .table td { border: 0; padding: .3rem 1.07rem; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--fg-muted); font-size: .867rem; font-weight: 500; }
  .table td[data-label]:empty { display: none; }
  .table .actions { text-align: left; }
  .actions .menu { left: 0; right: auto; width: min(20rem, 80vw); }
  .admin-tabs { gap: .2rem 1.1rem; }
}

/* course viewer: one frame, the course scrolls inside it */
.page-learn { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.page-learn .topbar { position: static; flex: none; margin-bottom: 0; }
.course-frame { flex: 1; width: 100%; border: 0; background: transparent; }

@media (max-width: 700px) {
  .who { display: none; }
  .brand span:last-child { display: none; }
  .container { padding: 1.2rem 1rem 3rem; }
  .login-card { padding: 2rem 1.3rem; }
  .topbar { margin: .5rem; }
  .page-learn .crumbs span, .page-learn .crumbs strong { display: none; }
  .page-learn .crumbs:has(+ .lang-picker) { display: none; } /* the logo leads back to My courses */
  .topbar .lang-picker { margin-left: 0; }
  .topbar .lang-picker select { max-width: 7.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Upload: what to do with an HTML course */
.choice-group { border: 1px solid var(--border); border-radius: var(--radius-card); padding: .9rem 1.1rem 1rem; margin: 0; display: flex; flex-direction: column; gap: .7rem; }
.choice-group legend { font-weight: 700; padding: 0 .35rem; }
.choice-group .check { align-items: flex-start; }
.choice-group .check input { margin-top: .2rem; flex: none; }
.choice-group .caption { margin: 0; }

/* Access: who can see which course */
.access-wrap { padding: 0 !important; overflow-x: auto; }
.access-table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: .933rem; }
.access-table th, .access-table td { padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.access-table thead th { background: var(--surface-2); vertical-align: bottom; text-align: left; font-weight: 600; min-width: 9.5rem; max-width: 14rem; }
.access-table thead th:first-child { min-width: 13rem; }
.access-table thead a { display: block; color: var(--fg); text-decoration: none; line-height: 1.3; }
.access-table thead a:hover { color: var(--accent); }
.access-table .everyone { margin-top: .55rem; font-size: .8rem; color: var(--fg-muted); font-weight: 600 !important; }
.access-table tbody th { text-align: left; font-weight: 600; position: sticky; left: 0; z-index: 1; background: var(--surface-1); }
.access-table thead th:first-child { position: sticky; left: 0; z-index: 2; }
.access-table td.cell { text-align: center; }
.access-table td.cell input { width: 1.3rem; height: 1.3rem; accent-color: var(--accent); cursor: pointer; }
.access-table tbody tr:hover td, .access-table tbody tr:hover th { background: var(--surface-2); }
.access-table .admins-row th, .access-table .admins-row td { border-bottom: 0; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .65rem 1rem; margin-top: .75rem; }
.people-grid .check { align-items: flex-start; }
.people-grid .check input { margin-top: .15rem; flex: none; }
fieldset.people { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.people[disabled] { opacity: .5; }
.caption.block { display: block; }
.brand-logo { display: block; height: 2.2rem; width: auto; max-width: 9rem; object-fit: contain; border-radius: .4rem; }
.brand-logo.lg { height: 3.6rem; max-width: 14rem; margin: 0 auto .8rem; }
.logo-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.5rem; margin-top: 1rem; }
.logo-preview { display: grid; place-items: center; width: 12rem; height: 6rem; padding: .6rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-card); background: var(--surface-1); }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.5rem; margin-top: 1rem; }
.logo-preview { display: grid; place-items: center; width: 12rem; height: 6rem; padding: .6rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-card); background: var(--surface-1); }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.powered-by { margin: 1.2rem 0 0; text-align: center; font-size: .8rem; color: var(--fg-subtle); }
.powered-by a { color: inherit; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Write a course: sections with text and images */
.builder-hidden { align-self: end; padding-bottom: .7rem; }
.build-section .ed-item-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.build-section .ed-item-head h2 { margin: 0; font-size: 1.133rem; }
.build-section .field + .field { margin-top: .8rem; }
.build-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .8rem; margin: .9rem 0 .6rem; }
.build-images:empty { display: none; }
.build-img { margin: 0; display: flex; flex-direction: column; gap: .45rem; padding: .55rem; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface-2); }
.build-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: var(--radius-sm); }
.build-img .btn-sm { align-self: flex-start; }
.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

[hidden] { display: none !important; }

/* Modal window (manage a user) */
dialog.modal { width: min(30rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 1.4rem 1.5rem 1.5rem; border: 1px solid var(--border); border-radius: var(--radius-glass, 1.375rem); background: var(--surface-1, #fff); color: inherit; box-shadow: 0 24px 64px rgb(15 23 42 / 18%); }
dialog.modal::backdrop { background: rgb(14 23 38 / 55%); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: modal-in .22s ease-out both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog.modal[open] { animation: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-head .caption { margin: .2rem 0 0; }
.modal-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.modal-actions form { margin: 0; }

/* ---------- sub accounts ---------- */

/* Super admin visiting a sub account */
.super-banner { position: sticky; top: 0; z-index: 20; padding: .55rem 1rem; text-align: center; font-size: .933rem; background: #fff1d2; color: #5b3a00; border-bottom: 1px solid #f1d38a; }
.super-banner a { color: inherit; margin-left: .4rem; }

/* Sign-up and status pages */
.login-card.wide { max-width: 36rem; }
.login-foot { margin: 1.4rem 0 0; text-align: center; font-size: .933rem; color: var(--fg-muted); }
.status-card .login-head { margin-bottom: 0; }
.subdomain-row { display: flex; align-items: stretch; }
.subdomain-row input { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; min-width: 0; flex: 1; }
.subdomain-row .suffix { display: flex; align-items: center; padding: 0 .8rem; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius-control) var(--radius-control) 0; background: var(--surface-2, #f7f9fc); color: var(--fg-muted); font-weight: 600; white-space: nowrap; font-size: .933rem; }
.signup .help, .login .help { display: block; margin-top: .3rem; font-size: .867rem; font-weight: 500; color: var(--fg-muted); }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Super admin table */
.super-table .actions { white-space: normal; }
.super-table .actions .inline, .table .actions form.inline { display: inline-block; margin: .15rem 0 .15rem .3rem; }
.btn-sm.primary { background: var(--accent); color: var(--accent-fg, #fff); border-color: var(--accent); }
.request-note { margin-top: .35rem; max-width: 26rem; font-style: italic; }
.pill.bad { background: #fce8e6; color: #b42f25; }

/* Welcome form */
.welcome .card h2 { font-size: 1.2rem; margin: 0 0 .9rem; }
.welcome .field + .field { margin-top: .9rem; }
.tone-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tone { display: flex; gap: .7rem; align-items: flex-start; padding: .9rem 1rem; border: 1.5px solid var(--border); border-radius: var(--radius-card); cursor: pointer; background: var(--surface-1, #fff); transition: border-color .15s, box-shadow .15s; }
.tone:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tone input { margin-top: .25rem; accent-color: var(--accent); flex: none; }
.tone strong { display: block; margin-bottom: .2rem; }
.tone span { font-size: .933rem; color: var(--fg-muted); }
.tone strong { color: var(--fg); }
.color-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1rem; align-items: end; }
.color-pick { display: flex; align-items: center; gap: .7rem; margin-top: .35rem; }
.color-pick input[type="color"] { width: 3.2rem; height: 2.6rem; padding: .15rem; border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: #fff; cursor: pointer; }
.color-sample { --cs-primary: #2f5be0; --cs-dark: #0e1726; display: flex; height: 5.5rem; border-radius: var(--radius-card); overflow: hidden; border: 1px solid var(--border); }
.cs-side { width: 30%; background: var(--cs-dark); }
.cs-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: .45rem; padding: 0 1rem; background: #fff; }
.cs-btn { align-self: flex-start; padding: .3rem .8rem; border-radius: 9999px; background: var(--cs-primary); color: #fff; font-size: .8rem; font-weight: 700; }
.cs-link { color: var(--cs-primary); font-weight: 700; font-size: .867rem; text-decoration: underline; }

.login textarea { width: 100%; padding: .7rem .93rem; border-radius: var(--radius-control); border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--fg); font: inherit; font-size: 1rem; resize: vertical; }

/* ---------- guided tour (new academy admins) ---------- */

.tour-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.tour-spot { position: fixed; border-radius: var(--radius-card); box-shadow: 0 0 0 9999px rgb(14 23 38 / 55%), 0 0 0 3px var(--accent); }
.tour-dim { position: fixed; inset: 0; background: rgb(14 23 38 / 55%); }
.tour-pop { position: fixed; width: min(24rem, calc(100vw - 24px)); padding: 1.2rem 1.25rem 1.1rem; border-radius: var(--radius-glass); background: var(--surface-1); color: var(--fg); border: 1px solid var(--border); box-shadow: var(--shadow-pop); pointer-events: auto; animation: tour-in .25s ease-out both; outline: none; }
.tour-layer.centered .tour-pop { top: 50%; left: 50%; transform: translate(-50%, -50%); animation-name: tour-in-center; }
.tour-count { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.tour-bar { height: 4px; margin: .45rem 0 .8rem; border-radius: 9999px; background: var(--surface-3, #eef2f8); overflow: hidden; }
.tour-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.tour-pop h2 { margin: 0 0 .4rem; font-size: 1.15rem; line-height: 1.3; }
.tour-pop p { margin: 0; color: var(--fg-muted); font-size: .95rem; line-height: 1.5; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; }
.tour-actions span { display: flex; gap: .5rem; margin-left: auto; }
.tour-skip { padding-left: 0; }
.tour-pill { position: fixed; right: 1rem; bottom: 1rem; z-index: 55; display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem .55rem 1rem; border-radius: 9999px; background: var(--surface-1); border: 1px solid var(--border); box-shadow: var(--shadow-pop); font-size: .9rem; animation: tour-in .25s ease-out both; }
.tour-x { width: 2rem; height: 2rem; border-radius: 9999px; border: 0; background: transparent; color: var(--fg-muted); cursor: pointer; }
.tour-x:hover { background: var(--surface-2, #f7f9fc); }
.tour-replay { margin-top: 1rem; }
@keyframes tour-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tour-in-center { from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); } to { opacity: 1; transform: translate(-50%, -50%); } }
@media (max-width: 639px) {
  .tour-pop { left: 12px !important; right: 12px; bottom: 12px; top: auto !important; width: auto; }
  .tour-layer.centered .tour-pop { transform: none; animation-name: tour-in; }
  .tour-pill { left: 1rem; right: 1rem; border-radius: var(--radius-card); }
}
@media (prefers-reduced-motion: reduce) { .tour-pop, .tour-pill { animation: none; } }

/* ---------- emails ---------- */

.email-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1000px) { .email-edit { grid-template-columns: 1fr; } }
.email-preview { display: block; width: 100%; height: 34rem; border: 1px solid var(--border); border-radius: var(--radius-card); background: #edf1f8; }
.preview-card h2 { margin: 0 0 .3rem; }
.vars { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.vars code { padding: .15rem .45rem; border-radius: var(--radius-sm); background: var(--surface-3, #eef2f8); font-size: .85rem; }
.table-title { padding: 1.1rem 1.07rem .2rem; margin: 0; font-size: 1.1rem; }
.pad { padding: 0 1.07rem 1.1rem; }
