/* ============================================================
   Raiq Platform - Main Stylesheet
   Premium SaaS Design with Dark/Light Mode
   ============================================================ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --accent-2: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 50px -12px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-accent: linear-gradient(135deg, #06b6d4, #6366f1);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
}

[dir="rtl"] { text-align: right; }
[dir="rtl"] .nav-links { flex-direction: row-reverse; }
[dir="rtl"] select.form-control { background-position: left 12px center; padding-left: 36px; padding-right: 16px; }
[dir="rtl"] .alert { right: auto; left: 20px; }
[dir="rtl"] .sidebar { right: 0; left: auto; border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .dashboard-main { margin-left: 0; margin-right: 260px; }
[dir="rtl"] .timeline { padding-left: 0; padding-right: 32px; }
[dir="rtl"] .timeline::before { left: auto; right: 11px; }
[dir="rtl"] .timeline-item::before { left: auto; right: -25px; }
[dir="rtl"] .chat-message.own { margin-left: 0; margin-right: auto; }
[dir="rtl"] .project-item:hover { transform: translateX(4px); }
[dir="rtl"] .pricing-features { text-align: right; }
[dir="rtl"] .faq-question { text-align: right; }

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border: none; border-radius: var(--radius-sm);
    font-size: 0.9375rem; font-weight: 600; cursor: pointer;
    transition: var(--transition); text-decoration: none; line-height: 1;
}
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 4px 20px rgba(99,102,241,0.35); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(99,102,241,0.45); color: #fff; }
.btn-glow { box-shadow: 0 0 30px rgba(99,102,241,0.4); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 0.8125rem; }
.btn-lg { padding: 16px 32px; font-size: 1.0625rem; }
.btn-block { width: 100%; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.875rem; color: var(--text-secondary); }
.form-control {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-primary);
    color: var(--text-primary); font-size: 0.9375rem; font-family: inherit;
    transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
    min-height: 48px; cursor: pointer;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow);
    transition: var(--transition); position: relative; overflow: hidden;
}
.card::before {
    content: ''; position: absolute; top: 0; right: 0; left: 0; height: 3px;
    background: var(--gradient); opacity: 0; transition: opacity 0.3s ease;
}
.card:hover::before { opacity: 1; }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-header { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.card-title { font-size: 1.125rem; font-weight: 600; }

/* ---- Badges ---- */
.badge {
    display: inline-block; padding: 4px 10px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600; text-transform: capitalize;
}
.badge-primary { background: rgba(99,102,241,0.15); color: var(--primary); }
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-secondary { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ---- Alerts ---- */
.alert {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    padding: 16px 24px; border-radius: var(--radius-sm);
    font-weight: 500; box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease; max-width: 400px;
}
.alert-success { background: #ecfdf5; color: #065f46; border-left: 4px solid var(--success); }
.alert-danger { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--info); }
.alert-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; margin-left: 12px; opacity: 0.6; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Star Rating ---- */
.star-rating { display: inline-flex; gap: 2px; }
.star { color: var(--border); font-size: 1.125rem; }
.star.filled { color: #f59e0b; }

/* ---- Navigation ---- */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: rgba(255,255,255,0.85); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border); transition: var(--transition);
}
[data-theme="dark"] .navbar { background: rgba(15,23,42,0.85); }
.navbar.scrolled { box-shadow: var(--shadow-md); }
.navbar-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between; height: 72px;
}
.logo {
    display: inline-flex; align-items: center; gap: 0;
    font-weight: 800; font-size: 1.5rem; color: var(--text-primary);
    line-height: 0; text-decoration: none;
}
.logo-mark { display: inline-flex; align-items: center; line-height: 0; will-change: transform; }
.logo-img {
    display: block;
    height: 40px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}
.logo-img.logo-lg { height: 52px; max-width: 200px; }
.logo-img.logo-sm { height: 32px; max-width: 130px; }
.logo-img-dark { display: none !important; }
[data-theme="dark"] .logo-img-light { display: none !important; }
[data-theme="dark"] .logo-img-dark { display: block !important; }
.logo-icon { display: none !important; }
.logo-text { display: none !important; }
.nav-links { display: flex; align-items: center; gap: 32px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--text-secondary); font-weight: 500; font-size: 0.9375rem; }
.nav-links a:hover { color: var(--primary); }
.nav-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: nowrap; }
.nav-actions-desktop { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
.nav-mobile-panel { display: none !important; }
.nav-backdrop {
    position: fixed; inset: 0; top: 64px;
    background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px);
    z-index: 1000; border: 0; padding: 0; cursor: pointer;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}
.nav-backdrop.show {
    opacity: 1; visibility: visible; pointer-events: auto;
}

