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

:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #111827;
    --primary-light: #374151;
    --green: #15803d;
    --red: #dc2626;
    --orange: #ea580c;
    --blue: #2563eb;
    --radius: 18px;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "Segoe UI",
        Arial,
        sans-serif;
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-header {
    background: #111827;
    color: white;
    padding:
        calc(16px + env(safe-area-inset-top))
        20px
        18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-title {
    font-size: 22px;
    font-weight: 800;
}

.app-title span {
    font-size: 13px;
    font-weight: 600;
    color: #9ca3af;
    margin-left: 4px;
}

.app-subtitle {
    margin-top: 3px;
    font-size: 12px;
    color: #cbd5e1;
}

.online-status {
    font-size: 12px;
    color: #86efac;
    white-space: nowrap;
}

.app-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.welcome-card {
    background: linear-gradient(135deg, #111827, #374151);
    color: white;
    border-radius: 24px;
    padding: 25px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.welcome-card h1 {
    margin: 5px 0;
    font-size: 30px;
}

.welcome-card p {
    margin: 0;
    color: #d1d5db;
}

.small-label {
    font-size: 11px;
    letter-spacing: 1.5px;
    font-weight: 800;
    color: #9ca3af;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-icon {
    font-size: 24px;
}

.stat-card strong {
    font-size: 24px;
}

.stat-card span:last-child {
    color: var(--muted);
    font-size: 13px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}

.card h2 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 19px;
}

.section-title-row,
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 5px 0 0;
    font-size: 30px;
}

.primary-button,
.secondary-button,
.danger-button,
.back-button,
.text-button {
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
}

.primary-button {
    background: var(--primary);
    color: white;
}

.primary-button:hover {
    background: var(--primary-light);
}

.secondary-button {
    background: #e5e7eb;
    color: #111827;
}

.danger-button {
    background: #fee2e2;
    color: var(--red);
}

.back-button {
    background: transparent;
    padding: 0;
    color: #2563eb;
}

.text-button {
    background: transparent;
    color: #2563eb;
    padding: 5px;
}

.big-button {
    font-size: 17px;
    padding: 16px 22px;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 18px;
}

.form-grid label,
.card > label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
}

.full {
    grid-column: 1 / -1;
}

.input,
.textarea,
.search-input {
    width: 100%;
    border: 1px solid var(--border);
    background: white;
    border-radius: 12px;
    padding: 12px;
    outline: none;
    color: var(--text);
}

.input:focus,
.textarea:focus,
.search-input:focus {
    border-color: #9ca3af;
}

.textarea {
    min-height: 100px;
    resize: vertical;
}

.large-textarea {
    min-height: 150px;
}

.search-input {
    margin-bottom: 12px;
    font-size: 16px;
}

.order-card,
.customer-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
}

.order-top,
.customer-top {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: flex-start;
}

.order-number {
    color: var(--muted);
    font-size: 12px;
}

.order-name {
    font-size: 19px;
    font-weight: 800;
    margin: 4px 0;
}

.order-description {
    color: var(--muted);
    margin: 5px 0;
}

.status {
    display: inline-block;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 800;
    background: #e5e7eb;
}

.status.In-Arbeit {
    background: #dbeafe;
    color: #1d4ed8;
}

.status.Fertig {
    background: #dcfce7;
    color: #166534;
}

.status.Bezahlt {
    background: #dcfce7;
    color: #166534;
}

.status.Angebot {
    background: #fef3c7;
    color: #92400e;
}

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

.order-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.room-card,
.position-card,
.material-card,
.payment-card,
.note-card {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 12px;
}

.room-header,
.position-header,
.material-header,
.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.remove-button {
    border: none;
    background: #fee2e2;
    color: var(--red);
    border-radius: 10px;
    padding: 7px 10px;
}

.calculation-card {
    background: #111827;
    color: white;
    border-radius: 20px;
    padding: 22px;
    margin: 20px 0;
}

.calculation-card > div {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    color: #d1d5db;
}

.calculation-card strong {
    color: white;
}

.calculation-card .total-row {
    margin-top: 8px;
    padding-top: 15px;
    border-top: 1px solid #374151;
    font-size: 19px;
}

.calculation-card .open-row {
    color: #fbbf24;
    font-size: 19px;
    font-weight: 800;
}

.save-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.photo-item {
    position: relative;
}

.photo-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
}

.photo-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, .75);
    color: white;
}

.install-card {
    display: flex;
    align-items: center;
    gap: 15px;
}

.install-icon {
    font-size: 40px;
}

.muted {
    color: var(--muted);
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 30px 10px;
}

.price-row {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}


/* =========================
   MALERPLAN BY DH BRANDING
========================= */

.brand-info {
    margin-top: 18px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 14px;
    line-height: 1.7;
    color: var(--muted);
}

.brand-info strong {
    display: block;
    color: var(--text);
    font-size: 16px;
    margin-bottom: 4px;
}

.app-footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 5px 20px 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.app-footer strong {
    color: var(--text);
}

.app-footer span:not(:last-child)::after {
    content: " ·";
    margin-left: 8px;
}


/* =========================
   BOTTOM NAVIGATION
========================= */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--border);
    padding:
        8px
        10px
        calc(8px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}

.bottom-nav button {
    border: none;
    background: transparent;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px;
}

.bottom-nav button span {
    font-size: 21px;
}

.bottom-nav button small {
    font-size: 10px;
}

.bottom-nav button.active {
    color: #111827;
    font-weight: 800;
}

.bottom-nav .nav-new {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #111827;
    color: white;
    margin: -20px auto 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .2);
}

.bottom-nav .nav-new span {
    font-size: 30px;
}


@media (max-width: 800px) {

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .welcome-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}


@media (max-width: 600px) {

    .app-main {
        padding: 14px;
    }

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

    .full {
        grid-column: auto;
    }

    .page-header,
    .section-title-row,
    .order-top,
    .customer-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions button {
        flex: 1;
    }

    .price-row {
        grid-template-columns: 1fr;
    }

    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .order-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-footer {
        padding-left: 14px;
        padding-right: 14px;
    }
}