/* ============================
   SoonaPay Plus — Merchant Dashboard
   dashboard.soonapayplus.com
   namespace: dash-*
   ============================ */
:root {
    --dash-primary: #7C3AED;
    --dash-primary-dark: #6D28D9;
    --dash-primary-light: #8B5CF6;
    --dash-bg: #F4F4F9;
    --dash-card: #FFFFFF;
    --dash-border: #E8E8F0;
    --dash-text: #1E1B2E;
    --dash-muted: #7A7790;
    --dash-ok: #10B981;
    --dash-warn: #F59E0B;
    --dash-err: #EF4444;
    --dash-radius: 16px;
    --dash-font: 'Cairo', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }
body { font-family: var(--dash-font); background: var(--dash-bg); color: var(--dash-text); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- Auth ---------- */
.dash-auth-body {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(1200px 600px at 80% -10%, rgba(124,58,237,.14), transparent 60%),
                radial-gradient(900px 500px at 10% 110%, rgba(139,92,246,.10), transparent 55%),
                var(--dash-bg);
    padding: 24px;
}
.dash-auth-wrap { width: 100%; max-width: 420px; }
.dash-auth-card {
    background: var(--dash-card);
    border: 1px solid var(--dash-border);
    border-radius: 24px;
    padding: 40px 36px 32px;
    box-shadow: 0 20px 60px -20px rgba(124,58,237,.18);
}
.dash-auth-brand { text-align: center; margin-bottom: 28px; }
.dash-auth-logo {
    height: 44px; margin-bottom: 16px;
    filter: brightness(0) invert(38%) sepia(12%) saturate(800%) hue-rotate(230deg) brightness(70%);
}
.dash-auth-title { font-size: 24px; font-weight: 800; color: var(--dash-text); }
.dash-auth-sub { font-size: 13px; color: var(--dash-muted); margin-top: 6px; }

.dash-alert { padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.dash-alert-err { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.dash-alert-ok { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }

.dash-auth-form { display: flex; flex-direction: column; gap: 18px; }
.dash-field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; color: var(--dash-text); }
.dash-input-wrap { position: relative; display: flex; align-items: center; }
.dash-input-wrap > svg {
    position: absolute; right: 14px; width: 19px; height: 19px;
    color: #A5A0BC; pointer-events: none;
}
.dash-input-wrap input {
    width: 100%; height: 50px;
    border: 1.5px solid var(--dash-border);
    border-radius: 14px;
    padding: 0 44px 0 44px;
    font-size: 15px;
    background: #FBFBFE;
    transition: border-color .2s, box-shadow .2s;
}
.dash-input-wrap input:focus {
    outline: none; border-color: var(--dash-primary-light);
    box-shadow: 0 0 0 4px rgba(139,92,246,.12);
    background: #fff;
}
.dash-eye {
    position: absolute; left: 12px;
    width: 34px; height: 34px; border: 0; background: none;
    display: flex; align-items: center; justify-content: center;
    color: #A5A0BC; border-radius: 8px;
}
.dash-eye:hover { color: var(--dash-primary); background: rgba(124,58,237,.07); }
.dash-eye svg { width: 19px; height: 19px; }

.dash-btn {
    border: 0; border-radius: 14px;
    font-size: 15px; font-weight: 700;
    padding: 14px 24px;
    transition: transform .15s, box-shadow .2s, background .2s;
}
.dash-btn-primary {
    background: linear-gradient(135deg, var(--dash-primary) 0%, var(--dash-primary-light) 100%);
    color: #fff; width: 100%; margin-top: 4px;
    box-shadow: 0 8px 20px -8px rgba(124,58,237,.5);
}
.dash-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(124,58,237,.55); }
.dash-btn-primary:active { transform: translateY(0); }
.dash-btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.dash-btn-ghost { background: none; color: var(--dash-muted); font-weight: 600; padding: 8px 14px; font-size: 13px; }
.dash-btn-ghost:hover { color: var(--dash-err); }

.dash-auth-note {
    display: flex; gap: 8px; align-items: flex-start;
    font-size: 12px; color: var(--dash-muted);
    margin-top: 22px; line-height: 1.8;
}
.dash-auth-note svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 3px; color: var(--dash-ok); }

.dash-auth-foot {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 24px; font-size: 12px; color: var(--dash-muted);
}
.dash-auth-foot-logo { height: 18px; opacity: .4; filter: brightness(0) grayscale(1); }

/* ---------- App shell ---------- */
.dash-topnav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255,255,255,.9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--dash-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; height: 64px;
}
.dash-topnav-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 16px; }
.dash-topnav-brand img { height: 32px; filter: brightness(0) invert(38%) sepia(12%) saturate(800%) hue-rotate(230deg) brightness(70%); }
.dash-topnav-user { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; }
.dash-merchant-logo { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; border: 1px solid var(--dash-border); }

