/* Palette adapted from https://uust.ru/static/New_files_ugatu/css/uust_new_design.css */
:root {
  color-scheme: light;
  --canvas: #f6f6f8;
  --sidebar: #2a1468;
  --sidebar-ink: #fff;
  --sidebar-muted: #d6cdec;
  --sidebar-line: #533d84;
  --sidebar-hover: #382174;
  --sidebar-selected: #442980;
  --brand-detail: #ffa039;
  --paper: #fff;
  --soft: #f5f3fa;
  --ink: #282333;
  --muted: #6d687c;
  --line: #dedbe7;
  --accent: #4d19cc;
  --accent-hover: #3c12a5;
  --accent-ink: #fff;
  --selected: #eee8fc;
  --danger: #a3433b;
  --warning: #8a652a;
  --warning-bg: #faf4e7;
  --sidebar-width: 224px;
  --paper-shadow: 0 4px 24px #26114b08;
  --scroll-thumb: #b8a8d2;
  --scroll-hover: #80639f;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #1c1924;
  --paper: #262230;
  --soft: #2d283a;
  --ink: #efecf5;
  --muted: #b9b1ca;
  --line: #423a53;
  --accent: #c2a7ff;
  --accent-hover: #d3c0ff;
  --accent-ink: #291653;
  --selected: #3b2c57;
  --danger: #e5a29a;
  --warning: #e0c18b;
  --warning-bg: #393024;
  --paper-shadow: 0 4px 24px #0000001a;
  --scroll-thumb: #625572;
  --scroll-hover: #ac8ed5;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 24px; scrollbar-gutter: stable; }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto; scrollbar-color: auto; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { min-height: 40px; border: 2px solid transparent; border-radius: 10px; background-color: var(--scroll-thumb); background-clip: padding-box; }
  ::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background-color: var(--scroll-hover); }
  ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  ::-webkit-scrollbar-corner { background: transparent; }
}
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.55 "Segoe UI", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, input, textarea, select { border-radius: 7px; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.25; letter-spacing: -.65px; font-weight: 600; }
h2 { font-size: 18px; line-height: 1.4; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.site-header { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar-width); background: var(--sidebar); border-right: 1px solid var(--sidebar-line); }
.header-inner { position: relative; height: 100%; display: flex; flex-direction: column; padding: 28px 14px 18px; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; color: var(--sidebar-ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 36px; color: var(--brand-detail); flex: 0 0 auto; }
.brand-mark svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.brand-shield { fill: var(--sidebar); }
.brand-check { stroke: var(--sidebar-ink); }
.brand-name { font: 600 20px/1.25 Georgia, serif; letter-spacing: -.3px; white-space: nowrap; }
.brand-name em { display: block; margin-top: 5px; font: normal 11px/1.4 "Segoe UI", sans-serif; color: var(--sidebar-muted); letter-spacing: 0; }
.sidebar-toggle { align-self: flex-end; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--sidebar-line); background: transparent; color: var(--sidebar-muted); margin-top: -10px; margin-bottom: -10px; }
.site-header :is(button,a):focus-visible { outline-color: var(--brand-detail); }
.sidebar-toggle:hover { background: var(--sidebar-hover); color: var(--sidebar-ink); }
.sidebar-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.top-nav { position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 4px; }
.nav-link { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 10px 12px; border: 0; background: transparent; text-align: left; color: var(--sidebar-muted); font-size: 13px; }
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-ink); }
.nav-link.active { background: var(--sidebar-selected); color: var(--sidebar-ink); font-weight: 600; box-shadow: inset 3px 0 var(--brand-detail); }
.nav-icon { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav-label { display: flex; align-items: center; gap: 8px; width: 100%; }
#history-count { margin-left: auto; font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.user-menu { margin-top: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 16px 10px 0; border-top: 1px solid var(--sidebar-line); color: var(--sidebar-muted); font-size: 12px; }
.user-avatar { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--sidebar-line); border-radius: 50%; font-size: 12px; }
main { margin-left: var(--sidebar-width); min-height: calc(100vh - 72px); }
.page-view, .landing { padding: 38px 40px 56px; width: 100%; max-width: 1600px; margin-inline: auto; }
.section-wrap { width: 100%; }
.page-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-intro p { margin-top: 9px; max-width: 640px; }
.eyebrow { font-size: 11px; color: var(--muted); margin-bottom: 12px; letter-spacing: .2px; }
.button, .small-btn, .text-link { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); min-height: 38px; padding: 8px 14px; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.button { min-height: 42px; }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button-outline:hover, .small-btn:hover { background: var(--soft); border-color: var(--muted); }
.text-link { border: 0; padding-inline: 0; min-height: 30px; background: transparent; color: var(--accent); }
.text-link:hover { text-decoration: underline; }
.small-btn { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.home-section { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--paper-shadow); margin-bottom: 28px; overflow: hidden; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.section-heading h2 { display: flex; align-items: baseline; gap: 12px; }
.section-heading small { color: var(--muted); font-size: 12px; font-weight: 400; }
#home-total { padding: 3px 9px; border: 1px solid var(--line); border-radius: 20px; font-size: 11px; background: var(--soft); }
.document-table-wrap { overflow-x: auto; }
.document-table { border-collapse: collapse; width: 100%; text-align: left; }
.document-table th { color: var(--muted); font-size: 11px; font-weight: 500; padding: 11px 20px; background: var(--soft); border-bottom: 1px solid var(--line); }
.document-table td { padding: 17px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 12px; }
.document-table tbody tr:last-child td { border-bottom: 0; }
.document-table tbody tr:hover { background: var(--soft); }
.document-table th:first-child, .document-table td:first-child { padding-left: 22px; }
.document-table .title-cell { min-width: 230px; }
.document-link { display: flex; align-items: center; gap: 12px; border: 0; padding: 0; background: none; text-align: left; font-size: 13px; font-weight: 600; line-height: 1.5; color: var(--ink); }
.document-link:hover { color: var(--accent); text-decoration: underline; }
.document-theme { margin-top: 4px; color: var(--muted); font-size: 11px; }
.document-date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.document-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.document-actions [data-delete] { color: var(--danger); background: transparent; border-color: transparent; }
.document-actions [data-delete]:hover { border-color: var(--danger); }
.topic-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
.topic-item { position: relative; transition: background-color .2s; padding: 23px 24px; border-right: 1px solid var(--line); }
.topic-item:last-child { border-right: 0; }
.topic-item:hover, .topic-item:focus-within { background: var(--soft); }
.topic-symbol { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); background: var(--soft); color: var(--accent); border-radius: 10px; margin-bottom: 18px; }
.topic-symbol svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.topic-item .text-link::after { content: ''; position: absolute; inset: 0; }
.topic-item .text-link { position: static; }
.topic-item .text-link:hover { transform: none; }
.topic-item:has(.text-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: -3px; }
.topic-item .text-link:focus-visible { outline: none; }
.topic-item h3 { margin-bottom: 8px; }
.topic-item p { font-size: 12px; min-height: 56px; margin-bottom: 15px; }
.section-note { padding: 14px 22px; border-top: 1px solid var(--line); font-size: 12px; }
.home-bottom { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 2px; }
.home-bottom p { font-size: 12px; }
.workspace-grid { display: grid; grid-template-columns: minmax(330px,.9fr) minmax(0,1.2fr); align-items: start; gap: 26px; }
.workspace-grid>* { min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--paper-shadow); }
.form-panel { padding: 24px; }
.panel-heading { padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.panel-heading h2 { font-size: 16px; }
.panel-heading p { font-size: 12px; margin-top: 5px; }
.form-panel form { display: flex; flex-direction: column; gap: 21px; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 500; color: var(--ink); }
input, select, textarea { min-width: 0; width: 100%; color: var(--ink); background: var(--paper); border: 1px solid var(--line); padding: 9px 11px; font-weight: 400; line-height: 1.6; }
input, select { min-height: 40px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
textarea { resize: vertical; min-height: 90px; }
.request-label textarea { min-height: 145px; }
.field-hint { font-size: 11px; font-weight: 400; color: var(--muted); }
.form-row { display: grid; gap: 14px; }
.form-row.two { grid-template-columns: 1fr 1fr; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
legend { font-size: 12px; font-weight: 500; margin-bottom: 10px; padding: 0; }
.check-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.check-pill { position: relative; display: block; }
.check-pill input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.check-pill span { display: flex; align-items: center; min-height: 32px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; font-weight: 400; color: var(--muted); background: var(--paper); cursor: pointer; }
.check-pill input:checked+span { color: var(--ink); background: var(--selected); border-color: var(--accent); }
.check-pill input:focus-visible+span { outline: 2px solid var(--accent); outline-offset: 2px; }
.criteria-option { display: grid; grid-template-columns: 16px 1fr; align-items: start; column-gap: 10px; }
.criteria-option input { width: 16px; min-height: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.criteria-option small { grid-column: 2; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: -3px; }
.vm-options { display: grid; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--selected); }
.vm-options legend { padding: 0 6px; }
.variant-options { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.variant-options .field-help { margin-top: 10px; margin-bottom: 0; }
.variant-card { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; }
.variant-card>summary { cursor: pointer; font-weight: 600; padding: 14px 16px; }
.variant-card-content { padding: 0 16px 16px; display: grid; gap: 16px; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0 0 12px; }
.material-upload { margin-bottom: 24px; padding: 24px; }
.material-upload h2 { margin-top: 0; }
.material-upload form { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; }
.material-upload form label { flex: 1 1 240px; min-width: 0; }
.material-upload input[type="file"] { max-width: 100%; height: auto; padding: 10px; }
.material-upload input::file-selector-button { border: 1px solid var(--line); border-radius: 5px; padding: 7px 10px; margin-right: 12px; background: var(--selected); color: var(--ink); font: inherit; cursor: pointer; }
#teacher-material-grid .artifact-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.material-upload [role="status"]:not(:empty) { margin-top: 12px; margin-bottom: 0; }
.library-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin: 32px 0 16px; }
#reference-materials-list { margin-bottom: 12px; }
#reference-materials-list .check-pill span { overflow-wrap: anywhere; }
.source-summary { margin-bottom: 20px; color: var(--muted); font-size: 12px; }
.source-summary ul { padding-left: 20px; }
.password-reset-dialog { width: min(480px,calc(100% - 32px)); }
.password-reset-dialog form { display: grid; gap: 16px; }
.password-reset-dialog [role="alert"]:empty { display: none; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 32px; }
.login-page .login-shell { display: grid; grid-template-columns: 1fr 1fr; width: min(1000px,100%); max-width: none; min-height: 0; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--paper-shadow); }
.login-brand { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: 70px; padding: 40px; background: #2a1468; color: #fff; }
.login-brand>* { position: relative; z-index: 1; }
.login-brand h1 { color: #fff; font-size: clamp(25px,3vw,35px); line-height: 1.2; letter-spacing: -.03em; margin: 16px 0; }
.login-brand p,.login-brand-note { color: #d5c8ef; font-size: 13px; }
.login-brand .eyebrow { color: #ffc27b; }
.login-brand .brand { color: #fff; }
.login-form-panel { position: relative; padding: 80px 44px 44px; background: var(--paper); }
.login-theme { position: absolute; top: 22px; right: 22px; }
.login-theme .theme-label { display: inline; }
.login-form-wrap { max-width: 380px; margin: auto; }
.login-form-wrap h2 { font-size: 26px; margin: 12px 0; }
.login-form-wrap form { display: grid; gap: 18px; margin-top: 28px; }
.login-form-wrap #login-error { font-size: 12px; margin: 0; }
.login-form-wrap #login-error:empty { display: none; }
.login-assistance { color: var(--muted); font-size: 12px; margin: 24px 0 0; }
@media(max-width:700px){
  .login-page { padding: 16px; }
  .login-page .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 24px; gap: 0; }
  .login-brand>div,.login-brand-note { display: none; }
  .login-form-panel { padding: 72px 24px 28px; }
}
.accounts-dialog { width: min(880px,calc(100% - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; }
.dialog-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.dialog-heading h2 { margin: 0; }
.account-create-form { display: grid; gap: 16px; padding: 20px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 24px; }
.account-create-form h3 { margin: 0; }
.account-create-form small { font-weight: 400; font-size: 11px; color: var(--muted); }
.account-form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.account-feedback { margin: 0; font-size: 12px; }
.account-feedback:empty { display: none; }
.account-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.account-row p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.artifact-card h3 { overflow-wrap: anywhere; }
.advanced-options { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 15px 0; }
.advanced-options>summary { font-size: 12px; font-weight: 600; color: var(--ink); }
.advanced-content { display: flex; flex-direction: column; gap: 20px; padding-top: 20px; }
.form-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.form-foot>span { font-size: 11px; color: var(--muted); max-width: 195px; }
.generation-mode { padding: 12px; border-left: 2px solid var(--warning); color: var(--warning); background: var(--warning-bg); font-size: 12px; }
.result-panel { overflow: hidden; }
.empty-state { min-height: 560px; padding: 54px 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: var(--soft); }
.empty-state h2 { font-size: 18px; margin: 22px 0 10px; }
.empty-state p { max-width: 300px; font-size: 13px; line-height: 1.8; }
.document-placeholder { width: 47px; height: 62px; border: 1px solid var(--muted); border-radius: 2px; padding: 14px 9px; opacity: .55; }
.document-placeholder i { display: block; height: 1px; margin: 6px 0; background: var(--muted); }
.document-placeholder i:last-child { width: 65%; }
.result-content { padding: 26px; border-radius: 12px; }
.teacher-message { padding: 12px 14px; border-left: 2px solid var(--line); margin-bottom: 20px; background: var(--soft); }
.teacher-message span { font-size: 10px; color: var(--muted); }
.teacher-message p { margin-top: 4px; color: var(--ink); font-size: 12px; overflow-wrap: anywhere; }
.result-top { padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.result-top h2 { font-size: 17px; }
.result-top p { margin: 6px 0 14px; font-size: 11px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.export-more { position: relative; }
.export-more>summary { list-style: none; }
.export-more>summary::-webkit-details-marker { display: none; }
.export-more[open]>div { position: absolute; z-index: 10; top: calc(100% + 5px); right: 0; display: grid; gap: 4px; width: 160px; padding: 7px; background: var(--paper); border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 8px 20px #00000012; }
.export-more button { justify-content: flex-start; }
.result-content label { font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.result-content input, .result-content textarea, .result-content select { font-size: 13px; color: var(--ink); background: transparent; border-color: var(--line); padding: 8px; border-radius: 3px; }
.result-content textarea { min-height: 84px; line-height: 1.8; }
.result-content input:hover, .result-content textarea:hover { border-color: var(--muted); }
.result-section { border-top: 1px solid var(--line); padding: 21px 0 5px; margin-top: 17px; }
.result-section h3 { font-size: 12px; font-weight: 600; letter-spacing: .1px; margin-bottom: 15px; color: var(--ink); }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 5px 0 18px; }
.tag { display: inline-block; font-size: 10px; color: var(--muted); background: var(--soft); padding: 3px 7px; border-radius: 3px; }
.task-card { border-left: 2px solid var(--line); padding-left: 15px; margin: 20px 0 26px; }
.task-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: 11px; font-weight: 600; }
.task-head .small-btn { border-color: transparent; color: var(--muted); font-size: 10px; }
.list-row { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 10px; }
.list-row>label { flex: 1; min-width: 0; margin: 0; }
.section-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.section-total { font-size: 11px; color: var(--muted); }
.criteria-block { padding: 10px 0; }
.result-banner { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.task-table-scroll { overflow-x: auto; margin: 12px 0; }
.task-table { border-collapse: collapse; width: 100%; min-width: 330px; table-layout: fixed; }
.task-table caption { text-align: left; color: var(--muted); font-size: 11px; padding-bottom: 7px; }
.task-table td, .task-table th { border: 1px solid var(--line); padding: 3px; vertical-align: top; }
.task-table th { background: var(--soft); }
.task-table textarea { border: 0; min-height: 50px; padding: 5px; margin: 0; font-size: 12px; }
.artifact-list { display: grid; gap: 8px; }
.artifact-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.artifact-row>span { flex: 1; min-width: 130px; display: grid; gap: 3px; }
.artifact-row b { font-size: 12px; overflow-wrap: anywhere; }
.artifact-row small { color: var(--muted); font-size: 10px; }
.artifact-add { display: flex; gap: 8px; margin-top: 14px; }
.review-notice { border: 1px solid var(--warning); border-radius: 5px; background: var(--warning-bg); padding: 16px; margin-bottom: 20px; }
.review-notice h3, .review-notice h4 { font-size: 13px; margin-bottom: 8px; }
.review-notice p, .review-notice li, .review-notice summary { font-size: 12px; }
.review-notice li { margin-bottom: 10px; overflow-wrap: anywhere; }
.review-notice ul { padding-left: 18px; }
.history-toolbar { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.history-toolbar label:first-child { flex: 1; max-width: 440px; }
.stats-strip { color: var(--muted); font-size: 12px; margin-bottom: 14px; display: flex; gap: 16px; flex-wrap: wrap; }
.history-list { border: 1px solid var(--line); border-radius: 6px; background: var(--paper); overflow: hidden; }
.empty-message { padding: 32px 24px; color: var(--muted); font-size: 13px; text-align: center; }
.artifact-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.artifact-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--paper-shadow); padding: 24px; min-width: 0; }
.artifact-type { font-size: 11px; color: var(--accent); margin-bottom: 9px; }
.artifact-card h3 { font-size: 17px; margin-bottom: 10px; }
.artifact-card p { font-size: 12px; margin-bottom: 16px; }
.artifact-preview { padding: 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 3px; overflow: auto; font: 11px/1.8 Consolas, monospace; max-height: 230px; margin-bottom: 16px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.site-footer { margin-left: var(--sidebar-width); border-top: 1px solid var(--line); }
.footer-inner { padding: 18px 40px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 11px; color: var(--muted); }
.footer-links { display: flex; align-items: center; gap: 18px; }
.footer-links button { font-size: 11px; border: 0; background: transparent; padding: 4px 0; color: var(--muted); }
.footer-links button:hover { color: var(--ink); text-decoration: underline; }
.toast { position: fixed; z-index: 100; bottom: 22px; left: calc(50% + var(--sidebar-width)/2); transform: translate(-50%,16px); opacity: 0; pointer-events: none; max-width: min(640px,90vw); padding: 13px 18px; background: var(--ink); color: var(--paper); border-radius: 5px; font-size: 12px; box-shadow: 0 4px 20px #0002; transition: opacity .15s,transform .15s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
dialog { border: 1px solid var(--line); border-radius: 8px; padding: 30px; color: var(--ink); background: var(--paper); max-width: min(560px,calc(100% - 32px)); }
dialog::backdrop { background: #20143966; }
dialog h2 { margin-bottom: 15px; }
dialog p { margin-bottom: 15px; font-size: 13px; }
dialog label { margin-bottom: 15px; }
dialog .button { margin-top: 8px; }
.workspace-dialog { width: min(620px,calc(100% - 32px)); max-width: min(620px,calc(100% - 32px)); max-height: calc(100dvh - 40px); overflow: auto; }
.workspace-dialog-wide { width: min(1120px,calc(100% - 32px)); max-width: min(1120px,calc(100% - 32px)); }
.workspace-dialog .dialog-heading { position: sticky; top: -30px; z-index: 2; padding-block: 12px; background: var(--paper); border-bottom: 1px solid var(--line); }
.workspace-dialog h3 { margin: 20px 0 12px; }
.dialog-status { min-height: 20px; color: var(--muted); overflow-wrap: anywhere; }
.dialog-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); margin-top: 20px; }
.revision-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.comparison-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.comparison-grid > div { min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.comparison-grid h4 { padding: 10px 14px; margin: 0; background: var(--soft); font-size: 14px; border-bottom: 1px solid var(--line); }
.comparison-grid pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px; margin: 0; font: inherit; font-size: 14px; line-height: 1.65; }
.versions-layout { display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 24px; }
.version-list { display: flex; flex-direction: column; gap: 8px; align-self: start; max-height: 55dvh; overflow-y: auto; }
.version-entry { background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: 8px; text-align: left; padding: 12px; }
.version-entry strong,.version-entry span { display: block; overflow-wrap: anywhere; }
.version-entry span { font-size: 12px; color: var(--muted); margin-top: 6px; }
.version-entry.selected { border-color: var(--accent); background: var(--soft); }
.version-preview { min-width: 0; }
.version-preview .comparison-grid { grid-template-columns: 1fr; }
.classroom-picker { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.classroom-picker label { flex: 1 1 100%; margin: 0; }
.classroom-picker p { margin: 0; width: 100%; }
.profile-management { margin-top: 20px; }
.profile-row,.backup-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.backup-row span { display: block; color: var(--muted); margin-top: 4px; }
.usage-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin: 18px 0; }
.usage-summary > div { padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.usage-summary span { color: var(--muted); font-size: 13px; display: block; }
.usage-summary strong { font-size: 26px; display: block; margin-top: 8px; }
.data-table-wrap { overflow-x: auto; }
.data-table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table-wrap th,.data-table-wrap td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: top; }
@media(max-width:760px) {
  .workspace-dialog { padding: 20px; max-height: calc(100dvh - 24px); }
  .workspace-dialog .dialog-heading { top: -20px; }
  .comparison-grid,.versions-layout { grid-template-columns: 1fr; }
  .version-list { max-height: 180px; }
  .usage-summary { grid-template-columns: 1fr; gap: 8px; }
  .usage-summary > div { display: flex; align-items: center; justify-content: space-between; }
  .usage-summary strong { margin: 0; font-size: 22px; }
}
.dialog-close { float: right; border: 0; background: transparent; color: var(--muted); font-size: 22px; }
.loader { width: 13px; height: 13px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 761px) {
  .sidebar-collapsed { --sidebar-width: 70px; }
  .sidebar-collapsed .header-inner { padding-inline: 10px; }
  .sidebar-collapsed .brand { padding: 0; justify-content: center; }
  .sidebar-collapsed .brand-name, .sidebar-collapsed .nav-label, .sidebar-collapsed .user-menu>span:not(.user-avatar) { display: none; }
  .sidebar-collapsed .nav-link { justify-content: center; padding-inline: 10px; }
  .sidebar-collapsed .sidebar-toggle { align-self: center; }
  .sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
  .sidebar-collapsed .user-menu { justify-content: center; padding-inline: 0; }
}
@media (max-width: 1150px) {
  .page-view, .landing { padding-inline: 26px; }
  .workspace-grid { grid-template-columns: minmax(300px,.9fr) minmax(0,1.1fr); gap: 18px; }
  .form-panel, .result-content { padding: 20px; }
  .form-foot { flex-direction: column; gap: 12px; }
  .form-foot>.button { width: 100%; }
  .form-foot>span { max-width: none; }
  .document-table td, .document-table th { padding-inline: 14px; }
  .document-actions { flex-wrap: wrap; }
}
@media (max-width: 1000px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .empty-state { min-height: 260px; padding: 32px; }
  .topic-list { grid-template-columns: 1fr; }
  .topic-item { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px 22px; }
  .topic-item:last-child { border-bottom: 0; }
  .topic-item p { min-height: 0; }
  .artifact-grid { grid-template-columns: 1fr; }
  .document-table .level-column { display: none; }
}
@media (max-width: 760px) {
  :root { --sidebar-width: 0px; }
  .site-header { position: static; width: 100%; border-right: 0; border-bottom: 1px solid var(--sidebar-line); }
  .header-inner { padding: 17px 16px 12px; gap: 16px; }
  .brand { padding: 0; }
  .brand-name { font-size: 19px; }
  .brand-name em { font-size: 10px; }
  .brand-mark { width: 28px; height: 32px; }
  .sidebar-toggle, .user-menu { display: none; }
  .top-nav { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; }
  .nav-link { padding: 8px; min-height: 34px; gap: 7px; font-size: 11px; }
  .nav-icon { width: 14px; height: 14px; }
  .nav-label { gap: 5px; }
  .page-view, .landing { padding: 28px 16px 38px; }
  .page-intro { margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
  .page-intro h1 { font-size: 26px; }
  .page-intro p { font-size: 13px; }
  .page-intro>.button { min-height: 36px; font-size: 12px; }
  .section-heading { padding: 16px; align-items: flex-start; }
  .section-heading h2 { font-size: 16px; flex-direction: column; gap: 3px; }
  .section-heading .text-link { font-size: 11px; }
  .document-table .date-column { display: none; }
  .document-table .title-cell { min-width: 0; }
  .document-table td, .document-table th { padding: 15px 12px; }
  .document-table th:first-child, .document-table td:first-child { padding-left: 16px; }
  .document-table .document-link { font-size: 12px; }
  .document-table .document-actions .small-btn { font-size: 10px; padding: 4px 6px; min-height: 28px; }
  .document-theme { font-size: 10px; }
  .home-bottom { align-items: flex-start; flex-direction: column; gap: 8px; }
  .form-panel, .result-content { padding: 18px; }
  .form-row.three { grid-template-columns: 1fr 1fr; }
  .form-row.three>label:last-child { grid-column: span 2; }
  .history-toolbar { flex-wrap: wrap; }
  .history-toolbar label:first-child { flex-basis: 100%; max-width: none; }
  .history-toolbar label:nth-child(2) { flex: 1; }
  .history-list .document-actions { max-width: 115px; }
  .artifact-card { padding: 20px; }
  .footer-inner { padding: 18px 16px; flex-direction: column; align-items: flex-start; gap: 10px; }
  .footer-links { gap: 22px; }
  .list-row { flex-wrap: wrap; }
  .list-row>label { flex-basis: 100%; }
}
@media (max-width: 480px) {
  .top-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-link { min-height: 44px; white-space: normal; }
}
/* Shared navigation indicator, theme control, and document workspace. */
.nav-indicator { position: absolute; inset: 0 auto auto 0; z-index: 0; pointer-events: none; border-radius: 7px; background: var(--sidebar-selected); box-shadow: inset 3px 0 var(--brand-detail); opacity: 0; }
.indicator-ready .nav-indicator { transition: transform .38s cubic-bezier(.22,.8,.22,1), width .28s, height .28s, opacity .18s; }
.indicator-ready .nav-link.active { background: transparent; box-shadow: none; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 14px; }
.theme-switch { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 42px; padding: 7px 10px; border: 1px solid var(--sidebar-line); background: transparent; color: var(--sidebar-muted); text-align: left; font-size: 12px; }
.theme-switch:hover { color: var(--sidebar-ink); background: var(--sidebar-hover); }
.theme-track { position: relative; display: block; width: 46px; height: 26px; flex-shrink: 0; border-radius: 20px; background: #f7ce94; overflow: hidden; transition: background-color .4s; }
.theme-orb { position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%; background: #ea591f; transition: transform .45s cubic-bezier(.3,.8,.2,1), background-color .3s; }
.theme-orb::after { content: ''; position: absolute; top: -3px; left: 6px; width: 15px; height: 15px; border-radius: 50%; background: #412577; opacity: 0; transform: translateX(10px); transition: opacity .3s, transform .45s; }
.theme-cloud { position: absolute; right: 4px; bottom: 6px; width: 15px; height: 5px; border-radius: 6px; background: #fff9ef; transition: transform .4s, opacity .3s; }
.theme-cloud::before { content: ''; position: absolute; left: 3px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: inherit; }
.theme-stars { position: absolute; top: 8px; left: 9px; width: 2px; height: 2px; background: #e9d9ff; border-radius: 50%; opacity: 0; transform: translateY(-10px); box-shadow: 7px -3px #e9d9ff, 5px 9px #e9d9ff; transition: transform .4s, opacity .3s; }
[data-theme="dark"] .theme-track { background: #412577; }
[data-theme="dark"] .theme-orb { transform: translateX(20px) rotate(-20deg); background: #f4eaff; }
[data-theme="dark"] .theme-orb::after { opacity: 1; transform: translateX(0); }
[data-theme="dark"] .theme-cloud { transform: translateY(14px); opacity: 0; }
[data-theme="dark"] .theme-stars { transform: translateY(0); opacity: 1; }
.action-icon { display: block; width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.document-link>.action-icon { width: 31px; height: 36px; padding: 7px 5px; border: 1px solid var(--line); border-radius: 5px; color: var(--accent); background: var(--soft); }
[data-state="busy"], [data-state="success"] { opacity: 1 !important; cursor: default; }
[data-state="success"] .action-icon { stroke-dasharray: 30; stroke-dashoffset: 0; animation: check-draw .35s ease-out; }
.page-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex-shrink: 0; }
.page-tools svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
#conditions-toggle[aria-expanded="true"] { background: var(--selected); border-color: var(--accent); color: var(--accent); }
.editor-context { max-width: 960px; margin: -10px auto 18px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--muted); }
#save-indicator { display: inline-flex; align-items: center; gap: 7px; }
#save-indicator::before { content: ''; display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
#save-indicator[data-state="error"] { color: var(--danger); }
#save-indicator[data-state="error"]::before { background: var(--danger); }
.has-document:not(.show-conditions) .workspace-grid { grid-template-columns: minmax(0,1fr); max-width: 960px; margin-inline: auto; }
.has-document:not(.show-conditions) .result-panel { overflow: visible; }
.has-document:not(.show-conditions) .result-content { padding: 32px 42px; }
.has-document:not(.show-conditions) .result-top { position: sticky; top: 0; z-index: 9; background: var(--paper); padding: 18px 0; }
.has-document:not(.show-conditions) .result-content textarea { font-size: 14px; }
.has-document.show-conditions .editor-context { max-width: none; }
.document-outline { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 24px; }
.document-outline button { padding: 7px 11px; font-size: 11px; border: 1px solid var(--line); background: var(--soft); color: var(--muted); }
.document-outline button:hover { border-color: var(--accent); color: var(--accent); }
.result-section { scroll-margin-top: 150px; }
@keyframes check-draw { from { stroke-dashoffset: 30; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .action-spinner { animation: spin .8s linear infinite; }
  #save-indicator[data-state="saving"]::before { animation: generation-pulse 1.2s ease-in-out infinite; }
  .topic-symbol { transition: transform .25s, background-color .25s, color .25s; }
  .topic-item:hover .topic-symbol { transform: translateY(-3px) rotate(-4deg); background: var(--accent); color: var(--accent-ink); }
}
@media (min-width: 761px) {
  .sidebar-collapsed .theme-label { display: none; }
  .sidebar-collapsed .theme-switch { padding: 4px 0; border-color: transparent; justify-content: center; }
  .sidebar-collapsed .sidebar-bottom { gap: 10px; }
  .sidebar-collapsed .nav-link:is(:hover,:focus-visible)::after { content: attr(title); position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); padding: 7px 11px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 400; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--paper-shadow); white-space: nowrap; pointer-events: none; }
}
@media (max-width: 760px) {
  .sidebar-bottom { position: absolute; top: 18px; right: 16px; margin: 0; display: block; }
  .theme-switch { width: auto; min-height: 32px; padding: 3px 5px; border-color: transparent; }
  .theme-label { display: none; }
  .page-tools { justify-content: flex-start; }
  .page-tools .button { min-height: 36px; font-size: 12px; }
  .has-document:not(.show-conditions) .result-content { padding: 18px; }
  .document-link>.action-icon { display: none; }
  .editor-context>span:last-child { display: none; }
  .result-section { scroll-margin-top: 180px; }
  .topic-symbol { width: 32px; height: 32px; margin-bottom: 12px; }
}
/* Short transitions preserve the document workspace while giving controls a clear response. */
@media (prefers-reduced-motion: no-preference) {
  .site-header { transition: width .28s cubic-bezier(.2,.7,.2,1); }
  main, .site-footer { transition: margin-left .28s cubic-bezier(.2,.7,.2,1); }
  body, .site-header, .panel, .home-section, .artifact-card, .site-footer { transition-property: background-color, border-color, color; transition-duration: .22s; }
  .site-header { transition-property: width, background-color, border-color; transition-duration: .28s; }
  .site-footer { transition-property: margin-left, background-color, border-color; transition-duration: .28s; }
  .button, .small-btn, .text-link, .nav-link, .sidebar-toggle, .check-pill span { transition: background-color .18s, border-color .18s, color .18s, box-shadow .2s, transform .2s cubic-bezier(.2,.8,.2,1); }
  input, select, textarea { transition: border-color .18s, background-color .18s; }
  .sidebar-toggle svg, .nav-icon { transition: transform .25s; }
  .view:not(.hidden)>.page-intro { animation: arrive .38s cubic-bezier(.2,.7,.2,1) both; }
  .view:not(.hidden)>:not(.page-intro) { animation: arrive .45s cubic-bezier(.2,.7,.2,1) .06s both; }
  .document-table tbody tr { animation: row-arrive .35s ease-out both; }
  .document-table tbody tr:nth-child(2) { animation-delay: .035s; }
  .document-table tbody tr:nth-child(3) { animation-delay: .07s; }
  .document-table tbody tr:nth-child(4) { animation-delay: .105s; }
  .document-table tbody tr:nth-child(n+5) { animation-delay: .14s; }
  .artifact-card { animation: arrive .4s ease-out both; }
  .artifact-card:nth-child(2n) { animation-delay: .07s; }
  .result-content:not(.hidden) { animation: arrive .4s ease-out both; }
  .export-more[open]>div { animation: menu-arrive .18s ease-out both; }
  dialog[open] { animation: arrive .22s ease-out; }
  dialog[open]::backdrop { animation: backdrop-arrive .22s ease-out; }
  .generation-mark span { animation: generation-pulse 1.3s ease-in-out infinite; }
  .generation-mark span:nth-child(2) { animation-delay: .16s; }
  .generation-mark span:nth-child(3) { animation-delay: .32s; }
  .generation-skeleton i { background-size: 220% 100%; animation: paper-shimmer 1.8s linear infinite; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .button:hover:not(:disabled), .small-btn:hover:not(:disabled) { transform: translateY(-2px); }
  .button-primary:hover:not(:disabled) { box-shadow: 0 5px 12px color-mix(in srgb,var(--accent) 24%,transparent); }
  .button:active:not(:disabled), .small-btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
  .nav-link:hover .nav-icon { transform: translateX(2px); }
  .check-pill:hover span { transform: translateY(-1px); }
  .text-link:hover { transform: translateX(3px); }
}
.advanced-options>summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
.advanced-options>summary::-webkit-details-marker { display: none; }
.advanced-options>summary::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-right: 4px; transition: transform .2s; }
.advanced-options[open]>summary::after { transform: rotate(225deg); }
.generation-status { padding: 56px 32px; text-align: center; }
.generation-status h2 { margin: 24px 0 10px; font-size: 18px; }
.generation-elapsed { display: block; margin-top: 14px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.generation-status p { max-width: 330px; margin-inline: auto; font-size: 13px; }
.generation-mark { display: flex; gap: 7px; justify-content: center; align-items: center; height: 30px; }
.generation-mark span { width: 8px; height: 22px; border-radius: 4px; background: var(--accent); }
.generation-mark span:last-child { background: var(--brand-detail); }
.generation-skeleton { max-width: 350px; margin: 30px auto 0; padding: 24px; border: 1px solid var(--line); border-radius: 5px; }
.generation-skeleton i { display: block; height: 8px; border-radius: 2px; margin-bottom: 14px; background: linear-gradient(100deg,var(--soft) 30%,var(--line) 50%,var(--soft) 70%); }
.generation-skeleton i:first-child { width: 60%; height: 12px; margin-bottom: 22px; }
.generation-skeleton i:last-child { width: 75%; margin-bottom: 0; }
.result-panel[aria-busy="true"] #empty-state { display: none; }
.result-panel[aria-busy="true"] .result-content { opacity: .5; }
@keyframes arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes row-arrive { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes menu-arrive { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes backdrop-arrive { from { opacity: 0; } to { opacity: 1; } }
@keyframes generation-pulse { 0%,80%,100% { transform: scaleY(.55); opacity: .55; } 40% { transform: scaleY(1); opacity: 1; } }
@keyframes paper-shimmer { from { background-position: 110% 0; } to { background-position: -110% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition: none !important; } }
@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  :root { color-scheme: light; --canvas: #fff; --paper: #fff; --ink: #000; --muted: #333; --line: #ccc; --soft: #fff; }
  .site-header, .site-footer, .page-intro, .editor-context, .document-outline, .form-panel, .result-actions, .section-actions, .task-head .small-btn, .artifact-add, .list-row .small-btn, [data-table-action], .toast { display: none !important; }
  main { margin: 0; }
  .view { display: none !important; }
  #view-generate { display: block !important; padding: 0; }
  .workspace-grid { display: block; }
  .result-panel { border: 0; box-shadow: none; }
  .has-document:not(.show-conditions) .result-top { position: static; }
  .result-content { display: block !important; padding: 0; }
  .empty-state { display: none !important; }
  .result-content textarea { overflow: visible; }
}
