/* ═══════════════════════════════════════════════════════════════════════
   RIFARIZ SYS — Design System
   Soft Glassmorphism Light Theme | Enterprise PMO SaaS
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Google Fonts ──────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Custom Properties ─────────────────────────────────────────── */
:root {
    /* Brand */
    --primary: #4F46E5;
    --primary-light: #6366F1;
    --primary-dark: #3730A3;
    --primary-bg: rgba(79, 70, 229, 0.08);

    /* Neutrals */
    --bg-body: #F0F1F5;
    --bg-surface: #FFFFFF;
    --bg-glass: rgba(255, 255, 255, 0.72);
    --bg-glass-hover: rgba(255, 255, 255, 0.85);
    --bg-sidebar: rgba(255, 255, 255, 0.88);
    --border-glass: rgba(255, 255, 255, 0.6);
    --border-light: rgba(0, 0, 0, 0.06);
    --border-medium: rgba(0, 0, 0, 0.1);

    /* Text */
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-inverse: #FFFFFF;

    /* Status Colors */
    --status-green: #22C55E;
    --status-green-bg: rgba(34, 197, 94, 0.1);
    --status-yellow: #F59E0B;
    --status-yellow-bg: rgba(245, 158, 11, 0.1);
    --status-red: #EF4444;
    --status-red-bg: rgba(239, 68, 68, 0.1);
    --status-blue: #3B82F6;
    --status-blue-bg: rgba(59, 130, 246, 0.1);
    --status-purple: #8B5CF6;
    --status-purple-bg: rgba(139, 92, 246, 0.1);
    --status-gray: #6B7280;
    --status-gray-bg: rgba(107, 114, 128, 0.08);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(79, 70, 229, 0.15);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 0px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Reset & Base ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    font-family: var(--font-family);
    border: none;
    background: none;
}

input,
select,
textarea {
    font-family: var(--font-family);
    font-size: 0.925rem;
}

/* ─── Typography ────────────────────────────────────────────────────── */
h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.4;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
}

h5 {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.8rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.text-center {
    text-align: center;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* ─── Glass Card ────────────────────────────────────────────────────── */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
}

.glass-card-elevated {
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 32px;
}

/* ─── App Layout ────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    transition: margin-left var(--transition-slow);
    min-height: 100vh;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ─── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-slow);
    overflow: hidden;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
    min-height: 76px;
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-brand .brand-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    object-fit: contain;
    flex-shrink: 0;
    background: var(--bg-surface);
    padding: 2px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--transition-base);
}

body.sidebar-collapsed .sidebar-brand .brand-text {
    opacity: 0;
    width: 0;
}

.sidebar-brand .brand-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.sidebar-brand .brand-sub {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-nav a:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-nav a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-nav a .nav-text {
    transition: opacity var(--transition-base);
}

body.sidebar-collapsed .sidebar-nav a .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-toggle {
    padding: 16px 12px;
    border-top: 1px solid var(--border-light);
}

.sidebar-toggle button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.sidebar-toggle button:hover {
    background: var(--border-light);
    color: var(--text-secondary);
}

.sidebar-toggle button svg {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-base);
}

body.sidebar-collapsed .sidebar-toggle button svg {
    transform: rotate(180deg);
}

/* Sidebar user section */
.sidebar-user {
    padding: 16px 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--transition-base);
}

body.sidebar-collapsed .sidebar-user .user-info {
    opacity: 0;
    width: 0;
}

