/*
 * App-Hülle (Redesign Phase 3).
 * Desktop: Seitenleiste mit Wortmarke. Tablet quer: schmale Icon-Leiste mit
 * Bildmarke. Handy und Tablet hoch: untere Leiste mit fünf Einträgen.
 * Einbettung (?_t= / ?embed=1): ohne Hülle, nur Inhalt.
 */
.shell { min-height: 100vh; min-height: 100dvh; display: grid; --nav-w: 232px;
    grid-template-columns: var(--nav-w) 1fr; grid-template-rows: auto 1fr; grid-template-areas: "nav top" "nav main";
    background: linear-gradient(90deg, var(--ink-1) var(--nav-w), transparent var(--nav-w)); }
.shell.is-loading { display: flex; align-items: center; justify-content: center; background: none; }

.shell-nav { grid-area: nav; position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
    gap: 4px; padding: 16px 12px calc(12px + var(--safe-bottom)); background: var(--ink-1); border-right: 1px solid var(--line);
    overflow-y: auto; }
.shell-nav .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.shell-nav .brand img.wordmark { height: 34px; width: auto; }
.shell-nav .brand img.mark { display: none; height: 30px; }
.shell-nav .nav-group-label { margin: 16px 10px 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-s);
    color: var(--fg-2) !important; text-decoration: none !important; position: relative; }
.nav-item:hover { background: var(--ink-3); color: var(--fg) !important; }
.nav-item.is-active { background: var(--signal-soft); color: var(--fg) !important; }
.nav-item.is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
    background: var(--signal); }
.nav-item .nav-label { flex: 1; }
.nav-item .nav-tag { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3);
    border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }
.nav-item .icon.ext { width: 14px; height: 14px; opacity: 0.6; }
.shell-nav .nav-spacer { flex: 1; }
.shell-nav .user-box { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-s);
    border: 1px solid var(--line); background: var(--ink-2); cursor: pointer; text-align: left; width: 100%; }
.shell-nav .user-box:hover { border-color: var(--line-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
    background: var(--ink-4); color: var(--fg); font: 600 13px var(--font-display); }
.user-box .user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-box .user-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .user-role { font-size: 12px; color: var(--fg-3); }

.shell-top { grid-area: top; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
    padding: calc(10px + var(--safe-top)) 20px 10px; background: rgba(5, 9, 19, 0.88); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); }
.shell-top .top-spacer { flex: 1; }
.site-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; max-width: 420px;
    border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--ink-2); cursor: pointer; text-align: left; }
.site-switch:hover { border-color: var(--line-2); }
.site-switch .site-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.site-switch .site-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-switch .site-sub { font-size: 12px; color: var(--fg-3); }
.site-switch.is-fixed { cursor: default; }
.palette-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border-radius: var(--radius-s);
    border: 1px solid var(--line); background: var(--ink-1); color: var(--fg-3); cursor: pointer; }
.palette-btn kbd { font: 11px var(--font-mono); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--fg-2); }
.shell-top .vas-bell-slot { display: inline-flex; }

.shell-main { grid-area: main; min-width: 0; padding: 20px 24px calc(28px + var(--safe-bottom)); }
.shell-bottom { display: none; }

/* Seitenkopf der Inhalte */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; }
.page-head h1 { font-size: 26px; }
.page-head .page-sub { color: var(--fg-2); margin-top: 2px; }

/* Tablet quer und kleine Laptops: schmale Icon-Leiste mit Bildmarke */
@media (max-width: 1199px) and (min-width: 768px) and (orientation: landscape), (max-width: 1100px) and (min-width: 900px) {
    .shell { --nav-w: 72px; }
    .shell-nav { padding: 14px 8px; align-items: center; }
    .shell-nav .brand { padding: 2px 0 14px; justify-content: center; }
    .shell-nav .brand img.wordmark { display: none; }
    .shell-nav .brand img.mark { display: block; }
    .nav-item { width: 52px; justify-content: center; padding: 0; min-height: 48px; }
    .nav-item .nav-label, .nav-item .nav-tag, .nav-item .icon.ext { display: none; }
    .nav-item.is-active::before { left: -8px; }
    .shell-nav .nav-group-label { font-size: 0; margin: 10px 0 4px; height: 1px; width: 36px; background: var(--line-2); }
    .shell-nav .user-box { width: 52px; padding: 8px; justify-content: center; }
    .user-box .user-text { display: none; }
}

