/* ============================================================
   PCI Subcontractor Portal — Styles
   Version: 1.0.0
   ============================================================ */

:root {
    --pci-blue: #3A78BD;
    --pci-blue-dark: #2c5a91;
    --pci-blue-light: #e8f0fa;
    --pci-blue-hover: #4988cd;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --green-500: #22c55e;
    --green-100: #dcfce7;
    --red-500: #ef4444;
    --red-100: #fee2e2;
    --yellow-500: #eab308;
    --yellow-100: #fef9c3;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

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

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

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pci-blue) 0%, var(--pci-blue-dark) 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin: -48px -40px 32px;
    padding: 32px 40px;
    background: var(--pci-blue);
    border-radius: 12px 12px 0 0;
}

.login-logo-img {
    max-width: 280px;
    height: auto;
    margin-bottom: 8px;
}

.login-logo p {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-top: 8px;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--gray-800);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--pci-blue);
    box-shadow: 0 0 0 3px rgba(58,120,189,0.15);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--pci-blue);
    color: white;
}
.btn-primary:hover { background: var(--pci-blue-dark); }

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-50); }

.btn-danger {
    background: var(--red-500);
    color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-full { width: 100%; }

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

/* ============================================================
   APP LAYOUT
   ============================================================ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-700);
}

.sidebar-logo {
    max-width: 180px;
    height: auto;
}

.sidebar-header .company-name {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    padding: 16px 20px 8px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

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

.nav-item.active {
    background: var(--pci-blue);
    color: white;
}

.nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-700);
}

.sidebar-footer .user-info {
    font-size: 13px;
    color: var(--gray-300);
}

.sidebar-footer .user-role {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* Main content area */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s;
}

/* Desktop sidebar collapse (toggled via .sidebar-collapse-btn) */
.app-wrapper.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}
.app-wrapper.sidebar-collapsed .main-content {
    margin-left: 0;
}

.sidebar-collapse-btn {
    display: inline-block;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--gray-600);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.sidebar-collapse-btn:hover {
    color: var(--pci-blue);
}

.top-bar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

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

.page-content {
    padding: 32px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-700);
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-100);
}

