
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #673de6;
  --accent-hover: #522fc4;
  --accent-soft: rgba(103, 61, 230, 0.08);
  --accent-glow: 0 4px 14px rgba(103, 61, 230, 0.25);
  --ok: #00b090;
  --warn: #f59e0b;
  --bad: #fc5c65;
  --text: #2d3748;
  --text-dark: #1a202c;
  --muted: #718096;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 260px;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.025);
  --shadow-hover: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
}
html[data-theme="dark"] {
  --bg: #0b0e14;
  --panel: #151921;
  --line: #222733;
  --line-strong: #32394a;
  --accent: #8b6bed;
  --accent-hover: #a086f0;
  --accent-soft: rgba(139, 107, 237, 0.15);
  --accent-glow: 0 4px 14px rgba(139, 107, 237, 0.25);
  --text: #f3f4f6;
  --text-dark: #ffffff;
  --muted: #9ca3af;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.2);
  --shadow-hover: 0 10px 15px -3px rgba(0,0,0,0.3);
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Tajawal", system-ui, sans-serif; background-color: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; font-size: 14px; }
svg.icon { width: 18px; height: 18px; flex-shrink: 0; display: block; }
svg.icon-lg { width: 24px; height: 24px; flex-shrink: 0; display: block; }
svg.icon-xl { width: 32px; height: 32px; flex-shrink: 0; display: block; }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }
.app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; gap: 0; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 100; }
.brand-wrap { display: flex; align-items: center; justify-content: center; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.brand-logo-link { position: relative; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.brand-logo-img { display: block; width: 160px; max-width: 100%; height: auto; object-fit: contain; transition: transform .25s ease, filter .25s ease; }
.brand-logo-link:hover .brand-logo-img { transform: scale(1.04); filter: drop-shadow(0 8px 18px rgba(103, 61, 230, 0.22)); }
.brand-fallback { display: none; align-items: center; gap: 8px; }
.nav-scroll { overflow: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; flex-grow: 1; -ms-overflow-style: none; scrollbar-width: none; }
.nav-scroll::-webkit-scrollbar { display: none; }
.nav-section-title { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; margin: 16px 8px 8px; letter-spacing: 0.05em; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); color: var(--muted); transition: all 0.2s; font-weight: 600; border-right: 3px solid transparent; }
.nav-item:hover { background: var(--bg); color: var(--text-dark); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); border-right-color: var(--accent); font-weight: 700; }
.nav-item.store-link { background: linear-gradient(135deg, rgba(103,61,230,.10), rgba(0,176,144,.08)); border: 1px solid rgba(103,61,230,.16); color: var(--text-dark); }
.nav-item.store-link:hover { box-shadow: var(--accent-glow); transform: translateY(-1px); }
.nav-item.store-link.active { background: linear-gradient(135deg, rgba(103,61,230,.18), rgba(0,176,144,.14)); border-right-color: var(--accent); }
.nav-item .ico { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; flex-shrink:0; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--line); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); z-index: 90; opacity: 0; transition: opacity 0.3s ease; }
.sidebar-overlay.show { display: block; opacity: 1; }
.main { padding: 0; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 24px; min-height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; box-shadow: var(--shadow); }
.menu-toggle { display: none; background: transparent; border: none; color: var(--text-dark); cursor: pointer; padding: 4px; border-radius: 6px; transition: 0.2s; }
.menu-toggle:hover { background: var(--line); }
.search-bar { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid transparent; padding: 6px 12px; border-radius: 6px; width: 280px; color: var(--muted); transition: 0.3s; }
.search-bar:focus-within { background: var(--panel); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-bar input { border: none; background: transparent; outline: none; color: var(--text); width: 100%; font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.wallet-chip { display: flex; align-items: center; gap: 10px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-width: 140px; transition: 0.2s; }
.wallet-chip:hover { border-color: var(--accent); }
.wallet-chip .value { font-weight: 900; color: var(--text-dark); font-size: 13px; line-height: 1.2; }
.wallet-chip .meta { font-size: 10px; color: var(--muted); line-height: 1.2; margin-bottom: 2px; }
.notif-btn { position: relative; width: 34px; height: 34px; border-radius: 6px; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--muted); transition: 0.2s; cursor: pointer; border: 1px solid transparent; flex-shrink:0; }
.notif-btn:hover { color: var(--text-dark); background: var(--line); }
.notif-count { position: absolute; top: -4px; left: -4px; background: var(--bad); color: #fff; font-size: 9px; font-weight: 900; padding: 1px 5px; min-width: 16px; height: 16px; display: grid; place-items: center; border-radius: 99px; }
.user-profile { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 6px; transition: 0.2s; border: 1px solid transparent; }
.user-profile:hover { background: var(--bg); border-color: var(--line); }
.user-profile .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 12px; flex-shrink:0; }
.user-profile .info { display: flex; flex-direction: column; }
.user-profile .name { font-size: 12px; font-weight: 700; color: var(--text-dark); line-height: 1.2; margin-bottom: 2px; }
.user-profile .role { font-size: 10px; color: var(--muted); line-height: 1.2; }
.content-area { padding: 24px 32px; display: flex; flex-direction: column; gap: 24px; max-width: 1400px; margin: 0 auto; }
.card, .hero-panel, .glass, .login-card, .task-card, .stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow 0.3s; }
.card:hover, .task-card:hover { box-shadow: var(--shadow-hover); }
.card { padding: 24px; }
.hero-panel { padding: 32px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; background: linear-gradient(135deg, var(--panel), var(--bg)); }
.hero-panel h2 { margin: 8px 0; font-size: 26px; font-weight: 900; color: var(--text-dark); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; white-space: nowrap; border: 1px solid transparent; flex-shrink:0; }
.btn-primary { background: var(--accent); color: #ffffff !important; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--accent-glow); transform: translateY(-1px); }
.btn-secondary { background: var(--bg); border-color: var(--line-strong); color: var(--text-dark); }
.btn-secondary:hover { background: var(--line); border-color: var(--muted); }
.btn-dark { background: var(--text-dark); color: var(--panel); }
.table-wrap { overflow-x: auto; margin-top: 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; text-align: right; }
th, td { padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: var(--bg); font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; }
tbody tr:hover { background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }
.alert { padding: 16px; border-radius: 8px; border-left: 4px solid var(--accent); background: var(--panel); border: 1px solid var(--line); display: flex; gap: 12px; font-weight: 600; box-shadow: var(--shadow); }
.alert.success { border-left-color: var(--ok); background: rgba(0, 176, 144, 0.05); }
.alert.danger { border-left-color: var(--bad); background: rgba(252, 92, 101, 0.05); }
@media(max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .menu-toggle { display: block; }
  .desktop-only { display: none !important; }
  .topbar { padding: 8px 16px; }
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: var(--sidebar);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
  }
  .sidebar.open { transform: translateX(0); }
  .content-area { padding: 20px 16px; }
}


