/* Layout Utilities */
.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--section-gap);
}

.grid-main-side {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--section-gap);
}

.grid-main-side.with-sidebar {
    grid-template-columns: 1fr 340px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

:root {
    --bg-dark: #0a0a0c;
    --bg-sidebar: #111114;
    --primary: #3b82f6;
    --primary-hover: #1d4ed8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --card-bg: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(17, 17, 20, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 24px;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, 0.25);

    --page-padding: 2rem;
    --section-gap: 1.25rem;
    --card-padding: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    line-height: 1.5;
}

h1,
h2,
h3,
.logo {
    font-family: 'Outfit', sans-serif;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-image: url('logo.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    width: 100%;
}

.nav-item i {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-sub-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 0.5rem;
}

.folder-nav-item .nav-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.825rem;
    height: auto;
    gap: 0.75rem;
    border-radius: 8px;
}

.folder-nav-item .nav-item i {
    width: 14px;
    height: 14px;
}

.folder-nav-item:hover .delete-folder-btn {
    opacity: 1 !important;
}

.delete-folder-btn:hover {
    color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.nav-item-secondary:hover {
    color: var(--text-main) !important;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: #1e1e24;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--border);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.username {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.05), transparent 40%),
        radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.03), transparent 30%);
}

.top-bar {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.view-content {
    padding: var(--page-padding);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    height: 44px;
    /* Standard height for all buttons */
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

/* Icon-only Square Buttons */
.btn-square {
    width: 48px;
    height: 48px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
}

.btn-square i {
    width: 20px;
    height: 20px;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Small Buttons (Maintaining proportions) */
.btn-small {
    padding: 0.5rem 0.875rem !important;
    font-size: 0.8rem !important;
    height: 34px !important;
    gap: 0.4rem !important;
}

.btn-small.btn-square {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
}

.btn-small i {
    width: 16px !important;
    height: 16px !important;
}

.project-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.project-actions-group {
    display: flex;
    gap: 0.5rem;
}

/* Glassmorphism */
.glass {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Grid & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--section-gap);
    margin-bottom: var(--section-gap);
}

.stat-card {
    padding: var(--card-padding);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.clickable:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Outfit';
}

.stat-footer {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-up {
    color: var(--success);
}

.stat-down {
    color: var(--danger);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s;
}

.modal-content {
    width: 100%;
    max-width: 540px;
    padding: 3rem;
    border-radius: var(--radius-lg);
    position: relative;
}

.modal-content.large {
    max-width: 900px;
}

.hidden {
    display: none !important;
}

/* Status Badges */
.status-badge {
    padding: 0 0.85rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    /* Fixed height for pill shape */
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-badge select {
    background: transparent;
    border: none;
    color: inherit;
    font-weight: inherit;
    font-size: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.status-badge.planning {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.status-badge.doing,
.status-badge.performing {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.status-badge.review {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.status-badge.complete,
.status-badge.completed,
.status-badge.done {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-badge.on-hold {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-badge.todo {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Task Card Refinements */
.task-card {
    transition: background 0.2s;
    cursor: pointer;
}

.task-card:hover {
    background: rgba(255, 255, 255, 0.02);
}

.task-card input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-dim);
    font-size: 1.125rem;
}

/* Form Styles */
.form-group label {
    font-weight: 500;
}

select option {
    background: var(--bg-sidebar);
}

/* Kanban View */
.kanban-board {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    min-height: 500px;
}

.kanban-column {
    flex: 1;
    min-width: 320px;
    background: rgba(255, 255, 255, 0.015);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    border: 1px solid var(--border);
}

.kanban-column h4 {
    font-family: 'Outfit';
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.kanban-task {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.kanban-task:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Table View */
.table-container {
    overflow-x: auto;
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.task-table th {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.task-table td {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.task-table tr:last-child td {
    border-bottom: none;
}

.task-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Priority Badges */
.priority-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.priority-high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.priority-medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.priority-low {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* Auth Section */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    background: rgba(0, 0, 0, 0.4);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 3rem;
    border-radius: 24px;
    background: rgba(17, 17, 20, 0.8);
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* View Switcher */
.view-switcher {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: var(--radius-md);
    gap: 4px;
}

.view-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-btn.active {
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

/* Subtasks & Hierarchy */
.subtask-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.task-indent {
    margin-left: 24px;
    border-left: 1px solid var(--border);
    padding-left: 12px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Phase 2 Enhancements */
.dropdown-item {
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.kanban-column.drag-over,
.task-card.drag-over,
#tasks-list.drag-over {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px dashed var(--primary) !important;
}

.clickable-row {
    transition: all 0.2s ease;
}

.clickable-row:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    transform: translateY(-2px);
}

.all-tasks-view .task-card:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Project Card Rows */
.project-card-row {
    display: grid !important;
    grid-template-columns: 2.5fr 1.2fr 1.2fr 1fr 1.2fr auto;
    align-items: center;
    gap: 1.25rem;
    padding: 0.875rem 1.5rem !important;
    transition: all 0.2s ease;
}

.project-card-row:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(-1px);
}

.project-title-main {
    font-weight: 600;
    font-size: 1rem;
    color: white;
}

.project-client-sub {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.project-meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.meta-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
}

.meta-value input[type="date"] {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.progress-txt {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
}

.project-row-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.completion-banner {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    color: var(--success);
    font-style: italic;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

/* Responsive Design & Mobile Excellence */
.mobile-only {
    display: none !important;
}

@media (max-width: 1024px) {
    :root {
        --page-padding: 1rem;
        --section-gap: 1.25rem;
    }

    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .app-container {
        flex-direction: column;
    }

    /* Sidebar Drawer */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 2000;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        background: #0d0d12;
        border-right: 1px solid var(--border);
        box-shadow: 0 0 0 100vw rgba(0, 0, 0, 0);
        visibility: hidden;
    }

    .sidebar.mobile-active {
        left: 0;
        visibility: visible;
        box-shadow: 0 0 0 100vw rgba(0, 0, 0, 0.7);
    }

    .sidebar-header {
        padding: calc(1.5rem + env(safe-area-inset-top)) 1.25rem 1.5rem 1.25rem;
    }

    /* Main Layout */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        min-height: 100vh;
    }

    .top-bar {
        padding: calc(1rem + env(safe-area-inset-top)) 1.25rem 1rem 1.25rem !important;
        background: rgba(10, 10, 12, 0.9);
        border-bottom: 1px solid var(--border);
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-areas:
            "title title"
            "menu actions" !important;
        gap: 0.75rem !important;
        height: auto !important;
    }

    .top-bar-left {
        display: contents !important;
        /* Allow children to participate in the top-bar grid */
    }

    .view-title {
        grid-area: title;
        width: 100%;
    }

    .view-title h1 {
        font-size: 1.35rem !important;
        max-width: none !important;
        white-space: normal !important;
        text-align: center;
        width: 100%;
    }

    /* Move buttons below title */
    .top-bar-actions {
        grid-area: actions;
        display: flex !important;
        justify-self: end;
        width: auto !important;
    }

    /* Pull the hamburger menu next to the + button on the bottom row */
    #mobile-menu-toggle {
        grid-area: menu;
        display: flex !important;
        width: 44px !important;
        height: 44px !important;
        justify-self: start;
    }

    .folder-actions {
        display: none !important;
    }

    .top-bar-left button {
        display: none !important;
        /* Hide original hamburger location */
    }

    /* We need to restructure top-bar via CSS to move hamburger next to add button */
    /* Alternative: Just stack everything */

    .view-content {
        padding: var(--page-padding);
    }

    .mobile-only {
        display: flex !important;
    }

    /* Typography Adjustments */
    .view-title h1 {
        font-size: 1.15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
        /* Prevent pushing the right button */
    }

    .top-bar-actions {
        flex-shrink: 0;
    }

    /* Dashboard Optimizations */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
        border-radius: var(--radius-md);
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .grid-2-1,
    .grid-main-side {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    /* Component Refinements */
    .project-card-row {
        grid-template-columns: 1fr auto !important;
        grid-template-areas:
            "info actions"
            "status status" !important;
        padding: 1rem !important;
        gap: 0.75rem !important;
        position: relative;
    }

    /* Hide less important columns on mobile list */
    .project-date-col,
    .project-folder-col,
    .project-progress-col {
        display: none !important;
    }

    .project-info {
        grid-area: info;
    }

    .project-row-actions {
        grid-area: actions;
        align-self: flex-start;
    }

    .project-status-col {
        grid-area: status;
        flex-direction: row !important;
        justify-content: flex-start;
        align-items: center;
        gap: 0.5rem;
        margin-top: 0.25rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .project-status-col .meta-label {
        margin-bottom: 0;
    }

    /* Fix select padding on mobile that causes distortion */
    .project-status-col .status-badge select {
        padding: 0 !important;
        font-size: 0.7rem !important;
    }

    .clickable-row {
        grid-template-columns: 1fr !important;
        padding: 0.85rem 1rem !important;
        gap: 0.75rem !important;
    }

    /* Task Cards */
    .task-card {
        grid-template-columns: auto 1fr !important;
        grid-template-areas:
            "check title"
            ". actions" !important;
        padding: 1rem 1.25rem !important;
        gap: 0.5rem 1rem !important;
        align-items: center !important;
    }

    .task-card>input[type="checkbox"] {
        grid-area: check;
        margin: 0 !important;
    }

    .task-card>div:nth-child(2) {
        grid-area: title;
        text-align: left;
    }

    .task-card>div:nth-child(3),
    .task-card>div:nth-child(4) {
        display: none !important;
    }

    .task-card>div:last-child {
        grid-area: actions;
        justify-self: flex-start;
        display: flex;
        gap: 0.5rem;
    }

    .task-card>div:last-child .btn {
        padding: 6px !important;
        height: 36px !important;
        width: 36px !important;
    }

    /* Kanban & Tables */
    .kanban-board {
        padding: 0.5rem;
        gap: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .kanban-column {
        min-width: 280px;
    }

    .table-container {
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    /* Restore 'New Project' button to top bar (no longer a FAB) */
    #mobile-menu-toggle,
    #add-project-btn {
        position: static !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        z-index: 10;
        width: 48px !important;
        height: 48px !important;
        padding: 0 !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid var(--border) !important;
    }

    #add-project-btn {
        background: var(--primary) !important;
        border-color: transparent !important;
    }

    #add-project-btn span {
        display: none !important;
    }

    #add-project-btn {
        width: 48px !important;
        height: 48px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    #mobile-menu-toggle i,
    #add-project-btn i {
        width: 20px !important;
        height: 20px !important;
    }

    /* Modals */
    .modal-content {
        width: 95% !important;
        padding: 1.5rem !important;
        border-radius: 20px !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-content.large {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        max-width: 100% !important;
    }

    .grid-layout {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Forms */
    input,
    select,
    textarea {
        font-size: 16px !important;
        /* Prevent iOS zoom */
        padding: 0.75rem !important;
    }

    /* Project Detail Header Mobile */
    .project-header-top {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .project-title-wrapper {
        width: 100% !important;
        order: 1;
    }

    .project-header-top .back-btn {
        display: flex !important;
        order: 2;
    }

    .project-actions {
        width: 100% !important;
        justify-content: flex-start !important;
        order: 3;
        margin-top: 0.5rem;
    }

    .project-detail h1,
    .project-detail textarea#p-edit-name {
        font-size: 1.5rem !important;
        width: 100% !important;
        white-space: normal !important;
    }


    .view-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch !important;
        background: rgba(255, 255, 255, 0.02);
        padding: 1rem;
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
    }

    .view-switcher {
        justify-content: space-between;
    }

    .view-switcher .view-btn {
        flex: 1;
        justify-content: center;
        padding: 0.6rem 0.25rem !important;
        font-size: 0.75rem !important;
    }

    /* Top bar actions alignment */
    .top-bar-actions {
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
    }

    /* Fixed double hiding of the add project button */
    .top-bar-actions #add-project-btn {
        display: flex !important;
        /* Force visibility as FAB */
    }

    /* Modal Bottom Sheet on Mobile */
    .modal-overlay {
        align-items: flex-end !important;
    }

    .modal-content {
        width: 100% !important;
        max-height: 92vh !important;
        border-radius: 24px 24px 0 0 !important;
        padding: 1.5rem !important;
        margin-top: auto;
        animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .task-card-wrapper {
        margin-left: 0.75rem !important;
        /* Tighten nesting on mobile */
    }

    /* Mobile Auth Optimizations */
    .auth-overlay {
        background: var(--bg-dark) !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .auth-card {
        max-width: 100% !important;
        width: 100% !important;
        height: 100% !important;
        padding: calc(3rem + env(safe-area-inset-top)) 1.5rem calc(1.5rem + env(safe-area-inset-bottom)) !important;
        border-radius: 0 !important;
        background: var(--bg-dark) !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        color: white !important;
    }

    .auth-card h2 {
        font-size: 1.75rem !important;
        color: white !important;
        margin-bottom: 0.5rem !important;
    }

    .auth-card p {
        color: var(--text-muted) !important;
    }

    .auth-card input {
        height: 52px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid var(--border) !important;
        color: white !important;
        margin-bottom: 1rem !important;
    }

    #auth-page-overlay {
        background: var(--bg-dark) !important;
        backdrop-filter: none !important;
    }

    .project-header-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1.25rem !important;
    }

    .project-actions-group {
        width: 100% !important;
    }

    .project-actions-group .btn {
        flex: 1 !important;
        justify-content: center !important;
    }

    .project-modal-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    #project-modal-desc {
        min-height: 200px !important;
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}