:root {
    --navy: #101b32;
    --navy-deep: #0b1427;
    --navy-muted: #98a6be;
    --bg: #f5f7fc;
    --surface: #fff;
    --ink: #17233a;
    --muted: #78859a;
    --line: #e8edf5;
    --blue: #4d67ec;
    --blue-deep: #3c54d9;
    --shadow: 0 12px 36px rgba(27, 44, 91, .045);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 280px; background: var(--bg); color: var(--ink); font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.55; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { max-width: 100%; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #68b3ff; outline-offset: 3px; }
.ui-icon { display: inline-block; width: 22px; height: 22px; flex: none; vertical-align: middle; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 999; background: #fff; border-radius: 10px; padding: 10px 14px; color: #0b1427; }
.skip-link:focus { top: 12px; }
.app-shell { display: flex; min-height: 100dvh; }
.sidebar { width: 260px; flex: 0 0 260px; position: sticky; top: 0; align-self: flex-start; height: 100dvh; min-height: 650px; display: flex; flex-direction: column; padding: 31px 17px 20px; overflow-y: auto; color: #fff; background: radial-gradient(circle at -50px -80px, rgba(92, 110, 244, .3), transparent 50%), linear-gradient(165deg, #172440 0%, var(--navy-deep) 80%); }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 43px; color: #fff; text-decoration: none; }
.brand__mark { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(135deg, #7484ff, #4259d9); box-shadow: 0 9px 20px rgba(41, 64, 173, .25); color: #fff; font-size: 15px; font-weight: 800; letter-spacing: -.5px; flex: none; }
.brand__text { display: grid; line-height: 1.4; }
.brand__text strong { font-size: 14px; letter-spacing: -.2px; }
.brand__text small { font-size: 11px; color: #9caac6; margin-top: 3px; }
.nav-group { margin-bottom: 23px; }
.nav-group__label { margin: 0 14px 11px; color: #7586a5; font-size: 10px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 13px; min-height: 45px; border: 1px solid transparent; padding: 10px 12px; border-radius: 11px; color: #aebad0; text-decoration: none; font-size: 12.5px; font-weight: 600; transition: background .2s ease, color .2s ease; }
.nav-link .ui-icon { width: 18px; height: 18px; stroke-width: 1.9; }
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.is-active { color: #fff; background: linear-gradient(90deg, rgba(88, 104, 236, .6), rgba(86, 102, 213, .15)); border-color: rgba(138, 151, 254, .2); }
.sidebar__bottom { margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 18px 12px 0; border-top: 1px solid rgba(255,255,255,.09); color: #d0d8e9; font-size: 11.5px; font-weight: 600; }
.sidebar__bottom small { color: #7384a3; font-size: 10px; font-weight: 400; }
.sidebar__bottom-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; background: rgba(91, 112, 229, .17); color: #9caafd; }
.sidebar__bottom-icon .ui-icon { width: 17px; height: 17px; }
.workspace { min-width: 0; flex: 1; }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(20px, 4.4vw, 62px); background: rgba(255, 255, 255, .88); border-bottom: 1px solid #e9edf5; }
.topbar__title { display: grid; line-height: 1.3; }
.topbar__eyebrow { color: #9ba5b7; font-size: 9px; font-weight: 800; letter-spacing: 1.4px; }
.topbar__title strong { font-size: 15px; font-weight: 750; }
.topbar__actions { display: flex; align-items: center; gap: 12px; }
.logout-action { color: #60718a; font-size: 12px; }
.logout-action a, .logout-action button, .logout-action input[type="submit"] { display: inline-flex; align-items: center; padding: 9px 13px; border: 1px solid #e3e8f2; background: white; color: #52627c; border-radius: 10px; text-decoration: none; font: inherit; font-weight: 650; }
.logout-action a:hover, .logout-action button:hover, .logout-action input[type="submit"]:hover { background: #f1f4fc; }
.logout-action form { margin: 0; }
.main-content { padding: 0 clamp(20px, 4.4vw, 62px); }
.dashboard { max-width: 1370px; margin: 0 auto; }
.welcome-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 34px 0 35px; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 1.6px; }
.eyebrow--blue { color: #5a71e0; }
.welcome-banner h1 { margin: 5px 0 4px; font-size: clamp(31px, 3.4vw, 43px); font-weight: 800; letter-spacing: -1.7px; line-height: 1.2; }
.title-dot { color: #667cf0; }
.welcome-banner p { margin: 0; font-size: 13px; color: #8a94a6; }
.welcome-banner__badge { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid #e6ebf4; border-radius: 25px; background: #fff; color: #7a8ba4; font-size: 10.5px; font-weight: 650; white-space: nowrap; }
.welcome-banner__badge .ui-icon { width: 14px; height: 14px; color: #5d73e8; }
.dashboard-section { margin-bottom: 35px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.section-heading__overline { color: #a1acc0; font-size: 9px; font-weight: 800; letter-spacing: 1.45px; }
.section-heading h2 { margin: 1px 0 0; font-size: clamp(17px, 1.8vw, 21px); font-weight: 800; letter-spacing: -.6px; }
.section-heading__aside, .section-heading__count { color: #a2adbd; font-size: 11px; }
.section-heading__count { padding-bottom: 2px; }
.tile-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.tile { display: flex; flex-direction: column; min-width: 0; min-height: 183px; padding: 20px 19px 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.tile:hover { transform: translateY(-3px); border-color: #d4dcef; box-shadow: 0 18px 35px rgba(38, 54, 107, .095); }
.tile__icon { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 15px; border-radius: 12px; }
.tile__icon .ui-icon { width: 21px; height: 21px; }
.tile__icon--violet { color: #5265d9; background: #eff0ff; }
.tile__icon--amber { color: #da9850; background: #fff5e8; }
.tile__icon--cyan { color: #288bb8; background: #e8f7ff; }
.tile__icon--green { color: #259a83; background: #e8faf4; }
.tile__title { color: #1c2c4a; font-size: 13px; font-weight: 800; line-height: 1.4; }
.tile__description { margin-top: 5px; color: #98a3b5; font-size: 10.5px; line-height: 1.55; }
.tile__bottom { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin-top: auto; padding-top: 15px; color: #6174dd; font-size: 10px; font-weight: 750; }
.tile__bottom > span { width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center; background: #f0f2ff; }
.tile__bottom .ui-icon { width: 13px; height: 13px; }
.dashboard-footer { padding: 1px 0 28px; text-align: center; font-size: 10px; color: #a5afbd; }
.mobile-menu { display: none; }
/* Eingebundene Bestandsseiten bleiben benutzbar, auch mit breiten Tabellen. */
.legacy-page { max-width: 1370px; margin: 29px auto; min-width: 0; overflow-wrap: anywhere; }
.legacy-page img, .legacy-page video, .legacy-page iframe { max-width: 100%; }
.legacy-page input, .legacy-page select, .legacy-page textarea { max-width: 100%; }
.legacy-page a { color: #4765da; }
.notice-page { margin: 36px auto; padding: 26px; max-width: 750px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.notice-page h1 { margin-top: 0; }
.primary-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 15px; color: #5366da; font-weight: 700; text-decoration: none; }
.primary-link .ui-icon { width: 16px; height: 16px; }
/* Login: verwendet weiterhin das vorhandene system/formular.inc */
.login-layout { min-height: 100dvh; display: grid; place-items: center; padding: 26px 15px; background: radial-gradient(circle at 10% 10%, #263c78, transparent 42%), linear-gradient(135deg, #101b32, #0b1427); }
.login-panel { width: min(100%, 440px); padding: 34px; background: #fff; border-radius: 24px; box-shadow: 0 28px 65px rgba(0,0,0,.17); }
.login-panel__heading { text-align: center; }
.login-panel__heading .brand__mark { margin: 0 auto 20px; }
.login-panel__heading .eyebrow { color: #6476da; }
.login-panel__heading h1 { margin: 6px 0; font-size: 27px; letter-spacing: -1px; }
.login-panel__heading p:not(.eyebrow) { color: #8a94a6; font-size: 13px; }
.login-panel__form { margin-top: 23px; min-width: 0; }
.login-panel__form input:not([type="checkbox"]):not([type="radio"]), .login-panel__form select { max-width: 100%; }
.login-panel__form input[type="text"], .login-panel__form input[type="email"], .login-panel__form input[type="password"] { width: 100%; padding: 12px 13px; border: 1px solid #dce3ef; border-radius: 10px; }
.login-panel__form button, .login-panel__form input[type="submit"] { min-height: 43px; border: 0; padding: 9px 18px; border-radius: 10px; background: #5067df; color: #fff; font-weight: 700; }
@media (max-width: 1280px) { .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
    .sidebar { display: none; }
    .topbar { height: 70px; padding: 0 21px; position: relative; z-index: 30; }
    .main-content { padding: 0 21px; }
    .mobile-menu { display: block; position: relative; }
    .mobile-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px solid #e2e7f2; border-radius: 10px; color: #304260; background: #fff; cursor: pointer; font-size: 12px; font-weight: 700; }
    .mobile-menu summary::-webkit-details-marker { display: none; }
    .mobile-menu summary .ui-icon { width: 17px; height: 17px; }
    .mobile-menu__panel { position: absolute; top: calc(100% + 10px); right: 0; width: min(88vw, 315px); padding: 16px; max-height: calc(100dvh - 90px); overflow-y: auto; border: 1px solid #293a58; border-radius: 15px; background: #111d34; box-shadow: 0 18px 45px rgba(21, 32, 57, .25); color: #fff; }
    .mobile-menu__panel .nav-group { margin-bottom: 14px; }
    .mobile-menu__panel .nav-group:last-child { margin-bottom: 0; }
    .mobile-menu__panel .nav-link { min-height: 44px; }
}
@media (max-width: 600px) {
    .main-content { padding: 0 15px; }
    .topbar { padding: 0 15px; }
    .topbar__title strong { font-size: 13px; }
    .topbar__actions { gap: 7px; }
    .logout-action a, .logout-action button, .logout-action input[type="submit"] { padding: 9px; font-size: 11px; }
    .welcome-banner { align-items: flex-start; flex-direction: column; gap: 12px; margin: 28px 0; }
    .welcome-banner__badge { display: none; }
    .welcome-banner h1 { font-size: 32px; }
    .section-heading__aside, .section-heading__count { display: none; }
    .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tile { min-height: 183px; padding: 15px 13px 13px; }
    .tile__title { font-size: 12px; }
    .tile__description { font-size: 10px; }
    .dashboard-section { margin-bottom: 29px; }
    .login-panel { padding: 26px 20px; }
    .legacy-page { margin: 20px auto; }
    .legacy-page table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 370px) { .tile-grid { grid-template-columns: 1fr; } .tile { min-height: 155px; } .topbar__eyebrow { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* Konto-Menü: keine festen Viewport-Breiten oder Inline-Styles mehr. */
.account-links { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.account-links a { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 8px 12px; border: 1px solid #e3e8f2; border-radius: 10px; background: #fff; color: #52627c; text-decoration: none; font-size: 12px; font-weight: 650; }
.account-links a:hover { background: #f1f4fc; }
@media (max-width: 420px) { .account-links { gap: 5px; } .account-links a { padding: 8px 9px; font-size: 11px; } }