/* ==========================================================================
   Hostinger hPanel Dashboard Styles & Responsive Grid
   تم حل مشكلة تمدد الـ SVG نهائياً وجعلها داخل صناديق احترافية
   ========================================================================== */

/* بطاقات الإحصائيات العلوية */
.h-stat-card {
    position: relative;
    padding: 24px;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.h-stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

/* إطارات الأيقونات داخل البطاقات لمنع التمدد وضبط الحجم تماماً */
.h-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.h-icon-box.info    { background: rgba(103, 61, 230, 0.1); color: var(--accent); }
.h-icon-box.success { background: rgba(0, 176, 144, 0.1); color: var(--ok); }
.h-icon-box.warning { background: rgba(245, 158, 11, 0.1); color: var(--warn); }
.h-icon-box.neutral { background: var(--bg); color: var(--text-dark); border: 1px solid var(--line); }

.h-stat-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.h-stat-card .label { font-size: 13px; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.h-stat-card .num { font-size: 28px; font-weight: 900; letter-spacing: -0.02em; color: var(--text-dark); }
.h-stat-card .sub { font-size: 11px; color: var(--muted); margin-top: 12px; }

/* بطاقات "أين أذهب؟" السريعة */
.h-quick-action {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s ease;
}
.h-quick-action:hover {
    background: var(--panel);
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateX(-4px); 
}
.h-qa-icon {
    width: 40px; 
    height: 40px;
    border-radius: 10px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    flex-shrink: 0;
    transition: 0.3s ease;
}
.h-quick-action:hover .h-qa-icon { transform: scale(1.05); }

/* أزرار الجدول */
.h-table-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 16px; font-size: 11px; font-weight: 800;
    border-radius: 8px; background: var(--accent-soft); color: var(--accent);
    border: 1px solid transparent; transition: all 0.2s ease;
    white-space: nowrap; text-decoration: none;
}
.h-table-btn:hover { background: var(--accent); color: #fff; box-shadow: var(--accent-glow); transform: translateY(-1px); }

/* الشبكات (Grids) */
.h-grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 24px; }
.h-grid-main { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 24px; }
.h-qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.h-mini-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* حاوية الجدول للهواتف */
.h-table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }

/* ==========================================================================
   التجاوب مع الشاشات (Responsive)
   ========================================================================== */
@media(max-width: 1024px) {
    .h-grid-stats { grid-template-columns: repeat(2, 1fr); }
    .h-grid-main { grid-template-columns: 1fr; }
    .h-qa-grid { grid-template-columns: repeat(3, 1fr); }
}

@media(max-width: 640px) {
    .h-grid-stats { grid-template-columns: 1fr; }
    .h-qa-grid { grid-template-columns: 1fr; }
    
    .hero-panel { flex-direction: column; text-align: right; align-items: stretch !important; }
    .hero-panel .hero-actions { display: flex; flex-direction: column; width: 100%; margin-top: 16px; gap: 10px; }
    .hero-panel .hero-actions .btn { width: 100%; justify-content: center; }
    
    .h-stat-card .num { font-size: 26px; }
    .h-mini-stats-grid { grid-template-columns: 1fr; }
    
    .card { padding: 16px !important; } 
    .table-header-flex { flex-direction: column; align-items: flex-start !important; gap: 12px; }
    .table-header-flex .btn { width: 100%; justify-content: center; }
}
