:root {
    --bg: #0f1420;
    --bg-card: #161d2e;
    --bg-card-hover: #1c2438;
    --border: #262f45;
    --text: #e6e9f0;
    --text-dim: #8b93a7;
    --primary: #5b7fff;
    --primary-hover: #4a6bed;
    --danger: #ff5b6e;
    --danger-hover: #ed4a5e;
    --warn: #ffb454;
    --success: #3ddc97;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    direction: rtl;
    margin: 0;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar .brand { font-weight: 700; font-size: 18px; display:flex; align-items:center; gap:8px; }
.topbar nav a {
    color: var(--text-dim);
    margin-inline-start: 18px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
}
.topbar nav a:hover, .topbar nav a.active { background: var(--bg-card-hover); color: var(--text); }

.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 { margin-top: 0; font-size: 18px; }
.card h3 { margin-top: 0; font-size: 15px; color: var(--text-dim); font-weight: 500; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box { width: 340px; }

label { display: block; margin: 10px 0 6px; font-size: 13px; color: var(--text-dim); }

input[type=text], input[type=password], input[type=number], select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0c1120;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

button, .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    background: var(--primary);
    color: #fff;
    transition: background .15s;
}
button:hover, .btn:hover { background: var(--primary-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-card-hover); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; text-align: right; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--bg-card-hover); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.badge-danger { background: rgba(255,91,110,.15); color: var(--danger); }
.badge-warn { background: rgba(255,180,84,.15); color: var(--warn); }
.badge-muted { background: rgba(139,147,167,.15); color: var(--text-dim); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

.filter-group { display: inline-flex; background: #0c1120; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.filter-group button { background: transparent; border-radius: 0; color: var(--text-dim); }
.filter-group button.active { background: var(--primary); color: #fff; }

.progress-wrap { background: #0c1120; border-radius: 999px; overflow: hidden; height: 10px; border: 1px solid var(--border); }
.progress-bar { height: 100%; background: var(--success); width: 0%; transition: width .3s; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: rgba(255,91,110,.12); color: var(--danger); border: 1px solid rgba(255,91,110,.3); }
.alert-success { background: rgba(61,220,151,.12); color: var(--success); border: 1px solid rgba(61,220,151,.3); }
.alert-info { background: rgba(91,127,255,.12); color: var(--primary); border: 1px solid rgba(91,127,255,.3); }

.muted { color: var(--text-dim); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.empty-state { text-align: center; padding: 40px 0; color: var(--text-dim); }

.log-box {
    max-height: 220px;
    overflow-y: auto;
    background: #0c1120;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    font-family: monospace;
    direction: ltr;
    text-align: left;
}
.log-box div { padding: 2px 0; }
.log-ok { color: var(--success); }
.log-err { color: var(--danger); }
.log-info { color: var(--text-dim); }

.checkbox-cell { width: 34px; }
