:root {
    --ink: #12182c;
    --pitch: #173ad2;
    --pitch-deep: #0e2070;
    --gold: #c8962e;
    --gold-soft: #f3e2bc;
    --cream: #f4f0e6;
    --card: #fffcf7;
    --line: #e5dccb;
    --muted: #6e655a;
    --danger: #9f2d2d;
    --ok: #1c7a4d;
    --warn: #a15c12;
    --shadow: 0 16px 40px rgba(20, 36, 28, 0.08);
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Manrope, "Noto Naskh Arabic", "Segoe UI", sans-serif;
    background: var(--cream);
    color: var(--ink);
    min-height: 100vh;
}
body[dir="rtl"] { font-family: "Noto Naskh Arabic", Manrope, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }

.topbar {
    background: linear-gradient(120deg, var(--pitch-deep), var(--pitch) 55%, #3d63e8);
    color: white;
    padding: 18px 7vw 16px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    border-bottom: 4px solid var(--gold);
}
.brand { display: flex; gap: 14px; align-items: center; text-decoration: none; }
.brand-logo, .login-logo { background: #fff; object-fit: contain; display: block; }
.brand-logo { height: 56px; width: auto; border-radius: 12px; padding: 4px 8px; }
.login-logo { height: 132px; width: auto; border-radius: 20px; padding: 12px 16px; margin: 18px 0 8px; }
.brand small { display: block; opacity: 0.75; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; }
.brand strong { font-size: 18px; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.lang a, .ghost, .user-chip {
    color: white; text-decoration: none; border: 1px solid rgba(255,255,255,.25);
    border-radius: 999px; padding: 7px 12px; font-size: 14px;
}
.lang a.active, .user-chip { background: rgba(255,255,255,.12); }
.nav {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 12px 7vw; background: white; border-bottom: 1px solid var(--line);
}
.nav a {
    text-decoration: none; padding: 8px 12px; border-radius: 999px; color: var(--muted); font-weight: 700;
}
.nav a.active, .nav a:hover { background: var(--gold-soft); color: var(--pitch); }

main { padding: 28px 7vw 64px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 22px; flex-wrap: wrap; }
h1 { font-size: 34px; line-height: 1.15; margin: 0 0 6px; }
h2 { margin: 0 0 12px; font-size: 22px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.two { grid-template-columns: 1.4fr .8fr; }
.card, .panel {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px;
}
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.kpi strong { display: block; font-size: 34px; margin-top: 6px; }
.ring {
    width: 84px; height: 84px; border-radius: 50%;
    display: grid; place-items: center;
    background: conic-gradient(var(--gold) calc(var(--p) * 1%), #efe6d4 0);
}
.ring span {
    width: 62px; height: 62px; border-radius: 50%; background: var(--card);
    display: grid; place-items: center; font-weight: 800;
}
.band { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800; }
.band.elite { background: #e5f6ee; color: var(--ok); }
.band.performance { background: #e7eefb; color: var(--pitch); }
.band.developing { background: #fff1dc; color: var(--warn); }
.band.priority { background: #fde8e8; color: var(--danger); }
.band.none { background: #eee; color: var(--muted); }
.jersey {
    display: inline-grid; place-items: center; min-width: 42px; height: 42px; padding: 0 8px;
    border-radius: 12px; background: var(--pitch); color: white; font-weight: 800;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.table-wrap { overflow-x: auto; }

.btn, button, .button {
    background: var(--pitch); color: white; border: 0; border-radius: 12px;
    padding: 11px 16px; font-weight: 800; cursor: pointer; text-decoration: none; display: inline-flex; gap: 8px; align-items: center;
}
.btn.secondary, button.secondary { background: white; color: var(--pitch); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 7px 10px; border-radius: 10px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-weight: 800; margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="password"], input[type="date"], select, textarea {
    width: 100%; border: 1px solid var(--line); background: white; border-radius: 12px; padding: 12px 14px; color: var(--ink);
}
textarea { min-height: 140px; resize: vertical; }
textarea.short { min-height: 72px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 18px; }
.filters label { font-size: 13px; }
.filters input, .filters select { min-width: 160px; }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.check input { width: auto; }
.check label { display: inline; margin: 0; }

.alert { background: #fde8e8; color: var(--danger); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.success { background: #e5f6ee; color: var(--ok); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.hint, .help-text { background: var(--gold-soft); border-radius: 12px; padding: 12px 14px; color: var(--ink); font-size: 14px; }
.help-text { margin: 6px 0 12px; font-weight: 600; }
form ul { margin: 6px 0 0; padding-inline-start: 18px; color: var(--danger); }

.scale { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
    border: 1px solid var(--line); background: white; border-radius: 14px; padding: 10px 12px;
    display: flex; gap: 8px; align-items: center; cursor: pointer; min-height: 48px;
}
.pill input { accent-color: var(--pitch); }
.pill:has(input:checked) { background: var(--pitch); color: white; border-color: var(--pitch); }
.pill.emoji { min-width: 148px; }
.emoji { font-size: 22px; }
.question { padding: 14px 0; border-top: 1px solid var(--line); }
.question.invalid { background: #fff6f6; margin: 0 -12px; padding: 14px 12px; border-radius: 12px; }
.q-main { font-weight: 800; display: block; }
.q-sub { color: var(--muted); font-size: 14px; }
.section-card { margin-bottom: 16px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-hero {
    background:
        radial-gradient(circle at 20% 20%, rgba(200,150,46,.35), transparent 40%),
        linear-gradient(160deg, var(--pitch-deep), #3d63e8);
    color: white; padding: 8vh 8vw; display: flex; flex-direction: column; justify-content: space-between;
}
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(440px, 100%); }
.stack { display: grid; gap: 12px; }
canvas { width: 100%; height: 280px; display: block; }
.gap-neg { color: var(--danger); font-weight: 800; }
.gap-pos { color: var(--ok); font-weight: 800; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--warn); }
.status-dot.on { background: var(--ok); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.q-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.q-row form { display: inline; }
.section-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 980px) {
    .kpis, .two, .login-wrap, .form-grid { grid-template-columns: 1fr; }
    .login-hero { min-height: 240px; }
    h1 { font-size: 28px; }
    main, .topbar, .nav { padding-left: 18px; padding-right: 18px; }
}
