:root {
    --ow-green: #25D366;
    --ow-green-dark: #128C7E;
    --ow-teal: #075E54;
    --ow-accent: #34B7F1;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-soft: 0 10px 30px rgba(2, 8, 23, .08);
    --shadow-card: 0 4px 18px rgba(2, 8, 23, .06);
    --transition: .25s cubic-bezier(.4, 0, .2, 1);
}

[data-bs-theme="light"] {
    --bg: #f6f8fb;
    --bg-elev: #ffffff;
    --bg-card: #ffffff;
    --border: rgba(2, 8, 23, .08);
    --text: #0e1726;
    --text-soft: #5b677d;
    --navbar-bg: rgba(255, 255, 255, .9);
}

[data-bs-theme="dark"] {
    --bg: #0a0f1a;
    --bg-elev: #111a2b;
    --bg-card: #131d30;
    --border: rgba(255, 255, 255, .09);
    --text: #e8edf5;
    --text-soft: #9aa7bd;
    --navbar-bg: rgba(13, 20, 33, .9);
}

html, body { min-height: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Cairo', sans-serif;
    display: flex;
    flex-direction: column;
}
[dir="rtl"] body { font-family: 'Cairo', 'Inter', sans-serif; }
main { flex: 1 0 auto; }

a { color: var(--ow-green-dark); }
.text-muted { color: var(--text-soft) !important; }