tr:hover td {
    background: var(--gray-50);
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active { background: var(--green-100); color: #16a34a; }
.badge-hold { background: var(--yellow-100); color: #ca8a04; }
.badge-completed { background: var(--gray-200); color: var(--gray-600); }
.badge-admin { background: var(--pci-blue-light); color: var(--pci-blue); }
.badge-pm { background: #fef3c7; color: #d97706; }
.badge-viewer { background: var(--gray-200); color: var(--gray-600); }
.badge-sub { background: #dbeafe; color: #2563eb; }

/* ============================================================
   PROJECT GRID
   ============================================================ */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.project-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

.project-card:hover {
    border-color: var(--pci-blue);
    box-shadow: var(--shadow-md);
}

.project-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.project-card .address {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.project-card .meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-600);
}

.project-card .meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   DOCUMENT LIST
   ============================================================ */

.doc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    transition: background 0.15s;
}

.doc-item:hover {
    background: var(--gray-50);
}

.doc-item .doc-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.doc-item .doc-icon {
    width: 40px;
    height: 40px;
    background: var(--pci-blue-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.doc-item .doc-name {
    font-size: 14px;
    font-weight: 600;
}

.doc-item .doc-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.doc-item .doc-actions {
    display: flex;
    gap: 8px;
}

/* ============================================================
   COMMENTS
   ============================================================ */

.comment-thread {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment {
    display: flex;
    gap: 12px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pci-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.comment-avatar.sub {
    background: var(--gray-500);
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author {
    font-size: 14px;
    font-weight: 600;
}

.comment-time {
    font-size: 12px;
    color: var(--gray-400);
}

.comment-text {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.6;
}

.comment-reply {
    margin-left: 48px;
    border-left: 2px solid var(--pci-blue-light);
    padding-left: 16px;
}

.comment-input-area {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.comment-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.comment-input-area textarea:focus {
    outline: none;
    border-color: var(--pci-blue);
    box-shadow: 0 0 0 3px rgba(58,120,189,0.15);
}

/* ============================================================
   UPLOAD AREA
   ============================================================ */

.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--pci-blue);
    background: var(--pci-blue-light);
}

.upload-zone .upload-icon {
    font-size: 36px;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.upload-zone p {
    color: var(--gray-600);
    font-size: 14px;
}

.upload-zone .upload-hint {
    color: var(--gray-400);
    font-size: 13px;
    margin-top: 4px;
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
}

.modal-close:hover { color: var(--gray-700); }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================================
   STATS ROW
   ============================================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-top: 4px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--green-500);
    border-radius: 4px;
    transition: width 0.3s;
}

/* Project breakdown */
.project-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-breakdown-card .card-header {
    padding: 14px 20px;
}

.project-breakdown-card .card-header:hover {
    background: var(--gray-50);
}

/* ============================================================
   TABS
   ============================================================ */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab:hover { color: var(--gray-700); }

.tab.active {
    color: var(--pci-blue);
    border-bottom-color: var(--pci-blue);
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: var(--red-100);
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--green-100);
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: var(--pci-blue-light);
    color: var(--pci-blue-dark);
    border: 1px solid #bfdbfe;
}

/* ============================================================
   INVITE LINK BOX
   ============================================================ */

.invite-box {
    display: flex;
    gap: 8px;
    align-items: center;
}

.invite-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: monospace;
    background: var(--gray-50);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================================
   LOADING
   ============================================================ */

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--pci-blue);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-center {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s;
    min-width: 300px;
}

.toast.success { border-left: 4px solid var(--green-500); }
.toast.error { border-left: 4px solid var(--red-500); }
.toast.info { border-left: 4px solid var(--pci-blue); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   SCHEDULE
   ============================================================ */

.badge-not-started { background: var(--gray-200); color: var(--gray-600); }
.badge-in-progress { background: var(--pci-blue-light); color: var(--pci-blue); }
.badge-complete { background: var(--green-100); color: #16a34a; }
.badge-delayed { background: var(--red-100); color: #dc2626; }

.schedule-row-not-started { border-left: 3px solid var(--gray-300); }
.schedule-row-in-progress { border-left: 3px solid var(--pci-blue); }
.schedule-row-complete { border-left: 3px solid var(--green-500); }
.schedule-row-delayed { border-left: 3px solid var(--red-500); }
.schedule-row-critical { border-left: 3px solid var(--red-500); }

.schedule-phase-row td { background: var(--gray-50); }
.schedule-phase-row:hover td { background: var(--gray-100); }

.subtask-row td { font-size: 13px; }

.phase-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--gray-500);
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s;
    width: 20px;
    text-align: center;
}

.phase-toggle:hover { background: var(--gray-200); color: var(--gray-700); }

/* View toggle */
.schedule-view-toggle {
    display: flex;
    gap: 0;
}

.schedule-view-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    transition: all 0.15s;
}

.schedule-view-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.schedule-view-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.schedule-view-btn:not(:first-child) { border-left: none; }

.schedule-view-btn.active {
    background: var(--pci-blue);
    color: white;
    border-color: var(--pci-blue);
}

.schedule-view-btn:hover:not(.active) {
    background: var(--gray-50);
}

/* Calendar */
.calendar-container { margin-top: 8px; }

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-nav h3 { font-size: 18px; font-weight: 600; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar-day-header {
    padding: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.calendar-day {
    min-height: 90px;
    padding: 4px 6px;
    border-right: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
    background: white;
}

.calendar-day.outside {
    background: var(--gray-50);
}

.calendar-day.outside .day-number {
    color: var(--gray-400);
}

.calendar-day.today .day-number {
    background: var(--pci-blue);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day.weekend {
    background: #f5f5f5;
    opacity: 0.5;
}

.calendar-day.weekend .day-number {
    color: #ccc;
}

.day-number {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gray-700);
}

.calendar-item {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.calendar-item.status-not_started { background: var(--gray-200); color: var(--gray-600); }
.calendar-item.status-in_progress { background: var(--pci-blue-light); color: var(--pci-blue); }
.calendar-item.status-complete { background: var(--green-100); color: #16a34a; }
.calendar-item.status-delayed { background: var(--red-100); color: #dc2626; }

/* Gantt / Critical Path */
.gantt-container {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: white;
}

.gantt-header {
    display: flex;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
    border-bottom: 2px solid var(--gray-200);
}

.gantt-timeline-header {
    overflow: hidden;
}

.gantt-month-row {
    display: flex;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.gantt-month {
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    border-right: 1px solid var(--gray-200);
    text-align: center;
}

.gantt-day-row {
    display: flex;
}

.gantt-day-header {
    padding: 4px 0;
    font-size: 10px;
    color: var(--gray-400);
    text-align: center;
    border-right: 1px solid var(--gray-100);
}

.gantt-row {
    display: flex;
    border-bottom: 1px solid var(--gray-100);
    align-items: center;
}

.gantt-row:hover {
    background: var(--gray-50);
}

.gantt-label-col {
    width: 200px;
    min-width: 200px;
    padding: 8px 12px;
    font-size: 13px;
    border-right: 1px solid var(--gray-200);
}

.gantt-timeline {
    position: relative;
    min-height: 40px;
}

.gantt-bar {
    position: absolute;
    top: 8px;
    height: 24px;
    border-radius: 4px;
    font-size: 11px;
    color: white;
    display: flex;
    align-items: center;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-bar-normal { background: var(--pci-blue); }
.gantt-bar-critical { background: var(--red-500); }

.gantt-dep-arrow {
    position: absolute;
    top: 12px;
    font-size: 14px;
    color: var(--gray-400);
}

/* Task document thumbnails */
.task-docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.task-doc-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.task-doc-thumb {
    height: 120px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.task-doc-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.15s;
}

.task-doc-img:hover { opacity: 0.85; }

.task-doc-icon {
    font-size: 36px;
    color: var(--gray-400);
}

.task-doc-details {
    padding: 8px 10px;
    border-top: 1px solid var(--gray-100);
}

.task-doc-actions {
    padding: 6px 10px 10px;
    display: flex;
    gap: 6px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .sidebar-collapse-btn {
        display: none;
    }

    .page-content {
        padding: 16px;
    }

    .top-bar {
        padding: 12px 16px;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .modal {
        max-width: 100%;
        margin: 10px;
        max-height: 92vh;
    }
    .modal-body { padding: 16px; }
    .modal-header, .modal-footer { padding: 14px 16px; }
    .modal-footer { flex-wrap: wrap; gap: 8px; }

    /* Keep inputs >= 16px so iOS doesn't zoom in on focus */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
    }

    /* Document / attachment rows: stack info above the buttons */
    .doc-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .doc-item .doc-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Project tabs scroll sideways instead of squishing */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .tab { flex: 0 0 auto; }

    /* Comfortable tap targets */
    .btn { min-height: 40px; }
    .nav-item { padding-top: 12px; padding-bottom: 12px; }

    /* Compact tables (they still scroll horizontally) */
    table th, table td { padding: 8px 10px; font-size: 13px; }

    /* Stack any inline two-column grids (modal detail / form sections) */
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

@media print {
    .sidebar, .top-bar, .schedule-view-toggle, .btn { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .gantt-container { overflow: visible !important; }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 32px 24px;
    }
}
