/* =========================================================
   ENTERPRISE DESIGN SYSTEM
   Professional SaaS Dashboard Styling
   ========================================================= */

/* =========================================================
   COLOR SYSTEM - Professional Palette
   ========================================================= */
:root {
    /* Primary Brand */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --primary-bg: #eff6ff;

    /* Semantic Colors */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;

    /* Neutrals */
    --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;

    /* Backgrounds */
    --body-bg: #ffffff;
    --card-bg: #ffffff;
    --sidebar-bg: #1f2937;
    --content-bg: #f9fafb;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;

    /* Borders */
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Spacing */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================
   RESET & BASE
   ========================================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Roboto", "Helvetica Neue", Arial, sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    overflow-y: auto;
    height: 100%;
    min-height: 100%;
    width: 100%;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Responsive Media */
img,
video,
iframe,
canvas,
svg {
    max-width: 100%;
    height: auto;
    display: block;
    /* Removes bottom space */
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =========================================================
   TYPOGRAPHY
   ========================================================= */
/* =========================================================
   TYPOGRAPHY (Fluid & Responsive)
   ========================================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin: 0;
}

h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h4 {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
}

h5 {
    font-size: 1rem;
}

h6 {
    font-size: 0.875rem;
}

p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1rem;
}

/* =========================================================
   LAYOUT
   ========================================================= */
/* =========================================================
   LAYOUT (Mobile-First)
   ========================================================= */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
    overflow-y: visible;
}

/* Sidebar - Mobile Default (Off-canvas) - ERP only, has own scroll when content exceeds viewport */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    position: fixed;
    top: 0;
    left: 0;
    min-height: 100vh;
    max-height: 100vh;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-100%);
    overflow-y: auto;
}

.sidebar.active {
    transform: translateX(0);
    /* Visible when toggled */
}

/* Content Wrapper - Mobile Default (ERP only) */
.content-wrapper {
    flex: 1;
    width: 100%;
    margin-left: 0;
    padding: 1.5rem 1rem;
    min-height: 100vh;
    background: var(--content-bg);
    padding-bottom: 80px;
    transition: margin-left 0.3s ease;
    overflow: visible;
}

/* Desktop Layout (min-width: 1024px) */
@media (min-width: 1024px) {
    .sidebar {
        position: sticky;
        transform: none;
        width: 280px;
        min-height: 100vh;
        max-height: 100vh;
        box-shadow: none;
        border-right: 1px solid rgba(255, 255, 255, 0.05);
    }

    .content-wrapper {
        padding: 2rem;
        /* No margin-left needed if sidebar is sticky in flex container, 
           BUT if sidebar is fixed, we need margin. 
           Here, app-layout is flex, sidebar is sticky. 
           So they sit side-by-side. No margin needed.*/
        padding-bottom: 2rem;
    }
}

.page-container {
    width: 100%;
    max-width: 1400px;
    /* Limit max width on large screens */
    margin: 0 auto;
    padding: 0;
}

.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.grid-row {
    display: grid;
    gap: 1.5rem;
    width: 100%;
    grid-template-columns: 1fr;
    /* Mobile Default: 1 col */
}

/* Grid Breakpoints */
@media (min-width: 768px) {
    .row-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .row-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .row-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .kpi-row {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Sidebar Logo - Light background for contrast */
.sidebar .sidebar-logo-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0.625rem 0.75rem;
    margin-bottom: 1rem;
    text-decoration: none;
    color: #e5e7eb;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.875rem;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.sidebar .sidebar-logo-img {
    max-width: 100%;
    height: auto;
    max-height: 40px;
    width: auto;
    object-fit: contain;
    object-position: left center;
    display: block;
}

.sidebar .sidebar-logo-link::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: width 0.3s ease;
}

.sidebar .sidebar-logo-link:hover {
    opacity: 1;
    transform: translateX(2px);
    background: #f9fafb;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.sidebar .sidebar-logo-link:hover::before {
    width: 100%;
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-logo-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #ffffff;
    line-height: 1.3;
    background: linear-gradient(135deg, #ffffff 0%, #e5e7eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-logo-sub {
    display: none;
}

.sidebar-user {
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #9ca3af;
    line-height: 1.4;
}

.sidebar-welcome {
    display: block;
    margin-bottom: 0.2rem;
    color: #9ca3af;
}

.sidebar-welcome strong {
    color: #f3f4f6;
    font-weight: 600;
    display: inline;
    word-break: break-word;
}

.sidebar-user .sidebar-welcome+div {
    color: #9ca3af;
    font-size: 0.75rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex: 1;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.nav-section:last-child {
    margin-bottom: 0;
}

.nav-section-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b7280;
    font-weight: 700;
    padding: 0.5rem 0.75rem 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: #d1d5db;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-left: 0.25rem;
}

.sidebar-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    margin-left: 0;
}

.sidebar-link:hover i {
    opacity: 1;
}

.sidebar-link.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    margin-left: 0;
}

.sidebar-link.active i {
    opacity: 1;
    color: #ffffff;
}

