/* ==========================================================================
   Qekele Design System
   Exact Coolors Monochrome / Slate Palette:
   #f8f9fa (Gray-50) | #e9ecef (Gray-100) | #dee2e6 (Gray-200) | #ced4da (Gray-300)
   #adb5bd (Gray-400) | #6c757d (Gray-500) | #495057 (Gray-600) | #343a40 (Gray-700)
   #212529 (Gray-800)
   ========================================================================== */

:root {
    --gray-50: #f8f9fa;
    --gray-100: #e9ecef;
    --gray-200: #dee2e6;
    --gray-300: #ced4da;
    --gray-400: #adb5bd;
    --gray-500: #6c757d;
    --gray-600: #495057;
    --gray-700: #343a40;
    --gray-800: #212529;
    --white: #ffffff;

    /* Theme Primary - Slate 800 & 900 */
    --brand-primary: #212529;
    --brand-primary-hover: #343a40;
    --brand-primary-soft: #e9ecef;
    --brand-primary-focus: #dee2e6;

    /* Phase Column Header / Accent Tones (Aligned to Monochrome Palette) */
    --phase-plan-bg: #f8f9fa;
    --phase-plan-border: #adb5bd;
    --phase-plan-text: #212529;

    --phase-test-bg: #f8f9fa;
    --phase-test-border: #6c757d;
    --phase-test-text: #343a40;

    --phase-done-bg: #f8f9fa;
    --phase-done-border: #212529;
    --phase-done-text: #212529;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-subtle: 0 1px 3px rgba(33, 37, 41, 0.06), 0 1px 2px rgba(33, 37, 41, 0.04);
    --shadow-card: 0 4px 6px -1px rgba(33, 37, 41, 0.06), 0 2px 4px -2px rgba(33, 37, 41, 0.04);
    --shadow-elevated: 0 10px 15px -3px rgba(33, 37, 41, 0.10), 0 4px 6px -4px rgba(33, 37, 41, 0.06);

    --site-grid-background:
        repeating-linear-gradient(90deg, rgba(108, 117, 125, 0.06) 0, rgba(108, 117, 125, 0.06) 1px, transparent 1px, transparent 96px),
        repeating-linear-gradient(0deg, rgba(108, 117, 125, 0.06) 0, rgba(108, 117, 125, 0.06) 1px, transparent 1px, transparent 96px),
        repeating-linear-gradient(0deg, rgba(108, 117, 125, 0.09) 0, rgba(108, 117, 125, 0.09) 1px, transparent 1px, transparent 12px),
        repeating-linear-gradient(90deg, rgba(108, 117, 125, 0.09) 0, rgba(108, 117, 125, 0.09) 1px, transparent 1px, transparent 12px),
        linear-gradient(90deg, var(--gray-50), var(--gray-50));
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
}

/* Application Layout Frame */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar-wrapper {
    width: 260px;
    flex-shrink: 0;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--gray-50);
}

.main-content {
    padding: 32px 40px;
    flex: 1;
}

/* User's Nav CSS & Color Palette Styling */
.nav-menu {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px 14px;
    background: var(--white);
}

.nav-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 22px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-close-btn {
    background: transparent;
    border: none;
    color: var(--gray-600);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 150ms ease;
}

.sidebar-close-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.sidebar-close-btn .material-symbols-outlined {
    font-size: 22px;
}

.nav-logo img {
    max-width: 160px;
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--gray-800);
}

.brand-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--gray-800);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(33, 37, 41, 0.2);
}

.brand-icon {
    font-size: 22px;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: var(--gray-800);
    line-height: 1.2;
}

.brand-tag {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-top: 15px;
}

.nav-list li {
    margin-bottom: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--gray-600);
    text-decoration: none;
    transition: background-color 180ms ease, color 180ms ease, transform 120ms ease;
    border: none;
    background-color: transparent;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.nav-item--active {
    background: var(--gray-800) !important;
    color: var(--white) !important;
    font-weight: 600;
}

.nav-item .material-symbols-outlined {
    font-size: 20px;
}

.nav-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
}

.user-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-700);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border: 1px solid var(--gray-300);
}

.user-info {
    overflow: hidden;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    color: var(--gray-600);
}

.logout-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

/* Page Headers & Toolbars */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
    letter-spacing: -0.03em;
}

.page-subtitle {
    font-size: 0.92rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.action-btn-primary {
    background: var(--gray-800);
    color: var(--white);
    border: 1px solid var(--gray-800);
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 180ms ease;
    box-shadow: var(--shadow-subtle);
}

.action-btn-primary:hover {
    background: var(--gray-700);
    border-color: var(--gray-700);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.action-btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 9px 16px;
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 180ms ease;
}

.action-btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-800);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 22px;
}

.project-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
    transition: all 200ms ease;
    position: relative;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-elevated);
    border-color: var(--gray-400);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.project-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-800);
    text-decoration: none;
    margin-bottom: 4px;
    display: block;
}

.project-card-title:hover {
    color: var(--gray-600);
}

.client-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
}

.project-card-desc {
    font-size: 0.875rem;
    color: var(--gray-500);
    line-height: 1.5;
    margin-bottom: 18px;
    flex-grow: 1;
}

.project-progress-bar {
    height: 6px;
    background-color: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

.project-progress-fill {
    height: 100%;
    background-color: var(--gray-800);
    border-radius: 3px;
}

.project-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8rem;
    color: var(--gray-500);
}

