/* ═══════════════════════════════════════════════════════════
   SaaS Community — Design System
   ═══════════════════════════════════════════════════════════ */

/* ── Design tokens ────────────────────────────────────────── */
:root {
    --c-brand:        #1630a3;
    --c-brand-hover:  #1630a3;
    --c-brand-light:  #f0fdf4;
    --c-brand-soft:   rgba(22, 62, 163, 0.1);
    --c-danger:       #dc2626;
    --c-danger-soft:  rgba(220, 38, 38, 0.1);
    --c-warning:      #d97706;
    --c-warning-soft: rgba(217, 119, 6, 0.1);

    --c-text:         #111827;
    --c-text-muted:   #6b7280;
    --c-border:       #e5e7eb;
    --c-bg:           #f9fafb;
    --c-surface:      #ffffff;

    --r-sm: 0.375rem;
    --r-md: 0.625rem;
    --r-lg: 0.875rem;
    --r-xl: 1rem;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);

    --nav-h: 56px;
    --layout-max: 1100px;
}

.container-fixed,
.container.container-fixed {
    max-width: var(--layout-max);
    width: 100%;
    margin-inline: auto;
}

/* Utility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body, .saas-body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--c-bg);
    color: var(--c-text);
    font-size: 0.9375rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.rtl body, .rtl.saas-body,
.saas-body.rtl {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

a {
    color: var(--c-brand);
    text-decoration: none;
    transition: color 0.15s;
}
a:hover { color: var(--c-brand-hover); text-decoration: underline; }

/* Footer */
.saas-footer {
    background: #f8fafc;
    border-top: 1px solid var(--c-border);
    padding: 2rem 0 1.5rem;
    font-size: 0.875rem;
    color: var(--c-text-muted);
}

.saas-footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem;
}

.saas-footer-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 0.5rem;
}

.saas-footer-text {
    margin: 0;
    color: var(--c-text-muted);
}

.saas-footer-subtitle {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.saas-footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.saas-footer-links a {
    color: var(--c-text-muted);
    text-decoration: none;
}


.saas-footer-links a:hover {
    color: var(--c-text);
}

.saas-footer-social {
    display: flex;
    gap: 0.5rem;
}

.saas-footer-social a {
    width: 36px;
    height: 36px;
    border: 1px solid var(--c-border);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-muted);
    transition: border-color 0.2s, color 0.2s;
}

.saas-footer-social svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.saas-footer-social a:hover {
    border-color: var(--c-brand);
    color: var(--c-brand);
}

.saas-footer-divider {
    border-top: 1px solid var(--c-border);
    margin: 2rem 0 1.5rem;
}

.saas-footer-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

.doctor-verification-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1;
    cursor: pointer;
    font-size: 0.85rem;
}

.doctor-verification-badge .badge-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.doctor-verification-badge .badge-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doctor-verification-badge.verified-badge {
    color: #0d6efd;
}

.doctor-verification-badge.verified-badge .badge-icon {
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.25);
}

.doctor-verification-badge.not-verified-badge {
    color: #adb5bd;
}

.doctor-verification-badge.not-verified-badge .badge-icon {
    filter: grayscale(100%) opacity(0.6);
}

.doctor-verification-badge.badge-inline {
    cursor: default;
    gap: 0.35rem;
}

.doctor-verification-badge.badge-inline .badge-text {
    font-size: 0.75rem;
    color: inherit;
    opacity: 0.85;
}

.doctor-verification-badge.no-tooltip {
    pointer-events: none;
}

.saas-footer-verification {
    font-size: 0.75rem;
    opacity: 0.85;
}

.saas-footer-made {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #6b7280;
}

.saas-heart {
    color: #e11d48;
    font-size: 0.9rem;
}

.saas-legal .saas-legal-section + .saas-legal-section {
    margin-top: 2rem;
}

.saas-legal ul {
    padding-inline-start: 1.25rem;
    margin-bottom: 0;
    color: var(--c-text);
}

.saas-legal li {
    margin-bottom: 0.35rem;
}

.saas-empty-card {
    text-align: center;
    padding: 3rem 2rem;
}

