:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

#app {
    max-width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: var(--primary);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    padding-top: max(1rem, env(safe-area-inset-top));
}

.header-content {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.countdown {
    font-size: 0.875rem;
    background: rgba(255,255,255,0.2);
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
    font-weight: 600;
    flex-shrink: 0;
}

.header-logout-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.header-logout-btn:active {
    transform: translateY(0);
}

/* Turnaround Header Styling */
.turnaround-header {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

/* Wellness Header Styling */
.wellness-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.header-title-section {
    flex: 1;
    margin-left: 1rem;
}

.title-with-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.header-subtitle {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 0.25rem;
    font-weight: 500;
    letter-spacing: 0.025em;
}

.header-badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.info-badge {
    font-size: 0.675rem;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.info-badge.critical {
    background: rgba(254, 202, 202, 0.3);
    border-color: rgba(254, 202, 202, 0.5);
}

.info-badge.warning {
    background: rgba(254, 243, 199, 0.25);
    border-color: rgba(254, 243, 199, 0.4);
}

.countdown-large {
    font-size: 1.125rem;
    background: rgba(255,255,255,0.25);
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 700;
    text-align: center;
    min-width: 140px;
    border: 2px solid rgba(255,255,255,0.3);
}

.urgent-pulse {
    animation: pulse-urgent 2s ease-in-out infinite;
}

@keyframes pulse-urgent {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255,255,255,0.7);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(255,255,255,0);
    }
}

/* Navigation */
.nav-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-tab.active {
    color: white;
    border-bottom-color: white;
}

/* Main Content */
.app-main {
    flex: 1;
    padding: 1.25rem;
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
}

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

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Card */
.card {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.75rem 0 0.25rem;
}

.card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Timeline */
.timeline-progress {
    margin-top: 1rem;
}

.timeline-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.timeline-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 1rem;
    transition: width 0.3s ease;
}

.timeline-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Phase Badge */
.phase-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Progress Bar */
.phase-progress {
    margin-top: 1rem;
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 1rem;
    transition: width 0.3s ease;
}

.phase-progress span {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Milestone List */
.milestone-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.milestone-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.milestone-item:active {
    transform: scale(0.98);
    background: var(--bg-tertiary);
}

.milestone-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    margin-right: 0.875rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.milestone-item.complete .milestone-checkbox {
    background: var(--success);
    border-color: var(--success);
    position: relative;
}

.milestone-item.complete .milestone-checkbox::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
}

.milestone-info {
    flex: 1;
}

.milestone-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.milestone-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.milestone-due {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-left: auto;
    flex-shrink: 0;
}

.milestone-due.overdue {
    color: var(--danger);
    font-weight: 600;
}

/* Phases Container */
.phases-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.phase-card {
    background: var(--bg-primary);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.phase-card:active {
    transform: scale(0.98);
}

.phase-header {
    padding: 1.25rem;
    border-left: 4px solid var(--primary);
}

.phase-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.phase-dates {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.phase-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
}

.phase-stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.phase-stat strong {
    color: var(--primary);
}

.phase-body {
    display: none;
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.phase-card.expanded .phase-body {
    display: block;
}

/* Risk List */
.risk-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    background: var(--bg-primary);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

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

.risk-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.risk-item {
    background: var(--bg-primary);
    padding: 1.25rem;
    border-radius: 0.875rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--secondary);
}

.risk-item.high {
    border-left-color: var(--danger);
}

.risk-item.medium {
    border-left-color: var(--warning);
}

.risk-item.low {
    border-left-color: var(--success);
}

.risk-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.risk-title {
    font-weight: 600;
    font-size: 0.9375rem;
    flex: 1;
}

.risk-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 0.5rem;
}

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

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

