header {
    background: var(--bg-surface);
    padding: calc(10px + var(--safe-top)) 12px 12px;
    box-shadow: var(--shadow-sm);
    z-index: 20;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--primary);
    white-space: nowrap;
}

.tab-switcher {
    display: flex;
    background: var(--bg-app);
    padding: 4px;
    border-radius: var(--radius-md);
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tab-switcher::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    border: none;
    background: none;
    padding: 8px 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    z-index: 2;
    position: relative;
}

.tab-btn.active {
    color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 2px 12px rgba(108, 99, 255, 0.15);
}

.tab-btn:not(.active):hover {
    color: var(--primary-light);
}

.tab-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-app);
    color: var(--primary);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.view-content {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.view-content.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.canvas-section {
    flex: 0 0 35%;
    background-color: var(--bg-surface);
    position: relative;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    overflow: hidden;
}

.toolbar {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 15;
}

.toggle-grid {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
}

[data-theme="dark"] .toggle-grid {
    background: rgba(30, 30, 50, 0.9);
    color: #aaa;
}

.input-section {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 769px) {
    header {
        flex-direction: row;
        padding: 8px 20px;
        gap: 12px;
    }

    .tab-switcher {
        flex: 1;
    }

    .tab-btn {
        flex: 1;
        padding: 10px;
        font-size: 14px;
    }

    .view-content {
        flex-direction: row;
        height: calc(100vh - 70px);
    }

    .canvas-section {
        flex: 0 0 50%;
        border-radius: 0;
        border-right: 1px solid var(--border);
    }

    .input-section {
        flex: 1;
        overflow-y: auto;
    }
}