.saas-empty-icon {
    width: 72px;
    height: 72px;
    margin-inline: auto;
    border-radius: 50%;
    border: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-brand);
    background: var(--c-surface);
    font-size: 2rem;
    margin-bottom: 1.25rem;
}

.saas-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

@media (max-width: 576px) {
    .saas-footer {
        padding: 1.75rem 0 1.25rem;
    }
    .saas-footer-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Navbar ───────────────────────────────────────────────── */
.saas-navbar {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    height: var(--nav-h);
    box-shadow: var(--shadow-xs);
    padding: 0 0;
    z-index: 1040;
}

/* Container row inside navbar — always a flex row */
.saas-nav-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    height: var(--nav-h);
}

.saas-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--c-text) !important;
    text-decoration: none !important;
    letter-spacing: -0.01em;
}

.saas-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--c-brand);
    color: #fff;
    border-radius: var(--r-sm);
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
}

.saas-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.saas-brand-icon-sm {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

.saas-brand-text {
    color: var(--c-text);
}

/* Kill ALL bullet/list styling inside navbar */
.saas-navbar .navbar-nav,
.saas-nav-list {
    list-style: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.125rem;
}

.saas-navbar .navbar-nav .nav-item,
.saas-nav-list .nav-item {
    list-style: none !important;
    display: flex !important;
    align-items: center;
}

.saas-nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--c-text-muted) !important;
    padding: 0.375rem 0.625rem !important;
    border-radius: var(--r-sm);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1;
}

.saas-nav-link:hover,
.saas-nav-link.active {
    color: var(--c-text) !important;
    background: var(--c-bg);
    text-decoration: none;
}

/* Right-side controls stay in a row */
.saas-nav-right {
    flex-shrink: 0;
    flex-wrap: nowrap;
    margin-inline-start: auto;
    margin-inline-end: 0;
}

.saas-brand {
    flex-grow: 1;
    text-align: center;
}

.saas-nav-user {
    display: flex;
    align-items: center;
}

.saas-nav-user .btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
}

.saas-nav-user .saas-avatar-btn {
    width: 36px;
    height: 36px;
}

@media (max-width: 991.98px) {
    .saas-navbar {
        height: auto;
    }

    .saas-nav-container {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        padding-block: 0.5rem;
        row-gap: 0.75rem;
        justify-content: space-between;
    }

    .saas-toggler {
        order: 1;
        flex-shrink: 0;
    }

    .saas-brand {
        order: 2;
        flex-grow: 1;
        text-align: center;
        margin: 0 0.5rem;
        font-size: 0.95rem;
    }
    
    .saas-brand-text {
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .saas-nav-user {
        order: 3;
        flex-shrink: 0;
    }

    .saas-navbar .navbar-collapse {
        order: 4;
        width: 100%;
        margin-top: 0.5rem;
        background: var(--c-surface);
        border: 1px solid var(--c-border);
        border-radius: var(--r-md);
        box-shadow: var(--shadow-sm);
        padding: 0.75rem;
    }

    .saas-navbar .navbar-collapse .saas-nav-list,
    .saas-navbar .navbar-collapse .navbar-nav {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        width: 100%;
    }

    .saas-nav-link {
        padding: 0.65rem 0.5rem !important;
        border-radius: var(--r-sm);
    }

    .saas-nav-right {
        width: 100%;
        margin-top: 0.75rem;
        justify-content: flex-start;
    }

    .saas-nav-right .btn {
        width: 100%;
        text-align: center;
    }

    .saas-user-menu .dropdown-menu {
        width: 100%;
        min-width: auto;
        margin-top: 0.5rem;
    }
}

/* Language selector */
.saas-lang-form { margin: 0; }

.saas-lang-select {
    font-size: 0.8rem;
    border-radius: var(--r-sm) !important;
    border-color: var(--c-border) !important;
    padding: 0.25rem 0.625rem !important;
    background-color: var(--c-bg) !important;
    color: var(--c-text-muted);
    min-width: 90px;
    cursor: pointer;
}

.saas-lang-select:focus {
    border-color: var(--c-brand) !important;
    box-shadow: 0 0 0 3px var(--c-brand-soft) !important;
}

/* Avatar button */
.saas-avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--c-border);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    padding: 0;
}