.member-avatars-stack {
    display: flex;
    align-items: center;
}

.avatar-stack-item {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-700);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
    margin-left: -6px;
}

.avatar-stack-item:first-child {
    margin-left: 0;
}

/* Kanban Board Architecture */
.board-header {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-subtle);
}

.board-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-input-wrap {
    position: relative;
    width: 240px;
}

.search-input-wrap input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    background: var(--white);
    color: var(--gray-800);
}

.search-input-wrap input:focus {
    outline: none;
    border-color: var(--gray-600);
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 18px;
}

.kanban-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: flex-start;
}

@media (max-width: 1024px) {
    .kanban-grid {
        grid-template-columns: 1fr;
    }
}

.kanban-column {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 16px;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--gray-300);
}

.column-plan .kanban-column-header {
    border-bottom-color: var(--gray-400);
}

.column-test .kanban-column-header {
    border-bottom-color: var(--gray-600);
}

.column-done .kanban-column-header {
    border-bottom-color: var(--gray-800);
}

.column-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.column-count {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    box-shadow: var(--shadow-subtle);
}

.kanban-cards-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 380px;
    padding-bottom: 10px;
}

.kanban-cards-container.drag-over {
    background: var(--gray-200);
    border: 2px dashed var(--gray-400);
    border-radius: var(--radius-md);
}

/* Kanban Task Card */
.task-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-subtle);
    cursor: grab;
    transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.task-card:hover {
    box-shadow: var(--shadow-card);
    transform: translateY(-2px);
    border-color: var(--gray-400);
}

.task-card.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.task-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.task-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-800);
    line-height: 1.35;
    margin: 0;
}

.priority-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    border: 1px solid var(--gray-300);
}

.priority-Urgent { background: var(--gray-800); color: var(--white); border-color: var(--gray-800); }
.priority-High { background: var(--gray-600); color: var(--white); border-color: var(--gray-600); }
.priority-Medium { background: var(--gray-200); color: var(--gray-700); }
.priority-Low { background: var(--gray-100); color: var(--gray-500); }

.task-desc {
    font-size: 0.83rem;
    color: var(--gray-500);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
    font-size: 0.78rem;
}

.expectation-timeline {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--gray-600);
    font-weight: 500;
}

.expectation-timeline.overdue {
    color: var(--gray-800);
    font-weight: 700;
    text-decoration: underline;
}

.task-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-phase-btn {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 150ms ease;
}

.quick-phase-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
    border-color: var(--gray-400);
}

/* Modals & Forms */
.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-elevated);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
    padding: 20px 24px;
    background: var(--gray-50);
}

.modal-title {
    font-weight: 700;
    color: var(--gray-800);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 16px 24px;
    background: var(--gray-50);
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-300);
    padding: 9px 12px;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.form-control:focus, .form-select:focus {
    border-color: var(--gray-700);
    box-shadow: 0 0 0 3px var(--gray-200);
}

/* Auth Cards */
.auth-page-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background-color: var(--gray-50);
}

.auth-login-page {
    background-image: var(--site-grid-background);
}

.auth-card {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
    width: 100%;
    max-width: 440px;
    padding: 36px 32px;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

/* ==========================================================================
   Responsive Architecture & Mobile-First Media Queries
   ========================================================================== */

/* Mobile Header Bar */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 3px rgba(33, 37, 41, 0.04);
}

.mobile-nav-toggle {
    background: transparent;
    border: none;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 150ms ease;
    padding: 0;
}

.mobile-nav-toggle:hover {
    background: var(--gray-100);
}

.mobile-nav-toggle .material-symbols-outlined {
    font-size: 26px;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    color: var(--gray-800);
    letter-spacing: -0.02em;
}

.brand-badge-sm {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--gray-800);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(33, 37, 41, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    transition: opacity 250ms ease;
    pointer-events: none;
}

.sidebar-backdrop.is-visible {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

body.sidebar-locked {
    overflow: hidden;
}

/* Breakpoint: Tablets & Mobile (< 992px) */
@media (max-width: 991.98px) {
    .app-layout {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
    }

    .sidebar-wrapper.is-open {
        transform: translateX(0);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    }

    .main-content {
        padding: 20px 18px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        margin-bottom: 22px;
    }

    .page-header > div:last-child {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .page-title {
        font-size: 1.45rem;
    }

    .board-header {
        padding: 16px;
    }

    .board-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .search-input-wrap,
    .filter-group .form-select {
        width: 100% !important;
    }

    /* Horizontal scroll or stacked kanban columns */
    .kanban-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .kanban-column {
        min-height: auto;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Responsive Tables */
    .table-responsive {
        border: 1px solid var(--gray-200);
        border-radius: var(--radius-md);
        background: var(--white);
        margin-bottom: 1rem;
    }
}

/* Breakpoint: Small Mobile Devices (< 576px) */
@media (max-width: 575.98px) {
    .main-content {
        padding: 16px 12px;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .action-btn-primary,
    .action-btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 10px 14px;
    }

    .page-header > div:last-child {
        flex-direction: column;
    }

    .page-header > div:last-child > * {
        width: 100%;
    }

    .auth-card {
        padding: 24px 20px;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-header,
    .modal-footer {
        padding: 14px 18px;
    }

    .task-card {
        padding: 14px;
    }

    .task-meta-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .task-meta-row > div:last-child {
        width: 100%;
        justify-content: space-between;
    }
}
