/**
 * WorkShift Page-Specific Styles — Enterprise SaaS (Atlassian Design Language)
 * Kanban Board, Dashboard, Client Portal, Landing, Invoices, Settings, Auth
 */

/* =========================================================================
   Kanban Board
   Lanes as tinted trays, cards with keys & avatars, dashed add-task row
   ========================================================================= */

.board-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-height));
    height: calc(100dvh - var(--topbar-height));
    overflow: hidden;
    background: var(--color-bg-page);
}

.board-header {
    padding: var(--space-4) var(--space-6);
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    flex-shrink: 0;
}

.board-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.board-title-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.board-summary-strip {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--color-bg-surface-sunken);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: var(--text-caption);
    font-weight: var(--weight-medium);
}

/* ── Board Canvas ── */
.board-canvas {
    flex: 1;
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6) var(--space-6);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ── Kanban Lane / Column ── */
.board-column {
    flex: 0 0 320px;
    width: 320px;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-surface-sunken);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    max-height: 100%;
    overflow: hidden;
}

.board-column-header {
    height: 44px;
    padding: 0 var(--space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.column-title {
    font-size: 11px;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-subtle);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.column-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: var(--weight-semibold);
    color: var(--color-text-subtle);
}

/* ── Scrollable Task List ── */
.board-task-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 100px;
}

/* ── Task Card (Jira-style) ── */
.clay-task-card,
.task-card {
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    user-select: none;
    position: relative;
    box-shadow: none;
}

.clay-task-card:hover,
.task-card:hover {
    border-color: var(--color-border-focused);
    background: var(--color-bg-hover);
}

.clay-task-card.sortable-ghost {
    opacity: 0.3;
    border: 1px dashed var(--color-brand);
}

.task-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.task-card-title {
    font-size: var(--text-body);
    font-weight: var(--weight-medium);
    color: var(--color-text);
    line-height: 1.4;
    word-break: break-word;
}

.task-card-key {
    font-size: 11px;
    font-weight: var(--weight-semibold);
    color: var(--color-text-subtlest);
    font-family: monospace;
    letter-spacing: 0.02em;
}

.task-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-caption);
    color: var(--color-text-subtle);
}

.task-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Dashed Add Task Row at Bottom of Lane */
.lane-add-task-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    height: 36px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-subtle);
    font-size: var(--text-caption);
    font-weight: var(--weight-medium);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.lane-add-task-btn:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-brand);
    color: var(--color-brand);
}

/* Add Stage Column (after last lane) */
.board-add-stage-col {
    flex: 0 0 240px;
    display: flex;
    align-items: flex-start;
}

.add-stage-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--color-text-subtle);
    font-size: var(--text-body);
    font-weight: var(--weight-medium);
    cursor: pointer;
    width: 100%;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.add-stage-btn:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-brand);
    color: var(--color-brand);
}

/* Mobile Stage Switcher Tabs */
.board-mobile-nav {
    display: none;
    padding: var(--space-2) var(--space-4);
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    gap: var(--space-2);
    overflow-x: auto;
    white-space: nowrap;
}

.board-mobile-tab {
    padding: 4px var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-caption);
    font-weight: var(--weight-medium);
    color: var(--color-text-subtle);
    background: var(--color-bg-surface-sunken);
    border: 1px solid var(--color-border);
    cursor: pointer;
}

.board-mobile-tab.active {
    background: var(--color-brand);
    color: var(--color-brand-text);
    border-color: var(--color-brand);
}

@media (max-width: 639px) {
    .board-mobile-nav {
        display: flex;
    }
    .board-canvas {
        scroll-snap-type: x mandatory;
        padding: var(--space-3);
        gap: var(--space-3);
    }
    .board-column {
        flex: 0 0 calc(100vw - 32px);
        width: calc(100vw - 32px);
        scroll-snap-align: center;
    }
    .board-header {
        padding: var(--space-3);
    }
}

/* =========================================================================
   Dashboard Screen
   Structured 12-column grid, stat tiles, waiting-on split
   ========================================================================= */

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-8);
}

@media (max-width: 1023px) {
    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-stats-grid {
        gap: var(--space-4);
        margin-bottom: var(--space-6);
    }
}

.waiting-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

@media (max-width: 639px) {
    .waiting-split-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
}

/* =========================================================================
   Auth Screens
   Centered 400px card on page background, 32px padding, 20px field gaps
   ========================================================================= */

.auth-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background-color: var(--color-bg-page);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: none;
}

@media (max-width: 639px) {
    .auth-card {
        padding: var(--space-6);
    }
}

/* =========================================================================
   Public Landing Page
   Enterprise SaaS calm presentation, 64-96px section gaps
   ========================================================================= */

.landing-hero {
    padding: clamp(3rem, 6vw + 1rem, 6rem) var(--space-6);
    text-align: center;
    position: relative;
}