.saas-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.saas-avatar-btn::after { display: none; }

.saas-avatar-btn:hover,
.saas-avatar-btn:focus {
    border-color: var(--c-brand);
    box-shadow: 0 0 0 3px var(--c-brand-soft);
    outline: none;
}

/* Dropdown */
.saas-dropdown {
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    padding: 0.25rem 0;
    margin-top: 0.5rem !important;
}

.saas-user-menu .saas-dropdown {
    min-width: 230px;
}

.saas-dropdown .dropdown-item {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    color: var(--c-text);
    transition: background 0.1s;
    border-radius: 0;
}

.saas-dropdown .dropdown-item:hover {
    background: var(--c-bg);
    color: var(--c-text);
}

.saas-logout { color: var(--c-danger) !important; }
.saas-logout:hover { background: var(--c-danger-soft) !important; }

.saas-user-menu {
    position: relative;
}

.saas-user-menu .dropdown-menu {
    inset-inline-end: 0;
    inset-inline-start: auto;
}

.saas-user-menu .dropdown-menu[data-bs-popper] {
    inset-inline-start: auto !important;
    inset-inline-end: 0 !important;
    transform: none !important;
}

/* Mobile hamburger */
.saas-toggler {
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    background: transparent;
    padding: 0.375rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.saas-toggler:focus { box-shadow: none !important; outline: none; }
.saas-toggler:focus-visible { box-shadow: 0 0 0 3px var(--c-brand-soft) !important; }

.saas-toggler-icon {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--c-text-muted);
    border-radius: 2px;
    transition: background 0.15s;
}

.saas-toggler:hover .saas-toggler-icon { background: var(--c-text); }

/* ── Main layout ──────────────────────────────────────────── */
.saas-main {
    padding-top: var(--nav-h);
    min-height: 100vh;
}

/* Prevent collapsed navbar from pushing content down */
.saas-navbar .navbar-collapse {
    /* On desktop: always inline flex row inside the container */
    flex-grow: 1;
}

/* ── Breadcrumb strip ─────────────────────────────────────── */
.saas-breadcrumb-strip {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-xs);
    margin-bottom: 1.5rem;
}

.breadcrumb { margin-bottom: 0.25rem; }

.breadcrumb-item + .breadcrumb-item::before { color: var(--c-border); }

.breadcrumb-item a {
    color: var(--c-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.breadcrumb-item a:hover { color: var(--c-brand); text-decoration: none; }

.breadcrumb-item.active {
    color: var(--c-text);
    font-size: 0.8125rem;
    font-weight: 600;
}

.saas-page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 0.125rem;
    line-height: 1.3;
}

.saas-page-subtitle {
    font-size: 0.8125rem;
    color: var(--c-text-muted);
    margin-bottom: 0;
}

/* ── Forum layout (Discourse / GitHub Discussions vibe) ───── */
.forum-toolbar {
    margin: 0 0 1rem;
}

.forum-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.forum-pill {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    color: var(--c-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.forum-pill:hover {
    background: var(--c-bg);
    color: var(--c-text);
    text-decoration: none;
}

.forum-pill.active {
    border-color: rgba(22, 163, 74, 0.35);
    background: rgba(22, 163, 74, 0.08);
    color: var(--c-text);
}

.forum-search {
    width: 100%;
    max-width: 520px;
}

.forum-search-group {
    gap: 0.5rem;
}

.forum-search-group .form-control {
    border-radius: 999px !important;
}

.forum-panel {
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.forum-panel-head {
    display: grid;
    grid-template-columns: 1fr 120px 260px;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(249, 250, 251, 0.75);
    border-bottom: 1px solid var(--c-border);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--c-text-muted);
    font-weight: 600;
}

.forum-col-main { grid-column: 1; }
.forum-col-metric { grid-column: auto; }

.forum-list { display: block; }

.forum-row {
    display: grid;
    grid-template-columns: 1fr 120px 260px;
    gap: 1rem;
    padding: 1rem;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--c-border);
    transition: background 0.15s;
}

.forum-row:last-child { border-bottom: none; }

.forum-row:hover {
    background: var(--c-brand-soft);
    text-decoration: none;
    color: inherit;
}

.forum-cell { min-width: 0; }

.forum-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.forum-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--c-brand-soft);
    color: var(--c-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.forum-main-text { min-width: 0; }

.forum-title {
    font-size: 0.98rem;
    font-weight: 650;
    color: var(--c-text);
    line-height: 1.25;
}

.forum-subtitle {
    margin-top: 0.15rem;
    font-size: 0.85rem;
    color: var(--c-text-muted);
    line-height: 1.35;
}

.forum-metric {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.forum-metric-value {
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--c-text);
}

.forum-metric-label {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-top: 0.1rem;
}

.forum-last {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.forum-last-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--c-text);
}

.forum-last-meta {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-top: 0.15rem;
}

.forum-badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid rgba(22, 163, 74, 0.25);
    background: rgba(22, 163, 74, 0.08);
    color: var(--c-text);
}

