html { max-width: 100vw; overflow-x: hidden; }
/* ==========================================================================
   Fournitures Maroc - Premium Clean Modern Design System
   المنصة الوطنية المتخصصة لصفقات التوريدات بالمغرب
   ========================================================================== */

:root {
    /* Color Palette - Light Theme */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    /* Brand Accents */
    --brand-primary: #0284c7;
    --brand-primary-hover: #0369a1;
    --brand-emerald: #059669;
    --brand-emerald-light: #ecfdf5;
    --brand-amber: #d97706;
    --brand-amber-light: #fffbeb;
    --brand-purple: #7c3aed;
    --brand-purple-light: #f5f3ff;
    --brand-rose: #e11d48;
    --brand-rose-light: #fff1f2;

    /* Shadows & Elevation */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Variables */
body.theme-dark {
    --bg-primary: #0b1120;
    --bg-secondary: #131c31;
    --bg-tertiary: #1e293b;
    --bg-card: #141f36;
    --border-color: #27354f;
    --border-hover: #3b4d6e;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;

    --brand-emerald-light: rgba(5, 150, 105, 0.15);
    --brand-amber-light: rgba(217, 119, 6, 0.15);
    --brand-purple-light: rgba(124, 58, 237, 0.15);
    --brand-rose-light: rgba(225, 29, 72, 0.15);

    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Base & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Isolated Numbers & Quantities: Strict BiDi Isolation to Prevent Arabic Number Inversion */
.num-ltr {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
    font-family: 'Inter', 'Cairo', monospace;
}

bdi, .num-val {
    unicode-bidi: isolate;
    direction: ltr;
    display: inline-block;
}

html[dir="rtl"] .num-ltr {
    unicode-bidi: isolate;
}

/* LTR Support for French and English */
html[dir="ltr"] body {
    text-align: left;
}

html[dir="ltr"] .search-icon {
    left: 1.1rem;
    right: auto;
}

html[dir="ltr"] .search-box input {
    padding: 0.75rem 2.5rem 0.75rem 2.8rem;
}

html[dir="ltr"] .clear-search-btn {
    right: 0.8rem;
    left: auto;
}

html[dir="ltr"] .select-icon {
    left: auto;
    right: 1rem;
}

html[dir="ltr"] .select-wrapper select {
    padding: 0.7rem 1.2rem 0.7rem 2.4rem;
}

html[dir="ltr"] .tenders-table {
    text-align: left;
}

a {
    text-decoration: none;
    color: inherit;
}

button, select, input {
    font-family: inherit;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
.main-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #0284c7, #059669);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
}

.brand-title span {
    color: var(--brand-emerald);
}

.brand-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    display: block;
    letter-spacing: 0.3px;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 2px;
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 0.28rem 0.7rem;
    font-size: 0.76rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-btn.active {
    background-color: var(--bg-secondary);
    color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

.header-badges {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.badge-exclusive {
    background-color: var(--brand-emerald-light);
    color: var(--brand-emerald);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.badge-source {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* Button Component Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.52rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-ghost:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-outline {
    background-color: transparent;
    color: var(--brand-emerald);
    border-color: var(--brand-emerald);
}

.btn-outline:hover {
    background-color: var(--brand-emerald);
    color: white;
}

.btn-pdf {
    color: var(--brand-rose);
    border-color: var(--brand-rose);
}

.btn-pdf:hover {
    background-color: var(--brand-rose);
    color: white;
}

.btn-accent {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #047857, #065f46);
    transform: translateY(-1px);
}

.btn-large {
    padding: 0.8rem 1.4rem;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
}

.btn-icon {
    padding: 0.52rem 0.85rem;
}

/* ==========================================================================
   Top Dashboard Stats (Compact & Clean)
   ========================================================================== */
.top-stats-section {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.stats-container {
    max-width: 1400px;
    margin: 0 auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.1rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.stat-card.clickable {
    cursor: pointer;
    user-select: none;
}

.stat-card.clickable:hover {
    border-color: #e11d48;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.18);
}

.stat-card-today {
    border-color: rgba(225, 29, 72, 0.35);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(225, 29, 72, 0.05) 100%);
}

.stat-value-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.click-hint {
    font-size: 0.72rem;
    background-color: rgba(225, 29, 72, 0.15);
    color: #e11d48;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.icon-blue { background-color: rgba(2, 132, 199, 0.12); color: #0284c7; }
.icon-rose { background-color: rgba(225, 29, 72, 0.12); color: #e11d48; }
.icon-amber { background-color: rgba(217, 119, 6, 0.12); color: #d97706; }
.icon-emerald { background-color: rgba(5, 150, 105, 0.12); color: #059669; }

.stat-value {
    display: block;
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ==========================================================================
   Main Content & Toolbar
   ========================================================================== */
.main-content {
    flex: 1;
    padding: 1.5rem;
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
}

.filter-toolbar {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1.15rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.15rem;
    box-shadow: var(--shadow-sm);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.search-icon {
    position: absolute;
    right: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.search-box input {
    width: 100%;
    padding: 0.7rem 2.8rem 0.7rem 2.5rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--brand-primary);
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.clear-search-btn {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    display: none;
}

.filter-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.select-wrapper {
    position: relative;
}

.select-icon {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.85rem;
}

.select-wrapper select {
    appearance: none;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.65rem 2.2rem 0.65rem 1.1rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
}

.select-wrapper select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Date Picker Wrapper */
.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-icon {
    position: absolute;
    right: 0.85rem;
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.85rem;
}

.date-picker-input {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.65rem 2.1rem 0.65rem 0.85rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.clear-date-btn {
    position: absolute;
    left: 0.4rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
}

.view-toggles {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--bg-tertiary);
}

.view-btn {
    background: none;
    border: none;
    padding: 0.6rem 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn.active {
    background-color: var(--bg-secondary);
    color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

.export-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Category Pills Bar */
.category-pills-bar {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    margin-bottom: 1.25rem;
    scrollbar-width: thin;
}

.category-pills-bar::-webkit-scrollbar { height: 4px; }
.category-pills-bar::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 4px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pill:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.pill.active {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.pill-today {
    border-color: rgba(225, 29, 72, 0.4);
    color: #e11d48;
}

.pill-today.active {
    background: linear-gradient(135deg, #e11d48, #be123c);
}

.pill-bdc {
    border-color: rgba(124, 58, 237, 0.45);
    color: #7c3aed;
}

.pill-bdc:hover {
    background-color: rgba(124, 58, 237, 0.08);
    border-color: #7c3aed;
}

.pill-bdc.active {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
}

.badge-cat-bdc {
    background-color: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    border: 1px solid rgba(124, 58, 237, 0.25);
}

.pill-food {
    border-color: rgba(234, 88, 12, 0.45);
    color: #ea580c;
}

.pill-food:hover {
    background-color: rgba(234, 88, 12, 0.08);
    border-color: #ea580c;
}

.pill-food.active {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    color: white;
}

.badge-cat-food {
    background-color: rgba(234, 88, 12, 0.12);
    color: #ea580c;
    border: 1px solid rgba(234, 88, 12, 0.25);
}

/* Custom Budget Input */
.budget-filter-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.custom-budget-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.custom-budget-icon {
    position: absolute;
    right: 0.85rem;
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.85rem;
}

[dir="ltr"] .custom-budget-icon {
    right: auto;
    left: 0.85rem;
}

#customPriceInput {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.65rem 2.2rem 0.65rem 0.85rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    width: 210px;
    outline: none;
    transition: all var(--transition-fast);
}

[dir="ltr"] #customPriceInput {
    padding: 0.65rem 0.85rem 0.65rem 2.2rem;
}

#customPriceInput:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.clear-budget-btn {
    position: absolute;
    left: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem;
}

[dir="ltr"] .clear-budget-btn {
    left: auto;
    right: 0.5rem;
}

.pill-count {
    background-color: rgba(0, 0, 0, 0.08);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
}

.pill.active .pill-count {
    background-color: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.15rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.highlight-count {
    font-weight: 800;
    color: var(--brand-primary);
    font-size: 1.1rem;
}

.filter-desc-tag {
    background-color: var(--bg-tertiary);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 0.4rem;
}

.last-sync-tag {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pulse-live {
    color: var(--brand-emerald);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* ==========================================================================
   Tender Cards View
   ========================================================================== */
.tenders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.tender-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.tender-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-primary);
}

.tender-card.is-visited {
    border-color: rgba(5, 150, 105, 0.4);
    background-color: rgba(5, 150, 105, 0.02);
}

.card-top { margin-bottom: 0.8rem; }

.card-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}

.badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-category { background-color: var(--brand-emerald-light); color: var(--brand-emerald); }
.badge-cat-fournitures { background-color: #ecfdf5; color: #059669; border: 1px solid rgba(5, 150, 105, 0.25); }
.badge-cat-travaux { background-color: #fff7ed; color: #d97706; border: 1px solid rgba(217, 119, 6, 0.25); }
.badge-cat-services { background-color: #f0f9ff; color: #0284c7; border: 1px solid rgba(2, 132, 199, 0.25); }
.badge-cat-etudes { background-color: #faf5ff; color: #7c3aed; border: 1px solid rgba(124, 58, 237, 0.25); }
.badge-source-tag { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; border-radius: var(--radius-sm); font-size: 0.72rem; font-weight: 700; }
.badge-sub { background-color: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border-color); }
.badge-ref { background-color: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border-color); margin-right: auto; }
.badge-today { background-color: rgba(225, 29, 72, 0.12); color: #e11d48; border: 1px solid rgba(225, 29, 72, 0.3); }
.badge-visited { background-color: rgba(5, 150, 105, 0.12); color: #059669; font-size: 0.7rem; }

.card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.card-title:hover { color: var(--brand-primary); }

/* Card Price Chip */
.card-price-chip {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.price-chip-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.price-chip-val { font-size: 0.92rem; font-weight: 800; color: #0284c7; }

.card-meta-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.meta-row { display: flex; align-items: flex-start; gap: 0.55rem; }
.meta-row i { color: var(--text-muted); margin-top: 0.25rem; font-size: 0.85rem; flex-shrink: 0; }
.meta-row .val { font-weight: 600; }

.card-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.deadline-indicator { display: flex; flex-direction: column; }
.deadline-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.deadline-val { font-size: 0.82rem; font-weight: 700; color: var(--brand-rose); display: flex; align-items: center; gap: 0.35rem; }

/* ==========================================================================
   Table View
   ========================================================================== */
.tenders-table-wrapper {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.tenders-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    font-size: 0.85rem;
}

.tenders-table th {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.85rem 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.tenders-table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.tenders-table tr:hover td { background-color: var(--bg-tertiary); }
.tenders-table .table-ref { font-weight: 700; color: var(--brand-primary); }
.tenders-table .table-price { font-weight: 800; color: var(--brand-primary); white-space: nowrap; }

/* ==========================================================================
   CPS Explainer & Analyzer Section
   ========================================================================== */
.cps-explainer-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: var(--shadow-sm);
}

.explainer-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.explainer-icon {
    width: 48px;
    height: 48px;
    background-color: rgba(2, 132, 199, 0.12);
    border-radius: var(--radius-md);
    color: #0284c7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.explainer-header h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.2rem; }
.explainer-header p { font-size: 0.85rem; color: var(--text-muted); }

.explainer-search-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.explainer-input {
    flex: 1;
    padding: 0.75rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.explainer-input:focus { border-color: var(--brand-primary); }

.explainer-result-card {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.35rem;
    animation: fadeIn 0.3s ease;
}

/* Required Documents Box */
.required-docs-box {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    margin-bottom: 1.25rem;
}

.required-docs-box h4 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.docs-checklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.docs-checklist li {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.docs-checklist li i { color: #059669; margin-top: 0.25rem; flex-shrink: 0; }

/* Direct DCE Download Box */
.direct-download-card {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: white;
    border-radius: var(--radius-md);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md);
}

.dce-info { display: flex; align-items: flex-start; gap: 0.9rem; }
.dce-icon {
    width: 46px;
    height: 46px;
    background-color: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #10b981;
    flex-shrink: 0;
}

.dce-texts h4 { font-size: 1rem; font-weight: 800; margin-bottom: 0.25rem; }
.dce-texts p { font-size: 0.82rem; color: #94a3b8; line-height: 1.5; }
.dce-actions .btn { width: 100%; }

/* Devis Section */
.devis-card-section {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    margin-top: 1rem;
}

.devis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.devis-header h4 { font-size: 0.92rem; font-weight: 700; color: var(--text-primary); }
.devis-badge { font-size: 0.75rem; color: #d97706; font-weight: 700; }

.devis-input-row {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.devis-input {
    flex: 1;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

.devis-history-box {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.devis-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    border: 1px solid var(--border-color);
}

/* Modal Pricing Banner */
.modal-price-banner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.08), rgba(5, 150, 105, 0.08));
    border: 1px solid rgba(2, 132, 199, 0.25);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    margin-bottom: 1.25rem;
}

.price-box { display: flex; flex-direction: column; gap: 0.2rem; }
.price-title { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; }
.price-amount { font-size: 1.3rem; font-weight: 900; color: #0284c7; }
.caution-amount { font-size: 1.1rem; font-weight: 800; color: #059669; }

.modal-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header { padding: 1.15rem 1.4rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-close-btn { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }
.modal-body { padding: 1.4rem; }
.modal-title { font-size: 1.15rem; font-weight: 800; line-height: 1.5; margin-bottom: 1.15rem; color: var(--text-primary); }
.modal-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; background-color: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.15rem; margin-bottom: 1.15rem; }
.meta-item { display: flex; flex-direction: column; gap: 0.2rem; }
.meta-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; display: flex; align-items: center; gap: 0.35rem; }
.meta-value { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }
.highlight-meta .meta-value { color: var(--brand-rose); }

.countdown-banner {
    background-color: var(--brand-amber-light);
    border: 1px solid rgba(217, 119, 6, 0.3);
    color: var(--brand-amber);
    padding: 0.7rem 0.95rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.15rem;
}

.countdown-time { color: #b45309; font-weight: 800; }
.modal-footer { padding: 1.1rem 1.4rem; border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }

/* Pagination & Toasts */
.pagination-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }
.pagination-info { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.pagination-buttons { display: flex; align-items: center; gap: 0.35rem; }
.page-btn { min-width: 36px; height: 36px; padding: 0 0.5rem; display: inline-flex; align-items: center; justify-content: center; background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-primary); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.page-btn.active { background: linear-gradient(135deg, #0284c7, #0369a1); color: white; border-color: transparent; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.toast-container { position: fixed; bottom: 1.5rem; left: 1.5rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background-color: #0f172a; color: white; padding: 0.75rem 1.15rem; border-radius: var(--radius-md); font-size: 0.85rem; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 0.55rem; }

/* Print / PDF Stylesheet Base */
.print-only { display: none; }

.main-footer { background-color: var(--bg-secondary); border-top: 1px solid var(--border-color); padding: 1.5rem; margin-top: auto; text-align: center; font-size: 0.8rem; color: var(--text-muted); }

/* ==========================================================================
   Dedicated CPS & Procurement Explainer Section Styles
   ========================================================================== */
.cps-explainer-section {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-md);
}

.explainer-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.25rem;
}

.explainer-icon {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.15), rgba(5, 150, 105, 0.15));
    border: 1px solid rgba(2, 132, 199, 0.3);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--brand-primary);
    flex-shrink: 0;
}

.explainer-header h3 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.explainer-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Tabs Navigation in Explainer */
.explainer-tabs-nav {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.explainer-tab-btn {
    padding: 0.65rem 1.25rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-normal);
}

.explainer-tab-btn.active {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.explainer-search-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.explainer-input {
    flex: 1;
    padding: 0.85rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-normal);
}

.explainer-input:focus {
    border-color: var(--brand-primary);
}

/* Upload Dropzone */
.drop-zone {
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    background-color: var(--bg-tertiary);
    cursor: pointer;
    transition: var(--transition-normal);
    margin-bottom: 1.5rem;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--brand-primary);
    background-color: rgba(2, 132, 199, 0.05);
}

.drop-icon {
    font-size: 2.75rem;
    color: var(--brand-primary);
    margin-bottom: 0.75rem;
}

.drop-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.drop-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.upload-progress-box {
    margin-top: 1rem;
    display: none;
}

/* Explainer Result Card */
.explainer-result-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Risk & Sensitivity Alerts Banner */
.risk-alert-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.risk-alert-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.15rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.risk-alert-item.highlight-danger {
    background-color: var(--brand-rose-light);
    border-color: rgba(225, 29, 72, 0.3);
}

.risk-alert-item.highlight-success {
    background-color: var(--brand-emerald-light);
    border-color: rgba(5, 150, 105, 0.3);
}

.risk-alert-item.highlight-warning {
    background-color: var(--brand-amber-light);
    border-color: rgba(217, 119, 6, 0.3);
}

/* Compliance Matrix */
.compliance-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.compliance-card {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.compliance-card-title {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compliance-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.compliance-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.84rem;
    line-height: 1.45;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.compliance-status-toggle {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.status-tag {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
}

.status-tag.active-ok {
    background-color: #059669;
    color: white;
    border-color: #059669;
}

/* BPU Interactive Table */
.bpu-container {
    margin-top: 1.5rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.bpu-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.85rem;
    font-size: 0.84rem;
}

.bpu-table th {
    background-color: var(--bg-card);
    padding: 0.65rem 0.85rem;
    text-align: right;
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
}

html[dir="ltr"] .bpu-table th {
    text-align: left;
}

.bpu-table td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-card);
}

.bpu-input-price {
    width: 120px;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 700;
    outline: none;
}

.bpu-total-row {
    background-color: rgba(2, 132, 199, 0.06) !important;
    font-weight: 800;
    font-size: 0.95rem;
}

/* ==========================================================================
   Mobile & Tablet Responsiveness Enhancements
   ========================================================================== */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        padding: 0.75rem 1rem;
    }
    .header-actions {
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .brand-title {
        font-size: 1.25rem;
    }
    .brand-subtitle {
        font-size: 0.72rem;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Filter Toolbar & Controls */
    .filter-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .filter-controls {
        width: 100%;
        flex-direction: column;
        gap: 0.65rem;
    }
    .filter-select, .search-input {
        width: 100%;
        min-width: 0;
    }

    /* Category Pills Bar Touch Scroll */
    .category-pills-bar {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 0.5rem 0.25rem 0.75rem 0.25rem !important;
        gap: 0.5rem !important;
        scrollbar-width: thin;
    }
    .category-pill {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        font-size: 0.82rem !important;
        padding: 0.45rem 0.85rem !important;
    }

    /* Grid & Card Layouts */
    .tenders-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .card-actions {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .card-actions .btn-details {
        flex: 1;
        text-align: center;
        justify-content: center;
    }

    /* Table Horizontal Scroll */
    .tenders-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        margin-bottom: 1.5rem;
    }
    .tenders-table {
        min-width: 650px;
    }

    /* Modal Responsive Layout */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 1rem auto !important;
        padding: 1.15rem !important;
        max-height: 90vh !important;
    }
    .modal-price-banner, .modal-meta-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .explainer-search-row {
        flex-direction: column;
    }
    .compliance-matrix {
        grid-template-columns: 1fr;
    }

    /* Dedicated Tender Page Mobile Rules */
    .tender-page-wrapper {
        padding: 1rem 0.75rem 3rem 0.75rem !important;
    }
    .tender-hero-card {
        padding: 1.25rem !important;
    }
    .tender-main-title {
        font-size: 1.25rem !important;
        line-height: 1.35 !important;
    }
    .metrics-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    .tender-actions-banner {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 1.25rem !important;
    }
    .actions-banner-btns {
        flex-direction: column !important;
        width: 100% !important;
    }
    .actions-banner-btns .btn,
    .actions-banner-btns a {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }
    .bpu-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 0.85rem !important;
    }
    .bpu-table {
        min-width: 580px !important;
    }
    .bpu-action-footer {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .bpu-action-footer .btn,
    .bpu-action-footer a {
        width: 100% !important;
        justify-content: center !important;
    }
}

@media (max-width: 480px) {
    .metrics-cards-grid {
        grid-template-columns: 1fr !important;
    }
    .metric-card-value {
        font-size: 1.2rem !important;
    }
    .tender-main-title {
        font-size: 1.15rem !important;
    }
    .sort-btn-group {
        width: 100%;
        justify-content: flex-start;
    }
    .btn-sort-pill {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
    }
}

/* Developer Credit Tag */
.developer-credit-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 800;
    color: #0284c7;
    background: rgba(2, 132, 199, 0.09);
    border: 1px solid rgba(2, 132, 199, 0.22);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    margin-top: 0.35rem;
    width: fit-content;
}

/* Saved Offers Button in Header */
.btn-saved-offers {
    background: rgba(217, 119, 6, 0.12) !important;
    color: #d97706 !important;
    border: 1px solid rgba(217, 119, 6, 0.3) !important;
    font-weight: 800 !important;
    border-radius: var(--radius-md) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.btn-saved-offers:hover {
    background: #d97706 !important;
    color: #ffffff !important;
}

.badge-count {
    background: #d97706;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.btn-saved-offers:hover .badge-count {
    background: #ffffff;
    color: #d97706;
}

/* Saved Offers Hub Section */
.saved-offers-section {
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease;
}

.saved-offers-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
}

.saved-offers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.saved-offers-title-box {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.saved-offers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.86rem;
}

.saved-offers-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 800;
    padding: 0.75rem 0.95rem;
    text-align: inherit;
    border: 1px solid var(--border-color);
}

.saved-offers-table td {
    padding: 0.75rem 0.95rem;
    border: 1px solid var(--border-color);
    vertical-align: middle;
    background: var(--bg-card);
}

.saved-offers-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* Quick Sorting Toolbar */
.sort-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-card);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-top: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.sort-toolbar-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-sort-pill {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-sort-pill:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
    background: var(--bg-card);
}

.btn-sort-pill.active {
    background: var(--brand-blue);
    color: #ffffff;
    border-color: var(--brand-blue);
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

/* Contractual Clauses Strict RTL Alignment */
.contractual-clause-card {
    background: var(--bg-card);
    padding: 0.95rem;
    border-radius: var(--radius-sm);
    line-height: 1.6;
}

[dir="rtl"] .contractual-clause-card,
body:not([dir="ltr"]) .contractual-clause-card {
    text-align: right !important;
    direction: rtl !important;
}

[dir="ltr"] .contractual-clause-card {
    text-align: left !important;
    direction: ltr !important;
}

/* BPU Bottom Action Footer */
.bpu-action-footer {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.btn-official-portal {
    background: #059669 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: var(--radius-md) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25) !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-official-portal:hover {
    background: #047857 !important;
    transform: translateY(-1px);
}

/* Professional Print Stylesheet for Clean Output */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 8mm 10mm 8mm;
    }

    /* Hide web-only UI chrome */
    header.main-header,
    .top-stats-section,
    .search-section,
    .filter-section,
    .category-pills-bar,
    .sort-toolbar,
    .results-header,
    .tenders-grid,
    .tenders-table-wrapper,
    .pagination-bar,
    .empty-state,
    .modal-overlay,
    .toast-container,
    .main-footer,
    .btn,
    .saved-offers-section,
    .tender-nav-bar,
    .tender-top-actions,
    .tender-actions-banner,
    .bpu-action-footer,
    .lang-switcher,
    .theme-toggle-btn,
    .last-sync-tag {
        display: none !important;
        visibility: hidden !important;
    }

    body {
        background: #ffffff !important;
        color: #0f172a !important;
        font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Print Template Container */
    .print-only {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-header {
        border-bottom: 2px solid #0f172a !important;
        padding-bottom: 10px !important;
        margin-bottom: 14px !important;
    }

    .print-header-top {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 4px !important;
    }

    .print-header h2 {
        font-size: 14pt !important;
        font-weight: 900 !important;
        color: #0f172a !important;
        margin: 0 !important;
    }

    .print-developer-credit {
        font-size: 9.5pt !important;
        font-weight: 800 !important;
        color: #0284c7 !important;
        margin: 3px 0 !important;
    }

    .print-header p {
        font-size: 9.5pt !important;
        color: #475569 !important;
        margin: 3px 0 !important;
    }

    .print-table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 8.5pt !important;
    }

    .print-table th {
        background-color: #f1f5f9 !important;
        color: #0f172a !important;
        font-weight: 800 !important;
        border: 1px solid #cbd5e1 !important;
        padding: 6px 8px !important;
        text-align: inherit !important;
    }

    .print-table td {
        border: 1px solid #cbd5e1 !important;
        padding: 5px 7px !important;
        line-height: 1.4 !important;
        color: #0f172a !important;
    }

    .print-table tr {
        page-break-inside: avoid !important;
    }

    .print-table tbody tr:nth-child(even) {
        background-color: #f8fafc !important;
    }

    .print-footer {
        margin-top: 15px !important;
        border-top: 1px solid #cbd5e1 !important;
        padding-top: 8px !important;
        display: flex !important;
        justify-content: space-between !important;
        font-size: 8pt !important;
        color: #64748b !important;
    }

    /* Specific Print Mode Routing */
    body.printing-offer #printTemplate {
        display: none !important;
    }
    body.printing-offer #offerPrintTemplate {
        display: block !important;
        visibility: visible !important;
    }
    body.printing-list #offerPrintTemplate {
        display: none !important;
    }
    body.printing-list #printTemplate {
        display: block !important;
        visibility: visible !important;
    }

    /* Dedicated Tender Page Print Rules */
    .tender-page-wrapper {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .tender-hero-card,
    .tender-section-card,
    .bpu-container {
        border: 1px solid #94a3b8 !important;
        box-shadow: none !important;
        page-break-inside: avoid !important;
        margin-bottom: 1.5rem !important;
        padding: 1.25rem !important;
        background: #ffffff !important;
    }

    .metrics-cards-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.75rem !important;
        margin-bottom: 1.5rem !important;
    }

    .metric-card {
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        padding: 0.75rem !important;
        background: #f8fafc !important;
    }

    .bpu-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .bpu-table th, .bpu-table td {
        border: 1px solid #cbd5e1 !important;
        padding: 6px 8px !important;
        color: #0f172a !important;
    }

    .bpu-table th {
        background-color: #f1f5f9 !important;
    }

    .bpu-price-input {
        display: none !important;
    }

    .bpu-price-print-val {
        display: inline-block !important;
        font-weight: 800 !important;
        color: #0f172a !important;
    }
}

/* ----------------------------------------------------
   Certified Financial Audit Matrix & Verification Styles
   ---------------------------------------------------- */
.audit-matrix-banner {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.audit-matrix-banner:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-2px);
}

.badge-accord-cadre {
    background: rgba(124, 58, 237, 0.12) !important;
    color: #7c3aed !important;
    border: 1px solid rgba(124, 58, 237, 0.35) !important;
    font-weight: 800;
}

.btn-verify-card {
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
}

.btn-verify-card:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.btn-verify-portal-card {
    transition: all 0.2s ease;
}

.btn-verify-portal-card:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}





/* ==========================================================================
   Paint & Coating Pill (صفقات الطلاء والصباغة)
   ========================================================================== */
.pill-paint {
    border-color: rgba(14, 165, 233, 0.45);
    color: #0284c7;
}

.pill-paint:hover {
    background-color: rgba(14, 165, 233, 0.08);
    border-color: #0284c7;
}

.pill-paint.active {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
    border-color: transparent;
}

/* ==========================================================================
   Procurement Results & Attribution Hub (Résultats des Marchés & PV)
   ========================================================================== */
.btn-results {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.25);
    font-weight: 700;
}

.btn-results:hover {
    background: rgba(37, 99, 235, 0.18);
    border-color: #2563eb;
    transform: translateY(-1px);
}

.results-section {
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease;
}

.results-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.results-title-box {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.results-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.results-stats-mini {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 800;
}

.stat-badge-winner {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.stat-badge-opened {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.stat-badge-rejected {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.results-search-wrap {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.results-search-wrap .search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

[dir="rtl"] .results-search-wrap .search-icon {
    right: 1rem;
}

[dir="ltr"] .results-search-wrap .search-icon {
    left: 1rem;
}

.results-search-wrap input {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

[dir="rtl"] .results-search-wrap input {
    padding-right: 2.5rem;
}

[dir="ltr"] .results-search-wrap input {
    padding-left: 2.5rem;
}

.results-search-wrap input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.results-filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.results-pill {
    padding: 0.45rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.results-pill:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.results-pill.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.results-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-top: 1rem;
}

.result-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.result-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: rgba(37, 99, 235, 0.3);
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.result-ref-badge {
    font-weight: 900;
    font-family: monospace;
    font-size: 0.95rem;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.result-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.35rem 0 0.5rem 0;
    line-height: 1.4;
}

.result-meta-bar {
    display: flex;
    gap: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.winner-banner {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.winner-info {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.winner-icon {
    font-size: 1.75rem;
    color: #d97706;
}

.winner-name {
    font-size: 1rem;
    font-weight: 900;
    color: #92400e;
    margin: 0;
}

.winner-sub {
    font-size: 0.8rem;
    color: #b45309;
    margin: 0.15rem 0 0 0;
}

.winner-amount-box {
    text-align: right;
}

[dir="rtl"] .winner-amount-box {
    text-align: left;
}

.winner-amount-val {
    font-size: 1.25rem;
    font-weight: 900;
    color: #047857;
}

.winner-rabais-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 800;
    background: #d1fae5;
    color: #065f46;
    margin-top: 0.25rem;
}

.bidders-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.85rem;
}

@media (max-width: 900px) {
    .bidders-grid {
        grid-template-columns: 1fr;
    }
}

.admitted-box, .excluded-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem;
}

.admitted-header {
    color: #047857;
    font-weight: 800;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.excluded-header {
    color: #b91c1c;
    font-weight: 800;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.bidder-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.82rem;
}

.bidder-row:last-child {
    border-bottom: none;
}

.bidder-name {
    font-weight: 700;
    color: var(--text-primary);
}

.bidder-val {
    font-weight: 800;
    font-family: monospace;
    color: #047857;
}

.excluded-item {
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.82rem;
}

.excluded-item:last-child {
    border-bottom: none;
}

.excluded-name {
    font-weight: 800;
    color: #991b1b;
}

.excluded-stage {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    background: #fee2e2;
    color: #991b1b;
    margin: 0.2rem 0;
}

.excluded-motif {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0.2rem 0 0 0;
}

.pv-summary-note {
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}


/* ==========================================================================
   Top Master Categories Portal (بوابة وتصنيفات الأقسام الرئيسية في أعلى الموقع)
   ========================================================================== */
.top-categories-hub {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border-bottom: 2px solid var(--border-color);
    padding: 1.75rem 0 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.hub-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 2rem;
}

.hub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.hub-title-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hub-main-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.28);
}

.hub-title {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.3px;
}

.hub-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0 0;
}

.hub-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.95rem;
    border-radius: 9999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 800;
}

.hub-categories-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

@media (max-width: 1200px) {
    .hub-categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .hub-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .hub-container {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .hub-categories-grid {
        grid-template-columns: 1fr;
    }
}

/* Individual Category Hub Card */
.hub-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: inherit;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    border-color: #2563eb;
}

.hub-card.active {
    border-color: #2563eb;
    background: var(--bg-card);
    box-shadow: 0 0 0 2px #2563eb, 0 8px 20px rgba(37, 99, 235, 0.12);
}

.hub-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    transition: transform 0.2s ease;
}

.hub-card:hover .hub-card-icon {
    transform: scale(1.1);
}

/* Department Icon Color Themes */
.hub-card-sabio { border: 2px solid #8b5cf6 !important; background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(245, 158, 11, 0.05)); }
.hub-card-sabio .hub-card-icon { background: #ede9fe; color: #7c3aed; }
.hub-card-sabio.active { border-color: #7c3aed !important; background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(245, 158, 11, 0.14)) !important; box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25) !important; }
.pill-sabio { border-color: #8b5cf6 !important; color: #7c3aed !important; }
.pill-sabio.active { background: #7c3aed !important; color: #fff !important; }
.hub-card-sports .hub-card-icon { background: #dcfce7; color: #16a34a; }
.hub-card-paint .hub-card-icon { background: #e0f2fe; color: #0284c7; }
.hub-card-food .hub-card-icon { background: #ffedd5; color: #ea580c; }
.hub-card-supplies .hub-card-icon { background: #eff6ff; color: #2563eb; }
.hub-card-it .hub-card-icon { background: #f3e8ff; color: #7c3aed; }
.hub-card-services .hub-card-icon { background: #ccfbf1; color: #0d9488; }
.hub-card-bdc .hub-card-icon { background: #f1f5f9; color: #475569; }
.hub-card-results .hub-card-icon { background: #fef3c7; color: #d97706; }
.hub-card-today .hub-card-icon { background: #ffe4e6; color: #e11d48; }
.hub-card-all .hub-card-icon { background: #f8fafc; color: #334155; border: 1px solid var(--border-color); }

.hub-card-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    display: block;
    line-height: 1.3;
}

.hub-card-desc {
    font-size: 0.73rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.35rem;
    line-height: 1.4;
    min-height: 2rem;
}

.hub-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border-color);
}

.hub-card-count {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--text-primary);
}

.hub-card-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.hub-badge-green { background: #dcfce7; color: #15803d; }
.hub-badge-gold { background: #fef3c7; color: #b45309; }
.hub-badge-orange { background: #ffedd5; color: #c2410c; }
.hub-badge-purple { background: #f3e8ff; color: #6b21a8; }
.hub-badge-teal { background: #ccfbf1; color: #0f766e; }
.hub-badge-blue { background: #dbeafe; color: #1d4ed8; }
.hub-badge-rose { background: #ffe4e6; color: #be123c; }

/* Pill Sports styling */
.pill-sports {
    border-color: rgba(22, 163, 74, 0.45);
    color: #16a34a;
}

.pill-sports:hover {
    background-color: rgba(22, 163, 74, 0.08);
    border-color: #16a34a;
}

.pill-sports.active {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #ffffff;
    border-color: transparent;
}


/* Free Caution Styling (Plan 2: الصفقات المعفاة من الضمان 0 درهم) */
.hub-card-free-caution {
    border: 2px solid #10b981 !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(5, 150, 105, 0.06)) !important;
}

.hub-card-free-caution .hub-card-icon {
    background: #d1fae5;
    color: #059669;
}

.hub-card-free-caution.active {
    border-color: #059669 !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(5, 150, 105, 0.16)) !important;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.25) !important;
}

.hub-badge-emerald {
    background: #d1fae5;
    color: #047857;
}

.pill-free-caution {
    border-color: rgba(16, 185, 129, 0.5) !important;
    color: #059669 !important;
}

.pill-free-caution:hover {
    background-color: rgba(16, 185, 129, 0.09) !important;
    border-color: #059669 !important;
}

.pill-free-caution.active {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

.badge-free-caution {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    color: #ffffff !important;
    border: 1px solid #047857 !important;
    font-weight: 800 !important;
    padding: 0.2rem 0.6rem !important;
    border-radius: 9999px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    font-size: 0.72rem !important;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2) !important;
}


/* ==========================================================================
   MOBILE-FIRST UX/CX TRANSFORMATION & RESPONSIVE SUITE (Version 7)
   ========================================================================== */

/* 1. Mobile Touch Targets standard (Apple HIG & Google Material >= 44px) */
@media (max-width: 768px) {
    .btn, 
    .lang-btn,
    .view-btn,
    .pill,
    .select-wrapper select,
    .search-box input,
    .custom-budget-wrapper input,
    .date-input-wrapper input {
        min-height: 44px !important;
        font-size: 0.88rem !important;
    }

    .lang-switcher {
        gap: 0.35rem !important;
    }

    .lang-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.82rem !important;
    }

    #themeToggle {
        width: 44px !important;
        height: 44px !important;
    }

    /* Top Stats in 2x2 grid strictly contained without horizontal overflow */
    .top-stats-section {
        padding: 0.75rem 0.65rem !important;
        overflow: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    .stats-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    
    .stat-card {
        padding: 0.65rem 0.55rem !important;
        gap: 0.45rem !important;
        min-width: 0 !important;
        width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    .stat-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 1.05rem !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
    }

    .stat-info {
        min-width: 0 !important;
        flex: 1 !important;
        overflow: hidden !important;
    }
    
    .stat-value-row {
        gap: 0.25rem !important;
        flex-wrap: wrap !important;
    }

    .stat-value {
        font-size: 1.15rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.15 !important;
    }

    .stat-label {
        font-size: 0.72rem !important;
        line-height: 1.25 !important;
        white-space: normal !important;
        word-break: break-word !important;
    }

    /* Safe bottom padding for body so fixed bottom nav never overlaps content */
    body {
        padding-bottom: 78px !important;
    }
}

/* 2. Top Categories Hub: Horizontal Swipeable Carousel on Mobile */
@media (max-width: 768px) {
    .top-categories-hub {
        padding: 1rem 0 !important;
    }

    .hub-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        margin-bottom: 0.85rem !important;
        padding: 0 1rem !important;
    }

    .hub-title {
        font-size: 1.15rem !important;
    }

    .hub-subtitle {
        font-size: 0.78rem !important;
    }

    .hub-categories-grid {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 0.85rem !important;
        padding: 0.4rem 1rem 1rem 1rem !important;
        scrollbar-width: none !important;
    }

    .hub-categories-grid::-webkit-scrollbar {
        display: none !important;
    }

    .hub-card {
        flex: 0 0 260px !important;
        width: 260px !important;
        min-height: 145px !important;
        scroll-snap-align: start !important;
        padding: 0.85rem 1rem !important;
        border-radius: var(--radius-lg) !important;
    }

    .hub-card-name {
        font-size: 0.9rem !important;
    }

    .hub-card-desc {
        min-height: auto !important;
        font-size: 0.72rem !important;
        margin-top: 0.25rem !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .hub-card-footer {
        margin-top: 0.5rem !important;
        padding-top: 0.5rem !important;
    }
}

/* 3. Filter Toolbar & Mobile Trigger Button */
.btn-filter-mobile {
    display: none;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.95rem;
    background: var(--brand-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
    transition: transform var(--transition-fast);
}

.btn-filter-mobile:active {
    transform: scale(0.96);
}

.filter-active-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    background: #e11d48;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .btn-filter-mobile {
        display: inline-flex !important;
    }

    .search-box {
        display: flex !important;
        gap: 0.5rem !important;
        align-items: center !important;
    }

    /* Hide desktop multi-select clutter on mobile - accessible via the mobile drawer */
    .filter-toolbar .filter-controls {
        display: none !important;
    }

    .filter-toolbar {
        padding: 0.75rem !important;
        margin-bottom: 0.85rem !important;
    }
}

/* 4. Mobile Filter Drawer / Bottom Sheet */
.mobile-filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-filter-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mobile-filter-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
    z-index: 1250;
    display: flex;
    flex-direction: column;
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 1px solid var(--border-color);
}

.mobile-filter-drawer.open {
    transform: translateY(0);
}

.drawer-header {
    padding: 0.75rem 1.25rem 0.5rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    flex-shrink: 0;
}

.drawer-drag-handle {
    width: 44px;
    height: 4px;
    background: var(--border-color);
    border-radius: 9999px;
    margin: 0 auto 0.65rem auto;
}

.drawer-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-title-row h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-close-drawer {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    position: relative;
    z-index: 30;
    pointer-events: auto;
}

.drawer-body {
    padding: 1.25rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    flex: 1;
}

.drawer-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.drawer-field-group label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.drawer-select,
.drawer-input {
    width: 100%;
    min-height: 46px;
    padding: 0.65rem 0.85rem;
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.drawer-select:focus,
.drawer-input:focus {
    border-color: var(--brand-primary);
}

.drawer-export-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.drawer-export-row button {
    flex: 1;
    min-height: 44px;
    font-size: 0.82rem;
    font-weight: 700;
}

.drawer-footer {
    padding: 0.85rem 1.25rem;
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom, 16px));
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.drawer-footer button {
    flex: 1;
    min-height: 46px;
    font-weight: 800;
}

/* 5. Mobile Fixed Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    align-items: center;
    justify-content: space-around;
    padding: 0 0.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
    }
}

.mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.35rem 0;
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.mobile-nav-btn i {
    font-size: 1.15rem;
    transition: transform var(--transition-fast);
}

.mobile-nav-btn.active {
    color: var(--brand-primary);
}

.mobile-nav-btn.active i {
    transform: translateY(-2px);
}

.nav-badge-dot {
    position: absolute;
    top: 3px;
    left: 50%;
    margin-left: 6px;
    width: 8px;
    height: 8px;
    background: #e11d48;
    border-radius: 50%;
}

.mobile-nav-counter {
    position: absolute;
    top: 2px;
    left: 50%;
    margin-left: 6px;
    background: #0284c7;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.1rem 0.3rem;
    border-radius: 9999px;
    min-width: 14px;
    text-align: center;
}

/* 6. Floating Scroll-to-Top Button */
.scroll-to-top-btn {
    position: fixed;
    bottom: 76px;
    left: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    z-index: 1050 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.25s ease;
}

[dir="rtl"] .scroll-to-top-btn {
    left: 16px;
    right: auto;
}

[dir="ltr"] .scroll-to-top-btn {
    right: 16px;
    left: auto;
}

.scroll-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top-btn:active {
    transform: scale(0.92);
}

/* 7. Category Pills Bar Mobile Enhancements with Scroll Hint */
.category-pills-bar {
    position: relative;
}

@media (max-width: 768px) {
    .category-pills-bar {
        padding: 0.4rem 0.5rem 0.75rem 0.5rem !important;
        margin-bottom: 0.85rem !important;
    }
    .pill {
        flex-shrink: 0 !important;
        font-size: 0.78rem !important;
        padding: 0.4rem 0.8rem !important;
    }
}

/* 8. Tender Detail Page Mobile Sticky BPU Calculation Bar */
@media (max-width: 768px) {
    .bpu-totals-summary-bar {
        position: sticky !important;
        bottom: 0 !important;
        z-index: 900 !important;
        background: var(--bg-card) !important;
        border: 1.5px solid var(--border-color) !important;
        border-bottom: none !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.15) !important;
        padding: 0.85rem 1rem !important;
        margin: 0 -1rem !important;
    }

    .tender-actions-banner {
        padding: 1.15rem !important;
    }

    .actions-banner-btns {
        flex-direction: column !important;
        gap: 0.65rem !important;
    }

    .actions-banner-btns a,
    .actions-banner-btns button {
        width: 100% !important;
        justify-content: center !important;
    }
}

.btn-close-drawer i,
.btn-filter-mobile i,
.scroll-to-top-btn i,
.mobile-nav-btn i {
    pointer-events: none;
}


/* =========================================================================
   COMPREHENSIVE MOBILE POLISH (FLAWLESS 390PX VIEWPORT COMPLIANCE)
   ========================================================================= */
@media (max-width: 768px) {
    /* Main Content container constraints */
    .main-content {
        padding: 0.85rem 0.5rem !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .content-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Streamline Tender Card for Mobile */
    .tender-card {
        padding: 0.9rem !important;
        border-radius: 14px !important;
    }

    .card-badges {
        gap: 0.35rem !important;
        margin-bottom: 0.45rem !important;
        flex-wrap: wrap !important;
    }

    /* Hide long redundant subcategory badge on mobile cards to reduce clutter */
    .badge-tag.badge-sub {
        display: none !important;
    }

    .badge-tag, .badge-ref {
        font-size: 0.72rem !important;
        padding: 0.18rem 0.45rem !important;
        border-radius: 6px !important;
    }

    .card-title {
        font-size: 0.98rem !important;
        line-height: 1.45 !important;
        margin-bottom: 0.55rem !important;
    }

    .card-price-chip {
        padding: 0.4rem 0.65rem !important;
        margin-bottom: 0.55rem !important;
        font-size: 0.85rem !important;
    }

    .card-meta-list {
        gap: 0.35rem !important;
        margin-bottom: 0.6rem !important;
    }

    .card-meta-list .meta-row {
        font-size: 0.78rem !important;
    }

    .card-footer {
        flex-wrap: wrap !important;
        gap: 0.6rem !important;
        padding-top: 0.6rem !important;
    }

    .card-actions {
        width: 100% !important;
        display: flex !important;
        gap: 0.35rem !important;
    }

    .card-actions .btn-details {
        flex: 1 !important;
        text-align: center !important;
        font-size: 0.85rem !important;
        padding: 0.55rem 0.85rem !important;
    }

    /* Hub Badges & Text Legibility */
    .hub-card-badge {
        font-size: 0.75rem !important;
        padding: 0.2rem 0.55rem !important;
    }

    .hub-card-desc {
        font-size: 0.78rem !important;
        line-height: 1.35 !important;
    }

    .hub-card-count {
        font-size: 0.82rem !important;
    }

    /* Sleek Slim Sticky BPU Summary Bar on tender.html (58px height vs 233px) */
    .bpu-totals-summary-bar {
        position: sticky !important;
        bottom: 0 !important;
        z-index: 900 !important;
        background: var(--bg-card) !important;
        border: 1.5px solid var(--border-color) !important;
        border-bottom: none !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12) !important;
        padding: 0.55rem 0.85rem !important;
        margin: 0 -0.85rem !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
        min-height: 58px !important;
        max-height: 68px !important;
    }

    .totals-metrics-group {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.6rem !important;
        flex: 1 !important;
        min-width: 0 !important;
    }

    /* On mobile, only show TTC prominently to keep bar slim */
    .total-metric-col:not(.col-ttc) {
        display: none !important;
    }

    .total-metric-col.col-ttc {
        display: flex !important;
        flex-direction: column !important;
    }

    .total-metric-label {
        font-size: 0.68rem !important;
        margin-bottom: 0.05rem !important;
    }

    .total-metric-val.ttc {
        font-size: 1.15rem !important;
        font-weight: 900 !important;
        color: #0284c7 !important;
    }

    .bpu-diff-container {
        font-size: 0.75rem !important;
        text-align: end !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
    }

    #lblDiffCeiling {
        display: none !important;
    }

    #valDiffCeiling {
        font-size: 0.82rem !important;
        font-weight: 800 !important;
    }

    /* Table Horizontal Scroll Hint on Mobile */
    .mobile-table-scroll-hint {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        padding: 0.45rem 0.75rem;
        background: rgba(2, 132, 199, 0.08);
        color: #0284c7;
        font-size: 0.78rem;
        font-weight: 700;
        border-radius: 8px;
        margin-bottom: 0.6rem;
        border: 1px dashed rgba(2, 132, 199, 0.3);
    }
}


/* =========================================================================
   ALL CITIES & REGIONS QUICK BAR (PROMINENT MOROCCAN GEOGRAPHY)
   ========================================================================= */
.city-quick-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border-color);
}

.city-select-wrapper-direct {
    position: relative;
    flex: 0 0 240px;
    min-width: 190px;
}

.city-direct-icon {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #0284c7;
    font-size: 0.95rem;
    pointer-events: none;
}

[dir="ltr"] .city-direct-icon {
    right: auto;
    left: 0.85rem;
}

.city-direct-select {
    width: 100%;
    height: 42px;
    padding: 0 2.2rem 0 0.85rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

[dir="ltr"] .city-direct-select {
    padding: 0 0.85rem 0 2.2rem;
}

.city-direct-select:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.city-pills-scroll {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
    padding: 0.2rem 0;
}

.city-pills-scroll::-webkit-scrollbar {
    display: none;
}

.city-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.city-pill-btn:hover {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
    border-color: rgba(2, 132, 199, 0.3);
}

.city-pill-btn.active {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.city-pill-count {
    font-size: 0.7rem;
    opacity: 0.85;
    background: rgba(0, 0, 0, 0.08);
    padding: 0.05rem 0.35rem;
    border-radius: 9999px;
}

.city-pill-btn.active .city-pill-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

@media (max-width: 768px) {
    .city-quick-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.45rem !important;
        margin-top: 0.5rem !important;
        padding-top: 0.5rem !important;
    }

    .city-select-wrapper-direct {
        flex: 1 1 auto !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .city-direct-select {
        height: 44px !important;
        font-size: 0.88rem !important;
    }

    .city-pills-scroll {
        width: 100% !important;
        padding-bottom: 0.25rem !important;
    }
}


/* ==========================================================================
   PACKAGE 1: MOBILE UX, TOUCH TARGETS & HIGH CONTRAST (Points 36-50)
   ========================================================================== */

/* 1. Prevent iOS Auto-Zoom Bug (Point #37): Form inputs must be >= 16px */
@media (max-width: 768px) {
    input, select, textarea, .bpu-price-input, .city-direct-select, #searchInput {
        font-size: 16px !important;
    }

    /* 2. Touch Target Boundaries >= 48px (Point #36) */
    .btn, button, .city-pill-btn, .category-pill, .nav-btn, .filter-select, .bpu-price-input {
        min-height: 48px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        touch-action: manipulation;
    }

    .city-direct-select {
        height: 48px !important;
        min-height: 48px !important;
    }

    /* 3. Sticky Column for BPU Table in Mobile View (Point #38) */
    .bpu-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    .bpu-page-table th:first-child,
    .bpu-page-table td:first-child {
        position: sticky !important;
        right: 0 !important;
        background: var(--bg-card) !important;
        z-index: 5 !important;
        box-shadow: -3px 0 6px rgba(0, 0, 0, 0.08) !important;
    }

    /* 4. Scroll-snap indicator for city pills (Point #46) */
    .city-pills-scroll {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    .city-pill-btn {
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    /* 5. Prevent Background Scroll Chaining when Modal is Open (Point #41) */
    body.modal-open {
        overflow: hidden !important;
        height: 100vh !important;
    }
}

/* 6. Sunlight Contrast Enhancements - WCAG AA/AAA (Point #43) */
body.theme-light {
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #475569;
}

/* 7. Shimmer Skeleton Loading Indicator (Point #45) */
.shimmer-loading {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, rgba(2, 132, 199, 0.08) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 8. WhatsApp Alerts Banner & Modal Styling (Point #87) */
.whatsapp-alert-pill {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    padding: 0.6rem 1.25rem;
    border-radius: 9999px;
    font-weight: 800;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}
.whatsapp-alert-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}