.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px var(--space-3);
    border-radius: var(--radius-full);
    background: var(--color-brand-subtle);
    border: 1px solid var(--color-border);
    color: var(--color-brand);
    font-size: var(--text-caption);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-4);
}

.landing-section {
    padding: var(--space-16) var(--space-6);
    border-top: 1px solid var(--color-border);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    max-width: 800px;
    margin: 0 auto;
}

.pricing-card-pro {
    border: 2px solid var(--color-brand);
    position: relative;
}

.pricing-popular-tag {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-brand);
    color: var(--color-brand-text);
    font-size: 11px;
    font-weight: var(--weight-semibold);
    padding: 2px var(--space-3);
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* =========================================================================
   Settings Screen
   Two-column layout (sub-nav left, forms right)
   ========================================================================= */

.settings-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: var(--space-8);
    align-items: start;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    position: sticky;
    top: var(--space-4);
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-body);
    font-weight: var(--weight-medium);
    color: var(--color-text-subtle);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.settings-nav-item:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
    text-decoration: none;
}

.settings-nav-item.active {
    background: var(--color-bg-selected);
    color: var(--color-brand);
    font-weight: var(--weight-semibold);
}

@media (max-width: 767px) {
    .settings-layout {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
        border-bottom: 1px solid var(--color-border);
        padding-bottom: var(--space-2);
    }
}

/* ==========================================================================
   Gantt & Timeline View Styles
   ========================================================================== */
.gantt-root-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.gantt-toolbar {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-subtle, rgba(0,0,0,0.02));
}

.gantt-viewport {
    display: flex;
    width: 100%;
    min-height: 480px;
    max-height: calc(100vh - 280px);
    overflow: hidden;
    position: relative;
}

.gantt-left-pane {
    flex: 0 0 280px;
    width: 280px;
    border-right: 1px solid var(--color-border);
    background: var(--color-bg-surface);
    overflow-y: hidden;
    user-select: none;
    z-index: 10;
}

.gantt-left-header {
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 var(--space-4);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    color: var(--color-text-subtle);
    border-bottom: 2px solid var(--color-border);
    background: var(--color-bg-surface);
}

.gantt-left-stage-row {
    height: 38px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-3);
    background: var(--color-bg-subtle, rgba(0,0,0,0.03));
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    font-size: var(--text-xs);
}

.gantt-left-stage-row:hover {
    background: var(--color-bg-hover);
}

.stage-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.stage-toggle-icon {
    font-size: 9px;
    color: var(--color-text-subtle);
    width: 12px;
}

.gantt-left-task-row {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-caption);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.gantt-left-task-row:hover {
    background: var(--color-bg-hover);
}

.task-title-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.gantt-right-grid {
    flex: 1 1 auto;
    overflow: auto;
    position: relative;
    background: var(--color-bg-surface);
}

.gantt-grid-content {
    position: relative;
    min-height: 100%;
}

.gantt-date-header {
    height: 48px;
    display: flex;
    border-bottom: 2px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-bg-surface);
    z-index: 8;
}

.gantt-header-cell {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--color-border);
    user-select: none;
}

.gantt-header-cell.is-weekend {
    background: var(--color-bg-subtle, rgba(0,0,0,0.02));
}

.gantt-stage-grid-row {
    height: 38px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-subtle, rgba(0,0,0,0.02));
}

.gantt-task-grid-row {
    height: 44px;
    position: relative;
    border-bottom: 1px solid var(--color-border);
}

.gantt-bar {
    position: absolute;
    top: 7px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: #ffffff;
    font-size: 11px;
    font-weight: var(--weight-medium);
    cursor: grab;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: box-shadow 0.15s ease, opacity 0.15s ease;
    z-index: 5;
}

.gantt-bar:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    z-index: 7;
}

.gantt-bar.is-dragging {
    cursor: grabbing;
    opacity: 0.85;
    z-index: 10;
}

.gantt-bar-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.gantt-bar-label {
    position: relative;
    z-index: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
    z-index: 4;
}

.gantt-handle-left { left: 0; }
.gantt-handle-right { right: 0; }

.gantt-handle:hover {
    background: rgba(255,255,255,0.4);
}

.gantt-milestone-diamond {
    position: absolute;
    top: 14px;
    width: 16px;
    height: 16px;
    transform: rotate(45deg);
    border-radius: 2px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    z-index: 6;
}

.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-danger, #E5493A);
    z-index: 7;
    pointer-events: none;
}

.gantt-dependency-svg {
    position: absolute;
    top: 48px;
    left: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 4;
}

.gantt-unscheduled-drawer {
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-subtle, rgba(0,0,0,0.02));
}

@media (max-width: 767px) {
    .gantt-left-pane {
        flex: 0 0 160px;
        width: 160px;
    }
}