.forum-badge.danger {
    border-color: rgba(220, 38, 38, 0.25);
    background: rgba(220, 38, 38, 0.08);
}

/* ── Thread view ──────────────────────────────────────────── */
.thread-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
}

.thread-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.thread-category {
    color: var(--c-text);
    font-weight: 600;
    text-decoration: none;
}

.thread-category:hover { text-decoration: underline; }

.thread-dot { color: var(--c-text-muted); }
.thread-muted { color: var(--c-text-muted); font-size: 0.875rem; }

.thread-panel {
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.thread-post {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 0.9rem;
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid var(--c-border);
}

.thread-post:last-child { border-bottom: none; }

.thread-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    color: var(--c-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.thread-post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.thread-author {
    font-weight: 650;
    color: var(--c-text);
    font-size: 0.92rem;
}

.thread-op {
    margin-inline-start: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--c-text-muted);
    border: 1px solid var(--c-border);
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
}


.thread-post-time {
    font-size: 0.82rem;
    color: var(--c-text-muted);
    white-space: nowrap;
}

.thread-post-body {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--c-text);
}

.thread-post-body p:last-child { margin-bottom: 0; }

.thread-composer {
    margin-top: 1rem;
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: var(--shadow-xs);
    padding: 1rem 1.25rem;
}

.django-ckeditor-widget {
    width: 100%;
    display: block;
}

.django-ckeditor-widget .cke,
.django-ckeditor-widget .cke_chrome,
.django-ckeditor-widget .cke_inner,
.django-ckeditor-widget textarea {
    width: 100% !important;
}

.django-ckeditor-widget .cke_contents {
    min-height: 240px;
}

.thread-composer-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
}

.thread-closed {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    background: var(--c-surface);
}

@media (max-width: 991.98px) {
    .forum-panel-head { grid-template-columns: 1fr; }
    .forum-row { grid-template-columns: 1fr; }
    .forum-metric, .forum-last { flex-direction: row; gap: 0.5rem; align-items: baseline; }
    .forum-last { justify-content: flex-start; }

    .thread-post { grid-template-columns: 36px 1fr; padding: 1rem; }
    .thread-composer { padding: 1rem; }
}

/* ── Latest Topics dashboard ───────────────────────────────── */
.latest-topics {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.lt-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.lt-overline {
    margin: 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-muted);
}

.lt-title {
    margin: 0.25rem 0 0.35rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--c-text);
}

.lt-subtitle {
    margin: 0;
    color: var(--c-text-muted);
    font-size: 0.95rem;
}

.lt-toolbar {
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    padding: 1rem;
    background: var(--c-surface);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-xs);
}

.lt-search {
    flex: 1;
    min-width: 240px;
}

.lt-search-field {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 999px;
    padding-inline-start: 2.5rem;
}

.lt-search-field input {
    border: none;
    background: transparent;
    padding: 0.65rem 1rem;
    width: 100%;
    font-size: 0.95rem;
    color: var(--c-text);
}

.lt-search-field input:focus {
    outline: none;
}

.lt-search-icon {
    position: absolute;
    inset-inline-start: 1rem;
    display: inline-flex;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--c-text-muted);
}

.lt-search-icon svg { width: 100%; height: 100%; fill: currentColor; }