.mobile-toggle {
    display: none; background: var(--bg-secondary); border: 1px solid var(--border);
    cursor: pointer; color: var(--text-primary);
    width: 44px; height: 44px; border-radius: 12px;
    align-items: center; justify-content: center; padding: 0;
    transition: background 0.2s ease, transform 0.2s ease;
}
.mobile-toggle:hover { background: var(--bg-tertiary); }
.mobile-toggle:active { transform: scale(0.96); }
.burger {
    width: 20px; height: 14px; display: inline-flex; flex-direction: column;
    justify-content: space-between; position: relative;
}
.burger-line {
    display: block; width: 100%; height: 2px; border-radius: 2px;
    background: currentColor; transition: transform 0.28s ease, opacity 0.2s ease;
    transform-origin: center;
}
.mobile-toggle.is-open .burger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mobile-toggle.is-open .burger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mobile-toggle.is-open .burger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
body.nav-open { overflow: hidden; }

/* ---- Hero Section ---- */
.hero {
    padding: 170px 24px 120px; text-align: center;
    background: var(--bg-secondary); position: relative; overflow: hidden;
    min-height: 90vh; display: flex; align-items: center; justify-content: center;
}
.hero::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at 70% 50%, rgba(99,102,241,0.1) 0%, transparent 50%),
                radial-gradient(circle at 30% 50%, rgba(139,92,246,0.08) 0%, transparent 50%);
}
.hero h1 { font-size: 3.75rem; margin-bottom: 24px; letter-spacing: -0.02em; font-weight: 900; line-height: 1.2; }
.hero h1 span { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { font-size: 1.3rem; color: var(--text-secondary); margin-bottom: 44px; max-width: 650px; margin-left: auto; margin-right: auto; line-height: 1.8; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 20px; background: rgba(99,102,241,0.1);
    color: var(--primary); border-radius: 30px; font-size: 0.9rem; font-weight: 700;
    margin-bottom: 28px; border: 1px solid rgba(99,102,241,0.2);
}
.hero-content { max-width: 850px; margin: 0 auto; position: relative; z-index: 2; }
.hero-badge::before { content: '✦'; font-size: 0.75rem; }
.hero-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hero-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ---- Sections ---- */
.section { padding: 100px 24px; }
.section-header { text-align: center; max-width: 600px; margin: 0 auto 60px; }
.section-header h2 { margin-bottom: 16px; }
.section-header p { color: var(--text-secondary); font-size: 1.125rem; }
.container { max-width: 1200px; margin: 0 auto; }

/* ---- Features Grid ---- */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.feature-card {
    padding: 36px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); transition: var(--transition); position: relative;
}
.feature-icon {
    width: 56px; height: 56px; background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
    color: var(--primary); border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
    margin-bottom: 24px;
}
.feature-icon svg { width: 28px; height: 28px; stroke: currentColor; fill: none; }
.feature-card h3 { margin-bottom: 12px; font-size: 1.125rem; }
.feature-card p { color: var(--text-secondary); font-size: 0.9375rem; }

/* ---- Pricing ---- */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 320px));
    gap: 24px;
    align-items: stretch;
    justify-content: center;
    width: 100%;
}
.pricing-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 36px 28px 28px; text-align: center; transition: var(--transition); position: relative;
    display: flex; flex-direction: column; min-height: 100%;
    overflow: visible;
}
.pricing-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}
.pricing-name {
    font-size: 1.125rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px;
}
.pricing-discount-badge {
    display: inline-block; margin-bottom: 8px; padding: 4px 10px;
    background: rgba(16,185,129,0.12); color: var(--success);
    border-radius: 999px; font-size: 0.8rem; font-weight: 700;
}
.pricing-amount-old {
    font-size: 1.1rem; font-weight: 600; color: var(--text-muted);
    text-decoration: line-through; margin-inline-end: 6px;
}
.pricing-card.popular {
    border-color: var(--primary);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    z-index: 2;
}
.pricing-card.popular::before {
    content: 'الأكثر طلباً'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
    background: var(--gradient); color: #fff; padding: 6px 20px; border-radius: 20px;
    font-size: 0.8rem; font-weight: 700; white-space: nowrap;
}
.pricing-price {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
    gap: 6px; margin: 16px 0 8px; line-height: 1.1;
}
.pricing-price .pricing-amount {
    font-size: 2.5rem; font-weight: 900; color: var(--text-primary);
    font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate;
}
.pricing-price .pricing-period {
    font-size: 1rem; font-weight: 600; color: var(--text-muted);
}
.pricing-features { list-style: none; margin: 20px 0 24px; padding: 0; text-align: right; flex: 1; }
.pricing-card .btn,
.pricing-card form { margin-top: auto; width: 100%; flex-shrink: 0; }
.pricing-card form .btn { margin-top: 0; }
.pricing-features li {
    padding: 8px 0; color: var(--text-secondary); font-size: 0.9375rem;
    display: flex; align-items: center; gap: 8px; justify-content: flex-start;
}
.pricing-features li::before { content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0; }

