/* ============================================================
   Lilly Knowledge — App-Styles
   Light-Theme (Teal/Gold) passend zur Wissensbibliothek
   ============================================================ */

:root {
	--bg: #f6f8fb;
	--paper: #ffffff;
	--ink: #1f2733;
	--ink-soft: #4a5568;
	--muted: #7a869a;
	--line: #e3e9f2;
	--primary: #0d6b6e;
	--primary-dark: #0a5557;
	--primary-soft: #e6f2f2;
	--accent: #b8860b;
	--accent-soft: #fbf3df;
	--blue: #2563eb;
	--green: #1f8a4c;
	--green-soft: #e6f5ec;
	--red: #c0392b;
	--red-soft: #fdecea;
	--radius: 10px;
	--radius-sm: 7px;
	--shadow: 0 2px 14px rgba(13, 107, 110, .10);
	--shadow-lg: 0 12px 40px rgba(13, 38, 59, .22);
	--topbar-h: 62px;
	--font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body.lk-body {
	font-family: var(--font);
	background: var(--bg);
	color: var(--ink);
	line-height: 1.55;
	font-size: 15px;
	min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.lk-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	font: inherit; font-weight: 600; font-size: 14px;
	padding: 9px 16px; border-radius: var(--radius-sm);
	border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft);
	cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.lk-btn:hover { border-color: var(--primary); color: var(--primary); }
.lk-btn:disabled { opacity: .55; cursor: not-allowed; }
.lk-btn-primary {
	background: linear-gradient(135deg, var(--primary), var(--primary-dark));
	border-color: transparent; color: #fff;
}
.lk-btn-primary:hover { color: #fff; filter: brightness(1.07); }
.lk-btn-ghost { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .35); color: #fff; }
.lk-btn-ghost:hover { background: rgba(255, 255, 255, .26); color: #fff; border-color: #fff; }
.lk-btn-danger { color: var(--red); border-color: #f0c5c0; }
.lk-btn-danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.lk-btn-sm { padding: 6px 11px; font-size: 13px; }
.lk-btn-block { width: 100%; }

/* ---------- Forms ---------- */
.lk-form { display: flex; flex-direction: column; gap: 14px; }
.lk-field { display: flex; flex-direction: column; gap: 5px; }
.lk-field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.lk-field input, .lk-field select {
	font: inherit; font-size: 14.5px; padding: 10px 12px;
	border: 1px solid var(--line); border-radius: var(--radius-sm);
	background: var(--paper); color: var(--ink); outline: none; width: 100%;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.lk-field input:focus, .lk-field select:focus {
	border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.lk-hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.lk-form-intro { font-size: 14px; color: var(--ink-soft); }
.lk-form-foot { text-align: center; font-size: 13.5px; margin-top: 2px; }
.lk-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lk-field-wide { grid-column: 1 / -1; }
.lk-pw-row { display: flex; gap: 8px; align-items: stretch; }
.lk-pw-row input { flex: 1; }
.lk-pw-row .lk-input-wrap { flex: 1; }

/* Passwort ein-/ausblenden (Auge) */
.lk-input-wrap { position: relative; display: block; }
.lk-input-wrap > input { padding-right: 44px; }
.lk-pw-toggle {
	position: absolute; top: 0; right: 0; height: 100%; width: 42px;
	border: 0; padding: 0; cursor: pointer; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	background-color: transparent;
	background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%2364748b'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M2%2012s3.5-7%2010-7%2010%207%2010%207-3.5%207-10%207-10-7-10-7z'/%3E%3Ccircle%20cx='12'%20cy='12'%20r='3'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: center; background-size: 21px 21px;
}
.lk-pw-toggle:hover { background-color: rgba(13, 107, 110, .07); }
.lk-pw-toggle.is-on {
	background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%230d6b6e'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M17.94%2017.94A10.07%2010.07%200%200%201%2012%2020c-7%200-10-7-10-7a18.45%2018.45%200%200%201%205.06-5.94M9.9%204.24A9.12%209.12%200%200%201%2012%204c7%200%2010%207%2010%207a18.5%2018.5%200%200%201-2.16%203.19m-6.72-1.07a3%203%200%201%201-4.24-4.24'/%3E%3Cline%20x1='1'%20y1='1'%20x2='23'%20y2='23'/%3E%3C/svg%3E");
}

.lk-form-msg { font-size: 13.5px; min-height: 0; }
.lk-form-msg:empty { display: none; }
.lk-form-msg.is-error { color: var(--red); background: var(--red-soft); padding: 9px 12px; border-radius: var(--radius-sm); }
.lk-form-msg.is-success { color: var(--green); background: var(--green-soft); padding: 9px 12px; border-radius: var(--radius-sm); }

/* ---------- 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 ---------- */
.lk-tablewrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.lk-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lk-table th {
	text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
	color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 2px solid var(--line);
	white-space: nowrap;
}
.lk-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.lk-table tr:last-child td { border-bottom: 0; }
.lk-table tbody tr:hover { background: var(--primary-soft); }
.lk-col-actions { text-align: right; white-space: nowrap; }
.lk-col-actions .lk-btn { margin-left: 6px; }

.lk-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.lk-badge-admin { background: var(--accent-soft); color: var(--accent); }
.lk-badge-leser { background: var(--primary-soft); color: var(--primary-dark); }
.lk-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.lk-dot-on { background: var(--green); }
.lk-dot-off { background: var(--muted); }
.lk-muted { color: var(--muted); }

.lk-deflist { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14.5px; }
.lk-deflist dt { color: var(--muted); font-weight: 600; }

.lk-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.lk-card-pad { padding: 20px 22px; }
.lk-card-title { font-size: 16px; color: var(--primary-dark); margin-bottom: 14px; }

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

/* ---------- Toast ---------- */
.lk-toast {
	position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
	z-index: 80; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
	font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
	transition: opacity .2s ease, transform .2s ease; max-width: 90vw;
}
.lk-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.lk-toast.is-error { background: var(--red); }
.lk-toast.is-success { background: var(--green); }

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