.lt-clear {
    background: none;
    border: none;
    color: var(--c-text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    padding-inline: 0.75rem;
}

.lt-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.lt-filter {
    border: 1px solid var(--c-border);
    border-radius: 999px;
    padding: 0.45rem 1.15rem;
    font-size: 0.85rem;
    color: var(--c-text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
}

.lt-filter.active {
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(14, 165, 233, 0.4);
    color: var(--c-brand);
}

.lt-card {
    border: 1px solid var(--c-border);
    border-radius: 16px;
    background: var(--c-surface);
    box-shadow: 0 24px 60px rgba(15,23,42,0.08);
    overflow: hidden;
}

.lt-table-header {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 140px minmax(0, 2fr);
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(241, 245, 249, 0.75);
    border-bottom: 1px solid var(--c-border);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--c-text-muted);
}

.lt-table-body {
    display: flex;
    flex-direction: column;
}

.lt-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 2fr) 140px minmax(0, 2fr);
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(15,23,42,0.08);
    transition: background 0.15s ease;
}

.lt-row:last-child { border-bottom: none; }

.lt-row:hover { background: rgba(14,165,233,0.06); }

.lt-row-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.lt-cell {
    position: relative;
    z-index: 2;
    min-width: 0;
}

.lt-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.lt-category-text { min-width: 0; }

.lt-category-name {
    font-weight: 700;
    color: var(--c-text);
}

.lt-category-description {
    margin: 0.15rem 0 0;
    color: var(--c-text-muted);
    font-size: 0.85rem;
}

.lt-icon-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(14,165,233,0.12);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0284c7;
    flex-shrink: 0;
    transition: background 0.15s;
}

.lt-icon-button svg { width: 18px; height: 18px; fill: currentColor; }

.lt-icon-button:hover { background: rgba(14,165,233,0.22); }

.lt-metric {
    text-align: center;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--c-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lt-activity { min-width: 0; }

.lt-topic-title {
    font-weight: 700;
    color: var(--c-text);
    display: inline-block;
    margin-bottom: 0.35rem;
}

.lt-topic-meta {
    font-size: 0.85rem;
    color: var(--c-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.lt-meta-dot {
    color: var(--c-text-muted);
}

.lt-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.lt-error {
    background: #fee2e2;
    color: #991b1b;
}

.lt-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 18px;
    background: rgba(14,165,233,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.lt-state-actions {
    margin-top: 1.25rem;
    display: inline-flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.lt-skeleton {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lt-skeleton-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 140px minmax(0, 2fr);
    gap: 1rem;
}

.lt-skeleton-line {
    height: 16px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(226, 232, 240, 0.8), rgba(203, 213, 225, 0.8), rgba(226, 232, 240, 0.8));
    background-size: 400% 100%;
    animation: lt-shimmer 1.5s infinite;
}

.lt-skeleton-line.w-60 { width: 60%; }
.lt-skeleton-line.w-50 { width: 50%; }
.lt-skeleton-line.w-15 { width: 30%; }

@keyframes lt-shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.lt-pagination {
    border-top: 1px solid var(--c-border);
    padding: 1rem 1.5rem;
}

.lt-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.lt-pagination a,
.lt-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--c-border);
    color: var(--c-text);
    text-decoration: none;
}

.lt-pagination .disabled {
    color: var(--c-text-muted);
    background: var(--c-bg);
}

.lt-page-indicator {
    width: auto;
    padding-inline: 1rem;
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .lt-toolbar { flex-direction: column; align-items: stretch; }
    .lt-row,
    .lt-table-header,
    .lt-skeleton-row {
        grid-template-columns: 1fr;
    }
    .lt-category { flex-direction: column; align-items: flex-start; }
    .lt-metric { justify-content: flex-start; }
    .lt-icon-button { align-self: flex-start; }
    .lt-pagination ul { flex-wrap: wrap; }
}


@media (prefers-color-scheme: dark) {
    body, .saas-body {
        --c-text: #f1f5f9;
        --c-text-muted: #94a3b8;
        --c-border: rgba(148,163,184,0.35);
        --c-bg: #0f172a;
        --c-surface: #1e293b;
    }
    .lt-table-header { background: rgba(30, 41, 59, 0.9); }
    .lt-row { border-color: rgba(148,163,184,0.2); }
    .lt-row:hover { background: rgba(30, 64, 175, 0.28); }
    .lt-error { background: rgba(239, 68, 68, 0.15); color: #fecaca; }
    .lt-pagination .disabled { background: rgba(148,163,184,0.1); }
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--c-border) !important;
    border-radius: var(--r-lg) !important;
    background: var(--c-surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.card.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.card-hover:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-2px);
}

.card-body { padding: 1.5rem; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s;
}

.btn-success,
.btn-success:focus {
    background-color: var(--c-brand);
    border-color: var(--c-brand);
    color: #fff;
}

.btn-success:hover {
    background-color: var(--c-brand-hover);
    border-color: var(--c-brand-hover);
    color: #fff;
}

.btn-outline-secondary {
    border-color: var(--c-border);
    color: var(--c-text-muted);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--c-bg);
    border-color: var(--c-text-muted);
    color: var(--c-text);
}

.btn-outline-danger {
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--c-danger);
}

