/* GBS: klare Typografie, rechteckige Flächen, Lime als wiederkehrender Akzent.
   Gemeinsame Bildschirm-Komponenten; Druckvorlagen behalten ihre Gestaltung. */
/* Eingebettete Klassenansichten sollen ohne abgebrochene Dokumentübergänge laden. */
@view-transition { navigation: none; }
@media screen {
  :root {
    --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: var(--font-body);
    --font-mono: var(--font-body);
    --ui-gutter: 28px;
    --ui-radius: 4px;
    --ui-gap: 16px;
  }
  html { scroll-behavior: auto; }
  body { font-family: var(--font-body); }
  h1, h2, h3, h4, button, input, select, textarea { font-family: var(--font-body); }
  h1, h2, h3 { text-align: left; }
  body:not(.page-tagesprogramm) .view h2 { font-size: clamp(1.1rem, 1.6vw, 1.4rem); font-weight: 800; line-height: 1.3; }
  .lektion-time, .tp-dc-daynr, .tp-dc-date, .ak-table { font-variant-numeric: tabular-nums; }

  /* Ein gemeinsamer linker Rand für Titel, Inhalt und Fusszeile. */
  body:not(.page-tagesprogramm):not(.page-gbs-hub):not(.page-gruppenwahl):not(.page-bdw-solo) .view {
    width: 100%; max-width: none; margin: 0 !important;
    padding: 0 var(--ui-gutter) 32px;
  }
  body.page-schultage.page-tagesprogramm .view {
    width: 100%; max-width: none; margin: 0 !important; padding: 0 var(--ui-gutter) 32px;
  }
  body .bdw-page:not(.is-solo), body .editor2 { width: 100%; max-width: none; margin-inline: 0; }
  body.page-kompetenzen .view > .pa-entry,
  body.page-kompetenzen .view > .hf-entry,
  body.page-kompetenzen .view > .plakat-entry { margin: 16px 0 0; }
  body .page-lead { margin: 0 0 24px; max-width: 72ch; font-size: .95rem; line-height: 1.6; color: var(--ink-soft); }
  body .norm-group { margin: 0 0 28px; }

  /* Alle Hauptrubriken verwenden dieselbe Titelleiste. */
  body :is(.view, .gbs-tool .ui) .ui-page-head {
    --head-bg: var(--ink); --head-ink: #fff; --head-mark: var(--brand);
    position: relative; left: auto; top: auto;
    display: flex; flex-direction: column; flex-wrap: nowrap; align-items: flex-start; justify-content: center;
    gap: 12px 20px; width: calc(100% + 2 * var(--ui-gutter)); max-width: none;
    min-height: 112px; margin: 0 calc(-1 * var(--ui-gutter)) 24px;
    padding: 24px var(--ui-gutter); border: 0; border-radius: 0;
    background: var(--head-bg); color: var(--head-ink); box-shadow: none;
    overflow: visible; text-align: left;
  }
  body :is(.view, .gbs-tool .ui) .ui-page-head::before, body :is(.view, .gbs-tool .ui) .ui-page-head::after { content: none; }
  body :is(.view, .gbs-tool .ui) .ui-page-head h1 {
    display: flex; align-items: baseline; gap: 12px;
    margin: 0; padding: 0; min-width: 0; max-width: 100%;
    color: var(--head-ink); font-family: var(--font-body); font-size: clamp(1.65rem, 2.3vw, 2.1rem);
    line-height: 1.18; font-weight: 800; letter-spacing: -.035em;
    overflow-wrap: anywhere; text-align: left;
  }
  body :is(.view, .gbs-tool .ui) .ui-page-head h1::before { content: ''; flex: 0 0 10px; width: 10px; height: 10px; background: var(--head-mark); }
  body :is(.view, .gbs-tool .ui) .ui-page-head p { margin: 10px 0 0; max-width: 65ch; color: inherit; opacity: .85; font-size: .88rem; line-height: 1.55; }
  body :is(.view, .gbs-tool .ui) .ui-page-head > div { min-width: 0; max-width: 100%; }
  body :is(.view, .gbs-tool .ui) .ui-page-head .editor2-tag { border-radius: var(--ui-radius); font-size: .68rem; padding: 3px 7px; margin: 0 0 10px 8px; }
  body :is(.view, .gbs-tool .ui) .ui-page-head .editor2-back { margin: 0 0 12px; }
  body :is(.view, .gbs-tool .ui) .ui-page-head .btn { min-height: 36px; height: auto; padding: 7px 12px; font-size: .8rem; }

  /* Klassen- und Editor-App: dieselbe dunkle Titelleiste wie im Browser/Teams. */
  body.is-appmode .view .ui-page-head, body.is-teacherapp .view .ui-page-head {
    min-height: 88px;
  }
  body.is-appmode .view .ui-page-head .btn-ghost,
  body.is-teacherapp .view .ui-page-head .btn-ghost { color: #fff; border-color: #ffffff55; background: transparent; }

  /* Die aktive Icon-Fläche genügt in der schmalen Teams-Navigation. */
  body.is-embed .sidebar:not(:hover):not(:focus-within) .sidenav a::before,
  body.is-embed.sidebar-collapsed .sidenav a::before { display: none; }

  /* Vergangene Tage bleiben erreichbar, ohne die aktuelle Übersicht zu füllen. */
  .tp-past-days { grid-column: 1 / -1; min-width: 0; border: 1px solid #cbd1d0; border-radius: var(--ui-radius); background: #edf0ef; }
  .tp-past-days > summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 16px; color: var(--ink); font-weight: 750; font-size: .9rem; cursor: pointer; list-style: none; }
  .tp-past-days > summary::-webkit-details-marker { display: none; }
  .tp-past-days > summary:hover { background: #e3e8e6; }
  .tp-past-days > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: var(--ui-radius); }
  .tp-past-days > summary svg { flex: 0 0 18px; }
  .tp-past-days[open] > summary svg { transform: rotate(90deg); }
  .tp-past-count { margin-left: auto; font-size: .8rem; font-weight: 600; color: #52615e; font-variant-numeric: tabular-nums; }
  .tp-past-grid { padding: 0 12px 12px; }

  /* Gleiche Kartenform für Navigation, Material und Lehrerwerkzeuge. Fachfarben bleiben. */
  body :is(.norm-card, .sem-card, .hit, .auf-card, .hk-row, .tp-tile,
    .pa-entry, .hf-entry, .pa-teaser, .hf-teaser, .plakat-teaser,
    .info-section, .bdw-approved, .bdw-gallery-card, .bdw-upload-card,
    .editor-hub-tile, .editor-tool-tile, .mc-class-card, .ak-class-card, .ak-list-tile,
    .ed-block, .ed-card, .teacher-app-controls, .teacher-app-panel, .teacher-action,
    .teacher-owned-classes, .teacher-more-panel, .teacher-app-setup,
    .mc-selection, .mc-mini-card, .editor-empty-area, .gbs-hub-tile) {
    border-radius: var(--ui-radius); box-shadow: none;
  }
  body :is(.norm-card, .sem-card, .hit, .auf-card, .hk-row, .tp-tile, .editor-hub-tile, .editor-tool-tile):hover {
    transform: none; box-shadow: none; border-color: #758383;
  }
  body :is(.norm-grid, .editor-hub-grid, .editor-tool-grid, .mc-class-grid) { gap: var(--ui-gap); }
  body :is(.norm-card-code, .norm-tool-brand, .editor-hub-tile strong, .editor-tool-tile strong) { font-family: var(--font-body); font-weight: 800; letter-spacing: -.015em; }
  body :is(.norm-group-title, .home-pathhead h2, .hf-section-head h2) { font-size: 1.08rem; font-weight: 800; line-height: 1.3; }
  body :is(.btn, .iconbtn, .la-search-box, .filterbar select, .ed-select, .ed-input,
    .editor2-tag, .auf2-tag, .tp-nav-group, .tp-navlink, .tp-dc-sem) { border-radius: var(--ui-radius); }
  body .btn { font-weight: 700; }

  /* Lernaufträge: kompakte Dokument-Kacheln mit der unbeschnittenen Titelseite. */
  body .hit-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  body .hit-document { min-width: 0; gap: 0; padding: 0; border: 1.5px solid var(--hc); background: #fff; overflow: hidden; box-shadow: none; }
  body .hit-document:hover { border-color: var(--hc); background: var(--hc-bg); box-shadow: none; }
  body .hit-document:focus-visible { outline: 3px solid var(--hc); outline-offset: 3px; }
  body .hit-document .hit-head { align-items: center; gap: 8px; padding: 14px 14px 8px; }
  body .hit-document .hit-auf { font-family: var(--font-body); font-weight: 800; font-size: 26px; line-height: 1.15; letter-spacing: -.03em; }
  body .hit-kind { color: var(--hc); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  body .hit-cover { position: relative; aspect-ratio: 210 / 297; margin: 4px 14px 0; border: 1px solid #e5e9e5; background: #fff; overflow: hidden; }
  body .hit-cover img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; visibility: hidden; }
  body .hit-cover.is-loaded img { visibility: visible; }
  body .hit-cover-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px; color: #657370; text-align: center; font-size: 11px; }
  body .hit-cover.is-loaded .hit-cover-placeholder { display: none; }
  body .hit-caption { padding: 14px; flex: 1; min-width: 0; }
  body .hit-document h3 { margin: 0 0 8px; font-size: 16px; font-weight: 800; line-height: 1.4; letter-spacing: -.015em; overflow-wrap: anywhere; }
  body .hit-document .hit-thema { margin: 0; color: #586863; font-size: 12px; line-height: 1.5; }
  body .hit-context { margin: 10px 0 0; color: #657370; font-size: 10px; line-height: 1.45; }
  body .hit-document .hit-why { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--hc-bd); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
  body .hit-open { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--hc-bd); color: var(--hc); font-size: 12px; font-weight: 800; }
  body .hit-open svg { flex: 0 0 14px; }
  body .editor-hub-tile, body .editor-tool-tile {
    align-items: flex-start; justify-content: flex-start; text-align: left; padding: 20px;
    aspect-ratio: auto; min-height: 190px;
  }
  body .editor-hub-tile strong, body .editor-tool-tile strong { font-size: 1.1rem; line-height: 1.3; text-align: left; }
  body .editor-hub-tile small, body .editor-tool-tile small { font-size: .85rem; line-height: 1.5; text-align: left; color: var(--ink-soft); }
  body .editor-hub-tile .editor-hub-ico, body .editor-tool-tile .editor-tool-ico { width: 42px; height: 42px; border-radius: var(--ui-radius); background: var(--ink); color: var(--brand); }
  body .editor-hub-tile.is-toolbox .editor-hub-ico, body .editor-tool-tile.is-abgabe .editor-tool-ico { background: var(--ink); color: var(--brand); }
  body .editor-hub-ico svg { width: 23px; height: 23px; }
  body :is(.pa-teaser-icon, .hf-teaser-icon, .plakat-teaser-icon) { border-radius: var(--ui-radius); }
  body .bdw-media-open { border-radius: 3px 3px 0 0; }
  body .bdw-reactions.is-compact { border-radius: 0 0 3px 3px; }
  body .bdw-share-disclosure, body .bdw-approved { margin-left: 0; margin-right: 0; max-width: none; }
  body .bdw-share-toggle { border-radius: var(--ui-radius); box-shadow: none; }
  body .bdw-share-toggle-icon { border-radius: var(--ui-radius); }
  body .detail { border-radius: var(--ui-radius); box-shadow: none; }
  body .usage-dashboard { max-width: none; margin: 0; }
  body :is(.usage-filters, .usage-kpi, .usage-card, .usage-privacy, .usage-highlights article) { border-radius: var(--ui-radius); }
  body .usage-head .btn-ghost { color: #fff; border-color: #ffffff55; }
  body .editor-gate-card { text-align: left; border-radius: var(--ui-radius); }
  body .editor-gate-card :is(h1,p,form) { text-align: left; }
  body .editor-gate-card input[type=password] { width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: var(--ui-radius); padding: 10px 12px; background: #fff; }
  body .editor-gate-card form { display: grid; gap: 14px; }
  body .editor-empty-area { text-align: left; align-items: flex-start; }
  body .editor-empty-area h2, body .editor-empty-area p { width: 100%; }
  body .empty h2 { text-align: inherit; }

  /* Prüfungseditor: dieselbe Schrift, Kanten und Titelhierarchie wie im Unterrichtseditor. */
  .gbs-generator { --radius: 4px; --radius-lg: 4px; --font-display: var(--font-body); }
  .gbs-generator > div > header { border-radius: 0; padding: 24px; }
  .gbs-generator > div > header h1 { font-family: var(--font-body); font-weight: 800; font-size: clamp(1.65rem, 2.3vw, 2.1rem); line-height: 1.18; letter-spacing: -.035em; }
  .gbs-generator > div > header h1::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 12px; background: var(--brand); vertical-align: .15em; }
  .gbs-generator .sg-pill { border-radius: 4px; }
  .gbs-generator .sg-btn-secondary, .gbs-generator .sg-btn-primary, .gbs-generator .sg-btn-ghost { border-radius: 4px; }
  .gbs-tool { --brand: #c7d300; --ink: #142126; }
  .gbs-tool .ui { padding: 0 var(--ui-gutter) 32px; }
  .gbs-tool .ui :is(button,textarea,input,select) { font-family: var(--font-body); border-radius: var(--ui-radius); }
  .gbs-tool .ui :is(.panel,.preview-stage) { border-radius: var(--ui-radius); }
  .gbs-tool .ui .backlink { color: #fff; }
  .gbs-tool .ui .ui-page-head h1 { display: block; overflow-wrap: normal; hyphens: auto; }
  .gbs-tool .ui .ui-page-head h1::before { display: inline-block; margin-right: 12px; vertical-align: .15em; }
  .gbs-tool footer.appfoot { padding-inline: var(--ui-gutter); }
}
@media screen and (max-width: 860px) {
  :root { --ui-gutter: 16px; --ui-gap: 12px; }
  body :is(.view, .gbs-tool .ui) .ui-page-head { min-height: 88px; padding-block: 20px; margin-bottom: 20px; }
  body :is(.view, .gbs-tool .ui) .ui-page-head h1 { font-size: clamp(1.3rem, 6vw, 1.65rem); }
  body .page-lead { font-size: .88rem; margin-bottom: 20px; }
  body .view > .detail { padding: 16px; }
  body .filterbar { gap: 12px; }
  body .filter-group { min-width: 0; flex: 1 1 130px; }
  body .filter-group select { width: 100%; max-width: 100%; }
  body .la-search .btn-label { display: inline; }
  body .editor-hub-tile, body .editor-tool-tile { padding: 16px; }
}
@media screen and (max-width: 760px) {
  body .hit-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body .hit-document .hit-head { padding: 12px 10px 8px; }
  body .hit-document .hit-auf { font-size: 24px; }
  body .hit-kind { font-size: 8px; letter-spacing: .03em; }
  body .hit-cover { margin-inline: 10px; }
  body .hit-caption { padding: 12px 10px; }
  body .hit-document h3 { font-size: 14px; }
  body .hit-document .hit-thema { font-size: 11px; }
  body .hit-open { padding: 10px; font-size: 11px; }
}
@media screen and (max-width: 350px) {
  body .hit-list { grid-template-columns: minmax(0, 1fr); }
}
@media screen and (prefers-reduced-motion: reduce) {
  .norm-card, .sem-card, .hit, .editor-hub-tile, .editor-tool-tile { transition: none; }
}
