/* ==========================================================================
   Intranet – Startseite
   Farben --primary / --accent werden aus den Einstellungen gesetzt.
   ========================================================================== */

:root {
    --primary: #1f3a5f;
    --primary-dark: #172c48;
    --primary-soft: #e9edf2;
    --primary-tint: #c7cfd9;
    --accent: #b8925a;
    --accent-dark: #937548;
    --accent-soft: #f4ede3;

    --text: #1d2430;
    --muted: #5d6675;
    --line: #e2e6ec;
    --bg: #ffffff;
    --bg-alt: #f5f7fa;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-hover: 0 10px 24px -8px rgba(16, 24, 40, .18);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

    --ev-blue: #2f6db5;
    --ev-green: #2e8b57;
    --ev-gold: #b8860b;
    --ev-red: #c0392b;
    --ev-purple: #7a4fb0;
    --ev-gray: #6b7280;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .container { padding: 0 16px; } }

.icon { width: 20px; height: 20px; flex: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 600; font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn .icon { width: 18px; height: 18px; }
.btn--small { padding: 6px 12px; font-size: 14px; }
.btn--outline { background: transparent; color: var(--primary); }
.btn--outline:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--ghost:hover { background: var(--bg-alt); border-color: var(--primary-tint); }
.btn--danger { background: var(--ev-red); border-color: var(--ev-red); }
.btn--danger.btn--ghost { background: transparent; color: var(--ev-red); border-color: transparent; }
.btn--danger.btn--ghost:hover { background: #fdecea; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px;
    border: 1px solid var(--line); border-radius: 8px;
    background: #fff; cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--bg-alt); border-color: var(--primary-tint); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Banner / Meldungen ---------- */
/* Meldungen stehen unter der Begrüßung als Boxen */
.alerts { padding-top: 28px; }
.alerts__list { display: flex; flex-direction: column; gap: 10px; }
.alerts:not(:has(.alert:not(.is-hidden))) { display: none; }
.alert { font-size: 15px; border: 1px solid rgba(0,0,0,.07); border-left-width: 4px; border-radius: var(--radius); box-shadow: var(--shadow); }
.alert__inner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px 12px 16px; }
.alert__icon { display: flex; padding-top: 1px; }
.alert__text { flex: 1; min-width: 0; }
.alert__text strong { margin-right: 8px; }
.alert__msg { opacity: .92; }
.alert__link { margin-left: 8px; font-weight: 600; color: inherit; white-space: nowrap; }
.alert__close {
    display: grid; place-items: center; width: 28px; height: 28px;
    border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; opacity: .7;
}
.alert__close:hover { opacity: 1; background: rgba(0,0,0,.07); }
.alert__close .icon { width: 18px; height: 18px; }

.alert--info    { background: var(--primary-soft); color: var(--primary-dark); border-left-color: var(--primary); }
.alert--success { background: #e5f3ea; color: #1d5e36; border-left-color: #2e8b57; }
.alert--warning { background: #fcf1d6; color: #6e4b00; border-left-color: #d9a21b; }
.alert--danger  { background: #b42318; color: #fff; border-color: #b42318; border-left-color: #7a1710; }
.alert--danger .alert__close:hover { background: rgba(255,255,255,.15); }
.alert.is-hidden { display: none; }

/* ---------- Kopfbereich ---------- */
.site-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255,255,255,.97);
    backdrop-filter: saturate(160%) blur(6px);
    border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); min-width: 0; }
.brand__logo { height: 48px; width: auto; display: block; }
.brand__mark {
    display: grid; place-items: center;
    width: 46px; height: 46px; flex: none;
    border-radius: 8px;
    background: var(--primary); color: #fff;
    font-weight: 700; letter-spacing: .04em; font-size: 15px;
    box-shadow: inset 0 -3px 0 var(--accent);
}
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__title { font-weight: 700; font-size: 19px; color: var(--primary); letter-spacing: -.01em; }
.brand__org { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.main-nav { display: flex; align-items: center; gap: 26px; }
.main-nav > a:not(.btn) {
    text-decoration: none; color: var(--text); font-weight: 600; font-size: 15px;
    padding: 6px 0; border-bottom: 2px solid transparent;
}
.main-nav > a:not(.btn):hover { color: var(--primary); border-bottom-color: var(--accent); }
.main-nav .nav-admin { display: inline-flex; align-items: center; gap: 6px; color: var(--muted) !important; font-weight: 500 !important; }
.main-nav .nav-admin .icon { width: 16px; height: 16px; }
@media (max-width: 720px) {
    .main-nav > a:not(.btn):not(.nav-admin) { display: none; }
    .brand__org { display: none; }
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    background:
        linear-gradient(120deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary) 100%);
    color: #fff;
    overflow: hidden;
}
.hero::after {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(circle at 92% -20%, rgba(255,255,255,.10) 0 220px, transparent 221px),
        radial-gradient(circle at 80% 140%, rgba(255,255,255,.06) 0 260px, transparent 261px);
    pointer-events: none;
}
.hero__inner {
    position: relative; z-index: 1;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; flex-wrap: wrap;
    padding-top: 52px; padding-bottom: 52px;
}
.hero__date { margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-soft); opacity: .9; }
.hero__title { font-size: clamp(30px, 4vw, 42px); font-weight: 700; letter-spacing: -.02em; }
.hero__title::after { content: ""; display: block; width: 56px; height: 3px; background: var(--accent); margin-top: 16px; border-radius: 2px; }
.hero__subtitle { margin: 16px 0 0; max-width: 620px; font-size: 17px; color: rgba(255,255,255,.85); }

.hero-search {
    display: flex; align-items: center; gap: 10px;
    width: min(380px, 100%);
    background: #fff; color: var(--muted);
    border-radius: 999px; padding: 4px 6px 4px 18px;
    box-shadow: 0 8px 24px -10px rgba(0,0,0,.35);
}
.hero-search input { flex: 1; border: 0; outline: 0; padding: 10px 8px 10px 0; background: transparent; color: var(--text); min-width: 0; }

/* ---------- Abschnitte ---------- */
.section { padding: 56px 0; }
.alerts + main > .section:first-child { padding-top: 40px; }
.section--alt { background: var(--bg-alt); border-top: 1px solid var(--line); }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section__title { font-size: 28px; font-weight: 700; color: var(--primary); letter-spacing: -.01em; }
.edit-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--accent-dark); }
.edit-link .icon { width: 16px; height: 16px; }
.empty { color: var(--muted); }