/* ---- Reviews ---- */
.reviews-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.review-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.review-stars { margin-bottom: 16px; }
.review-text { color: var(--text-secondary); font-style: italic; margin-bottom: 20px; line-height: 1.7; }
.review-author { display: flex; align-items: center; gap: 12px; }
.review-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gradient); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; }

/* ---- Stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.stat-card { text-align: center; padding: 36px; background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.stat-value { font-size: 3rem; font-weight: 900; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-label { color: var(--text-secondary); font-weight: 500; margin-top: 8px; }

/* ---- FAQ ---- */
.faq-list { max-width: 800px; margin: 0 auto; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; }
.faq-question {
    width: 100%; padding: 20px 24px; background: var(--bg-card); border: none;
    text-align: left; font-size: 1rem; font-weight: 600; cursor: pointer;
    color: var(--text-primary); display: flex; justify-content: space-between; align-items: center;
    font-family: inherit; transition: var(--transition);
}
.faq-question:hover { background: var(--bg-secondary); }
.faq-answer { padding: 0 24px; max-height: 0; overflow: hidden; transition: all 0.3s ease; color: var(--text-secondary); }
.faq-item.active .faq-answer { padding: 0 24px 20px; max-height: 300px; }
.faq-item.active .faq-question { color: var(--primary); }

/* ---- Contact ---- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; max-width: 900px; margin: 0 auto; }
.contact-info h3 { margin-bottom: 24px; }
.contact-item { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--text-secondary); }
.contact-item svg { width: 20px; height: 20px; stroke: var(--primary); fill: none; flex-shrink: 0; }

/* ---- Footer ---- */
.footer { background: var(--bg-secondary); border-top: 1px solid var(--border); padding: 60px 24px 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; max-width: 1200px; margin: 0 auto; }
.footer-brand p { color: var(--text-secondary); margin-top: 12px; font-size: 0.9375rem; }
.footer-links h4 { margin-bottom: 16px; font-size: 0.9375rem; }
.footer-links a { display: block; color: var(--text-secondary); padding: 4px 0; font-size: 0.875rem; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom { max-width: 1200px; margin: 40px auto 0; padding-top: 24px; border-top: 1px solid var(--border); text-align: center; color: var(--text-muted); font-size: 0.875rem; }

/* ---- Auth Pages ---- */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px; background: var(--bg-secondary); position: relative; overflow: hidden;
}
.auth-page::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(99,102,241,0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(139,92,246,0.06) 0%, transparent 50%);
}
.auth-card {
    width: 100%; max-width: 460px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 44px; box-shadow: var(--shadow-xl); position: relative; z-index: 1;
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h1 { font-size: 1.75rem; margin-bottom: 8px; }
.auth-header p { color: var(--text-secondary); }
.auth-divider { display: flex; align-items: center; gap: 16px; margin: 24px 0; color: var(--text-muted); font-size: 0.875rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-google { background: #fff; color: #333; border: 1px solid var(--border); width: 100%; }
.btn-google:hover { background: var(--bg-secondary); }
.auth-footer { text-align: center; margin-top: 24px; color: var(--text-secondary); font-size: 0.875rem; }

/* ---- Theme Toggle ---- */
.theme-toggle { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; cursor: pointer; color: var(--text-primary); display: flex; align-items: center; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table th { font-weight: 600; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: var(--bg-secondary); }
table tr:hover { background: var(--bg-secondary); }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
    padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 0.875rem;
}
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- Chat ---- */
.chat-container { display: flex; flex-direction: column; height: 500px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg-secondary); }
.chat-message { margin-bottom: 12px; max-width: 75%; }
.chat-message.own { margin-left: auto; }
.chat-message .bubble { padding: 10px 16px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); word-break: break-word; }
.chat-message.own .bubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.chat-message .meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.chat-input-wrap { border-top: 1px solid var(--border); background: var(--bg-card); }
.chat-input { display: flex; gap: 8px; padding: 12px; align-items: center; }
.chat-input input { flex: 1; min-width: 0; }
@media (max-width: 768px) {
    .chat-container { height: min(70vh, 520px); border-radius: 12px; }
    .chat-message { max-width: 88%; }
    .chat-input { flex-wrap: wrap; gap: 8px; }
    .chat-input input { flex: 1 1 100%; min-height: 44px; font-size: 16px; }
    .chat-input .btn { min-height: 44px; }
}

/* File preview (chat + forms) */
.file-preview-list,
#chatFilePreview {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 10px 12px 0;
}
.file-preview-list[hidden],
#chatFilePreview[hidden] { display: none !important; }
.file-preview-item {
    display: inline-flex; align-items: center; gap: 8px;
    max-width: 100%; padding: 6px 8px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 0.875rem;
}
.file-preview-thumb {
    width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex-shrink: 0;
}
.file-preview-icon { font-size: 1.25rem; line-height: 1; }
.file-preview-name {
    max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--text-secondary);
}
.file-preview-remove {
    border: none; background: transparent; color: var(--danger);
    font-size: 1.25rem; line-height: 1; cursor: pointer; padding: 0 4px;
}
.file-preview-remove:hover { opacity: 0.75; }
.form-group .file-preview-list { padding: 10px 0 0; }