/* ===== Navbar ===== */
.ow-navbar {
    background: var(--navbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.ow-navbar .nav-link { color: var(--text); font-weight: 500; }
.ow-navbar .nav-link:hover { color: var(--ow-green-dark); }
.btn-icon {
    border: 1px solid var(--border);
    background: var(--bg-elev);
    color: var(--text);
    border-radius: 10px;
    padding: .35rem .55rem;
    display: inline-flex;
    align-items: center;
}
.btn-icon:hover { color: var(--ow-green-dark); }
.theme-light-icon { display: none; }
[data-bs-theme="dark"] .theme-dark-icon { display: none; }
[data-bs-theme="dark"] .theme-light-icon { display: inline; }

/* ===== Buttons ===== */
.btn-success { background: var(--ow-green); border-color: var(--ow-green); color: #053b29; font-weight: 600; }
.btn-success:hover { background: var(--ow-green-dark); border-color: var(--ow-green-dark); color: #fff; }
.btn-primary { background: var(--ow-green-dark); border-color: var(--ow-green-dark); }
.btn-primary:hover { background: var(--ow-teal); border-color: var(--ow-teal); }
.btn-outline-primary { color: var(--ow-green-dark); border-color: var(--ow-green-dark); }
.btn-outline-primary:hover { background: var(--ow-green-dark); border-color: var(--ow-green-dark); }

/* ===== Cards / surfaces ===== */
.card, .ow-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.ow-surface { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }

/* ===== Hero ===== */
.ow-hero {
    background:
        radial-gradient(1100px 480px at 80% -10%, rgba(37, 211, 102, .16), transparent 60%),
        radial-gradient(900px 420px at 0% 0%, rgba(52, 183, 241, .12), transparent 55%);
    padding: 5rem 0 4rem;
}
.ow-hero h1 { font-weight: 800; font-size: clamp(2rem, 4.5vw, 3.4rem); line-height: 1.15; }
.ow-badge {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(37, 211, 102, .14); color: var(--ow-green-dark);
    border: 1px solid rgba(37, 211, 102, .3);
    padding: .35rem .8rem; border-radius: 999px; font-weight: 600; font-size: .85rem;
}
.ow-hero-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-soft);
    padding: 1.5rem;
}
.chat-bubble {
    background: rgba(37, 211, 102, .12); border-radius: 14px;
    padding: .6rem .9rem; margin-bottom: .6rem; max-width: 85%;
}
.chat-bubble.me { background: var(--ow-green); color: #053b29; margin-inline-start: auto; }

/* ===== Sections ===== */
.section { padding: 4rem 0; }
.section-title { font-weight: 800; font-size: clamp(1.6rem, 3vw, 2.3rem); }
.feature-icon {
    width: 52px; height: 52px; border-radius: 13px;
    display: grid; place-items: center; font-size: 1.4rem;
    background: rgba(37, 211, 102, .14); color: var(--ow-green-dark);
}
.stat-num { font-weight: 800; font-size: 2rem; color: var(--ow-green-dark); }

/* ===== Pricing ===== */
.price-card { position: relative; transition: var(--transition); height: 100%; }
.price-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-soft); }
.price-card.popular { border-color: var(--ow-green); border-width: 2px; }
.price-amount { font-weight: 800; font-size: 2.6rem; }
.price-card .ribbon {
    position: absolute; top: -12px; inset-inline-end: 18px;
    background: var(--ow-green); color: #053b29; font-weight: 700;
    padding: .2rem .7rem; border-radius: 999px; font-size: .78rem;
}
.feat-list { list-style: none; padding: 0; margin: 0; }
.feat-list li { padding: .35rem 0; display: flex; align-items: center; gap: .5rem; }
.feat-list .bi { color: var(--ow-green); }

/* ===== CTA ===== */
.ow-cta {
    background: linear-gradient(120deg, var(--ow-teal), var(--ow-green-dark));
    color: #fff; border-radius: var(--radius-lg); padding: 3rem;
}

/* ===== Dashboard ===== */
.stat-tile { padding: 1.2rem 1.4rem; }
.stat-tile .label { color: var(--text-soft); font-size: .85rem; }
.stat-tile .value { font-weight: 800; font-size: 1.8rem; }
.ow-sidebar .list-group-item { background: transparent; border: none; border-radius: 10px; color: var(--text); }
.ow-sidebar .list-group-item.active { background: rgba(37, 211, 102, .14); color: var(--ow-green-dark); font-weight: 600; }

.table { color: var(--text); }
.form-control, .form-select { background: var(--bg-elev); border-color: var(--border); color: var(--text); }
.form-control:focus, .form-select:focus { border-color: var(--ow-green); box-shadow: 0 0 0 .2rem rgba(37, 211, 102, .2); background: var(--bg-elev); color: var(--text); }
.code-pill {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
    padding: .3rem .6rem; word-break: break-all;
}

/* ===== Footer ===== */
.ow-footer { background: var(--bg-elev); border-top: 1px solid var(--border); flex-shrink: 0; }
.footer-link { color: var(--text-soft); text-decoration: none; margin-inline-start: 1.2rem; }
.footer-link:hover { color: var(--ow-green-dark); }

.qr-box { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; border: 1px solid var(--border); }
.badge-soft { background: rgba(37,211,102,.15); color: var(--ow-green-dark); }

/* ===== Admin dashboard ===== */
.kpi-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 1rem; }
.kpi-green { background: rgba(37,211,102,.15); color: var(--ow-green-dark); }
.kpi-blue { background: rgba(52,183,241,.15); color: var(--ow-accent); }
.kpi-amber { background: rgba(240,173,78,.18); color: #c8861a; }
.trend-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.trend-bar-wrap { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.trend-count { font-size: .72rem; color: var(--text-soft); margin-bottom: 2px; }
.trend-bar { width: 70%; max-width: 46px; background: linear-gradient(180deg, var(--ow-green), var(--ow-green-dark)); border-radius: 6px 6px 0 0; transition: height var(--transition); }
.trend-label { font-size: .72rem; color: var(--text-soft); margin-top: 6px; }
.border-bottom-soft { border-bottom: 1px solid var(--border); }
.border-bottom-soft:last-child { border-bottom: none; }

/* ===== Chat thread ===== */
.chat-thread { max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.chat-row { display: flex; }
.chat-row.mine { justify-content: flex-end; }
.chat-row.theirs { justify-content: flex-start; }
.chat-msg { max-width: 78%; padding: .5rem .75rem; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); }
.chat-msg.me { background: var(--ow-green); color: #053b29; border-color: transparent; }
.chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-meta { font-size: .68rem; opacity: .7; text-align: end; margin-top: 2px; display: flex; gap: 4px; justify-content: flex-end; align-items: center; }

/* ===== API docs ===== */
.code-wrap { position: relative; margin-bottom: 1rem; }
.code-block {
    background: #0d1526; color: #d6e2f5; border: 1px solid var(--border);
    border-radius: 10px; padding: 1rem 1.1rem; margin: 0; overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; line-height: 1.55;
    text-align: left; direction: ltr;
}
[data-bs-theme="light"] .code-block { background: #0f172a; color: #e2e8f0; }
.code-wrap .copy-pre { position: absolute; top: 8px; inset-inline-end: 8px; background: rgba(255,255,255,.08); color: #cbd5e1; border-color: transparent; }
.code-wrap .copy-pre:hover { color: #fff; }
.doc-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(37,211,102,.15); color: var(--ow-green-dark); font-size: .85rem; margin-inline-end: 6px; }
.doc-label { font-weight: 600; font-size: .8rem; color: var(--text-soft); margin: .8rem 0 .35rem; text-transform: uppercase; letter-spacing: .03em; }
.method { font-family: ui-monospace, monospace; font-weight: 700; font-size: .72rem; padding: .12rem .5rem; border-radius: 6px; }
.method.post { background: rgba(37,211,102,.18); color: var(--ow-green-dark); }
.method.get { background: rgba(52,183,241,.18); color: #1c7ea3; }

/* ===== Impersonation bar ===== */
.impersonation-bar { background: linear-gradient(90deg, var(--ow-teal), var(--ow-green-dark)); color: #fff; padding: .5rem 0; font-size: .9rem; }
.impersonation-bar .btn-light { font-weight: 600; }
