/* ============================================================
   Lilly Knowledge — App-Styles (Shell-spezifisch)
   Light-Theme (Teal/Gold) passend zur Wissensbibliothek.
   Generische Basis (Token, Reset, Buttons, Forms, Utilities,
   Toast) liegt in base.css und wird VOR dieser Datei geladen.
   ============================================================ */

/* ---------- Auth-Screen ---------- */
.lk-auth-screen {
	min-height: 100vh; display: flex; flex-direction: column;
	align-items: center; justify-content: center; gap: 26px; padding: 24px;
}
.lk-auth-brand { text-align: center; }
.lk-auth-logo {
	display: inline-grid; place-items: center;
	width: 62px; height: 62px; border-radius: 16px; font-size: 0;
	background:
		url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%20fill='white'%3E%3Cellipse%20cx='22'%20cy='30'%20rx='8'%20ry='6.5'/%3E%3Cellipse%20cx='14'%20cy='20'%20rx='3.2'%20ry='4.2'/%3E%3Cellipse%20cx='20'%20cy='16'%20rx='3.2'%20ry='4.5'/%3E%3Cellipse%20cx='26'%20cy='17'%20rx='3.2'%20ry='4.5'/%3E%3Cellipse%20cx='31'%20cy='21'%20rx='3.2'%20ry='4.2'/%3E%3Cellipse%20cx='42'%20cy='48'%20rx='8'%20ry='6.5'/%3E%3Cellipse%20cx='34'%20cy='38'%20rx='3.2'%20ry='4.2'/%3E%3Cellipse%20cx='40'%20cy='34'%20rx='3.2'%20ry='4.5'/%3E%3Cellipse%20cx='46'%20cy='35'%20rx='3.2'%20ry='4.5'/%3E%3Cellipse%20cx='51'%20cy='39'%20rx='3.2'%20ry='4.2'/%3E%3C/svg%3E") no-repeat center / 34px 34px,
		linear-gradient(135deg, var(--primary), var(--primary-dark));
	box-shadow: var(--shadow); margin-bottom: 10px;
}
.lk-auth-brand h1 { font-size: 24px; color: var(--primary-dark); }
.lk-auth-tagline { color: var(--muted); font-size: 14px; margin-top: 2px; }
.lk-auth-card {
	width: 100%; max-width: 380px; background: var(--paper);
	border: 1px solid var(--line); border-radius: var(--radius);
	box-shadow: var(--shadow); padding: 26px 24px;
}