/* Handy und Tablet hoch: untere Leiste */
@media (max-width: 767px), (orientation: portrait) and (max-width: 899px) {
    .shell { grid-template-columns: 1fr; grid-template-areas: "top" "main"; background: none; }
    .shell-nav { display: none; }
    .shell-top { padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left)); gap: 8px; }
    .shell-top .brand-mini { display: inline-flex; }
    .palette-btn { display: none; }
    .site-switch { flex: 1; max-width: none; min-height: var(--touch); }
    .shell-main { padding: 14px calc(12px + var(--safe-right)) calc(84px + var(--safe-bottom)) calc(12px + var(--safe-left)); }
    .shell-bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        padding: 6px calc(6px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(6px + var(--safe-left));
        background: rgba(8, 16, 31, 0.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
    .shell-bottom a, .shell-bottom button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        min-height: 52px; border: 0; background: none; color: var(--fg-3) !important; font-size: 11px; text-decoration: none !important;
        border-radius: var(--radius-s); cursor: pointer; position: relative; }
    .shell-bottom .is-active { color: var(--signal) !important; }
    .shell-bottom .icon { width: 22px; height: 22px; }
    .page-head h1 { font-size: 22px; }
}
.brand-mini { display: none; }
.brand-mini img { height: 30px; }

/* Einbettung: nur Inhalt */
.shell.is-embed { display: block; background: none; }
.shell.is-embed .shell-nav, .shell.is-embed .shell-top, .shell.is-embed .shell-bottom { display: none !important; }
.shell.is-embed .shell-main { padding: 12px; }

/* Standort-Auswahl / Befehlspalette / Mehr-Menü */
.site-list, .palette-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.site-list button, .palette-list a, .palette-list button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 42px;
    padding: 6px 10px; border: 0; border-radius: var(--radius-s); background: none; color: var(--fg) !important; text-align: left;
    cursor: pointer; text-decoration: none !important; }
.site-list button:hover, .palette-list a:hover, .palette-list .is-hot, .site-list button.is-hot { background: var(--ink-3); }
.site-list button.is-current { color: var(--signal) !important; }
.search-field { width: 100%; min-height: 42px; padding: 0 12px; border-radius: var(--radius-s); border: 1px solid var(--line-2);
    background: var(--ink-2); color: var(--fg); font: inherit; }
.search-field:focus { outline: none; border-color: var(--signal); }
.palette-dialog { position: fixed; inset: 0; z-index: 70; display: none; align-items: flex-start; justify-content: center;
    padding-top: 12vh; background: rgba(2, 5, 12, 0.6); }
.palette-dialog.is-open { display: flex; }
.palette-dialog .palette-box { width: min(560px, 92vw); padding: 14px; border-radius: var(--radius-l); background: var(--ink-1);
    border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.palette-dialog .palette-hint { font-size: 12px; color: var(--fg-3); margin: 10px 2px 0; }

/* Konto: persönliche Einstellungen (Phase 12) */
.pref-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 10px 2px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.pref-row > .icon { width: 20px; height: 20px; color: var(--fg-2); }
.pref-row span { display: flex; flex-direction: column; gap: 2px; }
.pref-row small { font-size: 12px; }

/* Erste Anmeldung: eigenes Passwort festlegen */
.pw-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.pw-gate-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.pw-gate-card h1 { font: 600 22px var(--font-display); margin: 4px 0 0; }
.pw-gate-card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--fg-2); }
.pw-gate-logo { height: 30px; width: auto; align-self: flex-start; }
.pw-gate-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pw-msg:empty { display: none; }
.pw-msg { color: var(--bad); font-size: 13px; margin: 0; }
