:root {
    --bg: #07111f;
    --bg-2: #0b1a2d;
    --card: rgba(16, 34, 55, 0.88);
    --card-2: rgba(21, 45, 71, 0.72);
    --line: rgba(148, 184, 219, 0.16);
    --text: #eef6ff;
    --muted: #9bb3cc;
    --accent: #35c8ff;
    --accent-2: #7b8cff;
    --green: #38d996;
    --orange: #ffb547;
    --red: #ff6b7a;
    --radius: 18px;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: "SF Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(53, 200, 255, 0.18), transparent 60%),
        radial-gradient(700px 450px at 0% 100%, rgba(123, 140, 255, 0.15), transparent 55%),
        linear-gradient(160deg, var(--bg), var(--bg-2));
    direction: rtl;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    padding: 22px 16px;
    border-left: 1px solid var(--line);
    background: rgba(6, 16, 28, 0.72);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 13px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, var(--accent), var(--accent-2));
    color: #06111f; font-weight: 900; font-size: 18px;
}
.brand h1 { font-size: 17px; margin: 0; }
.brand small { color: var(--muted); font-size: 11px; }

.nav { display: grid; gap: 6px; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; border-radius: 12px;
    color: var(--muted); font-size: 14px;
}
.nav a:hover { background: rgba(53, 200, 255, 0.08); color: var(--text); text-decoration: none; }
.nav a.active { background: rgba(53, 200, 255, 0.14); color: var(--text); border: 1px solid rgba(53, 200, 255, 0.22); }
.nav .spacer { height: 12px; }

.main { flex: 1; padding: 26px; max-width: 1300px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.topbar h2 { margin: 0; font-size: 23px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 16px; }
.card .hint { color: var(--muted); font-size: 12px; line-height: 1.7; }

.stat { display: flex; align-items: center; justify-content: space-between; }
.stat strong { font-size: 30px; letter-spacing: -0.5px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat-icon {
    width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
    background: rgba(53, 200, 255, 0.12); color: var(--accent); font-size: 20px;
}

.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 11px 12px; text-align: right; font-size: 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: rgba(53, 200, 255, 0.06); color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.ltr, .ltr { direction: ltr; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.green { background: rgba(56, 217, 150, 0.13); color: var(--green); }
.badge.red { background: rgba(255, 107, 122, 0.13); color: var(--red); }
.badge.orange { background: rgba(255, 181, 71, 0.13); color: var(--orange); }
.badge.gray { background: rgba(155, 179, 204, 0.12); color: var(--muted); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 14px; border-radius: 11px; border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04); color: var(--text);
    font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; color: #06111f; }
.btn.danger { color: var(--red); border-color: rgba(255, 107, 122, 0.3); background: rgba(255, 107, 122, 0.08); }
.btn.small { padding: 6px 9px; font-size: 11px; border-radius: 9px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
input, select, textarea {
    width: 100%; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--line); background: rgba(4, 12, 22, 0.55);
    color: var(--text); font-family: inherit; font-size: 13px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(53, 200, 255, 0.25); border-color: rgba(53, 200, 255, 0.4); }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.check input { width: auto; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13px; border: 1px solid var(--line); }
.alert.ok { background: rgba(56, 217, 150, 0.1); color: var(--green); border-color: rgba(56, 217, 150, 0.24); }
.alert.err { background: rgba(255, 107, 122, 0.1); color: var(--red); border-color: rgba(255, 107, 122, 0.24); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(430px, 100%); padding: 28px; }
.login-card .brand { justify-content: center; }
.login-card h2 { text-align: center; margin: 0 0 6px; }
.login-card p { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 20px; }

.source-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.source-row:last-child { border-bottom: 0; }
.source-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(53, 200, 255, 0.12); color: var(--accent); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; unicode-bidi: embed; }
.pill { display: inline-block; padding: 3px 8px; border-radius: 999px; background: rgba(53, 200, 255, 0.1); color: var(--accent); font-size: 11px; }
.empty { text-align: center; padding: 28px; color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
    .layout { display: block; }
    .sidebar { width: auto; height: auto; position: static; border-left: 0; border-bottom: 1px solid var(--line); }
    .nav { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
    .main { padding: 18px; }
}
