*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --navbar-height: 52px;
    --nav-bg: #333;
    --nav-hover: #444;
    --page-bg: #f0f0f0;
    --tile-bg: #ffffff;
    --accent: #0d6efd;
    --text-dark: #333;
    --text-mid: #444;
    --text-muted: #666;
}

html, body {
    height: 100%;
    font-family: 'DM Sans', Arial, sans-serif;
    background: var(--page-bg);
    color: var(--text-dark);
}


.layout-frame-guard-hidden {
    visibility: hidden;
}

.language-toggle-icon {
    font-size: 1em;
}

.language-code {
    font-size: .83em;
    letter-spacing: .03em;
}

.active-language-check {
    font-size: .75em;
    color: var(--accent);
}

.nav-user-label {
    font-size: .88em;
}

.nav-user-label-anon {
    color: #aaa;
}

.profile-muted-name {
    color: #999;
    font-weight: 400;
}

.offcanvas-title-icon {
    color: #4f8ef7;
}

.offcanvas-profile-summary {
    padding: 4px 8px;
    margin-bottom: 4px;
}

.offcanvas-profile-label {
    font-size: .72em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.offcanvas-profile-name {
    font-size: .85em;
    color: #bbb;
    margin-top: 2px;
}

.offcanvas-signin-link {
    color: #4f8ef7 !important;
}

.session-key-icon {
    font-size: .85em;
    opacity: .7;
}

.lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-flag {
    font-size: 1.15em;
    line-height: 1;
    flex-shrink: 0;
}

.lang-name {
    flex: 1;
}

/* ── Shell wrapper ── */
.shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Navbar ── */
.navbar {
    background-color: var(--nav-bg) !important;
    padding: 0 16px;
    min-height: var(--navbar-height);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1030; /* Bootstrap-Standard für fixed navbars */
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Audiowide', sans-serif;
    font-size: 1.05em;
    letter-spacing: .05em;
    color: #fff !important;
    text-decoration: none;
}

    .navbar-brand img {
        height: 28px;
    }

.active-tool-badge {
    font-size: .75em;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    border-left: 1px solid #555;
}

    .active-tool-badge .dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #4caf50;
        flex-shrink: 0;
    }

.navbar .nav-link {
    color: #aaa !important;
    font-size: .88em;
    padding: 8px 12px !important;
    border-radius: 6px;
    transition: background .15s, color .15s;
}

    .navbar .nav-link:hover,
    .navbar .nav-link.show {
        color: #fff !important;
        background: var(--nav-hover);
    }

.avatar-anon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #555;
    color: #bbb;
    font-size: .9em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: .72em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Dropdowns */
.dropdown-menu {
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 4px 0;
    min-width: 210px;
}

.dropdown-header {
    font-size: .7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #999;
    padding: 8px 14px 6px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .88em;
    padding: 9px 14px;
    color: #333;
    transition: background .12s;
}

    .dropdown-item i {
        width: 16px;
        text-align: center;
        color: #888;
    }

    .dropdown-item.active {
        background: #f0f5ff;
        color: var(--accent);
    }

        .dropdown-item.active i {
            color: var(--accent);
        }

    .dropdown-item.text-danger {
        color: #dc3545 !important;
    }

        .dropdown-item.text-danger i {
            color: #dc3545;
        }

        .dropdown-item.text-danger:hover {
            background: #fff5f5;
        }

.profile-info {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
}

    .profile-info .label {
        font-size: .7em;
        color: #999;
        text-transform: uppercase;
        letter-spacing: .07em;
    }

    .profile-info .name {
        font-size: .88em;
        font-weight: 600;
        color: #333;
        margin-top: 2px;
    }

/* Hamburger */
.navbar-toggler {
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
}

    .navbar-toggler:focus {
        box-shadow: none;
    }

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ── Offcanvas ── */
.offcanvas {
    max-width: 280px;
    background: #2a2a2a;
}

.offcanvas-header {
    background: #333;
    border-bottom: 1px solid #444;
    padding: 14px 16px;
}

.offcanvas-title {
    font-family: 'Audiowide', sans-serif;
    font-size: .95em;
    color: #fff;
}

.btn-close-white {
    filter: invert(1);
}

.offcanvas-body {
    padding: 10px 8px;
}

.offcanvas-label {
    font-size: .7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #666;
    padding: 10px 12px 4px;
}

.offcanvas .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px !important;
    border-radius: 6px;
    color: #bbb !important;
    font-size: .9em;
    transition: background .15s, color .15s;
}

    .offcanvas .nav-link:hover {
        background: #3a3a3a;
        color: #fff !important;
    }

    .offcanvas .nav-link.active {
        background: rgba(13,110,253,.2);
        color: #fff !important;
    }

    .offcanvas .nav-link i {
        width: 16px;
        text-align: center;
    }

.offcanvas hr {
    border-color: #444;
    margin: 8px 0;
}

