/* Kitaab pages: account group. Loaded after app.css.
   Boards: KAccount, KAdmin, KMobileProgress, and the logged-in header of KProgress. */

/* ---------- Shared helpers ---------- */
.k-phone-only { display: none; }
.k-head { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.k-head-eyebrow { font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); line-height: 1.4; }
.k-head-title { font-family: var(--font-serif); font-size: 46px; font-weight: 600; line-height: 1.05; letter-spacing: -0.015em; }
.k-icon { flex: none; }

.k-table-frame { overflow-x: auto; border: 2px solid var(--ink); }
.k-table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: 15px; }
.k-table thead tr { background: var(--soft); border-bottom: 1px solid var(--ink); }
.k-table thead th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }
.k-table tbody { font-variant-numeric: tabular-nums; }
.k-table tbody tr { border-bottom: 1px dashed var(--muted); }
.k-table tbody tr:last-child { border-bottom: 0; }
.k-table tbody th { text-align: left; padding: 10px 14px; font-weight: 600; white-space: nowrap; }
.k-table td { padding: 10px 14px; }
.k-table .num-col { text-align: right; }

.ka-btn {
  align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; min-height: 48px; padding: 0 20px; border: 1px solid var(--ink); border-radius: 0;
  background: #FFFFFF; color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; text-decoration: none;
}
.ka-btn:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.btn-primary.ka-btn { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.btn-primary.ka-btn:hover:not(:disabled) { background: #000000; color: #FFFFFF; }
.ka-btn.ka-btn-red { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.ka-btn.ka-btn-red:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #FFFFFF; }

/* ---------- Logged-in header (KProgress / KAccount / KAdmin) ---------- */
.app-header { height: auto; min-height: 70px; padding: 8px 40px; gap: 10px 28px; }
.app-header .brand { align-self: center; }
.header-nav { gap: 22px; margin-left: 0; }
.header-nav a {
  padding: 0; font-size: 14px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
}
.header-nav a:hover { color: var(--accent-hover); }
.header-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.nav-icon { display: none; }
.header-context { margin-left: 0; }
.header-meta { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.header-date { display: none; }
@media (max-width: 1180px) {
  .header-meta { display: none; }
}

/* Phone and small tablet: wordmark + date on top, the main nav as a tab bar at the bottom (KMobileProgress). */
@media (max-width: 900px) {
  .app-header { min-height: 0; height: auto; padding: 8px 16px 6px; gap: 10px; }
  .app-header .mascot { width: 32px; height: 32px; }
  .brand { gap: 8px; }
  .brand-name { display: inline; font-size: 24px; }
  .header-date { display: inline; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); white-space: nowrap; }
  .header-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; gap: 0; margin: 0;
    overflow: visible; background: #FFFFFF; border-top: 1px solid var(--ink);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .header-nav a {
    flex: 1 1 0; min-width: 0; height: 60px; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    margin-top: -1px; border-top: 3px solid transparent; padding: 0 2px;
    font-size: 12px; font-weight: 700; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .header-nav a[aria-current="page"] { text-decoration: none; border-top-color: var(--accent); font-weight: 700; }
  .nav-icon { display: block; }
  body:not(.is-full) .app-main { padding-bottom: 60px; }
  /* The lesson screen has its own bottom tabs (KMobileLesson draws no main nav). */
  body.is-full .header-nav { display: none; }
}
@media (max-width: 360px) {
  .header-nav a { letter-spacing: .02em; font-size: 11px; }
}

/* ---------- Account (KAccount) ---------- */
.ka-page { max-width: 1200px; padding: 32px 40px 56px; gap: 30px; }
.ka-cols { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.ka-usage { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; border-top: 2px solid var(--ink); padding-top: 14px; }
.ka-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.ka-sec-head h2, .ka-export h2 { margin: 0; font-family: var(--font-serif); font-size: 28px; font-weight: 600; line-height: 1.2; }
.ka-sub { font-size: 14px; color: var(--muted); }

.ka-usage .limits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.ka-usage .limit { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; }
.ka-usage .limit + .limit { padding-top: 14px; border-top: 1px dashed var(--muted); }
.limit-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; font-size: 15px; }
.limit-label { font-weight: 600; }
.limit-used { font-family: var(--font-serif); font-size: 18px; font-weight: 400; }
.limit.is-warn .limit-bar, .limit.is-full .limit-bar { outline: 0; }
.ka-usage .limit-bar { height: 8px; border: 1px solid var(--ink); background: #FFFFFF; border-radius: 0; }
.ka-usage .limit-bar > span { background: var(--ink); }
.limit.is-warn .limit-used, .limit.is-full .limit-used { color: var(--accent); }
.limit.is-warn .limit-bar > span, .limit.is-full .limit-bar > span { background: var(--accent); }
.limit-warn { margin: 2px 0 0; display: flex; align-items: flex-start; gap: 8px; color: var(--accent); font-weight: 600; }
.limit-warn .k-icon { margin-top: 1px; }
.limit-warn a { color: var(--accent); }
.limit-foot { font-size: 13px; color: var(--muted); }
.ka-days { margin-top: 6px; }
.ka-days .k-label { margin: 0 0 8px; }

.ka-side { flex: 1 1 340px; min-width: 0; max-width: 460px; display: flex; flex-direction: column; gap: 30px; }
.ka-export { border-top: 2px solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.ka-lede { margin: 0; font-family: var(--font-serif); font-size: 18px; line-height: 1.5; color: #3D3D3D; }
.ka-list { margin: 0; padding-left: 20px; font-family: var(--font-serif); font-size: 17px; line-height: 1.6; }
.ka-strong { margin: 0; font-weight: 600; }

.ka-delete { border: 2px solid var(--accent); }
.ka-delete-head {
  margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--accent); background: var(--soft);
  font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); line-height: 1.4;
}
.delete-account { padding: 16px 14px; display: flex; flex-direction: column; gap: 14px; }
.ka-del-form { display: flex; flex-direction: column; gap: 14px; }
.ka-del-text { margin: 0; font-family: var(--font-serif); font-size: 18px; line-height: 1.5; }
.ka-input { height: 48px; width: 100%; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--ink); border-radius: 0; background: #FFFFFF; font: inherit; font-size: 16px; color: var(--ink); }
.ka-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ka-input[aria-invalid="true"] { border: 2px solid var(--accent); }
.ka-mono { font-family: var(--font-code); }
.ka-err { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 15px; }
.ka-err[hidden] { display: none; }
.ka-del-form > .field-error:empty { display: none; }
.ka-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Admin (KAdmin) ---------- */
.kad-page { max-width: 1280px; padding: 28px 40px 56px; gap: 24px; }
.kad-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 40px; border-bottom: 1px solid var(--ink); }
.kad-top .k-head { padding-bottom: 14px; }
.kad-tabs { display: flex; gap: 28px; }
.kad-tab {
  height: 48px; display: inline-flex; align-items: center; border-bottom: 3px solid transparent; margin-bottom: -1px;
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
}
.kad-tab:hover { color: var(--accent-hover); }
.kad-tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.kad-prompts { display: flex; flex-wrap: wrap; gap: 36px; align-items: flex-start; }
.kad-versions { flex: 1 1 220px; max-width: 260px; display: flex; flex-direction: column; gap: 20px; }
.kad-name { margin: 0 0 6px; font-family: var(--font-code); font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1.4; }
.kad-vlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.kad-vlist li { border-bottom: 1px dashed var(--muted); }
.version-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0; border: 0; border-radius: 0;
  background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.version-btn:hover, .version-btn[aria-pressed="true"] { background: none; border: 0; }
.version-btn:hover .version-n { text-decoration: underline; }
.kad-detail .placeholders { display: block; font-size: 15px; }
.version-n { font-weight: 600; }
.kad-vmeta { font-size: 13px; color: var(--muted); }
.version-btn[aria-pressed="true"] { color: var(--accent); font-weight: 700; }
.version-btn[aria-pressed="true"] .version-n { font-weight: 700; }
.version-btn[aria-pressed="true"] .kad-vmeta { color: #3D3D3D; font-weight: 500; }
.kad-badge { padding: 2px 6px; border: 1px solid var(--success); color: var(--success); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

.kad-detail { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.kad-detail-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
#prompt-h { margin: 0; font-family: var(--font-serif); font-size: 30px; font-weight: 600; line-height: 1.2; }
#prompt-h:focus { outline: none; }
#prompt-h:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kad-state { margin-left: 14px; font-family: var(--font-ui); font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--success); }
.kad-code { border: 2px solid var(--ink); }
.kad-code-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--ink); background: var(--soft); font-family: var(--font-code); font-size: 12px; font-weight: 600; }
.kad-code .prompt-text {
  margin: 0; height: 220px; max-height: none; overflow: auto; padding: 14px 16px; border: 0; border-radius: 0; background: #FFFFFF;
  font-family: var(--font-code); font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink);
}
.kad-ph { color: var(--accent); }
.placeholders .k-label { margin: 0 0 8px; }
.kad-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--font-code); font-size: 13px; }
.kad-chips li { padding: 4px 8px; border: 1px solid var(--ink); }
.kad-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.kad-actions:empty, .kad-confirm-slot:empty, .kad-status:empty { display: none; }
.kad-confirm { border: 2px solid var(--accent); padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.kad-confirm-text { flex: 1 1 300px; min-width: 0; }
.kad-confirm-q { margin: 0; font-weight: 700; color: var(--accent); }
.kad-confirm-d { margin: 4px 0 0; font-family: var(--font-serif); font-size: 17px; }
.kad-confirm .field-error:empty { display: none; }
.kad-btn-sm { height: 44px; min-height: 44px; padding: 0 18px; }
.kad-textarea {
  display: block; width: 100%; box-sizing: border-box; min-height: 320px; padding: 14px 16px; border: 0; border-radius: 0; resize: vertical;
  font-family: var(--font-code); font-size: 14px; line-height: 1.7; color: var(--ink); background: #FFFFFF;
}
.kad-textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.kad-textarea[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.kad-editor-foot { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--ink); }
.kad-editor-foot .field-error:empty { display: none; }
.kad-status { margin: 0; color: var(--success); font-weight: 600; }

.kad-evals { border-top: 2px solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; gap: 16px; }
.kad-top + .kad-evals { border-top: 0; padding-top: 0; }
.kad-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.kad-sec-head h2 { margin: 0; font-family: var(--font-serif); font-size: 28px; font-weight: 600; line-height: 1.2; }
.kad-evals-cols { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.kad-evals-main { flex: 999 1 560px; min-width: 0; }
.kad-table { min-width: 640px; font-size: 14px; }
.kad-table thead th, .kad-table tbody th, .kad-table td { padding: 9px 12px; }
.kad-table tbody th a { color: var(--ink); }
.kad-table tbody th a:hover { color: var(--accent); }
.kad-mono { font-family: var(--font-code); font-size: 13px; }
.kad-good { color: var(--success); font-weight: 600; }
.kad-bad { color: var(--accent); font-weight: 600; }
.kad-stop { color: var(--accent); font-family: var(--font-code); font-size: 13px; font-weight: 600; }
.kad-muted { color: var(--muted); }
.kad-run-form { flex: 1 1 260px; max-width: 320px; }
.kad-run-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.kad-check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.kad-check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--ink); }
.kad-check-strong { font-weight: 600; }
.kad-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.kad-fieldset legend { float: left; width: 100%; padding: 8px 0 2px; border-top: 1px dashed var(--muted); font-size: 13px; font-weight: 700; }
.kad-fieldset > label { clear: both; }
.kad-field { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--muted); }
.kad-field label { font-size: 13px; font-weight: 700; }
.kad-select { height: 44px; padding: 0 10px; border: 1px solid var(--ink); border-radius: 0; background: #FFFFFF; font: inherit; color: var(--ink); max-width: 100%; }
.kad-run { align-self: stretch; margin-top: 6px; width: 100%; }
.kad-run-body .eval-status:empty { display: none; }

.kad-back { margin: 0; font-weight: 600; }
.kad-result { font-size: 15px; font-weight: 600; }
.kad-facts { margin: 0; display: flex; flex-wrap: wrap; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.kad-facts > div { flex: 1 1 160px; min-width: 0; padding: 10px 12px; border-left: 1px solid var(--ink); }
.kad-facts > div:first-child { border-left: 0; padding-left: 0; }
.kad-facts dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kad-facts dd { margin: 4px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.kad-cases .k-label { margin: 0 0 4px; }
.kad-cases .eval-cases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 2px solid var(--ink); }
.kad-cases .eval-case { border: 0; border-bottom: 1px dashed var(--muted); border-radius: 0; padding: 12px 0; gap: 6px; }
.kad-cases .eval-case.is-fail { border-left: 4px solid var(--accent); padding-left: 14px; }
.kad-case-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.kad-verdict { padding: 2px 6px; border: 1px solid currentColor; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.eval-case.is-pass .kad-verdict { color: var(--success); }
.eval-case.is-fail .kad-verdict { color: var(--accent); }
.kad-judge { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 14px; }
.kad-judge .k-label { margin: 0; }
.kad-cases .reply-text { border: 1px solid var(--ink); border-radius: 0; background: #FFFFFF; max-height: 320px; overflow: auto; }

/* ---------- Phone: account and admin ---------- */
@media (max-width: 720px) {
  .k-head-title { font-size: 30px; }
  .ka-page, .kad-page { padding: 16px 16px 32px; gap: 22px; }
  .ka-cols { gap: 30px; }
  .ka-side, .kad-versions, .kad-run-form { max-width: none; }
  .ka-sec-head h2, .ka-export h2, .kad-sec-head h2 { font-size: 24px; }
  #prompt-h { font-size: 24px; }
  .kad-top { gap: 4px 20px; }
  .kad-top .k-head { padding-bottom: 6px; }
  .kad-code .prompt-text { height: 260px; font-size: 13px; }
  .kad-facts > div { flex-basis: 140px; }
}

/* ---------- Phone Progress (KMobileProgress). Desktop Progress is unchanged. ---------- */
.k-lead-top { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 720px) {
  .k-wide-only { display: none; }
  .k-phone-only { display: revert; }

  .progress-page { padding: 14px 16px 24px; gap: 14px; }
  .masthead { text-align: left; padding: 0; border: 0; }
  .masthead h1 { align-items: flex-start; gap: 0; }
  .masthead-date { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .masthead-name { font-size: 34px; line-height: 1.05; }
  .masthead-sub { display: none; }

  .k-front { flex-direction: column; flex-wrap: nowrap; gap: 14px; align-items: stretch; }
  .k-lead, .k-side { display: contents; }

  .k-lead-top { order: 1; gap: 10px; border: 2px solid var(--ink); padding-bottom: 12px; }
  .k-lead-top > * { margin-left: 12px; margin-right: 12px; }
  .k-lead-top > .k-kicker { margin: 0; padding: 8px 12px; background: var(--soft); border-bottom: 1px solid var(--ink); }
  .k-lead-top .k-lead-title { font-size: 24px; line-height: 1.15; }
  .k-lead .k-lead-text { display: none; }
  .k-lead.is-empty .k-lead-text { display: block; font-size: 17px; }
  .k-lead-bar .progress { height: 6px; }
  .k-lead-actions .k-note { display: none; }
  .k-lead-actions { display: block; }
  .k-btn-lead { width: 100%; height: 50px; justify-content: center; }

  .k-stats-sec { order: 2; }
  .k-stats-sec > .k-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .k-side-sec .stats { flex-wrap: nowrap; }
  .k-side-sec .stat { flex: 1 1 0; min-width: 0; padding: 8px; }
  .k-side-sec .stat:last-child { flex-grow: 1.2; padding-right: 0; }
  .k-side-sec .stat .value { font-size: 28px; }
  .k-stats-sec .k-unit { font-size: 16px; }
  .k-stat-label { margin-top: 4px !important; font-size: 12px; }
  .k-stat-note { display: none; }

  .k-contents { order: 3; margin-top: 0; padding-top: 0; border-top: 0; }
  .k-contents-head, .k-contents > .progress { display: none; }
  .k-contents-goal { margin: 0 0 2px; }
  .k-toc { font-size: 17px; }
  .k-toc-item { gap: 10px; padding: 7px 0; }
  .k-toc-num { width: 26px; }
  .k-toc-state { font-size: 12px; }

  .k-week-sec, .k-goals-sec, .k-front .k-box { display: none; }
  .k-front.no-lead .k-box { display: block; order: 2; }
  .k-front.no-lead .k-goals-sec { display: block; order: 3; }

  .k-also { order: 4; margin: 0; font-size: 14px; color: #3D3D3D; }
  .k-also-link { padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; text-decoration: underline; }
  .k-also-link:hover { color: var(--accent-hover); }
}

/* Copyright footer (all pages except the lesson). On phones it sits above the fixed bottom tab bar. */
.app-footer { flex: none; border-top: 1px solid var(--ink); padding: 18px 40px; text-align: center; }
.app-footer[hidden] { display: none; }
.app-footer-text { margin: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 900px) {
  body:not(.is-full) .app-main { padding-bottom: 0; }
  .app-footer { padding: 16px 16px calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* Header never squeezes the nav: words stay whole, the goal name shortens first (design review 2026-11-14). */
@media (min-width: 901px) {
  .app-header .brand, .header-nav, .lang-switch { flex: none; }
  .header-nav a { white-space: nowrap; }
  .header-context { flex: 0 1 auto; min-width: 0; max-width: 34ch; }
  .app-header.has-context .header-meta { display: none; }
}
@media (min-width: 901px) and (max-width: 1100px) {
  .header-context { display: none; }
}
/* Phone header: brand, date and the full-name language picker must fit 390px. */
@media (max-width: 420px) { .header-date { display: none; } }

/* ---------- Guide (/guide): a short book with contents and six chapters ---------- */
.kgd-page { max-width: 1120px; gap: 28px; }
.kgd-head { padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.kgd-eyebrow { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.kgd-head h1 { margin: 8px 0 10px; font-family: var(--font-serif); font-size: 52px; font-weight: 600; line-height: 1.05; letter-spacing: -0.015em; }
.kgd-intro { margin: 0; max-width: 62ch; font-family: var(--font-serif); font-size: 20px; line-height: 1.55; color: #3D3D3D; }
.kgd-body { display: grid; grid-template-columns: 240px minmax(0, 720px); gap: 56px; align-items: start; }
.kgd-side { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 20px; }
.kgd-label { margin: 0 0 8px; font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kgd-contents ol { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.kgd-contents li { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px dashed var(--muted); }
.kgd-contents-num { flex: none; width: 28px; font-size: 12px; font-weight: 700; color: var(--accent); }
.kgd-contents a { display: flex; align-items: center; min-height: 44px; flex: 1; font-family: var(--font-serif); font-size: 17px; color: var(--ink); text-decoration: none; }
.kgd-contents a:hover, .kgd-contents a:focus-visible { color: var(--accent); text-decoration: underline; }
.kgd-side-cta .btn { width: 100%; justify-content: center; color: #FFFFFF; }
.kgd-chapters { display: flex; flex-direction: column; gap: 44px; min-width: 0; }
.kgd-chapter { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; border-top: 2px solid var(--ink); scroll-margin-top: 16px; }
.kgd-chapter:focus { outline: none; }
.kgd-chapter:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.kgd-num { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.kgd-title { margin: 0; font-family: var(--font-serif); font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.kgd-lede { margin: 0; font-family: var(--font-serif); font-size: 19px; line-height: 1.55; color: #3D3D3D; }
.kgd-steps { margin: 4px 0 0; padding: 0; list-style: none; counter-reset: kg; }
.kgd-steps li {
  counter-increment: kg; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 8px; padding: 12px 0;
  border-bottom: 1px dashed var(--muted); font-family: var(--font-serif); font-size: 18px; line-height: 1.55;
}
.kgd-steps li::before { content: counter(kg) "."; font-family: var(--font-ui); font-size: 14px; font-weight: 700; padding-top: 3px; }
.kgd-tip { margin: 6px 0 0; padding: 10px 14px; border-left: 4px solid var(--ink); background: var(--soft); font-size: 15px; line-height: 1.5; }
.kgd-go { margin: 0; }
.kgd-go a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.kgd-providers { margin: 0; padding: 0; list-style: none; border: 1px solid var(--ink); }
.kgd-providers li { padding: 6px 14px; border-bottom: 1px dashed var(--muted); }
.kgd-provider-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; min-height: 44px; }
.kgd-providers li:last-child { border-bottom: 0; }
.kgd-provider { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.kgd-rec { padding: 2px 8px; border: 1px solid var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.kgd-providers li.is-rec { background: var(--soft); }
.kgd-providers a { font-weight: 700; }
.kgd-note { font-size: 14px; color: var(--muted); }
/* Screenshots (img/guide/<lang>/): wide app shots fill the column; tall workspace shots sit side by side. */
.kgd-shots { display: flex; flex-wrap: wrap; gap: 20px; margin: 6px 0 2px; }
.kgd-shot { flex: 1 1 100%; min-width: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.kgd-shot.is-tall { flex: 0 1 300px; }
.kgd-shot-open { display: block; width: 100%; padding: 0; border: 1px solid var(--ink); background: var(--panel); cursor: zoom-in; box-shadow: 4px 4px 0 var(--ink); transition: box-shadow .15s, transform .15s; }
.kgd-shot-open:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
.kgd-shot-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.kgd-shot-open img { display: block; width: 100%; height: auto; }
.kgd-shot figcaption { display: flex; gap: 10px; align-items: baseline; font-family: var(--font-serif); font-size: 15px; line-height: 1.45; color: #3D3D3D; }
.kgd-shot-n { flex: none; font-family: var(--font-ui); font-size: 12px; font-weight: 700; color: var(--accent); }
.kgd-provider-how { margin: 2px 0 8px; }
.kgd-provider-how summary { display: flex; align-items: center; min-height: 40px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent); }
.kgd-provider-how summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kgd-provider-how .kgd-shots { margin-top: 4px; }
#kgd-zoom { width: min(1100px, calc(100vw - 32px)); }
#kgd-zoom .kdl-body { padding: 12px; }
.kgd-zoom-img { display: block; width: 100%; height: auto; max-height: calc(100vh - 200px); object-fit: contain; border: 1px solid var(--ink); }
@media (prefers-reduced-motion: reduce) { .kgd-shot-open { transition: none; } .kgd-shot-open:hover { transform: none; } }
.reduce-motion .kgd-shot-open { transition: none; }
.reduce-motion .kgd-shot-open:hover { transform: none; }
/* Walkthrough video (js/guide-video.js): local poster, the YouTube iframe only after a click. */
.kgd-video { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; border-top: 2px solid var(--ink); scroll-margin-top: 16px; }
.kgd-video:focus, .kgd-video:focus-visible { outline: none; box-shadow: none; }
.kgd-video-title { margin: 0; font-family: var(--font-serif); font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.kgd-player { position: relative; width: 100%; aspect-ratio: 16 / 9; border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); background: var(--panel); overflow: hidden; }
.kgd-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--ink); }
.kgd-poster { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: var(--panel); cursor: pointer; }
.kgd-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kgd-play { position: absolute; left: 50%; top: 72%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border: 2px solid var(--ink); background: var(--accent); color: #FFFFFF; font-family: var(--font-ui); font-size: 16px; font-weight: 700; white-space: nowrap; }
.kgd-play::before { content: ""; border-left: 14px solid #FFFFFF; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.kgd-poster:hover .kgd-play { background: #8A0B1F; }
.kgd-poster:focus-visible { outline: 3px solid var(--accent); outline-offset: -6px; }
.kgd-len { position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; background: var(--ink); color: #FFFFFF; font-family: var(--font-ui); font-size: 13px; font-weight: 700; }
.kgd-video-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.kgd-video-foot a { display: inline-flex; align-items: center; min-height: 32px; font-weight: 700; color: var(--ink); }
.kgd-vparts { margin: -4px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; border-top: 1px solid var(--ink); }
.kgd-vparts li { border-bottom: 1px dashed var(--muted); }
.kgd-vparts button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; font-family: var(--font-serif); font-size: 16px; color: var(--ink); }
.kgd-vparts button:hover, .kgd-vparts button:focus-visible { color: var(--accent); text-decoration: underline; }
.kgd-vparts-t { flex: none; width: 40px; font-family: var(--font-ui); font-size: 13px; font-weight: 700; color: var(--accent); }
.kgd-titlerow { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.kgd-part { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--ink); background: var(--panel); cursor: pointer; font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.kgd-part::before { content: ""; border-left: 9px solid var(--accent); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.kgd-part:hover { background: var(--soft); }
.kgd-part b { color: var(--accent); }
.kgd-side-video { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--ink); background: var(--soft); }
.kgd-side-video .kgd-label { margin: 0; }
.kgd-side-video button { min-height: 36px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; font-family: var(--font-ui); font-size: 15px; font-weight: 700; color: var(--accent); text-decoration: underline; }
/* "Watch how it works" card on log in / sign up and setup step 1. */
.kgd-watch { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--ink); background: var(--soft); color: var(--ink); text-decoration: none; }
.kgd-watch:hover strong, .kgd-watch:focus-visible strong { color: var(--accent); text-decoration: underline; }
.kgd-watch-thumb { position: relative; flex: none; width: 96px; aspect-ratio: 16 / 9; border: 1px solid var(--ink); background: var(--panel); overflow: hidden; }
.kgd-watch-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kgd-watch-thumb::before { content: ""; position: absolute; left: 50%; top: 50%; width: 26px; height: 18px; transform: translate(-50%, -50%); background: var(--accent); }
.kgd-watch-thumb::after { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-35%, -50%); border-left: 8px solid #FFFFFF; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.kgd-watch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kgd-watch-text strong { font-family: var(--font-ui); font-size: 15px; font-weight: 700; }
.kgd-watch-text small { font-family: var(--font-ui); font-size: 13px; color: var(--muted); }
@media (max-width: 900px) {
  .kgd-video-title { font-size: 28px; }
  .kgd-vparts { grid-template-columns: minmax(0, 1fr); }
}
.k-guide-link { margin: 0; font-size: 15px; }
.k-guide-link a { font-weight: 700; }
@media (max-width: 900px) {
  .kgd-body { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .kgd-side { position: static; }
  .kgd-head h1 { font-size: 36px; }
  .kgd-intro { font-size: 18px; }
  .kgd-title { font-size: 28px; }
}

/* Front page (logged out): "Guide" link in the header and under the about list. */
.guest-guide {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; margin-right: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink); text-decoration: none;
}
.guest-guide:hover, .guest-guide[aria-current="page"] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.ka-guide { margin: 0; font-family: var(--font-ui); font-size: 15px; }
.ka-guide a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.kgd-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 6px; }
.kgd-try { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.kgd-next { display: inline-flex; align-items: center; min-height: 44px; margin-left: auto; font-weight: 600; color: var(--ink); }
.kgd-done { margin: 0 0 0 auto; font-family: var(--font-serif); font-style: italic; color: #3D3D3D; }

/* ---------- Admin: Overview and Users (/admin, /admin/users, /admin/users/{id}) ---------- */
.kau-sec { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.kau-label { margin: 0; font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kau-h2 { margin: 0; font-family: var(--font-serif); font-size: 28px; font-weight: 600; line-height: 1.15; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.kau-count { font-family: var(--font-ui); font-size: 14px; font-weight: 500; color: var(--muted); }
.kau-stats { display: flex; flex-wrap: wrap; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
.kau-stat { flex: 1 1 150px; padding: 14px 16px; border-left: 1px solid var(--ink); }
.kau-stat:first-child { border-left: 0; padding-left: 0; }
.kau-stat p { margin: 0; }
.kau-stat-value { font-family: var(--font-serif); font-size: 40px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.kau-stat-label { margin-top: 6px !important; font-size: 13px; font-weight: 600; }
.kau-stat-note { margin-top: 2px !important; font-family: var(--font-serif); font-size: 15px; color: #3D3D3D; }
.kau-chart { height: 140px; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; align-items: end; border-bottom: 1px solid var(--ink); }
.kau-bar-col { height: 100%; display: flex; align-items: flex-end; }
.kau-bar { width: 100%; background: var(--ink); min-height: 2px; }
.kau-bar.is-zero { background: var(--muted); height: 1px; min-height: 1px; }
.kau-bar-col:last-child .kau-bar:not(.is-zero) { background: var(--accent); }
.kau-chart-axis { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.kau-privacy { margin: 0; font-size: 13px; color: var(--muted); }
/* Admin: delete a user's account and all their data. */
.kau-danger { padding: 16px 18px; border: 1px solid var(--accent); border-left-width: 4px; }
.kau-danger .kau-label { color: var(--accent); }
.kau-del-text { margin: 0; font-family: var(--font-serif); font-size: 16px; line-height: 1.5; max-width: 70ch; }
.kau-del-form { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.kau-del-field { display: flex; flex-direction: column; gap: 6px; }
.kau-del-field label { font-size: 14px; font-weight: 400; line-height: 1.6; }
.kau-del-code { padding: 1px 6px; border: 1px solid var(--line); background: var(--soft); font-family: var(--font-code); font-size: 13px; font-weight: 700; user-select: all; word-break: break-all; }
.kau-del-field .kau-input { flex: none; width: 100%; box-sizing: border-box; }
.kau-del-err { margin: 0; font-weight: 600; color: var(--accent); }
.kau-del-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.kau-users-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.kau-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.kau-input { height: 44px; padding: 0 12px; border: 1px solid var(--ink); border-radius: 0; background: #FFFFFF; font: inherit; font-size: 15px; color: var(--ink); min-width: 0; }
input.kau-input { flex: 1 1 220px; }
.kau-users th a { font-weight: 700; }
/* User list: sortable column names, a small token bar, totals on top (admin-users.js). */
.kau-users thead a.kau-sort { color: inherit; text-decoration: none; }
.kau-users thead a.kau-sort:hover { text-decoration: underline; }
.kau-users thead a.kau-sort.is-on { color: var(--ink); }
.kau-users thead a.kau-sort.is-on::after { content: ' ↓'; color: var(--accent); }
.kau-users thead th[aria-sort="ascending"] a.kau-sort.is-on::after { content: ' ↑'; }
.kau-users td, .kau-users th { padding: 7px 10px; white-space: nowrap; }
.kau-users .kau-who { white-space: normal; min-width: 200px; }
.kau-users thead th { white-space: normal; overflow-wrap: normal; word-break: normal; vertical-align: bottom; }
.kau-users .kau-role { white-space: nowrap; vertical-align: 1px; }
.kau-tokbar { display: inline-block; height: 8px; margin-right: 8px; background: var(--ink); vertical-align: middle; }
.kau-muted { color: var(--muted); }
.kau-stats-sm .kau-stat { padding-top: 10px; padding-bottom: 10px; }
.kau-stats-sm .kau-stat-value { font-size: 28px; }
.kau-pw { padding: 16px 18px; border: 1px solid var(--ink); border-left-width: 4px; background: var(--soft); }
.kau-pw-msg { margin: 0; min-height: 1.4em; font-weight: 600; }
.kau-pw-msg.is-ok { color: var(--success); }
.kau-pw-msg.is-err { color: var(--accent); }
.kau-sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.kau-role { display: inline-block; padding: 2px 8px; border: 1px solid var(--ink); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.kau-role.is-admin { border-color: var(--accent); color: var(--accent); }
.kau-pager { display: flex; align-items: center; justify-content: center; gap: 20px; font-size: 14px; }
.kau-page { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.kau-empty { margin: 0; font-family: var(--font-serif); font-size: 17px; color: #3D3D3D; }
.kau-user { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 40px; }
.kau-user > .kau-sec:first-child { grid-column: 1 / -1; }
.kau-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); border-top: 2px solid var(--ink); }
.kau-facts > div { padding: 10px 0; border-bottom: 1px dashed var(--muted); }
.kau-facts dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kau-facts dd { margin: 4px 0 0; font-family: var(--font-serif); font-size: 18px; overflow-wrap: anywhere; }
.kau-goals { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.kau-goals li { padding: 10px 0; border-bottom: 1px dashed var(--muted); }
.kau-goal-title { font-family: var(--font-serif); font-size: 18px; font-weight: 600; }
.kad-page .kau-sec + .kau-sec { margin-top: 8px; }
@media (max-width: 900px) {
  .kau-user { grid-template-columns: minmax(0, 1fr); }
  .kau-stat { flex-basis: 45%; }
  .kau-stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .kau-stat-value { font-size: 30px; }
}

/* Touch screens: small text links get a taller tap area (about 40px) without moving the text (mobile check
   2026-11-21: footer "Send feedback" 16px, "Log in" / "Create account" 19px, "Open the key guide" 16px). Inline
   padding does not change the line height; the negative margin keeps inline-block ones (buttons) in place. */
@media (pointer: coarse) {
  .app-footer-link, .ka-switch a, .k-st-help, .kgd-providers a, .kg-free a, .k-also-link { padding-block: 10px; margin-block: -10px; }
}
