:root {
    --bg: #f8f9fc;
    --bg-card: #ffffff;
    --text: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --primary: #F5A623;
    --primary-hover: #d48a0f;
    --primary-light: #FEF3E2;
    --secondary: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04), 0 1px 3px -1px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 4px 6px -1px rgb(0 0 0 / 0.06), 0 10px 20px -6px rgb(0 0 0 / 0.06);
    --shadow-xl: 0 10px 25px -3px rgb(0 0 0 / 0.08), 0 4px 8px -4px rgb(0 0 0 / 0.04);
    --radius: 8px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; width: 100%; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; line-height: 1.5; overflow-x: hidden; width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.container-fluid { width: 100%; padding: 0 20px; }
.section { padding: 32px 0; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.section-title h2 { margin: 0; font-size: 1.4rem; font-weight: 600; }
.section-title .muted { color: var(--text-muted); font-size: .9rem; }

/* ===== Boutons ===== */
.btn, button:not(.icon-btn) {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
    font-family: var(--font); font-size: .88rem; font-weight: 500; cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
    white-space: nowrap;
}
.btn:hover, button:not(.icon-btn):hover {
    background: #f8f9fa; border-color: #c1c7d0; transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn-primary, button[type='submit']:not(.icon-btn) {
    background: var(--primary); color: white; border-color: var(--primary);
}
.btn-primary:hover, button[type='submit']:not(.icon-btn):hover {
    background: var(--primary-hover); border-color: var(--primary-hover); color: white;
}
.btn-secondary { background: var(--primary-light); color: var(--primary); border-color: #FADB9F; }
.btn-secondary:hover { background: #FDECC9; color: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #c93622; color: white; }
.btn-sm { padding: 4px 10px; font-size: .82rem; }

/* ===== Formulaires ===== */
input, select, textarea {
    width: 100%; padding: 10px 12px; border-radius: var(--radius);
    border: 2px solid var(--border-light); background: var(--bg-card); color: var(--text);
    font-family: var(--font); font-size: .9rem; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light);
}
select { cursor: pointer; }

/* Icon picker */
.icon-picker { margin: 8px 0; }
.icon-picker-search {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font); font-size: .85rem; margin-bottom: 8px; background: var(--bg-card);
    color: var(--text);
}
.icon-picker-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px;
    max-height: 200px; overflow-y: auto; padding: 8px; background: var(--bg); border-radius: var(--radius);
    border: 1px solid var(--border-light);
}
.icon-picker-btn {
    display: flex; align-items: center; justify-content: center;
    width: 100%; aspect-ratio: 1; border: 1px solid transparent; border-radius: 6px;
    background: var(--bg-card); cursor: pointer; font-size: 1.1rem; color: var(--text-secondary);
    transition: all .15s; padding: 0;
}
.icon-picker-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.icon-picker-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
textarea { min-height: 100px; resize: vertical; }
label { display: block; margin-bottom: 4px; font-weight: 500; font-size: .88rem; color: var(--text-secondary); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.checkbox-grid { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.checkbox-line { display: flex !important; align-items: center; gap: 8px; font-weight: 400; font-size: .9rem; color: var(--text-primary); cursor: pointer; margin-bottom: 0; }
.checkbox-line input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }

/* ===== Cards ===== */
.card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: var(--spacing-lg); box-shadow: var(--shadow);
}
.card-hover:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--spacing-lg); box-shadow: var(--shadow); }

