:root {
  --ink: #10233f;
  --muted: #68788f;
  --line: rgba(27, 55, 90, .11);
  --surface: rgba(255, 255, 255, .9);
  --navy: #0b2545;
  --blue: #176bce;
  --cyan: #18a6b8;
  --gold: #e8aa36;
  --green: #15936f;
  --red: #d95959;
  --shadow: 0 22px 55px rgba(25, 55, 91, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.modern-app {
  margin: 0;
  color: var(--ink);
  font-family: 'Noto Sans Arabic', system-ui, sans-serif;
  background:
    radial-gradient(circle at 8% 8%, rgba(24, 166, 184, .13), transparent 25rem),
    radial-gradient(circle at 92% 3%, rgba(23, 107, 206, .14), transparent 30rem),
    linear-gradient(180deg, #f8fbff 0%, #eef4fa 100%);
  min-height: 100vh;
}
body.modern-app::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: linear-gradient(rgba(23,107,206,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(23,107,206,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

body.modern-app.bg-app { background: radial-gradient(circle at 12% 14%, rgba(24,166,184,.16), transparent 26rem), radial-gradient(circle at 88% 4%, rgba(23,107,206,.18), transparent 31rem), linear-gradient(155deg, #f8fbff, #edf5fb 55%, #f7fafc); }
body.modern-app.bg-app header h1 { color: var(--navy); letter-spacing: -.02em; }
body.modern-app.bg-app header p { color: var(--muted); }
body.modern-app.bg-app .glass { background: rgba(255,255,255,.9); border: 1px solid rgba(255,255,255,.8); border-radius: 26px; box-shadow: 0 28px 70px rgba(19,55,91,.14); backdrop-filter: blur(20px); }
body.modern-app.bg-app .download-hero { background: linear-gradient(110deg, #0d315d, #176bce 58%, #1596a7); box-shadow: 0 18px 40px rgba(23,107,206,.24); border: 1px solid rgba(255,255,255,.18); }
body.modern-app.bg-app .download-hero::before { content: ''; position: absolute; width: 120px; height: 120px; right: -45px; top: -50px; border-radius: 50%; border: 25px solid rgba(232,170,54,.22); }
body.modern-app.bg-app form button[type='submit'] { background: linear-gradient(110deg, var(--blue), #0d91a3) !important; min-height: 46px; }
.google-login-button { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; color: #fff; border-radius: 15px; background: linear-gradient(110deg, #176bce, #0d91a3); box-shadow: 0 14px 30px rgba(23,107,206,.22); transition: transform .2s ease, box-shadow .2s ease; }
.google-login-button:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 18px 38px rgba(23,107,206,.28); }
.google-login-button .google-mark { width: 38px; height: 38px; display: grid; place-items: center; color: #4285f4; border-radius: 11px; background: #fff; font-size: 18px; }
.google-login-button strong, .google-login-button small { display: block; text-align: right; }
.google-login-button strong { font-size: 13px; }
.google-login-button small { margin-top: 2px; color: rgba(255,255,255,.72); font-size: 10px; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--muted); font-size: 10px; }
.login-divider::before, .login-divider::after { content: ''; height: 1px; flex: 1; background: #e3eaf2; }
.emergency-login { padding: 10px 12px; border: 1px solid #e1e8f0; border-radius: 13px; background: rgba(248,251,255,.75); }
.emergency-login summary { cursor: pointer; color: #607288; font-size: 11px; text-align: center; }
.emergency-login[open] summary { margin-bottom: 14px; }

.modern-app .container { max-width: 1380px; }
.page-shell { position: relative; z-index: 1; max-width: 1380px; margin: 0 auto; padding: 28px 24px 60px; }

.app-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  color: #fff;
  background: linear-gradient(110deg, rgba(7, 29, 57, .97), rgba(12, 55, 92, .96));
  border-bottom: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 16px 40px rgba(5, 30, 58, .18);
  backdrop-filter: blur(18px);
}
.app-nav-inner { max-width: 1380px; margin: 0 auto; min-height: 74px; padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logos { display: flex; align-items: center; gap: 8px; padding: 6px 9px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); border-radius: 16px; }
.brand-logos img { width: auto; height: 38px; object-fit: contain; }
.brand-copy { min-width: 0; }
.brand-eyebrow { display: block; color: rgba(255,255,255,.66); font-size: 11px; margin-bottom: 2px; letter-spacing: .03em; }
.brand-title { display: block; color: #fff; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 13px;
  color: rgba(255,255,255,.84); border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.07); transition: .2s ease;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.14); transform: translateY(-1px); }

.hero-strip {
  position: relative; overflow: hidden; margin-bottom: 22px; padding: 28px 30px;
  color: #fff; border-radius: 26px;
  background: linear-gradient(120deg, #0b315c 0%, #0e5b91 55%, #138fa2 100%);
  box-shadow: 0 24px 55px rgba(10, 62, 105, .2);
}
.hero-strip::after { content: ''; position: absolute; width: 260px; height: 260px; left: -70px; top: -140px; border: 48px solid rgba(255,255,255,.07); border-radius: 50%; }
.hero-strip::before { content: ''; position: absolute; width: 170px; height: 170px; right: 45%; bottom: -145px; border: 34px solid rgba(232,170,54,.18); border-radius: 50%; }
.hero-content { position: relative; z-index: 1; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.hero-kicker { margin: 0 0 6px; color: #87e3eb; font-size: 12px; font-weight: 700; }
.hero-title { margin: 0; font-size: clamp(24px, 3vw, 35px); font-weight: 700; line-height: 1.35; }
.hero-subtitle { max-width: 660px; margin: 7px 0 0; color: rgba(255,255,255,.74); font-size: 13px; line-height: 1.8; }
.hero-year { flex: 0 0 auto; min-width: 150px; padding: 13px 16px; border: 1px solid rgba(255,255,255,.15); border-radius: 16px; background: rgba(255,255,255,.1); backdrop-filter: blur(10px); }
.hero-year span { display: block; color: rgba(255,255,255,.65); font-size: 11px; }
.hero-year strong { display: block; margin-top: 3px; font-size: 17px; }

.tab-rail { margin-bottom: 24px; padding: 8px; overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.72); box-shadow: 0 12px 35px rgba(30,60,90,.07); backdrop-filter: blur(14px); }
.tab-rail nav { display: flex; gap: 7px; min-width: max-content; }
.modern-app .tab-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px !important; color: #63748b !important; border: 0 !important; border-radius: 12px; transition: .2s ease; }
.modern-app .tab-btn:hover { color: var(--blue) !important; background: #eef6ff; }
.modern-app .tab-btn.active { color: #fff !important; background: linear-gradient(110deg, var(--blue), #0d8fa3); box-shadow: 0 10px 25px rgba(23,107,206,.24); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { position: relative; overflow: hidden; min-height: 145px; padding: 21px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 14px 38px rgba(26,55,88,.075); }
.metric-card::after { content: ''; position: absolute; width: 88px; height: 88px; left: -28px; bottom: -34px; border-radius: 50%; background: var(--metric-soft, rgba(23,107,206,.1)); }
.metric-top { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.metric-label { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.metric-value { margin: 0; font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.metric-value small { font-size: 14px; color: var(--muted); }
.metric-icon { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; color: var(--metric-color, var(--blue)); background: var(--metric-soft, rgba(23,107,206,.1)); }
.metric-context { position: relative; z-index: 1; margin-top: 17px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.metric-context.positive { color: var(--green); }
.metric-context.negative { color: var(--red); }
.metric-blue { --metric-color: #176bce; --metric-soft: rgba(23,107,206,.11); }
.metric-teal { --metric-color: #12879a; --metric-soft: rgba(18,135,154,.11); }
.metric-gold { --metric-color: #c88613; --metric-soft: rgba(232,170,54,.14); }
.metric-green { --metric-color: #148362; --metric-soft: rgba(20,131,98,.11); }

.analytics-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); gap: 18px; margin-bottom: 20px; }
.analytics-stack { display: grid; gap: 18px; }
.panel, .modern-app .card, .modern-app .glass-card { border: 1px solid var(--line); border-radius: 21px; background: var(--surface); box-shadow: 0 15px 42px rgba(27,56,89,.075); }
.modern-app .card:hover, .modern-app .glass-card:hover { box-shadow: 0 20px 50px rgba(27,56,89,.105); transform: translateY(-1px); }
.chart-panel { padding: 22px; min-height: 360px; }
.panel-header { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.panel-title { margin: 0; color: var(--ink); font-size: 16px; font-weight: 700; }
.panel-description { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.panel-chip { flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; color: var(--blue); background: #edf6ff; font-size: 10px; font-weight: 700; }
.chart-stage { position: relative; height: 285px; }
.chart-stage.compact { height: 230px; }

.insight-panel { padding: 21px; }
.insight-list { display: grid; gap: 10px; }
.insight-item { display: grid; grid-template-columns: 37px 1fr; gap: 11px; padding: 12px; border-radius: 15px; background: #f7faff; border: 1px solid #edf2f8; }
.insight-item .insight-icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 12px; color: var(--blue); background: #e8f3ff; }
.insight-item.warning .insight-icon { color: #b87709; background: #fff5dc; }
.insight-item.danger .insight-icon { color: #c54545; background: #ffebeb; }
.insight-item.success .insight-icon { color: #137b5c; background: #e7f7f1; }
.insight-item h4 { margin: 0 0 3px; font-size: 12px; font-weight: 700; }
.insight-item p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.65; }

.progress-list { display: grid; gap: 15px; }
.progress-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.progress-row-head strong { color: var(--ink); font-size: 12px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: #e9eff6; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.progress-fill.gold { background: linear-gradient(90deg, #d9951d, #f2c76f); }
.progress-fill.green { background: linear-gradient(90deg, #148362, #31baa0); }

.rank-list { display: grid; gap: 8px; }
.rank-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #edf1f6; }
.rank-row:last-child { border: 0; }
.rank-index { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 9px; color: var(--blue); background: #edf6ff; font-size: 10px; font-weight: 700; }
.rank-name { overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.rank-meta { color: var(--muted); font-size: 9px; }
.rank-score { text-align: left; font-size: 13px; font-weight: 700; }
.rank-delta { display: block; font-size: 9px; color: var(--green); }
.rank-delta.down { color: var(--red); }

.matrix-panel { padding: 22px; overflow: hidden; }
.modern-app table { border-collapse: separate; border-spacing: 0; }
.modern-app table thead th { color: #65758a; background: #f3f7fb !important; border-color: #e6edf4 !important; font-size: 11px; font-weight: 700; }
.modern-app table tbody td { border-color: #edf1f5 !important; }
.modern-app table tbody tr { transition: background .15s ease; }
.modern-app table tbody tr:hover { background: #f7fbff; }

.modern-app input:not([type='hidden']):not([type='checkbox']):not([type='radio']), .modern-app select, .modern-app textarea {
  border: 1px solid #dce5ee !important; border-radius: 12px !important; background: rgba(255,255,255,.86) !important; transition: border-color .2s, box-shadow .2s;
}
.modern-app input:focus, .modern-app select:focus, .modern-app textarea:focus { outline: none !important; border-color: #5a9fe8 !important; box-shadow: 0 0 0 4px rgba(23,107,206,.09) !important; }
.modern-app button[type='submit'], .primary-action { border-radius: 12px !important; box-shadow: 0 9px 22px rgba(23,107,206,.16); }

.employee-hero { margin-bottom: 20px; }
.employee-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .72fr); gap: 18px; }
.profile-orb { position: relative; width: 76px; height: 76px; margin: 0 auto 14px; display: grid; place-items: center; color: #fff; border-radius: 24px; background: linear-gradient(135deg, var(--blue), var(--cyan)); box-shadow: 0 15px 32px rgba(23,107,206,.25); font-size: 27px; font-weight: 700; transform: rotate(4deg); }
.profile-orb span { transform: rotate(-4deg); }
.status-banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; color: #176a54; background: #eaf8f3; border: 1px solid #d4efe5; }

@media (max-width: 1024px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .analytics-layout, .employee-grid { grid-template-columns: 1fr; }
  .analytics-stack { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .app-nav-inner, .page-shell { padding-left: 14px; padding-right: 14px; }
  .brand-eyebrow, .nav-link span { display: none; }
  .brand-title { font-size: 14px; }
  .brand-logos img { height: 31px; }
  .hero-strip { padding: 22px 19px; border-radius: 20px; }
  .hero-content { align-items: start; flex-direction: column; }
  .hero-year { min-width: 0; width: 100%; }
  .metric-grid, .analytics-stack { grid-template-columns: 1fr; }
  .metric-card { min-height: 128px; }
  .chart-panel, .matrix-panel { padding: 17px; }
  .chart-stage { height: 250px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media (max-width: 480px) {
  .hero-year {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px;
  }
  .hero-year strong {
    font-size: 15px;
  }
  .metric-card {
    padding: 15px;
    min-height: 110px;
  }
  .metric-value {
    font-size: 24px;
  }
  .metric-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
}