.dash-main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px; display: flex; flex-direction: column; gap: 24px; }

.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.dash-stat {
    background: var(--dash-card); border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius); padding: 20px 22px;
    display: flex; flex-direction: column; gap: 6px;
}
.dash-stat-label { font-size: 13px; color: var(--dash-muted); font-weight: 600; }
.dash-stat-value { font-size: 26px; font-weight: 800; }
.dash-stat-value small { font-size: 14px; color: var(--dash-muted); font-weight: 600; }

.dash-card { background: var(--dash-card); border: 1px solid var(--dash-border); border-radius: var(--dash-radius); overflow: hidden; }
.dash-card-head { padding: 18px 24px; border-bottom: 1px solid var(--dash-border); }
.dash-card-head h2 { font-size: 16px; font-weight: 800; }

.dash-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-table th {
    text-align: right; padding: 12px 24px;
    background: #FAFAFD; color: var(--dash-muted);
    font-size: 12px; font-weight: 700;
}
.dash-table td { padding: 14px 24px; border-top: 1px solid var(--dash-border); }
.dash-table tr:hover td { background: #FBFBFE; }

.dash-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; background: #F1F0F7; color: var(--dash-muted); }
.dash-badge-ok { background: #ECFDF5; color: #047857; }
.dash-badge-warn { background: #FFFBEB; color: #B45309; }
.dash-badge-err { background: #FEF2F2; color: #B91C1C; }

@media (max-width: 640px) {
    .dash-topnav { padding: 0 16px; }
    .dash-main { padding: 20px 14px 48px; }
    .dash-auth-card { padding: 32px 22px 26px; }
    .dash-table { font-size: 12px; }
    .dash-table th, .dash-table td { padding: 10px 12px; }
}

/* ---------- Sidebar layout ---------- */
.dash-body { display: flex; min-height: 100vh; }
.dash-sidebar {
    width: 248px; flex-shrink: 0;
    background: var(--dash-card);
    border-inline-start: none; border-left: 1px solid var(--dash-border);
    display: flex; flex-direction: column;
    position: fixed; right: 0; top: 0; bottom: 0; height: 100vh; height: 100dvh;
    z-index: 60;
}
.dash-side-brand {
    display: flex; align-items: center; justify-content: center;
    padding: 22px 20px; border-bottom: 1px solid var(--dash-border);
}
.dash-side-brand img { height: 34px; filter: brightness(0) invert(38%) sepia(12%) saturate(800%) hue-rotate(230deg) brightness(70%); }
.dash-side-brand b { font-size: 15px; display: block; }
.dash-side-brand span { font-size: 11px; color: var(--dash-muted); }

.dash-side-nav { flex: 1; padding: 26px 14px 18px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.dash-side-group { font-size: 11px; font-weight: 700; color: #B4B0C8; padding: 0 10px 8px; letter-spacing: .5px; }

.dash-side-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; border-radius: 12px;
    color: var(--dash-muted); text-decoration: none;
    font-size: 14px; font-weight: 600;
    transition: background .15s, color .15s;
    border: 0; background: none; width: 100%; text-align: right;
}
.dash-side-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.dash-side-link:hover { background: rgba(124,58,237,.07); color: var(--dash-primary); }
.dash-side-link.active {
    background: linear-gradient(135deg, var(--dash-primary) 0%, var(--dash-primary-light) 100%);
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(124,58,237,.5);
}
.dash-side-link.soon { opacity: .55; pointer-events: none; }
.dash-side-link em {
    margin-right: auto; font-style: normal;
    font-size: 10px; background: rgba(124,58,237,.12); color: var(--dash-primary);
    padding: 2px 8px; border-radius: 10px;
}
.dash-side-link.active em { background: rgba(255,255,255,.25); color: #fff; }

.dash-side-foot { padding: 14px; border-top: 1px solid var(--dash-border); }
.dash-side-logout { color: var(--dash-err); }
.dash-side-logout:hover { background: #FEF2F2; color: var(--dash-err); }

.dash-side-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(30,27,46,.45); z-index: 55; backdrop-filter: blur(2px);
}

/* ---------- Shell ---------- */
.dash-shell { flex: 1; display: flex; flex-direction: column; min-width: 0; margin-right: 248px; }
.dash-topbar {
    position: sticky; top: 0; z-index: 40;
    background: rgba(244,244,249,.85); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    display: flex; align-items: center; gap: 16px;
    padding: 16px 28px; border-bottom: 1px solid var(--dash-border);
}
.dash-page-title { font-size: 20px; font-weight: 800; flex: 1; }
.dash-topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.dash-burger {
    display: none; border: 0; background: var(--dash-card);
    width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid var(--dash-border);
    align-items: center; justify-content: center; color: var(--dash-text);
}
.dash-burger svg { width: 20px; height: 20px; }

/* ---------- Home widgets ---------- */
.dash-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    background: linear-gradient(135deg, var(--dash-primary) 0%, var(--dash-primary-light) 100%);
    border-radius: var(--dash-radius); padding: 26px 28px; color: #fff;
    box-shadow: 0 16px 40px -16px rgba(124,58,237,.5);
}
.dash-hero h2 { font-size: 20px; font-weight: 800; }
.dash-hero p { font-size: 13px; opacity: .85; margin-top: 6px; }
.dash-hero-badge {
    background: rgba(255,255,255,.18); padding: 8px 18px;
    border-radius: 20px; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.dash-hero-badge.ok { background: rgba(16,185,129,.35); }

.dash-stat { flex-direction: row; align-items: center; gap: 16px; }
.dash-stat-ic {
    width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(124,58,237,.1); color: var(--dash-primary);
}
.dash-stat-ic svg { width: 22px; height: 22px; }
.dash-stat-ic.ok { background: #ECFDF5; color: var(--dash-ok); }
.dash-stat-ic.warn { background: #FFFBEB; color: var(--dash-warn); }
.dash-stat-ic.info { background: #EFF6FF; color: #3B82F6; }
.dash-stat { display: flex; }
.dash-stat > div { display: flex; flex-direction: column; gap: 4px; }

.dash-sdg {
    height: 1.05em; width: auto; vertical-align: -0.15em;
    filter: grayscale(1) brightness(.45);
    display: inline-block;
}

.dash-card-hint { font-size: 12px; color: var(--dash-muted); }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; }
.dash-table-wrap { overflow-x: auto; }
.dash-ref { font-family: monospace; font-size: 12px; letter-spacing: .3px; }
.dash-date { color: var(--dash-muted); font-size: 13px; white-space: nowrap; }
.dash-empty { text-align: center; color: #94A3B8; padding: 48px 20px !important; }

@media (max-width: 860px) {
    .dash-sidebar {
        position: fixed; right: -280px; top: 0; bottom: 0;
        transition: right .25s ease;
        visibility: hidden;
        box-shadow: -20px 0 60px rgba(30,27,46,.15);
    }
    .dash-side-open .dash-sidebar { right: 0; visibility: visible; }
    .dash-side-open .dash-side-overlay { display: block; }
    .dash-burger { display: flex; }
    .dash-shell { margin-right: 0; }
    .dash-hero { flex-direction: column; align-items: flex-start; }
}

/* ---------- Responsive hardening ---------- */
.dash-table { min-width: 640px; } /* يجبر الـ scroll بدل سحق الأعمدة */
.dash-ref { word-break: break-all; }

/* ---------- Tablet (860–1080px) ---------- */
@media (max-width: 1080px) {
    .dash-stats { grid-template-columns: repeat(2, 1fr); }
    .dash-main { padding: 24px 20px 60px; }
}
@media (min-width: 1600px) {
    .dash-main { max-width: 1280px; }
}

/* ---------- Mobile (≤860px) — sidebar drawer ---------- */
/* موجود فوق: .dash-sidebar fixed drawer + burger */

/* ---------- Phones (≤600px) ---------- */
@media (max-width: 600px) {
    /* --- login --- */
    .dash-auth-body { padding: 14px; align-items: flex-start; padding-top: 8vh; }
    .dash-auth-card { padding: 26px 20px 22px; border-radius: 20px; }
    .dash-auth-logo { height: 34px; margin-bottom: 12px; }
    .dash-auth-title { font-size: 20px; }
    .dash-auth-sub { font-size: 12px; }
    .dash-input-wrap input { height: 46px; font-size: 14px; border-radius: 12px; }
    .dash-btn-primary { padding: 13px 20px; font-size: 14px; }
    .dash-auth-note { font-size: 11px; }
    .dash-auth-foot { font-size: 11px; }

    /* --- shell --- */
    .dash-sidebar { width: 232px; }
    .dash-topbar { padding: 10px 14px; gap: 10px; }
    .dash-page-title { font-size: 17px; }
    .dash-merchant-logo { width: 32px; height: 32px; }
    .dash-topbar-user span {
        font-size: 13px; max-width: 110px;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .dash-main { padding: 14px 12px 44px; gap: 14px; }

    /* --- hero --- */
    .dash-hero {
        flex-direction: column; align-items: flex-start; gap: 10px;
        padding: 18px; border-radius: 14px;
    }
    .dash-hero h2 { font-size: 16px; }
    .dash-hero p { font-size: 12px; }
    .dash-hero-badge { font-size: 11px; padding: 5px 12px; }

    /* --- stats: 2×2 مضغوطة --- */
    .dash-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .dash-stat { padding: 12px 14px; border-radius: 14px; gap: 10px; }
    .dash-stat-ic { width: 38px; height: 38px; border-radius: 11px; }
    .dash-stat-ic svg { width: 18px; height: 18px; }
    .dash-stat-label { font-size: 11px; }
    .dash-stat-value { font-size: 18px; }
    .dash-stat-value small, .dash-stat-value .dash-sdg { font-size: 12px; }

    /* --- table --- */
    .dash-card { border-radius: 14px; }
    .dash-card-head { padding: 12px 16px; flex-direction: column; align-items: flex-start; gap: 2px; }
    .dash-card-head h2 { font-size: 14px; }
    .dash-table { min-width: 540px; font-size: 12px; }
    .dash-table th { padding: 9px 14px; font-size: 10px; }
    .dash-table td { padding: 11px 14px; }
    .dash-badge { font-size: 11px; padding: 3px 10px; }
    .dash-date { font-size: 11px; }
}

/* ---------- Very small (≤360px) ---------- */
@media (max-width: 360px) {
    .dash-stats { grid-template-columns: 1fr; }
    .dash-auth-card { padding: 22px 14px 18px; }
    .dash-topbar-user span { display: none; }
}

/* ---------- Overflow hardening (all devices) ---------- */
.dash-shell, .dash-main, .dash-hero, .dash-card, .dash-table-wrap { min-width: 0; max-width: 100%; }
.dash-main > * { min-width: 0; }
.dash-stat { min-width: 0; overflow: hidden; }
.dash-stat-txt { min-width: 0; overflow: hidden; }
.dash-stat-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.dash-hero-txt { min-width: 0; }
.dash-num { white-space: nowrap; }
.dash-na { color: #B4B0C8; }
.dash-topbar-user { min-width: 0; }
.dash-topbar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Inner pages ---------- */
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .dash-grid-2 { grid-template-columns: 1fr; } }

.dash-form { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.dash-form .dash-field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.dash-form input[type=text], .dash-form input[type=url], .dash-form input[type=tel], .dash-form input[type=password], .dash-form input[type=number] {
    width: 100%; height: 46px;
    border: 1.5px solid var(--dash-border); border-radius: 12px;
    padding: 0 14px; font-size: 14px; background: #FBFBFE;
    transition: border-color .2s, box-shadow .2s;
}
.dash-form input:focus { outline: none; border-color: var(--dash-primary-light); box-shadow: 0 0 0 4px rgba(139,92,246,.12); background: #fff; }
.dash-form .dash-btn-primary { width: auto; margin-top: 4px; }

.dash-form-logo { display: flex; align-items: center; gap: 14px; }
.dash-form-logo img, .dash-form-logo-ph {
    width: 64px; height: 64px; border-radius: 16px; object-fit: cover;
    border: 1px solid var(--dash-border);
}
.dash-form-logo-ph { background: repeating-linear-gradient(45deg,#F4F4F9,#F4F4F9 8px,#ECECF4 8px,#ECECF4 16px); }

.dash-btn-soft {
    background: rgba(124,58,237,.1); color: var(--dash-primary);
    padding: 9px 18px; font-size: 13px; border-radius: 12px;
    display: inline-flex; align-items: center; cursor: pointer;
}
.dash-btn-warn { background: #FFFBEB; color: #B45309; border: 1px solid #FDE68A; padding: 11px 20px; font-size: 13px; border-radius: 12px; }
.dash-btn-warn:hover { background: #FEF3C7; }

.dash-form-note {
    margin: 0 24px 22px; padding: 14px 16px;
    background: #FBFBFE; border: 1px dashed var(--dash-border);
    border-radius: 12px; font-size: 13px; color: var(--dash-muted); line-height: 1.9;
}
.dash-muted { font-size: 13px; color: var(--dash-muted); line-height: 1.8; }

.dash-secret {
    display: inline-block; direction: ltr;
    background: #F4F4F9; border: 1px solid var(--dash-border);
    border-radius: 10px; padding: 10px 14px;
    font-family: monospace; font-size: 13px;
    cursor: copy; word-break: break-all;
}
.dash-secret:hover { border-color: var(--dash-primary-light); }
.dash-key-row { display: flex; flex-direction: column; gap: 8px; }
.dash-key-hint { font-size: 11px; color: var(--dash-muted); }
.dash-docs .dash-field input[readonly] { font-family: monospace; font-size: 12px; color: var(--dash-text); cursor: copy; }

/* filters */
.dash-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; border-radius: 20px;
    background: var(--dash-card); border: 1.5px solid var(--dash-border);
    color: var(--dash-muted); text-decoration: none;
    font-size: 13px; font-weight: 700;
    transition: all .15s;
}
.dash-chip b { font-size: 12px; }
.dash-chip:hover { border-color: var(--dash-primary-light); color: var(--dash-primary); }
.dash-chip.active { background: var(--dash-primary); border-color: var(--dash-primary); color: #fff; }

.dash-pagination { padding: 16px 24px; border-top: 1px solid var(--dash-border); }
.dash-pagination nav { display: flex; justify-content: center; }
.dash-pagination .pagination { display: flex; gap: 6px; list-style: none; }
.dash-pagination .page-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 10px;
    border-radius: 10px; border: 1px solid var(--dash-border);
    background: var(--dash-card); color: var(--dash-muted);
    font-size: 13px; text-decoration: none;
}
.dash-pagination .page-item.active .page-link { background: var(--dash-primary); color: #fff; border-color: var(--dash-primary); }
.dash-pagination .page-item.disabled .page-link { opacity: .45; }

/* ---------- Integration guide ---------- */
.dash-integration { padding: 8px 24px 24px; display: flex; flex-direction: column; gap: 22px; }
.dash-step { display: flex; gap: 16px; }
.dash-step > div { flex: 1; min-width: 0; }
.dash-step h3 { font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.dash-step p { font-size: 13px; color: var(--dash-muted); line-height: 1.8; margin-bottom: 10px; }
.dash-step code { background: #F4F4F9; padding: 1px 7px; border-radius: 6px; font-size: 12px; }
.dash-step-n {
    width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0;
    background: rgba(124,58,237,.1); color: var(--dash-primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px;
    margin-top: 2px;
}
.dash-code {
    background: #1E1B2E; color: #E8E6F0;
    border-radius: 12px; padding: 16px 18px;
    overflow-x: auto;
}
.dash-code pre { font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.7; white-space: pre; }
.dash-code em { color: #8B8AA3; font-style: normal; }
.dash-code b { color: #C4B5FD; font-weight: 600; }
.dash-step-events { font-size: 12px !important; margin-top: 8px !important; margin-bottom: 0 !important; }
.dash-step-note {
    background: #FBFBFE; border: 1px dashed var(--dash-border);
    border-radius: 12px; padding: 14px 16px;
    font-size: 13px; color: var(--dash-muted); line-height: 2;
}
.dash-step-note code { background: #F1F0F7; padding: 1px 7px; border-radius: 6px; font-size: 12px; }
@media (max-width: 600px) { .dash-code pre { font-size: 11px; } }

/* ===== Dark mode ===== */
[data-theme="dark"] {
    --dash-bg: #0E0C1A;
    --dash-card: #171429;
    --dash-border: #28243E;
    --dash-text: #ECEAF6;
    --dash-muted: #9A94B8;
}
[data-theme="dark"] .dash-body,
[data-theme="dark"] .dash-auth-body {
    background: radial-gradient(1200px 600px at 80% -10%, rgba(124,58,237,.20), transparent 60%),
                radial-gradient(900px 500px at 10% 110%, rgba(139,92,246,.12), transparent 55%),
                var(--dash-bg);
}
[data-theme="dark"] .dash-auth-card { box-shadow: 0 20px 60px -20px rgba(0,0,0,.6); }
[data-theme="dark"] .dash-auth-note,
[data-theme="dark"] .dash-auth-foot,
[data-theme="dark"] .dash-muted { color: var(--dash-muted); }
[data-theme="dark"] .dash-field input {
    background: #100D20; border-color: var(--dash-border); color: var(--dash-text);
}
[data-theme="dark"] .dash-field input:focus { background: #161229; }
[data-theme="dark"] .dash-field .dash-input-wrap svg { color: var(--dash-muted); }
[data-theme="dark"] .dash-topbar { background: rgba(14,12,26,.85); }
[data-theme="dark"] .dash-sidebar { background: var(--dash-card); }
[data-theme="dark"] .dash-side-group { color: #6E6890; }
[data-theme="dark"] .dash-code { background: #0B0917; border-color: var(--dash-border); }
[data-theme="dark"] .dash-code em { color: #7dd3a0; }
[data-theme="dark"] .dash-table thead th { background: #100D20; }
[data-theme="dark"] .dash-table tr:hover td { background: #1B1732; }
[data-theme="dark"] .dash-chip { background: var(--dash-card); color: var(--dash-muted); }
[data-theme="dark"] .dash-chip.active { background: var(--dash-primary); color: #fff; }
[data-theme="dark"] .dash-badge { background: #221E3A; }
[data-theme="dark"] .dash-badge-ok { background: rgba(16,185,129,.15); color: #34D399; }
[data-theme="dark"] .dash-badge-warn { background: rgba(245,158,11,.15); color: #FBBF24; }
[data-theme="dark"] .dash-badge-err { background: rgba(239,68,68,.15); color: #F87171; }
[data-theme="dark"] .dash-alert-err { background: rgba(239,68,68,.12); color: #FCA5A5; border-color: rgba(239,68,68,.3); }
[data-theme="dark"] .dash-alert-ok { background: rgba(16,185,129,.12); color: #6EE7B7; border-color: rgba(16,185,129,.3); }
[data-theme="dark"] .dash-stat-ic.ok { background: rgba(16,185,129,.15); }
[data-theme="dark"] .dash-stat-ic.warn { background: rgba(245,158,11,.15); }
[data-theme="dark"] .dash-stat-ic.info { background: rgba(59,130,246,.15); }
[data-theme="dark"] .dash-secret { background: #0B0917; color: #C4B5FD; }
[data-theme="dark"] .dash-form-note { color: var(--dash-muted); }
[data-theme="dark"] .dash-btn-soft { background: #221E3A; color: var(--dash-text); }
[data-theme="dark"] .dash-empty { color: #6E6890; }
[data-theme="dark"] .dash-key-hint { color: var(--dash-muted); }
[data-theme="dark"] .dash-pagination * { color: var(--dash-muted); }

/* theme toggle icon swap */
.dash-theme-sun { display: none; }
[data-theme="dark"] .dash-theme-moon { display: none; }
[data-theme="dark"] .dash-theme-sun { display: block; }

/* topbar actions */
.dash-topbar-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; margin-inline-end: 12px; }
.dash-topbar-actions form { margin: 0; display: flex; }
.dash-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; min-width: 36px; padding: 0 10px; border-radius: 10px;
    border: 1px solid var(--dash-border); background: var(--dash-card); color: var(--dash-muted);
    cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 700; transition: .2s;
}
.dash-icon-btn:hover { color: var(--dash-primary); border-color: var(--dash-primary-light, #8B5CF6); }
.dash-icon-btn svg { width: 18px; height: 18px; }
.dash-lang-btn { font-size: 13px; }

/* floating actions on login page */
.dash-auth-actions { position: fixed; top: 18px; inset-inline-end: 18px; display: flex; gap: 8px; z-index: 10; }
.dash-auth-actions form { margin: 0; display: flex; }

/* ===== LTR (English) ===== */
[dir="ltr"] .dash-shell { margin-right: 0; margin-left: 0; }
@media (min-width: 861px) {
    [dir="ltr"] .dash-sidebar { right: auto; left: 0; border-right: none; border-left: 1px solid var(--dash-border); }
    [dir="ltr"] .dash-shell { margin-right: 0; margin-left: 248px; }
}
@media (max-width: 860px) {
    [dir="ltr"] .dash-sidebar { right: auto; left: -280px; transition: left .3s; }
    [dir="ltr"] body.dash-side-open .dash-sidebar,
    [dir="ltr"] .dash-side-open .dash-sidebar { left: 0; }
}

/* ===== Page loader ===== */
.dash-loader {
    position: fixed; inset: 0; z-index: 999;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
    background: var(--dash-bg);
    transition: opacity .4s ease, visibility .4s;
}
.dash-loader-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.dash-loader-logo { width: 110px; height: 110px; object-fit: contain; filter: invert(.85); }

/* ===== White logo in dark mode (brand logo only — not merchant logo) ===== */
[data-theme="dark"] .dash-side-brand img,
[data-theme="dark"] .dash-auth-logo,
[data-theme="dark"] .dash-auth-foot-logo {
    filter: brightness(0) invert(1);
}
[data-theme="dark"] .dash-loader-logo { filter: none; }
[data-theme="dark"] .dash-sdg { filter: brightness(0) invert(1); }

/* ===== Filters / export bar ===== */
.dash-filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-date-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dash-date-form input[type="date"] { padding: 8px 12px; border: 1px solid var(--dash-border); border-radius: 10px; background: var(--dash-card); color: var(--dash-text); font-family: inherit; font-size: 13px; }
.dash-filter-actions { display: flex; gap: 8px; }
.dash-btn-sm { padding: 8px 14px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.dash-btn-sm svg { width: 15px; height: 15px; }
.dash-row-link { cursor: pointer; }
.dash-back { display: inline-block; margin-bottom: 14px; color: var(--dash-muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.dash-back:hover { color: var(--dash-primary); }

/* ===== Key-value details ===== */
.dash-kv { display: grid; gap: 0; }
.dash-kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--dash-border); font-size: 13.5px; }
.dash-kv > div:last-child { border-bottom: none; }
.dash-kv span { color: var(--dash-muted); }
.dash-kv b { font-weight: 700; text-align: end; word-break: break-all; display: flex; align-items: center; gap: 5px; justify-content: flex-end; }
.dash-code-inline { font-family: monospace; font-size: 11px; }
.dash-badge-muted { background: #F1F0F7; color: var(--dash-muted); }

/* ===== Timeline ===== */
.dash-timeline { list-style: none; margin: 0; padding: 4px 0 0; position: relative; }
.dash-timeline li { position: relative; padding-inline-start: 26px; padding-bottom: 18px; font-size: 13px; }
.dash-timeline li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--dash-border); }
.dash-timeline li::after { content: ""; position: absolute; inset-inline-start: 8px; top: 16px; bottom: -2px; width: 1.5px; background: var(--dash-border); }
.dash-timeline li:last-child::after { display: none; }
.dash-timeline li.done::before { background: var(--dash-ok); }
.dash-timeline li.wait { color: var(--dash-muted); }
.dash-timeline li b { display: block; }
.dash-timeline li span { color: var(--dash-muted); font-size: 11.5px; }

/* ===== Chart ===== */
.dash-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 10px; }
.dash-chart-col { flex: 1; display: flex; align-items: flex-end; height: 100%; min-width: 0; }
.dash-chart-bar { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--dash-primary-light), var(--dash-primary)); opacity: .85; transition: .2s; }
.dash-chart-col:hover .dash-chart-bar { opacity: 1; }

/* ===== Notifications ===== */
.dash-notif { position: relative; }
.dash-notif-badge { position: absolute; top: -4px; inset-inline-end: -4px; background: var(--dash-err); color: #fff; font-size: 10px; font-weight: 800; min-width: 17px; height: 17px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.dash-notif-menu {
    position: absolute; top: 46px; inset-inline-end: 0; width: 310px; max-height: 380px; overflow-y: auto;
    background: var(--dash-card); border: 1px solid var(--dash-border); border-radius: 14px;
    box-shadow: 0 16px 40px -12px rgba(0,0,0,.18); z-index: 60; display: none;
}
.dash-notif.open .dash-notif-menu { display: block; }
.dash-notif-head { padding: 12px 16px; font-weight: 800; font-size: 13px; border-bottom: 1px solid var(--dash-border); }
.dash-notif-item { display: block; padding: 11px 16px; text-decoration: none; border-bottom: 1px solid var(--dash-border); }
.dash-notif-item b { display: block; font-size: 12.5px; color: var(--dash-text); }
.dash-notif-item span { font-size: 11px; color: var(--dash-muted); }
.dash-notif-item.err { border-inline-start: 3px solid var(--dash-err); }
.dash-notif-item.warn { border-inline-start: 3px solid var(--dash-warn); }
.dash-notif-item:hover { background: rgba(124,58,237,.05); }
.dash-notif-empty { padding: 22px; text-align: center; color: var(--dash-muted); font-size: 12.5px; }

/* ===== Dark additions ===== */
[data-theme="dark"] .dash-date-form input[type="date"] { color-scheme: dark; }
[data-theme="dark"] .dash-notif-menu { box-shadow: 0 16px 40px -12px rgba(0,0,0,.6); }
[data-theme="dark"] .dash-badge-muted { background: #221E3A; }
[data-theme="dark"] .dash-back:hover { color: var(--dash-primary-light); }

@media (max-width: 600px) {
    .dash-filter-bar { flex-direction: column; align-items: stretch; }
    .dash-filter-actions { justify-content: flex-start; }
    .dash-notif-menu { width: 270px; }
    .dash-chart { height: 100px; }
}

/* ===== Payment detail page ===== */
.dash-ptx-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    background: var(--dash-card); border: 1px solid var(--dash-border); border-radius: var(--dash-radius);
    padding: 22px 26px; margin-bottom: 18px;
}
.dash-ptx-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.dash-ptx-ic { width: 54px; height: 54px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dash-ptx-ic svg { width: 28px; height: 28px; }
.dash-ptx-ok .dash-ptx-ic { background: rgba(16,185,129,.14); color: var(--dash-ok); }
.dash-ptx-warn .dash-ptx-ic { background: rgba(245,158,11,.14); color: var(--dash-warn); }
.dash-ptx-err .dash-ptx-ic { background: rgba(239,68,68,.14); color: var(--dash-err); }
.dash-ptx-muted .dash-ptx-ic { background: #F1F0F7; color: var(--dash-muted); }
[data-theme="dark"] .dash-ptx-muted .dash-ptx-ic { background: #221E3A; }
.dash-ptx-amount { font-size: 30px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.dash-ptx-status { font-size: 13px; color: var(--dash-muted); font-weight: 600; margin-top: 2px; }
.dash-ptx-ref { text-align: end; display: flex; flex-direction: column; gap: 5px; }
.dash-ptx-ref code {
    font-family: monospace; font-size: 14px; font-weight: 700; cursor: pointer;
    background: var(--dash-bg); border: 1px dashed var(--dash-border); padding: 6px 14px; border-radius: 10px;
}
.dash-ptx-ref code:hover { border-color: var(--dash-primary); color: var(--dash-primary); }
.dash-ptx-ref span { font-size: 11.5px; color: var(--dash-muted); }

.dash-ptx-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.dash-ptx-side { display: grid; gap: 18px; }

/* webhook mini cards */
.dash-wh { border-top: 1px solid var(--dash-border); padding: 12px 0 4px; }
.dash-wh:first-of-type { border-top: none; padding-top: 0; }
.dash-wh-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-wh-head code { font-size: 12px; font-weight: 700; }
.dash-wh-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--dash-muted); margin: 6px 0; }
.dash-wh-payload summary { cursor: pointer; font-size: 11.5px; color: var(--dash-primary); font-weight: 700; user-select: none; }
.dash-wh-payload pre {
    margin: 8px 0 4px; background: var(--dash-bg); border: 1px solid var(--dash-border);
    border-radius: 10px; padding: 10px 12px; font-size: 10.5px; max-height: 220px; overflow: auto; white-space: pre-wrap;
}

@media (max-width: 1000px) { .dash-ptx-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
    .dash-ptx-hero { padding: 18px; }
    .dash-ptx-amount { font-size: 24px; }
    .dash-ptx-ref { text-align: start; width: 100%; }
}

/* ===== Test mode ===== */
.dash-test-pill { display: inline-block; background: #F59E0B; color: #fff; font-size: 9.5px; font-weight: 800; letter-spacing: .8px; padding: 2px 8px; border-radius: 6px; vertical-align: middle; margin-inline-start: 6px; }
.dash-test-card { border-color: rgba(245,158,11,.5); }
.dash-chip-test { border-style: dashed !important; }
.dash-test-hint { font-size: 12px; color: #B45309; background: #FFFBEB; border: 1px dashed #F59E0B; border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
[data-theme="dark"] .dash-test-hint { color: #FBBF24; background: rgba(245,158,11,.1); }
.dash-textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--dash-border); border-radius: 12px; background: var(--dash-bg); color: var(--dash-text); font-family: monospace; font-size: 13px; resize: vertical; }
.dash-textarea:focus { outline: none; border-color: var(--dash-primary); box-shadow: 0 0 0 4px rgba(139,92,246,.12); }
.dash-ips-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* ===== Confirm modal ===== */
.dash-modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(15,12,30,.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    opacity: 0; visibility: hidden; transition: .25s;
}
.dash-modal-open { opacity: 1; visibility: visible; }
.dash-modal-box {
    background: var(--dash-card); border: 1px solid var(--dash-border);
    border-radius: 22px; padding: 30px 28px 24px; max-width: 380px; width: 100%;
    text-align: center; position: relative;
    transform: translateY(14px) scale(.95); transition: .3s cubic-bezier(.2,.9,.3,1.2);
    box-shadow: 0 30px 80px -20px rgba(0,0,0,.45);
}
.dash-modal-box::before {
    content: ""; position: absolute; top: 0; inset-inline: 24px; height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, transparent, var(--dash-warn), transparent);
}
.dash-modal-open .dash-modal-box { transform: none; }
.dash-modal-ic {
    width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 18px;
    background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(245,158,11,.07));
    border: 1px solid rgba(245,158,11,.3);
    color: var(--dash-warn); display: flex; align-items: center; justify-content: center;
    animation: dashModalIc 2.4s ease-in-out infinite;
}
.dash-modal-ic svg { width: 30px; height: 30px; }
@keyframes dashModalIc { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.dash-modal-title { margin: 0 0 6px; font-size: 16.5px; font-weight: 800; color: var(--dash-text); }
.dash-modal-msg { font-size: 13.5px; color: var(--dash-muted); margin: 0 0 22px; line-height: 1.8; }
.dash-modal-btns { display: flex; gap: 10px; }
.dash-modal-btn-cancel, .dash-modal-btn-ok {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 11px 0; border-radius: 12px; font-family: inherit; font-size: 13.5px;
    font-weight: 700; cursor: pointer; border: none; transition: .2s;
}
.dash-modal-btn-cancel { background: var(--dash-bg); color: var(--dash-muted); border: 1px solid var(--dash-border); }
.dash-modal-btn-cancel:hover { color: var(--dash-text); border-color: var(--dash-muted); }
.dash-modal-btn-ok { background: linear-gradient(135deg, #EF4444, #DC2626); color: #fff; box-shadow: 0 8px 18px -6px rgba(239,68,68,.5); }
.dash-modal-btn-ok:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -6px rgba(239,68,68,.55); }
.dash-modal-btn-ok svg { width: 16px; height: 16px; }