.offcanvas .logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    background: none;
    border: none;
    color: #e05252;
    font-size: .9em;
    cursor: pointer;
    text-align: left;
    transition: background .15s;
}

    .offcanvas .logout-btn:hover {
        background: rgba(224,82,82,.12);
    }

/* ── Page content area ── */
.shell-page {
    flex: 1;
    overflow-y: auto;
    /* Overridden below when a tool iframe is active */
}

/* When a tool iframe is open: no scroll, children fill the space */
.shell-page--iframe {
    overflow: hidden;
}

/* Footer */
footer {
    flex-shrink: 0;
    background-color: var(--nav-bg);
    color: #fff;
    padding: 12px 20px;
    text-align: center;
    font-size: .8em;
}

    footer a {
        color: #fff;
        text-decoration: none;
        margin-right: 8px;
    }

        footer a:hover {
            text-decoration: underline;
        }


/* ── Session Dot States (JS-controlled) ─────────────────────── */
@keyframes sp-dot-loading {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        background: #60a5fa;
    }

    50% {
        opacity: .3;
        transform: scale(.65);
        background: #60a5fa;
    }
}

@keyframes sp-dot-success {
    0% {
        transform: scale(1);
        background: #4ade80;
    }

    40% {
        transform: scale(1.6);
        background: #4ade80;
    }

    100% {
        transform: scale(1);
        background: #4ade80;
    }
}

.sp-dot-loading {
    animation: sp-dot-loading 1.5s ease-in-out infinite;
}

.sp-dot-success {
    animation: sp-dot-success .4s ease-out forwards;
}

/* ── Session Pill (Desktop Navbar) ───────────────────────────── */
.session-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    border-radius: 20px;
    padding: 0;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    white-space: nowrap;
    border: 1px solid transparent;
    font-size: .82em;
    color: #bbb;
    font-family: 'DM Sans', sans-serif;
    transition: max-width .4s ease, opacity .4s ease, padding .4s ease, background .3s, border-color .3s, color .3s;
}

.session-pill.sp-visible {
    max-width: 340px;
    opacity: 1;
    padding: 4px 6px 4px 9px;
}

.session-pill.sp-warn {
    background: rgba(251, 191, 36, .12);
    border-color: rgba(251, 191, 36, .35);
    color: #fbbf24;
}

.session-pill.sp-danger {
    background: rgba(239, 68, 68, .14);
    border-color: rgba(239, 68, 68, .4);
    color: #f87171;
}

.sp-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #4ade80;
    transition: background .3s;
}

.session-pill.sp-warn .sp-dot {
    background: #fbbf24;
}

.session-pill.sp-danger .sp-dot {
    background: #f87171;
}

/* Fixed-width time: no layout shift as 8:32 -> 0:09 */
.sp-time {
    display: inline-block;
    min-width: 2.8em;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: monospace;
}

.sp-label {
    font-size: .9em;
    opacity: .75;
}

.sp-extend-btn {
    background: rgba(255, 255, 255, .12);
    border: none;
    border-radius: 10px;
    color: inherit;
    font-size: .8em;
    padding: 3px 10px 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

    .sp-extend-btn:hover {
        background: rgba(255, 255, 255, .22);
    }

    .sp-extend-btn:disabled {
        opacity: .5;
        cursor: default;
    }

/* ── Hamburger notification dot (Mobile) ─────────────────────── */
.navbar-toggler {
    position: relative;
}

.nav-session-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid #333;
    background: transparent;
    transition: background .3s;
    pointer-events: none;
}

    .nav-session-dot.ss-warn {
        background: #fbbf24;
    }

    .nav-session-dot.ss-danger {
        background: #f87171;
    }

/* ── Session Strip (Mobile Offcanvas) ────────────────────────── */
.session-strip {
    overflow: hidden;
    max-height: 0;
    transition: max-height .4s ease, margin-bottom .4s ease;
}

    .session-strip.ss-visible {
        max-height: 70px;
        margin-bottom: 8px;
    }

.session-strip-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .05);
    font-size: .85em;
    color: #bbb;
    transition: background .3s, border-color .3s, color .3s;
}

.session-strip.ss-warn .session-strip-inner {
    background: rgba(251, 191, 36, .1);
    border-color: rgba(251, 191, 36, .3);
    color: #fbbf24;
}

.session-strip.ss-danger .session-strip-inner {
    background: rgba(239, 68, 68, .12);
    border-color: rgba(239, 68, 68, .35);
    color: #f87171;
}

.session-strip-inner .sp-extend-btn {
    margin-left: auto;
}

.session-strip-inner .sp-time {
    min-width: 2.5em;
}

/* ── Pulse (critical state) ───────────────────────────────────── */
@keyframes kd-pulse {
    from {
        opacity: 1;
    }

    to {
        opacity: .5;
    }
}

.sp-pulse {
    animation: kd-pulse .55s ease-in-out infinite alternate;
}

.dropdown-item-disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

    .dropdown-item-disabled i {
        opacity: .85;
    }

.nav-link-disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

    .nav-link-disabled i {
        opacity: .85;
    }