.btn-outline-danger:hover {
    background: var(--c-danger-soft);
    border-color: var(--c-danger);
    color: var(--c-danger);
}

/* ── Forms ────────────────────────────────────────────────── */
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--c-text);
    margin-bottom: 0.375rem;
}

.form-control,
.form-select {
    border: 1px solid var(--c-border);
    border-radius: var(--r-md) !important;
    background: var(--c-surface);
    color: var(--c-text);
    font-size: 0.9375rem;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--c-brand);
    box-shadow: 0 0 0 3px var(--c-brand-soft);
    outline: none;
}

.form-control::placeholder { color: var(--c-text-muted); opacity: 0.7; }

/* ── Alerts ───────────────────────────────────────────────── */
.saas-alert {
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
}

/* ── Setup wizard ───────────────────────────────────────────── */
.setup-body {
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(22, 163, 74, 0.08), transparent 55%);
    background-color: #f4f7fb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: var(--c-text);
}

.setup-shell {
    width: min(1100px, 100%);
    padding: 2rem 1.5rem;
}

.setup-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.setup-logo {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--setup-brand, var(--c-brand));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.35rem;
}

.setup-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.setup-powered {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-bottom: 0.2rem;
}

.setup-community {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.setup-card {
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 40px 120px rgba(15, 23, 42, 0.15);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.setup-head {
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.setup-overline {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-bottom: 0.35rem;
}

.setup-title {
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 800;
    color: var(--c-text);
}

.setup-lead {
    margin: 0.35rem 0 0;
    color: var(--c-text-muted);
}

.setup-progress-meta {
    min-width: 200px;
}

.setup-step-count {
    font-weight: 600;
    color: var(--c-text);
}

.setup-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    margin-top: 0.6rem;
    position: relative;
}

.setup-progress-bar span {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--setup-brand, var(--c-brand));
    width: var(--progress-value, 0%);
    transition: width 0.25s ease;
}

.setup-progress-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.setup-progress-item {
    padding: 0.75rem 0.85rem;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 600;
    color: var(--c-text-muted);
}

.setup-progress-item.complete {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.12);
    color: var(--c-text);
}

.setup-progress-item.current {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.12);
    color: var(--c-text);
}

.setup-progress-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--setup-brand, var(--c-brand));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.setup-form label {
    font-weight: 600;
    color: var(--c-text);
}

.setup-form .form-control,
.setup-form .form-select {
    border-radius: 14px;
}

.setup-form .form-control-color {
    min-width: 60px;
    border: none;
    background: transparent;
}

.setup-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.setup-actions .btn {
    padding-inline: 1.75rem;
    border-radius: 999px;
    font-weight: 600;
}

.setup-footer {
    text-align: center;
    margin-top: 1.25rem;
    color: var(--c-text-muted);
    font-size: 0.9rem;
}

.setup-messages .alert {
    border-radius: 16px;
    border: none;
}

.review-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: #fff;
}

.review-title {
    margin-bottom: 1rem;
    font-weight: 700;
}

.review-list {
    margin: 0;
}

.review-list div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    gap: 1rem;
}

.review-list dt {
    font-weight: 600;
    color: var(--c-text-muted);
}

