/* SecuDraw · gemeinsame Kopfleiste links (Logo-Menü + Ablaufschritte) — Tokens aus secudraw.css */

.sd-shell { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }

/* Logo mit Menü */
.sd-shell-brand-wrap { position: relative; flex-shrink: 0; }
.sd-shell-brand {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 7px 0 6px;
    border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--sd-text);
    font: inherit; cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.sd-shell-brand img { width: 22px; height: 22px; border-radius: 6px; object-fit: contain; display: block; }
.sd-shell-wordmark { font-family: var(--sd-brand-font); font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
.sd-shell-chevron { opacity: .45; transition: transform .15s ease, opacity .15s ease; }
.sd-shell-brand:hover { background: rgba(0,0,0,0.05); }
.sd-shell-brand:hover .sd-shell-chevron { opacity: .8; }
.sd-shell.is-menu-open .sd-shell-brand { background: rgba(0,0,0,0.06); border-color: var(--sd-border); }
.sd-shell.is-menu-open .sd-shell-chevron { transform: rotate(180deg); opacity: .8; }
.sd-shell-brand:focus-visible, .sd-shell-step:focus-visible, .sd-shell-menu-item:focus-visible {
    outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,0.28);
}

/* Offenes Menü: Kopfleiste über Seitenleisten wie „Dateien“ (z 30) heben, sonst liegt das Menü dahinter; unter Dialogen (z 100) */
.sd-toolbar:has(.sd-shell.is-menu-open) { z-index: 90; }

.sd-shell-menu {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 300; min-width: 224px; padding: 6px;
    background: var(--sd-surface); border: 1px solid var(--sd-border); border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.06);
    animation: sd-shell-pop .14s cubic-bezier(.2,.8,.2,1); transform-origin: top left;
}
@keyframes sd-shell-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.sd-shell-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px 0 8px;
    border: none; border-radius: 9px; background: transparent; color: var(--sd-text);
    font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.sd-shell-menu-item:hover, .sd-shell-menu-item:focus-visible { background: rgba(0,113,227,0.08); box-shadow: none; }
.sd-shell-menu-item:disabled { opacity: .38; cursor: default; background: transparent; }
.sd-shell-menu-item.is-current { color: var(--sd-accent); font-weight: 600; }
.sd-shell-menu-icon { display: inline-flex; width: 18px; justify-content: center; color: var(--sd-text-sec); }
.sd-shell-menu-item.is-current .sd-shell-menu-icon { color: var(--sd-accent); }
.sd-shell-menu-key {
    margin-left: auto; min-width: 20px; padding: 1px 5px; border: 1px solid var(--sd-border); border-radius: 5px;
    font: 500 11px var(--sd-font); color: var(--sd-text-sec); text-align: center; background: transparent;
}
.sd-shell-menu-sep { height: 1px; margin: 5px 6px; background: var(--sd-border); }
.sd-shell-menu-item[hidden] { display: none; }

/* Ablaufschritte */
.sd-shell-steps { display: none; align-items: center; min-width: 0; }
.sd-shell.has-flow .sd-shell-steps { display: inline-flex; }
.sd-shell.has-flow .sd-shell-brand-wrap::after {
    content: ""; position: absolute; right: -6px; top: 9px; bottom: 9px; width: 1px; background: var(--sd-border);
}
.sd-shell-line { display: block; width: 8px; height: 1.5px; margin: 0 1px; border-radius: 1px; background: var(--sd-border); flex-shrink: 0; }
.sd-shell-line.is-done { background: rgba(0,113,227,0.45); }
.sd-shell-step {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; min-width: 28px; padding: 0;
    border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--sd-text);
    font: inherit; cursor: pointer; flex-shrink: 0;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}