.risk-badge.low {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.risk-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.risk-owner {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Team Grid */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.team-card {
    background: var(--bg-primary);
    padding: 1.25rem;
    border-radius: 0.875rem;
    box-shadow: var(--shadow);
}

.team-role {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.team-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.team-tasks {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* FAB */
.fab-container {
    position: fixed;
    bottom: calc(1.5rem + env(safe-area-inset-bottom));
    right: calc(1.5rem + env(safe-area-inset-right));
    z-index: 90;
}

@supports (height: 100dvh) {
    .fab-container {
        bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:active {
    transform: scale(0.9);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 1rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: calc(-1 * min(320px, 90vw));
    width: min(320px, 90vw);
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar.open {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: var(--primary);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.sidebar-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-content {
    padding: 0.5rem 0;
}

.sidebar-section {
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.25rem;
    margin: 0;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.sidebar-section-title:hover {
    background: var(--bg-secondary);
}

.sidebar-section-title:active {
    background: var(--bg-tertiary);
}

.section-arrow {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    transform: rotate(-90deg);
}

.sidebar-section.expanded .section-arrow {
    transform: rotate(0deg);
}

.sidebar-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.sidebar-section.expanded .sidebar-section-content {
    max-height: 1000px;
    opacity: 1;
}

.sidebar-item {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 0.875rem 1.25rem;
    color: var(--text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-item:hover,
.sidebar-item:active {
    background: var(--bg-secondary);
}

.sidebar-item:active {
    background: var(--bg-tertiary);
}

.toggle-indicator {
    font-size: 1.25rem;
}

.status-indicator {
    font-size: 0.75rem;
}

.status-indicator.online {
    color: var(--success);
}

.status-indicator.offline {
    color: var(--secondary);
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    margin-right: 0.5rem;
}

/* Project Badge */
.project-badge {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-top: 0.25rem;
}

.project-badge.urgent {
    background: rgba(255,255,255,0.3);
    color: white;
}

/* Alert Banner */
.alert-banner {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-banner.critical {
    background: #fee2e2;
    border-left-color: var(--danger);
    color: #991b1b;
}

.alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert-content h3,
.alert-content strong {
    color: inherit;
    margin-bottom: 0.25rem;
}

.alert-content p {
    margin: 0;
    color: inherit;
    opacity: 0.9;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.kpi-card {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid;
}

.kpi-card.critical,
.kpi-card.urgent {
    border-left-color: var(--danger);
}

.kpi-card.warning {
    border-left-color: var(--warning);
}

.kpi-card.ok {
    border-left-color: var(--success);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.kpi-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.kpi-trend {
    font-size: 1.25rem;
}

.kpi-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.kpi-current,
.kpi-target {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Badge */
.badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.urgent {
    background: #fee2e2;
    color: #991b1b;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

/* Phase Impact */
.phase-impact {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Milestone Details */
.milestone-details {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.milestone-details p {
    margin-bottom: 0.75rem;
}

.milestone-details p:last-child {
    margin-bottom: 0;
}

.milestone-details strong {
    color: var(--text-primary);
}

.milestone-details details {
    margin-top: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.milestone-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
    padding: 0.5rem;
    list-style: none;
    user-select: none;
}

.milestone-details summary::-webkit-details-marker {
    display: none;
}

.milestone-details summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.3s;
    font-size: 0.75rem;
}

.milestone-details details[open] summary::before {
    transform: rotate(90deg);
}

.milestone-details ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
}

.milestone-details li {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

/* Notes Section */
.notes-section {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary);
}

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

.notes-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
}

.notes-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.notes-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.notes-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.save-indicator {
    color: var(--success);
    font-weight: 600;
}

/* Upload Section */
.upload-section {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    border-left: 3px solid var(--warning);
}

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

.upload-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
}

.upload-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

.upload-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.upload-item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-icon {
    font-size: 1.25rem;
}

.upload-name {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.upload-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.upload-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: var(--primary-dark);
}

.upload-input {
    display: none;
}

/* Context/History Section for KPIs */
.kpi-context {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.kpi-context-toggle {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.kpi-context-toggle::before {
    content: '▶';
    font-size: 0.625rem;
    transition: transform 0.3s;
}

.kpi-context-toggle.open::before {
    transform: rotate(90deg);
}

.kpi-context-content {
    display: none;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.kpi-context-content.open {
    display: block;
}

/* Responsive */
@media (min-width: 768px) {
    .app-main {
        padding: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .header-content h1 {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .fab-container {
        bottom: 1rem;
        right: 1rem;
    }
}

/* Checklist Toggle Button */
.checklist-toggle-btn {
    background: rgba(103, 58, 183, 0.2);
    border: 1px solid var(--primary);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    width: auto;
}

.checklist-toggle-btn:hover {
    background: rgba(103, 58, 183, 0.3);
    transform: translateY(-1px);
}

.checklist-content {
    margin-bottom: 1rem;
}

/* Notes & Attachments Toggle Button */
.notes-toggle-btn {
    background: rgba(33, 150, 243, 0.2);
    border: 1px solid #2196F3;
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: auto;
}

.notes-toggle-btn:hover {
    background: rgba(33, 150, 243, 0.3);
    transform: translateY(-1px);
}

/* Save Note Button */
.save-note-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.save-note-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.save-note-btn:active {
    transform: translateY(0);
}

/* Checklist Item Notes */
.checklist-item-notes {
    margin-top: 0.75rem;
    padding: 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    border-left: 3px solid #2196F3;
}

.checklist-item-notes textarea {
    width: 100%;
    min-height: 80px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.checklist-item-notes textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Add Note Button (on checklist items) */
.checklist-item-note-btn,
.add-note-btn {
    background: transparent;
    border: 1px dashed rgba(255,255,255,0.3);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.checklist-item-note-btn:hover,
.add-note-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
}

.checklist-item-text {
    flex: 1;
}

.milestone-notes-section {
    margin-top: 1rem;
    position: relative;
}

.phase-description-section {
    margin: 1rem 0;
    position: relative;
}

.checklist-content {
    position: relative;
}

.milestone-details {
    position: relative;
}

.checklist-item-notes {
    position: relative;
}

/* Close Button */
.close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.5);
    color: #f44336;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
}

.close-btn:hover {
    background: rgba(244, 67, 54, 0.4);
    border-color: #f44336;
    transform: scale(1.1);
}

.close-btn:active {
    transform: scale(0.95);
}

/* AI Copilot Styles */
.copilot-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.copilot-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.copilot-panel {
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.copilot-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
}

.copilot-icon {
    font-size: 2rem;
}

.copilot-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.25rem;
}

.copilot-section {
    margin-bottom: 1.5rem;
}

.copilot-section h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.copilot-simple {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    font-size: 1rem;
    line-height: 1.6;
}

.copilot-list {
    list-style: none;
    padding: 0;
}

.copilot-list li {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    border-left: 3px solid #667eea;
}

.copilot-qa {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 3px solid #764ba2;
}

.copilot-question {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.copilot-answer {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 0;
}

.copilot-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
    width: 100%;
}

.copilot-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

/* Revenue Calculator Styles */
.revenue-scenarios {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.scenario-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.scenario-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.scenario-optimistic {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.scenario-realistic {
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.1);
}

.scenario-conservative {
    border-color: #FF9800;
    background: rgba(255, 152, 0, 0.1);
}

.scenario-minimum {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.scenario-percent {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.scenario-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.scenario-amount {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.calculator-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.calculator-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.calculator-input:focus {
    outline: none;
    border-color: var(--primary);
}

.calculator-symbol {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.calculator-result {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-top: 1rem;
}

/* Authentication & Login Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
    padding: calc(env(safe-area-inset-top, 1.5rem)) 1.5rem 1.5rem;
    overflow-y: auto;
    min-height: 100vh;
}

.login-modal {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: min(500px, 100%);
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(103, 58, 183, 0.3);
}

.login-header h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.login-mission {
    background: linear-gradient(135deg, #4f8cff 0%, #8ab6ff 100%) !important;
    border: 2px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    text-align: center !important;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.6) !important;
    position: relative;
    z-index: 10001;
}

.login-mission p {
    color: #f4f7ff !important;
    font-size: 1.05rem !important;
    line-height: 1.7;
    margin: 0 auto !important;
    font-weight: 600 !important;
    letter-spacing: 0.015em;
    text-align: center !important;
    text-shadow: 0 4px 14px rgba(15, 23, 42, 0.45) !important;
    position: relative;
    z-index: 10002;
    max-width: 100%;
}

.login-body {
    margin-bottom: 1.25rem;
}

.login-body label {
    display: block;
    color: #ffffff;
    font-weight: 500;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.login-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 0.875rem;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.login-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.2);
}

.login-select option {
    background: #0f172a;
    color: #ffffff;
    padding: 0.5rem;
}

.login-select optgroup {
    background: #1e293b;
    color: #94a3b8;
    font-weight: 600;
}

.login-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 0.875rem;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.login-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.2);
}

.login-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
}

.login-info {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid #10b981;
    color: #6ee7b7;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
}

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
    .login-overlay {
        padding: calc(env(safe-area-inset-top, 1rem)) 1rem 1rem;
    }
    .login-modal {
        padding: 1.25rem;
        border-radius: 10px;
        border-width: 1px;
        max-height: 90vh;
        overflow-y: auto;
    }
    .login-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
    .login-header h2 {
        font-size: 1.35rem;
    }
    .login-mission {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    .login-mission p {
        font-size: 0.95rem;
    }
    .login-body label {
        margin-bottom: 0.5rem;
        font-size: 0.85rem;
    }
    .login-select,
    .login-input {
        padding: 0.75rem;
        margin-bottom: 0.85rem;
    }
    .login-btn {
        padding: 0.85rem 1rem;
        font-size: 1rem;
    }
    .login-footer {
        padding-top: 1rem;
    }
}

@media (max-width: 420px) {
    .login-modal {
        padding: 1rem;
    }
    .login-mission {
        padding: 0.9rem;
        border-radius: 10px;
    }
    .login-mission p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    .login-select,
    .login-input,
    .login-btn {
        font-size: 0.95rem;
    }
}

@media (max-height: 720px) {
    .login-overlay {
        align-items: flex-start;
    }
    .login-modal {
        margin-top: env(safe-area-inset-top, 1rem);
        margin-bottom: 1.5rem;
    }
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.login-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    font-style: italic;
}

/* User Info Display */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-name {
    color: white !important;
    font-weight: 500;
    font-size: 0.95rem;
}

.logout-btn {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.5);
    color: #f44336;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: #f44336;
}

/* Copilot Locked State */
.copilot-locked {
    background: rgba(244, 67, 54, 0.1);
    border: 2px solid rgba(244, 67, 54, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    text-align: center;
}

.lock-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.lock-message {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.lock-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Owner Badge */
.owner-badge,
.owner-badge-you {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.owner-badge {
    background: rgba(33, 150, 243, 0.2);
    border: 1px solid rgba(33, 150, 243, 0.4);
    color: #2196F3;
}

.owner-badge-you {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
    color: #4CAF50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Dark mode support */
body.dark-theme {
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1e293b;
        --bg-secondary: #0f172a;
        --bg-tertiary: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border: #334155;
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
    }
}

/* Enhanced Mobile Optimization */
@media (max-width: 768px) {
    .app-main {
        padding: 1rem;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .stats-grid {
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .card h2 {
        font-size: 1.125rem;
    }
    
    .milestone-list {
        gap: 0.75rem;
    }
    
    .milestone-item {
        padding: 0.875rem;
    }
    
    .nav-tabs {
        gap: 0.25rem;
        padding: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .nav-tab {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    .header-content {
        padding: 0.75rem 1rem;
    }
    
    .header-content h1 {
        font-size: 1.125rem;
    }
    
    .sidebar {
        width: 85%;
        max-width: 320px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.6875rem;
    }
    
    .app-main {
        padding: 0.75rem;
    }
    
    .card {
        padding: 0.75rem;
    }
    
    .phase-badge {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }
    
    .timeline-info {
        font-size: 0.75rem;
    }
    
    body {
        overflow-x: hidden;
        position: relative;
    }
    
    #app {
        overflow-x: hidden;
        width: 100%;
    }
}

/* Prevent horizontal scroll on all devices */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

.view {
    overflow-x: hidden;
    width: 100%;
}

