:root {
  --navy: #163A8C;
  --blue: #204BB1;
  --sky: #3B82F6;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --soft: #F8FAFC;
  --card: #FFFFFF;
  --ok: #059669;
  --warn: #D97706;
  --err: #DC2626;
  --sidebar: #0B1F4D;
  --sidebar-2: #122B66;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --font: 'Tajawal', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--soft);
  color: var(--ink);
  font-size: 15px;
}
#app { min-height: 100vh; }
button, input, select, textarea { font: inherit; }

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 10% 10%, rgba(32,75,177,.18), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(59,130,246,.14), transparent 42%),
    linear-gradient(160deg, #EEF2FF, #F8FAFC 55%, #EFF6FF);
}
.login-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid rgba(22,58,140,.12);
  border-radius: 22px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(15,23,42,.12);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand img { width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.brand strong { display: block; font-size: 1.2rem; font-weight: 900; }
.brand span { color: var(--muted); font-size: .88rem; font-weight: 700; }
h1 { margin: 0 0 8px; font-size: 1.45rem; font-weight: 900; }
.lead { margin: 0 0 20px; color: var(--muted); font-weight: 700; line-height: 1.7; }

label { display: block; font-weight: 800; font-size: .92rem; margin-bottom: 6px; color: #1E293B; }
input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  margin-bottom: 12px;
  outline: none;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(32,75,177,.12);
}
textarea { min-height: 100px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 16px;
  font-weight: 900; cursor: pointer; transition: .15s ease;
}
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--blue), var(--navy));
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost {
  background: #fff; color: var(--blue);
  border: 1.5px solid rgba(32,75,177,.2);
}
.btn-sm { padding: 8px 12px; font-size: .86rem; width: auto; }
.msg { margin-top: 10px; font-weight: 800; font-size: .9rem; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

/* ── Shell ── */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; padding: 4px 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar .logo img { width: 42px; height: 42px; border-radius: 12px; background: #fff; }
.sidebar .logo strong { font-size: 1rem; font-weight: 900; }
.sidebar .logo small { display: block; opacity: .72; font-weight: 700; font-size: .75rem; }
.nav-btn {
  text-align: right; background: transparent; border: 0;
  color: rgba(255,255,255,.86); padding: 12px 14px; border-radius: 12px;
  font-weight: 800; cursor: pointer;
}
.nav-btn.active, .nav-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar .spacer { flex: 1; }
.venue-pill {
  background: rgba(255,255,255,.1); border-radius: 12px; padding: 12px;
  font-weight: 800; font-size: .88rem; margin-bottom: 6px;
}

.main { padding: 28px; max-width: 1200px; }
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 22px; flex-wrap: wrap;
}
.topbar h2 { margin: 0; font-size: 1.55rem; font-weight: 900; letter-spacing: -.02em; }
.topbar p { margin: 6px 0 0; color: var(--muted); font-weight: 700; line-height: 1.6; }

.notice {
  background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E3A8A;
  border-radius: 14px; padding: 14px 16px; font-weight: 700; line-height: 1.75; margin-bottom: 16px;
}
.notice.warn { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat .k { color: var(--muted); font-weight: 800; font-size: .86rem; margin-bottom: 8px; }
.stat .v { font-size: 1.75rem; font-weight: 900; color: var(--navy); line-height: 1.1; }
.stat .s { margin-top: 6px; color: var(--muted); font-weight: 700; font-size: .82rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-top: 16px;
}
.card h3 { margin: 0 0 14px; font-size: 1.05rem; font-weight: 900; }
.charts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 16px; }
.chart-box { position: relative; height: 280px; }
.chart-box canvas { max-height: 280px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 9px 14px; font-weight: 800; cursor: pointer; color: #334155;
}
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }

.help-panel {
  background: linear-gradient(135deg, #EEF2FF, #F5F3FF);
  border: 1px solid #C7D2FE;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}
.help-panel h4 { margin: 0 0 8px; font-size: 1.1rem; font-weight: 900; color: #312E81; }
.help-panel .lead-help { margin: 0 0 12px; font-size: 1rem; font-weight: 800; color: #4338CA; line-height: 1.7; }
.help-panel ol { margin: 0; padding: 0 22px 0 0; }
.help-panel li { margin-bottom: 8px; font-size: .98rem; font-weight: 700; color: #312E81; line-height: 1.7; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field-hint { color: var(--muted); font-size: .82rem; font-weight: 700; margin: -6px 0 12px; }

.q-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #FAFBFC;
}
.q-card .opts { display: grid; gap: 8px; }
.opt-row { display: flex; gap: 8px; align-items: center; }
.opt-row input[type="radio"] { width: auto; margin: 0; }
.opt-row input[type="text"] { margin: 0; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px;
}
.item strong { display: block; font-weight: 900; }
.item span { color: var(--muted); font-weight: 700; font-size: .88rem; }
.badge {
  display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 900;
}
.badge.pending { background: #FEF3C7; color: #92400E; }
.badge.approved { background: #D1FAE5; color: #065F46; }
.badge.rejected { background: #FEE2E2; color: #991B1B; }

.seg {
  display: inline-flex; background: #F1F5F9; border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 12px;
}
.seg button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 10px;
  font-weight: 800; cursor: pointer; color: var(--muted);
}
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 2px 8px rgba(15,23,42,.08); }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center;
  }
  .sidebar .logo { width: 100%; margin-bottom: 8px; }
  .sidebar .spacer { display: none; }
  .venue-pill { width: 100%; }
  .main { padding: 18px 14px 40px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
}
