/* ==========================================================================
   Buchprojekt-Planer – Mobile First & DIN-A4-Druckansicht
   100 % lokal, keine externen Schriftarten
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100dvh;
    font-family: var(--le-font-sans);
    color: var(--le-ink);
    background: var(--le-bg);
}

.mono {
    font-family: var(--le-font-mono);
    font-variant-numeric: tabular-nums;
}

.bp-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    background: radial-gradient(circle at 12% 0%, #eef2ff 0%, #fdfaf3 52%, #f0fdfa 100%);
}

/* ---------------- TOPBAR ---------------- */

.bp-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(10px);
    border-bottom: 1.5px solid var(--le-border);
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
}

.bp-topbar-inner {
    max-width: 920px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.bp-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bp-home-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1.5px solid var(--le-border);
    background: var(--le-surface-alt);
    color: var(--le-ink);
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    font-weight: 900;
    text-decoration: none;
}

.bp-brand-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.bp-title {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 900;
    line-height: 1.2;
}

.bp-sub {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--le-ink-muted);
}

.bp-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bp-action-btn {
    min-height: 44px;
    padding: 0 13px;
    border-radius: 12px;
    border: 1.5px solid var(--le-border);
    background: #ffffff;
    color: var(--le-ink);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bp-action-btn.is-primary {
    border: 0;
    background: linear-gradient(135deg, #4f46e5 0%, #0284c7 100%);
    color: #ffffff;
}

/* ---------------- MAIN & STEPPER ---------------- */

.bp-main {
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 18px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bp-stepper {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bp-step-pill {
    flex: 1;
    min-width: 135px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1.5px solid var(--le-border);
    background: rgba(255, 255, 255, 0.8);
    color: var(--le-ink-muted);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.bp-step-pill.is-active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
}

.bp-step-pill.is-done {
    background: #dcfce7;
    border-color: #16a34a;
    color: #14532d;
}

/* ---------------- CARDS & FORMS ---------------- */

.bp-card {
    background: var(--le-surface);
    border: 1.5px solid var(--le-border);
    border-radius: var(--le-radius-lg);
    padding: 22px;
    box-shadow: var(--le-shadow-sm);
}

.bp-step-head {
    margin-bottom: 18px;
}

.bp-step-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--le-indigo-soft);
    color: var(--le-indigo);
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.bp-step-head h2 {
    margin: 0 0 4px;
    font-size: 1.32rem;
    font-weight: 900;
}

.bp-step-head p {
    margin: 0;
    font-size: 0.92rem;
    color: var(--le-ink-muted);
}

.bp-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.bp-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bp-span-2 {
    grid-column: 1 / -1;
}

.bp-field label {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--le-ink);
}

.bp-input {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border-radius: 12px;
    border: 1.5px solid var(--le-border-strong);
    background: #ffffff;
    color: var(--le-ink);
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 700;
}

.bp-input:focus {
    outline: 2px solid #4f46e5;
    border-color: #4f46e5;
}

.bp-chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.bp-chip {
    min-height: 40px;
    padding: 0 13px;
    border-radius: 999px;
    border: 1.5px solid var(--le-border-strong);
    background: var(--le-surface-alt);
    color: var(--le-ink);
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
}

.bp-chip.is-active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
}

.bp-preset-cards,
.bp-split-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.bp-preset-card {
    min-height: 64px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1.5px solid var(--le-border-strong);
    background: var(--le-surface-alt);
    color: var(--le-ink);
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.bp-preset-card strong {
    font-size: 0.92rem;
    font-weight: 900;
}

.bp-preset-card span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--le-ink-muted);
}

.bp-preset-card.is-active {
    background: #eef2ff;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.16);
}

.bp-custom-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.bp-custom-inline .bp-input {
    max-width: 130px;
}

.bp-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.bp-mini-links {
    display: flex;
    gap: 12px;
}

.bp-link-btn {
    background: none;
    border: 0;
    padding: 4px 0;
    color: #0284c7;
    font-size: 0.83rem;
    font-weight: 800;
    text-decoration: underline;
    cursor: pointer;
}

.bp-days-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.bp-day-btn {
    min-height: 46px;
    border-radius: 12px;
    border: 1.5px solid var(--le-border-strong);
    background: var(--le-surface-alt);
    color: var(--le-ink-muted);
    font-size: 0.92rem;
    font-weight: 900;
    cursor: pointer;
}

.bp-day-btn.is-active {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

.bp-hint-line {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--le-ink-muted);
    margin-top: 2px;
}

.bp-step-error {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--le-rose-soft);
    border: 1.5px solid rgba(225, 29, 72, 0.35);
    color: #9f1239;
    font-size: 0.88rem;
    font-weight: 800;
}

.bp-step-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--le-border);
}