.sidebar-user .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-user .user-role {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

/* ─── Page Header ───────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--status-red);
    color: var(--text-inverse);
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.825rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

/* ─── Badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.775rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-green {
    background: var(--status-green-bg);
    color: #16A34A;
}

.badge-yellow {
    background: var(--status-yellow-bg);
    color: #D97706;
}

.badge-red {
    background: var(--status-red-bg);
    color: #DC2626;
}

.badge-blue {
    background: var(--status-blue-bg);
    color: #2563EB;
}

.badge-purple {
    background: var(--status-purple-bg);
    color: #7C3AED;
}

.badge-gray {
    background: var(--status-gray-bg);
    color: var(--status-gray);
}

.badge-dot::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

/* ─── Stat Cards ────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.stat-card .stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.825rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ─── Forms ─────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.925rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-tertiary);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-error {
    font-size: 0.8rem;
    color: var(--status-red);
    margin-top: 4px;
}

/* ─── Table ─────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.03);
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table .project-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* ─── Tabs ──────────────────────────────────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 24px;
}

.tab-item {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
}

.tab-item:hover {
    color: var(--text-primary);
}

.tab-item.active {
    background: var(--bg-surface);
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* ─── Modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.97);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

/* ─── Upload Zone ───────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: rgba(79, 70, 229, 0.02);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.upload-zone svg {
    width: 40px;
    height: 40px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.upload-zone .upload-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-zone .upload-hint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.upload-zone .upload-text strong {
    color: var(--primary);
}

/* ─── Progress ──────────────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width var(--transition-slow);
}

.progress-bar .progress-fill.green {
    background: linear-gradient(90deg, #16A34A, #22C55E);
}

.progress-bar .progress-fill.yellow {
    background: linear-gradient(90deg, #D97706, #F59E0B);
}

.progress-bar .progress-fill.red {
    background: linear-gradient(90deg, #DC2626, #EF4444);
}

/* Progress Ring (SVG-based) */
.progress-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring .ring-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.06);
}

.progress-ring .ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-linecap: round;
    transition: stroke-dashoffset var(--transition-slow);
}

.progress-ring .ring-text {
    position: absolute;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ─── Centered Alternating Timeline ────────────────────────────────── */
.timeline {
    position: relative;
    padding: 20px 0;
    max-width: 800px;
    margin: 0 auto;
}

/* Central vertical line */
.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-medium);
    transform: translateX(-50%);
}