/* ---------- Link-Boxen ---------- */
.link-group + .link-group { margin-top: 36px; }
.link-group__title {
    font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
    color: var(--muted); margin-bottom: 14px;
    display: flex; align-items: center; gap: 12px;
}
.link-group__title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
    display: flex; align-items: center; gap: 14px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none; color: var(--text);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--primary-tint); }
.card__icon {
    display: grid; place-items: center;
    width: 46px; height: 46px; flex: none;
    border-radius: 10px;
    background: var(--accent-soft); color: var(--accent-dark);
    transition: background .15s, color .15s;
}
.card:hover .card__icon { background: var(--primary); color: #fff; }
.card__icon .icon { width: 22px; height: 22px; }
.card__body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card__title { font-weight: 650; font-size: 16px; color: var(--primary-dark); overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.card__desc { font-size: 14px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.card__arrow { color: var(--primary-tint); transition: color .15s, transform .15s; }
.card__arrow .icon { width: 18px; height: 18px; }
.card:hover .card__arrow { color: var(--accent); transform: translateX(2px); }

/* ---------- Favoriten ---------- */
.card-wrap { position: relative; display: flex; min-width: 0; }
.card-wrap > .card { flex: 1; min-width: 0; padding-right: 22px; }
.card-wrap .card__arrow { align-self: flex-end; }
.pin-btn {
    position: absolute; top: 6px; right: 6px;
    display: grid; place-items: center;
    width: 30px; height: 30px;
    border: 0; border-radius: 8px; background: transparent;
    color: #a6adb8; cursor: pointer;
    opacity: 0; transition: opacity .15s, color .15s, background .15s;
}
.pin-btn .icon { width: 17px; height: 17px; }
.card-wrap:hover .pin-btn, .pin-btn:focus-visible { opacity: 1; }
.pin-btn:hover { background: var(--accent-soft); color: var(--accent-dark); }
.pin-btn[aria-pressed="true"] { opacity: 1; color: var(--accent); }
.pin-btn[aria-pressed="true"] .icon { fill: currentColor; }
@media (hover: none) { .pin-btn { opacity: .55; } .pin-btn[aria-pressed="true"] { opacity: 1; } }

.link-group--fav {
    padding: 18px; margin-bottom: 36px;
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: calc(var(--radius) + 4px);
}
.link-group--fav .link-group__title { color: var(--accent-dark); }
.link-group--fav .link-group__title .icon { width: 15px; height: 15px; fill: currentColor; }
.link-group--fav .link-group__title::after { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.link-group--fav + .link-group { margin-top: 0; }
.fav-hint { margin: 12px 0 0; font-size: 13px; color: var(--accent-dark); opacity: .8; }

/* ---------- Kalender ---------- */
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 980px) { .calendar-layout { grid-template-columns: 1fr; } }

.calendar, .upcoming {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.calendar__toolbar { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.calendar__month { font-size: 20px; font-weight: 700; color: var(--primary); min-width: 190px; text-align: center; }
.calendar__toolbar [data-cal="today"] { margin-left: auto; }

.calendar__weekdays, .calendar__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar__weekdays span {
    padding: 10px 10px 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
    border-bottom: 1px solid var(--line);
}
.day {
    position: relative;
    min-height: 112px;
    padding: 6px 6px 8px;
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
    background: #fff;
    display: flex; flex-direction: column; gap: 3px;
    min-width: 0;
}
.day:nth-child(7n) { border-right: 0; }
.calendar__grid .day:nth-last-child(-n+7) { border-bottom: 0; }
.day--weekend { background: #fafbfc; }
.day--other { background: #f7f8fa; }
.day--other .day__num { color: #a6adb8; }
.day--holiday { background: var(--accent-soft); }
.day--clickable { cursor: pointer; }
.day--clickable:hover { box-shadow: inset 0 0 0 2px var(--primary-tint); }
.day__head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.day__num {
    display: inline-grid; place-items: center;
    min-width: 28px; height: 28px; padding: 0 4px;
    font-size: 14px; font-weight: 600; border-radius: 999px;
}
.day--today .day__num { background: var(--primary); color: #fff; }
.day__holiday {
    font-size: 11px; color: var(--accent-dark); font-weight: 600; line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px;
}

.chip {
    display: block; width: 100%;
    border: 0; border-left: 3px solid var(--c);
    background: color-mix(in srgb, var(--c) 12%, #fff);
    color: var(--text);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12.5px; line-height: 1.35; text-align: left;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer;
}
.chip:hover { background: color-mix(in srgb, var(--c) 22%, #fff); }
.chip--allday { background: var(--c); color: #fff; border-left-color: var(--c); }
.chip--allday:hover { background: color-mix(in srgb, var(--c) 85%, #000); }
.chip time { font-weight: 700; margin-right: 4px; }
.day__more { border: 0; background: none; padding: 0 4px; font-size: 12px; color: var(--primary); font-weight: 600; cursor: pointer; text-align: left; }
.day__dots { display: none; gap: 3px; flex-wrap: wrap; padding: 0 4px; }
.day__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

@media (max-width: 680px) {
    .day { min-height: 62px; padding: 4px 2px; align-items: center; cursor: pointer; }
    .day .chip, .day__more, .day__holiday { display: none; }
    .day__dots { display: flex; justify-content: center; }
    .calendar__month { min-width: 0; font-size: 17px; flex: 1; }
    .calendar__weekdays span { text-align: center; padding: 8px 0; }
}

.ev-color--blue   { --c: var(--ev-blue); }
.ev-color--green  { --c: var(--ev-green); }
.ev-color--gold   { --c: var(--ev-gold); }
.ev-color--red    { --c: var(--ev-red); }
.ev-color--purple { --c: var(--ev-purple); }
.ev-color--gray   { --c: var(--ev-gray); }

/* Nächste Termine */
.upcoming { padding: 18px; }
.upcoming__title { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 12px; }
.upcoming__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.up-item {
    display: flex; gap: 14px; align-items: center; width: 100%;
    padding: 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer;
}
.up-item:hover { background: var(--bg-alt); }
.up-date {
    flex: none; width: 50px; text-align: center;
    border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fff;
}
.up-date b { display: block; font-size: 20px; line-height: 1.1; padding-top: 4px; color: var(--primary-dark); }
.up-date small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: #fff; background: var(--c); padding: 2px 0; }
.up-info { min-width: 0; }
.up-info strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-info span { font-size: 13px; color: var(--muted); }

/* ---------- Dialoge ---------- */
.modal {
    width: min(520px, calc(100vw - 32px));
    padding: 0; border: 0; border-radius: 14px;
    box-shadow: 0 24px 60px -12px rgba(16,24,40,.35);
    color: var(--text);
}
.modal::backdrop { background: rgba(16, 24, 40, .45); }
.modal__head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal__head h3 { flex: 1; font-size: 19px; color: var(--primary-dark); }
.modal__swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; }
.modal__body { padding: 18px 20px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg-alt); border-radius: 0 0 14px 14px; }
.ev-meta { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 10px; color: var(--muted); }
.ev-meta .icon { width: 18px; height: 18px; margin-top: 3px; }
.ev-desc { white-space: pre-line; margin: 14px 0 0; }
.ev-by { font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.day-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.day-list .chip { white-space: normal; font-size: 14px; padding: 8px 10px; }

/* ---------- Formulare ---------- */
.form .field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.form .field > span { font-size: 14px; font-weight: 600; }
.form input:not([type=checkbox]):not([type=radio]), .form textarea, .form select {
    width: 100%; padding: 9px 12px;
    border: 1px solid #cfd5de; border-radius: 8px; background: #fff;
}
.form input:focus, .form textarea:focus, .form select:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field-row { display: grid; grid-template-columns: 1fr 140px; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; font-weight: 500; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.swatches { display: flex; gap: 8px; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 28px; height: 28px; border-radius: 50%; background: var(--c); cursor: pointer; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatch input:focus-visible + span { outline: 3px solid var(--accent); }
.form-error { color: var(--ev-red); font-weight: 600; margin: 0; }

/* ---------- Fußzeile ---------- */
.site-footer { background: var(--primary-dark); color: rgba(255,255,255,.75); font-size: 14px; }
.site-footer__inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 22px; }

@media print {
    .alerts, .site-header, .hero-search, .calendar__toolbar button, .site-footer { display: none; }
}