/* ===== Unified Listing Card (companies, services) ===== */
.card-listing {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-md) 0; box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center;
    text-align: center; gap: 8px;
    transition: box-shadow .2s, transform .15s;
}
.card-listing:hover {
    box-shadow: var(--shadow-lg); transform: translateY(-2px);
}
.card-listing-left {
    width: 60px; height: 60px; border-radius: 50%;
    overflow: hidden; border: 2px solid var(--border-light);
    display: grid; place-items: center;
    background: #f8f9fa; flex-shrink: 0;
}
.card-listing-left img { width: 100%; height: 100%; object-fit: cover; }
.card-listing-body {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 6px; width: 100%;
}
.card-listing-body .card-title {
    margin: 0; font-size: .95rem; font-weight: 700; color: var(--text);
    line-height: 1.25;
}
.card-listing-body .card-title a { color: var(--text); text-decoration: none; }
.card-listing-body .card-title a:hover { color: var(--primary); }
.card-listing-body .card-meta {
    font-size: .78rem; color: var(--text-secondary);
    display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
}
.card-listing-body .card-desc {
    font-size: .82rem; color: var(--text-muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; margin: 0; line-height: 1.4;
}
.card-listing-stats {
    display: flex; gap: 12px; justify-content: center; width: 100%;
}
.card-listing-stats .stat {
    text-align: center;
}
.card-listing-stats .stat strong {
    display: block; font-size: 1rem; font-weight: 700; color: var(--text);
    line-height: 1.2;
}
.card-listing-stats .stat span {
    font-size: .68rem; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .02em;
}
.card-listing-footer {
    display: flex; gap: 6px; width: calc(100% + var(--spacing-md) * 2);
    margin: 4px calc(var(--spacing-md) * -1) 0;
    padding: 10px var(--spacing-md);
    border-top: 1px solid var(--border-light);
    background: var(--bg);
}
.card-listing-footer .btn { flex: 1; justify-content: center; font-size: .82rem; }

/* ===== Tags / Badges ===== */
.tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
    letter-spacing: .01em;
}
.tag-primary { background: var(--primary-light); color: var(--primary); }
.tag-success { background: #dcfce7; color: #16a34a; }
.tag-warning { background: #fef3c7; color: #d97706; }
.tag-danger { background: #fef2f2; color: #dc2626; }
.tag-info { background: #dbeafe; color: #2563eb; }

.badge-status { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; letter-spacing: .01em; }
.status-active, .status-confirmed, .status-delivered { background: #dcfce7; color: #16a34a; }
.status-pending, .status-processing { background: #fef3c7; color: #d97706; }
.status-inactive, .status-cancelled { background: #fef2f2; color: #dc2626; }
.status-shipped { background: #fef3c7; color: #d97706; }
.status-info { background: #dbeafe; color: #2563eb; }
.status-rejected { background: #fef2f2; color: #dc2626; }
.status-payment_verification { background: #fef3c7; color: #92400e; }
.status-accepted { background: #dbeafe; color: #1e40af; }

/* ===== Product media ===== */
.product-media {
    height: 180px; border-radius: var(--radius); background: #f8f9fa;
    display: grid; place-items: center; color: var(--text-muted); overflow: hidden; position: relative;
    margin-bottom: 12px;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }

.badge-top {
    position: absolute; top: 8px; left: 8px; z-index: 2;
    background: #E74C3C; color: #fff; font-size: .7rem; font-weight: 700;
    padding: 3px 8px; border-radius: 4px; text-transform: uppercase;
    letter-spacing: .3px;
}

/* ===== Star Ratings ===== */
.stars { display: inline-flex; gap: 2px; align-items: center; }
.stars i { font-size: .95rem; color: #ddd; cursor: default; }
.stars i.filled { color: #F5A623; }
.stars i.half { position: relative; }
.stars i.half:after { content: '\f005'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; left: 0; width: 50%; overflow: hidden; color: #F5A623; }
.stars .star-count { font-size: .78rem; color: var(--text-muted); margin-left: 4px; }
.stars-input { display: inline-flex; gap: 4px; flex-direction: row-reverse; }
.stars-input input { display: none; }
.stars-input label { font-size: 1.6rem; cursor: pointer; transition: color .15s, transform .15s; margin: 0; color: #ddd; }
.stars-input label::before { content: '\f005'; font-family: 'Font Awesome 6 Free'; font-weight: 400; }
.stars-input label:hover, .stars-input label:hover ~ label,
.stars-input input:checked ~ label { color: #F5A623; }
.stars-input input:checked ~ label::before { font-weight: 900; }
.stars-input label:hover::before { font-weight: 900; }
.stars-input label:hover { transform: scale(1.2); }

/* ===== Grilles ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--spacing-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--spacing-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--spacing-md); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--spacing-md); }
.dashboard-grid { display: grid; grid-template-columns: 240px 1fr; gap: var(--spacing-lg); margin-top: var(--spacing-lg); }
.dashboard-grid > div:last-child { min-width: 0; }
.catalog-grid { display: grid; grid-template-columns: 280px 1fr; gap: var(--spacing-lg); align-items: start; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border-light); text-align: start; vertical-align: middle; font-size: .9rem; }
th { font-weight: 600; color: var(--text-secondary); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
td { color: var(--text); }

/* ===== Alerts ===== */
.alert { padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #e6f0ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ===== Navigation ===== */
.atlassian-header {
    background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.site-marquee {
    background: #12355c; color: #fff; padding: 8px 0; overflow: hidden;
    font-size: .92rem; font-weight: 500; white-space: nowrap; text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.site-marquee .marquee-content {
    display: inline-flex; align-items: center; gap: 10px;
    padding-left: 100%; animation: siteMarquee 30s linear infinite;
}
.site-marquee img { height: 28px; width: auto; border-radius: 4px; flex-shrink: 0; }
@keyframes siteMarquee {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}
@media (max-width: 480px) {
    .site-marquee { font-size: .78rem; padding: 6px 0; gap: 6px; }
    .site-marquee .marquee-content { animation-duration: 25s; gap: 6px; }
    .site-marquee img { height: 20px; }
}
.atlassian-nav {
    display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 56px;
}
.atlassian-nav .brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.atlassian-nav .brand a { font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.atlassian-nav .brand a img { max-height: 32px; max-width: 100px; object-fit: contain; }
.nav-center { display: flex; gap: 4px; flex: 1; }
.nav-center a {
    padding: 6px 12px; border-radius: var(--radius); color: var(--text-secondary);
    font-size: .88rem; font-weight: 500; text-decoration: none; transition: background .15s, color .15s;
}
.nav-center a:hover, .nav-center a.active { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ===== Footer ===== */
.atlassian-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 40px 0; margin-top: 48px; }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-col h4 { margin: 0 0 12px; font-size: .9rem; font-weight: 600; color: var(--text); }
.footer-col p, .footer-col a { margin: 0 0 6px; font-size: .85rem; color: var(--text-secondary); display: block; }
.footer-col a:hover { color: var(--primary); text-decoration: none; }
.footer-bottom { border-top: 1px solid var(--border-light); margin-top: 24px; padding-top: 16px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; font-size: .82rem; color: var(--text-muted); }

/* ===== Hero ===== */
.hero-section {
    background: linear-gradient(135deg, #e6f0ff 0%, #f4f5f7 50%, #ecfdf5 100%);
    padding: 64px 0 48px; text-align: center; border-bottom: 1px solid var(--border-light);
}
.hero-section h1 { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 700; margin: 0 0 12px; line-height: 1.2; }
.hero-section p { font-size: 1.1rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto 24px; }
.hero-search { max-width: 560px; margin: 0 auto; display: flex; gap: 8px; }
.hero-search input { flex: 1; height: 48px; font-size: 1rem; }
.hero-search button { height: 48px; padding: 0 24px; font-size: 1rem; }

/* ===== Category tiles ===== */
.cat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.cat-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    padding: 28px 16px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow); cursor: pointer;
    transition: box-shadow .2s, transform .15s; text-align: center; color: var(--text); text-decoration: none;
}
.cat-tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; color: var(--text); }
.cat-tile i { font-size: 1.8rem; color: var(--primary); }
.cat-tile strong { font-size: .9rem; font-weight: 600; }
.cat-tile span { font-size: .8rem; color: var(--text-muted); }

/* ===== Product card ===== */
.product-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .2s, transform .15s;
    display: flex; flex-direction: column;
}
.product-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.product-card .product-media { height: 100px; border-radius: 0; margin: 0; }
.product-card-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.product-card-body h3 { margin: 0; font-size: .82rem; font-weight: 600; line-height: 1.2; }
.product-card-body .company-name { font-size: .75rem; color: var(--text-secondary); margin: 0; display: flex; align-items: center; gap: 4px; }
.price { font-size: .9rem; font-weight: 700; }
.product-card-body .price { margin: 1px 0; }
.product-card-actions { display: flex; gap: 4px; margin-top: auto; padding-top: 4px; }
.product-card .tag { align-self: flex-start; font-size: .7rem; padding: 2px 8px; }
.product-card .stars { gap: 1px; }
.product-card .stars i { font-size: .7rem; }

/* ===== Section Title ===== */
.section-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }

/* ===== Secteur Grid ===== */
.secteur-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.secteur-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; transition: box-shadow .2s, transform .15s; text-align: center; }
.secteur-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.secteur-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-light); display: grid; place-items: center; font-size: 1.2rem; color: var(--primary); flex-shrink: 0; }
.secteur-name { font-size: .82rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.secteur-count { font-size: .72rem; color: var(--text-muted); }

/* ===== Stats Bar ===== */
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin: 24px 20px; max-width: 800px; }
@media (min-width: 840px) { .stats-bar { margin: 24px auto; } }
.stats-bar .stat-item { text-align: center; padding: 20px 16px; border-inline-end: 1px solid var(--border); }
.stats-bar .stat-item:last-child { border-inline-end: none; }
.stats-bar .stat-item strong { display: block; font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.stats-bar .stat-item span { display: block; font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
@media (max-width: 600px) {
    .stats-bar { grid-template-columns: repeat(2, 1fr); border-radius: var(--radius); }
    .stats-bar .stat-item { padding: 14px 10px; }
    .stats-bar .stat-item:nth-child(2) { border-inline-end: none; }
    .stats-bar .stat-item:nth-child(3), .stats-bar .stat-item:nth-child(4) { border-block-start: 1px solid var(--border); }
    .stats-bar .stat-item strong { font-size: 1.15rem; }
}
@media (max-width: 360px) {
    .stats-bar { margin: 24px 10px; }
    .stats-bar .stat-item { padding: 10px 8px; }
    .stats-bar .stat-item strong { font-size: 1rem; }
    .stats-bar .stat-item span { font-size: .72rem; }
}

/* ===== Horizontal Scroll Strip ===== */
.h-scroll { display: flex; gap: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.h-scroll-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; min-width: 150px; max-width: 160px; flex-shrink: 0; scroll-snap-align: start; transition: box-shadow .2s, transform .15s; }
.h-scroll-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.h-scroll-logo, .h-scroll-img { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--bg); flex-shrink: 0; }
.h-scroll-logo img, .h-scroll-img img { width: 100%; height: 100%; object-fit: cover; }
.h-scroll-logo i, .h-scroll-img i { font-size: 1.2rem; color: var(--text-muted); }
.h-scroll-name { font-size: .82rem; font-weight: 600; color: var(--text); text-align: center; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; overflow-wrap: break-word; max-height: 2.4em; }
.h-scroll-meta { font-size: .72rem; color: var(--text-muted); text-align: center; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; }
.h-scroll-img { border-radius: var(--radius); width: 100%; height: 100px; }
.product-pop-card { min-width: 160px; max-width: 180px; padding: 10px; }
.product-pop-card .h-scroll-img { height: 80px; }
.product-pop-card .price { margin-top: auto; }

.tag-sm { font-size: .65rem; padding: 1px 6px; }

@media (max-width: 768px) {
    .secteur-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .secteur-card { padding: 12px 6px; }
}
@media (max-width: 480px) {
    .secteur-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .h-scroll { gap: 8px; }
    .h-scroll-card { min-width: 130px; max-width: 140px; padding: 10px; }
}

/* ===== Auth ===== */
.auth-section { display: flex; justify-content: center; align-items: center; min-height: 80vh; padding: 48px 20px; background: linear-gradient(rgba(18,53,92,.7),rgba(18,53,92,.8)) center/cover no-repeat; }
.auth-section.has-bg { background: linear-gradient(rgba(18,53,92,.7),rgba(18,53,92,.8)), var(--auth-bg-img) center/cover no-repeat; }
.auth-wrap { width: 100%; max-width: 480px; }
.auth-section .panel { background: rgba(255,255,255,.95); backdrop-filter: blur(6px); }
.auth-wrap-wide { max-width: 640px; }

/* ===== Sidebar ===== */
.sidebar { padding: 16px; position: sticky; top: 72px; }
.sidebar a { display: block; padding: 10px 12px; border-radius: var(--radius); color: var(--text-secondary); font-size: .88rem; font-weight: 500; text-decoration: none; transition: background .15s; }
.sidebar a:hover, .sidebar a.active { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.badge-count { display: inline-block; background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; margin-left: 6px; vertical-align: middle; line-height: 1.4; }

/* ===== Misc ===== */
.kpi { font-size: 1.8rem; font-weight: 700; color: var(--text); }
.kpi-label { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }
.logo-wrap { width: 56px; height: 56px; border-radius: var(--radius); background: #f8f9fa; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border-light); flex-shrink: 0; }
.logo-wrap img { width: 100%; height: 100%; object-fit: cover; }
.company-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
@media (max-width: 768px) { .company-line h1 { font-size:1.2rem; } }
@media (max-width: 480px) { .company-line { justify-content:center; text-align:center; }
    .company-line > .logo-wrap { width:64px!important;height:64px!important;font-size:1.6rem!important; }
    .company-line > .logo-wrap img { width:64px!important;height:64px!important; } }
@media (max-width: 360px) { .company-line { flex-direction:column; }
    .company-line h1 { font-size:1.1rem; } }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.notice { padding: 12px 16px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-secondary); font-size: .88rem; }
.ad-banner { padding: 16px; background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border); text-align: center; display:flex;flex-wrap:wrap;gap:16px;justify-content:center; }
.ad-banner .ad-item { display:block;flex:1 1 280px;max-width:100%;border-radius:var(--radius-md);overflow:hidden;transition:transform .2s,box-shadow .2s; }
.ad-banner .ad-item:hover { transform:translateY(-2px);box-shadow:0 4px 16px rgba(0,0,0,.12); }
.ad-banner .ad-item img { display:block;width:100%;height:auto; }

.ad-marquee-wrap { padding:24px 0;background:var(--bg-card);border-top:1px solid var(--border);border-bottom:1px solid var(--border); }
.ad-marquee { overflow:hidden;position:relative; }
.ad-marquee-track { display:flex;gap:32px;animation:adScroll 30s linear infinite;width:max-content; }
.ad-marquee-track:hover { animation-play-state:paused; }
.ad-marquee-item { flex-shrink:0;display:flex;align-items:center;border-radius:var(--radius-md);overflow:hidden;transition:transform .2s,box-shadow .2s; }
.ad-marquee-item:hover { transform:scale(1.05);box-shadow:0 4px 16px rgba(0,0,0,.12); }
.ad-marquee-item img { display:block;height:60px;width:auto;max-width:220px;object-fit:contain; }
@keyframes adScroll { 0% { transform:translateX(0); } 100% { transform:translateX(-50%); } }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--text-secondary); }
.small, small { font-size: .85rem; }
.chart-wrap { position: relative; width: 100%; max-height: 240px; }
.chart-wrap canvas { max-height: 240px; }

/* ===== Icon buttons ===== */
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius);
    border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
    cursor: pointer; transition: background .15s, color .15s, border-color .15s;
    font-size: .9rem; position: relative; text-decoration: none;
}
.icon-btn:hover { background: #f8f9fa; color: var(--text); border-color: #c1c7d0; text-decoration: none; }
.icon-btn-sm { width: 32px; height: 32px; font-size: .82rem; }
.icon-btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.icon-btn-primary:hover { background: var(--primary-hover); color: white; }
.icon-btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.icon-btn-danger:hover { background: #c93622; color: white; }
.icon-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px);
    left: 50%; transform: translateX(-50%); background: #172b4d; color: white;
    padding: 4px 8px; border-radius: 4px; font-size: .75rem; white-space: nowrap; z-index: 200;
}
.table-actions { display: flex; gap: 4px; flex-wrap: nowrap; align-items: center; white-space: nowrap; }
.v3-inline-form { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 0; background: none; border: none; box-shadow: none; white-space: nowrap; }
td { white-space: normal; }
td:has(.table-actions), td:has(.v3-inline-form) { white-space: nowrap; }

/* ===== Cycle toggle ===== */
.cycle-toggle { display: flex; gap: 12px; margin-bottom: 16px; }
.cycle-option {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 20px; border: 2px solid var(--border); border-radius: var(--radius-lg);
    background: #fff; cursor: pointer; font-weight: 600; font-size: .95rem; color: var(--text-secondary);
    transition: border-color .2s, background .2s, color .2s, box-shadow .2s;
}
.cycle-option input { display: none; }
.cycle-option:has(input:checked) {
    border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(245,166,35,.3);
}
.cycle-option:first-child:has(input:checked) { border-color: var(--primary); background: var(--primary); color: #fff; }
.cycle-option:last-child:has(input:checked) { border-color: var(--success); background: var(--success); color: #fff; box-shadow: 0 4px 12px rgba(126,211,33,.3); }
.cycle-option:hover { border-color: var(--primary); }

/* ===== Pagination ===== */
.pagination-wrap { display:flex;justify-content:center;margin-top:24px; }
.pagination { display:flex;gap:4px;list-style:none;padding:0;margin:0; }
.page-item { display:inline-flex; }
.page-item.disabled .page-link { opacity:.4;pointer-events:none; }
.page-link { display:flex;align-items:center;justify-content:center;min-width:36px;height:36px;padding:0 8px;border:1px solid var(--border);border-radius:var(--radius);background:#fff;color:var(--text);font-size:.88rem;text-decoration:none;transition:background .15s,border-color .15s; }
.page-link:hover { background:var(--bg);border-color:var(--primary);color:var(--primary);text-decoration:none; }
.page-item.active .page-link { background:var(--primary);border-color:var(--primary);color:#fff;font-weight:600; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .dashboard-grid, .catalog-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4, .stats-grid, .footer-grid { grid-template-columns: 1fr; }
    .atlassian-nav { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 4px; }
    .nav-center { order: 3; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .nav-center a { font-size: .82rem; padding: 6px 10px; white-space: nowrap; }
    .nav-right { margin-left: auto; flex-shrink: 1; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
    .nav-right .btn { font-size: .78rem; padding: 4px 8px; white-space: nowrap; }
    .chat-float { right: 12px; bottom: 16px; }
    .chat-robot { width: 48px; height: 48px; }
    .hero-section { padding: 40px 0 32px; }
    .cat-tiles { grid-template-columns: repeat(2, 1fr); }
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .card-listing-footer { width: calc(100% + 32px); margin: 4px -16px 0; padding: 10px 16px; }
    .container, .container-fluid { padding-left: 16px; padding-right: 16px; }
    .panel { padding: 16px; }
    .hero-section h1 { font-size: 1.5rem; }
    .section { padding-top: 20px; padding-bottom: 20px; }
}
@media (max-width: 600px) {
    .nav-right { flex-wrap: wrap; gap: 2px; }
    .nav-right .btn { font-size: .72rem; padding: 3px 6px; }
    .atlassian-nav .brand strong { font-size: .9rem; }
    .atlassian-nav .brand a img { max-height: 26px; max-width: 80px; }
}
@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
    .cat-tiles { grid-template-columns: 1fr 1fr; }
    .hero-search { flex-direction: column; }
    .hero-search input, .hero-search .hero-btn { width: 100%; border-radius: var(--radius)!important; }
    .card-listing-footer { flex-direction: column; gap: 6px; }
    .card-listing-footer .btn { width: 100%; }
    .map-wrap iframe { height: 200px!important; }
    .panel { padding: 14px; }
    .atlassian-nav { gap: 2px; }
    .nav-right { width: 100%; justify-content: flex-end; margin-left: 0; gap: 2px; }
    .nav-right .btn { font-size: .68rem; padding: 2px 6px; }
}
@media (max-width: 360px) {
    .map-wrap iframe { height: 160px!important; }
    .panel { padding: 12px; }
    .container, .container-fluid { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
    .cat-tiles { grid-template-columns: 1fr 1fr; }
    .hero-search { flex-direction: column; }
    .hero-search input, .hero-search .hero-btn { width: 100%; border-radius: var(--radius)!important; }
    .card-listing-footer { flex-direction: column; gap: 6px; }
    .card-listing-footer .btn { width: 100%; }
    .map-wrap iframe { height: 200px!important; }
    .panel { padding: 14px; }
}
@media (max-width: 360px) {
    .map-wrap iframe { height: 160px!important; }
    .panel { padding: 12px; }
    .container, .container-fluid { padding-left: 10px; padding-right: 10px; }
}

/* RTL overrides */
[dir="rtl"] .nav-right { margin-left: 0; margin-right: auto; }
[dir="rtl"] .v3-tooltip::after { left: auto; right: 50%; translate: 50% 0; }
[dir="rtl"] .stat-item { border-right: none; border-left: 1px solid var(--border-light); }
[dir="rtl"] .stat-item:last-child { border-left: none; }
[dir="rtl"] .marquee { mask-image: linear-gradient(-90deg, transparent, #000 8%, #000 92%, transparent); }
[dir="rtl"] .marquee-track { animation-name: marquee-rtl; }
@keyframes marquee-rtl { from { transform: translateX(0); } to { transform: translateX(50%); } }
[dir="rtl"] .hero-search input { border-radius: 0 var(--radius) var(--radius) 0; }
[dir="rtl"] .hero-search .hero-btn { border-radius: var(--radius) 0 0 var(--radius); }
[dir="rtl"] .catalog-grid .sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .toast { left: auto; right: 20px; }
.num-ltr, [dir="rtl"] .num-ltr { direction: ltr; unicode-bidi: embed; display: inline; }
[dir="rtl"] .kpi, [dir="rtl"] .stat-item strong, [dir="rtl"] .price { direction: ltr; unicode-bidi: embed; display: inline-block; }
[dir="rtl"] td, [dir="rtl"] th { text-align: right; }
[dir="rtl"] td.num, [dir="rtl"] th.num { text-align: left; direction: ltr; }
@media (max-width: 768px) {
    [dir="rtl"] .nav-right { margin-right: 0; }
}

/* ── Floating Chat Widget ── */
.chat-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.chat-robot {
    width: 64px;
    height: 64px;
    cursor: pointer;
    animation: robot-bounce 3s ease-in-out infinite;
    transition: opacity .3s, transform .3s;
}
.chat-robot:hover {
    animation-play-state: paused;
    transform: scale(1.15);
}
.chat-robot svg {
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: block;
}
.chat-panel.open ~ .chat-robot { opacity: 0 !important; animation: none !important; }
@keyframes robot-bounce {
    0%, 100% { transform: translateY(0); }
    15% { transform: translateY(-8px); }
    30% { transform: translateY(-3px); }
    45% { transform: translateY(-6px); }
    60% { transform: translateY(-1px); }
    75%, 100% { transform: translateY(0); }
}
[dir="rtl"] .chat-float {
    right: auto;
    left: 24px;
    align-items: flex-start;
}
.chat-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    box-shadow: 0 4px 16px rgba(245,166,35,.4);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(245,166,35,.55);
}
.chat-btn .badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: .7rem;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: 0 5px;
}
.chat-panel {
    display: none;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    overflow: hidden;
}
.chat-panel.open {
    display: flex;
    position: fixed;
    top: 60px;
    bottom: 100px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: auto;
    max-height: none;
    z-index: 10000;
}

[dir="rtl"] .chat-panel.open {
    right: auto;
    left: 24px;
}
.chat-panel-header {
    background: var(--primary);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-panel-header h3 {
    margin: 0;
    font-size: .95rem;
    font-weight: 600;
}
.chat-panel-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: .8;
}
.chat-panel-header button:hover { opacity: 1; }
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg);
}
.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: .85rem;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-line;
    animation: fadeIn .25s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot {
    background: var(--bg-card);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: var(--text);
}
.chat-msg.user {
    background: var(--primary);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-msg.admin {
    background: #12355c;
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.chat-msg .msg-time {
    font-size: .65rem;
    opacity: .6;
    margin-top: 4px;
    display: block;
}
.chat-msg.user .msg-time { text-align: right; }
.chat-panel-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: var(--bg-card);
}
.chat-panel-footer input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: .85rem;
    outline: none;
    font-family: var(--font);
}
.chat-panel-footer input:focus {
    border-color: var(--primary);
}
.chat-panel-footer button {
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: .9rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-panel-footer button:hover {
    background: var(--primary-hover);
}
.chat-typing {
    font-size: .78rem;
    color: var(--text-muted);
    padding: 4px 14px;
    font-style: italic;
}
.chat-human-btn {
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: .78rem;
    cursor: pointer;
    align-self: center;
    margin: 4px 0;
    transition: background .2s;
}
.chat-human-btn:hover {
    background: #6abf1d;
}

/* ── Admin Chat Page ── */
.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    min-height: 500px;
}
.chat-sidebar {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.chat-sidebar-list {
    flex: 1;
    overflow-y: auto;
}
.chat-sidebar-item {
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background .15s;
}
.chat-sidebar-item:hover { background: var(--primary-light); }
.chat-sidebar-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.chat-sidebar-item .conv-name { font-weight: 600; font-size: .85rem; }
.chat-sidebar-item .conv-preview { font-size: .78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sidebar-item .conv-status { font-size: .7rem; display: inline-block; padding: 1px 7px; border-radius: 10px; margin-top: 4px; }
.chat-sidebar-item .conv-status.bot { background: var(--primary-light); color: var(--primary); }
.chat-sidebar-item .conv-status.active { background: #e6f7e6; color: var(--success); }
.chat-sidebar-item .conv-status.human_requested { background: #fff3e0; color: var(--warning); }
.chat-sidebar-item .conv-status.closed { background: var(--border-light); color: var(--text-muted); }
.chat-sidebar-item .unread-badge { float: right; background: var(--danger); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .7rem; font-weight: 700; }
.chat-view {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 500px;
}
.chat-view-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-view-header h3 { margin: 0; font-size: .95rem; }
.chat-view-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg);
}
.chat-view-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.chat-view-footer input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: .85rem;
    outline: none;
    font-family: var(--font);
}
.chat-view-footer input:focus { border-color: var(--primary); }
.chat-view-footer button {
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    padding: 8px 18px;
    cursor: pointer;
    font-size: .85rem;
}
.chat-view-footer button:hover { background: var(--primary-hover); }

@media (max-width: 768px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
    .chat-panel.open {
        top: 12px;
        bottom: 80px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }
}

/* Product image management */
.product-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}
.product-images-preview .image-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    text-align: center;
    background: #fafafa;
}
.product-images-preview .image-item img {
    display: block;
    border-radius: 4px;
    object-fit: cover;
    max-height: 100px;
}
.product-images-preview .image-item label {
    display: block;
    margin-top: 4px;
    font-size: .75rem;
    cursor: pointer;
    color: var(--danger);
}
.product-images-preview .image-item input[type="checkbox"] {
    margin-right: 4px;
    vertical-align: middle;
}
.text-center { text-align: center; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; }


/* Bootstrap compatibility */
.container { max-width: 1240px; padding: 0 20px; }
.container-fluid { padding: 0 20px; }
body { font-family: 'Inter', sans-serif; }