.sidebar-project-select {
    margin-top: auto;
    margin-bottom: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-project-select label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-project-select select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
    font-size: 0.875rem;
    transition: var(--transition);
}

.sidebar-project-select select:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-project-select select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.sidebar-footer {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-link {
    color: #9ca3af;
}

.logout-link:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* =========================================================
   PAGE TITLE BAR
   ========================================================= */
.page-title-bar {
    display: flex;
    flex-direction: column;
    /* Mobile Default: Column */
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-light);
}

@media (min-width: 768px) {
    .page-title-bar {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }

    .page-title-bar>div:first-child {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .page-title-bar {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
        gap: 1rem;
    }

    .page-title-bar>div:last-child {
        width: 100%;
    }

    .page-title-bar .btn {
        width: 100%;
        justify-content: center;
    }
}

.page-title-bar>div:first-child {
    flex: 1;
    min-width: 300px;
}

.page-title-bar h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-title-bar h2 i {
    color: var(--primary);
    font-size: 1.5rem;
}

.page-title-bar p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    max-width: 600px;
}

.page-title-bar>div:last-child {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* =========================================================
   CARDS
   ========================================================= */
/* =========================================================
   CARDS
   ========================================================= */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    /* Slightly compact on mobile */
    border: 1px solid var(--border-light);
    transition: var(--transition);
    height: 100%;
    /* Fill height in grid */
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    /* Prevent overflow */
}

@media (min-width: 768px) {
    .card {
        padding: 1.5rem;
    }
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}


/* Empty state cards */
.card-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.card-empty i {
    font-size: 3rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
    opacity: 0.5;
    display: block;
}