/* ---- Timeline ---- */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 24px; }
.timeline-item::before {
    content: ''; position: absolute; left: -25px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-card);
}
.timeline-item .time { font-size: 0.8125rem; color: var(--text-muted); }
.timeline-item .status { font-weight: 600; }

/* ---- Responsive ---- */
@media (max-width: 1200px) {
    .pricing-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 300px)); }
}
/* Mobile nav: also driven by body.is-mobile-nav (JS) as fallback */
@media (max-width: 900px) {
    h1 { font-size: 2rem; }
    .hero { padding: 120px 16px 72px; min-height: auto; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .navbar-inner { height: 64px; padding: 0 16px; gap: 8px; }
    .logo-img { height: 34px; }

    .nav-actions-desktop,
    body.is-mobile-nav .nav-actions-desktop { display: none !important; }
    .mobile-toggle,
    body.is-mobile-nav .mobile-toggle { display: inline-flex !important; }

    .nav-links,
    body.is-mobile-nav .nav-links {
        display: flex !important;
        position: fixed !important;
        top: 64px; left: 0; right: 0;
        max-height: 78vh;
        background: var(--bg-card);
        padding: 12px 14px 20px;
        border-bottom: 1px solid var(--border);
        border-radius: 0 0 20px 20px;
        flex-direction: column !important;
        align-items: stretch;
        gap: 4px;
        z-index: 1002;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        list-style: none;
        margin: 0;
        box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
        transform: translateY(-12px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.3s ease, opacity 0.25s ease, visibility 0.25s;
    }
    .nav-links.active,
    body.is-mobile-nav .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    [dir="rtl"] .nav-links { flex-direction: column !important; }
    .nav-links > li { width: 100%; }

    .nav-links > li:not(.nav-mobile-panel) > a {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 14px 16px;
        border-radius: 14px;
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--text-primary);
        background: transparent;
    }
    .nav-links > li:not(.nav-mobile-panel) > a:hover,
    .nav-links > li:not(.nav-mobile-panel) > a:active {
        background: var(--bg-secondary);
        color: var(--primary);
    }

    .nav-mobile-panel,
    body.is-mobile-nav .nav-mobile-panel {
        display: flex !important;
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
        padding-top: 16px;
        border-top: 1px solid var(--border);
    }
    .nav-theme-btn {
        display: flex; align-items: center; justify-content: space-between;
        width: 100%; gap: 12px; min-height: 52px; padding: 12px 16px;
        border-radius: 14px; border: 1px solid var(--border);
        background: var(--bg-secondary); color: var(--text-primary);
        font-family: inherit; font-size: 1rem; font-weight: 700;
        cursor: pointer;
    }
    .nav-theme-icons {
        display: inline-flex; align-items: center; justify-content: center;
        width: 36px; height: 36px; border-radius: 10px;
        background: var(--bg-card); color: var(--primary);
    }
    .nav-mobile-cta {
        width: 100%; justify-content: center; min-height: 50px;
        border-radius: 14px; font-weight: 800; font-size: 1rem;
    }

    select.form-control,
    input.form-control,
    textarea.form-control { font-size: 16px; }

    .contact-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .pricing-grid { grid-template-columns: 1fr; }
    .section { padding: 60px 16px; }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .hero-buttons { flex-direction: column; }
    .hero-buttons .btn { width: 100%; }
    .logo-img { height: 30px; }
}

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.flex { display: flex; }
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
}
.gap-2 { gap: 1rem; }
.hidden { display: none; }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .table-responsive { display: block; width: 100%; max-width: 100%; overflow-x: auto; }
    .card, .dash-stat, .page-header { max-width: 100%; min-width: 0; }
}