.bp-btn-primary,
.bp-btn-outline {
    min-height: 48px;
    padding: 0 20px;
    border-radius: 14px;
    font-size: 0.96rem;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.bp-btn-primary {
    border: 0;
    background: linear-gradient(135deg, #4f46e5 0%, #0284c7 100%);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
}

.bp-btn-outline {
    border: 1.5px solid var(--le-border-strong);
    background: #ffffff;
    color: var(--le-ink);
}

/* ---------------- ERGEBNIS-PLAN ---------------- */

.bp-plan-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bp-print-header {
    display: none;
}

.bp-plan-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.bp-plan-kicker {
    font-size: 0.84rem;
    font-weight: 800;
    color: #0284c7;
}

.bp-plan-name {
    margin: 4px 0 0;
    font-size: 1.45rem;
    font-weight: 900;
}

.bp-plan-progress-box {
    min-width: 190px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 800;
}

.bp-progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.bp-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #16a34a 0%, #0d9488 100%);
    transition: width 0.25s ease;
}

.bp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.bp-kpi-box {
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--le-surface-alt);
    border: 1px solid var(--le-border);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.bp-kpi-box span {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--le-ink-muted);
}

.bp-kpi-box strong {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--le-ink);
}

.bp-feasibility-banner {
    margin-top: 14px;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 800;
}

.bp-feasibility-banner.is-good {
    background: #dcfce7;
    color: #14532d;
    border: 1.5px solid #86efac;
}

.bp-feasibility-banner.is-medium {
    background: #fef3c7;
    color: #78350f;
    border: 1.5px solid #fcd34d;
}

.bp-feasibility-banner.is-tight {
    background: #ffe4e6;
    color: #9f1239;
    border: 1.5px solid #fda4af;
}

.bp-schedule-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.bp-schedule-head h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 900;
}

.bp-schedule-head span {
    font-size: 0.84rem;
    color: var(--le-ink-muted);
    font-weight: 600;
}

.bp-schedule-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.bp-day-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid var(--le-border);
    background: #ffffff;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.bp-day-row:hover {
    border-color: #4f46e5;
}

.bp-day-row.is-done {
    background: #f0fdf4;
    border-color: #86efac;
    opacity: 0.78;
}

.bp-day-row.is-done .bp-day-tasks {
    text-decoration: line-through;
}

.bp-day-row.is-buffer {
    background: #fffbeb;
    border-color: #fde68a;
}

.bp-day-row.is-due {
    background: #eff6ff;
    border-color: #93c5fd;
    cursor: default;
}

.bp-check {
    width: 24px;
    height: 24px;
    accent-color: #16a34a;
    flex-shrink: 0;
    cursor: pointer;
}

.bp-print-box {
    display: none;
}

.bp-day-date {
    min-width: 118px;
    font-size: 0.88rem;
    font-weight: 900;
    color: var(--le-ink);
}

.bp-day-tasks {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
}

.bp-task-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 0.84rem;
    font-weight: 800;
}

.bp-task-pill.is-read {
    background: #e0f2fe;
    color: #0c4a6e;
}

.bp-task-pill.is-sheet {
    background: #ede9fe;
    color: #4c1d95;
}

.bp-task-pill.is-polish {
    background: #fef3c7;
    color: #78350f;
}

.bp-day-time {
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--le-ink-muted);
    white-space: nowrap;
}

.bp-plan-bottom-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .hide-xs {
        display: none;
    }

    .bp-form-grid {
        grid-template-columns: 1fr;
    }

    .bp-card {
        padding: 16px;
        border-radius: 18px;
    }

    .bp-day-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .bp-day-date {
        min-width: auto;
        flex: 1;
    }
}

/* ---------------- DIN-A4 DRUCKANSICHT ---------------- */

@media print {
    @page {
        size: A4 portrait;
        margin: 14mm 14mm 14mm 14mm;
    }

    html,
    body,
    .bp-shell {
        background: #ffffff !important;
        color: #000000 !important;
        min-height: auto;
    }

    .no-print,
    [data-lerneule-legal],
    #lerneule-legal-host {
        display: none !important;
    }

    .bp-main {
        max-width: 100%;
        padding: 0;
        gap: 10px;
    }

    .bp-print-header {
        display: block !important;
        border-bottom: 2px solid #1e293b;
        padding-bottom: 8px;
        margin-bottom: 6px;
    }

    .bp-print-brand {
        font-size: 9pt;
        font-weight: 800;
        color: #475569;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .bp-print-title {
        margin: 3px 0 4px;
        font-size: 18pt;
        font-weight: 900;
    }

    .bp-print-meta {
        font-size: 10pt;
        color: #334155;
        font-weight: 700;
    }

    .bp-card {
        border: 1px solid #cbd5e1;
        box-shadow: none !important;
        padding: 10px 12px;
        border-radius: 8px;
    }

    .bp-kpi-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .bp-kpi-box {
        padding: 6px 8px;
        background: #f8fafc !important;
        border: 1px solid #cbd5e1;
    }

    .bp-schedule-list {
        gap: 5px;
    }

    .bp-day-row {
        padding: 6px 8px;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        break-inside: avoid;
        page-break-inside: avoid;
        opacity: 1 !important;
        background: #ffffff !important;
    }

    .bp-day-row.is-done .bp-day-tasks {
        text-decoration: none;
    }

    .bp-check {
        display: none;
    }

    .bp-print-box {
        display: inline-block;
        width: 15px;
        height: 15px;
        border: 1.6px solid #0f172a;
        border-radius: 3px;
        flex-shrink: 0;
        text-align: center;
        line-height: 12px;
        font-size: 10pt;
        font-weight: 900;
    }

    .bp-task-pill {
        border: 1px solid #cbd5e1;
        background: #ffffff !important;
        color: #000000 !important;
        padding: 2px 7px;
        font-size: 9.5pt;
    }
}