.review-list dd {
    margin: 0;
    font-weight: 600;
    color: var(--c-text);
}

.review-actions {
    margin-top: 1.5rem;
}

.color-chip {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: var(--chip-color, var(--setup-brand, var(--c-brand)));
    margin-inline-end: 0.35rem;
}

@media (max-width: 768px) {
    .setup-shell {
        padding: 1rem;
    }
    .setup-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .setup-progress-list {
        grid-template-columns: 1fr;
    }
}

/* ── List group (topic rows) ──────────────────────────────── */
.list-group-flush .list-group-item {
    border-left: none;
    border-right: none;
    border-color: var(--c-border);
    padding: 1rem 1.5rem;
    transition: background 0.12s;
}

.list-group-flush .list-group-item:first-child { border-top: none; }
.list-group-flush .list-group-item:last-child  { border-bottom: none; }

.list-group-item-action { color: var(--c-text); }

.list-group-item-action:hover {
    background: var(--c-brand-soft);
    color: var(--c-text);
    text-decoration: none;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge-soft {
    background: var(--c-brand-soft);
    color: var(--c-brand);
    font-weight: 600;
    font-size: 0.7rem;
    border-radius: 999px;
    padding: 0.3em 0.7em;
}

.badge-soft-danger {
    background: var(--c-danger-soft);
    color: var(--c-danger);
    font-weight: 600;
    font-size: 0.7rem;
    border-radius: 999px;
    padding: 0.3em 0.7em;
}

.badge-soft-warning {
    background: var(--c-warning-soft);
    color: var(--c-warning);
    font-weight: 600;
    font-size: 0.7rem;
    border-radius: 999px;
    padding: 0.3em 0.7em;
}

/* ── Topic meta ───────────────────────────────────────────── */
.topic-meta {
    font-size: 0.8125rem;
    color: var(--c-text-muted);
}

/* ── Thread / post timeline ───────────────────────────────── */
.saas-post {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--c-border);
}

.saas-post:last-child { border-bottom: none; padding-bottom: 0; }
.saas-post:first-child { padding-top: 0; }

.saas-post-author {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--c-text);
}

.saas-post-time {
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

.saas-post-body {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--c-text);
    margin-top: 0.5rem;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    border: 1.5px dashed var(--c-border);
    border-radius: var(--r-xl);
    background: var(--c-surface);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    background: var(--c-bg);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--c-text-muted);
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination .page-link {
    border-color: var(--c-border);
    color: var(--c-text-muted);
    font-size: 0.875rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--r-sm) !important;
}

.pagination .page-item.active .page-link {
    background-color: var(--c-brand);
    border-color: var(--c-brand);
    color: #fff;
}

.pagination .page-link:hover {
    background: var(--c-bg);
    border-color: var(--c-text-muted);
    color: var(--c-text);
}

/* ── Section header ───────────────────────────────────────── */
.saas-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.saas-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--c-text);
    margin: 0;
}

/* ── Login page centering ─────────────────────────────────── */
.saas-auth-wrap {
    min-height: calc(100vh - var(--nav-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.saas-auth-card {
    width: 100%;
    max-width: 400px;
}

/* ── RTL overrides ────────────────────────────────────────── */
.rtl .saas-nav-link,
.rtl .saas-brand-text,
.rtl .breadcrumb-item,
.rtl .card-body,
.rtl .list-group-item,
.rtl .form-label {
    font-family: 'Tajawal', Tahoma, sans-serif;
}


/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .card-body { padding: 1.25rem; }
    .saas-breadcrumb-strip { padding: 0.875rem 1rem; }
}

/* ── Utility overrides ────────────────────────────────────── */
.rounded-3 { border-radius: var(--r-lg) !important; }
.rounded-4 { border-radius: var(--r-xl) !important; }
.border-0  { border: none !important; }

.text-muted { color: var(--c-text-muted) !important; }

.dropdown-divider { border-color: var(--c-border); }

.invalid-feedback { font-size: 0.8125rem; color: var(--c-danger); }

.form-control.is-invalid,
.form-select.is-invalid { border-color: var(--c-danger) !important; }

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--c-danger-soft) !important;
}
