/* UI-2.0.0 operation patterns, with the confirmed lesson icon's indigo accent. */
:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  font-synthesis: none;
  color: #121212;
  background: #f8fafa;
  --ink: #121212;
  --paper: #f8fafa;
  --surface: #fff;
  --muted: #737776;
  --line: #e7e8e7;
  --accent: #6764d9;
  --accent-strong: #5956cd;
  --accent-soft: #eeedfc;
  --mint: #ddf5f0;
  --mint-ink: #29776c;
  --pink: #ffe4ef;
  --danger: #d84b52;
  --error-ink: #9b343b;
  --warning-ink: #795927;
  --shadow: 0 14px 40px rgba(18, 18, 18, .07);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737776' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}
button:hover:not(:disabled), .button:hover { background: #f2f5f4; }
button:disabled, .button[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(89, 86, 205, .6);
  outline-offset: 3px;
}
.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.primary:hover:not(:disabled) { background: #303735; border-color: #303735; }
.danger { border-color: #efc8cc; background: #fff5f6; color: var(--error-ink); }
.danger:hover:not(:disabled) { background: #ffecef; }
.small { padding: 8px 12px; font-size: .875rem; }
button.link { padding: 8px; border: 0; background: transparent; color: var(--accent-strong); }
button.link:hover:not(:disabled) { background: var(--accent-soft); }
a { color: var(--accent-strong); }
button svg, .button svg { flex-shrink: 0; }

/* Readable controls with a full touch area, including native date/time inputs. */
input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #d8dedb;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
}
select {
  appearance: none;
  padding-right: 36px;
  background-image: var(--chevron);
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
}
select[multiple] { appearance: auto; padding-right: 12px; background-image: none; }
textarea { min-height: 104px; resize: vertical; line-height: 1.65; }
input[type="checkbox"], input[type="radio"] {
  width: 20px;
  min-width: 20px;
  min-height: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent-strong);
  flex-shrink: 0;
}
input:disabled, select:disabled, textarea:disabled {
  background-color: #f7f9f8;
  color: #59625f;
  opacity: 1;
  -webkit-text-fill-color: #59625f;
}
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
label.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-size: .875rem; font-weight: 600; }
label.field .hint { color: var(--muted); font-size: .8125rem; font-weight: 400; line-height: 1.6; }
label.check { display: flex; align-items: center; gap: 9px; min-height: 44px; font-size: .9375rem; line-height: 1.6; cursor: pointer; }
form .field { margin-bottom: 0; }

/* Type and page frame. */
h1, h2, h3, h4, p { margin-top: 0; overflow-wrap: anywhere; }
h1 { margin-bottom: 8px; font-size: 1.75rem; line-height: 1.3; letter-spacing: -.025em; }
h2 { margin-bottom: 16px; font-size: 1.25rem; line-height: 1.45; }
h3 { margin-bottom: 12px; font-size: 1.0625rem; line-height: 1.5; }
h4 { margin-bottom: 8px; font-size: .9375rem; line-height: 1.5; }
p { line-height: 1.7; }
.muted, .hint { color: var(--muted); }
.tiny, .sources { font-size: .8125rem; overflow-wrap: anywhere; }
.wrap { overflow-wrap: anywhere; }
.loading { padding: 60px 24px; text-align: center; }
.shell { max-width: 1120px; min-width: 0; margin: 0 auto; padding: 24px 24px max(32px, env(safe-area-inset-bottom)); }
.shell main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand > div { min-width: 0; }
.brand img { display: block; flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; object-fit: contain; }
.brand strong { font-size: 1rem; line-height: 1.5; overflow-wrap: anywhere; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: .8125rem; line-height: 1.5; }
.identity { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Account menu is one real identity with scoped information and session actions. */
.account-menu { position: relative; flex-shrink: 0; max-width: 46%; }
.account-menu > summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: .875rem;
  line-height: 1.5;
  cursor: pointer;
}
.account-menu > summary > span { min-width: 0; overflow-wrap: anywhere; }
.account-menu > summary strong { font-size: .875rem; }
.account-menu > summary small { display: block; color: var(--muted); font-size: .8125rem; }
.account-menu > summary .tag { background: #f2f5f4; }
.account-menu[open] { z-index: 40; }
.account-menu[open] > summary { border-color: var(--accent); }
.account-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 280px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
.account-panel p { margin: 0 0 10px; color: #59625f; font-size: .875rem; }
.account-panel .actions { padding-top: 12px; border-top: 1px solid var(--line); }
.account-panel .actions button { flex: 1; }

/* Runtime details stay accessible without taking over the first screen. */
.runtime-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-height: 36px; margin-bottom: 12px; color: #59625f; font-size: .8125rem; }
.runtime-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.runtime-details { min-width: 0; flex: 1; }
.runtime-details > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 0; font-size: .8125rem; line-height: 1.6; cursor: pointer; }
.runtime-details > p, .runtime-details > div { margin: 4px 0 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); line-height: 1.7; overflow-wrap: anywhere; }
.trial { padding: 11px 16px; margin-bottom: 16px; border-radius: 12px; background: var(--pink); color: #744650; font-size: .875rem; line-height: 1.6; }
#sync-message:empty { display: none; }

/* Shared line navigation: narrow screens scroll only this strip. */
.nav { display: flex; align-items: stretch; gap: 24px; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; margin-bottom: 20px; padding: 0; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.nav button { position: relative; flex: 0 0 auto; min-height: 48px; padding: 10px 0; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 1rem; font-weight: 500; white-space: nowrap; }
.nav button:hover:not(:disabled) { background: transparent; color: var(--ink); }
.nav button.active { background: transparent; color: var(--ink); font-weight: 650; }
.nav button.active::after { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; border-radius: 3px; background: var(--accent); content: ""; }
.nav button:focus-visible { outline-offset: -3px; }

/* Titles, compact overview, and lists. */
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.pagehead > div { min-width: 0; }
.pagehead p { margin: 0; color: var(--muted); font-size: .875rem; }
.pagehead > .actions { flex-shrink: 0; }
.overview-panel { padding: 20px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); }
.overview-panel .pagehead { margin-bottom: 16px; }
.overview-panel h1 { font-size: 1.5rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.metric strong { display: block; margin: 5px 0; font-size: 1.75rem; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric span { color: var(--muted); font-size: .8125rem; line-height: 1.5; overflow-wrap: anywhere; }
.overview-panel .metrics { gap: 0; margin-bottom: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.overview-panel .metric { padding: 0 16px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; }
.overview-panel .metric:first-child { padding-left: 0; }
.overview-panel .metric:last-child { padding-right: 0; border-right: 0; }
.overview-panel .metric strong { font-size: 1.625rem; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.card { min-width: 0; padding: 20px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); }
.card.soft { background: #f5f4fc; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
.span { grid-column: 1 / -1; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 16px 0; border-bottom: 1px solid #edf0ee; }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-main strong { display: block; font-size: .9375rem; line-height: 1.6; overflow-wrap: anywhere; }
.class-location, .class-identity { display: block; overflow-wrap: anywhere; }
.class-location { color: #59625f; font-size: .8125rem; font-weight: 500; }
.class-identity { margin-top: 2px; color: var(--ink); font-size: .9375rem; font-weight: 600; }
.row-main p { margin: 4px 0 0; color: var(--muted); font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.row > .actions { flex: 0 0 auto; max-width: 48%; justify-content: flex-end; }
.row > .actions button, .row > button { font-size: .875rem; padding: 8px 12px; }
.row-action { gap: 6px; color: var(--accent-strong); }
.row-action:not(.primary):not(.danger) { border-color: transparent; background: transparent; }
.row-action:not(.primary):not(.danger):hover:not(:disabled) { background: var(--accent-soft); }
.row-action.primary { color: #fff; }
.tag { display: inline-block; max-width: 100%; padding: 4px 8px; border-radius: 8px; background: #f0f4f2; color: #59625f; font-size: .75rem; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.tag.approved, .tag.confirmed, .tag.forwarded { background: var(--mint); color: var(--mint-ink); }
.tag.returned, .tag.overdue { background: #fff0f1; color: var(--error-ink); }
.tag.submitted, .tag.pending, .tag.needs_revision { background: #fff4d9; color: var(--warning-ink); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.empty { padding: 24px 12px; color: var(--muted); text-align: center; font-size: .875rem; line-height: 1.7; overflow-wrap: anywhere; }
.section-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.section-title > * { min-width: 0; max-width: 100%; }
.section-title h2, .section-title h3 { margin: 0; }
.section-title h2::before, .section-title h3::before { display: inline-block; width: 4px; height: 16px; margin-right: 9px; border-radius: 4px; background: var(--accent); vertical-align: -1px; content: ""; }
.section-title.pink h2::before, .section-title.pink h3::before { background: var(--accent); }
.task-card { border-top: 3px solid var(--accent); }
.task-card .row-main p { overflow-wrap: anywhere; }

/* Filter controls and their visible current range. */
.filter-panel { margin-bottom: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar label { flex: 1 1 150px; min-width: 0; max-width: 320px; }
.filter-panel .toolbar { margin-bottom: 12px; }
.filter-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; color: #59625f; font-size: .8125rem; line-height: 1.6; overflow-wrap: anywhere; }
.filter-summary > span { min-width: 0; flex: 1; }
.filter-summary button { min-height: 44px; padding: 6px 8px; border: 0; background: transparent; color: var(--accent-strong); font-size: .8125rem; }
.filter-summary button:hover:not(:disabled) { background: var(--accent-soft); }

/* Editors use a quiet, consistent return/header/status sequence. */
.editor-heading { margin-bottom: 16px; }
.editor-topline { display: grid; grid-template-columns: minmax(44px, auto) minmax(0, 1fr) minmax(44px, auto); align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.editor-topline h1 { margin: 0; text-align: center; font-size: 1.125rem; line-height: 1.5; letter-spacing: 0; }
.back-button { justify-self: start; gap: 6px; min-width: 44px; padding: 8px 10px; font-size: .875rem; }
.editor-mode { justify-self: end; max-width: 160px; color: var(--muted); font-size: .8125rem; text-align: right; line-height: 1.6; overflow-wrap: anywhere; }
.editor-subtitle { margin: 10px 0 0; color: #59625f; font-size: .875rem; line-height: 1.7; }
.editor-status { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: #524f9c; font-size: .875rem; line-height: 1.65; overflow-wrap: anywhere; }
.editor-status:empty { display: none; }
.action-bar, .fixed-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.action-bar { justify-content: flex-end; }
.fixed-actions { position: sticky; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 10; justify-content: flex-end; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .97); box-shadow: 0 4px 22px rgba(18, 18, 18, .06); }
.fixed-actions > .primary { min-width: 136px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; }
.sidebar { position: sticky; top: 16px; align-self: start; }
.segment, .lesson, .stage, .moment { min-width: 0; padding: 16px; margin-top: 16px; border: 1px solid #e4eae7; border-radius: 16px; background: #f9fbfa; }
.lesson { margin: 20px 0; background: var(--surface); scroll-margin-top: 18px; }
.stage { padding: 14px; background: #f6f6fa; }
.stage .grid { gap: 12px; }
.moment { background: #f7f6fd; }
.lesson-jumps { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.lesson-jumps button { font-size: .875rem; padding: 8px 12px; }
.skill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.skill-option { min-width: 0; padding: 12px; border: 1px solid #e1e7e4; border-radius: 12px; }
.skill-option label { align-items: flex-start; }
.skill-option p { margin: 6px 0 0; color: #59625f; font-size: .8125rem; line-height: 1.6; overflow-wrap: anywhere; }
.checkline { display: flex; gap: 8px 16px; flex-wrap: wrap; padding: 8px 0; }
.checkline label { min-width: 58px; }
.requirements { padding: 12px 16px; margin-bottom: 16px; border-left: 3px solid var(--accent); background: #f7f6fd; font-size: .875rem; line-height: 1.7; overflow-wrap: anywhere; }
.grouphead { padding: 12px 14px; margin-top: 20px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); }
.grouphead:first-child { margin-top: 0; }
.divider { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.list { margin: 0; padding-left: 22px; line-height: 1.75; overflow-wrap: anywhere; }
.rules { color: #45534c; font-size: .875rem; }

/* Status and feedback distinguish review, missing work, and system errors. */
.notice { padding: 12px 16px; margin: 0 0 16px; border: 1px solid transparent; border-radius: 12px; background: #f2f3f6; font-size: .875rem; line-height: 1.65; overflow-wrap: anywhere; }
.notice.warn { background: #fff7e7; color: var(--warning-ink); }
.notice.error { background: #fff0f1; color: var(--error-ink); }
.notice p:last-child { margin-bottom: 0; }
.error-line { margin: 8px 0; color: var(--error-ink); font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.error-line:empty { display: none; }
.persistent-error { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid #f1cbd0; border-radius: 12px; background: #fff0f1; color: var(--error-ink); font-size: .875rem; line-height: 1.65; overflow-wrap: anywhere; }
.persistent-error > p, .persistent-error > div { min-width: 0; flex: 1 1 200px; margin: 0; }
.persistent-error button { flex-shrink: 0; border-color: #efc8cc; background: #fff; color: var(--error-ink); font-size: .8125rem; }
.persistent-error:empty { display: none; }
.feedback { position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; z-index: 60; display: none; width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; transform: translateX(-50%); }
.feedback.show { display: block; }
.feedback.error { background: var(--error-ink); }
.busy { opacity: .6; pointer-events: none; }
.changed { color: #9b5c26; font-size: .8125rem; }
.checkbadge { color: var(--warning-ink); }
.checks { margin: 0; padding: 0; list-style: none; }
.checks li { padding: 9px 0; border-bottom: 1px solid #edf0ee; font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.checks li:last-child { border-bottom: 0; }
.checks .basis { display: block; margin-top: 4px; color: var(--muted); font-size: .8125rem; }
.deadline-line { display: flex; gap: 6px 16px; flex-wrap: wrap; margin: 8px 0 12px; color: #59625f; font-size: .8125rem; line-height: 1.7; overflow-wrap: anywhere; }
.recovery p { margin: 8px 0 12px; }
.recovery strong { display: block; overflow-wrap: anywhere; }

/* One chevron construction and direction for expandable sections. */
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.details { margin: 10px 0; }
.details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 10px 0; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; cursor: pointer; }
.details > summary:not(:has(svg))::after,
.runtime-details > summary:not(:has(svg))::after,
.account-menu > summary:not(:has(svg))::after { display: block; width: 16px; height: 16px; flex-shrink: 0; background: var(--chevron) center / 16px no-repeat; content: ""; }
.details[open] > summary:not(:has(svg))::after,
.runtime-details[open] > summary:not(:has(svg))::after,
.account-menu[open] > summary:not(:has(svg))::after { transform: rotate(180deg); }
.ui-chevron, .chevron { display: block; width: 16px; height: 16px; flex-shrink: 0; }
.chevron-right { transform: rotate(0); }
.chevron-down { transform: rotate(90deg); }
.details[open] > summary .chevron-down,
.runtime-details[open] > summary .chevron-down,
.account-menu[open] > summary .chevron-down { transform: rotate(-90deg); }
.details[open] > summary .ui-chevron-down,
.runtime-details[open] > summary .ui-chevron-down,
.account-menu[open] > summary .ui-chevron-down { transform: rotate(180deg); }

/* Read-only review, brief, tables and document content. */
.reviewbox { padding: 20px; margin-top: 20px; border: 1px solid #dce2df; border-radius: 16px; background: #f4f6f5; }
.reviewbox textarea { margin: 10px 0; }
.reviewbox h2 { font-size: 1.125rem; }
.brief-steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; padding: 0; list-style-position: inside; }
.brief-steps li { flex: 1 1 150px; min-width: 0; padding: 10px 12px; border-radius: 12px; background: #f2f5f4; color: #59625f; font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.brief-steps li.current { background: #fff4d9; color: var(--warning-ink); }
.brief-steps li.done { background: var(--mint); color: var(--mint-ink); }
pre.brief { margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #f8fbf9; font-family: inherit; font-size: .9375rem; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e8eeeb; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.sources { color: var(--muted); }
.footer { padding: 20px 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.7; text-align: center; overflow-wrap: anywhere; }
dialog { width: 440px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); padding: 24px; overflow-y: auto; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(18, 18, 18, .4); }
.login { max-width: 460px; margin: 7vh auto; padding: 26px; }
.login .brand { margin-bottom: 20px; }
.login .card { padding: 20px; }
.login form { display: grid; gap: 16px; }
.login .primary { width: 100%; }
.login h1 { font-size: 1.5rem; }

/* Responsive composition, with no unconditional full-width row buttons. */
@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; }
  .grid.three, .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell { padding: 20px 20px max(28px, env(safe-area-inset-bottom)); }
  .identity { justify-content: flex-end; font-size: .875rem; }
}

@media (max-width: 680px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .overview-panel .metrics { gap: 12px 0; }
  .overview-panel .metric { padding: 0 12px; }
  .overview-panel .metric:nth-child(odd) { padding-left: 0; }
  .overview-panel .metric:nth-child(even) { padding-right: 0; border-right: 0; }
  .pagehead { flex-wrap: wrap; }
  .pagehead > .actions { flex-shrink: 1; }
  .row { flex-wrap: wrap; }
  .row-main { flex: 1 1 180px; }
  .row > .actions { flex: 0 1 auto; max-width: 100%; }
}

@media (max-width: 560px) {
  .shell { padding: 16px 16px max(28px, env(safe-area-inset-bottom)); }
  .topbar { align-items: center; gap: 8px; margin-bottom: 8px; }
  .brand { gap: 8px; }
  .brand img { width: 36px; height: 36px; border-radius: 10px; }
  .brand strong { font-size: .9375rem; }
  .brand small { font-size: .75rem; }
  .identity { gap: 6px; }
  .identity .username { max-width: 88px; overflow-wrap: anywhere; }
  .identity button { padding: 8px 10px; font-size: .875rem; }
  .account-menu { max-width: 46%; }
  .account-menu > summary { gap: 6px; padding: 6px 8px; }
  .account-menu > summary .tag { padding: 3px 5px; }
  .account-panel { width: 260px; }
  .runtime-strip { gap: 2px 10px; margin-bottom: 10px; }
  .runtime-details { flex-basis: 150px; }
  .trial { padding: 10px 12px; font-size: .8125rem; }
  .nav { gap: 20px; margin-bottom: 16px; }
  .nav button { font-size: .9375rem; }
  h1 { font-size: 1.5rem; }
  .pagehead { gap: 12px; margin-bottom: 16px; }
  .pagehead > .actions { margin: 0; }
  .card, .overview-panel { padding: 16px; margin-bottom: 16px; }
  .overview-panel h1 { font-size: 1.375rem; }
  .metric { padding: 12px; }
  .metric strong { font-size: 1.5rem; }
  .grid, .grid.three, .grid.four, .skill-grid { grid-template-columns: minmax(0, 1fr); }
  .span { grid-column: auto; }
  .row { gap: 8px 12px; padding: 14px 0; }
  .row > .actions { margin-left: auto; gap: 6px; }
  .row > .actions button, .row > button { padding: 8px 10px; }
  .row-main p { font-size: .8125rem; }
  .toolbar { gap: 10px; }
  .toolbar label { flex: 1 1 140px; max-width: none; }
  .filter-panel { padding: 12px; }
  .filter-panel .toolbar { gap: 10px; }
  .editor-topline { gap: 8px; grid-template-columns: minmax(44px, auto) minmax(0, 1fr) minmax(36px, auto); }
  .editor-mode { max-width: 90px; }
  .back-button { padding: 8px; }
  .lesson, .segment, .moment { padding: 14px; }
  .stage { padding: 12px; }
  .fixed-actions { padding: 10px; gap: 8px; }
  .fixed-actions button { padding: 10px 12px; }
  .fixed-actions > .primary { min-width: 0; flex: 1 1 140px; }
  .action-bar { gap: 8px; }
  .section-title { align-items: flex-start; }
  .notice, .reviewbox { padding: 12px 14px; }
  .reviewbox { margin-top: 16px; }
  .brief-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .brief-steps li { padding: 8px 12px; }
  .lesson-jumps { gap: 6px; }
  .lesson-jumps button { flex: 0 1 auto; text-align: left; }
  .deadline-line { gap: 4px 12px; }
  pre.brief { padding: 14px; }
  .login { margin: 28px auto; padding: 16px; }
  .login .card { padding: 16px; }
}

@media (max-width: 360px) {
  .shell { padding-right: 16px; padding-left: 16px; }
  .brand strong { font-size: .875rem; }
  .brand small { font-size: .75rem; }
  .account-menu > summary { gap: 4px; font-size: .8125rem; }
  .account-menu > summary .tag { font-size: .75rem; }
  .nav { gap: 18px; }
  .row-main { flex-basis: 160px; }
  .overview-panel .metric { padding-right: 10px; padding-left: 10px; }
  .overview-panel .metric strong { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