.card-empty h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-empty p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.card h3 {
    margin: 0 0 1rem 0;
    font-size: 0.9375rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h3 i {
    color: var(--primary);
    font-size: 1rem;
}

.card-tasks-wide {
    grid-column: 1 / -1;
    min-height: auto;
    height: auto;
    overflow: visible;
}

/* =========================================================
   KPI CARDS
   ========================================================= */
/* =========================================================
   KPI CARDS
   ========================================================= */
.kpi-card {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
}

.kpi-card i {
    font-size: 1.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .kpi-card {
        padding: 1.5rem;
    }

    .kpi-card i {
        width: 64px;
        height: 64px;
        font-size: 2rem;
    }
}

.kpi-card-info {
    flex: 1;
    min-width: 0;
}

.kpi-card-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.kpi-card-info p {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.kpi-complete {
    color: var(--success);
    background: var(--success-bg);
}

.kpi-days {
    color: var(--primary);
    background: var(--primary-bg);
}

.kpi-overdue {
    color: var(--danger);
    background: var(--danger-bg);
}

.kpi-tasks {
    color: #8b5cf6;
    background: #f5f3ff;
}

.kpi-pending {
    color: var(--warning);
    background: var(--warning-bg);
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    /* Increased padding for better touch targets */
    border-radius: var(--radius);
    font-size: 0.9375rem;
    /* Slightly larger font */
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    min-height: 44px;
    /* Minimum touch target */
    line-height: 1.5;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--border-medium);
}

.btn-small {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* =========================================================
   STATUS BADGES
   ========================================================= */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-completed,
.status-success {
    background: var(--success-bg);
    color: #059669;
}

.status-pending,
.status-warning {
    background: var(--warning-bg);
    color: #d97706;
}

.status-in-progress,
.status-info {
    background: var(--info-bg);
    color: #2563eb;
}

.status-not-started,
.status-muted {
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-overdue,
.status-danger {
    background: var(--danger-bg);
    color: #dc2626;
}

/* =========================================================
   TABLES
   ========================================================= */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--card-bg);
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.task-table th,
.task-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.task-table th {
    background: var(--gray-50);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.task-table tbody tr {
    transition: var(--transition);
}

.task-table tbody tr:hover {
    background: var(--gray-50);
}

.task-table tbody tr:last-child td {
    border-bottom: none;
}

/* =========================================================
   FORMS
   ========================================================= */
.form-card {
    max-width: 800px;
    margin: 0 auto;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-group {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group.full-width {
    flex: 0 0 100%;
}

.form-group label {
    font-size: 0.9375rem;
    /* Larger labels */
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: block;
}

/* Helper text */
.form-group small,
.form-group .helper-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    display: block;
}

/* Error messages */
.form-group .error-message {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.form-group .error-message::before {
    content: '⚠';
    font-size: 0.875rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="datetime-local"],
input[type="password"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    /* Increased padding for better touch targets */
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    font-size: 1rem;
    /* Larger font for better readability */
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: var(--transition);
    min-height: 44px;
    /* Minimum touch target size */
    line-height: 1.5;
}

/* Focus states with better visibility */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
    background: var(--card-bg);
}

/* Error states */
input:invalid:not(:focus):not(:placeholder-shown),
select:invalid:not(:focus),
textarea:invalid:not(:focus):not(:placeholder-shown) {
    border-color: var(--danger);
    background: var(--danger-bg);
}

/* Disabled states */
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--gray-100);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

/* =========================================================
   FIELDSETS
   ========================================================= */
fieldset {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--gray-50);
}

fieldset legend {
    padding: 0 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

fieldset legend i {
    margin-right: 0.5rem;
    color: var(--primary);
}

/* =========================================================
   ALERTS
   ========================================================= */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert i {
    font-size: 1rem;
    flex-shrink: 0;
}

.alert-success {
    background: var(--success-bg);
    color: #059669;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: var(--danger-bg);
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--warning-bg);
    color: #d97706;
    border: 1px solid #fde68a;
}

.alert-info {
    background: var(--info-bg);
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* =========================================================
   CLIENT LINK CARD
   ========================================================= */
.card-client-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.card-client-link h3 {
    margin-bottom: 0.5rem;
}

.card-client-link p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.link-box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    background: var(--gray-50);
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.link-box input {
    flex: 1;
    padding: 0.625rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: monospace;
}

.link-box button {
    white-space: nowrap;
    padding: 0.625rem 1rem;
}

#copy-success-msg {
    display: block;
    margin-top: 0.5rem;
    color: var(--success);
    font-size: 0.875rem;
    font-weight: 600;
    min-height: 1.25rem;
}

/* =========================================================
   FILTERS
   ========================================================= */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 160px;
}

.filter-group label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-form.main-filter-form {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

/* =========================================================
   CHARTS
   ========================================================= */
.card-chart {
    justify-content: stretch;
}

.chart-container {
    position: relative;
    height: 300px;
    min-height: 250px;
    width: 100%;
    /* Ensure chart doesn't break layout */
    overflow: visible;
}

@media (max-width: 768px) {
    .chart-container {
        height: 250px;
        min-height: 200px;
    }
}

/* =========================================================
   PROGRESS BARS
   ========================================================= */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar-inner {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* =========================================================
   UTILITY CLASSES
   ========================================================= */
.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-tertiary);
}

.bg-success {
    background: var(--success-bg);
}

.bg-warning {
    background: var(--warning-bg);
}

.bg-danger {
    background: var(--danger-bg);
}

.bg-primary {
    background: var(--primary-bg);
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

/* =========================================================
   RESPONSIVE - MOBILE & TABLET
   =========================================================
   MOVED TO: public/assets/css/erp-responsive.css
   This section has been replaced by the unified responsive system.
   ========================================================= */



/* =========================================================
   LEGACY COMPATIBILITY (Maintain existing class names)
   ========================================================= */
:root {
    --header-bg: var(--gray-900);
    --body-bg: var(--body-bg);
    --card-bg: var(--card-bg);
    --text-dark: var(--text-primary);
    --text-light: var(--text-secondary);
    --border-color: var(--border-light);
    --brand-blue: var(--primary);
    --brand-green: var(--success);
    --brand-red: var(--danger);
    --brand-accent: var(--warning);
    --brand-purple: #8b5cf6;
    --brand-grey: var(--gray-500);
    --input-bg: var(--card-bg);
    --radius: var(--radius-md);
    --shadow: var(--shadow);
    --transition: var(--transition);
}

/* Additional legacy classes for compatibility */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    background: var(--gray-800);
    color: var(--text-inverse);
}

.download-btn:hover {
    background: var(--gray-700);
    box-shadow: var(--shadow);
}

.download-btn.alt {
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.download-btn.alt:hover {
    background: var(--gray-200);
}

/* Task grid for project registration */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.task-category {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 0.875rem;
    background: var(--card-bg);
}

.task-category h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}

.task-item:hover {
    background-color: var(--gray-50);
}

.task-order-controls {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-right: 0.25rem;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.category-order-controls {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-order {
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    background: white;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-order:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

.btn-order:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-order:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--gray-100);
}

/* Queue blocks for dashboard */
.queue-block {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.queue-block:first-of-type {
    border-top: none;
    padding-top: 0;
}

.queue-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.queue-list li {
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--gray-50);
}

.queue-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.tag-danger {
    background: var(--danger-bg);
    color: #dc2626;
}

.tag-warning {
    background: var(--warning-bg);
    color: #d97706;
}

.tag-info {
    background: var(--info-bg);
    color: var(--primary);
}

/* Financial cards */
.profit-summary-container {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--gray-50);
}

.positive {
    color: var(--success);
}

.negative {
    color: var(--danger);
}

/* Urgent tasks container */
.urgent-tasks-container {
    margin-top: 0.5rem;
}

.urgent-tasks-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.urgent-tasks-container li {
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--warning-bg);
}

/* Project details grid */
.project-details-grid {
    display: grid;
    grid-template-columns: minmax(180px, 220px) 1fr;
    column-gap: 2rem;
    row-gap: 1rem;
    margin-top: 1rem;
}

.project-detail-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.project-detail-value {
    color: var(--text-primary);
    font-size: 0.9375rem;
}

/* Loading and error messages */
.loading-message,
.error-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.loading-message i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.error-message i {
    font-size: 2rem;
    color: var(--danger);
    margin-bottom: 1rem;
}

/* Tab bar for dashboard */
.tab-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--gray-50);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--gray-50);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}