:root {
  --ink: #2b2722;
  --muted: #746d64;
  --paper: #fffdf9;
  --canvas: #f2eee7;
  --line: #e3dcd2;
  --brown: #75482f;
  --brown-dark: #57321f;
  --brown-soft: #eee0d3;
  --sand: #f7f0e5;
  --sage: #4e6b59;
  --sage-soft: #e8f0e9;
  --coral: #a34c43;
  --coral-soft: #f9ebe8;
  --amber: #87611f;
  --amber-soft: #fbf0d6;
  --blue: #41647d;
  --blue-soft: #e6eff5;
  --shadow: 0 16px 46px rgba(69, 47, 30, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 16px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(78, 107, 89, .38); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.eyebrow { display: block; color: var(--brown); font-size: 11px; font-weight: 850; letter-spacing: .095em; text-transform: uppercase; }
.button { min-height: 45px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; border: 1px solid transparent; border-radius: 12px; text-decoration: none; cursor: pointer; font-weight: 780; font-size: 13px; }
.button.primary { border-color: var(--brown); background: var(--brown); color: #fff; box-shadow: 0 7px 18px rgba(117,72,47,.18); }
.button.primary:hover { background: var(--brown-dark); }
.button.secondary { border-color: #cdbdad; background: #fff; color: var(--brown-dark); }
.button.text { min-height: 36px; background: transparent; color: var(--brown); }
.button.danger { border-color: #dab8b2; background: var(--coral-soft); color: var(--coral); }
.button.full { width: 100%; }
.panel { border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 8px 26px rgba(70,49,33,.045); }
.flash { max-width: 1180px; display: flex; align-items: center; gap: 10px; margin: 0 auto 18px; padding: 13px 16px; border: 1px solid; border-radius: 13px; font-size: 13px; font-weight: 700; }
.public-demo-banner { display:flex; align-items:center; gap:14px; margin:18px 0 4px; padding:14px 18px; border:1px solid #d7b45c; border-radius:14px; background:#fff5d8; color:#6e4b12; }
.public-demo-banner strong { white-space:nowrap; text-transform:uppercase; letter-spacing:.06em; font-size:.78rem; }
.public-demo-banner span { line-height:1.45; }
.public-demo-chip { background:#fff0c7 !important; color:#7a5415 !important; }
.demo-readonly-note { margin-top:18px; padding:15px 18px; border-radius:12px; background:#fff5d8; color:#6e4b12; font-weight:700; }
.demo-check { cursor:default; opacity:.65; }
@media (max-width:720px) { .public-demo-banner { align-items:flex-start; flex-direction:column; gap:4px; margin:12px 0 2px; } }
.flash > span { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: white; font-weight: 900; }
.flash-success { border-color: #bdd0c0; background: #f2f8f2; color: #36513f; }
.flash-success > span { background: var(--sage); }
.flash-error { border-color: #e0bbb6; background: #fff4f2; color: #823c36; }
.flash-error > span { background: var(--coral); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0,1fr); }
.sidebar { position: sticky; z-index: 40; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 23px 18px; border-right: 1px solid var(--line); background: rgba(255,253,249,.95); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 4px 18px; border-bottom: 1px solid var(--line); text-decoration: none; }
.brand-mark { width: 51px; height: 51px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 17px; background: var(--brown-soft); overflow: hidden; }
.brand-mark img { width: 49px; height: 49px; object-fit: contain; }
.brand strong, .brand small, .login-brand strong, .login-brand small, .setup-brand strong, .setup-brand small { display: block; }
.brand strong, .login-brand strong, .setup-brand strong { font-size: 14px; }
.brand small, .login-brand small, .setup-brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.demo-chip { width: fit-content; margin: 14px 5px 8px; padding: 6px 9px; border-radius: 999px; background: var(--sage-soft); color: var(--sage); font-size: 9px; font-weight: 850; letter-spacing: .03em; }
.sidebar nav { display: grid; gap: 5px; margin-top: 8px; }
.nav-link { min-height: 46px; display: grid; grid-template-columns: 31px 1fr; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; color: #554f47; text-decoration: none; font-size: 13px; }
.nav-link > span { width: 27px; height: 27px; display: grid; place-items: center; color: var(--brown); font-size: 18px; }
.nav-link b { font-weight: 690; }
.nav-link:hover { background: var(--sand); }
.nav-link.active { background: var(--brown-soft); color: var(--brown-dark); }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.signed-in { display: flex; align-items: center; gap: 10px; margin: 0 4px 10px; }
.signed-in strong, .signed-in small { display: block; }
.signed-in strong { font-size: 12px; }
.signed-in small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--brown); color: #fff; font-size: 11px; font-weight: 850; }
.avatar.large { width: 48px; height: 48px; font-size: 12px; }
.avatar.small { width: 34px; height: 34px; font-size: 9px; }
.text-button { width: 100%; padding: 8px 4px; border: 0; background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: 11px; }
.content-shell { min-width: 0; }
.main-content { width: min(1180px, calc(100% - 56px)); min-height: calc(100vh - 50px); margin: 0 auto; padding: 38px 0 52px; }
.mobile-header { display: none; }
.portal-footer { padding: 0 30px 22px; color: var(--muted); text-align: center; font-size: 9px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-intro > div:first-child { max-width: 760px; }
.page-intro h1 { margin: 7px 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px,4vw,46px); font-weight: 600; line-height: 1.08; letter-spacing: -.025em; }
.page-intro p { margin: 0; color: var(--muted); line-height: 1.6; }

.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { position: relative; min-height: 154px; display: grid; align-content: start; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); text-decoration: none; box-shadow: 0 7px 24px rgba(70,49,33,.035); }
.stat-number { margin-bottom: 8px; font-family: Georgia, serif; font-size: 38px; line-height: 1; }
.stat-card strong { font-size: 14px; }
.stat-card small { max-width: 190px; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.stat-card > b { position: absolute; right: 18px; top: 18px; color: var(--muted); font-size: 17px; }
.tone-amber { background: linear-gradient(145deg,#fffdf9,#fbf0d7); }
.tone-amber .stat-number { color: var(--amber); }
.tone-green { background: linear-gradient(145deg,#fffdf9,#e9f1e9); }
.tone-green .stat-number { color: var(--sage); }
.tone-brown { background: linear-gradient(145deg,#fffdf9,#f0e3d7); }
.tone-brown .stat-number { color: var(--brown); }
.dashboard-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; }
.dashboard-grid > .panel { padding: 23px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 20px; }
.panel-heading > a { color: var(--brown); font-size: 11px; font-weight: 800; text-decoration: none; }
.compact-list { display: grid; gap: 8px; }
.compact-list > a { min-height: 65px; display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 12px; padding: 10px 11px; border: 1px solid #ece5dc; border-radius: 13px; background: #fff; text-decoration: none; }
.compact-list strong, .compact-list small { display: block; }
.compact-list strong { font-size: 12px; }
.compact-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.compact-list > a > b { color: var(--muted); }
.subject-dot { width: 9px; height: 9px; display: block; border-radius: 50%; background: var(--brown); }
.subject-dot.subject-deutsch, .subject-symbol.subject-deutsch { background: var(--blue-soft); color: var(--blue); }
.subject-dot.subject-mathematik, .subject-symbol.subject-mathematik { background: var(--sage-soft); color: var(--sage); }
.subject-dot.subject-sachunterricht, .subject-symbol.subject-sachunterricht { background: #edf0df; color: #66703b; }
.subject-dot.subject-rueckmeldung, .subject-symbol.subject-rueckmeldung { background: #eee6f3; color: #68537a; }
.activity-list { display: grid; gap: 4px; }
.activity-list > div { min-height: 53px; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #eee8e0; }
.activity-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--sand); color: var(--brown); }
.activity-list strong, .activity-list small { display: block; }
.activity-list strong { font-size: 11px; }
.activity-list small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.privacy-banner { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 15px; margin-top: 16px; padding: 18px 20px; border-radius: 17px; background: var(--sage-soft); }
.privacy-banner > span { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; background: #fff; }
.privacy-banner strong { font-size: 13px; }
.privacy-banner p { margin: 3px 0 0; color: #506057; font-size: 11px; line-height: 1.45; }

.search-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.search-row > span { color: var(--muted); font-size: 11px; }
.search-field { width: min(480px,100%); min-height: 45px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.search-field > span { color: var(--muted); font-size: 18px; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 13px; }
.student-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 13px; }
.student-card { padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 7px 24px rgba(70,49,33,.035); }
.student-card-head { display: flex; justify-content: space-between; align-items: start; }
.class-chip { padding: 5px 8px; border-radius: 999px; background: var(--sand); color: var(--muted); font-size: 9px; font-weight: 800; }
.student-card h2 { margin: 14px 0 10px; font-family: Georgia, serif; font-size: 23px; }
.student-counts { display: flex; gap: 9px; }
.student-counts span { padding: 5px 8px; border-radius: 9px; background: var(--canvas); color: var(--muted); font-size: 9px; }
.student-counts b { color: var(--ink); }
.student-card p { margin: 12px 0 16px; color: var(--muted); font-size: 9px; }
.tabs { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; border-bottom: 1px solid var(--line); }
.tabs > a { display: flex; align-items: center; gap: 8px; padding: 0 3px 12px; border-bottom: 2px solid var(--brown); color: var(--brown); text-decoration: none; font-size: 12px; font-weight: 800; }
.tabs a span { min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 99px; background: var(--brown-soft); font-size: 9px; }
.tabs > span { padding-bottom: 12px; color: var(--muted); font-size: 10px; }
.entry-list { display: grid; gap: 9px; }
.entry-row { min-height: 91px; display: grid; grid-template-columns: 50px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); text-decoration: none; box-shadow: 0 6px 22px rgba(70,49,33,.03); }
.subject-symbol { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 15px; background: var(--brown-soft); color: var(--brown); font-family: Georgia, serif; font-weight: 800; }
.entry-copy { min-width: 0; }
.entry-copy strong, .entry-copy small { display: block; }
.entry-copy strong { margin: 5px 0 2px; font-size: 13px; }
.entry-copy small { color: var(--muted); font-size: 9px; }
.entry-row > b { color: var(--muted); font-size: 20px; }
.status { width: fit-content; display: inline-flex; padding: 4px 7px; border-radius: 999px; font-size: 8px; font-weight: 850; letter-spacing: .025em; text-transform: uppercase; }
.status-draft { background: var(--amber-soft); color: var(--amber); }
.status-published { background: var(--sage-soft); color: var(--sage); }
.status-archived { background: #ece9e4; color: #66615a; }
.empty-state { min-height: 280px; display: grid; place-items: center; place-content: center; padding: 25px; text-align: center; }
.empty-state > span { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: var(--sage-soft); color: var(--sage); font-size: 24px; }
.empty-state h2, .empty-state h3 { margin: 13px 0 4px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.filter-tabs { width: fit-content; display: flex; gap: 4px; margin-bottom: 15px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.55); }
.filter-tabs a { min-height: 38px; display: flex; align-items: center; padding: 0 13px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 750; }
.filter-tabs a.active { background: var(--paper); color: var(--brown-dark); box-shadow: 0 3px 10px rgba(71,50,33,.08); }
.trash-row { min-height: 89px; display: grid; grid-template-columns: 50px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.trash-row > span:nth-child(2) strong, .trash-row > span:nth-child(2) small { display: block; }
.trash-row > span:nth-child(2) strong { font-size: 13px; }
.trash-row > span:nth-child(2) small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.trash-row > div { display: flex; gap: 7px; }
.inline-form { margin: 0; }

.editor-layout { display: grid; grid-template-columns: minmax(0,1fr) 315px; gap: 16px; align-items: start; }
.editor-main { padding: 25px; }
.editor-main > label, .form-grid label, .setup-form label { display: grid; gap: 7px; margin-bottom: 18px; }
.editor-main label > span, .form-grid label > span, .setup-form label > span, .field-label { font-size: 11px; font-weight: 800; }
label em { color: var(--muted); font-size: 9px; font-style: normal; font-weight: 500; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #cfc5ba; border-radius: 11px; background: #fff; }
textarea { resize: vertical; line-height: 1.55; }
label small, fieldset > small { color: var(--muted); font-size: 9px; }
.form-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.upload-field { padding: 16px; border: 1px dashed #c3b5a7; border-radius: 13px; background: var(--sand); }
.upload-field input { padding: 6px; border: 0; background: transparent; }
.existing-files { display: grid; gap: 8px; margin-top: 22px; }
.file-row { min-height: 62px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; }
.file-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--coral-soft); color: var(--coral); }
.file-row strong, .file-row small { display: block; }
.file-row strong { font-size: 11px; }
.file-row small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.link-danger { border: 0; background: transparent; color: var(--coral); cursor: pointer; font-size: 10px; font-weight: 750; }
.editor-side { position: sticky; top: 20px; display: grid; gap: 12px; }
.publish-panel, .help-panel { padding: 20px; }
.publish-panel h2 { margin: 5px 0 15px; font-size: 20px; }
.radio-card { min-height: 65px; display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 8px; margin-bottom: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.radio-card input { width: 16px; }
.radio-card strong, .radio-card small { display: block; }
.radio-card strong { font-size: 11px; }
.radio-card small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.publish-panel > .button { margin-top: 10px; }
.help-panel { display: grid; grid-template-columns: 28px 1fr; gap: 10px; background: var(--sage-soft); }
.help-panel > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: #fff; font-family: Georgia,serif; font-weight: 800; }
.help-panel strong { font-size: 11px; }
.help-panel p { margin: 3px 0 0; color: #526158; font-size: 9px; }

.preview-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 16px; align-items: start; }
.parent-preview { overflow: hidden; }
.preview-top { display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: 14px; padding: 22px 24px; border-bottom: 1px solid var(--line); background: linear-gradient(145deg,#fffdf9,#eaf1e9); }
.preview-top h2 { margin: 4px 0 2px; font-family: Georgia,serif; font-size: 28px; }
.preview-top p { margin: 0; color: var(--muted); font-size: 9px; }
.preview-body { padding: 28px; }
.preview-body > p { margin: 0; font-family: Georgia,serif; font-size: 19px; line-height: 1.7; }
.next-step { display: grid; grid-template-columns: 34px 1fr; gap: 10px; margin-top: 25px; padding: 17px; border-radius: 14px; background: var(--sage-soft); }
.next-step > span { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--sage); }
.next-step strong { font-size: 12px; }
.next-step p { margin: 4px 0 0; color: #46564d; font-family: inherit; font-size: 12px; line-height: 1.55; }
.preview-files { padding: 0 28px 28px; }
.preview-files > strong { display: block; margin-bottom: 9px; font-size: 11px; }
.preview-files > a { min-height: 60px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.preview-files > a > span:nth-child(2), .preview-files > a small { display: block; }
.preview-files small { color: var(--muted); font-size: 8px; }
.preview-files b { color: var(--brown); font-size: 9px; }
.preview-actions { display: grid; gap: 12px; }
.preview-actions > .panel { padding: 19px; }
.state-panel h2, .meta-panel h2, .danger-zone h2 { margin: 12px 0 5px; font-size: 17px; }
.state-panel p, .danger-zone p { margin: 0 0 13px; color: var(--muted); font-size: 10px; }
.state-panel .inline-form + .inline-form { margin-top: 4px; }
.meta-panel dl { margin: 0; }
.meta-panel dl > div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eee7de; font-size: 9px; }
.meta-panel dt { color: var(--muted); }
.meta-panel dd { margin: 0; text-align: right; }
.danger-zone { border-color: #e1c4bf; }

.audit-table-wrap { overflow-x: auto; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.audit-table th, .audit-table td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.audit-table th { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }

.family-safety { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 13px; margin-bottom: 15px; padding: 15px 17px; border-radius: 15px; background: var(--sage-soft); }
.family-safety > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: #fff; }
.family-safety strong { font-size: 12px; }
.family-safety p { margin: 2px 0 0; color: #506057; font-size: 10px; }
.parent-entry-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 13px; }
.parent-entry-card { min-height: 265px; display: flex; flex-direction: column; align-items: flex-start; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); text-decoration: none; box-shadow: 0 8px 26px rgba(70,49,33,.045); }
.parent-entry-card .eyebrow { margin-top: 16px; }
.parent-entry-card h2 { margin: 5px 0 8px; font-family: Georgia,serif; font-size: 25px; }
.parent-entry-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.parent-entry-card small { margin-top: auto; padding-top: 16px; color: var(--muted); font-size: 9px; }
.parent-entry-card > b { margin-top: 8px; color: var(--brown); font-size: 10px; }
.teacher-preview-note { display: flex; align-items: center; gap: 11px; margin-top: 15px; padding: 16px; border: 1px dashed #c5b9ad; border-radius: 15px; }
.teacher-preview-note strong { font-size: 11px; }
.teacher-preview-note p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.back-link { display: inline-block; margin-bottom: 15px; color: var(--brown); text-decoration: none; font-size: 11px; font-weight: 800; }
.parent-reading { max-width: 850px; margin: 0 auto; overflow: hidden; }
.parent-reading > header { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 15px; padding: 25px; border-bottom: 1px solid var(--line); background: linear-gradient(145deg,#fffdf9,#eaf1e9); }
.parent-reading h1 { margin: 5px 0 2px; font-family: Georgia,serif; font-size: 31px; }
.parent-reading header p { margin: 0; color: var(--muted); font-size: 9px; }
.reading-copy { padding: 32px; }
.reading-copy > p { margin: 0; font-family: Georgia,serif; font-size: 20px; line-height: 1.75; }
.parent-reading > footer { padding: 0 32px 32px; }
.parent-reading > footer > strong { display: block; margin-bottom: 10px; font-size: 11px; }
.download-row { min-height: 64px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; text-decoration: none; }
.download-row b, .download-row small { display: block; }
.download-row b { font-size: 11px; }
.download-row small { color: var(--muted); font-size: 9px; }
.download-row em { color: var(--brown); font-size: 9px; font-style: normal; font-weight: 750; }

.guest-main { min-height: 100vh; }
.login-page { min-height: 100vh; padding: 25px clamp(18px,4vw,58px); background: radial-gradient(circle at 8% 0%,#fffaf1 0,transparent 34%),var(--canvas); }
.login-brand, .setup-brand { max-width: 1160px; display: flex; align-items: center; gap: 11px; margin: 0 auto 22px; }
.login-card { max-width: 1160px; min-height: 650px; display: grid; grid-template-columns: 1.15fr .85fr; margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 31px; background: var(--paper); box-shadow: var(--shadow); }
.login-story { position: relative; overflow: hidden; padding: clamp(40px,6vw,74px); background: linear-gradient(145deg,#f4e7d6,#e5eee5); }
.login-story h1 { max-width: 620px; margin: 15px 0; font-family: Georgia,serif; font-size: clamp(42px,5vw,65px); font-weight: 600; line-height: 1.02; letter-spacing: -.04em; }
.login-story > p { max-width: 560px; margin: 0; color: #5f584e; font-size: 17px; line-height: 1.65; }
.login-story ul { display: grid; gap: 8px; margin: 27px 0 0; padding: 0; list-style: none; font-size: 12px; font-weight: 700; }
.login-story li::before { content: "✓"; margin-right: 8px; color: var(--sage); }
.login-kangaroo { position: absolute; right: 20px; bottom: -7px; width: 210px; height: 210px; object-fit: contain; opacity: .95; }
.login-form { align-self: center; margin: 30px; padding: clamp(27px,4vw,44px); border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: 0 12px 38px rgba(71,50,33,.06); }
.secure-chip { display: inline-flex; padding: 7px 10px; border-radius: 99px; background: var(--brown-soft); color: var(--brown-dark); font-size: 10px; font-weight: 800; }
.login-form h2 { margin: 17px 0 5px; font-family: Georgia,serif; font-size: 29px; }
.login-form > p { margin: 0 0 20px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.login-form label { display: grid; gap: 6px; margin: 13px 0; font-size: 10px; font-weight: 800; }
.login-form .button { margin-top: 10px; }
.demo-login-note { margin-top: 18px; padding: 13px; border-radius: 12px; background: var(--sage-soft); }
.demo-login-note strong, .demo-login-note span { display: block; }
.demo-login-note strong { font-size: 10px; }
.demo-login-note span { margin-top: 3px; color: #526158; font-size: 10px; }
.small-note { margin-top: 15px !important; color: var(--muted); font-size: 8px !important; }

.setup-body { min-height: 100vh; background: radial-gradient(circle at 8% 0%,#fffaf1 0,transparent 34%),var(--canvas); }
.setup-page { width: min(920px,calc(100% - 32px)); margin: 0 auto; padding: 26px 0 60px; }
.setup-brand { margin-left: 0; }
.setup-card { padding: clamp(25px,5vw,48px); border: 1px solid var(--line); border-radius: 27px; background: var(--paper); box-shadow: var(--shadow); }
.setup-intro h1, .setup-success h1 { margin: 8px 0; font-family: Georgia,serif; font-size: clamp(32px,5vw,47px); font-weight: 600; line-height: 1.08; }
.setup-intro p, .setup-success > p { margin: 0 0 25px; color: var(--muted); line-height: 1.65; }
.setup-form fieldset { margin: 0 0 18px; padding: 19px; border: 1px solid var(--line); border-radius: 16px; }
.setup-form legend { padding: 0 7px; font-size: 12px; font-weight: 850; }
.setup-form label { margin-bottom: 13px; }
.check-row { grid-template-columns: 20px 1fr !important; align-items: start; }
.check-row input { width: 17px; margin-top: 3px; }
.check-row strong, .check-row small { display: block; }
.check-row strong { font-size: 11px; }
.check-row small { margin-top: 2px; }
.setup-summary { display: grid; grid-template-columns: 29px 1fr; gap: 9px; align-items: start; margin: 18px 0; padding: 14px; border-radius: 13px; background: var(--sage-soft); }
.setup-summary > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: #fff; font-family: Georgia,serif; font-weight: 800; }
.setup-summary p { margin: 2px 0 0; color: #506057; font-size: 10px; }
.setup-success { text-align: center; }
.success-mark { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 50%; background: var(--sage); color: #fff; font-size: 29px; font-weight: 900; }
.credential-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 23px 0; text-align: left; }
.credential-grid > div { padding: 15px; border-radius: 13px; background: var(--sand); }
.credential-grid small, .credential-grid strong, .credential-grid span { display: block; }
.credential-grid small { color: var(--muted); font-size: 9px; }
.credential-grid strong { margin: 4px 0; font-size: 12px; }
.credential-grid span { font-size: 9px; }
.setup-warning { margin-top: 20px; padding: 14px; border-radius: 12px; background: var(--amber-soft); color: #735620; font-size: 10px; text-align: left; }
.error-page { max-width: 640px; display: grid; place-items: center; margin: 70px auto; padding: 45px; text-align: center; }
.error-page > span { width: 55px; height: 55px; display: grid; place-items: center; border-radius: 50%; background: var(--coral-soft); color: var(--coral); font-size: 26px; font-weight: 850; }
.error-page h1 { margin: 16px 0 6px; font-family: Georgia,serif; }
.error-page p { margin: 0 0 20px; color: var(--muted); }

.family-access-layout { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(320px,.75fr); gap: 18px; align-items: start; }
.family-access-list { display: grid; gap: 10px; }
.family-access-card { min-height: 88px; display: grid; grid-template-columns: 48px minmax(0,1fr) auto 16px; align-items: center; gap: 14px; padding: 16px; text-decoration: none; }
.family-access-card:hover { border-color: #cabaa9; transform: translateY(-1px); }
.family-access-card strong,.family-access-card small { display: block; }
.family-access-card strong { font-size: 14px; }
.family-access-card small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.family-access-card > b { color: var(--muted); }
.family-access-form { padding: 23px; }
.family-access-form h2 { margin: 6px 0 7px; font-family: Georgia,serif; font-size: 25px; font-weight: 600; }
.family-access-note { margin: 0 0 19px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.family-access-form label,.password-reset-box label { display: grid; gap: 6px; margin: 0 0 13px; }
.family-access-form label > span,.password-reset-box label > span { font-size: 10px; font-weight: 800; }
.family-account-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin: 17px 0; }
.family-account-card { padding: 21px; }
.family-account-head { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 11px; }
.family-account-head h2 { margin: 0; font-size: 16px; }
.family-account-head p { margin: 3px 0 0; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.family-account-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.family-account-meta > div { padding: 11px; border-radius: 11px; background: var(--sand); }
.family-account-meta dt { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .04em; }
.family-account-meta dd { margin: 4px 0 0; font-size: 10px; font-weight: 700; }
.family-account-actions { display: flex; gap: 8px; }
.password-reset-box { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.password-reset-box summary { color: var(--brown); cursor: pointer; font-size: 10px; font-weight: 800; }
.password-reset-box form { margin-top: 13px; }
.family-add-user { margin-top: 18px; }
.password-change-form { width: min(540px,100%); margin: 0 auto; }
.back-link { display: inline-flex; margin: 0 0 14px; color: var(--brown); font-size: 11px; font-weight: 800; text-decoration: none; }
.qr-access-panel { margin-bottom: 18px; padding: 23px; }
.qr-access-panel .panel-heading h2 { font-family: Georgia,serif; font-size: 24px; font-weight: 600; }
.qr-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.qr-card-actions > span { color: var(--muted); font-size: 9px; }
.qr-status-meta { max-width: 560px; }
.qr-print-card { width: min(760px,100%); margin: 18px auto; overflow: hidden; border: 2px solid var(--brown); border-radius: 21px; background: #fff; box-shadow: 0 12px 35px rgba(69,47,30,.1); }
.qr-print-card > header { display: flex; align-items: center; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--line); background: var(--sand); }
.qr-print-card > header strong,.qr-print-card > header small { display: block; }
.qr-print-card > header strong { font-size: 16px; }
.qr-print-card > header small { color: var(--muted); font-size: 10px; }
.qr-card-body { display: grid; grid-template-columns: 260px minmax(0,1fr); align-items: center; gap: 28px; padding: 28px; }
.qr-code { width: 260px; height: 260px; display: grid; place-items: center; }
.qr-code svg { width: 100%; height: 100%; display: block; }
.qr-render-error { margin: 0; padding: 17px; border-radius: 12px; background: var(--coral-soft); color: var(--coral); font-size: 11px; line-height: 1.5; text-align: center; }
.qr-card-body ol { margin: 13px 0 20px; padding-left: 20px; font-size: 13px; }
.pin-label { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.pin-display { display: block; margin: 4px 0 10px; color: var(--brown-dark); font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: 38px; letter-spacing: .16em; }
.qr-card-body p { margin: 0; color: var(--muted); font-size: 10px; }
.qr-print-card > footer { padding: 12px 20px; background: var(--sage-soft); color: #405247; text-align: center; font-size: 9px; font-weight: 700; }
.qr-login-page { min-height: 100vh; padding: 28px 18px; background: radial-gradient(circle at 8% 0%,#fffaf1 0,transparent 34%),var(--canvas); }
.qr-login-card { width: min(480px,100%); margin: 70px auto 0; padding: clamp(25px,5vw,43px); text-align: center; }
.qr-login-icon { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 17px; border-radius: 20px; background: var(--sage-soft); color: var(--sage); font-size: 31px; font-weight: 900; }
.qr-login-card h1 { margin: 7px 0 9px; font-family: Georgia,serif; font-size: 36px; font-weight: 600; }
.qr-login-card > p { margin: 0 0 21px; color: var(--muted); font-size: 12px; }
.qr-login-card form { display: grid; gap: 10px; text-align: left; }
.qr-login-card label { font-size: 10px; font-weight: 800; }
.pin-input { padding: 15px; text-align: center; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: 28px; letter-spacing: .35em; }
.qr-login-help { margin: 20px 0 16px; padding: 13px; border-radius: 12px; background: var(--sage-soft); text-align: left; }
.qr-login-help strong,.qr-login-help span { display: block; }
.qr-login-help strong { font-size: 10px; }
.qr-login-help span { margin-top: 3px; color: #506057; font-size: 9px; line-height: 1.5; }

@media (max-width: 1050px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .family-access-layout { grid-template-columns: 1fr; }
  .student-grid { grid-template-columns: repeat(2,1fr); }
  .editor-layout, .preview-layout { grid-template-columns: minmax(0,1fr) 280px; }
}

@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(290px,85vw); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(35,28,22,.2); }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open::after { content: ""; position: fixed; z-index: 30; inset: 0; background: rgba(33,27,22,.36); }
  .mobile-header { position: sticky; z-index: 20; top: 0; min-height: 64px; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: rgba(255,253,249,.94); backdrop-filter: blur(15px); }
  .menu-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; }
  .mobile-brand { text-decoration: none; font-family: Georgia,serif; font-weight: 700; }
  .main-content { width: min(100% - 30px,740px); padding-top: 24px; }
  .dashboard-grid, .editor-layout, .preview-layout { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .preview-actions { grid-template-columns: repeat(2,1fr); }
  .danger-zone { grid-column: 1 / -1; }
  .login-card { grid-template-columns: 1fr; }
  .login-story { min-height: 405px; padding-bottom: 135px; }
  .login-form { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
}

@media (max-width: 620px) {
  .main-content { width: min(100% - 24px,560px); }
  .page-intro { display: grid; align-items: start; }
  .page-intro h1 { font-size: 33px; }
  .page-intro > .button { width: 100%; }
  .stat-grid, .student-grid, .parent-entry-grid, .preview-actions, .credential-grid, .form-grid.two { grid-template-columns: 1fr; }
  .stat-card { min-height: 125px; }
  .privacy-banner { grid-template-columns: 38px 1fr; }
  .privacy-banner .button { grid-column: 1 / -1; width: 100%; }
  .search-row { align-items: stretch; flex-direction: column; }
  .student-card h2 { font-size: 21px; }
  .tabs > span { display: none; }
  .entry-row { grid-template-columns: 44px minmax(0,1fr); padding: 13px; }
  .entry-row > b { display: none; }
  .subject-symbol { width: 43px; height: 43px; border-radius: 13px; }
  .entry-copy strong { font-size: 12px; }
  .entry-copy small { line-height: 1.45; }
  .filter-tabs { width: 100%; overflow-x: auto; }
  .filter-tabs a { flex: 0 0 auto; }
  .trash-row { grid-template-columns: 43px 1fr; }
  .trash-row > div { grid-column: 1 / -1; flex-direction: column; }
  .editor-main { padding: 18px; }
  .preview-top, .parent-reading > header { grid-template-columns: 45px 1fr; padding: 18px; }
  .preview-top h2, .parent-reading h1 { font-size: 23px; }
  .preview-body, .reading-copy { padding: 22px 18px; }
  .preview-body > p, .reading-copy > p { font-size: 17px; }
  .preview-files, .parent-reading > footer { padding: 0 18px 22px; }
  .preview-files > a, .download-row { grid-template-columns: 37px 1fr; }
  .preview-files > a > b, .download-row em { grid-column: 2; }
  .audit-table th, .audit-table td { padding: 11px 12px; }
  .login-page { padding: 14px; }
  .login-brand { margin-bottom: 14px; }
  .login-card { border-radius: 23px; }
  .login-story { min-height: 380px; padding: 29px 24px 130px; }
  .login-story h1 { font-size: 39px; }
  .login-story > p { font-size: 14px; }
  .login-story ul { display: none; }
  .login-kangaroo { width: 150px; height: 150px; }
  .login-form { padding: 24px; }
  .setup-page { width: min(100% - 22px,560px); padding-top: 14px; }
  .setup-card { padding: 22px 17px; border-radius: 21px; }
  .setup-form fieldset { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

@media (prefers-contrast: more) {
  :root { --line: #958b80; --muted: #4c463f; }
}

/* Elternportal v2 */
.role-parent .main-content { width: min(1220px,calc(100% - 56px)); padding-top: 0; }
.role-parent .sidebar { width: 260px; }
.role-parent .sidebar nav { gap: 2px; }
.role-parent .nav-link { position: relative; min-height: 43px; }
.role-parent .nav-link b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-nav-badge { min-width: 22px; height: 22px; display: grid; place-items: center; margin-left: auto; border-radius: 999px; background: var(--coral); color: #fff !important; font-size: 9px !important; font-weight: 850; }
.portal-topbar { min-height: 122px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 34px; padding: 25px 0; border-bottom: 1px solid var(--line); }
.portal-topbar h1 { margin: 5px 0 0; font-family: Georgia,serif; font-size: 30px; font-weight: 600; }
.portal-topbar-actions { display: flex; gap: 9px; }
.portal-welcome { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin-bottom: 25px; }
.portal-welcome h2 { margin: 8px 0 6px; font-family: Georgia,serif; font-size: clamp(38px,5vw,54px); font-weight: 600; line-height: 1.05; }
.portal-welcome p { margin: 0; color: var(--muted); }
.portal-welcome > span { color: var(--muted); font-size: 10px; }
.portal-card { border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 8px 26px rgba(70,49,33,.045); }
.portal-priority-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(280px,.65fr); gap: 16px; }
.portal-todo-spotlight,.portal-personal-message { min-height: 320px; padding: 27px; }
.portal-todo-spotlight { border-color: #e6c2bd; background: linear-gradient(145deg,#fffdf9,#fff6f4); }
.portal-personal-message { display: flex; flex-direction: column; background: linear-gradient(145deg,#fffdf9,#edf3ed); }
.portal-personal-message > p { margin: 24px 0 14px; font-family: Georgia,serif; font-size: 20px; line-height: 1.45; }
.portal-personal-message .button { width: fit-content; margin-top: auto; }
.portal-section-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.portal-section-head h3 { margin: 6px 0 0; font-size: 22px; font-weight: 550; }
.eyebrow.urgent { color: var(--coral); }
.eyebrow.green { color: var(--sage); }
.portal-count { min-width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); color: #fff; font-size: 10px; font-weight: 850; }
.portal-preview-row { min-height: 67px; display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 10px; border-top: 1px solid #eaded8; }
.portal-preview-row:first-of-type { margin-top: 16px; }
.portal-preview-row strong,.portal-preview-row small { display: block; }
.portal-preview-row strong { font-size: 12px; }
.portal-preview-row small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.portal-symbol { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--brown-soft); color: var(--brown); font-weight: 850; }
.portal-symbol.urgent { background: var(--coral-soft); color: var(--coral); }
.portal-symbol.green { background: var(--sage-soft); color: var(--sage); }
.portal-empty-inline { min-height: 118px; display: flex; align-items: center; gap: 12px; }
.portal-empty-inline > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--sage-soft); color: var(--sage); }
.portal-empty-inline strong,.portal-empty-inline small { display: block; }
.portal-empty-inline small { color: var(--muted); }
.portal-unread { width: 10px; height: 10px; display: block; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 5px var(--coral-soft); }
.portal-meta { display: block; margin-bottom: 18px; color: var(--muted); font-size: 10px; }
.portal-quick-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 16px 0; }
.portal-quick-grid > a { min-height: 86px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); text-decoration: none; }
.portal-quick-grid strong,.portal-quick-grid small { display: block; }
.portal-quick-grid strong { font-size: 12px; }
.portal-quick-grid small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.portal-quick-grid b { color: var(--muted); font-size: 20px; }
.portal-information-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.portal-information-grid > article { min-height: 198px; padding: 23px; }
.portal-information-grid p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.portal-date { width: 53px; height: 59px; display: grid; place-items: center; align-content: center; border-radius: 13px; background: var(--brown-soft); color: var(--brown); }
.portal-date strong,.portal-date small { display: block; line-height: 1; }
.portal-date strong { font-family: Georgia,serif; font-size: 22px; }
.portal-date small { margin-top: 5px; font-size: 8px; font-weight: 850; }
.portal-info-card { background: linear-gradient(145deg,#fffdf9,#edf3ed); }
.portal-info-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--sage-soft); color: var(--sage); font-family: Georgia,serif; font-weight: 850; }
.portal-text-link { color: var(--brown); font-size: 11px; font-weight: 800; text-decoration: none; }
.portal-todo-list { display: grid; gap: 10px; }
.portal-todo-row { min-height: 122px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 15px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.portal-todo-row.completed { opacity: .72; }
.portal-todo-row form { margin: 0; }
.portal-check { width: 38px; height: 38px; border: 2px solid #c9baab; border-radius: 12px; background: #fff; color: var(--sage); cursor: pointer; font-weight: 900; }
.portal-todo-row.completed .portal-check { border-color: var(--sage); background: var(--sage-soft); }
.portal-title-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.portal-title-line h3 { margin: 0; font-size: 16px; }
.portal-todo-row p { margin: 7px 0 3px; color: var(--muted); font-size: 12px; }
.portal-todo-row small { color: var(--brown); font-size: 10px; font-weight: 700; }
.portal-calm-note { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 12px; margin-top: 18px; padding: 15px; border-radius: 15px; background: var(--sage-soft); }
.portal-calm-note > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--sage); }
.portal-calm-note p { margin: 0; color: #506057; font-size: 10px; }
.portal-message-list { display: grid; gap: 8px; }
.portal-message-row { position: relative; min-height: 96px; display: grid; grid-template-columns: 44px minmax(0,1fr) 110px 12px; align-items: center; gap: 13px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: inherit; text-decoration: none; }
.portal-message-row.unread { border-color: #dab9b3; background: #fff8f6; }
.portal-message-row > span:nth-child(2) em,.portal-message-row > span:nth-child(2) strong,.portal-message-row > span:nth-child(2) small { display: block; }
.portal-message-row em { color: var(--sage); font-size: 8px; font-style: normal; font-weight: 850; text-transform: uppercase; }
.portal-message-row strong { margin: 4px 0; font-size: 13px; }
.portal-message-row small,.portal-message-row time { color: var(--muted); font-size: 9px; }
.portal-conversation { overflow: hidden; }
.portal-conversation > header { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 14px; padding: 22px 25px; border-bottom: 1px solid var(--line); }
.portal-conversation h1 { margin: 5px 0 2px; font-family: Georgia,serif; font-size: 28px; }
.portal-conversation header p { margin: 0; color: var(--muted); font-size: 10px; }
.portal-chat { min-height: 260px; display: grid; align-content: start; gap: 12px; padding: 28px; background: #f8f4ee; }
.portal-bubble { max-width: min(680px,80%); padding: 15px 17px; border-radius: 16px; background: #fff; box-shadow: 0 3px 12px rgba(70,49,33,.05); }
.portal-bubble.sent { margin-left: auto; background: var(--sage-soft); }
.portal-bubble p { margin: 0; font-family: Georgia,serif; font-size: 16px; line-height: 1.6; }
.portal-bubble span { display: block; margin-top: 8px; color: var(--muted); font-size: 8px; }
.portal-reply { padding: 22px 25px; }
.portal-reply textarea { margin: 8px 0 10px; }
.portal-reply > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.portal-reply small { color: var(--muted); font-size: 9px; }
.portal-event-list { display: grid; gap: 10px; }
.portal-event-row { min-height: 112px; display: grid; grid-template-columns: 70px minmax(0,1fr) auto; align-items: center; gap: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.portal-date.large { width: 65px; height: 70px; }
.portal-date.large strong { font-size: 26px; }
.portal-event-row h3 { margin: 0; font-size: 17px; }
.portal-event-row p { margin: 5px 0 2px; color: var(--muted); font-size: 11px; }
.portal-event-row > div > span { color: var(--brown); font-size: 10px; }
.portal-missing-link { display: inline-flex; padding: 7px 10px; border-radius: 9px; background: #ece9e4; color: var(--muted); font-size: 9px; }
.portal-document-grid { display: grid; gap: 10px; }
.portal-document-card { min-height: 130px; display: grid; grid-template-columns: 50px minmax(0,1fr) auto; align-items: center; gap: 16px; padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.portal-document-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--coral-soft); color: var(--coral); }
.portal-document-card em { color: var(--brown); font-size: 8px; font-style: normal; font-weight: 850; text-transform: uppercase; }
.portal-document-card h3 { margin: 4px 0; font-size: 16px; }
.portal-document-card p { margin: 0; color: var(--muted); font-size: 11px; }
.portal-document-card small { color: var(--muted); font-size: 9px; }
.portal-child-head { display: grid; grid-template-columns: 55px minmax(0,1fr) auto; align-items: center; gap: 15px; margin-bottom: 16px; padding: 22px; }
.portal-child-head h2 { margin: 4px 0 2px; font-family: Georgia,serif; font-size: 28px; }
.portal-child-head p { margin: 0; color: var(--muted); font-size: 10px; }
.portal-feedback-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 13px; }
.portal-child-planning-head { grid-template-columns: 50px minmax(0,1fr) auto; }
.portal-child-planning-head .portal-symbol { width: 48px; height: 48px; border-radius: 15px; font-size: 18px; }
.portal-planning-chip { padding: 7px 11px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 9px; font-weight: 850; }
.portal-planning-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 13px; }
.portal-planning-card { min-height: 180px; display: grid; place-items: center; align-content: center; padding: 20px; text-align: center; }
.portal-planning-icon { width: 59px; height: 59px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 17px; font-family: Georgia,serif; font-size: 20px; font-weight: 850; }
.portal-planning-icon.blue { background: var(--blue-soft); color: var(--blue); }
.portal-planning-icon.green { background: var(--sage-soft); color: var(--sage); }
.portal-planning-icon.sage { background: #e7f0ed; color: #477064; }
.portal-planning-icon.violet { background: #eee6f3; color: #68537a; }
.portal-planning-card h3 { margin: 0 0 9px; font-size: 14px; }
.portal-planning-status { padding: 5px 8px; border-radius: 999px; background: var(--sand); color: var(--muted); font-size: 9px; font-weight: 750; }
.portal-future-note { margin-top: 16px; padding: 19px; }
.portal-future-note p { font-size: 11px; }
.portal-action-panel { min-height: 170px; display: grid; grid-template-columns: 55px minmax(0,1fr) auto; align-items: center; gap: 20px; padding: 25px; }
.portal-action-panel .portal-symbol { width: 52px; height: 52px; border-radius: 15px; font-size: 20px; }
.portal-action-panel h3 { margin: 0 0 6px; font-size: 20px; }
.portal-action-panel p { margin: 0; color: var(--muted); font-size: 12px; }
.portal-contact-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.portal-contact-grid > article { padding: 25px; }
.portal-teacher { display: flex; align-items: center; gap: 13px; }
.portal-teacher h3 { margin: 0; font-size: 21px; }
.portal-teacher p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.portal-contact-card dl { margin: 22px 0; }
.portal-contact-card dl > div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.portal-contact-card dt { color: var(--muted); }
.portal-contact-card dd { margin: 0; font-weight: 700; }
.portal-contact-actions { display: flex; gap: 8px; }
.portal-booking-card { display: flex; flex-direction: column; background: linear-gradient(145deg,#fffdf9,#f1e5d9); }
.portal-booking-card h3 { margin: 12px 0 7px; font-family: Georgia,serif; font-size: 25px; }
.portal-booking-card p { color: var(--muted); font-size: 12px; }
.portal-booking-card .button { width: fit-content; margin-top: auto; }
.portal-booking-card > small { margin-top: 8px; color: var(--muted); }
.portal-external-note { margin-top: 13px; color: var(--muted); font-size: 10px; text-align: center; }
.portal-language-grid { display: grid; grid-template-columns: 1fr .75fr; gap: 16px; align-items: start; }
.portal-language-card,.portal-read-card { padding: 24px; }
.portal-language-card h2 { margin-top: 0; }
.portal-language-options { display: grid; gap: 8px; margin: 16px 0; }
.portal-language-options label { min-height: 58px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.portal-language-options label.selected { border-color: var(--sage); background: var(--sage-soft); }
.portal-language-options input { width: 16px; }
.portal-language-options strong,.portal-language-options small { display: block; }
.portal-language-options small { color: var(--muted); font-size: 9px; }
.portal-simple-toggle { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 10px; margin: 18px 0; padding: 14px; border-radius: 13px; background: var(--sand); }
.portal-simple-toggle input { width: 17px; }
.portal-simple-toggle strong,.portal-simple-toggle small { display: block; }
.portal-simple-toggle small { color: var(--muted); font-size: 9px; }
.portal-read-card { display: grid; grid-template-columns: 46px 1fr; gap: 14px; }
.portal-read-card h2 { margin: 6px 0; }
.portal-read-card p { color: var(--muted); }
.simple-mode .main-content { font-size: 18px; }
.simple-mode p,.simple-mode small { line-height: 1.75; }
.portal-admin-list { display: grid; gap: 9px; }
.portal-admin-list > article { min-height: 100px; display: grid; grid-template-columns: 45px minmax(0,1fr) auto auto; align-items: center; gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); }
.portal-admin-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--brown-soft); color: var(--brown); }
.portal-admin-list article > span:nth-child(2) em,.portal-admin-list article > span:nth-child(2) strong,.portal-admin-list article > span:nth-child(2) small { display: block; }
.portal-admin-list em { color: var(--brown); font-size: 8px; font-style: normal; font-weight: 850; text-transform: uppercase; }
.portal-admin-list strong { margin: 4px 0; font-size: 13px; }
.portal-admin-list small { color: var(--muted); font-size: 9px; }
.portal-settings-form { padding: 25px; }
.family-import-panel,.family-delete-zone { margin-top: 18px; overflow: hidden; }
.family-import-panel > summary,.family-delete-zone > summary { min-height: 58px; display: flex; align-items: center; padding: 16px 20px; cursor: pointer; font-weight: 850; }
.family-import-panel > summary { color: var(--brown); }
.family-delete-zone > summary { color: #9c3f36; }
.family-import-content,.family-delete-copy { padding: 0 20px 22px; border-top: 1px solid var(--line); }
.family-import-content h2,.family-delete-copy h2 { margin: 18px 0 6px; }
.family-import-content > p,.family-delete-copy > p { color: var(--muted); }
.family-import-content ol { margin: 16px 0; padding-inline-start: 22px; color: var(--muted); }
.family-import-content li { margin: 7px 0; }
.family-import-content form,.family-delete-copy form { display: grid; gap: 13px; margin-top: 16px; }
.family-import-content .button,.family-delete-copy .button { width: fit-content; }
.family-delete-zone { border-color: #e1c4bf; }

@media (max-width: 1050px) {
  .portal-priority-grid,.portal-contact-grid,.portal-language-grid { grid-template-columns: 1fr; }
  .portal-planning-grid { grid-template-columns: repeat(2,1fr); }
  .portal-personal-message { min-height: 250px; }
}
@media (max-width: 860px) {
  .role-parent .main-content { width: min(100% - 30px,740px); padding-top: 18px; }
  .portal-topbar { min-height: 84px; margin-bottom: 22px; padding: 10px 0; }
  .portal-topbar-actions { display: none; }
  .portal-welcome { align-items: start; flex-direction: column; }
}
@media (max-width: 660px) {
  .family-account-grid { grid-template-columns: 1fr; }
  .family-access-card { grid-template-columns: 42px minmax(0,1fr); }
  .family-access-card > .status,.family-access-card > b { grid-column: 2; }
  .family-account-meta { grid-template-columns: 1fr; }
  .qr-card-body { grid-template-columns: 1fr; justify-items: center; padding: 20px; text-align: center; }
  .qr-code { width: min(260px,100%); height: auto; aspect-ratio: 1; }
  .qr-card-body ol { display: inline-block; text-align: left; }
  .pin-display { font-size: 31px; }
  .portal-priority-grid,.portal-quick-grid,.portal-information-grid,.portal-feedback-grid { grid-template-columns: 1fr; }
  .portal-welcome h2 { font-size: 37px; }
  .portal-todo-spotlight,.portal-personal-message { min-height: auto; padding: 20px; }
  .portal-todo-row { grid-template-columns: 38px minmax(0,1fr); padding: 14px; }
  .portal-todo-row > .button { grid-column: 2; width: fit-content; }
  .portal-message-row { grid-template-columns: 40px minmax(0,1fr) 9px; }
  .portal-message-row time { display: none; }
  .portal-event-row,.portal-document-card,.portal-action-panel { grid-template-columns: 54px minmax(0,1fr); padding: 15px; }
  .portal-event-row > :last-child,.portal-document-card > :last-child,.portal-action-panel > :last-child { grid-column: 2; width: fit-content; }
  .portal-child-head { grid-template-columns: 50px 1fr; }
  .portal-child-head > .status { grid-column: 2; }
  .portal-child-planning-head > .portal-planning-chip { grid-column: 2; width: fit-content; }
  .portal-planning-grid { grid-template-columns: 1fr 1fr; }
  .portal-planning-card { min-height: 150px; }
  .portal-contact-actions { flex-direction: column; }
  .portal-reply > div { align-items: stretch; flex-direction: column; }
  .portal-admin-list > article { grid-template-columns: 42px minmax(0,1fr); }
  .portal-admin-list > article > .status,.portal-admin-list > article > .button { grid-column: 2; width: fit-content; }
}


@media print {
  body.qr-printing { background: #fff; }
  body.qr-printing * { visibility: hidden !important; }
  body.qr-printing .qr-print-card, body.qr-printing .qr-print-card * { visibility: visible !important; }
  body.qr-printing .qr-print-card { position: absolute; left: 50%; top: 20mm; width: 175mm; max-width: none; margin: 0; transform: translateX(-50%); border-color: #000; box-shadow: none; }
  body.qr-printing .qr-card-body { grid-template-columns: 68mm 1fr; }
  body.qr-printing .qr-code { width: 64mm; height: 64mm; }
}

/* Zweisprachige Elternoberfläche und gezieltes Vorlesen */
.portal-language-switcher { min-height: 45px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border: 1px solid #cdbdad; border-radius: 12px; background: #fff; direction: ltr; }
.portal-language-switcher a { min-width: 44px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 800; }
.portal-language-switcher a.active { background: var(--brown-soft); color: var(--brown-dark); }
.portal-language-switcher.compact { min-height: 38px; padding: 2px 4px; gap: 2px; }
.portal-language-switcher.compact a { min-width: 34px; min-height: 32px; padding: 0 4px; font-size: 10px; }
.login-brand .portal-language-switcher { margin-inline-start: auto; }
.speech-controls { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.speech-controls .button { min-height: 45px; }
.speech-controls .button:disabled { cursor: not-allowed; opacity: .55; }
.bilingual-editor { display: grid; gap: 18px; }
.translation-section { min-width: 0; display: grid; gap: 13px; margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; }
.translation-section legend { padding: 0 9px; font-weight: 850; }
.translation-de { background: #fffdfa; }
.translation-ar { background: #f6faf7; text-align: right; }
.translation-ar input,.translation-ar textarea { direction: rtl; text-align: right; }
.translation-help { margin: 0; color: var(--muted); font-size: 11px; }

html[dir="rtl"] body { font-family: Tahoma, Arial, "Segoe UI", sans-serif; text-align: right; }
html[dir="rtl"] .app-shell { grid-template-columns: minmax(0,1fr) 260px; }
html[dir="rtl"] .sidebar { grid-column: 2; grid-row: 1; border-right: 0; border-left: 1px solid var(--line); }
html[dir="rtl"] .content-shell { grid-column: 1; grid-row: 1; }
html[dir="rtl"] .text-button { text-align: right; }
html[dir="rtl"] .portal-nav-badge { margin-right: auto; margin-left: 0; }
html[dir="rtl"] .page-intro,html[dir="rtl"] .portal-topbar,html[dir="rtl"] .portal-welcome,html[dir="rtl"] .portal-section-head { direction: rtl; }
html[dir="rtl"] .portal-message-row,html[dir="rtl"] .portal-todo-row,html[dir="rtl"] .portal-event-row,html[dir="rtl"] .portal-document-card,html[dir="rtl"] .portal-action-panel { direction: rtl; }
html[dir="rtl"] .portal-bubble.sent { margin-right: auto; margin-left: 0; }
html[dir="rtl"] .portal-bubble.received { margin-right: 0; margin-left: auto; }
html[dir="rtl"] .portal-reply textarea,html[dir="rtl"] .login-form input:not([dir="ltr"]) { direction: rtl; text-align: right; }
html[dir="rtl"] input[type="email"],html[dir="rtl"] input[type="url"],html[dir="rtl"] input[type="tel"],html[dir="rtl"] [dir="ltr"] { direction: ltr; text-align: left; unicode-bidi: isolate; }
html[dir="rtl"] .portal-date,html[dir="rtl"] time,html[dir="rtl"] bdi { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .portal-planning-card { text-align: center; }

@media (max-width: 860px) {
  .role-parent .mobile-header { grid-template-columns: 42px minmax(0,1fr) auto 34px; }
  .portal-topbar { align-items: flex-start; flex-wrap: wrap; }
  .portal-topbar-actions { display: flex; flex-wrap: wrap; }
  html[dir="rtl"] .app-shell { display: block; }
  html[dir="rtl"] .sidebar { right: 0; left: auto; transform: translateX(105%); border-left: 0; border-right: 1px solid var(--line); box-shadow: -20px 0 50px rgba(35,28,22,.2); }
  html[dir="rtl"] body.menu-open .sidebar { transform: translateX(0); }
}

@media (max-width: 660px) {
  .portal-topbar-actions { width: 100%; }
  .portal-topbar-actions .speech-controls { flex: 1 1 auto; }
  .portal-topbar-actions .speech-controls .button { width: 100%; }
  .translation-section { padding: 15px; }
  .role-parent .mobile-brand { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