.sd-shell-step-num {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
    font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1;
}
.sd-shell-step.is-done { color: var(--sd-accent); }
.sd-shell-step.is-done .sd-shell-step-num { background: rgba(0,113,227,0.10); }
.sd-shell-step.is-done:hover .sd-shell-step-num { background: rgba(0,113,227,0.18); }
/* Noch nicht erreicht: gestrichelt; schon einmal besucht (Spur) oder frei wählbar: durchgezogen und anklickbar */
.sd-shell-step.is-todo { color: var(--sd-text); border-color: rgba(0,0,0,0.22); }
.sd-shell-step.is-todo:not(:disabled):hover { border-color: rgba(0,113,227,0.55); color: var(--sd-accent); background: rgba(0,113,227,0.06); }
.sd-shell-step.is-todo:disabled { color: var(--sd-text-sec); border-style: dashed; border-color: rgba(0,0,0,0.16); opacity: .7; cursor: default; }
.sd-shell-step:not(:disabled):active { transform: scale(.94); }
.sd-shell-step.is-current {
    background: var(--sd-accent); color: #fff; padding-right: 11px; cursor: default;
    box-shadow: 0 1px 2px rgba(0,113,227,0.25);
}
/* Hauptseite: die Schritte des Assistenten stehen jetzt oben links statt in der Karte */
body:has(.sd-shell.has-flow) .sd-wiz-steps { display: none; }
.sd-shell-step-label { font-size: 12.5px; font-weight: 600; letter-spacing: -0.1px; white-space: nowrap; }

@media (max-width: 1180px) {
    .sd-shell-step.is-current { padding-right: 0; }
    .sd-shell-step-label { display: none; }
}

/* Tooltip im Stil des Viewers */
.sd-shell-tip {
    position: fixed; z-index: 400; max-width: 260px; padding: 8px 11px; border-radius: 10px;
    background: rgba(29,29,31,0.94); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    font: 12px/1.35 var(--sd-font); pointer-events: none; animation: sd-shell-pop .12s ease;
}
.sd-shell-tip strong { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.sd-shell-tip span { color: rgba(255,255,255,0.72); }
.sd-shell-tip::before {
    content: ""; position: absolute; left: calc(var(--arrow, 50%) - 5px); top: -5px;
    border: 5px solid transparent; border-top: 0; border-bottom-color: rgba(29,29,31,0.94);
}
.sd-shell-tip[hidden] { display: none; }

/* ── Objektdaten (sd-objekt.js): Drei-Punkte-Knopf neben dem Dateinamen, Karte darunter ── */
.sd-obj-btn {
    width: 32px; height: 32px; margin-left: 2px; flex-shrink: 0; border: 1px solid transparent; border-radius: 9px;
    background: transparent; color: var(--sd-text-sec); cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; justify-content: center; transition: background .15s ease, color .15s ease;
}
.sd-obj-btn:hover, .sd-obj-btn.is-open { background: rgba(0,0,0,0.06); color: var(--sd-text); }
.sd-obj-btn.is-open { border-color: var(--sd-border); }
.sd-obj-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,0.28); }
.sd-obj-btn[hidden] { display: none; }

