: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;
    --radius: .25rem;
    --shadow: 0 7px 20px rgba(0, 0, 0, .18);
}

* { 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; }

.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 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.active::after { content: ""; margin-left: auto; width: 3px; height: 24px; border-radius: .25rem; background: var(--gold); }
.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 { display: grid; gap: 4px; }
.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; }
.gold-line { width: 88px; height: 3px; background: linear-gradient(90deg, var(--gold), transparent); margin-top: 16px; border-radius: .25rem; }

.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; margin-bottom: 18px; }
.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: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: #07111f; border: 1px solid rgba(56,213,255,.18); color: #eef8ff;
    border-radius: .25rem; padding: 11px 12px; 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); }
.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:minmax(0,1fr) 24px; align-items:center; padding-left:calc(var(--depth) * 14px); }
.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 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)}.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)}
.graph-panel{border:1px solid var(--line-soft);border-radius:.25rem;background:radial-gradient(circle at center,rgba(56,213,255,.07),transparent 50%),rgba(5,13,23,.75);overflow:auto}.graph-panel svg{width:100%;min-width:900px;height:auto;display:block}.graph-line{stroke:rgba(56,213,255,.18);stroke-width:1}.graph-node{cursor:pointer}.graph-node circle{fill:var(--panel-3);stroke:var(--cyan);stroke-width:1.5}.graph-node text{fill:#d8eaf5;font-size:11px}.graph-node:hover circle{fill:var(--gold);stroke:var(--gold)}.graph-node:hover text{fill:white}
.collection-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.collection-card{display:flex;flex-direction:column;height:100%;border:1px solid var(--line-soft);border-radius:.25rem;padding:18px;background:rgba(12,25,42,.78)}.collection-card h2{margin:0}.collection-card p{color:var(--muted)}.choice-list{display:grid}.choice-row{padding:12px 4px}
.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; }
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 .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}.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 #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{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:40px}.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:42px}
.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-h3{padding-left:18px;font-size:11px}.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: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:'KB';display:grid;place-items:center;width:46px;height:46px;margin:0 auto 24px;border:1px solid var(--cyan);border-radius:.25rem;color:var(--gold);font-weight:800}.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 .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-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 { width: 32px; height: 32px; font-size:21px; }
  .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; }

/* 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: 12px; }
.article-question-panel .mini-action + .mini-action { margin-top: 6px; }
.article-flashcard-panel .mini-action { margin-top: 12px; }
.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);
}
@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; }
}
@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,
.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 .dashboard-sidebar-scroll {
  --sidebar-scroll-thumb: rgba(48, 91, 113, .26);
}
.sidebar-scroll::-webkit-scrollbar,
.article-sidebar-scroll::-webkit-scrollbar,
.dashboard-sidebar-scroll::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-track,
.article-sidebar-scroll::-webkit-scrollbar-track,
.dashboard-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb,
.article-sidebar-scroll::-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 logout actions 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-logout { margin: 0; }
.topbar-logout .logout-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--gold);
}
@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-logout .logout-button { 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; border-top: 1px solid var(--line-soft); }
.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-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: 760px) { .management-grid { grid-template-columns: minmax(0,1fr); } }

/* Article actions span the top of the article content beside the details rail. */
.content.article-content { padding-top: 0; }
.article-content .article-toolbar {
  position: sticky;
  top: var(--topbar-height);
  z-index: 18;
  gap: 6px;
  margin: 0 0 20px;
  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; }

/* 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}}

/* 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.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-task-panel { position: sticky; top: calc(var(--topbar-height) + 16px); }
.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; }
html.light .planning-day { background: #fff; }
html.light .planning-day.today { background: #fff9ec; }
@media (max-width: 1050px) { .planning-layout { grid-template-columns: 1fr; } .planning-task-panel { position: static; } }
@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; }
}

/* 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(56,213,255,.38)!important; }
input:not([type="checkbox"]):not([type="radio"]):focus,select:focus,textarea:focus { border-color: rgba(56,213,255,.78)!important; box-shadow: 0 0 0 3px rgba(56,213,255,.11); }
html.light input:not([type="checkbox"]):not([type="radio"]),html.light select,html.light textarea { border-color: rgba(0,103,137,.42)!important; }
html.light input:not([type="checkbox"]):not([type="radio"]):focus,html.light select:focus,html.light textarea:focus { border-color: rgba(0,103,137,.78)!important; box-shadow: 0 0 0 3px rgba(0,103,137,.12); }
@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; }
}
