/* ==========================================================================
   منصة عُقده — Static Stylesheet (No frameworks, no build step)
   Design tokens ported from design_guidelines.json + tailwind theme
   ========================================================================== */

/* Web fonts are optional: if offline, the system fallbacks below keep the
   Arabic typography correct (Tahoma / Segoe UI are RTL-safe on Windows). */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --background: #fcfbf9;
    --foreground: #111827;
    --card: #ffffff;
    --primary: #064e3b;
    --primary-fg: #ffffff;
    --secondary: #d97706;
    --muted: #f3f4f6;
    --muted-fg: #6b7280;
    --border: #e5e7eb;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;

    --emerald-50: #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-200: #a7f3d0;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-800: #065f46;
    --emerald-900: #064e3b;

    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-900: #0f172a;

    --radius: 0.5rem;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, .08);
    --shadow-xl: 0 20px 45px rgba(0, 0, 0, .12);
    --container: 1280px;
}

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

html { direction: rtl; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--foreground);
    font-family: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 { margin: 0; line-height: 1.25; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }

.mono, .num { font-family: 'JetBrains Mono', 'Courier New', monospace; }

/* ---------- Layout helpers ---------- */
.container { max-width: var(--container); margin-inline: auto; padding-inline: 24px; }
.container-sm { max-width: 768px; margin-inline: auto; padding-inline: 24px; }
.container-md { max-width: 1000px; margin-inline: auto; padding-inline: 24px; }

.section { padding-block: 64px; }
.section-sm { padding-block: 40px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.flex { display: flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; min-width: 0; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; direction: ltr; }
.hidden { display: none !important; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; } .mb-10 { margin-bottom: 40px; } .mb-12 { margin-bottom: 48px; }

/* ---------- Typography ---------- */
.h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -.02em; }
.h2 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); font-weight: 800; }
.h3 { font-size: 1.25rem; font-weight: 700; }
.lead { font-size: 1.05rem; color: var(--slate-600); line-height: 1.9; }
.small { font-size: .875rem; color: var(--muted-fg); }
.tiny { font-size: .75rem; color: var(--muted-fg); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--muted-fg); }
.text-emerald { color: var(--emerald-700); }
.text-amber { color: var(--secondary); }
.text-error { color: var(--error); }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding-inline: 20px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--primary);
    color: var(--primary-fg);
    font-weight: 600;
    font-size: .95rem;
    box-shadow: var(--shadow-sm);
    transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.btn:hover { background: #053d2e; }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-outline { background: transparent; color: var(--slate-700); border-color: var(--border); box-shadow: none; }
.btn-outline:hover { background: var(--muted); }

.btn-emerald-outline { background: transparent; color: var(--emerald-700); border-color: var(--emerald-700); box-shadow: none; }
.btn-emerald-outline:hover { background: var(--emerald-50); }

.btn-white { background: #fff; color: var(--emerald-800); }
.btn-white:hover { background: var(--emerald-50); }

.btn-amber { background: var(--secondary); }
.btn-amber:hover { background: #b45309; }

.btn-danger { background: var(--error); }
.btn-danger:hover { background: #b91c1c; }

.btn-lg { height: 52px; padding-inline: 28px; font-size: 1rem; }
.btn-sm { height: 34px; padding-inline: 12px; font-size: .8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:disabled:hover { background: var(--primary); }
.btn-outline:disabled:hover { background: transparent; }

.link { color: var(--primary); background: none; border: none; padding: 0; }
.link:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}
.card-hover { transition: box-shadow .2s ease, border-color .2s ease; }
.card-hover:hover { box-shadow: var(--shadow-md); border-color: var(--emerald-200); }
.card-body { padding: 20px; }
.card-body-lg { padding: 32px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.label { display: block; margin-bottom: 8px; font-size: .875rem; font-weight: 500; text-align: right; }
.input, .select, .textarea {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--foreground);
    font-family: inherit;
    font-size: .95rem;
    text-align: right;
    transition: border-color .15s, box-shadow .15s;
}
.select { appearance: none; padding-inline-start: 36px; background-image: none; }
.textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.8; }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(6, 78, 59, .12);
}
.input-ltr { direction: ltr; text-align: left; }
.input-wrap { position: relative; }
.input-wrap .icon {
    position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: var(--muted-fg); pointer-events: none;
}
.input-wrap .input, .input-wrap .select { padding-inline-end: 40px; }
.input-wrap .suffix {
    position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%);
    font-size: .75rem; color: var(--muted-fg); pointer-events: none;
}
.hint { margin-top: 6px; font-size: .75rem; color: var(--muted-fg); }
.error-text { margin-top: 6px; font-size: .75rem; color: var(--error); display: none; }
.field.invalid .input, .field.invalid .textarea, .field.invalid .select { border-color: var(--error); }
.field.invalid .error-text { display: block; }

.checkbox-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; background: var(--muted); border-radius: var(--radius);
}
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.checkbox-row label { font-size: .875rem; margin: 0; cursor: pointer; line-height: 1.8; }