.sd-obj-card {
    position: fixed; z-index: 320; width: min(420px, calc(100vw - 16px)); max-height: calc(100vh - 80px); overflow: auto;
    background: var(--sd-surface); border: 1px solid var(--sd-border); border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.06);
    font: 13px/1.35 var(--sd-font); color: var(--sd-text); animation: sd-shell-pop .14s cubic-bezier(.2,.8,.2,1);
    transform-origin: top right;
}
.sd-obj-card[hidden] { display: none; }
.sd-obj-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 10px 16px; border-bottom: 1px solid var(--sd-border); }
.sd-obj-head > div { flex: 1; min-width: 0; }
.sd-obj-title { font-size: 14px; font-weight: 600; }
.sd-obj-sub { margin-top: 2px; font-size: 11.5px; color: var(--sd-text-sec); }
.sd-obj-close {
    width: 26px; height: 26px; border: none; border-radius: 7px; background: transparent; color: var(--sd-text-sec);
    font-size: 18px; line-height: 1; cursor: pointer;
}
.sd-obj-close:hover { background: rgba(0,0,0,0.06); color: var(--sd-text); }
.sd-obj-body { padding: 4px 16px 6px; }
.sd-obj-group { padding: 10px 0 8px; }
.sd-obj-group + .sd-obj-group { border-top: 1px solid var(--sd-border); }
.sd-obj-group-title { margin-bottom: 6px; font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--sd-text-sec); }
.sd-obj-row { display: flex; gap: 8px; }
.sd-obj-row + .sd-obj-row { margin-top: 8px; }
.sd-obj-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sd-obj-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--sd-text-sec); white-space: nowrap; }
.sd-obj-tag {
    font-style: normal; font-size: 10px; font-weight: 600; padding: 0 5px; border-radius: 5px; line-height: 15px;
    background: rgba(0,113,227,0.10); color: var(--sd-accent); cursor: default;
}
.sd-obj-tag.is-manual { background: rgba(255,149,0,0.16); color: #B35A00; }
.sd-obj-input {
    width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--sd-border); border-radius: 8px;
    background: var(--sd-surface); color: var(--sd-text); font: inherit; font-size: 13px; outline: none; box-sizing: border-box;
}
.sd-obj-input:focus { border-color: var(--sd-accent); box-shadow: 0 0 0 3px rgba(0,113,227,0.18); }
.sd-obj-note { margin-top: 7px; font-size: 11.5px; color: var(--sd-text-sec); }
.sd-obj-note.is-ok { color: #1E8E3E; }
.sd-obj-note.is-bad { color: #C4320A; }
.sd-obj-foot {
    position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 10px 14px 12px 16px;
    border-top: 1px solid var(--sd-border); background: var(--sd-surface);
}
.sd-obj-status { flex: 1; min-width: 0; font-size: 11.5px; color: var(--sd-text-sec); }
.sd-obj-status.is-bad { color: #C4320A; }

/* ── Telefon (≤ 760 px): Schritte kompakt, Logo-Menü als Blatt, Objektdaten als Blatt ─────────── */
.sd-shell-step-compact, .sd-shell-backdrop { display: none; }
.sd-shell-menu-flow[hidden] { display: none; }
.sd-shell-menu:focus { outline: none; }

@media (max-width: 760px) {
    .sd-shell { gap: 4px; }
    .sd-shell-brand { height: 40px; min-width: 40px; padding: 0 6px; -webkit-tap-highlight-color: transparent; }
    .sd-shell.has-flow .sd-shell-wordmark { display: none; }
    .sd-shell-chevron { display: none; }
    .sd-shell.has-flow .sd-shell-brand-wrap::after { display: none; }

    /* Schritte: nur „2/4“ */
    .sd-shell-steps > .sd-shell-step, .sd-shell-steps > .sd-shell-line { display: none; }
    .sd-shell-step-compact {
        display: inline-flex; align-items: center; justify-content: center; gap: 1px; flex-shrink: 0;
        height: 40px; min-width: 40px; padding: 0 8px 0 7px; margin-left: 2px;
        border: none; border-radius: 999px; background: transparent; color: var(--sd-text-sec);
        font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .sd-shell-step-compact .sd-shell-step-num {
        width: 24px; height: 24px; background: var(--sd-accent); color: #fff; font-size: 12.5px;
    }
    .sd-shell-step-total { font-size: 12.5px; font-weight: 600; }
    .sd-shell.is-menu-open .sd-shell-step-compact { background: rgba(0,113,227,0.08); }
    .sd-shell-step-compact:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,0.28); }

    /* Logo-Menü als Blatt von unten */
    .sd-shell-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.28);
        animation: sd-shell-fade .18s ease; -webkit-tap-highlight-color: transparent;
    }
    .sd-shell-backdrop[hidden] { display: none; }
    .sd-shell-menu.is-sheet {
        position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 1001;
        min-width: 0; max-height: calc(100dvh - 56px); overflow-y: auto; overscroll-behavior: contain;
        padding: 6px max(10px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
        border-radius: 18px 18px 0 0; border-width: 1px 0 0; box-sizing: border-box;
        box-shadow: 0 -10px 30px rgba(0,0,0,0.16);
        animation: sd-shell-sheet .22s cubic-bezier(.2,.8,.2,1); transform-origin: bottom center;
    }
    .sd-shell-menu.is-sheet::before {
        content: ""; display: block; width: 36px; height: 4px; margin: 2px auto 8px; border-radius: 2px; background: rgba(0,0,0,0.16);
    }
    .sd-shell-menu.is-sheet .sd-shell-menu-item { height: 48px; padding: 0 12px; gap: 12px; font-size: 16px; border-radius: 11px; }
    .sd-shell-menu.is-sheet .sd-shell-menu-icon { width: 22px; }
    .sd-shell-menu.is-sheet .sd-shell-menu-icon svg { width: 20px; height: 20px; }
    .sd-shell-menu.is-sheet .sd-shell-menu-key { display: none; }
    .sd-shell-menu.is-sheet .sd-shell-menu-item:hover { background: transparent; }
    .sd-shell-menu.is-sheet .sd-shell-menu-item:active:not(:disabled) { background: rgba(0,113,227,0.08); }

    .sd-shell-menu-flow-title {
        padding: 4px 12px 4px; font-size: 12px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; color: var(--sd-text-sec);
    }
    .sd-shell-menu-num {
        display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
        font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid rgba(0,0,0,0.22); box-sizing: border-box;
    }
    .sd-shell-menu-step.is-done { color: var(--sd-accent); }
    .sd-shell-menu-step.is-done .sd-shell-menu-num { border-color: transparent; background: rgba(0,113,227,0.10); }
    .sd-shell-menu-step.is-current { font-weight: 600; }
    .sd-shell-menu-step.is-current .sd-shell-menu-num { border-color: transparent; background: var(--sd-accent); color: #fff; }
    .sd-shell-menu-step.is-todo:disabled .sd-shell-menu-num { border-style: dashed; }
    .sd-shell-menu-step.is-current:disabled { opacity: 1; }

    /* Objektdaten-Knopf: Tippziel */
    .sd-obj-btn { width: 40px; height: 40px; }

    /* Objektdaten als Blatt von unten (sd-objekt.js setzt .is-sheet und den Abstand zur Tastatur) */
    .sd-obj-backdrop {
        position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.28); animation: sd-shell-fade .18s ease;
    }
    .sd-obj-card.is-sheet {
        left: 0; right: 0; top: auto; width: auto; max-width: none; z-index: 1001; box-sizing: border-box;
        max-height: calc(100dvh - 56px); overscroll-behavior: contain;
        border-radius: 18px 18px 0 0; border-width: 1px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,0.16);
        font-size: 15px; animation: sd-shell-sheet .22s cubic-bezier(.2,.8,.2,1); transform-origin: bottom center;
    }
    .sd-obj-card.is-sheet .sd-obj-head { padding: 12px 8px 10px max(16px, env(safe-area-inset-left)); }
    .sd-obj-card.is-sheet .sd-obj-title { font-size: 16px; }
    .sd-obj-card.is-sheet .sd-obj-sub { font-size: 13px; }
    .sd-obj-card.is-sheet .sd-obj-close { width: 40px; height: 40px; font-size: 24px; margin-top: -6px; }
    .sd-obj-card.is-sheet .sd-obj-body { padding: 4px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); }
    .sd-obj-card.is-sheet .sd-obj-row { flex-direction: column; gap: 10px; }
    .sd-obj-card.is-sheet .sd-obj-row + .sd-obj-row { margin-top: 10px; }
    .sd-obj-card.is-sheet .sd-obj-field { flex: none !important; }
    .sd-obj-card.is-sheet .sd-obj-label { font-size: 13px; white-space: normal; }
    .sd-obj-card.is-sheet .sd-obj-input { height: 44px; font-size: 16px; padding: 0 12px; border-radius: 10px; }
    .sd-obj-card.is-sheet .sd-obj-group-title { font-size: 12px; }
    .sd-obj-card.is-sheet .sd-obj-note { font-size: 13px; }
    .sd-obj-card.is-sheet .sd-obj-foot {
        flex-wrap: wrap; row-gap: 6px;
        padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    }
    .sd-obj-card.is-sheet.has-keyboard .sd-obj-foot { padding-bottom: 10px; }
    .sd-obj-card.is-sheet .sd-obj-status { flex-basis: 100%; font-size: 13px; }
    .sd-obj-card.is-sheet .sd-obj-status:empty { display: none; }
    .sd-obj-card.is-sheet .sd-obj-foot button { min-height: 44px; font-size: 15px; }
    .sd-obj-card.is-sheet .sd-obj-save { margin-left: auto; padding: 0 20px; }
}
@keyframes sd-shell-sheet { from { transform: translateY(24px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes sd-shell-fade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
    .sd-shell-menu.is-sheet, .sd-obj-card.is-sheet, .sd-shell-backdrop, .sd-obj-backdrop { animation: none; }
}

/* Touch: langes Drücken auf Knöpfen mit Tooltip (sd-tips.js) öffnet kein Browser-Menü und markiert keinen Text */
@media (hover: none) {
    button[data-label], [role="button"][data-label], .ly-tool[data-label] {
        -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
    }
}
