:root {
    --primary: #FF5A36;
    --primary-hover: #E04826;
    --teal: #00A896;
    --navy: #1E293B;
    --navy-dark: #0F172A;
    --bg: #FAF7F2;
    --card-bg: #FFFFFF;
    --text-main: #1E293B;
    --text-muted-custom: #475569;
    --border: #EFE9E0;
    --sidebar-width: 250px;
    --topbar-height: 68px;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(0,0,0,.03);
    --shadow-hover: 0 8px 24px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

body { 
    font-family: 'Inter', system-ui, -apple-system, sans-serif; 
    background-color: var(--bg) !important; 
    color: var(--text-main) !important; 
    margin: 0; 
    font-size: 14px;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6, .page-title, .brand-text, .card-header, .stat-value, .font-heading { 
    font-family: 'Outfit', sans-serif; 
    color: var(--navy) !important;
    font-weight: 700;
}

/* Ensure text in bg-dark, bg-primary, bg-gradient headers is ALWAYS crisp pure white (#FFFFFF) */
.bg-dark, .bg-primary, .bg-gradient, .bg-secondary, .bg-danger, .bg-success, .bg-navy {
    color: #FFFFFF !important;
}
.bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark h4, .bg-dark h5, .bg-dark h6,
.bg-primary h1, .bg-primary h2, .bg-primary h3, .bg-primary h4, .bg-primary h5, .bg-primary h6,
.bg-gradient h1, .bg-gradient h2, .bg-gradient h3, .bg-gradient h4, .bg-gradient h5, .bg-gradient h6,
.bg-danger h1, .bg-danger h2, .bg-danger h3, .bg-danger h4, .bg-danger h5, .bg-danger h6 {
    color: #FFFFFF !important;
}

/* High Contrast Text Utility Classes */
.text-dark { color: #0F172A !important; }
.text-muted { color: #475569 !important; }
.text-white { color: #FFFFFF !important; }
.text-secondary { color: #475569 !important; }
.text-primary { color: var(--primary) !important; }
.text-teal { color: var(--teal) !important; }

/* Light backgrounds must ALWAYS have dark high-contrast text */
.bg-light, .bg-white, .card-body, .stat-card {
    color: #1E293B !important;
}

/* High Contrast Links & Hover States */
a { color: var(--primary); text-decoration: none; font-weight: 600; transition: color 0.15s ease; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
a.text-dark { color: #0F172A !important; }
a.text-dark:hover { color: var(--primary) !important; text-decoration: none; }
a.text-white { color: #FFFFFF !important; }

/* Code Blocks & Pre Formatting */
pre {
    background-color: #0F172A !important;
    color: #F8FAFC !important;
    border-radius: 12px;
}
pre code, code {
    color: #38BDF8 !important;
    background-color: transparent !important;
    font-family: 'Fira Code', 'Courier New', monospace;
}

/* Buttons High Contrast Standards */
.btn {
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 14px;
    padding: 9px 18px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(255, 90, 54, 0.25);
}
.btn-primary:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: #FFFFFF !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 90, 54, 0.35);
}
.btn-outline-primary {
    background-color: #FFFFFF !important;
    border: 2px solid var(--primary) !important;
    color: var(--primary) !important;
}
.btn-outline-primary:hover {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #FFFFFF !important;
}

/* High-Contrast Badge Styling */
.badge {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.badge.bg-light {
    background-color: #F1F5F9 !important;
    color: #1E293B !important;
    border: 1px solid #CBD5E1 !important;
}
.badge.bg-success-subtle {
    background-color: #DCFCE7 !important;
    color: #15803D !important;
    border: 1px solid #86EFAC !important;
}
.badge.bg-info-subtle {
    background-color: #E0F2FE !important;
    color: #0369A1 !important;
    border: 1px solid #7DD3FC !important;
}
.badge.bg-warning-subtle {
    background-color: #FEF3C7 !important;
    color: #B45309 !important;
    border: 1px solid #FCD34D !important;
}
.badge.bg-danger-subtle {
    background-color: #FEE2E2 !important;
    color: #B91C1C !important;
    border: 1px solid #FCA5A5 !important;
}
.badge.bg-primary-subtle {
    background-color: #FFEFEA !important;
    color: #FF5A36 !important;
    border: 1px solid #FFD4C8 !important;
}

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }
.app-main { flex: 1; margin-left: var(--sidebar-width); min-width: 0; }
.app-content { padding: 24px 32px; max-width: 1400px; }

/* Sidebar */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-width);
    background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 1000;
}
.sidebar-brand { padding: 20px 20px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.brand-icon { width: 38px; height: 38px; background: var(--primary); color: #fff; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: 0 4px 12px rgba(255,90,54,.3); }
.brand-text { font-weight: 700; font-size: 20px; letter-spacing: -.3px; color: var(--navy) !important; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px;
    color: #475569; font-weight: 600; margin-bottom: 3px; transition: all .15s ease;
}
.nav-item:hover { background: #FAF7F2; color: var(--navy) !important; }
.nav-item.active { background: #FFEFEA; color: var(--primary) !important; font-weight: 700; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }

/* Topbar */
.topbar {
    height: var(--topbar-height); background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 100;
}
.topbar-search { flex: 1; max-width: 480px; position: relative; }
.topbar-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #64748b; font-size: 13px; }
.topbar-search input {
    width: 100%; padding: 9px 14px 9px 38px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg); font-size: 13px; outline: none; transition: border .15s; color: #0F172A !important;
}
.topbar-search input:focus { border-color: var(--primary); background: #fff; }
.search-results {
    position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow); margin-top: 4px; display: none; max-height: 320px; overflow-y: auto; z-index: 200;
}
.search-results.show { display: block; }
.search-result-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9; color: #1E293B !important; }
.search-result-item:hover { background: #f8fafc; color: var(--primary) !important; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-sprint, .topbar-clock { font-size: 13px; color: #475569; }
.notif-badge { position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff; font-size: 10px; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }

/* Cards & Stats */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: 16px 20px; font-weight: 700; color: var(--navy) !important; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); color: #1E293B !important; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; font-size: 16px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1; color: var(--navy) !important; }
.stat-label { font-size: 12px; color: #475569 !important; margin-top: 4px; font-weight: 600; }

/* Page */
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin: 0; color: var(--navy) !important; }

/* Forms */
.form-control, .form-select { border-radius: 10px; border-color: var(--border); font-size: 14px; padding: 10px 14px; color: #0F172A !important; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,90,54,.15); }

/* Table */
.table { font-size: 14px; color: #1E293B !important; }
.table thead th { font-weight: 700; color: #475569 !important; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom-width: 1px; padding: 12px 16px; }
.table td { padding: 14px 16px; vertical-align: middle; color: #1E293B !important; }

/* Responsive */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .app-content { padding: 16px; }
}