/* Each timeline entry (row) */
.timeline-item {
    display: flex;
    align-items: flex-start;
    position: relative;
    margin-bottom: 40px;
    width: 100%;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

/* Left-aligned items (odd: card on left, date on right) */
.timeline-item.left {
    flex-direction: row;
}

/* Right-aligned items (even: date on left, card on right) */
.timeline-item.right {
    flex-direction: row-reverse;
}

/* The blue dot on the center line */
.timeline-dot {
    position: absolute;
    left: 50%;
    top: 18px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 2;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.timeline-item.completed .timeline-dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.timeline-item.pending .timeline-dot {
    background: var(--text-tertiary);
    box-shadow: 0 0 0 4px rgba(156, 163, 175, 0.15);
}

.timeline-item.delayed .timeline-dot {
    background: var(--status-red);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

/* Content card (title + status) */
.timeline-card {
    width: calc(50% - 40px);
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.timeline-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.timeline-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.35;
}

.timeline-card-status {
    display: inline-block;
}

/* Date block (prominent: month, day large, year) */
.timeline-date-block {
    width: calc(50% - 40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
}

/* Left item: card is left, date is right → card needs right-align */
.timeline-item.left .timeline-card {
    margin-right: auto;
    text-align: right;
}

.timeline-item.left .timeline-date-block {
    margin-left: auto;
    padding-left: 40px;
}

/* Right item: card is right, date is left → card needs left-align */
.timeline-item.right .timeline-card {
    margin-left: auto;
    text-align: left;
}

.timeline-item.right .timeline-date-block {
    margin-right: auto;
    padding-right: 40px;
}

.timeline-date-month {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

.timeline-date-day {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
}

.timeline-date-year {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    line-height: 1;
}

/* ─── Centered Timeline Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
    .timeline::before {
        left: 20px;
    }

    .timeline-item.left,
    .timeline-item.right {
        flex-direction: row;
        padding-left: 50px;
    }

    .timeline-dot {
        left: 20px;
        top: 18px;
    }

    .timeline-card {
        width: 100%;
        text-align: left !important;
        margin: 0 !important;
    }

    .timeline-date-block {
        display: none;
    }

    /* Show date inline on mobile inside the card */
    .timeline-card .timeline-mobile-date {
        display: block;
        font-size: 0.775rem;
        color: var(--text-tertiary);
        font-weight: 500;
        margin-bottom: 6px;
    }
}

@media (min-width: 769px) {
    .timeline-card .timeline-mobile-date {
        display: none;
    }
}

/* ─── Gallery Grid ──────────────────────────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    background: var(--border-light);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item .gallery-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    z-index: 2;
}

.gallery-item:hover .gallery-delete {
    display: flex;
}

/* ─── Lightbox ──────────────────────────────────────────────────────── */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    border: none;
}

/* ─── Gantt-style Timeline Bar ──────────────────────────────────────── */
.gantt-bar {
    position: relative;
    height: 32px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
}

.gantt-bar .planned {
    height: 12px;
    background: rgba(79, 70, 229, 0.2);
    border-radius: var(--radius-full);
    margin-bottom: 4px;
}

.gantt-bar .actual {
    height: 12px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-full);
}

/* ─── Search & Filter Bar ───────────────────────────────────────────── */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.search-input {
    flex: 1;
    max-width: 360px;
    position: relative;
}

.search-input input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
}

/* ─── Widget Grid (Dashboard) ───────────────────────────────────────── */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.widget-col-4 {
    grid-column: span 4;
}

.widget-col-6 {
    grid-column: span 6;
}

.widget-col-8 {
    grid-column: span 8;
}

.widget-col-12 {
    grid-column: span 12;
}

@media (max-width: 1200px) {

    .widget-col-4,
    .widget-col-6,
    .widget-col-8 {
        grid-column: span 6;
    }
}

@media (max-width: 768px) {

    .widget-col-4,
    .widget-col-6,
    .widget-col-8 {
        grid-column: span 12;
    }
}

/* ─── Milestone Checklist ───────────────────────────────────────────── */
.milestone-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.milestone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.milestone-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.milestone-check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.milestone-check.completed {
    border-color: var(--status-green);
    background: var(--status-green);
    color: white;
}

.milestone-check.delayed {
    border-color: var(--status-red);
    background: var(--status-red);
    color: white;
}

.milestone-info {
    flex: 1;
}

.milestone-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.milestone-date {
    font-size: 0.775rem;
    color: var(--text-tertiary);
}

.milestone-actions {
    display: flex;
    gap: 4px;
}

/* ─── Empty State ───────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-tertiary);
}

.empty-state svg {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 320px;
    margin: 0 auto;
}

/* ─── Toast / Notification ──────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--primary);
    min-width: 280px;
}

.toast.success {
    border-left-color: var(--status-green);
}

.toast.error {
    border-left-color: var(--status-red);
}

.toast.warning {
    border-left-color: var(--status-yellow);
}

/* ─── File List ─────────────────────────────────────────────────────── */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.file-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.file-icon.pdf {
    background: var(--status-red-bg);
    color: #DC2626;
}

.file-icon.drawing {
    background: var(--status-blue-bg);
    color: #2563EB;
}

.file-icon.report {
    background: var(--status-green-bg);
    color: #16A34A;
}

.file-icon.other {
    background: var(--status-gray-bg);
    color: var(--status-gray);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.775rem;
    color: var(--text-tertiary);
}

.file-actions {
    display: flex;
    gap: 4px;
}

/* ─── Activity Group ────────────────────────────────────────────────── */
.activity-group {
    margin-bottom: 28px;
}

.activity-date-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-date-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

.activity-entry {
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.activity-description {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* ─── Login Page ────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.3rem;
    margin-bottom: 16px;
    box-shadow: var(--shadow-glow);
}

.auth-logo h1 {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

.auth-error {
    background: var(--status-red-bg);
    color: #DC2626;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

.auth-error.visible {
    display: block;
}

/* ─── Welcome Page ──────────────────────────────────────────────────── */
.welcome-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.welcome-content {
    text-align: center;
    animation: fadeInUp 0.8s ease;
}

.welcome-content .welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.8rem;
    margin-bottom: 32px;
    box-shadow: var(--shadow-glow);
}

.welcome-content h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content .welcome-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 400;
}

.welcome-content .welcome-brand {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 40px;
    font-weight: 400;
}

.welcome-dots {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(79, 70, 229, 0.06) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* ─── Animations ────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .main-content {
        padding: 24px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .auth-card {
        padding: 28px;
    }

    .welcome-content h1 {
        font-size: 2.2rem;
    }
}

/* ─── Utility ───────────────────────────────────────────────────────── */
.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-20 {
    gap: 20px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}