:root {
    --bg: #07101e;
    --bg-deep: #040b15;
    --panel: #0c1727;
    --panel-2: #101f32;
    --panel-3: #152841;
    --line: #1b6f8f;
    --line-soft: rgba(56, 189, 248, .18);
    --cyan: #38d5ff;
    --cyan-soft: #8be7ff;
    --gold: #f2b84b;
    --text: #edf7ff;
    --muted: #91a9bc;
    --danger: #ff7b86;
    --success: #63dfa0;
    --paper-dark: #0d1926;
    --radius: .25rem;
    --shadow: 0 7px 20px rgba(0, 0, 0, .18);
    --brand-logo-url: url('../images/logo-dark.png?v=3.31');
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 1rem;
    background:
        radial-gradient(circle at 20% 0%, rgba(56, 213, 255, .08), transparent 28%),
        linear-gradient(135deg, #07101e 0%, #040a13 100%);
    color: var(--text);
    min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:not(.icon-button):not(.x-button):not(.article-image-button):not(.mobile-create):not(.logout-button),
input[type="button"],input[type="submit"],input[type="reset"],a.link-button { font-size:12px; }
.primary-button,.secondary-button,.danger-button,.mini-action { font-size:12px!important; }
.primary-button.compact,.secondary-button.compact,.danger-button.compact { font-size:11px!important; }

.app-shell { display: grid; grid-template-columns: 290px 1fr; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    padding: 24px 18px;
    background: linear-gradient(180deg, rgba(10, 23, 40, .98), rgba(5, 13, 24, .98));
    border-right: 1px solid var(--line-soft);
    box-shadow: 6px 0 18px rgba(0,0,0,.11);
}
.sidebar::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .28;
    background-image:
        linear-gradient(90deg, transparent 24px, rgba(56,213,255,.08) 25px, transparent 26px),
        linear-gradient(0deg, transparent 24px, rgba(56,213,255,.05) 25px, transparent 26px);
    background-size: 52px 52px;
}
.brand, .main-nav, .sidebar-section, .sidebar-footer { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark {
    width: 46px; height: 46px; border: 1px solid var(--cyan); border-radius: .25rem;
    display: grid; place-items: center; color: var(--gold); font-weight: 800;
    box-shadow: inset 0 0 12px rgba(56,213,255,.06), 0 0 10px rgba(56,213,255,.05);
}
.brand-logo { display:block; width:50px; height:50px; flex:0 0 auto; content:var(--brand-logo-url); object-fit:contain; filter:drop-shadow(0 4px 9px rgba(0,0,0,.16)); }
.auth-brand .brand-logo { width:64px; height:64px; }
.brand strong { display: block; font-size:17px; letter-spacing: .02em; }
.brand span { display: block; margin-top: 4px; font-size:12px; color: var(--muted); }

.main-nav { display: grid; gap: 7px; }
.nav-item {
    border: 1px solid transparent; background: transparent; color: #b8ccda;
    padding: 11px 12px; border-radius: .25rem; text-align: left; display: flex; gap: 10px; align-items: center;
}
.nav-item:hover, .nav-item.active {
    background: linear-gradient(90deg, rgba(56,213,255,.12), rgba(56,213,255,.03));
    border-color: rgba(56,213,255,.18); color: var(--text);
}

.nav-item span { width: 24px; color: var(--cyan); text-align: center; }

.sidebar-section { margin-top: 30px; min-height: 0; flex: 1; overflow: auto; }
.section-heading { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size:12px; text-transform: uppercase; letter-spacing: .12em; margin: 0 8px 10px; }
.category-tree, .category-children { display: grid; gap: 4px; }
.category-branch.is-collapsed > .category-children { display: none; }
.category-button {
    width: 100%; border: 0; background: transparent; color: #bcd0de; text-align: left;
    padding: 9px 10px; border-radius: .25rem; display: flex; justify-content: space-between;
}
.category-button:hover { background: rgba(56,213,255,.07); color: #fff; }
.category-count { color: var(--muted); font-size:12px; }
.sidebar-footer { border-top: 1px solid var(--line-soft); padding-top: 16px; color: var(--muted); font-size:12px; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: .25rem; background: var(--success); box-shadow: 0 0 6px rgba(99,223,160,.48); }

.workspace { min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; gap: 18px; align-items: center;
    padding: 18px 28px; border-bottom: 1px solid var(--line-soft);
    background: rgba(6, 14, 25, .88); backdrop-filter: blur(16px);
}
.search-wrap { position: relative; flex: 1; max-width: 820px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--cyan); }
.search-wrap input {
    width: 100%; background: rgba(15,30,49,.85); border: 1px solid rgba(56,213,255,.18); color: #fff;
    padding: 12px 15px 12px 40px; border-radius: .25rem; outline: none;
}
.search-wrap input:focus { border-color: rgba(56,213,255,.55); box-shadow: 0 0 0 3px rgba(56,213,255,.07); }
.search-results {
    position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: #0d1b2c;
    border: 1px solid rgba(56,213,255,.22); border-radius: .25rem; box-shadow: var(--shadow); overflow: hidden;
}
.search-result { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.search-result:hover { background: rgba(56,213,255,.08); }
.search-result strong { display: block; }
.search-result small { color: var(--muted); }
.hidden { display: none !important; }

.content { padding: 30px; max-width: 1500px; margin: 0 auto; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 6px 0 30px; }
.eyebrow { color: var(--cyan); text-transform: uppercase; font-size:11px; letter-spacing: .14em; margin-bottom: 10px; }
h1 { margin: 0; font-size:clamp(28px, 4vw, 44px); letter-spacing: -.03em; }
h2, h3 { line-height: 1.25; }
.page-header p { margin: 10px 0 0; color: var(--muted); line-height: 1.7; max-width: 760px; }


.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card, .panel, .article-card {
    background: linear-gradient(180deg, rgba(16,31,50,.93), rgba(10,22,37,.93));
    border: 1px solid rgba(56,213,255,.16); border-radius: .25rem; box-shadow: 0 5px 16px rgba(0,0,0,.1);
}
.stat-card { padding: 20px; position: relative; overflow: hidden; }
.stat-card::after { content:""; position:absolute; width:70px; height:70px; right:-20px; bottom:-20px; border:1px solid rgba(56,213,255,.18); transform:rotate(45deg); }
.stat-label { color: var(--muted); font-size:12px; text-transform: uppercase; letter-spacing: .08em; }
.stat-value { font-size:34px; font-weight: 760; margin-top: 9px; }
.stat-accent { width: 24px; height: 3px; background: var(--gold); margin-top: 12px; }

.panel { padding: 22px; }
.panel-header { display: flex; align-items: center; justify-content: space-between;}
.panel-header h2 { margin: 0; font-size:18px; }
.article-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.article-card { padding: 18px; transition: transform .18s ease, border-color .18s ease; cursor: pointer; }
.article-card > .eyebrow { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.article-card:hover { transform: translateY(-2px); border-color: rgba(56,213,255,.4); }
.article-card h3 { margin: 8px 0 8px; font-size:17px; }
.article-card p { color: var(--muted); font-size:14px; line-height: 1.6; margin: 0; min-height: 44px; }
.article-meta { display: flex; gap: 8px; margin-bottom: 3rem;align-items: center; flex-wrap: wrap; color: var(--muted); font-size:12px; margin-top: 16px; }
.pill { border: 1px solid rgba(56,213,255,.22); padding: 4px 8px; border-radius: .25rem; color: #bfefff; }
.pill.gold { border-color: rgba(242,184,75,.35); color: #ffd890; }

.article-view { max-width: 980px; }
.article-toolbar { display: flex; gap: 10px; margin: 20px 0 24px; }
.article-body { line-height: 1.8; color: #dce9f2; font-size:16px; }
.article-body h2 { margin-top: 36px; color: #fff; padding-top: 8px; }
.article-body h3 { margin-top: 28px; color: var(--cyan-soft); }
.article-body pre { background: #050b14; border: 1px solid rgba(56,213,255,.16); padding: 16px; border-radius: .25rem; overflow: auto; }
.article-body ul { padding-left: 22px; }

.primary-button, .secondary-button, .icon-button {
    border-radius: .25rem; transition: .16s ease; font-weight: 650;
}
.primary-button { background: linear-gradient(180deg, #20bfe6, #1493b8); color: #04101a; border: 1px solid #4be0ff; padding: 11px 15px; box-shadow: 0 3px 9px rgba(20,147,184,.14); }
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.secondary-button { background: transparent; color: var(--text); border: 1px solid rgba(56,213,255,.22); padding: 10px 14px; }
.secondary-button:hover { background: rgba(56,213,255,.07); }
.icon-button { width: 30px; height: 30px; display: grid; place-items: center; background: rgba(56,213,255,.06); color: var(--cyan); border: 1px solid rgba(56,213,255,.16); }
.icon-button.large { width: 38px; height: 38px; font-size:22px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(2,7,13,.8); display: grid; place-items: center; padding: 22px; backdrop-filter: blur(8px); }
.modal-card { width: min(980px, 96vw); max-height: 92vh; overflow: auto; background: #0b1727; border: 1px solid rgba(56,213,255,.26); border-radius: .25rem; box-shadow: var(--shadow); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--line-soft); }
.modal-header h2 { margin: 0; }
.article-form { padding: 24px; display: grid; gap: 18px; }
.article-form label { display: grid; gap: 8px; color: #bfd2df; font-size:13px; }
.article-form input, .article-form select, .article-form textarea {
    width: 100%; background: rgba(0,0,0,.16); border: 1px solid rgba(255,255,255,.16); color: #eef8ff;
    border-radius: .25rem; padding: 8px 10px; outline: none;
}
.article-form textarea { resize: vertical; line-height: 1.55; }
.article-form input:focus, .article-form select:focus, .article-form textarea:focus { border-color: rgba(56,213,255,.52); box-shadow: 0 0 0 3px rgba(56,213,255,.07); }
.editor-details-layout { display:grid;grid-template-columns:minmax(0,1fr) minmax(270px,320px);gap:20px;align-items:stretch; }
.editor-left-column { display:flex;flex-direction:column;min-width:0; }
.editor-primary-fields { align-content:start; }
.article-category-field { position:relative;display:flex;align-self:stretch;flex-direction:column;min-width:0;min-height:0;height:100%;margin:0;padding:0;overflow:hidden;border:0;background:transparent;color:var(--text);font-size:13px; }
.article-category-field legend { margin:0 0 8px;padding:0;color:var(--muted);font-weight:650; }
.article-category-picker { position:absolute;inset:27px 0 0;display:grid;align-content:start;gap:2px;min-height:0;height:auto;max-height:none;overflow:auto;padding:5px 0;border:solid rgba(255,255,255,.14);border-width:1px 0;background:transparent; }
.article-category-choice { display:flex!important;grid-template-columns:none!important;align-items:center;gap:8px!important;min-height:30px;padding:4px 7px;border-radius:.25rem;color:var(--text)!important;cursor:pointer; }
.article-category-choice:hover { background:rgba(255,255,255,.045); }
.article-category-choice input { flex:0 0 auto;width:16px!important;height:16px;margin:0;padding:0;border:0;accent-color:var(--cyan);box-shadow:none!important; }
.article-category-choice span { overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.article-category-empty { padding:8px;color:var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.content-editor { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.editor-hint { color: var(--muted); font-size:12px; margin-top: -8px; }
.modal-actions { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line-soft); padding-top: 18px; }
.favorite-toggle { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 8px !important; color: #ffd890 !important; }
.favorite-toggle input { width: auto; }
.spacer { flex: 1; }

.empty-state { border: 1px dashed rgba(56,213,255,.22); border-radius: .25rem; padding: 46px; text-align: center; color: var(--muted); }
.notice { padding: 14px 16px; border: 1px solid rgba(242,184,75,.28); background: rgba(242,184,75,.06); color: #ffdc98; border-radius: .25rem; margin-bottom: 20px; }

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 230px 1fr; }
    .article-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: static; height: auto; }
    .sidebar-section, .sidebar-footer { display: none; }
    .main-nav { grid-template-columns: repeat(5, minmax(0,1fr)); }
    .nav-item { justify-content: center; padding: 9px 4px; font-size: 0; }
    .nav-item span { font-size:18px; }
    .nav-item.active::after { display: none; }
    .topbar { padding: 14px; }
    .content { padding: 20px 14px; }
    .article-grid, .stat-grid, .form-grid { grid-template-columns: 1fr; }
    #new-article { white-space: nowrap; }
}

/* Authentication --------------------------------------------------------- */
.account-avatar {
    width: 38px;
    height: 38px;
    border-radius: .25rem;
    display: grid;
    place-items: center;
    border: 1px solid rgba(56,213,255,.28);
    background: rgba(56,213,255,.08);
    color: var(--gold);
    font-weight: 800;
}
.logout-button { color: var(--gold); }

.auth-body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 18% 22%, rgba(56,213,255,.09), transparent 26%),
        radial-gradient(circle at 80% 78%, rgba(242,184,75,.055), transparent 24%),
        #050c16;
}
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr);
}
.auth-brand-panel {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    padding: clamp(28px, 5vw, 70px);
    border-right: 1px solid rgba(56,213,255,.13);
    background:
        linear-gradient(145deg, rgba(13,30,49,.96), rgba(5,14,25,.96)),
        #07111f;
    display: flex;
    flex-direction: column;
}
.auth-brand { margin: 0; }
.auth-intro { margin: auto 0; max-width: 570px; position: relative; z-index: 2; }
.auth-intro h1 { font-size:clamp(38px, 5vw, 68px); line-height: 1.04; }
.auth-intro p { color: var(--muted); line-height: 1.8; font-size:16px; max-width: 560px; margin-top: 24px; }
.auth-circuit { position: absolute; inset: auto -60px 8% auto; width: 48%; min-width: 260px; height: 190px; opacity: .45; }
.auth-circuit::before, .auth-circuit::after, .auth-circuit span { content: ""; position: absolute; border-color: rgba(56,213,255,.27); }
.auth-circuit::before { inset: 20px 40px 60px 0; border-top: 1px solid; border-right: 1px solid; }
.auth-circuit::after { inset: 70px 0 10px 65px; border-left: 1px solid rgba(242,184,75,.32); border-top: 1px solid rgba(242,184,75,.22); }
.auth-circuit span:nth-child(1) { width: 10px; height: 10px; border: 2px solid var(--cyan); border-radius: .25rem; left: -4px; top: 15px; box-shadow: 0 0 8px rgba(56,213,255,.3); }
.auth-circuit span:nth-child(2) { width: 8px; height: 8px; border: 2px solid var(--gold); border-radius: .25rem; left: 60px; top: 65px; }
.auth-circuit span:nth-child(3) { width: 80px; height: 1px; background: rgba(56,213,255,.35); right: 0; top: 20px; }
.auth-form-panel {
    display: grid;
    place-items: center;
    padding: 32px;
    background:
        linear-gradient(rgba(5,12,22,.38), rgba(5,12,22,.52)),
        url('../images/auth-form-background.webp') 62% center / cover no-repeat;
}
.login-page .auth-form-panel {
    background:
        linear-gradient(rgba(247,250,255,.08), rgba(237,245,252,.16)),
        url('../images/login-auth-form-background.webp') 62% center / cover no-repeat;
}
.auth-card {
    width: min(470px, 100%);
    padding: clamp(28px, 4vw, 46px);
    background: linear-gradient(180deg, rgba(16,31,50,.97), rgba(9,20,34,.97));
    border: 1px solid rgba(56,213,255,.2);
    border-radius: .25rem;
    box-shadow: 0 7px 20px rgba(0,0,0,.2) !important;
}
.auth-card h2 { margin: 0; font-size:30px; }
.auth-subtitle { color: var(--muted); line-height: 1.65; margin: 9px 0 24px; }
.auth-form { display: grid; gap: 17px; }
.auth-form label { display: grid; gap: 8px; color: #bfd2df; font-size:13px; }
.auth-form input {
    width: 100%;
    box-sizing: border-box;
    background: #07111f;
    border: 1px solid rgba(56,213,255,.18);
    color: #eef8ff;
    border-radius: .25rem;
    padding: 12px 13px;
    outline: none;
}
.auth-form input:focus { border-color: rgba(56,213,255,.55); box-shadow: 0 0 0 3px rgba(56,213,255,.07); }
.auth-submit { width: 100%; margin-top: 5px; text-align: center; }
.auth-link-button { display: block; text-decoration: none; box-sizing: border-box; margin-top: 18px; }
.auth-error, .auth-notice { border-radius: .25rem; padding: 12px 14px; margin: 0 0 18px; line-height: 1.55; font-size:13px; }
.auth-error { color: #ffd0d0; background: rgba(255,91,91,.08); border: 1px solid rgba(255,91,91,.24); }
.auth-notice { color: #ffe0a5; background: rgba(242,184,75,.07); border: 1px solid rgba(242,184,75,.24); }
.optional { color: var(--muted); font-weight: 400; }
.password-hint { color: var(--muted); font-size:12px; margin-top: -5px; }

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand-panel { min-height: auto; padding: 28px; border-right: 0; border-bottom: 1px solid rgba(56,213,255,.13); }
    .auth-intro { margin: 48px 0 12px; }
    .auth-intro h1 { font-size:clamp(34px, 9vw, 52px); }
    .auth-circuit { display: none; }
    .auth-form-panel { padding: 24px 16px 38px; }
}

/* Web installer ---------------------------------------------------------- */
.setup-form-panel { align-items: start; overflow: auto; }
.setup-card { width: min(720px, 100%); margin: 22px 0; }
.setup-card code { color: var(--cyan-soft); background: rgba(56,213,255,.07); border: 1px solid rgba(56,213,255,.13); padding: 2px 6px; border-radius: .25rem; }
.setup-requirements { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.requirement { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: .25rem; font-size:12px; border: 1px solid rgba(56,213,255,.16); color: var(--muted); }
.requirement b { width: 18px; height: 18px; display: grid; place-items: center; border-radius: .25rem; font-size:11px; }
.requirement.ok { color: #bcf4d4; border-color: rgba(99,223,160,.23); background: rgba(99,223,160,.06); }
.requirement.ok b { color: #062013; background: var(--success); }
.requirement.fail { color: #ffd0d0; border-color: rgba(255,91,91,.25); background: rgba(255,91,91,.06); }
.requirement.fail b { color: #260707; background: #ff7474; }
.setup-form { gap: 16px; }
.setup-section-title { display: flex; align-items: center; gap: 12px; margin: 14px 0 2px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.setup-section-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.setup-section-title > span { width: 38px; height: 38px; border: 1px solid rgba(56,213,255,.27); border-radius: .25rem; display: grid; place-items: center; color: var(--gold); font-weight: 800; }
.setup-section-title strong, .setup-section-title small { display: block; }
.setup-section-title strong { color: var(--text); font-size:14px; }
.setup-section-title small { color: var(--muted); margin-top: 3px; line-height: 1.35; }
.setup-grid.two { display: grid; grid-template-columns: 1fr 150px; gap: 14px; }
.auth-error ul { margin: 8px 0 0; padding-left: 20px; }
.auth-error li + li { margin-top: 5px; }
.auth-submit:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.5); transform: none; }

@media (max-width: 620px) {
    .setup-grid.two { grid-template-columns: 1fr; }
    .setup-card { padding: 24px 20px; }
}

/* Knowledge Base v2 ------------------------------------------------------ */
.main-nav { overflow: auto; max-height: 46vh; padding-right: 2px; }
.category-row { display:grid; grid-template-columns:20px minmax(0,1fr) 24px; align-items:center; padding-left:calc(var(--depth) * 14px); }
.category-toggle,.category-toggle-placeholder { width:20px;height:28px; }
.category-toggle { display:grid;place-items:center;border:0;border-radius:.25rem;background:transparent;color:#86a9bc;padding:0; }
.category-toggle span { display:block;font-size:18px;line-height:1;transform:rotate(90deg);transition:transform .16s ease; }
.category-branch.is-collapsed > .category-row .category-toggle span { transform:rotate(0); }
.category-toggle:hover,.category-toggle:focus-visible { background:rgba(56,213,255,.1);color:var(--cyan); }
.category-edit { border:0;background:transparent;color:var(--muted);font-size:18px;border-radius:.25rem; }
.category-edit:hover { color:var(--gold);background:rgba(242,184,75,.08); }
.mobile-only { display:none; }
.compact { padding:8px 10px !important; }
.header-actions { display:flex; gap:10px; flex-wrap:wrap; }
.stat-grid.six { grid-template-columns:repeat(6,minmax(0,1fr)); }
.stat-sub { color:var(--muted);font-size:11px;margin-top:3px; }
.dashboard-actions { display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-top:24px; }
.action-tile { border:1px solid var(--line-soft);background:linear-gradient(160deg,rgba(14,31,50,.92),rgba(8,18,31,.92));color:var(--text);border-radius:.25rem;padding:20px;text-align:left;display:flex;gap:14px;align-items:center; }
.action-tile b { color:var(--gold);font-size:23px;min-width:26px;text-align:center; }.action-tile:hover{border-color:rgba(56,213,255,.42);transform:translateY(-1px)}
.card-top { display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px; }
.type-badge,.exam-badge { display:inline-flex;align-items:center;border-radius:.25rem;font-size:10px;text-transform:uppercase;letter-spacing:.08em;padding:4px 8px;border:1px solid rgba(56,213,255,.22);color:var(--cyan-soft);background:rgba(56,213,255,.05); }
.exam-badge { color:var(--gold);border-color:rgba(242,184,75,.28);background:rgba(242,184,75,.05);letter-spacing:.12em; }
.tag-row { display:flex;flex-wrap:wrap;gap:6px;margin-top:12px; }.tag{font-size:11px;color:#bdeeff;border:1px solid rgba(56,213,255,.16);background:rgba(56,213,255,.05);padding:3px 7px;border-radius:.25rem}.tag small{color:var(--muted)}
.filter-bar { display:grid;grid-template-columns:minmax(240px,2fr) repeat(5,minmax(130px,1fr));gap:10px;margin-bottom:16px;padding:14px;background:rgba(12,24,40,.72);border:1px solid var(--line-soft);border-radius:.25rem; }
.filter-bar.article-filters { grid-template-columns:repeat(7,minmax(125px,1fr));overflow-x:auto; }
.filter-bar input,.filter-bar select,.settings-form input,.settings-form select,.settings-form textarea,.assistant-input textarea,.quiz-answers textarea,.modal-body input,.modal-body select,.modal-body textarea { width:100%;background:#07111f;border:1px solid rgba(56,213,255,.18);color:var(--text);border-radius:.25rem;padding:10px 11px;outline:none; }
.result-count { color:var(--muted);font-size:12px;margin:0 0 14px 2px; }
.article-kicker { display:flex;align-items:center;gap:10px;margin-bottom:10px }.eyebrow.inline{margin:0}.article-summary{color:var(--muted);line-height:1.75;font-size:16px;max-width:850px}.source-link{color:var(--cyan);text-decoration:none}.source-link:hover{text-decoration:underline}
.article-layout { display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:30px;align-items:start; }.article-side-sections{display:grid;gap:12px;position:sticky;top:94px}.side-panel{background:rgba(12,25,42,.82);border:1px solid var(--line-soft);border-radius:.25rem;padding:14px}.side-title{font-size:11px;color:var(--gold);text-transform:uppercase;letter-spacing:.12em;margin-bottom:10px}.side-link,.collection-article,.choice-row{width:100%;border:0;border-bottom:1px solid var(--line-soft);background:transparent;color:var(--text);padding:9px 2px;text-align:left;display:flex;justify-content:space-between;gap:10px}.side-link:hover,.collection-article:hover,.choice-row:hover{color:var(--cyan)}.side-link small,.collection-article small,.choice-row small{color:var(--muted)}.mini-action{margin-top:10px;border:1px dashed rgba(56,213,255,.25);background:transparent;color:var(--cyan);padding:7px 9px;border-radius:.25rem;width:100%}.muted{color:var(--muted)}
.file-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:6px;align-items:center;padding:7px 0;border-bottom:1px solid var(--line-soft);font-size:12px}.file-row a{color:var(--cyan);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-row small{color:var(--muted)}.x-button{border:0;background:transparent;color:var(--danger);font-size:18px;border-radius:.25rem;padding:3px 7px}.x-button:hover{background:rgba(255,123,134,.08)}
.related-panel{grid-column:1/-1;margin-top:8px}.compact-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.article-toolbar{flex-wrap:wrap}.danger-button{background:rgba(255,123,134,.07);color:#ffadb4;border:1px solid rgba(255,123,134,.28);border-radius:.25rem;padding:10px 14px;font-weight:650}.danger-button:hover{background:rgba(255,123,134,.13)}
.dropdown{position:relative}.dropdown-menu{position:absolute;z-index:25;top:calc(100% + 6px);left:0;min-width:160px;background:#0c192a;border:1px solid var(--line-soft);border-radius:.25rem;overflow:hidden;box-shadow:var(--shadow)}.dropdown-menu a{display:block;color:var(--text);text-decoration:none;padding:9px 12px}.dropdown-menu a:hover{background:rgba(56,213,255,.07)}
.fact-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin:12px 0 24px}.fact-grid>div{border:1px solid var(--line-soft);background:rgba(56,213,255,.035);border-radius:.25rem;padding:10px}.fact-grid small{display:block;color:var(--muted);text-transform:capitalize}.fact-grid strong{display:block;margin-top:4px;word-break:break-word}
.article-body p{margin:0 0 12px}.para-gap{height:10px}.article-body a{color:var(--cyan)}.article-body blockquote{border-left:3px solid var(--gold);margin:18px 0;padding:8px 14px;background:rgba(242,184,75,.04);color:#dce8ef}.callout{margin:22px 0;border:1px solid rgba(56,213,255,.23);border-left:4px solid var(--cyan);background:rgba(56,213,255,.055);border-radius:.25rem;padding:14px 16px}.callout>strong{display:block;color:var(--cyan-soft);margin-bottom:7px}.callout.warning{border-color:rgba(255,123,134,.25);border-left-color:var(--danger);background:rgba(255,123,134,.05)}.callout.warning>strong{color:#ffadb4}.callout.exam{border-color:rgba(242,184,75,.3);border-left-color:var(--gold);background:rgba(242,184,75,.055)}.callout.exam>strong{color:#ffd888}.callout.tip>strong{color:var(--success)}.callout.tip{border-left-color:var(--success)}
.code-block{position:relative;padding-top:34px!important}.code-label{position:absolute;top:0;left:0;right:0;height:27px;padding:5px 10px;background:rgba(56,213,255,.07);border-bottom:1px solid var(--line-soft);font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.1em}.tok-key{color:#7fe3ff}.tok-str{color:#ffd58a}.checklist{list-style:none;padding-left:2px!important}.checklist input{accent-color:var(--cyan);cursor:pointer}.checklist li:has(input:checked){color:var(--muted);text-decoration:line-through}.checklist li.checklist-saving{opacity:.6}.table-wrap{overflow:auto;margin:20px 0}.article-body table{border-collapse:collapse;width:100%}.article-body th,.article-body td{border:1px solid var(--line-soft);padding:9px 11px;text-align:left}.article-body th{background:rgba(56,213,255,.06);color:var(--cyan-soft)}
.code-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.code-copy-button { flex: 0 0 auto; padding: 1px 7px; border: 1px solid var(--line-soft); border-radius: .25rem; background: rgba(56,213,255,.08); color: var(--cyan-soft); font-size:10px; line-height: 1.3; font-weight: 650; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.code-copy-button:hover, .code-copy-button:focus-visible { background: rgba(56,213,255,.18); }
html.light .code-copy-button { background: #f8fbfd; color: #075a78; border-color: #aac5d0; }
html.light .code-copy-button:hover, html.light .code-copy-button:focus-visible { background: #dceff5; }
@media print { .code-copy-button { display: none; } }
.pdf-embed{margin:28px 0;border:1px solid var(--line-soft);border-radius:.25rem;overflow:hidden}.pdf-embed summary{padding:12px 14px;cursor:pointer;color:var(--cyan)}.pdf-embed iframe{width:100%;height:720px;border:0;background:white}
.form-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}.span-2{grid-column:span 2}.type-fields{border-top:1px solid var(--line-soft);padding-top:18px}.editor-toolbar{display:flex;gap:5px;flex-wrap:wrap;background:rgba(4,12,22,.65);border:1px solid var(--line-soft);border-radius:.25rem;padding:7px}.editor-toolbar button{border:1px solid rgba(56,213,255,.16);background:rgba(56,213,255,.05);color:#d8f5ff;border-radius:.25rem;padding:6px 9px;font-size:12px}.editor-toolbar button:hover{background:rgba(56,213,255,.12)}.small-modal{width:min(650px,96vw)}.modal-body{padding:22px}.compact-form{padding:0}.version-preview{max-height:55vh;overflow:auto}.secret-box{font:700 18px ui-monospace,monospace;letter-spacing:.12em;padding:14px;border:1px dashed rgba(242,184,75,.35);background:rgba(242,184,75,.05);border-radius:.25rem;color:var(--gold);word-break:break-all}
.loading{height:240px;display:flex;justify-content:center;align-items:center;gap:8px}.loading span{width:8px;height:8px;border-radius:.25rem;background:var(--cyan);animation:pulse 1s infinite alternate}.loading span:nth-child(2){animation-delay:.2s}.loading span:nth-child(3){animation-delay:.4s}@keyframes pulse{to{opacity:.25;transform:translateY(-7px)}}
.toast{position:fixed;right:24px;bottom:24px;z-index:999;background:#0d2031;border:1px solid rgba(99,223,160,.35);color:var(--text);padding:12px 16px;border-radius:.25rem;box-shadow:var(--shadow);opacity:0;transform:translateY(12px);transition:.2s}.toast.show{opacity:1;transform:none}.toast.error{border-color:rgba(255,123,134,.4)}
.learn-summary{max-width:240px;margin-bottom:20px}.review-card{max-width:900px;margin:0 auto;background:linear-gradient(160deg,rgba(16,34,55,.96),rgba(8,18,31,.96));border:1px solid rgba(56,213,255,.22);border-radius:.25rem;padding:34px;min-height:360px;position:relative}.review-card h2{font-size:clamp(24px,4vw,38px);max-width:760px;margin:18px 0 34px}.review-count{position:absolute;right:22px;top:20px;color:var(--muted);font-size:12px}.card-answer{font-size:17px;line-height:1.7}.divider{height:1px;background:var(--line-soft);margin:20px 0}.review-buttons{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-top:28px}.review-buttons button{border:1px solid var(--line-soft);background:rgba(56,213,255,.05);color:var(--text);padding:12px;border-radius:.25rem}.review-buttons button:hover{border-color:var(--cyan)}.success-state{text-align:center;padding:70px 20px;border:1px solid var(--line-soft);border-radius:.25rem}.success-state b{font-size:40px;color:var(--success)}
.question-list{display:grid;gap:8px}.question-row{display:flex;justify-content:space-between;align-items:flex-start;gap:15px;padding:14px;border:1px solid var(--line-soft);border-radius:.25rem;background:rgba(56,213,255,.025)}.question-row h3{margin:7px 0 4px}.question-row p{margin:0;color:var(--muted);font-size:12px}.quiz-card{max-width:900px;margin:0 auto;border:1px solid var(--line-soft);border-radius:.25rem;padding:30px;background:rgba(12,25,42,.88)}.quiz-card h2{font-size:clamp(22px,3.5vw,34px);margin:20px 0}.quiz-answers{display:grid;gap:9px;margin:20px 0}.answer-option{display:block;border:1px solid var(--line-soft);border-radius:.25rem;padding:12px;background:rgba(56,213,255,.025)}.answer-option:hover{border-color:rgba(56,213,255,.45)}.feedback{border:1px solid var(--line-soft);border-left:4px solid var(--cyan);border-radius:.25rem;padding:14px;margin:18px 0}.feedback.correct{border-left-color:var(--success)}.feedback.wrong{border-left-color:var(--danger)}.feedback.neutral{border-left-color:var(--gold)}
.collection-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:stretch}.collection-grid-overview{grid-auto-rows:1fr}.collection-card{display:flex;flex-direction:column;height:100%;min-width:0;border:1px solid var(--line-soft);border-radius:.25rem;padding:18px;background:rgba(12,25,42,.78)}.collection-card-preview{min-height:462px}.collection-card h2{margin:0}.collection-card .panel-header p{display:-webkit-box;min-height:2.8em;margin:7px 0 0;overflow:hidden;color:var(--muted);line-height:1.4;-webkit-box-orient:vertical;-webkit-line-clamp:2}.collection-card-content{display:grid;align-content:start;min-width:0}.collection-card-preview .collection-card-content{grid-template-rows:repeat(5,44px);height:228px;margin-top:15px;padding-top:7px;border-top:1px solid var(--line-soft);overflow:hidden}.collection-card-preview .collection-article{height:44px;margin:0}.collection-card-preview .collection-article>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.collection-card-preview .collection-article>small{flex:0 0 auto;max-width:42%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.collection-card-more{width:100%;min-height:41px;margin-top:12px;padding:12px 2px 4px;border:0;border-top:1px solid var(--line-soft);background:transparent;color:var(--cyan);font-weight:700;text-align:left}.collection-card-more:hover,.collection-card-more:focus-visible{color:var(--gold)}.choice-list{display:grid}.choice-row{padding:12px 4px}
.article-sequence-links{display:grid;gap:6px}.article-sequence-panel .sequence-link{display:grid;justify-content:stretch;gap:3px;padding:8px}.article-sequence-panel .sequence-link small{font-size:10px;text-transform:uppercase;letter-spacing:.08em}.article-sequence-panel .sequence-link span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sequence-empty{padding:6px 8px;color:var(--muted);font-size:11px;border-left:2px solid var(--line-soft)}
.collection-article.sequence-member{position:relative;padding-left:11px;border-left:2px solid rgba(56,213,255,.55);background:linear-gradient(90deg,rgba(56,213,255,.075),transparent 58%)}.collection-article.sequence-member>span{display:flex;align-items:center;gap:8px;min-width:0}.collection-sequence-index{display:inline-grid;place-items:center;width:22px;height:22px;flex:0 0 22px;border:1px solid rgba(56,213,255,.38);background:rgba(56,213,255,.1);color:var(--cyan-soft);font-size:10px;font-weight:750;font-style:normal}.collection-article.sequence-start{margin-top:8px;border-top:1px solid var(--line-soft)}.collection-article.sequence-end{margin-bottom:8px;border-bottom-color:rgba(56,213,255,.35)}.collection-article.sequence-member:not(.sequence-end){border-bottom-color:rgba(56,213,255,.16)}
.collection-card-preview .collection-card-content .collection-article{border-top:0;border-bottom:0}.collection-card-preview .collection-card-content .collection-article.sequence-member{height:44px;min-height:44px;margin-top:0;margin-bottom:0;padding-top:9px;padding-bottom:9px}
.assistant-shell{max-width:1000px}.assistant-input,.assistant-result{border:1px solid var(--line-soft);background:rgba(12,25,42,.76);border-radius:.25rem;padding:18px}.assistant-input>div{display:flex;gap:8px;margin-top:10px}.assistant-result{margin-top:16px;min-height:240px;line-height:1.7}.ai-actions{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}.ai-actions button{border:1px solid var(--line-soft);background:rgba(56,213,255,.05);color:var(--text);padding:12px;border-radius:.25rem}.ai-result{margin-top:16px;border-top:1px solid var(--line-soft);padding-top:16px;line-height:1.7}
.settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.admin-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.settings-grid .span-2{grid-column:span 2}.settings-form{display:grid;gap:12px}.settings-form label{display:grid;gap:6px;color:#bfd2df;font-size:13px}.switch-line{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center;gap:8px!important}.switch-line input{width:auto!important}.admin-list{display:grid;gap:6px}.admin-row{display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:1px solid var(--line-soft);padding:9px 0}.admin-row strong,.admin-row small{display:block}.admin-row small{color:var(--muted);margin-top:3px}.link-button{display:inline-block;text-decoration:none}.tag-manager{display:flex;flex-wrap:wrap;gap:8px}.tag.managed{display:inline-flex;align-items:center;gap:5px}.tag.managed button{border:0;background:transparent;color:var(--danger);padding:0 2px}
.notice.danger{border-color:rgba(255,123,134,.35);background:rgba(255,123,134,.06);color:#ffc1c6}.notice.warning{border-color:rgba(242,184,75,.35)}

/* Light mode stays technically styled but improves long-form reading. */
html.light { --text:#172b3a;--muted:#5f7280;--panel:#f8fbfd;--panel-2:#edf5f8;--panel-3:#dcecf2;--line-soft:rgba(15,105,135,.18);--cyan:#007fa3;--cyan-soft:#006e8e;--gold:#a96e00;--danger:#b83343;--success:#16734a;--brand-logo-url:url('../images/logo.png'); }
html.light body{background:#eef4f7;color:var(--text)}html.light .sidebar{background:linear-gradient(180deg,#e8f1f5,#dde9ee)}html.light .topbar{background:rgba(241,247,249,.92)}html.light .search-wrap input,html.light .article-form input,html.light .article-form select,html.light .article-form textarea,html.light .filter-bar input,html.light .filter-bar select,html.light .settings-form input,html.light .settings-form select,html.light .settings-form textarea,html.light .assistant-input textarea,html.light .quiz-answers textarea,html.light .modal-body input,html.light .modal-body select,html.light .modal-body textarea{background:#fff;color:#173040}html.light .stat-card,html.light .panel,html.light .article-card{background:#f9fcfd}html.light .modal-card,html.light .dropdown-menu,html.light .search-results{background:#f7fbfd;color:#173040}html.light .article-body{color:#263c49}html.light .code-block{border: 1px solid var(--line-soft);background:#eaf2f5!important;color:#173040}
html.light .sidebar .nav-item,html.light .sidebar .category-button{color:var(--text)}
html.light .sidebar .category-toggle{color:#41677a}
html.light .article-category-picker{border-color:rgba(23,48,64,.2);background:transparent}
html.light .article-category-choice{color:#173040!important}
html.light .article-category-field{background:transparent}
html.light .article-category-choice:hover{background:rgba(23,48,64,.055)}
html.light .sidebar .nav-group-label{color:var(--muted)}

@media (max-width:1300px){.stat-grid.six{grid-template-columns:repeat(3,1fr)}.filter-bar{grid-template-columns:repeat(3,1fr)}.article-layout{grid-template-columns:minmax(0,1fr) 260px}.dashboard-actions{grid-template-columns:repeat(2,1fr)}}
@media (max-width:900px){.article-layout{display:block}.article-side-sections{position:static;grid-template-columns:repeat(2,1fr);margin-top:24px}.related-panel{margin-top:20px}.compact-grid{grid-template-columns:repeat(2,1fr)}.filter-bar{grid-template-columns:repeat(2,1fr)}.settings-grid,.admin-grid,.collection-grid{grid-template-columns:1fr}.collection-grid-overview{grid-auto-rows:auto}.collection-card-preview{min-height:0}.settings-grid .span-2{grid-column:auto}.fact-grid{grid-template-columns:repeat(2,1fr)}}
@media (max-width:760px){.mobile-only{display:grid}.app-shell{display:block}.sidebar{position:fixed;z-index:60;left:-310px;top:0;width:290px;height:100vh;transition:left .2s}.nav-open .sidebar{left:0}.sidebar-section,.sidebar-footer{display:block}.main-nav{display:grid;grid-template-columns:1fr;max-height:46vh}.nav-item{justify-content:flex-start;padding:10px 12px;font-size:14px}.nav-item span{font-size:14px}.nav-item.active::after{display:block}.topbar{gap:8px}.topbar #header-import-article,.topbar #quick-capture{display:none}.topbar #new-article{font-size:0;padding:10px 12px}.topbar #new-article::after{content:'+';font-size:18px}.page-header{align-items:flex-start;flex-direction:column}.stat-grid.six{grid-template-columns:repeat(2,1fr)}.dashboard-actions,.filter-bar,.article-side-sections,.review-buttons,.ai-actions{grid-template-columns:1fr}.article-grid,.compact-grid{grid-template-columns:1fr}.fact-grid{grid-template-columns:1fr}.form-grid.two{grid-template-columns:1fr}.span-2{grid-column:auto}.pdf-embed iframe{height:520px}}

@media print{body{background:white!important;color:#111!important}.sidebar,.topbar,.article-toolbar,.article-side-sections,.related-panel,.article-meta,.article-kicker{display:none!important}.app-shell,.article-layout{display:block}.content{max-width:none;padding:0}.article-view{max-width:none}.article-body{color:#111!important;font-size:11pt}.article-view h1{color:#111!important;font-size:24pt}.article-summary{color:#444!important}.callout{break-inside:avoid;border-color:#777!important;background:#f7f7f7!important}.code-block{background:#f3f3f3!important;color:#111!important;border-color:#aaa!important}.tok-key,.tok-str{color:#111!important}}
.progress-stack{height:14px;display:flex;overflow:hidden;border-radius:.25rem;background:rgba(56,213,255,.05);border:1px solid var(--line-soft)}.progress-stack>div{min-width:0}.progress-neu{background:#536878}.progress-lernen{background:#2e9fbd}.progress-wiederholen{background:#d09035}.progress-gelesen{background:#6b92a5}.progress-sicher{background:#3aae78}.progress-legend{display:flex;flex-wrap:wrap;gap:12px;margin-top:10px;color:var(--muted);font-size:11px}.progress-legend span{display:flex;align-items:center;gap:5px}.progress-legend i{width:8px;height:8px;border-radius:.25rem}.learning-progress{margin-bottom:22px}
.image-gallery{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:20px 0}.image-gallery a{display:block;border:1px solid var(--line-soft);border-radius:.25rem;overflow:hidden;text-decoration:none;background:rgba(56,213,255,.025)}.image-gallery img{display:block;width:100%;height:160px;object-fit:cover}.image-gallery span{display:block;padding:7px 9px;color:var(--muted);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.glossary-link{border:0;border-bottom:1px dotted var(--cyan);background:transparent;color:var(--cyan-soft);padding:0;display:inline;font:inherit;cursor:pointer}.matching-row{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:center;border:1px solid var(--line-soft);border-radius:.25rem;padding:10px}.matching-row select{background:#07111f;border:1px solid rgba(56,213,255,.18);color:var(--text);border-radius:.25rem;padding:8px}.auth-form label small{color:var(--muted);font-weight:400}
@media(max-width:760px){.image-gallery{grid-template-columns:1fr 1fr}.matching-row{grid-template-columns:1fr}}

/* V2 finishing details --------------------------------------------------- */
.drop-zone{position:relative;min-height:150px;border:1px dashed rgba(56,213,255,.38);border-radius:.25rem;background:rgba(56,213,255,.035);display:grid;place-items:center;text-align:center;padding:26px;cursor:pointer;transition:.18s ease}.drop-zone strong,.drop-zone span{display:block}.drop-zone strong{font-size:16px;color:var(--cyan-soft);margin-bottom:6px}.drop-zone span{color:var(--muted);font-size:12px}.drop-zone input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}.drop-zone.drag{border-color:var(--gold);background:rgba(242,184,75,.07);box-shadow:inset 0 0 0 2px rgba(242,184,75,.08)}
.version-tabs{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px}.version-preview{border:1px solid var(--line-soft);border-radius:.25rem;padding:16px;max-height:58vh;overflow:auto}.diff-view{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:1.55;border:1px solid var(--line-soft);border-radius:.25rem;overflow:auto;max-height:58vh;background:rgba(4,12,21,.55)}.diff-view>div{white-space:pre-wrap;word-break:break-word;padding:2px 10px;border-left:3px solid transparent}.diff-same{color:var(--muted)}.diff-old{color:#ffc1c6;background:rgba(255,91,91,.075);border-left-color:var(--danger)!important}.diff-new{color:#bcf4d4;background:rgba(99,223,160,.07);border-left-color:var(--success)!important}
.ai-sources{margin-top:20px;padding-top:14px;border-top:1px solid var(--line-soft)}.ai-sources strong{display:block;color:var(--gold);margin-bottom:8px}.ai-sources-list{display:flex;flex-wrap:wrap;gap:7px}.ai-source{border:1px solid var(--line-soft);background:rgba(56,213,255,.04);color:var(--cyan-soft);border-radius:.25rem;padding:6px 9px;font-size:11px;cursor:pointer}.ai-source:hover{border-color:var(--cyan)}
html.light .diff-view{background:#f5f9fb}.light .diff-old{color:#8e2030}.light .diff-new{color:#12623f}

/* V2.1 UX refinement ---------------------------------------------------- */
:root{
    --sidebar-width:276px;
    --sidebar-collapsed:82px;
    --topbar-height:73px;
    --focus-ring:0 0 0 3px rgba(56,213,255,.16);
}
html{scroll-behavior:smooth}
body{overflow-x:hidden}
::selection{background:rgba(56,213,255,.28);color:var(--text)}
*{scrollbar-width:thin;scrollbar-color:rgba(56,213,255,.26) transparent}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:none;box-shadow:var(--focus-ring);border-color:rgba(56,213,255,.55)!important}
.skip-link{position:fixed;left:18px;top:-60px;z-index:999;background:var(--gold);color:#111;padding:10px 14px;border-radius:.25rem;font-weight:800;text-decoration:none;transition:top .15s}.skip-link:focus{top:0}
.app-shell{grid-template-columns:var(--sidebar-width) minmax(0,1fr);transition:grid-template-columns .2s ease}
.sidebar{width:var(--sidebar-width);padding:20px 14px 16px;transition:width .2s ease,padding .2s ease}
.brand{margin-bottom:18px;padding:0 4px}.brand-copy{min-width:0;flex:1}.brand-copy strong,.brand-copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sidebar-collapse{margin-left:auto;flex:0 0 auto}
.main-nav{gap:3px;min-height:0;overflow-y:auto;padding-right:3px}
.nav-group-label{margin:15px 9px 5px;color:#68859a;font-size:9px;font-weight:800;letter-spacing:.15em;text-transform:uppercase}.nav-group-label:first-child{margin-top:2px}
.nav-item{min-height:40px;padding:8px 10px;gap:9px;font-size:13px}.nav-item b{font-weight:600;white-space:nowrap}.nav-item span{flex:0 0 24px}.nav-item.active{box-shadow:inset 0 0 20px rgba(56,213,255,.025)}
.sidebar-section{margin-top:18px}.section-heading{margin-bottom:8px}.category-button{padding:7px 9px;font-size:13px}
.sidebar-footer{padding-top:11px;margin-top:10px}
body.sidebar-collapsed .app-shell{grid-template-columns:var(--sidebar-collapsed) minmax(0,1fr)}
body.sidebar-collapsed .sidebar{width:var(--sidebar-collapsed);padding-left:12px;padding-right:12px}
body.sidebar-collapsed .brand-copy,body.sidebar-collapsed .nav-item b,body.sidebar-collapsed .nav-group-label,body.sidebar-collapsed .sidebar-section,body.sidebar-collapsed .sidebar-footer{display:none}
body.sidebar-collapsed .brand{justify-content:center;gap:0;position:relative}body.sidebar-collapsed .brand-mark,body.sidebar-collapsed .brand-logo{width:42px;height:42px}body.sidebar-collapsed .sidebar-collapse{position:absolute;right:-2px;bottom:-14px;width:24px;height:24px;font-size:12px}
body.sidebar-collapsed .main-nav{overflow:visible}body.sidebar-collapsed .nav-item{justify-content:center;padding:8px}body.sidebar-collapsed .nav-item span{font-size:15px}body.sidebar-collapsed .nav-item.active::after{position:absolute;right:4px}body.sidebar-collapsed .nav-item{position:relative}
.account-avatar{flex:0 0 auto}
.topbar{min-height:var(--topbar-height);padding:14px 24px;gap:10px}.search-wrap{max-width:760px}.search-wrap input{padding-right:43px}.search-shortcut{position:absolute;right:12px;top:50%;transform:translateY(-50%);min-width:24px;text-align:center;border:1px solid rgba(56,213,255,.18);border-bottom-color:rgba(56,213,255,.3);background:rgba(2,9,16,.3);border-radius:.25rem;padding:2px 6px;color:var(--muted);font-size:11px;font-family:inherit}.shortcut-button{min-width:39px;padding-left:0;padding-right:0}
.search-results{max-height:min(520px,70vh);overflow:auto}.search-result{width:100%;background:transparent;color:var(--text);border:0;border-bottom:1px solid var(--line-soft);text-align:left;display:block}.search-result small{display:block;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.search-result.keyboard-active{background:rgba(56,213,255,.1);box-shadow:inset 3px 0 var(--gold)}
.content{padding:34px clamp(22px,3vw,44px) 80px;max-width:1480px}.page-header{margin-bottom:26px}.page-header h1{max-width:920px}.page-header p{font-size:15px}.header-actions{display:flex;gap:8px;flex-wrap:wrap}
.panel{margin-bottom:20px}.stat-card,.panel,.article-card{border-color:rgba(56,213,255,.14)}.stat-card{padding:18px}.stat-value{font-size:31px}.stat-sub{color:var(--muted);font-size:11px;margin-top:4px}
.article-grid{gap:16px}.article-card{min-height:190px;padding:17px;display:flex;flex-direction:column}.article-card p{flex:1;min-height:auto}.article-card .article-meta{margin-top:auto;padding-top:14px}.article-card:hover{transform:translateY(-2px);box-shadow:0 7px 18px rgba(0,0,0,.14),inset 0 1px rgba(255,255,255,.015)}
.article-card:active{transform:translateY(-1px)}
.article-grid.list-view{grid-template-columns:1fr;gap:8px}.article-grid.list-view .article-card{min-height:0;display:grid;grid-template-columns:150px minmax(180px,1.1fr) minmax(220px,2fr) auto;align-items:center;column-gap:16px;padding:12px 15px}.article-grid.list-view .article-card .card-top{grid-column:1}.article-grid.list-view .article-card>.eyebrow{grid-column:1;grid-row:2;margin:4px 0 0}.article-grid.list-view .article-card h3{grid-column:2;grid-row:1/3;margin:0}.article-grid.list-view .article-card p{grid-column:3;grid-row:1/3;margin:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.article-grid.list-view .article-card .tag-row{display:none}.article-grid.list-view .article-card .article-meta{grid-column:4;grid-row:1/3;padding:0;margin:0;justify-content:flex-end;max-width:250px}.article-grid.list-view .article-card .article-meta span:not(.pill):first-of-type{display:none}
.result-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:14px 0}.result-count{color:var(--muted);font-size:12px}.view-switch{display:flex;gap:4px;padding:3px;border:1px solid var(--line-soft);border-radius:.25rem;background:rgba(56,213,255,.025)}.view-switch button{border:0;background:transparent;color:var(--muted);border-radius:.25rem;padding:6px 9px}.view-switch button.active{background:rgba(56,213,255,.12);color:var(--cyan-soft)}.reset-filters{margin-left:auto}
.filter-bar{align-items:center}.filter-bar input,.filter-bar select{min-height:36px}
.empty-state{border:1px dashed rgba(56,213,255,.2);border-radius:.25rem;padding:32px;text-align:center;color:var(--muted);background:rgba(56,213,255,.02)}
.article-layout{gap:28px}.article-view{max-width:900px}.article-view>h1{line-height:1.08}.article-summary{font-size:17px;line-height:1.65;color:#b9cfdd;max-width:800px}.article-toolbar{position:sticky;top:calc(var(--topbar-height) + 10px);z-index:8;flex-wrap:wrap;padding:10px;border:1px solid rgba(56,213,255,.14);border-radius:.25rem;background:rgba(7,16,30,.84);backdrop-filter:blur(14px);box-shadow:0 4px 13px rgba(0,0,0,.12)}.article-toolbar .primary-button,.article-toolbar .secondary-button,.article-toolbar .danger-button{padding:8px 10px;font-size:12px}.article-body{font-size:16.5px;line-height:1.85}.article-body p{margin:0 0 16px}.article-body h2{scroll-margin-top:130px;border-top:1px solid rgba(56,213,255,.08);padding-top:26px}.article-body h3{scroll-margin-top:130px}.article-body blockquote{margin:20px 0;padding:10px 16px;border-left:3px solid var(--gold);background:rgba(242,184,75,.04);color:#bed0dc}
.reading-progress{position:fixed;left:var(--sidebar-width);right:0;top:calc(var(--topbar-height) - 2px);height:2px;z-index:30;pointer-events:none;background:transparent;transition:left .2s}.reading-progress span{display:block;width:0;height:100%;background:linear-gradient(90deg,var(--cyan),var(--gold));box-shadow:0 0 5px rgba(56,213,255,.28)}body.sidebar-collapsed .reading-progress{left:var(--sidebar-collapsed)}
.toc-panel .side-link{padding:6px 8px}.toc-panel .toc-group{display:grid;gap:6px}.toc-panel .toc-group+.toc-group{margin-top:6px}.toc-panel .toc-children{display:grid;gap:6px;margin:0 0 0 13px;padding-left:14px;border-left:1px solid rgba(139,231,255,.58)}.article-side-sections .toc-panel .toc-h3{position:relative;padding:6px 8px;font-size:11px}.toc-panel .toc-h3::before{content:"";position:absolute;left:-15px;top:50%;width:11px;border-top:1px solid rgba(139,231,255,.58)}html.light .toc-panel .toc-children{border-left-color:rgba(0,95,128,.52)}html.light .toc-panel .toc-h3::before{border-top-color:rgba(0,95,128,.52)}.toc-panel .toc-group-orphan .toc-children{margin-left:0}.toc-panel .toc-active{color:var(--gold);background:rgba(242,184,75,.06)}
.recent-panel{margin-top:20px}.recent-strip{display:flex;gap:9px;overflow:auto;padding:2px 1px 6px}.recent-chip{flex:0 0 auto;max-width:260px;border:1px solid var(--line-soft);background:rgba(56,213,255,.035);color:var(--text);border-radius:.25rem;padding:10px 12px;text-align:left}.recent-chip strong,.recent-chip small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.recent-chip small{color:var(--muted);margin-top:4px}
.editor-card{width:min(1180px,97vw)}.editor-save-state{font-size:11px;color:var(--muted);margin-top:5px}.editor-save-state.dirty{color:var(--gold)}.editor-save-state.saved{color:var(--success)}.editor-modebar{position:sticky;top:-1px;z-index:5;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:7px 0 10px;background:#0b1727;border-bottom:1px solid rgba(56,213,255,.08)}.editor-tabs{display:flex;gap:5px;padding:3px;border:1px solid var(--line-soft);border-radius:.25rem;background:rgba(56,213,255,.025)}.editor-tabs button{border:0;background:transparent;color:var(--muted);border-radius:.25rem;padding:7px 12px}.editor-tabs button.active{background:rgba(56,213,255,.12);color:var(--cyan-soft)}#editor-draft-status{color:var(--muted);font-size:11px}.editor-preview{min-height:460px;padding:24px;border:1px solid var(--line-soft);border-radius:.25rem;background:rgba(5,13,23,.5)}.editor-preview .article-body{max-width:820px;margin:auto}.editor-preview-empty{display:grid;place-items:center;min-height:360px;color:var(--muted)}.draft-recovery{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid rgba(242,184,75,.3);background:rgba(242,184,75,.055);border-radius:.25rem;padding:11px 13px;color:#f6d99c;font-size:12px}.draft-recovery .spacer{flex:1}.draft-recovery button{padding:6px 9px}.content-editor{min-height:480px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:14px;tab-size:4}.editor-toolbar{position:sticky;top:48px;z-index:4;background:#0b1727;padding:9px 0;border-bottom:1px solid rgba(56,213,255,.08)}
.shortcut-grid{display:grid;gap:8px}.shortcut-row{display:grid;grid-template-columns:1fr auto;align-items:center;gap:15px;padding:8px 0;border-bottom:1px solid var(--line-soft)}.shortcut-row:last-child{border-bottom:0}.shortcut-row kbd{border:1px solid var(--line-soft);border-bottom-color:rgba(56,213,255,.4);background:rgba(56,213,255,.04);border-radius:.25rem;padding:4px 8px;color:var(--cyan-soft);font-family:inherit;font-size:11px}
.mobile-dock{display:none}.mobile-dock.no-create{grid-template-columns:repeat(4,1fr)!important}
.floating-top{position:fixed;right:24px;bottom:24px;z-index:25;width:42px;height:42px;border-radius:.25rem;border:1px solid var(--line-soft);background:rgba(10,24,40,.9);color:var(--cyan);box-shadow:var(--shadow);opacity:0;pointer-events:none;transform:translateY(10px);transition:.18s}.floating-top.visible{opacity:1;pointer-events:auto;transform:none}
html.light .article-toolbar{padding:.5rem;background:rgba(246,251,253,.9)}html.light .editor-modebar,html.light .editor-toolbar{background:#f7fbfd}html.light .editor-preview{background:#fff}html.light .search-shortcut{background:#eef5f8}

@media (max-width:1100px){.article-grid.list-view .article-card{grid-template-columns:120px 1fr 1.3fr}.article-grid.list-view .article-card .article-meta{grid-column:2/4;grid-row:3;justify-content:flex-start;margin-top:7px}.article-grid.list-view .article-card p{grid-column:3}.shortcut-button{display:none}}
@media (max-width:900px){.editor-details-layout{grid-template-columns:minmax(0,1fr)}.article-category-field{position:static;min-height:0;height:auto;overflow:visible}.article-category-picker{position:static;inset:auto;height:auto;max-height:220px}}
@media (max-width:760px){
    :root{--topbar-height:61px}
    body{padding-bottom:68px}.app-shell{display:block}.sidebar{width:290px}.topbar{min-height:var(--topbar-height);padding:10px 12px}.search-shortcut{display:none}.topbar #theme-toggle{display:none}.content{padding:22px 14px 84px}.page-header{margin-bottom:20px}.page-header h1{font-size:30px}.page-header p{font-size:14px}.stat-card{padding:15px}.stat-value{font-size:27px}.panel{padding:16px;border-radius:.25rem}.article-card{min-height:0}.article-grid.list-view .article-card{display:block;padding:15px}.article-grid.list-view .article-card h3{margin:8px 0}.article-grid.list-view .article-card p{display:block}.article-grid.list-view .article-card .article-meta{margin-top:12px}.result-toolbar{position:sticky;top:var(--topbar-height);z-index:7;padding:7px 0;background:linear-gradient(180deg,var(--bg) 70%,transparent)}.filter-bar{padding:12px}.article-toolbar{position:static;padding:8px}.article-toolbar .primary-button,.article-toolbar .secondary-button,.article-toolbar .danger-button{flex:1 1 auto}.reading-progress{left:0!important;top:calc(var(--topbar-height) - 2px)}.article-body{font-size:16px}.article-summary{font-size:15px}.editor-card{width:100%;height:100%;max-height:100vh;border-radius:.25rem}.modal-backdrop{padding:0}.modal-header{padding:16px}.article-form{padding:15px}.editor-modebar{top:-1px}.editor-toolbar{top:45px;overflow-x:auto;flex-wrap:nowrap;padding-bottom:8px}.editor-toolbar button{flex:0 0 auto}.content-editor{min-height:52vh}.editor-preview{min-height:62vh;padding:16px}.draft-recovery{align-items:flex-start}.mobile-dock{position:fixed;left:0;right:0;bottom:0;z-index:55;height:64px;display:grid;grid-template-columns:repeat(5,1fr);background:rgba(5,13,24,.96);backdrop-filter:blur(16px);border-top:1px solid rgba(56,213,255,.18);padding:5px max(5px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left));box-shadow:0 -12px 32px rgba(0,0,0,.24)}.mobile-dock button{border:0;background:transparent;color:var(--muted);display:grid;place-items:center;align-content:center;gap:1px;border-radius:.25rem}.mobile-dock button span{font-size:18px;color:var(--cyan)}.mobile-dock button small{font-size:9px}.mobile-dock button.active{background:rgba(56,213,255,.08);color:var(--text)}.mobile-dock .mobile-create{margin-top:-17px;width:52px;height:52px;justify-self:center;border:1px solid rgba(56,213,255,.55);border-radius:.25rem;background:linear-gradient(180deg,#1fbce2,#117f9f);box-shadow:0 8px 25px rgba(10,154,191,.35)}.mobile-dock .mobile-create span{color:#05111b;font-size:25px}.mobile-dock .mobile-create small{color:#06121c;font-weight:800}.floating-top{right:14px;bottom:78px}.auth-brand-panel{display:none}.auth-shell{display:block;min-height:100vh}.auth-form-panel{min-height:100vh;padding:20px}.auth-card{max-width:460px;margin:auto}.auth-card::before{content:'';display:block;width:64px;height:64px;margin:0 auto 24px;background:url('../images/logo.png') center/contain no-repeat;filter:drop-shadow(0 4px 9px rgba(0,0,0,.16))}.setup-form-panel{min-height:100vh}.setup-card{max-width:680px}}

/* Keep the article editor inside the mobile viewport. */
@media (max-width: 760px) {
    #editor-modal { padding: .5rem; }
    #editor-modal .editor-card {
        width: 100%;
        height: calc(100dvh - 1rem);
        max-height: calc(100dvh - 1rem);
    }
    #editor-modal .article-form,
    #editor-modal .editor-details-layout,
    #editor-modal .form-grid.two,
    #editor-modal .type-fields .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    #editor-modal .article-form > *,
    #editor-modal .article-form label,
    #editor-modal .type-fields { min-width: 0; }
    #editor-modal .article-form input,
    #editor-modal .article-form select,
    #editor-modal .article-form textarea {
        min-width: 0;
        max-width: 100%;
    }
}

/* Stronger separation and legibility in the light theme. */
html.light {
    color-scheme: light;
    --bg: #dfe9ee;
    --text: #142a38;
    --muted: #465f6e;
    --line-soft: rgba(36, 76, 97, .32);
    --shadow: 0 6px 18px rgba(19, 45, 61, .14);
}
html.light body { background: #dfe9ee; }
html.light .sidebar {
    background: linear-gradient(180deg, #dce8ee, #cbdce5);
    box-shadow: 5px 0 14px rgba(19, 45, 61, .11);
}
html.light .topbar { background: rgba(230, 239, 244, .96); box-shadow: 0 3px 10px rgba(19, 45, 61, .07); }
html.light .stat-card,
html.light .panel,
html.light .article-card,
html.light .action-tile,
html.light .side-panel,
html.light .collection-card,
html.light .assistant-input,
html.light .assistant-result,
html.light .review-card,
html.light .quiz-card,
html.light .filter-bar {
    background: #fff;
    border-color: #a6bbc6;
    box-shadow: var(--shadow);
}
html.light .article-card:hover,
html.light .action-tile:hover { border-color: #5187a1; box-shadow: 0 7px 18px rgba(19, 45, 61, .17); }
html.light .secondary-button,
html.light .icon-button,
html.light .review-buttons button,
html.light .ai-actions button,
html.light .editor-toolbar button,
html.light .recent-chip,
html.light .floating-top {
    background: #f5f9fb;
    border-color: #91adbb;
    color: var(--text);
    box-shadow: 0 2px 6px rgba(19, 45, 61, .09);
}
html.light .secondary-button:hover,
html.light .icon-button:hover { background: #e3eff4; }
html.light .primary-button { box-shadow: 0 3px 9px rgba(11, 105, 136, .19); }
html.light .article-toolbar { background: rgba(246, 250, 252, .96); border-color: #a6bbc6; box-shadow: var(--shadow); }
html.light .modal-card,
html.light .dropdown-menu,
html.light .search-results { background: #fff; border-color: #a6bbc6; box-shadow: var(--shadow); }
html.light select,
html.light select option,
html.light select optgroup {
    color-scheme: light;
    background-color: #fff;
    color: var(--text);
}
/* Login and installer use the same light surfaces as the application. */
html.light .auth-body {
    background: radial-gradient(circle at 18% 20%, rgba(0, 127, 163, .08), transparent 30%), #dfe9ee;
    color: var(--text);
}
html.light .auth-brand-panel {
    background: linear-gradient(145deg, #e8f1f5, #cbdce5);
    border-color: var(--line-soft);
    box-shadow: 5px 0 14px rgba(19, 45, 61, .2);
}
html.light .auth-brand strong,
html.light .auth-intro h1,
html.light .auth-card h2 { color: var(--text); }
html.light .auth-intro p,
html.light .auth-subtitle { color: var(--muted); }
html.light .auth-card {
    background: #fff;
    border-color: #a6bbc6;
    box-shadow: var(--shadow);
}
html.light .auth-form label { color: var(--text); }
html.light .auth-form input {
    background: #f8fbfd;
    border-color: #91adbb;
    color: var(--text);
}
html.light .auth-form input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 127, 163, .12);
}
html.light .auth-error {
    color: #9b2432;
    background: #fff0f1;
    border-color: #d997a0;
}
html.light .auth-notice {
    color: #75500b;
    background: #fff5df;
    border-color: #d7b875;
}
html.light .requirement.ok {
    color: #17633f;
    background: #e7f5ed;
    border-color: #9ac9ae;
}
html.light .requirement.fail {
    color: #9b2432;
    background: #fff0f1;
    border-color: #d997a0;
}
html.light .article-summary,
html.light .article-body blockquote,
html.light .settings-form label { color: var(--muted); }
html.light .article-body h2 { color: var(--text); }
html.light .tok-str { color: #875100; }
html.light .pill,
html.light .tag,
html.light .type-badge { color: var(--cyan-soft); background: #e8f3f7; border-color: #99bbc9; }
html.light .pill.gold,
html.light .exam-badge { color: #805200; background: #fff3d9; border-color: #d5ad60; }
html.light .danger-button,
html.light .notice.danger { color: var(--danger); }
html.light .editor-toolbar,
html.light .editor-modebar { background: #edf4f7; }

/* More compact typography in the main content area. */
.content { font-size:14px; }
.content .page-header h1 { font-size:clamp(24px, 2.6vw, 30px); }
.content .page-header p { font-size:13px; line-height: 1.55; }
.content .stat-value { font-size:27px; }
.content .panel h2 { font-size:17px; }
.content .panel-header h2 { font-size:16px; }
.content .article-card h3 { font-size:15px; }
.content .article-card p { font-size:13px; }
.content .article-view > h1 { font-size:clamp(26px, 3vw, 34px); }
.content .article-summary { font-size:15px; }
.content .article-body { font-size:15px; line-height: 1.7; }
.content .article-body h2 { font-size:21px; }
.content .article-body h3 { font-size:18px; }
.content .review-card h2 { font-size:clamp(22px, 3vw, 30px); }
.content .quiz-card h2 { font-size:clamp(20px, 3vw, 28px); }
.content .card-answer { font-size:15px; }

@media (max-width: 760px) {
    .content .page-header h1 { font-size:24px; }
    .content .article-view > h1 { font-size:26px; }
    .content .stat-value { font-size:24px; }
    .content .article-body { font-size:14px; }
}

/* Match the header typography to the smaller content text. */
.topbar { font-size:13px; }
.topbar .search-wrap input,
.topbar .primary-button,
.topbar .secondary-button,
.topbar .search-result { font-size:13px; }
.topbar .search-icon { font-size:16px; }

/* Tag management. */
.tag-management { max-width: 900px; }
.tag-create-form { display: grid; gap: 8px; margin-bottom: 24px; }
.tag-create-form label { font-weight: 650; }
.tag-create-form > div { display: flex; gap: 10px; }
.tag-create-form input { min-width: 0; flex: 1; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: .25rem; background: #07111f; color: var(--text); }
.tag-actions { display: flex; gap: 8px; flex-wrap: wrap; }
html.light .tag-create-form input { background: #fff; }
@media (max-width: 600px) { .tag-create-form > div { flex-direction: column; } }

/* Mockup-inspired application shell and dashboard. */
:root { --topbar-height: 64px; --sidebar-width: 300px; --sidebar-collapsed: 76px; }
.workspace { padding-top: var(--topbar-height); }
.topbar { position: fixed; inset: 0 0 auto; height: var(--topbar-height); min-height: 0; padding: 0 22px; gap: 18px; z-index: 80; }
.topbar .brand { flex: 0 0 calc(var(--sidebar-width) - 12px); margin: 0; padding: 0; gap: 10px; }
.topbar .brand-mark { width: 38px; height: 38px; color: var(--gold); border-color: var(--gold); font-size:25px; line-height: 1; }
.topbar .brand-logo { width:42px; height:42px; }
.topbar .brand-copy strong { font-size:14px; letter-spacing: .11em; white-space: nowrap; }
.topbar .brand-copy span { font-size:9px; letter-spacing: .14em; color: var(--muted); white-space: nowrap; }
.topbar .sidebar-collapse { width: 20px; height: 26px; margin-left: auto; font-size:14px; background: transparent; border: 0; }
.topbar .search-wrap { max-width: 600px; }
.topbar .search-wrap input { padding-block: 9px; }
.topbar-account { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; margin-left: auto; border: 0; background: transparent; color: var(--text); text-align: left; padding: 4px 0 4px 16px; border-left: 1px solid var(--line-soft); }
.topbar-account > span:last-child { display: grid; gap: 2px; }
.topbar-account strong { font-size:12px; font-weight: 650; }
.topbar-account small { font-size:10px; color: var(--muted); }
.topbar-account .account-avatar { width: 34px; height: 34px; font-size:12px; }
.sidebar { top: var(--topbar-height); margin-top: var(--topbar-height); height: calc(100vh - var(--topbar-height)); padding: 16px 12px; box-shadow: none; }
.sidebar::before { opacity: .1; }
.sidebar .main-nav { flex: 1; max-height: none; gap: 2px; }
.sidebar .nav-group-label { margin: 18px 9px 5px; font-size:10px; letter-spacing: .08em; }
.sidebar .nav-item { min-height: 34px; padding: 6px 10px; }
.sidebar .nav-item.active { border-color: rgba(242,184,75,.7); background: rgba(242,184,75,.1); color: #ffdb83; box-shadow: inset 0 0 16px rgba(242,184,75,.04); }
.sidebar .nav-item.active span { color: var(--gold); }
.sidebar .nav-item.active::after { width: 2px; height: 22px; }
.sidebar .sidebar-section { flex: 0 1 auto; max-height: 24vh; margin-top: 12px; }
body.sidebar-collapsed .topbar .brand { flex-basis: calc(var(--sidebar-collapsed) - 12px); }
body.sidebar-collapsed .topbar .sidebar-collapse { position: static; width: 20px; height: 26px; }
.content { max-width: 1500px; padding: 30px 26px 72px; }

.dashboard-layout { display: grid; grid-template-columns: minmax(0,1fr) 278px; align-items: start; gap: 16px; }
.dashboard-main, .dashboard-rail { min-width: 0; }
.dashboard-main { display: grid; gap: 16px; }
.dashboard-rail { display: grid; gap: 12px; }
.dashboard-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 76px; }
.dashboard-hero h1 { font-size:clamp(23px,2.2vw,29px); line-height: 1.2; letter-spacing: -.02em; }
.dashboard-hero h1 span { font-size:.75em; }
.dashboard-hero p { margin: 4px 0 0; color: var(--muted); font-size:14px; }
.dashboard-hero blockquote { flex: 0 1 280px; margin: 0; padding: 4px 0 4px 12px; border-left: 2px solid var(--gold); color: var(--text); font-size:12px; font-style: italic; line-height: 1.5; }
.dashboard-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.dashboard-stat { min-width: 0; min-height: 110px; display: flex; align-items: center; gap: 12px; padding: 16px 13px; text-align: left; border: 1px solid var(--stat-border); border-radius: .25rem; background: var(--stat-bg); color: var(--text); }
.dashboard-stat:hover { filter: brightness(1.13); transform: translateY(-2px); }
.dashboard-stat-icon { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border-radius: .25rem; background: var(--stat-icon-bg); color: var(--stat-accent); font-size:25px; }
.dashboard-stat-copy { display: grid; min-width: 0; }
.dashboard-stat-copy strong { font-size:25px; line-height: 1; }
.dashboard-stat-copy > span { margin-top: 5px; font-size:12px; color: #c6d7e3; }
.dashboard-stat-copy small { margin-top: 8px; font-size:10px; color: var(--stat-accent); }
.tone-blue { --stat-border: #237ca8; --stat-bg: linear-gradient(145deg,#0b2739,#0a1e2d); --stat-icon-bg: #103d5a; --stat-accent: #7cdbff; }
.tone-green { --stat-border: #23685f; --stat-bg: linear-gradient(145deg,#0c292c,#0c2024); --stat-icon-bg: #155146; --stat-accent: #7be3c6; }
.tone-gold { --stat-border: #84672a; --stat-bg: linear-gradient(145deg,#29291e,#1b2326); --stat-icon-bg: #554824; --stat-accent: #ffd06c; }
.tone-violet { --stat-border: #58468a; --stat-bg: linear-gradient(145deg,#1b213b,#131b31); --stat-icon-bg: #372963; --stat-accent: #c6a9ff; }
.dashboard-panels { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; }
.dashboard-panel { min-width: 0; padding: 15px; border: 1px solid #29475a; border-radius: .25rem; background: linear-gradient(150deg,#0c1e2b,#0a1a26); }
.dashboard-panel h2 { margin: 0; font-size:15px; }
.dashboard-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; margin-bottom: 8px; }
.dashboard-panel-heading > button { flex: 0 0 auto; padding: 0; border: 0; background: transparent; color: #7edbff; font-size:11px; }
.dashboard-panel-heading > span { color: #7edbff; font-size:11px; }
.dashboard-list { display: grid; }
.dashboard-list-row { display: flex; align-items: center; width: 100%; min-width: 0; min-height: 49px; gap: 9px; padding: 6px 0; border: 0; border-top: 1px solid #203b4b; background: transparent; color: var(--text); text-align: left; }
.dashboard-list-row:hover, .dashboard-collection-row:hover { background: rgba(100,203,255,.06); }
.dashboard-row-icon, .dashboard-collection-icon { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border: 1px solid #315166; border-radius: .25rem; background: #142c3c; color: #d7eaff; font-size:17px; }
.dashboard-row-main { display: grid; min-width: 0; flex: 1 1 auto; gap: 2px; }
.dashboard-row-main strong, .dashboard-row-main small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dashboard-row-main strong { font-size:12px; font-weight: 600; }
.dashboard-row-main small, .dashboard-row-date { color: #9cb6c6; font-size:10px; }
.dashboard-row-date { flex: 0 0 70px; text-align: right; }
.dashboard-status { flex: 0 0 auto; padding: 3px 7px; border: 1px solid #398bbd; border-radius: .25rem; background: rgba(41,145,205,.13); color: #a5e0ff; font-size:10px; }
.dashboard-status.status-sicher { border-color: #329779; color: #88e1bf; background: rgba(37,140,105,.12); }
.dashboard-status.status-wiederholen { border-color: #bd8b2f; color: #ffd17b; background: rgba(176,120,28,.12); }
html.light .dashboard-status { border-color: #76a8bb; background: #e2f1f6; color: #07516d; font-size:11px; font-weight: 750; }
html.light .dashboard-status.status-sicher,
html.light .dashboard-status.status-gelesen { border-color: #8bbda0; background: #e7f5ed; color: #17633f; }
html.light .dashboard-status.status-wiederholen { border-color: #d0ae66; background: #fff3d9; color: #805200; }
.dashboard-due { flex: 0 0 auto; color: #ff8f8f; font-size:10px; }
.dashboard-empty { color: var(--muted); font-size:12px; }
.dashboard-recommend-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.dashboard-recommend-card { display: grid; grid-template-rows: 72px minmax(0,1fr); min-width: 0; min-height: 216px; padding: 0; border: 1px solid #31566a; border-radius: .25rem; overflow: hidden; background: #102636; color: var(--text); text-align: left; }
.dashboard-recommend-card:hover { border-color: #77cbee; transform: translateY(-2px); }
.dashboard-recommend-art { display: grid; place-items: center; background: radial-gradient(circle at 70% 25%,rgba(103,199,255,.33),transparent 35%),linear-gradient(135deg,#183e5a,#0a1d2b); color: #a4ddff; font-size:39px; }
.recommendation-1 .dashboard-recommend-art { background: radial-gradient(circle at 70% 25%,rgba(70,216,172,.27),transparent 35%),linear-gradient(135deg,#1c4a43,#0a252a); color: #98e6c7; }
.recommendation-2 .dashboard-recommend-art { background: radial-gradient(circle at 70% 25%,rgba(174,150,255,.28),transparent 35%),linear-gradient(135deg,#323c64,#101d35); color: #c4b7ff; }
.recommendation-3 .dashboard-recommend-art { background: radial-gradient(circle at 70% 25%,rgba(255,202,111,.3),transparent 35%),linear-gradient(135deg,#5a432e,#211f24); color: #ffd38b; }
.dashboard-recommend-body { display: grid; align-content: start; gap: 5px; min-width: 0; padding: 10px; }
.dashboard-recommend-body small { width: fit-content; max-width: 100%; padding: 2px 6px; border-radius: .25rem; background: #144461; color: #b8e9ff; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size:9px; }
.dashboard-recommend-body strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size:12px; }
.dashboard-recommend-body > span { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: #a8bfcc; font-size:11px; line-height: 1.4; }
.dashboard-recommend-body em { align-self: end; color: #ffcf70; font-size:10px; font-style: normal; }
.dashboard-main .recent-panel { margin: 0; }
.dashboard-banner { display: flex; align-items: center; gap: 14px; min-height: 70px; padding: 12px 20px; border: 1px solid #385264; border-radius: .25rem; background: linear-gradient(110deg,#102536,#1b303e 65%,#0b1e2b); }
.dashboard-banner > span { color: var(--gold); font-size:37px; }
.dashboard-banner p { flex: 1; margin: 0; font-size:14px; font-style: italic; }
.dashboard-banner button { padding: 9px 18px; border: 1px solid var(--gold); border-radius: .25rem; background: rgba(242,184,75,.05); color: #ffdb83; font-size:12px; }
.dashboard-progress-top { display: flex; align-items: center; gap: 14px; margin: 17px 0; }
.dashboard-progress-ring { display: grid; place-items: center; flex: 0 0 92px; width: 92px; height: 92px; border-radius: 50%; background: conic-gradient(#71d1ff var(--progress),#1b3b51 0); }
.dashboard-progress-ring::before { content: ''; grid-area: 1/1; width: 68px; height: 68px; border-radius: 50%; background: #0d2030; }
.dashboard-progress-ring strong { z-index: 1; grid-area: 1/1; font-size:22px; }
.dashboard-progress-top > div:last-child { display: grid; gap: 6px; }
.dashboard-progress-top > div:last-child strong { color: var(--gold); font-size:12px; }
.dashboard-progress-top > div:last-child small { color: var(--muted); font-size:10px; line-height: 1.4; }
.dashboard-progress-legend { display: grid; gap: 7px; margin: 0 0 16px; }
.dashboard-progress-legend span { display: flex; justify-content: space-between; color: #bbcfda; font-size:11px; }
.dashboard-progress-legend b { color: var(--text); font-weight: 500; }
.dashboard-outline-button { width: 100%; padding: 7px 10px; border: 1px solid #2c9bc8; border-radius: .25rem; background: rgba(47,156,203,.06); color: #b1eaff; font-size:11px; }
.dashboard-quick { display: grid; gap: 7px; }
.dashboard-quick h2 { margin-bottom: 2px; }
.dashboard-quick > button { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 7px 10px; border: 1px solid #27729a; border-radius: .25rem; background: transparent; color: #d8e8f2; text-align: left; font-size:11px; }
.dashboard-quick > button:hover, .dashboard-outline-button:hover { background: rgba(47,156,203,.14); }
.dashboard-quick kbd { padding: 2px 5px; border: 1px solid #3a5a70; border-radius: .25rem; font-size:9px; }
.dashboard-shortcut { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding: 9px; border-radius: .25rem; background: #152c3c; color: #b8d6e5; font-size:17px; }
.dashboard-shortcut span { display: grid; gap: 2px; }
.dashboard-shortcut strong { font-size:10px; }
.dashboard-shortcut small { color: var(--muted); font-size:9px; }
.dashboard-collection-row { display: flex; align-items: center; width: 100%; gap: 9px; min-height: 39px; padding: 5px 0; border: 0; border-top: 1px solid #203b4b; background: transparent; color: var(--text); text-align: left; }
.dashboard-collection-row strong { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size:11px; font-weight: 500; }
.dashboard-collection-row small { color: var(--muted); font-size:10px; }
.dashboard-collection-icon { flex-basis: 26px; width: 26px; height: 26px; color: var(--gold); font-size:17px; }

html:not(.light) body { background: #071722; }
html:not(.light) .topbar { background: #0b1e2d; border-bottom-color: #24475b; }
html:not(.light) .sidebar { background: #0a1c2a; border-right-color: #24475b; }
html:not(.light) .sidebar .nav-group-label { color: #75d2f2; }
html:not(.light) .search-wrap input { background: #0d2232; border-color: #3b5b6d; }
html.light .dashboard-panel, html.light .dashboard-recommend-card, html.light .dashboard-banner { background: #fff; border-color: #a6bbc6; color: var(--text); box-shadow: var(--shadow); }
html.light .dashboard-hero blockquote, html.light .dashboard-recommend-body > span, html.light .dashboard-row-main small, html.light .dashboard-row-date, html.light .dashboard-progress-legend span { color: var(--muted); }
html.light .dashboard-stat { background: #fff; box-shadow: var(--shadow); }
html.light .dashboard-stat-copy > span, html.light .dashboard-row-main strong, html.light .dashboard-list-row, html.light .dashboard-collection-row { color: var(--text); }
html.light .dashboard-list-row, html.light .dashboard-collection-row { border-color: var(--line-soft); }
html.light .dashboard-row-icon, html.light .dashboard-collection-icon, html.light .dashboard-shortcut { background: #e8f1f5; color: var(--cyan); }
html.light .dashboard-recommend-body small { color: #005f7e; background: #dceff5; }
html.light .dashboard-progress-ring::before { background: #fff; }
html.light .dashboard-quick > button { color: var(--text); }

@media (max-width: 1300px) {
  .topbar-create { display: none; }
  .dashboard-layout { grid-template-columns: minmax(0,1fr) 240px; }
  .dashboard-panels { grid-template-columns: 1fr; }
}
@media (max-width: 1050px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-rail { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-collections { grid-column: 1/-1; }
}
@media (max-width: 760px) {
  :root { --topbar-height: 61px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .brand { flex: 0 0 auto; }
  .topbar .brand-mark, .topbar .brand-logo { width: 34px; height: 34px; }
  .topbar .brand-copy, .topbar .sidebar-collapse, .topbar-account, .topbar .shortcut-button { display: none; }
  .topbar .search-wrap { max-width: none; }
  .topbar .search-wrap input { padding-block: 8px; }
  .sidebar { margin-top: 0; top: var(--topbar-height); height: calc(100vh - var(--topbar-height)); }
  .nav-open .sidebar { left: 0; }
  .content { padding: 18px 14px 84px; }
  .dashboard-hero blockquote { display: none; }
  .dashboard-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-stat { min-height: 92px; padding: 10px; }
  .dashboard-stat-icon { flex-basis: 36px; width: 36px; height: 36px; font-size:21px; }
  .dashboard-stat-copy strong { font-size:21px; }
  .dashboard-recommend-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-rail { grid-template-columns: 1fr; }
  .dashboard-collections { grid-column: auto; }
  .dashboard-banner { flex-wrap: wrap; }
}
@media (max-width: 440px) {
  .dashboard-row-date, .dashboard-status { display: none; }
  .dashboard-recommend-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-recommend-card { min-height: 205px; }
}

/* Keep the shared layout readable in light mode. */
html.light .sidebar .nav-item.active { background: #d5eaf2; border-color: #4d8ba6; color: #143747; }
html.light .sidebar .nav-item.active span { color: #006e8e; }
html.light .dashboard-panel-heading > button, html.light .dashboard-panel-heading > span { color: #006c91; }
html.light .dashboard-due { color: #a9353c; }
html.light .dashboard-outline-button { color: #005f80; }
html.light .dashboard-banner button, html.light .dashboard-recommend-body em { color: #815300; }
html.light .tone-blue { --stat-accent: #006d92; --stat-icon-bg: #d9edf5; }
html.light .tone-green { --stat-accent: #176e5e; --stat-icon-bg: #def3ea; }
html.light .tone-gold { --stat-accent: #8a5b00; --stat-icon-bg: #fbefd4; }
html.light .tone-violet { --stat-accent: #5d4890; --stat-icon-bg: #ece6fa; }

html:not(.light) .panel,
html:not(.light) .stat-card,
html:not(.light) .article-card,
html:not(.light) .side-panel,
html:not(.light) .collection-card,
html:not(.light) .assistant-input,
html:not(.light) .assistant-result,
html:not(.light) .filter-bar {
  background: #0d2130;
  border-color: #2b4a5c;
  box-shadow: 0 5px 15px rgba(0,0,0,.13);
}
html:not(.light) .secondary-button { border-color: #33617a; }
html:not(.light) .secondary-button:hover { background: #123449; }

/* Unterricht */
.editor-teaching-field { margin-top:18px;padding:0;border:0;border-radius:0;background:transparent; }
.editor-section-heading { display:flex;justify-content:space-between;align-items:center;margin-bottom:13px; }
.editor-section-heading strong,.editor-section-heading small { display:block; }
.editor-section-heading small { margin-top:3px;color:var(--muted);font-size:11px; }
.editor-teaching-controls { display:grid;grid-template-columns:minmax(180px,1fr) minmax(220px,1.2fr) auto;gap:10px;align-items:end; }
.editor-teaching-controls label { display:grid;gap:6px;color:var(--muted);font-size:12px; }
.editor-teaching-controls select { width:100%;min-height:36px;background:rgba(0,0,0,.12);border:1px solid rgba(255,255,255,.16);color:var(--text);border-radius:var(--radius);padding:8px 10px; }
.editor-teaching-controls button { min-height:36px; }
.editor-teaching-assignments { display:flex;flex-wrap:wrap;gap:8px;margin-top:12px; }
.editor-teaching-chip { display:flex;align-items:center;gap:9px;padding:7px 8px 7px 11px;border:1px solid rgba(56,213,255,.25);border-radius:var(--radius);background:rgba(56,213,255,.08);font-size:12px; }
.editor-teaching-chip small { display:block;color:var(--cyan-soft);font-size:9px;text-transform:uppercase;letter-spacing:.08em; }
.editor-teaching-chip button { width:24px;height:24px;padding:0;border:0;border-radius:var(--radius);background:rgba(255,123,134,.1);color:var(--danger); }
.editor-checklist-field { margin-top:18px;padding:0;border:0;border-radius:0;background:transparent; }
.editor-checklist-field .editor-section-heading { margin-bottom:10px; }
.editor-checklist-items { display:grid;gap:7px; }
.editor-checklist-row { display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;align-items:center; }
.editor-checklist-row > input { min-width:0;font-size:13px; }
.editor-checklist-actions { display:flex;gap:4px; }
.editor-checklist-actions button { width:32px;height:32px;padding:0;border:1px solid var(--line-soft);border-radius:var(--radius);background:rgba(6,18,30,.7);color:var(--muted); }
.editor-checklist-actions button:hover:not(:disabled) { border-color:var(--cyan);color:var(--cyan-soft); }
.editor-checklist-actions button:last-child { color:var(--danger); }
.editor-checklist-actions button:disabled { opacity:.35;cursor:default; }

.teaching-module-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px; }
.teaching-module-card { --teaching-accent:var(--cyan);position:relative;min-height:245px;padding:22px;border:1px solid color-mix(in srgb,var(--teaching-accent) 33%,transparent);border-top:3px solid var(--teaching-accent);border-radius:var(--radius);background:linear-gradient(160deg,color-mix(in srgb,var(--teaching-accent) 9%,#0d2130),#0c1b29 65%);box-shadow:var(--shadow);cursor:pointer;transition:transform .18s,border-color .18s; }
.teaching-module-card:hover { transform:translateY(-2px);border-color:color-mix(in srgb,var(--teaching-accent) 65%,transparent); }
.teaching-module-card.tone-gold,.teaching-module-header.tone-gold { --teaching-accent:#f2b84b; }.teaching-module-card.tone-green,.teaching-module-header.tone-green { --teaching-accent:#63dfa0; }.teaching-module-card.tone-rose,.teaching-module-header.tone-rose { --teaching-accent:#ff7b86; }.teaching-module-card.tone-slate,.teaching-module-header.tone-slate { --teaching-accent:#91a9bc; }.teaching-module-card.tone-violet,.teaching-module-header.tone-violet { --teaching-accent:#ad94ff; }.teaching-module-card.tone-cyan,.teaching-module-header.tone-cyan { --teaching-accent:var(--cyan); }
.teaching-module-copy { display:flex;flex-direction:column;min-width:0;min-height:198px; }
.teaching-module-copy .eyebrow { color:var(--teaching-accent); }.teaching-module-copy h2 { margin:0 42px 8px 0;font-size:22px; }.teaching-module-copy p { flex:1;margin:0 0 18px;color:var(--muted);line-height:1.55;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden; }.teaching-module-copy>small { margin-top:12px;color:var(--muted); }
.teaching-module-stats,.teaching-summary { display:flex;flex-wrap:wrap;gap:8px 20px;color:var(--muted);font-size:12px; }.teaching-module-stats strong { color:var(--text);font-size:18px;margin-right:4px; }
.teaching-card-actions { position:absolute;top:12px;right:12px;display:flex;gap:4px; }.teaching-card-actions button,.teaching-lesson-actions button,.teaching-article-actions button { width:28px;height:28px;padding:0;border:1px solid var(--line-soft);background:rgba(6,18,30,.7);color:var(--muted);border-radius:var(--radius); }.teaching-card-actions button:hover,.teaching-lesson-actions button:hover,.teaching-article-actions button:hover { color:var(--cyan);border-color:var(--cyan); }
.teaching-module-header { --teaching-accent:var(--cyan);padding-bottom:22px;border-bottom:1px solid color-mix(in srgb,var(--teaching-accent) 38%,transparent); }.teaching-module-header .eyebrow { margin-top:13px;color:var(--teaching-accent); }.teaching-module-header h1 { color:var(--text); }.teaching-summary { margin-top:14px;color:var(--teaching-accent); }
.text-button { padding:0;border:0;background:none;color:var(--muted); }.text-button:hover { color:var(--cyan); }
.article-context-back { position:absolute;z-index:17;left:10px;display:block;width:max-content;max-width:calc(100% - 52px);margin:-30px 0 0;padding:7px 2px;border:0;background:transparent;color:var(--cyan-soft);white-space:normal;text-align:left;font-weight:650;box-shadow:none; }
.article-context-back:hover,.article-context-back:focus-visible { color:var(--cyan);text-decoration:underline;text-underline-offset:3px; }
.article-context-back:focus-visible { outline:2px solid var(--cyan);outline-offset:3px; }
html.light .article-context-back { color:#176783; }
html.light .article-context-back:hover,html.light .article-context-back:focus-visible { color:#005d7c; }
@media print { .article-context-back { display:none!important; } }
@media (max-width:760px) { .article-context-back { left:14px;max-width:calc(100% - 28px);margin-top:-10px; } }
.teaching-lesson-list { display:grid;gap:14px;max-width:1180px; }
.teaching-lesson { overflow:hidden;border:1px solid var(--line-soft);border-radius:var(--radius);background:#0d2130;box-shadow:0 4px 14px rgba(0,0,0,.1); }.teaching-lesson>header { display:flex;align-items:center;border-bottom:1px solid var(--line-soft); }.teaching-lesson-toggle { flex:1;display:grid;grid-template-columns:22px minmax(0,1fr) auto;gap:12px;align-items:center;padding:17px 19px;border:0;background:transparent;color:var(--text);text-align:left; }.teaching-lesson-toggle span:nth-child(2) { display:grid;gap:3px; }.teaching-lesson-toggle small { color:var(--cyan);font-size:10px;text-transform:uppercase;letter-spacing:.09em; }.teaching-lesson-toggle strong { font-size:16px; }.teaching-lesson-toggle em { color:var(--muted);font-size:11px;font-style:normal; }.teaching-chevron { color:var(--cyan);font-size:20px;transition:transform .18s; }
.teaching-lesson-actions { display:flex;gap:4px;padding-right:13px; }.teaching-lesson-content { padding:17px 19px 20px; }.teaching-lesson.is-collapsed .teaching-lesson-content { display:none; }.teaching-lesson.is-collapsed>header { border-bottom:0; }.teaching-lesson.is-collapsed .teaching-chevron { transform:rotate(-90deg); }.teaching-lesson-description { margin:0 0 15px;color:var(--muted);line-height:1.6; }
.teaching-article-list { display:grid;gap:8px; }.teaching-article-row { display:flex;align-items:stretch;border:1px solid rgba(56,213,255,.13);border-radius:var(--radius);background:rgba(4,14,25,.32); }.teaching-article-main { flex:1;display:grid;grid-template-columns:34px minmax(0,1fr);gap:12px;padding:13px;border:0;background:transparent;color:var(--text);text-align:left; }.teaching-article-main strong { font-size:14px; }.teaching-article-main p { margin:5px 0;color:var(--muted);line-height:1.45; }.teaching-article-main small { color:var(--cyan-soft); }.teaching-article-main .tag-row { margin-top:7px; }.teaching-article-index { display:grid;place-items:center;width:29px;height:29px;border:1px solid var(--line-soft);color:var(--cyan);font-size:11px; }.teaching-article-actions { display:flex;align-items:center;gap:4px;padding:10px; }.teaching-article-actions button:last-child { color:var(--danger); }.teaching-lesson-empty { padding:22px;text-align:center;color:var(--muted);border:1px dashed var(--line-soft); }.teaching-lesson-buttons { display:flex;justify-content:flex-end;gap:8px;margin-top:13px; }
.teaching-picker-filters { display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:9px;margin-bottom:13px; }.teaching-picker-results { display:grid;gap:7px;max-height:min(55vh,520px);overflow:auto; }.teaching-picker-row { display:flex;align-items:center;gap:10px;padding:9px;border:1px solid var(--line-soft);border-radius:var(--radius); }.teaching-picker-row>button:first-child { flex:1;display:grid;gap:4px;padding:3px;border:0;background:transparent;color:var(--text);text-align:left; }.teaching-picker-row small { color:var(--muted); }
html.light .editor-teaching-field,html.light .editor-checklist-field { background:transparent; }html.light .teaching-lesson { background:#f7fbfd; }.light .editor-teaching-controls select { background:#fff;color:#173040; }.light .teaching-module-card { background:linear-gradient(160deg,color-mix(in srgb,var(--teaching-accent) 8%,#fff),#f5fafc 65%); }.light .teaching-article-row { background:#fff; }
html.light .editor-checklist-actions button { background:#edf4f7;border-color:#a9c3cf;color:#31576a; }
html.light .editor-checklist-actions button:last-child { color:#a52e39; }
html.light .teaching-card-actions button,html.light .teaching-lesson-actions button,html.light .teaching-article-actions button { background:#edf4f7;border-color:#a9c3cf;color:#31576a;box-shadow:0 1px 2px rgba(24,63,82,.08); }
html.light .teaching-card-actions button:hover,html.light .teaching-lesson-actions button:hover,html.light .teaching-article-actions button:hover { background:#dceef4;border-color:#37819e;color:#006b8d; }
html.light .teaching-card-actions button:focus-visible,html.light .teaching-lesson-actions button:focus-visible,html.light .teaching-article-actions button:focus-visible { outline:2px solid #37819e;outline-offset:2px; }
html.light .teaching-article-actions button:last-child { background:#fff0f1;border-color:#d9a4a9;color:#a52e39; }
html.light .teaching-article-actions button:last-child:hover { background:#fbdde0;border-color:#bd5963;color:#82212b; }
@media (max-width:1100px){.teaching-module-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.editor-teaching-controls{grid-template-columns:1fr 1fr}.editor-teaching-controls button{grid-column:1/-1}.filter-bar{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}.filter-bar>input:first-child{grid-column:span 2}}
@media (max-width:700px){.teaching-module-grid{grid-template-columns:1fr}.teaching-module-card{min-height:0}.editor-teaching-controls,.teaching-picker-filters{grid-template-columns:1fr}.editor-teaching-controls button{grid-column:auto}.teaching-lesson-toggle{padding:14px 10px;grid-template-columns:18px minmax(0,1fr)}.teaching-lesson-toggle em{display:none}.teaching-lesson-actions{padding-right:7px}.teaching-lesson-actions button:nth-child(-n+2),.teaching-article-actions button:nth-child(-n+2){display:none}.teaching-lesson-content{padding:13px 10px}.teaching-article-row{display:block}.teaching-article-actions{justify-content:flex-end;padding-top:0}.teaching-lesson-buttons{align-items:stretch;flex-direction:column}.teaching-picker-row{align-items:stretch;flex-direction:column}.filter-bar>input:first-child{grid-column:auto}}

/* All Markdown callouts share one shape; their palette identifies the kind. */
.article-body .callout {
  --callout-accent: #5fcbe9;
  --callout-border: #2a7691;
  --callout-bg: #102b3b;
  --callout-text: #dceef5;
  --callout-title: #9fe7fa;
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid var(--callout-border);
  border-left: 4px solid var(--callout-accent);
  border-radius: .25rem;
  background: var(--callout-bg);
  color: var(--callout-text);
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}
.article-body .callout > strong {
  display: block;
  margin-bottom: 7px;
  color: var(--callout-title);
  font-size:13px;
  line-height: 1.4;
}
.article-body .callout > div { line-height: 1.65; overflow-wrap: anywhere; }
.article-body .callout:is(.tip,.merksatz) {
  --callout-accent: #49d2ab; --callout-border: #2b9e8b;
  --callout-bg: #12372f; --callout-text: #d8f8ed; --callout-title: #78e7be;
}
.article-body .callout.warning {
  --callout-accent: #ff7b86; --callout-border: #a34b55;
  --callout-bg: #38242b; --callout-text: #fce7e9; --callout-title: #ffadb4;
}
.article-body .callout.exam {
  --callout-accent: #f2b84b; --callout-border: #9f7636;
  --callout-bg: #352d1f; --callout-text: #f8ecd5; --callout-title: #ffd888;
}
html.light .article-body .callout {
  --callout-accent: #0c779a; --callout-border: #91bdcc;
  --callout-bg: #e7f3f8; --callout-text: #214554; --callout-title: #075b77;
  box-shadow: 0 3px 10px rgba(25,55,70,.07);
}
html.light .article-body .callout:is(.tip,.merksatz) {
  --callout-accent: #258667; --callout-border: #69ae91;
  --callout-bg: #e1f3e9; --callout-text: #183e32; --callout-title: #126348;
}
html.light .article-body .callout.warning {
  --callout-accent: #b43f50; --callout-border: #d4a0a9;
  --callout-bg: #fbecef; --callout-text: #582630; --callout-title: #902c3a;
}
html.light .article-body .callout.exam {
  --callout-accent: #a96e00; --callout-border: #cfb373;
  --callout-bg: #fbf2dc; --callout-text: #5a431b; --callout-title: #805200;
}

/* Profile images in the shell and account settings. */
.account-avatar { position: relative; overflow: hidden; flex: 0 0 auto; }
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-row { display: flex; align-items: center; gap: 16px; margin: 16px 0 20px; }
.profile-avatar-row .profile-avatar { width: 76px; height: 76px; font-size:28px; }
.profile-avatar-row strong { display: block; }
.profile-avatar-row p { margin: 5px 0 0; font-size:12px; }
.profile-avatar-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.profile-avatar-actions button { flex: 0 0 auto; }

/* Questions associated with the current article. */
.article-question-item { display: grid; gap: 3px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.article-question-item span { font-size:12px; line-height: 1.35; }
.article-question-item small { color: var(--muted); font-size:10px; }
.article-question-panel .mini-action { margin-top: 10px; }
.article-question-panel .mini-action + .mini-action { margin-top: 6px; }
.article-flashcard-panel .mini-action { margin-top: 10px; }
.article-flashcard-panel .mini-action + .mini-action { margin-top: 6px; }
.article-flashcard-items { display:grid; gap:6px; }
.article-tag-link { font: inherit; font-size:11px; cursor: pointer; }
.article-tag-link:hover, .article-tag-link:focus-visible { border-color: var(--cyan); background: rgba(56,213,255,.14); color: var(--text); }
.article-flashcard-item { display: grid; width: 100%; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.article-flashcard-item:hover, .article-flashcard-item:focus-visible { color: var(--cyan-soft); background: rgba(56,213,255,.07); }
.article-flashcard-item span { overflow-wrap: anywhere; }
.flashcard-preview-question, .flashcard-preview-answer { padding: 14px; border: 1px solid var(--line-soft); border-radius: .25rem; background: var(--panel-2); }
.flashcard-preview-question small, .flashcard-preview-answer small { color: var(--cyan-soft); font-size:10px; font-weight: 800; letter-spacing: .1em; }
.flashcard-preview-question .article-body, .flashcard-preview-answer .article-body { margin-top: 8px; font-size:14px; line-height: 1.6; overflow-wrap: anywhere; }
.flashcard-preview-question .article-body p, .flashcard-preview-answer .article-body p { margin: 0 0 8px; }
#flashcard-reveal { margin: 14px 0; }
.flashcard-preview-answer { margin-top: 14px; }

/* Article details have their own scroll area beside the reading column. */
.article-layout > .related-panel { grid-column: 1 / -1; min-width: 0; }

/* Full-height article rail at the viewport edge, matching the main sidebar. */
.article-sidebar-heading,
.sidebar-heading {
  padding: 4px 8px 12px;
  color: var(--cyan-soft);
  font-size:11px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-soft);
}
.article-sidebar-heading { display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:37px; }
.article-sidebar-mode-toggle { display:grid;flex:0 0 auto;place-items:center;width:30px;height:26px;padding:0;border:1px solid var(--line-soft);border-radius:var(--radius);background:transparent;color:var(--cyan-soft);font-size:15px;line-height:1;cursor:pointer; }
.article-sidebar-mode-toggle:hover,.article-sidebar-mode-toggle:focus-visible,.article-sidebar-mode-toggle.active { border-color:var(--cyan);background:rgba(56,213,255,.1);color:var(--cyan);outline:none; }
.article-sidebar-checklist { flex:1 1 auto;min-height:0;overflow-y:auto;padding:2px 5px 12px;scrollbar-width:thin; }
.sidebar-checklist-progress { display:grid;gap:7px;margin:2px 0 15px;color:var(--muted);font-size:11px;letter-spacing:0;text-transform:none; }
.sidebar-checklist-progress strong { color:var(--text); }
.sidebar-checklist-progress > div { height:4px;overflow:hidden;background:rgba(145,169,188,.2); }
.sidebar-checklist-progress i { display:block;width:0;height:100%;background:var(--cyan);transition:width .2s ease; }
.sidebar-checklist-items { display:grid;gap:7px; }
.sidebar-checklist-item { display:grid;grid-template-columns:18px minmax(0,1fr);gap:9px;align-items:start;padding:8px;border:1px solid transparent;border-radius:var(--radius);background:transparent;color:var(--text);font-size:12px;line-height:1.45;cursor:pointer; }
.sidebar-checklist-item:hover { border-color:transparent;background:rgba(56,213,255,.08); }
.sidebar-checklist-item input { width:16px;height:16px;margin:1px 0 0;accent-color:var(--cyan); }
.sidebar-checklist-item:has(input:checked) span { color:var(--muted);text-decoration:line-through; }
.sidebar-checklist-item.checklist-saving { opacity:.65; }
html.light .article-sidebar-mode-toggle { border-color:#91adba;color:#176783; }
html.light .article-sidebar-mode-toggle:hover,html.light .article-sidebar-mode-toggle:focus-visible,html.light .article-sidebar-mode-toggle.active { border-color:#087896;background:rgba(8,120,150,.1);color:#005d7c; }
html.light .sidebar-checklist-item { border-color:transparent;background:transparent;color:#005f80; }
html.light .sidebar-checklist-item:hover { border-color:transparent;background:rgba(56,213,255,.08); }
@media (min-width: 901px) {
  :root { --article-rail-width: 294px; }
  .content.article-content {
    max-width: none;
    margin: 0;
    padding-right: calc(var(--article-rail-width) + 30px);
  }
  .article-content .article-layout { display: block;}
  .article-content .article-view { max-width: 900px; margin: 0 auto; }
  .article-content .related-panel { max-width: 900px; margin: 28px auto 0; }
  .article-content .article-side-sections {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    bottom: auto;
    width: var(--article-rail-width);
    height: calc(100vh - var(--topbar-height));
    height: calc(100dvh - var(--topbar-height));
    z-index: 16;
    gap: 0;
    padding: 18px 12px 24px;
    overflow: hidden;
    border: 0;
    border-left: 1px solid var(--line-soft);
    border-radius: .25rem;
    background: linear-gradient(180deg, rgba(10, 23, 40, .98), rgba(5, 13, 24, .98));
    box-shadow: -5px 0 15px rgba(0, 0, 0, .12);
  }
  .article-sidebar-heading { flex: 0 0 auto; margin-bottom: 10px; }
  .article-sidebar-scroll {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: scroll;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding-right: 3px;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }
  .article-sidebar-scroll .side-panel { flex: 0 0 auto; }
  .article-side-sections .side-panel {
    background: transparent !important;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: .25rem;
    padding: 2px 6px 15px;
    box-shadow: none !important;
  }
  .article-side-sections .side-title { margin: 2px 0 8px; color: var(--muted); font-weight: 750; }
  .article-side-sections .side-link {
    border: 1px solid transparent;
    border-radius: .25rem;
    padding: 8px;
    font-size:12px;
  }
  .article-side-sections .side-link:hover { background: rgba(56, 213, 255, .08); }
  .article-side-sections .toc-active { border-color: rgba(242, 184, 75, .45); background: rgba(242, 184, 75, .1); }
  html.light .article-content .article-side-sections {
    background: linear-gradient(180deg, #dce8ee, #cbdce5);
    box-shadow: -5px 0 14px rgba(19, 45, 61, .11);
  }
}
@media (max-width: 900px) {
  .article-side-sections {
    display: block;
    position: static;
    height: auto;
    max-height: 70vh;
    max-height: 70dvh;
    overflow-y: scroll;
    overscroll-behavior-y: contain;
    padding-right: 4px;
    scrollbar-gutter: stable;
  }
  .article-layout > .related-panel { margin-top: 20px; }
  .article-sidebar-scroll { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .article-sidebar-checklist { max-height:60vh;max-height:60dvh; }
}
@media (max-width: 760px) {
  .article-sidebar-scroll { grid-template-columns: 1fr; }
}
@media print {
  .article-side-sections { display: none !important; }
  .content.article-content { max-width: none; padding: 0; }
}

/* Keep page scrolling in every view while hiding its scrollbar. */
html,
body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
}

/* Keep the overview link visible above the single left sidebar scroll area. */
.sidebar {
  overflow: hidden;
}
.sidebar-heading {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  margin-bottom: 10px;
}
.sidebar .sidebar-heading .nav-item,
html.light .sidebar .sidebar-heading .nav-item {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: .25rem;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.sidebar .sidebar-heading .nav-item:hover {
  color: var(--text);
}
.sidebar .sidebar-heading .nav-item::after,
.sidebar-heading .nav-item span {
  display: none;
}
.sidebar-heading .nav-item b {
  font-weight: inherit;
}
.sidebar .nav-group-label,
.sidebar .section-heading,
html:not(.light) .sidebar .nav-group-label {
  color: var(--muted);
  font-size:11px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}
body.sidebar-collapsed .sidebar-heading {
  padding-inline: 0;
}
body.sidebar-collapsed .sidebar-heading .nav-item {
  text-align: center;
}
body.sidebar-collapsed .sidebar-heading .nav-item span {
  display: inline-block;
  width: auto;
  color: inherit;
}
.sidebar-scroll {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding-right: 3px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
}
.sidebar .main-nav,
.sidebar .sidebar-section,
.sidebar .sidebar-footer {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
}
.sidebar .main-nav { padding-right: 0; }
.sidebar-scroll,
.article-sidebar-scroll,
.article-sidebar-checklist,
.dashboard-sidebar-scroll {
  --sidebar-scroll-thumb: rgba(134, 170, 189, .32);
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-scroll-thumb) transparent;
}
html.light .sidebar-scroll,
html.light .article-sidebar-scroll,
html.light .article-sidebar-checklist,
html.light .dashboard-sidebar-scroll {
  --sidebar-scroll-thumb: rgba(48, 91, 113, .26);
}
.sidebar-scroll::-webkit-scrollbar,
.article-sidebar-scroll::-webkit-scrollbar,
.article-sidebar-checklist::-webkit-scrollbar,
.dashboard-sidebar-scroll::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-track,
.article-sidebar-scroll::-webkit-scrollbar-track,
.article-sidebar-checklist::-webkit-scrollbar-track,
.dashboard-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb,
.article-sidebar-scroll::-webkit-scrollbar-thumb,
.article-sidebar-checklist::-webkit-scrollbar-thumb,
.dashboard-sidebar-scroll::-webkit-scrollbar-thumb {
  border-radius: .25rem;
  background: var(--sidebar-scroll-thumb);
}

/* Match navigation icons to the darker sidebar accent. */
.sidebar .nav-item span,
.sidebar .nav-item.active span,
.sidebar .icon-button,
html.light .sidebar .nav-item.active span {
  color: var(--line);
}

/* Account and compact application menu live together in the header. */
.topbar-profile {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
  padding-left: 12px;
  border-left: 1px solid var(--line-soft);
}
.topbar-profile .topbar-account { margin-left: 0; padding: 0; border: 0; }
.topbar-user-menu { position:relative; }
.topbar-menu-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color:var(--cyan-soft);
  font-size:18px;
}
.topbar-menu-toggle[aria-expanded="true"] { border-color:var(--cyan);background:rgba(56,213,255,.09);color:var(--cyan); }
.topbar-menu-panel {
  z-index:90;
  top:calc(100% + 12px);
  right:0;
  left:auto;
  width:230px;
  padding:6px;
  overflow:visible;
}
.topbar-menu-row {
  display:flex;
  align-items:center;
  width:100%;
  min-height:38px;
  gap:10px;
  padding:8px 9px;
  border:0;
  border-radius:.2rem;
  background:transparent;
  color:var(--text);
  font:inherit;
  text-align:left;
  cursor:pointer;
}
.topbar-menu-row:hover,.topbar-menu-row:focus-visible { background:rgba(56,213,255,.09);color:var(--cyan-soft); }
.topbar-menu-row > span:first-child { display:grid;place-items:center;width:21px;flex:0 0 21px;color:var(--cyan);font-size:15px; }
.topbar-menu-row > span:nth-child(2) { display:grid;gap:1px;flex:1; }
.topbar-menu-row small { color:var(--muted);font-size:9px; }
.topbar-menu-row.danger,.topbar-menu-row.danger > span:first-child { color:var(--danger); }
.topbar-menu-divider { height:1px;margin:5px 4px;background:var(--line-soft); }
.topbar-menu-logout { margin:0; }
.topbar-menu-switch { position:relative;width:30px;height:17px;flex:0 0 30px;border:1px solid var(--line-soft);border-radius:999px;background:var(--panel-3); }
.topbar-menu-switch::after { content:"";position:absolute;top:2px;left:2px;width:11px;height:11px;border-radius:50%;background:var(--muted);transition:transform .16s,background .16s; }
#theme-toggle[aria-checked="true"] .topbar-menu-switch { border-color:rgba(56,213,255,.5);background:rgba(56,213,255,.14); }
#theme-toggle[aria-checked="true"] .topbar-menu-switch::after { transform:translateX(13px);background:var(--cyan); }
.topbar-menu-panel #header-import-article,.topbar-menu-panel #theme-toggle { display:flex; }
.about-modal-body { display:grid;justify-items:center;gap:16px;text-align:center; }
.about-logo { display:block;width:78px;height:78px;content:var(--brand-logo-url);object-fit:contain;filter:drop-shadow(0 6px 15px rgba(0,0,0,.16)); }
.about-modal-body p { max-width:430px;margin:0;color:var(--muted);line-height:1.65; }
.about-modal-body dl { width:100%;margin:4px 0 0;border-top:1px solid var(--line-soft); }
.about-modal-body dl > div { display:flex;justify-content:space-between;gap:20px;padding:10px 2px;border-bottom:1px solid var(--line-soft);text-align:left; }
.about-modal-body dt { color:var(--muted); }
.about-modal-body dd { margin:0;color:var(--text);font-weight:650;text-align:right; }
html.light .topbar-menu-panel { background:#fff; }
html.light .topbar-menu-row:hover,html.light .topbar-menu-row:focus-visible { background:#e8f3f7;color:#005f80; }
html.light .topbar-menu-switch { background:#dbe7ec; }
@media (max-width: 480px) {
  .topbar-menu-panel { position:fixed;top:calc(var(--topbar-height) - 2px);right:8px;width:min(260px,calc(100vw - 16px)); }
}
@media (max-width: 760px) {
  .topbar-profile { gap: 5px; margin-left: 0; padding-left: 8px; }
  .topbar .topbar-account { display: flex; }
  .topbar-account > span:last-child { display: none; }
  .topbar-profile .topbar-account .account-avatar { width: 30px; height: 30px; }
  .topbar-menu-toggle { width: 30px; height: 30px; }
}

/* Let dashboard columns follow the available content width at any browser zoom. */
.dashboard-layout,
.dashboard-main,
.dashboard-rail,
.dashboard-main > *,
.dashboard-rail > * { min-width: 0; max-width: 100%; }
.dashboard-layout { width: 100%; }
.dashboard-main { grid-template-columns: minmax(0, 1fr); }
.dashboard-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.dashboard-recommend-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.dashboard-panels { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.dashboard-hero > div,
.dashboard-hero blockquote,
.dashboard-banner p,
.dashboard-panel-heading,
.dashboard-progress-top > div:last-child { min-width: 0; }
.dashboard-hero h1,
.dashboard-banner p { overflow-wrap: anywhere; }
.dashboard-panel-heading { flex-wrap: wrap; }
.dashboard-main .recent-strip { max-width: 100%; }
@media (max-width: 1000px) {
  .dashboard-rail { grid-template-columns: minmax(0, 1fr); }
}

/* The dashboard uses the same full-height right sidebar as article pages. */
.dashboard-sidebar-scroll { display: grid; gap: 12px; min-width: 0; }
@media (min-width: 1160px) {
  .content.dashboard-content {
    max-width: none;
    margin: 0;
    padding-right: calc(var(--article-rail-width, 294px) + 30px);
  }
  .dashboard-content .dashboard-layout { display: block; }
  .dashboard-content .dashboard-main { max-width: 1200px; margin: 0 auto; }
  .dashboard-content .dashboard-rail {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    z-index: 16;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: var(--article-rail-width, 294px);
    height: calc(100vh - var(--topbar-height));
    height: calc(100dvh - var(--topbar-height));
    padding: 18px 12px 24px;
    overflow: hidden;
    border-left: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(10, 23, 40, .98), rgba(5, 13, 24, .98));
    box-shadow: -5px 0 15px rgba(0, 0, 0, .12);
  }
  .dashboard-sidebar-scroll {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding-right: 3px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }
  .dashboard-sidebar-scroll .dashboard-panel {
    flex: 0 0 auto;
    padding: 2px 6px 15px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: .25rem;
    background: transparent;
    box-shadow: none;
  }
  html.light .dashboard-content .dashboard-rail {
    background: linear-gradient(180deg, #dce8ee, #cbdce5);
    box-shadow: -5px 0 14px rgba(19, 45, 61, .11);
  }
  html.light .dashboard-sidebar-scroll .dashboard-panel {
    background: transparent;
    border-color: var(--line-soft);
    box-shadow: none;
  }
}
@media (max-width: 1050px) {
  .dashboard-content .dashboard-rail { grid-template-columns: minmax(0, 1fr); }
  .dashboard-sidebar-scroll { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .dashboard-sidebar-scroll { grid-template-columns: minmax(0, 1fr); }
  .dashboard-sidebar-scroll .dashboard-collections { grid-column: auto; }
}

/* Interactive article learning progress. */
.dashboard-progress-filter {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #bbcfda;
  font-size:11px;
  text-align: left;
}
.dashboard-progress-filter:hover,
.dashboard-progress-filter:focus-visible { color: var(--cyan-soft); }
.dashboard-progress-filter b { color: var(--text); font-weight: 500; }
html.light .dashboard-progress-filter { color: var(--muted); }
html.light .dashboard-progress-filter b { color: var(--text); }
.progress-overview { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.progress-overview strong { color: var(--gold); font-size:32px; }
.progress-overview span { color: var(--muted); font-size:13px; }
.progress-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.progress-filters button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: .25rem;
  background: var(--panel-2);
  color: var(--text);
  font-size:12px;
}
.progress-filters button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.progress-filters b { font-size:11px; }
.progress-articles .panel-header { margin-bottom: 10px; }
.progress-article-list { display: grid; }
.progress-article-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
}
.progress-article-row > button {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.progress-article-row > button:hover strong { color: var(--cyan-soft); }
.progress-article-row strong,
.progress-article-row small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.progress-article-row small { color: var(--muted); font-size:11px; }
.progress-article-row select {
  flex: 0 0 auto;
  width: 150px;
  max-width: 42%;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: .25rem;
  background: var(--panel-2);
  color: var(--text);
  font-size:12px;
}
html.light .progress-article-row select,
html.light .progress-filters button { background: #fff; }
@media (max-width: 600px) {
  .progress-article-row { align-items: stretch; flex-direction: column; gap: 8px; }
  .progress-article-row select { width: 100%; max-width: none; }
}

/* Show the article's current scroll progress without covering its toolbar. */
.reading-progress-label {
  position: fixed;
  right: calc(var(--article-rail-width, 294px) + 16px);
  bottom: 16px;
  padding: 6px 9px;
  border: 1px solid var(--line-soft);
  border-radius: .25rem;
  background: #0d2232;
  color: var(--cyan-soft);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .16);
  font-size:11px;
  font-weight: 700;
  white-space: nowrap;
}
html.light .reading-progress-label { background: #f5fafc; color: #075a78; }
@media (max-width: 900px) {
  .reading-progress-label { right: 16px; }
}
@media (max-width: 760px) {
  .reading-progress-label { bottom: 80px; }
}
@media print {
  .reading-progress { display: none; }
}

/* Toast text must contrast with its background in both themes. */
html.light .toast {
  background: #f5fafc;
  color: #173040;
  border-color: #398769;
  box-shadow: 0 5px 14px rgba(19, 45, 61, .14);
}
html.light .toast.error {
  background: #fff2f3;
  color: #70202b;
  border-color: #bd5863;
}

/* Simple Markdown formatting for flashcard questions and answers. */
.card-edit-field { display: grid; gap: 8px; }
.card-format-toolbar { display: flex; flex-wrap: wrap; gap: 5px; }
.card-format-toolbar button {
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--line-soft);
  border-radius: .25rem;
  background: var(--panel-2);
  color: var(--text);
  font-size:12px;
}
.card-format-toolbar button:hover,
.card-format-toolbar button:focus-visible { border-color: var(--cyan); color: var(--cyan-soft); }
.card-format-preview { border: 1px solid var(--line-soft); border-radius: .25rem; padding: 10px 12px; }
.card-format-preview summary { cursor: pointer; color: var(--cyan-soft); font-size:12px; }
.card-preview-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 12px; }
.card-preview-grid > div { min-width: 0; padding: 12px; border: 1px solid var(--line-soft); border-radius: .25rem; }
.card-preview-grid strong { font-size:12px; }
.card-preview-grid .article-body { margin-top: 8px; font-size:12px; line-height: 1.5; overflow-wrap: anywhere; }
.card-preview-grid .article-body p { margin: 0 0 6px; }
.review-card .card-question { max-width: 760px; margin: 18px 0 34px; font-size:clamp(22px,3vw,30px); font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.review-card .card-question p { margin: 0 0 10px; }
.review-card .card-question ul,
.review-card .card-question ol,
.card-answer ul,
.card-answer ol { padding-left: 1.5em; }
.review-card .card-question u,
.card-answer u,
.card-preview-grid u { text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
html.light .card-format-toolbar button,
html.light .card-preview-grid > div { background: #fff; color: var(--text); }
@media (max-width: 600px) {
  .card-preview-grid { grid-template-columns: minmax(0,1fr); }
}

/* Searchable flashcard management. */
.flashcard-manager { max-width: 1050px; }
.flashcard-search { display: grid; gap: 8px; margin-bottom: 22px; }
.flashcard-search label { color: var(--muted); font-size:12px; font-weight: 700; }
.flashcard-search > div { display: flex; gap: 8px; }
.flashcard-search input { min-width: 0; flex: 1; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: .25rem; background: var(--panel-2); color: var(--text); font: inherit; }
.flashcard-list-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.flashcard-list-heading h2 { margin: 0; font-size:16px; }
.flashcard-list-heading span { color: var(--muted); font-size:12px; }
.flashcard-list-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.flashcard-list-text { display: grid; gap: 5px; min-width: 0; }
.flashcard-list-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size:13px; }
.flashcard-list-text small { color: var(--muted); font-size:11px; }
.flashcard-list-actions, .flashcard-pages { display: flex; align-items: center; gap: 8px; }
.flashcard-list-actions { flex: 0 0 auto; }
.flashcard-pages { justify-content: center; margin-top: 18px; color: var(--muted); font-size:12px; }
.flashcard-pages button:disabled { opacity: .4; cursor: default; }
html.light .flashcard-search input { background: #fff; color: var(--text); }
@media (max-width: 600px) {
  .flashcard-list-row { align-items: stretch; flex-direction: column; gap: 10px; }
  .flashcard-list-actions button { flex: 1; }
}
.management-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; max-width: 1050px; }
.management-link { display: flex; align-items: center; gap: 16px; min-width: 0; text-align: left; color: var(--text); cursor: pointer; font: inherit; }
.management-link:hover, .management-link:focus-visible { border-color: var(--cyan); background: var(--panel-2); }
.management-link > span:nth-child(2) { display: grid; gap: 6px; flex: 1; }
.management-link strong { font-size:15px; }
.management-link small { color: var(--muted); font-size:12px; line-height: 1.5; }
.management-link > span:last-child { color: var(--cyan-soft); }
.management-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid var(--line-soft); border-radius: .25rem; color: var(--cyan-soft); font-size:20px; }
.management-back { margin: 0 0 12px; padding: 0; border: 0; background: transparent; color: var(--cyan-soft); cursor: pointer; font: inherit; font-size:12px; }
.management-back:hover, .management-back:focus-visible { text-decoration: underline; }
.collection-manager-list { display: grid; gap: 16px; max-width: 1050px; }
.collection-manager-card .panel-header { gap: 12px; flex-wrap: wrap; }
.collection-manager-card .panel-header > div:first-child { min-width: 0; }
.collection-manager-card .panel-header p { margin: 5px 0 0; color: var(--muted); }
.collection-manager-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.collection-manager-articles { margin-bottom: 12px; }
.collection-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 18px; }
.collection-card-actions .primary-button,.collection-card-actions .secondary-button { display: inline-flex; align-items: center; justify-content: center; flex: 1 1 145px; min-height: 38px; text-align: center; line-height: 1.25; }
.collection-detail-layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; align-items:start; gap:16px; }
.collection-detail-main { min-width:0; padding:18px; }
.collection-detail-main .panel-header { margin-bottom:8px; }
.collection-detail-main .panel-header h2 { margin:3px 0 0; }
.collection-detail-list { display:grid; }
.collection-detail-article { display:grid; grid-template-columns:34px minmax(0,1fr) 24px; align-items:center; width:100%; min-width:0; gap:12px; padding:14px 4px; border:0; border-top:1px solid var(--line-soft); background:transparent; color:var(--text); text-align:left; }
.collection-detail-article:hover,.collection-detail-article:focus-visible { background:rgba(56,213,255,.055); }
.collection-detail-index { display:grid; place-items:center; width:30px; height:30px; border:1px solid var(--line-soft); color:var(--cyan-soft); font-size:10px; }
.collection-detail-copy { display:grid; min-width:0; gap:5px; }
.collection-detail-copy > span:first-child { display:flex; align-items:center; justify-content:space-between; min-width:0; gap:10px; }
.collection-detail-copy strong { overflow:hidden; font-size:14px; text-overflow:ellipsis; white-space:nowrap; }
.collection-detail-labels { display:flex; align-items:center; flex:0 0 auto; gap:6px; }
.collection-detail-copy em { font-style:normal; }
.collection-detail-copy p { display:-webkit-box; margin:0; overflow:hidden; color:var(--muted); font-size:11px; line-height:1.45; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
.collection-detail-copy small { overflow:hidden; color:var(--cyan-soft); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.collection-detail-arrow { color:var(--cyan); font-size:17px; text-align:center; }
.collection-detail-sequence-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:12px; padding:8px 11px; border-left:3px solid var(--cyan); background:rgba(56,213,255,.09); color:var(--cyan-soft); }
.collection-detail-sequence-heading:first-child { margin-top:0; }
.collection-detail-sequence-heading span { font-size:9px; font-weight:800; letter-spacing:.13em; }
.collection-detail-sequence-heading strong { color:var(--gold); font-size:10px; }
.collection-detail-article.collection-detail-sequence-member { padding-left:10px; border-left:3px solid rgba(56,213,255,.62); background:linear-gradient(90deg,rgba(56,213,255,.075),transparent 68%); }
.collection-detail-article.collection-detail-sequence-member.sequence-start { border-top-color:rgba(56,213,255,.32); }
.collection-detail-article.collection-detail-sequence-member.sequence-end { margin-bottom:10px; border-bottom:1px solid rgba(56,213,255,.32); }
.collection-detail-sequence-badge { flex:0 0 auto; padding:3px 7px; border:1px solid rgba(56,213,255,.34); background:rgba(56,213,255,.1); color:var(--cyan-soft); font-size:9px; font-weight:750; white-space:nowrap; }
.collection-detail-side { position:sticky; top:calc(var(--topbar-height) + 16px); display:grid; gap:12px; }
.collection-progress-summary { display:flex; align-items:center; gap:14px; margin-top:14px; }
.collection-progress-summary .dashboard-progress-ring { flex-basis:82px; width:82px; height:82px; }
.collection-progress-summary .dashboard-progress-ring::before { width:60px; height:60px; background:var(--panel); }
.collection-progress-summary .dashboard-progress-ring strong { font-size:18px; }
.collection-progress-summary > div:last-child { display:grid; gap:3px; }
.collection-progress-summary > div:last-child strong { color:var(--gold); font-size:14px; }
.collection-progress-summary > div:last-child small { color:var(--muted); font-size:10px; }
.collection-progress-track { height:5px; margin-top:14px; overflow:hidden; background:rgba(56,213,255,.08); }
.collection-progress-track span { display:block; height:100%; background:linear-gradient(90deg,var(--cyan),var(--gold)); }
.collection-type-breakdown { display:grid; margin-top:12px; }
.collection-type-breakdown > div { display:flex; justify-content:space-between; gap:10px; padding:9px 0; border-top:1px solid var(--line-soft); color:var(--muted); font-size:11px; }
.collection-type-breakdown strong { color:var(--text); }
.collection-manager-article { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.collection-manager-article .collection-article { flex: 1; min-width: 0; border-bottom: 0; }
.collection-manager-article > button:last-child { flex: 0 0 auto; }
@media (max-width: 1050px) { .collection-detail-layout { grid-template-columns:minmax(0,1fr); } .collection-detail-side { position:static; grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) { .management-grid { grid-template-columns: minmax(0,1fr); } .collection-detail-side { grid-template-columns:minmax(0,1fr); } .collection-detail-article { grid-template-columns:28px minmax(0,1fr); gap:9px; } .collection-detail-index { width:26px; height:26px; } .collection-detail-arrow { display:none; } .collection-detail-copy > span:first-child { align-items:flex-start; } .collection-detail-copy strong { white-space:normal; } .collection-detail-labels { align-items:flex-end; flex-direction:column; } }

/* Article actions span the top of the article content beside the details rail. */
.content.article-content { position:relative;padding-top:0; }
.article-content .article-toolbar {
  position: sticky;
  top: var(--topbar-height);
  z-index: 18;
  gap: 6px;
  margin: 0 0 35px;
  padding: .5rem;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: .25rem;
  background: var(--bg);
  box-shadow: none;
  backdrop-filter: none;
}
.article-content > .article-toolbar { margin-left: -26px; margin-right: -26px; }
@media (min-width: 901px) {
  .article-content > .article-toolbar { margin-right: -30px; }
}
.article-content .article-toolbar .primary-button,
.article-content .article-toolbar .secondary-button,
.article-content .article-toolbar .danger-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 9px;
  border-radius: .25rem;
  box-shadow: none;
  font-size:11px;
}
.article-content .article-toolbar .secondary-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.article-content .article-toolbar .secondary-button:hover,
.article-content .article-toolbar .secondary-button:focus-visible {
  border-color: var(--line-soft);
  background: var(--panel-2);
  color: var(--text);
}
.article-content .article-toolbar .danger-button { margin-left: auto; }
@media (max-width: 760px) {
  .article-content > .article-toolbar { gap: 4px; margin-left: -14px; margin-right: -14px; }
  .article-content .article-toolbar .danger-button { margin-left: 0; }
}

/* Section headings in articles should follow the text without large blank bands. */
.article-content .article-view > .article-body h1 { margin: 20px 0 10px; }
.article-content .article-view > .article-body h2 { margin: 20px 0 10px; padding-top: 10px; }
.article-content .article-view > .article-body h3 { margin: 16px 0 8px; }
.article-content .article-view > .article-body h4 { margin: 14px 0 7px; }
.article-content .article-view > .article-body > :is(h1,h2,h3,h4):first-child { margin-top: 0; }
.article-content .article-view > .article-body > pre.code-block { margin: 10px 0 18px; }

/* Consistent vertical rhythm for rendered article text. Markdown blank lines
   separate blocks, but must not add an extra spacer before lists. */
.article-body > .para-gap { display: none; }
.article-body > p { margin: 0 0 12px; }
.article-body > :is(ul,ol) { margin: 0 0 16px; padding-left: 1.5rem; }
.article-body > p:has(+ :is(ul,ol)) { margin-bottom: 6px; }
.article-body > :is(ul,ol) li { padding-left: .15rem; }
.article-body > :is(ul,ol) li + li { margin-top: 4px; }
.article-body > :is(h1,h2,h3,h4) + :is(p,ul,ol) { margin-top: 0; }
.article-body > :is(p,ul,ol,blockquote,pre,.code-block,.table-wrap,.callout,.article-figure):last-child { margin-bottom: 0; }

/* Media library, editor uploads and article images */
.article-body img { display: block; max-width: 100%; height: auto; border-radius: .35rem; }
.article-image-button { display: block; max-width: 100%; margin: 14px 0; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.article-figure { margin: 18px 0; }
.article-figure .article-image-button { margin: 0; }
.article-figure figcaption { padding: 8px 4px 0; color: var(--muted); font-size:12px; text-align: center; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 14px; }
.media-card { overflow: hidden; padding: 0; border: 1px solid var(--line-soft); border-radius: .45rem; background: var(--panel); color: var(--text); text-align: left; cursor: pointer; }
.media-card:hover,.media-card:focus-visible { border-color: var(--cyan); transform: translateY(-1px); }
.media-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--panel-2); }
.media-card > span { display: grid; gap: 4px; padding: 11px; }
.media-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card small { color: var(--muted); }
.media-detail > img { display: block; max-width: 100%; max-height: 46vh; margin: 0 auto 16px; object-fit: contain; }
.media-detail dl { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 7px 12px; }
.media-detail dt { color: var(--muted); }
.media-detail dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.media-picker-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.media-picker-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap: 10px; max-height: 55vh; overflow: auto; }
.media-picker-grid button { overflow: hidden; padding: 0; border: 1px solid var(--line-soft); border-radius: .35rem; background: var(--panel-2); color: var(--text); cursor: pointer; }
.media-picker-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.media-picker-grid span { display: block; overflow: hidden; padding: 7px; text-overflow: ellipsis; white-space: nowrap; }
.media-upload-status { display: grid; gap: 6px; margin-top: 8px; }
.media-upload-status > div { display: grid; grid-template-columns: minmax(100px,1fr) 130px auto; align-items: center; gap: 8px; padding: 7px; border: 1px solid var(--line-soft); border-radius: .3rem; font-size:12px; }
.media-upload-status .success b { color: var(--green,#63c998); }.media-upload-status .failed b { color: var(--danger,#ef7474); }
.content-editor.media-drag { outline: 2px dashed var(--cyan); outline-offset: -5px; background: color-mix(in srgb,var(--cyan) 8%,var(--panel)); }
.image-lightbox { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 5vw; background: rgba(0,0,0,.88); }
.image-lightbox img { max-width: 100%; max-height: 90vh; object-fit: contain; }
.image-lightbox button { position: absolute; top: 18px; right: 24px; border: 0; background: transparent; color: #fff; font-size:38px; cursor: pointer; }
@media(max-width:600px){.media-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.media-upload-status>div{grid-template-columns:1fr}.media-detail dl{grid-template-columns:1fr}.media-detail dt{margin-top:6px}}

/* Integrated document management */
.document-filters { grid-template-columns:minmax(240px,1.5fr) repeat(4,minmax(135px,.75fr)); }
.document-list { overflow:hidden; border:1px solid var(--line-soft); border-radius:.35rem; background:var(--panel); box-shadow:var(--shadow); }
.document-list-head,.document-row { display:grid; grid-template-columns:52px minmax(210px,1.4fr) minmax(110px,.7fr) minmax(130px,.8fr) 80px 115px 78px minmax(155px,.8fr); align-items:center; gap:12px; }
.document-list-head { padding:10px 14px; border-bottom:1px solid var(--line-soft); background:var(--panel-2); color:var(--muted); font-size:9px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.document-row { min-height:78px; padding:11px 14px; border-bottom:1px solid var(--line-soft); color:var(--text); cursor:pointer; transition:background .15s,border-color .15s; }
.document-row:last-child { border-bottom:0; }
.document-row:hover,.document-row:focus-visible { background:color-mix(in srgb,var(--cyan) 5%,var(--panel)); outline:none; }
.document-type-icon { display:grid; place-items:center; width:44px; height:48px; border:1px solid color-mix(in srgb,var(--cyan) 35%,var(--line-soft)); border-radius:.3rem; background:color-mix(in srgb,var(--cyan) 8%,var(--panel-2)); color:var(--cyan-soft); font-size:10px; font-weight:800; letter-spacing:.06em; }
.document-type-icon.type-pdf { border-color:color-mix(in srgb,var(--danger) 38%,var(--line-soft)); background:color-mix(in srgb,var(--danger) 7%,var(--panel-2)); color:var(--danger); }
.document-type-icon.type-ppt,.document-type-icon.type-pptx { border-color:color-mix(in srgb,var(--gold) 42%,var(--line-soft)); background:color-mix(in srgb,var(--gold) 8%,var(--panel-2)); color:var(--gold); }
.document-main { display:grid; min-width:0; gap:5px; }
.document-main strong,.document-main small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.document-main strong { font-size:13px; }
.document-main small,.document-row > span:not(.document-type-icon):not(.document-main) { color:var(--muted); font-size:10px; }
.document-tags { display:flex; flex-wrap:wrap; gap:4px; min-width:0; overflow:hidden; }
.document-tags em { padding:3px 5px; border:1px solid var(--line-soft); border-radius:999px; color:var(--cyan-soft); font-size:8px; font-style:normal; white-space:nowrap; }
.document-date { display:grid; gap:3px; }
.document-date small { font-size:9px; white-space:nowrap; }
.document-row-actions { display:flex; align-items:center; gap:6px; justify-content:flex-end; }
.document-view-switch { margin-left:auto; }
.document-preview-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; align-items:stretch; }
.document-preview-grid > .empty-state { grid-column:1/-1; }
.document-preview-card { display:flex; min-width:0; flex-direction:column; overflow:hidden; border:1px solid var(--line-soft); border-radius:.35rem; background:var(--panel); color:var(--text); box-shadow:var(--shadow); cursor:pointer; transition:transform .16s,border-color .16s,box-shadow .16s; }
.document-preview-card:hover,.document-preview-card:focus-visible { border-color:color-mix(in srgb,var(--cyan) 58%,var(--line-soft)); outline:none; transform:translateY(-2px); box-shadow:0 8px 22px rgba(0,0,0,.16); }
.document-preview-media { position:relative; display:grid; place-items:center; aspect-ratio:4/3; overflow:hidden; border-bottom:1px solid var(--line-soft); background:color-mix(in srgb,var(--cyan) 3%,var(--panel-2)); }
.document-preview-media > img { display:block; width:100%; height:100%; border:0; object-fit:contain; background:#fff; }
.document-preview-pdf-image { object-fit:contain; background:#fff; }
.document-preview-placeholder { display:grid; place-items:center; gap:9px; color:var(--muted); }
.document-preview-placeholder .document-type-icon { width:72px; height:82px; font-size:15px; }
.document-preview-placeholder > small { font-size:10px; font-weight:750; letter-spacing:.1em; }
.document-preview-extension { position:absolute; top:10px; right:10px; padding:4px 7px; border:1px solid rgba(255,255,255,.22); border-radius:.2rem; background:rgba(5,13,23,.78); color:#eaf7ff; font-size:9px; font-weight:800; letter-spacing:.08em; backdrop-filter:blur(8px); }
.document-preview-body { display:flex; flex:1; min-width:0; flex-direction:column; padding:13px; }
.document-preview-body > .eyebrow { overflow:hidden; margin-bottom:7px; text-overflow:ellipsis; white-space:nowrap; }
.document-preview-body h2 { margin:0; overflow:hidden; font-size:15px; line-height:1.3; text-overflow:ellipsis; white-space:nowrap; }
.document-preview-body > p { display:-webkit-box; min-height:50px; margin:8px 0 11px; overflow:hidden; color:var(--muted); font-size:11px; line-height:1.55; -webkit-box-orient:vertical; -webkit-line-clamp:3; }
.document-preview-tags { display:flex; min-height:24px; flex-wrap:wrap; gap:5px; }
.document-preview-tags em { padding:3px 6px; border:1px solid var(--line-soft); border-radius:.2rem; color:var(--cyan-soft); font-size:9px; font-style:normal; }
.document-preview-tags span { color:var(--muted); font-size:10px; }
.document-preview-meta { display:flex; flex-wrap:wrap; gap:5px 9px; margin-top:11px; padding-top:9px; border-top:1px solid var(--line-soft); color:var(--muted); font-size:9px; }
.document-preview-actions { display:flex; gap:6px; margin-top:11px; }
.document-preview-actions > * { flex:1; text-align:center; }
.document-detail-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(300px,360px); gap:18px; align-items:start; }
.document-preview-panel { min-height:520px; padding:14px; overflow:hidden; }
.document-pdf-preview { width:100%; height:72vh; min-height:500px; border:0; background:#fff; }
.document-image-preview { display:grid; place-items:center; min-height:500px; }
.document-image-preview img { max-width:100%; max-height:72vh; object-fit:contain; }
.document-text-preview { min-height:500px; max-height:72vh; margin:0; padding:18px; overflow:auto; border:1px solid var(--line-soft); background:var(--panel-2); color:var(--text); font:12px/1.65 ui-monospace,SFMono-Regular,Consolas,monospace; white-space:pre-wrap; overflow-wrap:anywhere; }
.document-no-preview { display:grid; place-items:center; align-content:center; min-height:490px; padding:30px; text-align:center; }
.document-no-preview .document-type-icon { width:74px; height:84px; margin-bottom:18px; font-size:15px; }
.document-no-preview h3 { margin:0 0 8px; }
.document-no-preview p { max-width:480px; margin:0 0 20px; color:var(--muted); }
.document-meta-panel { position:sticky; top:calc(var(--topbar-height) + 16px); padding:20px; }
.document-meta-panel h2 { margin:0 0 18px; font-size:17px; }
.document-meta-panel dl { display:grid; grid-template-columns:105px minmax(0,1fr); gap:9px 12px; margin:0; }
.document-meta-panel dt { color:var(--muted); font-size:10px; }
.document-meta-panel dd { min-width:0; margin:0; overflow-wrap:anywhere; font-size:11px; }
.document-linked-articles { margin-top:22px; padding-top:17px; border-top:1px solid var(--line-soft); }
.document-linked-articles h3 { margin:0; font-size:13px; }
.document-linked-articles > div:not(.panel-header) { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:7px; padding:8px 0; border-bottom:1px solid var(--line-soft); }
.document-linked-articles > div > button:first-child { display:grid; gap:3px; min-width:0; padding:0; border:0; background:transparent; color:var(--text); text-align:left; }
.document-linked-articles strong,.document-linked-articles small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.document-linked-articles small { color:var(--muted); font-size:9px; }
.document-form select[multiple] { min-height:160px; padding:6px; }
#simple-modal:has(.document-form) .modal-card { width:min(780px,94vw); }
.article-sequence-navigation { margin-top:34px; padding-top:22px; border-top:1px solid var(--line-soft); }
.article-sequence-navigation > .eyebrow { margin-bottom:10px; }
.article-sequence-navigation-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.article-sequence-nav-button,.article-sequence-nav-empty { display:grid; gap:5px; min-width:0; padding:15px 16px; border:1px solid var(--line-soft); background:var(--panel-2); color:var(--text); text-align:left; }
.article-sequence-nav-button { cursor:pointer; transition:border-color .16s,background .16s,transform .16s; }
.article-sequence-nav-button.next,.article-sequence-nav-empty.next { text-align:right; }
.article-sequence-nav-button:hover,.article-sequence-nav-button:focus-visible { border-color:rgba(56,213,255,.55); background:rgba(56,213,255,.07); transform:translateY(-1px); }
.article-sequence-nav-button small,.article-sequence-nav-empty small { color:var(--cyan-soft); font-size:10px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.article-sequence-nav-button strong { overflow:hidden; color:inherit; font-size:14px; text-overflow:ellipsis; white-space:nowrap; }
.article-sequence-nav-empty { border-style:dashed; color:var(--muted); }
.article-sequence-nav-empty span { font-size:12px; }
.article-side-document-list { display:grid; gap:6px; }
.article-side-document { display:grid; grid-template-columns:minmax(0,1fr) 28px; align-items:center; gap:5px; padding-bottom:6px; border-bottom:1px solid var(--line-soft); }
.article-side-document > button { display:grid; grid-template-columns:32px minmax(0,1fr); align-items:center; gap:8px; min-width:0; padding:5px 0; border:0; background:transparent; color:var(--text); text-align:left; cursor:pointer; }
.article-side-document > button:hover strong,.article-side-document > button:focus-visible strong { color:var(--cyan); }
.article-side-document .document-type-icon { width:32px; height:34px; font-size:8px; }
.article-side-document > button > span:last-child { display:grid; gap:3px; min-width:0; }
.article-side-document strong,.article-side-document small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.article-side-document strong { font-size:11px; }
.article-side-document small { color:var(--muted); font-size:9px; }
.article-side-document > a { display:grid; place-items:center; width:28px; height:28px; border:1px solid var(--line-soft); color:var(--cyan-soft); text-decoration:none; }
.article-side-document > a:hover,.article-side-document > a:focus-visible { border-color:var(--cyan); background:rgba(56,213,255,.08); }
@media (max-width:1200px) { .document-list-head,.document-row { grid-template-columns:48px minmax(190px,1.4fr) minmax(100px,.7fr) 75px 110px 70px minmax(150px,.8fr); } .document-list-head > :nth-child(4),.document-row > :nth-child(4) { display:none; } .document-filters { grid-template-columns:repeat(2,minmax(0,1fr)); } .document-filters > :first-child { grid-column:1/-1; } }
@media (max-width:760px) { .document-preview-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:900px) { .document-detail-layout { grid-template-columns:1fr; } .document-meta-panel { position:static; } .document-preview-panel,.document-image-preview,.document-text-preview,.document-no-preview { min-height:360px; } .document-pdf-preview { min-height:440px; } }
@media (max-width:760px) { .document-filters { grid-template-columns:1fr; } .document-filters > :first-child { grid-column:auto; } .document-list { display:grid; gap:10px; overflow:visible; border:0; background:transparent; box-shadow:none; } .document-list-head { display:none; } .document-row { grid-template-columns:48px minmax(0,1fr); gap:7px 11px; padding:14px; border:1px solid var(--line-soft); border-radius:.35rem; background:var(--panel); box-shadow:var(--shadow); } .document-row > span:not(.document-type-icon):not(.document-main):not(.document-row-actions) { grid-column:2; } .document-row > span[data-label]::before { content:attr(data-label) ': '; color:var(--muted); font-weight:700; } .document-row-actions { grid-column:1/-1; justify-content:stretch; margin-top:7px; } .document-row-actions > * { flex:1; text-align:center; } .document-tags { display:flex!important; } .document-detail-header .header-actions { width:100%; } .document-detail-header .header-actions > * { flex:1; text-align:center; } .document-meta-panel dl { grid-template-columns:1fr; gap:3px; } .document-meta-panel dd { margin-bottom:9px; } .article-sequence-navigation-grid { grid-template-columns:1fr; } .article-sequence-nav-button.next,.article-sequence-nav-empty.next { text-align:left; } }
@media (max-width:520px) { .document-preview-grid { grid-template-columns:1fr; } .document-view-switch { width:100%; margin-left:0; } .document-view-switch button { flex:1; } }

/* Independent personal notes */
.note-filters { grid-template-columns: minmax(240px,1fr) minmax(180px,260px); }
.notes-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; align-items: stretch; }
.notes-grid > .empty-state { grid-column: 1/-1; }
.note-card { --note-accent:var(--cyan); position: relative; display: flex; flex-direction: column; min-height: 220px; padding: 18px; overflow: hidden; border: 1px solid color-mix(in srgb,var(--note-accent) 24%,var(--line-soft)); border-top: 3px solid var(--note-accent); border-radius: .25rem; background: color-mix(in srgb,var(--note-accent) 7%,var(--panel)); color: var(--text); cursor: pointer; box-shadow: var(--shadow); transition: transform .16s,border-color .16s,box-shadow .16s,background .16s; }
.note-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb,var(--note-accent) 50%,var(--line-soft)); box-shadow: 0 8px 20px rgba(0,0,0,.14); }
.note-card.note-gold { --note-accent:var(--gold); }
.note-card.note-green { --note-accent:var(--success); }
.note-card.note-rose { --note-accent:var(--danger); }
.note-card.note-slate { --note-accent:#758a99; }
.note-card-head { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:28px; color:var(--note-accent); font-size:9px; font-weight:800; letter-spacing:.12em; }
.note-pin { position:relative; z-index:1; width:28px; height:28px; padding:0; border:1px solid color-mix(in srgb,var(--note-accent) 35%,transparent); border-radius:.25rem; background:color-mix(in srgb,var(--note-accent) 8%,transparent); color:var(--note-accent); }
.note-card h3 { margin:14px 0 10px; font-size:18px; line-height:1.28; }
.note-card p { display:-webkit-box; flex:1; margin:0; overflow:hidden; color:var(--muted); font-size:13px; line-height:1.65; -webkit-box-orient:vertical; -webkit-line-clamp:5; }
.note-card footer { position:relative; z-index:1; display:flex; justify-content:space-between; gap:10px; margin-top:18px; padding-top:11px; border-top:1px solid var(--line-soft); color:var(--muted); font-size:10px; }
.note-card footer span:last-child { color:var(--note-accent); }
.note-pin-field { align-self:end; min-height:42px; }
.note-reader { min-height:180px; }
.note-reader-attachments { margin-top:16px; }
.note-reader-attachments h2,.note-attachments h3 { margin:0 0 10px; font-size:13px; }
.note-editor-field { display:grid; gap:7px; }
.note-format-toolbar { flex-wrap:wrap; }
.note-format-toolbar #note-add-files { margin-left:auto; border-color:color-mix(in srgb,var(--cyan) 45%,var(--line-soft)); color:var(--cyan-soft); }
.note-file-selection { min-height:18px; color:var(--cyan-soft); font-size:11px; overflow-wrap:anywhere; }
.note-attachments { padding:12px; border:1px solid var(--line-soft); border-radius:.3rem; background:color-mix(in srgb,var(--panel-2) 75%,transparent); }
.note-no-attachments { margin:0; font-size:11px; }
.note-attachment-list { display:grid; gap:7px; }
.note-attachment-row { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--line-soft); border-radius:.25rem; background:var(--panel); }
.note-attachment-row > span { color:var(--cyan-soft); font-size:18px; }
.note-attachment-row a { display:grid; min-width:0; color:var(--text); text-decoration:none; }
.note-attachment-row a:hover strong { color:var(--cyan-soft); }
.note-attachment-row strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.note-attachment-row small { margin-top:3px; color:var(--muted); font-size:9px; }
.note-attachment-row button { width:28px; height:28px; padding:0; border:1px solid color-mix(in srgb,var(--danger) 38%,var(--line-soft)); border-radius:.25rem; background:transparent; color:var(--danger); font-size:18px; }
.note-upload-status:not(:empty) { padding:9px 11px; border:1px solid color-mix(in srgb,var(--cyan) 35%,var(--line-soft)); background:color-mix(in srgb,var(--cyan) 6%,transparent); color:var(--cyan-soft); font-size:11px; }
#simple-modal:has(.note-form) .modal-card { width:min(860px,94vw); }
html.light .note-card { background:color-mix(in srgb,var(--note-accent) 9%,#f9fcfd); }
.note-detail-toolbar { align-items:center; }
.note-detail-toolbar > div:first-child p { margin-top:5px; }
.note-detail-layout { display:grid; grid-template-columns:minmax(0,1fr) 280px; gap:20px; align-items:start; max-width:1180px; margin:0 auto; }
.note-detail-sheet { --note-accent:var(--cyan); min-width:0; min-height:58vh; padding:clamp(28px,4vw,48px); border:1px solid color-mix(in srgb,var(--note-accent) 24%,var(--line-soft)); border-top:4px solid var(--note-accent); border-radius:.25rem; background:color-mix(in srgb,var(--note-accent) 6%,var(--panel)); box-shadow:0 10px 28px rgba(0,0,0,.15); }
.note-detail-sheet.note-gold { --note-accent:var(--gold); }
.note-detail-sheet.note-green { --note-accent:var(--success); }
.note-detail-sheet.note-rose { --note-accent:var(--danger); }
.note-detail-sheet.note-slate { --note-accent:#758a99; }
.note-detail-status { display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--note-accent); font-size:10px; font-weight:800; letter-spacing:.13em; }
.note-detail-status strong { font-size:9px; }
.note-detail-sheet > h1 { margin:18px 0 0; overflow-wrap:anywhere; font-size:clamp(28px,4vw,42px); line-height:1.14; }
.note-detail-rule { width:90px; height:3px; margin:18px 0; background:linear-gradient(90deg,var(--note-accent),transparent); }
.note-detail-meta { display:flex; flex-wrap:wrap; gap:8px 18px; padding-bottom:20px; border-bottom:1px solid color-mix(in srgb,var(--note-accent) 18%,var(--line-soft)); color:var(--muted); font-size:11px; }
.note-detail-sheet .note-reader { min-height:0; padding-top:26px; }
.note-detail-sheet .note-reader > :first-child { margin-top:0; }
.note-detail-attachments { position:sticky; top:calc(var(--topbar-height) + 18px); margin:0; }
.note-detail-attachments-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.note-detail-attachments-heading .eyebrow { margin-bottom:4px; }
.note-detail-attachments-heading h2 { margin:0; font-size:17px; }
.note-detail-attachments-heading > span { display:grid; place-items:center; min-width:28px; height:28px; padding:0 7px; border:1px solid var(--line-soft); border-radius:.25rem; color:var(--cyan-soft); font-size:11px; }
html.light .note-detail-sheet { background:color-mix(in srgb,var(--note-accent) 8%,#f9fcfd); box-shadow:0 10px 25px rgba(20,48,63,.11); }
@media (max-width:1050px) { .notes-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:900px) { .note-detail-layout { grid-template-columns:1fr; } .note-detail-attachments { position:static; } }
@media (max-width:760px) { .note-filters,.notes-grid { grid-template-columns:1fr; } .note-card { min-height:180px; } .note-format-toolbar #note-add-files { margin-left:0; } .note-detail-toolbar .header-actions { width:100%; } .note-detail-toolbar .header-actions > * { flex:1 1 130px; } .note-detail-sheet { min-height:0; padding:24px 20px; } }

/* Personal planning: calendar, agenda and tasks */
.planning-header { align-items: flex-end; }
.planning-toolbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-bottom: 16px; }
.planning-toolbar > div { display: flex; gap: 7px; }
.planning-toolbar > div:last-child { justify-self: end; }
.planning-toolbar h2 { margin: 0; font-size:20px; text-transform: capitalize; }
.planning-layout { display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: 18px; align-items: start; }
.planning-main { padding: 0; overflow: hidden; }
.planning-weekdays { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size:11px; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.planning-weekdays span { padding: 9px; }
.planning-calendar { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); grid-template-rows: repeat(6,minmax(112px,auto)); }
.planning-calendar.week-view { grid-template-rows: minmax(360px,auto); }
.planning-day { min-width: 0; padding: 8px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb,var(--panel) 96%,transparent); }
.planning-day:nth-child(7n) { border-right: 0; }
.planning-day.outside { opacity: .45; }
.planning-day.today { box-shadow: inset 0 0 0 1px var(--gold); background: color-mix(in srgb,var(--gold) 5%,var(--panel)); }
.planning-day > header { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size:12px; }
.planning-day.today > header span { display: grid; place-items: center; width: 24px; height: 24px; margin-top: -3px; border-radius: 50%; background: var(--gold); color: #09121d; font-weight: 800; }
.planning-day > div { display: grid; gap: 4px; }
.planning-entry { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 5px; width: 100%; min-width: 0; padding: 5px 6px; border: 1px solid transparent; border-left: 3px solid var(--cyan); border-radius: .25rem; background: var(--panel-2); color: var(--text); text-align: left; font-size:10px; }
.planning-entry b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.planning-entry small { color: var(--muted); font-size:9px; }
.planning-entry:hover { border-color: var(--cyan); }
.planning-entry.event-learning,.planning-entry.event-review { border-left-color: var(--gold); }
.planning-entry.learning-due { border-left-color:var(--success); background:color-mix(in srgb,var(--success) 7%,var(--panel-2)); }
.planning-entry.learning-due > span { color:var(--success); }
.planning-entry.event-deadline,.planning-entry.priority-high { border-left-color: var(--danger); }
.planning-entry.priority-low { border-left-color: var(--success); }
.planning-entry.done { opacity: .5; text-decoration: line-through; }
.planning-side { position:sticky; top:calc(var(--topbar-height) + 16px); display:grid; gap:12px; min-width:0; }
.planning-task-panel { position:static; }
.planning-task-list { display: grid; gap: 2px; }
.planning-task-list article { display: flex; align-items: center; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.planning-task-list label { display: flex; align-items: flex-start; gap: 9px; min-width: 0; flex: 1; cursor: pointer; }
.planning-task-list label span { display: grid; gap: 4px; min-width: 0; }
.planning-task-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size:12px; }
.planning-task-list small { color: var(--muted); font-size:10px; }
.planning-task-list article > button { padding: 3px; border: 0; background: transparent; color: var(--cyan-soft); font-size:10px; }
.planning-agenda { padding: 18px; }
.planning-agenda h3 { margin: 18px 0 8px; color: var(--muted); font-size:12px; text-transform: capitalize; }
.planning-agenda h3:first-child { margin-top: 0; }
.planning-agenda-row { display: grid; grid-template-columns: minmax(180px,36%) minmax(0,1fr); gap: 16px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.planning-agenda-row p { margin: 0 0 7px; color: var(--muted); font-size:12px; }
.planning-reference { padding: 0; border: 0; background: transparent; color: var(--cyan-soft); font-size:11px; }
.planning-learning-panel { padding:16px; }
.planning-learning-list { display:grid; }
.planning-learning-list > button { display:flex; align-items:center; gap:9px; width:100%; padding:9px 2px; border:0; border-top:1px solid var(--line-soft); background:transparent; color:var(--text); text-align:left; }
.planning-learning-list > button:hover { background:color-mix(in srgb,var(--success) 6%,transparent); }
.planning-learning-list > button > span { display:grid; flex:1; min-width:0; gap:3px; }
.planning-learning-list strong { font-size:11px; }
.planning-learning-list small { color:var(--muted); font-size:9px; }
.planning-learning-list b { color:var(--success); font-weight:500; }
.planning-agenda-row.learning { border-left:2px solid var(--success); padding-left:10px; }
html.light .planning-day { background: #fff; }
html.light .planning-day.today { background: #fff9ec; }
@media (max-width: 1050px) { .planning-layout { grid-template-columns: 1fr; } .planning-side { position:static; grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) {
  .planning-header { align-items: stretch; }
  .planning-header .header-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .planning-header #planning-feed { grid-column: 1/-1; }
  .planning-toolbar { grid-template-columns: 1fr auto; }
  .planning-toolbar h2 { grid-row: 1; grid-column: 2; font-size:15px; }
  .planning-toolbar .view-switch { grid-column: 1/-1; justify-self: stretch; }
  .planning-toolbar .view-switch button { flex: 1; }
  .planning-main { overflow-x: auto; }
  .planning-weekdays,.planning-calendar { min-width: 760px; }
  .planning-agenda { min-width: 0; }
  .planning-agenda-row { grid-template-columns: 1fr; gap: 7px; }
  .planning-side { grid-template-columns:1fr; }
}

/* Ausbildungsnachweise */
.training-report-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.training-report-list { padding: 0; overflow: hidden; }
.training-report-list-head,.training-report-list article > .training-report-open { display: grid; grid-template-columns: 1.15fr 1.3fr 1fr .6fr .65fr; align-items: center; gap: 14px; }
.training-report-list-head { padding: 10px 70px 10px 18px; border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb,var(--panel-2) 82%,transparent); color: var(--muted); font-size:10px; letter-spacing: .08em; text-transform: uppercase; }
.training-report-list article { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 0 14px 0 0; border-bottom: 1px solid var(--line-soft); }
.training-report-list article:last-child { border-bottom: 0; }
.training-report-open { width: 100%; min-width: 0; padding: 15px 18px; border: 0; background: transparent; color: var(--text); text-align: left; }
.training-report-open:hover { background: color-mix(in srgb,var(--cyan) 5%,transparent); }
.training-report-open > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.training-report-open strong,.training-report-open small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.training-report-open strong { font-size:13px; }
.training-report-open small { margin-top: 4px; color: var(--muted); font-size:10px; }
.report-status { width: max-content; padding: 4px 7px; border: 1px solid var(--line-soft); border-radius: 999px; color: var(--muted); font-size:10px; }
.report-status.complete { border-color: color-mix(in srgb,var(--success) 45%,transparent); background: color-mix(in srgb,var(--success) 9%,transparent); color: var(--success); }
#simple-modal:has(.training-report-form) .modal-card { width: min(920px,94vw); max-width: 920px; height: min(92vh,900px); height: min(92dvh,900px); }
.modal-card { display: flex; flex-direction: column; overflow: hidden; }
.modal-card > .modal-header { flex: 0 0 auto; }
.modal-card > .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.modal-fixed-layout { display: flex; flex-direction: column; padding: 0!important; overflow: hidden!important; }
.modal-fixed-form { display: flex!important; flex-direction: column; flex: 1 1 auto; gap: 0!important; min-height: 0; max-height: none; padding: 0!important; overflow: hidden; }
.modal-scroll-content { flex: 1 1 auto; min-height: 0; padding: 22px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.modal-fixed-form > .modal-scroll-content { display: grid; gap: 18px; }
.modal-fixed-form > .modal-actions,.modal-fixed-layout > .modal-actions { z-index: 4; flex: 0 0 auto; margin: 0; padding: 15px 22px; border-top: 1px solid var(--line-soft); background: color-mix(in srgb,var(--panel) 96%,transparent); box-shadow: 0 -4px 12px rgba(0,0,0,.16); backdrop-filter: blur(14px); }
html.light .modal-fixed-form > .modal-actions,html.light .modal-fixed-layout > .modal-actions { background: rgba(247,251,253,.97); }
#editor-modal .editor-card { display: flex; flex-direction: column; overflow: hidden; }
#editor-modal .editor-card > .modal-fixed-form { flex: 1 1 auto; min-height: 0; }
.report-days { margin: 4px 0 16px; padding: 12px; border: 1px solid var(--line-soft); border-radius: .3rem; }
.report-days legend { padding: 0 8px; color: var(--cyan-soft); font-size:11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.report-day-row { display: grid; grid-template-columns: 80px minmax(0,1fr) 90px; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.report-day-row:last-child { border-bottom: 0; }
.report-day-row > strong { padding-top: 10px; font-size:12px; }
.report-day-row textarea { min-height: 54px; resize: vertical; }
.report-day-row label { gap: 3px; color: var(--muted); font-size:9px; }
.report-created { text-align: center; }
.report-created .success-mark { display: grid; place-items: center; width: 58px; height: 58px; margin: 4px auto 18px; border: 1px solid var(--success); border-radius: 50%; color: var(--success); font-size:28px; }
.report-created p { color: var(--muted); line-height: 1.65; }

/* Kantige Arbeitsbereiche und besser erkennbare Formfelder */
.sidebar,.article-side-sections,.side-panel,.article-toolbar { border-radius: 0!important; }
input:not([type="checkbox"]):not([type="radio"]),select,textarea { border-color:rgba(255,255,255,.17)!important; }
input:not([type="checkbox"]):not([type="radio"]):focus,select:focus,textarea:focus { border-color:rgba(255,255,255,.38)!important;box-shadow:0 0 0 2px rgba(255,255,255,.055); }
html.light input:not([type="checkbox"]):not([type="radio"]),html.light select,html.light textarea { border-color:rgba(23,48,64,.24)!important; }
html.light input:not([type="checkbox"]):not([type="radio"]):focus,html.light select:focus,html.light textarea:focus { border-color:rgba(23,48,64,.5)!important;box-shadow:0 0 0 2px rgba(23,48,64,.065); }

/* Compact form controls; organizational editor fields use neutral borders. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),select { min-height:36px;padding-top:8px;padding-bottom:8px; }
textarea { padding-top:8px!important;padding-bottom:8px!important; }
.article-form label { gap:6px; }
.editor-teaching-field .editor-teaching-controls select,
.editor-checklist-field .editor-checklist-row > input { border-color:rgba(255,255,255,.16)!important;background:rgba(0,0,0,.12);box-shadow:none!important; }
.editor-teaching-field .editor-teaching-controls select:focus,
.editor-checklist-field .editor-checklist-row > input:focus { border-color:rgba(255,255,255,.34)!important;box-shadow:0 0 0 2px rgba(255,255,255,.055)!important; }
html.light .editor-teaching-field .editor-teaching-controls select,
html.light .editor-checklist-field .editor-checklist-row > input { border-color:rgba(23,48,64,.24)!important;background:#fff; }
html.light .editor-teaching-field .editor-teaching-controls select:focus,
html.light .editor-checklist-field .editor-checklist-row > input:focus { border-color:rgba(23,48,64,.48)!important;box-shadow:0 0 0 2px rgba(23,48,64,.06)!important; }

/* Einheitliches Outline-Design für alle Aktionen in der rechten Artikel-Sidebar. */
.article-side-sections button,
.article-side-sections .article-side-document > a {
  padding: 7px 10px;
  border: 1px solid #2c9bc8;
  border-radius: .25rem;
  background: rgba(47,156,203,.06);
  color: #005f80;
  font-size:11px;
  cursor: pointer;
}
.article-side-sections button:hover,
.article-side-sections button:focus-visible,
.article-side-sections .article-side-document > a:hover,
.article-side-sections .article-side-document > a:focus-visible {
  border-color: #2c9bc8;
  background: rgba(47,156,203,.14);
  color: #b1eaff;
}
.article-side-sections .side-panel > .side-link + .side-link { margin-top:6px; }
.article-side-sections .mini-action { border-style:solid; }
.article-side-sections .mini-action + .mini-action { margin-top:6px; }
.article-side-sections .tag-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.article-side-sections .article-tag-link { width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.article-side-sections .article-side-document > button { padding:7px; }
.article-side-sections .article-side-document > a { width:28px; height:28px; padding:0; }
.article-side-sections .file-row .x-button { width:30px; padding:3px 7px; color:#b1eaff; }
html.light .article-side-sections button,
html.light .article-side-sections .article-side-document > a { color:#005f80; }
html:not(.light) .article-side-sections .toc-panel .side-link { color:#c9e3ed; }
html:not(.light) .article-side-sections .toc-panel .side-link:hover,
html:not(.light) .article-side-sections .toc-panel .side-link:focus-visible { color:#e7f7fb; }
html:not(.light) .article-side-sections .toc-panel .toc-active { color:var(--gold); }
@media (max-width: 760px) {
  .mobile-dock { box-shadow: 0 -4px 12px rgba(0,0,0,.16); }
  .mobile-dock .mobile-create { box-shadow: 0 3px 9px rgba(10,154,191,.22); }
}
@media (max-width: 800px) {
  .training-report-stats { grid-template-columns: 1fr; }
  .training-report-list-head { display: none; }
  .training-report-list article { padding: 0 10px 0 0; }
  .training-report-list article > .training-report-open { grid-template-columns: 1fr auto; gap: 9px; }
  .training-report-open > span:nth-child(3) { grid-column: 1; }
  .training-report-open > span:nth-child(4),.training-report-open > span:nth-child(5) { grid-column: 2; }
  .report-day-row { grid-template-columns: 1fr 78px; }
  .report-day-row > strong { grid-column: 1/-1; }
  #simple-modal:has(.training-report-form) .modal-card { width: 100%; height: 100%; max-height: 100dvh; }
  .modal-fixed-form > .modal-actions,.modal-fixed-layout > .modal-actions { flex-wrap: wrap; }
}

/* Paper-like reading surface for the article view. */
.article-content .article-view {
  --paper: var(--paper-dark);
  --paper-ink: #dce9f2;
  --paper-heading: #f0f8fc;
  --paper-muted: #91a9bc;
  --paper-line: rgba(139,231,255,.16);
  --paper-accent: #65d7f3;
  --paper-quote: #b9cad3;
  --paper-callout: #c9d7de;
  --paper-warning: #ff9da5;
  --paper-exam: #f2c56f;
  --paper-success: #78d8ab;
  --paper-inline-code: #a9e5f4;
  position: relative;
  min-height: 70vh;
  padding: clamp(28px,4.5vw,52px);
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 2px;
  background:
    radial-gradient(circle at 14% 8%, rgba(56,213,255,.055), transparent 36%),
    linear-gradient(112deg, rgba(56,213,255,.018), transparent 26%, rgba(255,255,255,.018) 64%, rgba(0,0,0,.08)),
    var(--paper);
  color: var(--paper-ink);
  box-shadow: 0 18px 44px rgba(0,0,0,.24), 0 3px 10px rgba(0,0,0,.15);
}
html.light .article-content .article-view {
  --paper: #fffdf8;
  --paper-ink: #27343b;
  --paper-heading: #173b4a;
  --paper-muted: #64727a;
  --paper-line: rgba(35,65,76,.16);
  --paper-accent: #087896;
  --paper-quote: #495960;
  --paper-callout: #34474f;
  --paper-warning: #9b3f48;
  --paper-exam: #8c5d08;
  --paper-success: #267052;
  --paper-inline-code: #174d61;
  border-color: rgba(35,65,76,.13);
  background:
    radial-gradient(circle at 14% 8%, rgba(255,255,255,.72), transparent 36%),
    linear-gradient(112deg, rgba(116,91,48,.025), transparent 26%, rgba(255,255,255,.2) 64%, rgba(91,72,42,.025)),
    var(--paper);
  box-shadow: 0 16px 38px rgba(28,52,65,.14), 0 3px 9px rgba(28,52,65,.08);
}
.article-content .article-view > h1,
.article-content .article-view .article-body { color: var(--paper-ink); }
.article-content .article-view .article-summary,
.article-content .article-view .article-meta,
.article-content .article-view .article-figure figcaption { color: var(--paper-muted); }
.article-content .article-view .article-body h1,
.article-content .article-view .article-body h2 { color: var(--paper-heading); }
.article-content .article-view .article-body h2 { border-top-color: var(--paper-line); }
.article-content .article-view .article-body h3,
.article-content .article-view .article-body h4,
.article-content .article-view .source-link,
.article-content .article-view .glossary-link { color: var(--paper-accent); }
.article-content .article-view .article-toolbar {
  border-bottom-color: var(--paper-line);
  background: color-mix(in srgb,var(--paper) 94%,transparent);
}
.article-content .article-view .article-toolbar .secondary-button { color: var(--paper-muted); }
.article-content .article-view .article-toolbar .secondary-button:hover,
.article-content .article-view .article-toolbar .secondary-button:focus-visible {
  border-color: var(--paper-line);
  background: rgba(24,89,112,.07);
  color: var(--paper-heading);
}
.article-content .article-view .article-body blockquote {
  border-left-color: #b7842e;
  background: rgba(183,132,46,.07);
  color: var(--paper-quote);
}
.article-content .article-view .article-body .callout { color: var(--paper-callout); }
.article-content .article-view .article-body .callout > strong { color: var(--paper-accent); }
.article-content .article-view .article-body .callout.warning > strong { color: var(--paper-warning); }
.article-content .article-view .article-body .callout.exam > strong { color: var(--paper-exam); }
.article-content .article-view .article-body .callout:is(.tip,.merksatz) > strong { color: var(--paper-success); }
.article-content .article-view .article-body pre,
.article-content .article-view .article-body pre code { color: #e8f3f9; }
html.light .article-content .article-view .article-body pre,
html.light .article-content .article-view .article-body pre code { color: #173040; }
html.light .article-content .article-view .article-body pre.code-block .tok-key { color: #075f7c; }
html.light .article-content .article-view .article-body pre.code-block .tok-str { color: #764600; }
.article-content .article-view .article-body :not(pre) > code {
  padding: .08em .32em;
  border: 1px solid var(--paper-line);
  border-radius: .2rem;
  background: rgba(28,67,83,.06);
  color: var(--paper-inline-code);
}
.article-content .article-view .article-body th,
.article-content .article-view .article-body td { border-color: var(--paper-line); }
.article-content .article-view .article-body th { background: rgba(25,91,116,.07); color: var(--paper-heading); }
.article-content .article-view .fact-grid > div,
.article-content .article-view .image-gallery a {
  border-color: var(--paper-line);
  background: rgba(28,83,104,.035);
}
.article-content .article-view .fact-grid small,
.article-content .article-view .image-gallery span { color: var(--paper-muted); }
.article-content .article-view .pdf-embed,
.article-content .article-view .article-sequence-navigation { border-color: var(--paper-line); }
.article-content .article-view .pdf-embed summary { color: var(--paper-accent); }
.article-content .article-view .article-sequence-nav-button,
.article-content .article-view .article-sequence-nav-empty {
  border-color: var(--paper-line);
  background: rgba(27,78,97,.04);
  color: var(--paper-ink);
}
.article-content .article-view .article-sequence-nav-button:hover,
.article-content .article-view .article-sequence-nav-button:focus-visible { background: rgba(27,112,143,.09); }
.article-content .article-view .article-sequence-nav-button small,
.article-content .article-view .article-sequence-nav-empty small { color: var(--paper-accent); }
.article-content .article-view .article-sequence-nav-empty { color: var(--paper-muted); }
@media (max-width: 760px) {
  .article-content .article-view {
    min-height: 0;
    margin-right: -6px;
    margin-left: -6px;
    padding: 24px 20px;
    box-shadow: 0 10px 26px rgba(0,0,0,.2), 0 2px 7px rgba(0,0,0,.11);
  }
}
@media print {
  .article-content .article-view {
    min-height: 0;
    padding: 0;
    border: 0;
    background: #fff;
    box-shadow: none;
  }
}

/* Dashboard V3: focused, task-oriented overview */
.content.dashboard-content {
  width:100%;
  max-width:1540px;
  margin:0 auto;
  padding:28px 30px 72px;
}
.dashboard-overview { display:grid; gap:18px; }
.dashboard-overview .dashboard-hero {
  position:relative;
  display:grid;
  grid-template-columns:minmax(0,1fr) 250px;
  min-height:230px;
  padding:30px 32px;
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--cyan) 30%,var(--line-soft));
  background:
    radial-gradient(circle at 82% 20%,rgba(56,213,255,.14),transparent 27%),
    linear-gradient(125deg,color-mix(in srgb,var(--panel-2) 92%,#0b3347),var(--panel));
  box-shadow:0 10px 28px rgba(0,0,0,.13);
}
.dashboard-overview .dashboard-hero::after {
  content:"";
  position:absolute;
  right:-85px;
  bottom:-130px;
  width:360px;
  height:360px;
  border:1px solid rgba(56,213,255,.12);
  border-radius:50%;
  box-shadow:0 0 0 42px rgba(56,213,255,.025),0 0 0 84px rgba(56,213,255,.018);
  pointer-events:none;
}
.dashboard-hero-copy { position:relative; z-index:1; align-self:center; }
.dashboard-hero-copy .eyebrow { margin-bottom:12px; }
.dashboard-hero-copy h1 { max-width:760px; font-size:clamp(30px,3.4vw,46px); line-height:1.08; }
.dashboard-hero-copy p { margin:12px 0 0; color:var(--muted); font-size:15px; }
.dashboard-hero-actions { display:flex; flex-wrap:wrap; gap:9px; margin-top:24px; }
.dashboard-hero-actions button { min-width:145px; }
.dashboard-hero-focus {
  position:relative;
  z-index:1;
  align-self:stretch;
  display:grid;
  align-content:end;
  justify-items:end;
}
.dashboard-hero-focus > span { color:var(--cyan-soft); font-size:10px; font-weight:750; letter-spacing:.13em; }
.dashboard-hero-focus > strong { margin:8px 0 5px; color:var(--text); font-size:58px; line-height:1; }
.dashboard-hero-focus > small { max-width:170px; color:var(--muted); font-size:11px; line-height:1.55; }

.dashboard-overview .dashboard-stats { grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.dashboard-overview .dashboard-stat {
  position:relative;
  min-height:116px;
  padding:17px 16px;
  border-color:color-mix(in srgb,var(--stat-accent) 34%,var(--line-soft));
  background:linear-gradient(145deg,color-mix(in srgb,var(--stat-accent) 7%,var(--panel-2)),var(--panel));
  box-shadow:0 6px 18px rgba(0,0,0,.1);
  transition:transform .16s,border-color .16s,box-shadow .16s;
}
.dashboard-overview .dashboard-stat:hover { filter:none; border-color:color-mix(in srgb,var(--stat-accent) 70%,var(--line-soft)); box-shadow:0 10px 24px rgba(0,0,0,.16); }
.dashboard-overview .dashboard-stat-icon { flex-basis:42px; width:42px; height:42px; font-size:21px; }
.dashboard-overview .dashboard-stat-copy { align-self:stretch; align-content:center; gap:3px; }
.dashboard-overview .dashboard-stat-copy > span { order:0; margin:0; color:var(--muted); font-size:10px; font-weight:750; letter-spacing:.09em; text-transform:uppercase; }
.dashboard-overview .dashboard-stat-copy > strong { order:1; margin-top:2px; font-size:28px; }
.dashboard-overview .dashboard-stat-copy > small { order:2; margin-top:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dashboard-stat-arrow { position:absolute; top:12px; right:13px; color:var(--stat-accent); font-size:14px; opacity:.6; }

.dashboard-overview .dashboard-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(285px,320px);
  align-items:start;
  gap:16px;
}
.dashboard-overview .dashboard-main { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; }
.dashboard-overview .dashboard-rail { position:static; display:grid; grid-template-columns:minmax(0,1fr); gap:16px; width:auto; height:auto; padding:0; overflow:visible; border:0; background:transparent; box-shadow:none; }
.dashboard-overview .dashboard-panel {
  padding:20px;
  border-color:color-mix(in srgb,var(--line) 40%,var(--line-soft));
  background:linear-gradient(150deg,color-mix(in srgb,var(--panel-2) 72%,var(--panel)),var(--panel));
  box-shadow:0 7px 20px rgba(0,0,0,.1);
}
.dashboard-overview .dashboard-panel-heading { align-items:flex-start; min-height:34px; margin-bottom:15px; }
.dashboard-overview .dashboard-panel-heading h2,.dashboard-overview .dashboard-quick h2 { margin:2px 0 0; font-size:17px; }
.dashboard-section-kicker { display:block; color:var(--cyan); font-size:9px; font-weight:750; letter-spacing:.14em; }
.dashboard-overview .dashboard-panel-heading > button { padding:4px 0; color:var(--cyan-soft); }
.dashboard-focus-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0; border-top:1px solid var(--line-soft); }
.dashboard-focus-column { min-width:0; padding:17px 18px 0 0; }
.dashboard-focus-column + .dashboard-focus-column { padding-right:0; padding-left:18px; border-left:1px solid var(--line-soft); }
.dashboard-subheading { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:5px; }
.dashboard-subheading h3 { margin:0; font-size:12px; }
.dashboard-subheading > span { display:grid; place-items:center; min-width:24px; height:24px; padding:0 6px; border:1px solid var(--line-soft); color:var(--cyan-soft); font-size:10px; }
.dashboard-overview .dashboard-list-row { min-height:55px; padding:8px 5px; border-top-color:var(--line-soft); }
.dashboard-overview .dashboard-list-row:first-child { border-top:0; }
.dashboard-overview .dashboard-list-row:hover { background:color-mix(in srgb,var(--cyan) 6%,transparent); }
.dashboard-overview .dashboard-row-icon { border-color:var(--line-soft); background:color-mix(in srgb,var(--cyan) 7%,var(--panel-2)); color:var(--cyan-soft); }
.dashboard-agenda-time { flex:0 0 auto; color:var(--gold); font-size:10px; }
.dashboard-focus-column > .dashboard-outline-button { margin-top:12px; }
.dashboard-empty { margin:15px 0; padding:12px; border:1px dashed var(--line-soft); color:var(--muted); }
.dashboard-empty-success { display:grid; justify-items:center; gap:4px; min-height:130px; align-content:center; text-align:center; }
.dashboard-empty-success > span { color:var(--success); font-size:22px; }
.dashboard-empty-success > strong { color:var(--text); font-size:12px; }
.dashboard-empty-success > small { font-size:10px; }

.dashboard-recent .dashboard-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:22px; }
.dashboard-recent .dashboard-list-row:nth-child(-n+2) { border-top:0; }
.dashboard-overview .dashboard-recommend-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.dashboard-overview .dashboard-recommend-card { grid-template-rows:62px minmax(0,1fr); min-height:195px; border-color:var(--line-soft); background:var(--panel-2); box-shadow:none; }
.dashboard-overview .dashboard-recommend-card:hover { border-color:var(--cyan); }
.dashboard-overview .dashboard-recommend-art { font-size:30px; }
.dashboard-overview .dashboard-recommend-body { padding:11px; }
.dashboard-overview .recent-panel { margin:0; }

.dashboard-overview .dashboard-progress-top { padding:15px 0 17px; margin:0; border-bottom:1px solid var(--line-soft); }
.dashboard-overview .dashboard-progress-ring { flex-basis:86px; width:86px; height:86px; }
.dashboard-overview .dashboard-progress-ring::before { width:64px; height:64px; background:var(--panel); }
.dashboard-overview .dashboard-progress-ring strong { font-size:20px; }
.dashboard-overview .dashboard-progress-legend { gap:2px; margin:12px 0 0; }
.dashboard-overview .dashboard-progress-filter { min-height:29px; padding:5px 7px; }
.dashboard-overview .dashboard-progress-filter:hover { background:rgba(56,213,255,.06); }
.dashboard-quick { display:block; }
.dashboard-quick-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; margin-top:15px; }
.dashboard-quick-grid > button {
  display:grid;
  grid-template-columns:34px minmax(0,1fr);
  grid-template-rows:auto auto;
  min-width:0;
  padding:10px;
  border:1px solid var(--line-soft);
  background:rgba(56,213,255,.025);
  color:var(--text);
  text-align:left;
}
.dashboard-quick-grid > button:hover { border-color:var(--cyan); background:rgba(56,213,255,.07); }
.dashboard-quick-grid > button > span { grid-row:1/3; align-self:center; color:var(--cyan); font-size:21px; }
.dashboard-quick-grid > button > strong { overflow:hidden; font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.dashboard-quick-grid > button > small { overflow:hidden; color:var(--muted); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.dashboard-collection-list { display:grid; }
.dashboard-overview .dashboard-collection-row { min-height:45px; padding:7px 3px; border-top-color:var(--line-soft); }
.dashboard-overview .dashboard-collection-row:first-child { border-top:0; }

html.light .dashboard-overview .dashboard-hero {
  border-color:#9bbdca;
  background:radial-gradient(circle at 82% 20%,rgba(20,154,194,.12),transparent 27%),linear-gradient(125deg,#f9fcfd,#e7f1f5);
  box-shadow:0 9px 24px rgba(19,45,61,.1);
}
html.light .dashboard-overview .dashboard-hero::after { border-color:rgba(10,116,151,.13); box-shadow:0 0 0 42px rgba(10,116,151,.025),0 0 0 84px rgba(10,116,151,.018); }
html.light .dashboard-overview .dashboard-panel,html.light .dashboard-overview .dashboard-stat { background:#fff; border-color:#a9c0cb; box-shadow:0 5px 15px rgba(19,45,61,.08); }
html.light .dashboard-overview .dashboard-progress-ring::before { background:#fff; }
html.light .dashboard-quick-grid > button { background:#f6fafb; color:var(--text); }
html.light .dashboard-overview .dashboard-row-icon { background:#e9f3f6; }

@media (max-width:1250px) {
  .dashboard-overview .dashboard-layout { grid-template-columns:minmax(0,1fr) 280px; }
  .dashboard-overview .dashboard-recommend-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:1000px) {
  .dashboard-overview .dashboard-layout { grid-template-columns:minmax(0,1fr); }
  .dashboard-overview .dashboard-rail { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dashboard-overview .dashboard-collections { grid-column:1/-1; }
}
@media (max-width:760px) {
  .content.dashboard-content { padding:18px 14px 84px; }
  .dashboard-overview .dashboard-hero { grid-template-columns:minmax(0,1fr); min-height:0; padding:24px 20px; }
  .dashboard-hero-focus { display:none; }
  .dashboard-hero-copy h1 { font-size:31px; }
  .dashboard-overview .dashboard-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dashboard-overview .dashboard-stat { min-height:100px; padding:12px 10px; }
  .dashboard-overview .dashboard-stat-icon { flex-basis:34px; width:34px; height:34px; font-size:18px; }
  .dashboard-overview .dashboard-stat-copy > strong { font-size:23px; }
  .dashboard-focus-grid,.dashboard-recent .dashboard-list { grid-template-columns:minmax(0,1fr); }
  .dashboard-focus-column { padding-right:0; }
  .dashboard-focus-column + .dashboard-focus-column { margin-top:18px; padding:18px 0 0; border-top:1px solid var(--line-soft); border-left:0; }
  .dashboard-recent .dashboard-list-row:nth-child(2) { border-top:1px solid var(--line-soft); }
  .dashboard-overview .dashboard-rail { grid-template-columns:minmax(0,1fr); }
  .dashboard-overview .dashboard-collections { grid-column:auto; }
}
@media (max-width:440px) {
  .dashboard-overview .dashboard-stat { display:grid; grid-template-columns:34px minmax(0,1fr); gap:8px; }
  .dashboard-overview .dashboard-stat-copy > small,.dashboard-stat-arrow { display:none; }
  .dashboard-overview .dashboard-recommend-grid { grid-template-columns:minmax(0,1fr); }
}

/* Keep dashboard tools in the established fixed right sidebar on desktop. */
@media (min-width:1160px) {
  .content.dashboard-content {
    max-width:none;
    margin:0;
    padding-right:350px;
  }
  .dashboard-overview .dashboard-layout { display:block; }
  .dashboard-overview .dashboard-main { max-width:1200px; margin:0 auto; }
  .dashboard-overview > .dashboard-hero,
  .dashboard-overview > .dashboard-stats { width:100%; max-width:1200px; margin-right:auto; margin-left:auto; }
  .dashboard-overview .dashboard-rail {
    position:fixed;
    top:var(--topbar-height);
    right:0;
    z-index:16;
    display:flex;
    flex-direction:column;
    gap:0;
    width:320px;
    height:calc(100vh - var(--topbar-height));
    height:calc(100dvh - var(--topbar-height));
    padding:18px 14px 26px;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior-y:contain;
    border-left:1px solid var(--line-soft);
    background:linear-gradient(180deg,rgba(10,23,40,.98),rgba(5,13,24,.98));
    box-shadow:-5px 0 15px rgba(0,0,0,.12);
    scrollbar-width:thin;
    scrollbar-color:rgba(134,170,189,.32) transparent;
  }
  .dashboard-overview .dashboard-rail::-webkit-scrollbar { width:8px; }
  .dashboard-overview .dashboard-rail::-webkit-scrollbar-track { background:transparent; }
  .dashboard-overview .dashboard-rail::-webkit-scrollbar-thumb { background:rgba(134,170,189,.32); }
  .dashboard-overview .dashboard-rail .dashboard-panel {
    flex:0 0 auto;
    padding:4px 5px 19px;
    border:0;
    border-bottom:1px solid var(--line-soft);
    background:transparent;
    box-shadow:none;
  }
  .dashboard-overview .dashboard-rail .dashboard-panel + .dashboard-panel { padding-top:19px; }
  .dashboard-overview .dashboard-rail .dashboard-panel:last-child { border-bottom:0; }
  html.light .dashboard-overview .dashboard-rail {
    background:linear-gradient(180deg,#dce8ee,#cbdce5);
    box-shadow:-5px 0 14px rgba(19,45,61,.11);
    scrollbar-color:rgba(48,91,113,.26) transparent;
  }
  html.light .dashboard-overview .dashboard-rail .dashboard-panel { background:transparent; box-shadow:none; }
}

/* Expanded flashcard learning session */
.learn-page-header { margin-bottom:22px; }
.learn-stat-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.learn-stat-grid > div { display:grid; gap:4px; min-width:0; padding:15px 17px; border:1px solid var(--line-soft); background:linear-gradient(145deg,var(--panel-2),var(--panel)); box-shadow:0 5px 16px rgba(0,0,0,.09); }
.learn-stat-grid span { color:var(--cyan-soft); font-size:9px; font-weight:750; letter-spacing:.11em; text-transform:uppercase; }
.learn-stat-grid strong { margin-top:2px; font-size:27px; line-height:1; }
.learn-stat-grid small { overflow:hidden; color:var(--muted); font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.learn-layout { display:grid; grid-template-columns:minmax(0,1fr) 320px; align-items:start; gap:16px; }
.learn-main { min-width:0; }
.learn-session-progress { display:grid; gap:9px; margin-bottom:12px; padding:13px 16px; border:1px solid var(--line-soft); background:var(--panel); }
.learn-session-progress > div:first-child { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.learn-session-progress > div:first-child span { color:var(--cyan); font-size:9px; font-weight:750; letter-spacing:.12em; }
.learn-session-progress > div:first-child strong { color:var(--muted); font-size:11px; }
.learn-session-progress > div:last-child { height:5px; overflow:hidden; background:rgba(56,213,255,.08); }
.learn-session-progress > div:last-child span { display:block; width:0; height:100%; background:linear-gradient(90deg,var(--cyan),var(--gold)); transition:width .25s ease; }
.learn-layout .review-card { width:100%; max-width:none; min-height:430px; margin:0; padding:38px; box-shadow:0 8px 22px rgba(0,0,0,.12); }
.learn-layout .review-card .card-question { min-height:150px; font-size:clamp(20px,2.5vw,31px); line-height:1.45; }
.review-card-tools { position:absolute; top:14px; left:18px; display:flex; gap:2px; }
.review-card-tools button { padding:3px 5px; border:0; background:transparent; color:var(--muted); font-size:9px; text-decoration:underline; text-decoration-color:transparent; text-underline-offset:3px; opacity:.72; }
.review-card-tools button:hover,.review-card-tools button:focus-visible { color:var(--cyan-soft); text-decoration-color:currentColor; opacity:1; }
.review-card-tools #delete-learn-card:hover,.review-card-tools #delete-learn-card:focus-visible { color:var(--danger); }
.learn-sidebar { position:sticky; top:calc(var(--topbar-height) + 16px); display:grid; gap:12px; min-width:0; }
.learn-side-panel { margin:0; padding:16px; }
.learn-side-heading { margin-bottom:10px; }
.learn-side-heading > span { color:var(--cyan); font-size:8px; font-weight:750; letter-spacing:.14em; }
.learn-side-heading h2 { margin:3px 0 0; font-size:15px; }
.learn-queue-row,.learn-upcoming-row { display:grid; align-items:center; min-width:0; gap:9px; padding:9px 0; border-top:1px solid var(--line-soft); }
.learn-queue-row { grid-template-columns:25px minmax(0,1fr); }
.learn-queue-row > span,.learn-upcoming-icon { display:grid; place-items:center; width:25px; height:25px; border:1px solid var(--line-soft); color:var(--cyan-soft); font-size:9px; }
.learn-queue-row > div,.learn-upcoming-row > span:nth-child(2) { display:grid; min-width:0; gap:2px; }
.learn-queue-row strong,.learn-queue-row small,.learn-upcoming-row strong,.learn-upcoming-row small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.learn-queue-row strong,.learn-upcoming-row strong { font-size:10px; font-weight:650; }
.learn-queue-row small,.learn-upcoming-row small { color:var(--muted); font-size:8px; }
.learn-upcoming-row { grid-template-columns:25px minmax(0,1fr) auto; }
.learn-upcoming-row time { color:var(--gold); font-size:8px; white-space:nowrap; }
.learn-sidebar-empty { margin:0; padding:13px 0; color:var(--muted); font-size:10px; line-height:1.5; }
.learn-rating-help dl { display:grid; gap:0; margin:0; }
.learn-rating-help dl > div { display:grid; grid-template-columns:68px minmax(0,1fr); gap:8px; padding:7px 0; border-top:1px solid var(--line-soft); }
.learn-rating-help dt { color:var(--cyan-soft); font-size:9px; font-weight:700; }
.learn-rating-help dd { margin:0; color:var(--muted); font-size:9px; line-height:1.4; }
html.light .learn-stat-grid > div,html.light .learn-session-progress { border-color:#a9c0cb; background:#fff; box-shadow:0 4px 14px rgba(19,45,61,.07); }
@media (max-width:1050px) {
  .learn-layout { grid-template-columns:minmax(0,1fr); }
  .learn-sidebar { position:static; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .learn-rating-help { grid-column:1/-1; }
}
@media (max-width:760px) {
  .learn-stat-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .learn-layout .review-card { min-height:360px; padding:25px 20px; }
  .learn-layout .review-card .card-question { min-height:120px; }
  .learn-sidebar { grid-template-columns:minmax(0,1fr); }
  .learn-rating-help { grid-column:auto; }
}
@media (max-width:440px) {
  .learn-stat-grid > div { padding:12px; }
  .learn-stat-grid strong { font-size:23px; }
  .learn-stat-grid small { white-space:normal; }
  .learn-session-progress > div:first-child { align-items:flex-start; flex-direction:column; gap:4px; }
}

/* Unified knowledge-base icon sets for dark and light mode. */
.kb-icon {
  display:inline-block;
  width:36px;
  height:27px;
  flex:0 0 auto;
  overflow:hidden;
  background-image:var(--kb-icon-light);
  background-position:center;
  background-repeat:no-repeat;
  background-size:contain;
  color:transparent!important;
  filter:none!important;
  font-size:0!important;
  line-height:0;
  vertical-align:middle;
}
html.light .kb-icon { background-image:var(--kb-icon-dark); }
.kb-icon-dashboard { --kb-icon-dark:url('../images/icons/dashboard.png'); --kb-icon-light:url('../images/icons/dashboard-light.png?v=3.30'); }
.kb-icon-document { --kb-icon-dark:url('../images/icons/document.png'); --kb-icon-light:url('../images/icons/document-light.png?v=3.30'); }
.kb-icon-hierarchy { --kb-icon-dark:url('../images/icons/hierarchy.png'); --kb-icon-light:url('../images/icons/hierarchy-light.png?v=3.30'); }
.kb-icon-search { --kb-icon-dark:url('../images/icons/search.png'); --kb-icon-light:url('../images/icons/search-light.png?v=3.30'); }
.kb-icon-tag { --kb-icon-dark:url('../images/icons/tag.png'); --kb-icon-light:url('../images/icons/tag-light.png?v=3.30'); }
.kb-icon-share { --kb-icon-dark:url('../images/icons/share.png'); --kb-icon-light:url('../images/icons/share-light.png?v=3.30'); }
.kb-icon-link { --kb-icon-dark:url('../images/icons/link.png'); --kb-icon-light:url('../images/icons/link-light.png?v=3.30'); }
.kb-icon-cards { --kb-icon-dark:url('../images/icons/cards.png'); --kb-icon-light:url('../images/icons/cards-light.png?v=3.30'); }
.kb-icon-question { --kb-icon-dark:url('../images/icons/question.png'); --kb-icon-light:url('../images/icons/question-light.png?v=3.30'); }
.kb-icon-media { --kb-icon-dark:url('../images/icons/media.png'); --kb-icon-light:url('../images/icons/media-light.png?v=3.30'); }
.kb-icon-upload { --kb-icon-dark:url('../images/icons/upload.png'); --kb-icon-light:url('../images/icons/upload-light.png?v=3.30'); }
.kb-icon-download { --kb-icon-dark:url('../images/icons/download.png'); --kb-icon-light:url('../images/icons/download-light.png?v=3.30'); }
.kb-icon-user { --kb-icon-dark:url('../images/icons/user.png'); --kb-icon-light:url('../images/icons/user-light.png?v=3.30'); }
.kb-icon-settings { --kb-icon-dark:url('../images/icons/settings.png'); --kb-icon-light:url('../images/icons/settings-light.png?v=3.30'); }
.kb-icon-checklist { --kb-icon-dark:url('../images/icons/checklist.png'); --kb-icon-light:url('../images/icons/checklist-light.png?v=3.30'); }
.kb-icon-book { --kb-icon-dark:url('../images/icons/book.png'); --kb-icon-light:url('../images/icons/book-light.png?v=3.30'); }
.kb-icon-terminal { --kb-icon-dark:url('../images/icons/terminal.png'); --kb-icon-light:url('../images/icons/terminal-light.png?v=3.30'); }
.kb-icon-favorite { --kb-icon-dark:url('../images/icons/favorite.png'); --kb-icon-light:url('../images/icons/favorite-light.png?v=3.30'); }
.kb-icon-trash { --kb-icon-dark:url('../images/icons/trash.png'); --kb-icon-light:url('../images/icons/trash-light.png?v=3.30'); }
.kb-icon-calendar { --kb-icon-dark:url('../images/icons/calendar.png'); --kb-icon-light:url('../images/icons/calendar-light.png?v=3.30'); }
.kb-icon-progress { --kb-icon-dark:url('../images/icons/progress.png'); --kb-icon-light:url('../images/icons/progress-light.png?v=3.30'); }
.kb-icon-assistant { --kb-icon-dark:url('../images/icons/assistant.png'); --kb-icon-light:url('../images/icons/assistant-light.png?v=3.30'); }
.kb-icon-note { --kb-icon-dark:url('../images/icons/note.png'); --kb-icon-light:url('../images/icons/note-light.png?v=3.30'); }
.kb-icon-certificate { --kb-icon-dark:url('../images/icons/certificate.png'); --kb-icon-light:url('../images/icons/certificate-light.png?v=3.30'); }
.sidebar .nav-item > .kb-icon { width:32px!important;height:24px;flex-basis:32px; }
.search-wrap > .search-icon.kb-icon { left:5px;width:34px;height:25.5px; }
.topbar-menu-row > .kb-icon { width:30px!important;height:22.5px;flex-basis:30px; }
.mobile-dock button > .kb-icon { width:34px!important;height:25.5px;margin:auto; }
.dashboard-stat-icon > .kb-icon { width:42px;height:31.5px; }
.dashboard-row-icon > .kb-icon,.dashboard-collection-icon > .kb-icon { width:29px;height:21.75px; }
.dashboard-recommend-art .kb-icon { width:80px;height:60px; }
.dashboard-quick-grid > button { grid-template-columns:48px minmax(0,1fr); }
.dashboard-quick-grid > button > .kb-icon { width:46px!important;height:34.5px;grid-row:1/3;align-self:center; }
@media (max-width:760px) {
  .sidebar .nav-item > .kb-icon { width:34px!important;height:25.5px;flex-basis:34px; }
}

@media (max-width:760px) {
  .auth-card::before { background-image:var(--brand-logo-url); }
}