/* ---------- Topbar ---------- */
.lk-topbar {
	position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
	display: flex; align-items: center; gap: 20px; padding: 0 22px;
	background: linear-gradient(135deg, var(--primary), var(--primary-dark));
	color: #fff; box-shadow: 0 2px 12px rgba(13, 107, 110, .25);
}
.lk-topbar-brand { display: flex; align-items: center; gap: 11px; }
.lk-topbar-logo {
	width: 36px; height: 36px; border-radius: 9px; font-size: 0;
	background:
		url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%20fill='white'%3E%3Cellipse%20cx='22'%20cy='30'%20rx='8'%20ry='6.5'/%3E%3Cellipse%20cx='14'%20cy='20'%20rx='3.2'%20ry='4.2'/%3E%3Cellipse%20cx='20'%20cy='16'%20rx='3.2'%20ry='4.5'/%3E%3Cellipse%20cx='26'%20cy='17'%20rx='3.2'%20ry='4.5'/%3E%3Cellipse%20cx='31'%20cy='21'%20rx='3.2'%20ry='4.2'/%3E%3Cellipse%20cx='42'%20cy='48'%20rx='8'%20ry='6.5'/%3E%3Cellipse%20cx='34'%20cy='38'%20rx='3.2'%20ry='4.2'/%3E%3Cellipse%20cx='40'%20cy='34'%20rx='3.2'%20ry='4.5'/%3E%3Cellipse%20cx='46'%20cy='35'%20rx='3.2'%20ry='4.5'/%3E%3Cellipse%20cx='51'%20cy='39'%20rx='3.2'%20ry='4.2'/%3E%3C/svg%3E") no-repeat center / 22px 22px,
		rgba(255, 255, 255, .16);
	display: grid; place-items: center;
}
.lk-topbar-titles { display: flex; flex-direction: column; line-height: 1.2; }
.lk-topbar-title { font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.lk-topbar-sub { font-size: 11.5px; opacity: .85; }
.lk-nav { display: flex; gap: 4px; margin-left: 8px; }
.lk-nav-btn {
	font: inherit; font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, .82);
	background: transparent; border: 0; padding: 8px 14px; border-radius: 7px; cursor: pointer;
	transition: background .15s ease, color .15s ease;
}
.lk-nav-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.lk-nav-btn.is-active { background: rgba(255, 255, 255, .2); color: #fff; }
.lk-topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lk-topbar-username { font-size: 13.5px; font-weight: 600; opacity: .92; }

/* ---------- Shell: Sidebar (IMMER sichtbar) + Hauptbereich ---------- */
.lk-shell { display: flex; align-items: flex-start; }
.lk-sidebar {
	position: sticky; top: var(--topbar-h); align-self: flex-start;
	flex: none; width: 290px; height: calc(100vh - var(--topbar-h));
	overflow-y: auto; background: var(--paper); border-right: 1px solid var(--line);
	padding: 16px 14px; display: flex; flex-direction: column; gap: 16px;
}

/* Globale Suche (fehlertolerant, über ALLE Dokumente) */
.lk-gsearch { position: relative; flex: none; }
.lk-gsearch-input {
	width: 100%; font: inherit; font-size: 14px; padding: 9px 12px 9px 34px;
	border: 1px solid var(--line); border-radius: var(--radius-sm);
	background: var(--bg) url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='18'%20height='18'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%237a869a'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='11'%20cy='11'%20r='8'/%3E%3Cline%20x1='21'%20y1='21'%20x2='16.65'%20y2='16.65'/%3E%3C/svg%3E") no-repeat 10px center / 16px 16px;
	color: var(--ink); outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.lk-gsearch-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background-color: var(--paper); }
.lk-gsearch-results {
	position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
	max-height: 65vh; overflow-y: auto; background: var(--paper);
	border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
	padding: 6px;
}
.lk-gsearch-results[hidden] { display: none; }
.lk-gres {
	display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
	background: none; border: 0; border-radius: var(--radius-sm); padding: 8px 10px;
}
.lk-gres:hover, .lk-gres.is-active { background: var(--primary-soft); }
.lk-gres-head { font-weight: 700; font-size: 13.5px; color: var(--primary-dark); }
.lk-gres-doc { font-size: 11px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-top: 1px; }
.lk-gres-snip {
	font-size: 12.5px; color: var(--muted); margin-top: 3px;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lk-gsearch-empty { padding: 12px 10px; font-size: 13px; color: var(--muted); text-align: center; }

/* Fächer-Navigation: Dokumente gruppiert nach Fach */
.lk-fnav { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.lk-fnav-empty { font-size: 13px; color: var(--muted); padding: 8px 4px; }
.lk-fnav-group { display: flex; flex-direction: column; gap: 2px; }
.lk-fnav-fach {
	font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px;
	color: var(--accent); font-weight: 700; padding: 4px 8px 5px;
	border-left: 3px solid var(--accent); margin-bottom: 2px;
}
.lk-fnav-doc {
	display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
	font: inherit; font-size: 13.5px; color: var(--ink-soft); cursor: pointer;
	background: none; border: 0; border-left: 3px solid transparent;
	padding: 7px 9px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	transition: background .15s ease, color .15s ease;
}
.lk-fnav-doc:hover { background: var(--primary-soft); color: var(--primary-dark); }
.lk-fnav-doc.is-active { background: var(--primary-soft); color: var(--primary-dark); border-left-color: var(--primary); font-weight: 600; }
.lk-fnav-doc-icon { flex: none; font-size: 16px; line-height: 1; }
.lk-fnav-doc-title { flex: 1; min-width: 0; }

/* ---------- Main / Panels ---------- */
.lk-main { flex: 1; min-width: 0; padding: 26px 22px; }
.lk-main.is-doc { padding: 0; }
/* App-natives Lernmaterial: feste Viewport-Höhe als Anker, damit die interne
   Höhen-Kette (.lk-lmhost -> .lk-lm -> .lm-main) greift und .lm-main scrollt
   (sonst kollabiert height:100% am auto-hohen Shell-Container). */
.lk-main.is-doc.is-native { height: calc(100vh - var(--topbar-h)); overflow: hidden; }
.lk-loading, .lk-empty {
	text-align: center; color: var(--muted); padding: 50px 20px; font-size: 15px;
}
.lk-panel { animation: lk-fade .2s ease; }
.lk-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.lk-panel-title { font-size: 21px; color: var(--primary-dark); }
.lk-panel-sub { color: var(--muted); font-size: 14px; margin-top: -6px; margin-bottom: 20px; }

@keyframes lk-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Karten / Bibliothek ---------- */
.lk-catsection { margin-bottom: 26px; }
.lk-catsection-title {
	font-size: 13px; text-transform: uppercase; letter-spacing: .8px;
	color: var(--accent); font-weight: 700; margin-bottom: 12px;
	border-left: 3px solid var(--accent); padding-left: 9px;
}
.lk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.lk-doccard {
	display: flex; align-items: center; gap: 14px; text-align: left;
	background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 16px 18px; cursor: pointer; font: inherit; color: var(--ink);
	transition: all .15s ease; box-shadow: var(--shadow);
}
.lk-doccard:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(13, 107, 110, .16); }
.lk-doccard-icon {
	flex: none; width: 44px; height: 44px; border-radius: 11px; font-size: 22px;
	display: grid; place-items: center; background: var(--primary-soft);
}
.lk-doccard-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lk-doccard-title { font-weight: 700; font-size: 15.5px; color: var(--primary-dark); }
.lk-doccard-desc { font-size: 13px; color: var(--muted); }
.lk-doccard-arrow { flex: none; font-size: 22px; color: var(--muted); }

/* ---------- Dokument-Ansicht (iframe) ---------- */
.lk-docview { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); }
.lk-docbar {
	display: flex; align-items: center; gap: 14px; padding: 10px 18px;
	background: var(--paper); border-bottom: 1px solid var(--line);
}
.lk-docbar-title { font-weight: 700; color: var(--primary-dark); font-size: 15px; }
.lk-docframe { flex: 1; width: 100%; border: 0; background: var(--bg); }

/* ---------- Tabelle (Shell-Container/Aktionen; .lk-table selbst in base.css) ---------- */
.lk-tablewrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.lk-col-actions { text-align: right; white-space: nowrap; }
.lk-col-actions .lk-btn { margin-left: 6px; }

/* ---------- Modal ---------- */
.lk-modal-overlay {
	position: fixed; inset: 0; z-index: 60; background: rgba(13, 38, 59, .5);
	display: flex; align-items: flex-start; justify-content: center; padding: 5vh 20px; overflow-y: auto;
}
.lk-modal-overlay[hidden] { display: none; }
.lk-modal {
	width: 100%; max-width: 620px; background: var(--paper);
	border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 22px 24px;
	animation: lk-pop .18s ease;
}
@keyframes lk-pop { from { opacity: 0; transform: translateY(-12px) scale(.98); } to { opacity: 1; transform: none; } }
.lk-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.lk-modal-title { font-size: 19px; color: var(--primary-dark); }
.lk-modal-close { font-size: 26px; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; }
.lk-modal-close:hover { color: var(--red); }
.lk-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Sitzungs-Ablauf-Warnung ---------- */
.lk-idle-overlay {
	position: fixed; inset: 0; z-index: 90;
	background: rgba(13, 38, 59, .55);
	display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lk-idle-overlay[hidden] { display: none; }
.lk-idle-card {
	width: 100%; max-width: 420px; text-align: center;
	background: var(--paper); border-radius: var(--radius);
	box-shadow: var(--shadow-lg); padding: 30px 28px; animation: lk-pop .18s ease;
}
.lk-idle-icon { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.lk-idle-title { font-size: 20px; color: var(--primary-dark); margin-bottom: 10px; }
.lk-idle-text { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 22px; }
.lk-idle-text b { color: var(--red); font-variant-numeric: tabular-nums; }
.lk-idle-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
	.lk-topbar { gap: 10px; padding: 0 14px; }
	.lk-topbar-sub, .lk-topbar-username { display: none; }
	.lk-nav { margin-left: 0; }
	.lk-nav-btn { padding: 7px 9px; font-size: 13px; }
	.lk-form-grid { grid-template-columns: 1fr; }
	.lk-main { padding: 18px 14px; }

	/* Sidebar bleibt sichtbar, rückt aber nach oben über den Inhalt */
	.lk-shell { flex-direction: column; }
	.lk-sidebar {
		position: static; width: 100%; height: auto; max-height: 46vh;
		border-right: 0; border-bottom: 1px solid var(--line);
	}
	.lk-gsearch-results { max-height: 50vh; }
}

/* Login: "Zugangsdaten merken" */
.lk-remember {
	display: flex; align-items: center; gap: 8px;
	font-size: 13.5px; color: var(--ink-soft); cursor: pointer;
	user-select: none; margin: -2px 0 14px;
}
.lk-remember input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