/* OTP boxes */
.otp-wrap { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; justify-content: center; }
.otp-group { display: flex; gap: 8px; direction: ltr; }
.otp-box {
    width: 44px; height: 50px; text-align: center; font-size: 1.25rem; font-weight: 700;
    border: 1px solid var(--border); border-radius: 8px; font-family: 'JetBrains Mono', monospace;
    background: #fff; color: var(--foreground);
}
.otp-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(6, 78, 59, .12); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 4px 12px; border-radius: 6px;
    font-size: .75rem; font-weight: 500; border: 1px solid; white-space: nowrap;
}
.badge-amber { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge-green { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge-blue  { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.badge-red   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.badge-orange{ background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.badge-slate { background: var(--slate-100); color: var(--slate-700); border-color: var(--slate-200); }

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 999px;
    background: var(--emerald-50); color: var(--emerald-700);
    font-size: .78rem; font-weight: 500; border: 1px solid var(--emerald-100);
}

/* ---------- Site header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--slate-100);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 12px; position: relative; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand-mark {
    width: 44px; height: 44px; border-radius: 10px; background: var(--primary);
    display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0;
}
.brand-name { font-weight: 800; color: var(--emerald-800); font-size: 1.1rem; line-height: 1.2; }
.brand-sub { font-size: .7rem; color: var(--slate-500); line-height: 1.2; }

.main-nav { display: flex; align-items: center; gap: 24px; font-size: .9rem; }
.main-nav a { color: var(--slate-700); padding-bottom: 4px; border-bottom: 2px solid transparent; transition: color .15s; }
.main-nav a:hover { color: var(--emerald-700); }
.main-nav a.active { color: var(--emerald-700); font-weight: 700; border-bottom-color: var(--emerald-700); }

.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px; color: var(--slate-700); }

/* ---------- Footer ---------- */
.site-footer { background: var(--emerald-900); color: #d1fae5; padding-block: 48px; margin-top: 48px; }
.site-footer h4 { color: #fff; margin-bottom: 12px; }
.site-footer a:hover { color: #fff; }
.site-footer .cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.site-footer li { margin-bottom: 8px; font-size: .9rem; }
.site-footer .bottom {
    margin-top: 40px; padding-top: 24px; border-top: 1px solid #065f46;
    text-align: center; font-size: .75rem; color: #6ee7b7;
}

/* ---------- Icons ---------- */
.icon-circle {
    width: 64px; height: 64px; border-radius: 999px; background: var(--emerald-50);
    display: flex; align-items: center; justify-content: center; margin-inline: auto;
    color: var(--emerald-700);
}
.icon-sq {
    width: 40px; height: 40px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: rgba(6, 78, 59, .1); color: var(--primary);
}
.icon-sq.amber { background: #fef3c7; color: #b45309; }
.icon-sq.green { background: #d1fae5; color: #047857; }
.icon-sq.lg { width: 56px; height: 56px; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.i-sm { width: 16px; height: 16px; }
svg.i-lg { width: 30px; height: 30px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; padding-inline: 8px; }
.tab {
    background: none; border: none; padding: 12px 16px;
    color: var(--muted-fg); font-size: .9rem; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--foreground); }
.tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
#toast-host {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center;
    pointer-events: none; width: min(92vw, 420px);
}
.toast {
    width: 100%; padding: 12px 16px; border-radius: 10px; background: #fff;
    border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    font-size: .875rem; display: flex; align-items: center; gap: 10px;
    animation: toastIn .25s ease;
}
.toast.success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.toast.error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.toast.info { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 90;
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: #fff; border-radius: 14px; width: min(100%, 760px);
    max-height: 86vh; display: flex; flex-direction: column; box-shadow: var(--shadow-xl);
}
.modal-head { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-close { background: none; border: none; font-size: 1.5rem; line-height: 1; color: var(--muted-fg); padding: 0 6px; }
.modal-body section { margin-bottom: 22px; }
.modal-body section h3 { color: var(--primary); font-size: 1.05rem; margin-bottom: 8px; }
.modal-body section li { font-size: .875rem; margin-bottom: 4px; }

/* ---------- Stepper ---------- */
.stepper { display: flex; align-items: center; gap: 6px; margin-bottom: 28px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; }
.step-dot {
    width: 30px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
    background: var(--muted); color: var(--muted-fg); font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.step.active .step-dot { background: var(--primary); color: #fff; }
.step.done .step-dot { background: var(--emerald-600); color: #fff; }
.step-label { font-size: .8rem; color: var(--muted-fg); }
.step.active .step-label { color: var(--primary); font-weight: 600; }
.step-line { width: 28px; height: 2px; background: var(--border); }

/* ---------- Accordion (FAQ) ---------- */
details.faq { background: #fff; border: 1px solid var(--slate-100); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; }
details.faq summary {
    cursor: pointer; font-weight: 700; display: flex; align-items: center; justify-content: space-between;
    list-style: none; gap: 12px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary svg { transition: transform .2s ease; }
details.faq[open] summary svg { transform: rotate(-90deg); }
details.faq p { margin-top: 12px; font-size: .9rem; color: var(--slate-600); line-height: 1.9; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--border); }
table.data th { background: var(--muted); font-weight: 600; font-size: .8rem; color: var(--slate-600); white-space: nowrap; }
table.data tbody tr:hover { background: #fafafa; }

/* ---------- Dashboard item rows ---------- */
.item-row {
    display: grid; grid-template-columns: 5fr 4fr 2fr 1fr; align-items: center; gap: 12px;
    padding: 16px; border-bottom: 1px solid var(--border); transition: background .15s;
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: rgba(243, 244, 246, .5); }
.item-title { font-weight: 500; font-size: .95rem; }
.item-sub { font-size: .75rem; color: var(--muted-fg); }
.item-amount { font-weight: 700; color: var(--primary); text-align: center; }
.avatar {
    width: 40px; height: 40px; border-radius: 999px; background: rgba(6, 78, 59, .1);
    display: flex; align-items: center; justify-content: center; color: var(--primary);
    font-weight: 700; flex-shrink: 0;
}

/* ---------- Utility blocks ---------- */
.empty-state { padding: 64px 20px; text-align: center; color: var(--muted-fg); }
.divider { height: 1px; background: var(--border); margin-block: 20px; }

.notice {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 16px; border-radius: 12px; border: 1px solid;
}
.notice-amber { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.notice-green { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.notice-info  { background: #fff; border-color: var(--border); color: var(--foreground); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .container, .container-sm, .container-md { padding-inline: 16px; }
    .section { padding-block: 44px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .site-footer .cols { grid-template-columns: 1fr; }
    .main-nav {
        display: none; position: absolute; top: 100%; inset-inline: 0;
        background: #fff; border-bottom: 1px solid var(--border);
        flex-direction: column; align-items: stretch; gap: 0; padding: 8px 16px;
        box-shadow: var(--shadow-md);
    }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 12px 0; border-bottom: 1px solid var(--slate-100); }
    .main-nav a.active { border-bottom-color: var(--slate-100); }
    .nav-toggle { display: inline-flex; }
    .hide-mobile { display: none !important; }
    .card-body-lg { padding: 20px; }
    .item-row { grid-template-columns: 1fr; gap: 10px; }
    .item-amount { text-align: right; }
    .otp-box { width: 38px; height: 46px; font-size: 1.05rem; }
}
