:root {
    --primary: #1a365d;
    --secondary: #2d3748;
    --accent: #e53e3e;
    --success: #38a169;
    --warning: #d69e2e;
    --info: #3182ce;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #718096;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-hover: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: 0.2s ease-in-out;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: var(--info);
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }

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

.sidebar {
    width: 280px;
    background: var(--primary);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    color: white;
    font-size: 20px;
    margin: 0;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    border-left: 3px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: var(--accent);
}

.nav-item i {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
}

.top-header {
    background: var(--card-bg);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 50%;
}

.page-content {
    flex: 1;
    padding: 30px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb separators {
    color: var(--text-secondary);
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.primary { background: var(--primary); }
.stat-icon.warning { background: var(--warning); }
.stat-icon.success { background: var(--success); }
.stat-icon.danger { background: var(--accent); }
.stat-icon.info { background: var(--info); }

.stat-info h3 {
    font-size: 28px;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-secondary);
    margin: 0;
}

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

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

.btn-primary:hover {
    background: #2c5282;
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-danger {
    background: var(--accent);
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #2f855a;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #b7791f;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-info:hover {
    background: #2b6cb0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

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

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.form-control:disabled {
    background: var(--bg);
    cursor: not-allowed;
}

select.form-control, textarea.form-control {
    min-height: 100px;
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

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

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

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.table tr:hover {
    background: var(--bg);
}

.table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-new { background: #e2e8f0; color: #4a5568; }
.badge-pending { background: #faf089; color: #744210; }
.badge-in_progress { background: #90cdf4; color: #2a4365; }
.badge-completed { background: #9ae6b4; color: #22543d; }
.badge-escalated { background: #feb2b2; color: #742a2a; }
.badge-closed { background: #a0aec0; color: #1a202c; }
.badge-scheduled { background: #bee3f8; color: #2c5282; }
.badge-cancelled { background: #e2e8f0; color: #4a5568; }

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.priority-urgent-important { background: #feb2b2; color: #742a2a; }
.priority-urgent-not-important { background: #fbd38d; color: #744210; }
.priority-not-urgent-important { background: #90cdf4; color: #2a4365; }
.priority-not-urgent-not-important { background: #e2e8f0; color: #4a5568; }

.actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 10px;
    border: none;
    background: var(--bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--border);
}

.action-btn.view { color: var(--info); }
.action-btn.edit { color: var(--warning); }
.action-btn.delete { color: var(--accent); }

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    color: var(--text-secondary);
}

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

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.alert {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
}

.alert-danger {
    background: #fed7d7;
    color: #742a2a;
}

.alert-warning {
    background: #fefcbf;
    color: #744210;
}

.alert-info {
    background: #bee3f8;
    color: #2c5282;
}

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

.empty-state i {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.search-box {
    position: relative;
    max-width: 300px;
}

.search-box input {
    padding-left: 40px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-secondary);
}

.priority-matrix {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius);
}

.priority-item {
    padding: 15px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-weight: 500;
}

.priority-item:hover {
    transform: scale(1.02);
}

.priority-item.selected {
    box-shadow: 0 0 0 3px var(--info);
}

.priority-item.urgent-important {
    background: #fc8181;
    color: white;
}

.priority-item.urgent-not-important {
    background: #f6ad55;
    color: white;
}

.priority-item.not-urgent-important {
    background: #63b3ed;
    color: white;
}

.priority-item.not-urgent-not-important {
    background: #a0aec0;
    color: white;
}

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 25px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--info);
    border: 2px solid white;
    box-shadow: var(--shadow);
}

.timeline-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.timeline-content {
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.comments-section {
    margin-top: 20px;
}

.comment {
    display: flex;
    gap: 12px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.comment:last-child {
    border-bottom: none;
}

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

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.comment-author {
    font-weight: 600;
}

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

.comment-text {
    color: var(--text-primary);
}

.footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #2c5282 100%);
}

.login-container {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    color: var(--primary);
    font-size: 24px;
}

.login-logo p {
    color: var(--text-secondary);
    margin-top: 5px;
}

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

.login-form .btn {
    width: 100%;
    padding: 12px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-content {
        padding: 15px;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .table th:nth-child(n+5),
    .table td:nth-child(n+5) {
        display: none;
    }
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

.mt-0 { margin-top: 0; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-0 { margin-bottom: 0; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.text-center { text-align: center; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

.aging-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.aging-indicator.green {
    background: #c6f6d5;
    color: #22543d;
}

.aging-indicator.orange {
    background: #fefcbf;
    color: #744210;
}

.aging-indicator.red {
    background: #fed7d7;
    color: #742a2a;
}

.quick-note {
    background: #e2e8f0;
    padding: 12px 15px;
    border-radius: var(--radius);
    margin-top: 10px;
    font-style: italic;
    border-left: 3px solid var(--primary);
}

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-header {
    background: var(--primary);
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: 600;
}

.calendar-day {
    background: var(--card-bg);
    border: 1px solid var(--border);
    min-height: 100px;
    padding: 5px;
}

.calendar-day.today {
    background: #bee3f8;
}

.calendar-day.other-month {
    background: var(--bg);
    opacity: 0.5;
}

.calendar-event {
    background: var(--info);
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 11px;
    margin-bottom: 3px;
    cursor: pointer;
}

.chart-container {
    position: relative;
    height: 300px;
}