/* Filtary identity — water, navy, quiet light
   The font tokens live in filtary-fonts.css, loaded ahead of this file.
   What belongs here is the identity's type hierarchy: which surfaces
   speak in the display voice. */
.ui-title, .auth-title, .sidebar-brand-title, .app-top h1,
.kpi-value, .page-head .ui-title, .panel-head h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.01em;
}

/* Arabic is a connected script: the letterforms already join, and negative
   tracking pulls the joins apart, so the tightening that flatters Latin
   headings has to be undone for Arabic. Weight carries the hierarchy here
   instead. */
html[dir="rtl"] .ui-title,
html[dir="rtl"] .auth-title,
html[dir="rtl"] .sidebar-brand-title,
html[dir="rtl"] .app-top h1,
html[dir="rtl"] .kpi-value,
html[dir="rtl"] .page-head .ui-title,
html[dir="rtl"] .panel-head h3 {
  letter-spacing: 0;
}

body {
  background:
    radial-gradient(900px 380px at 110% -12%, rgba(69,165,255,.22), transparent 58%),
    radial-gradient(720px 320px at -8% 108%, rgba(16,40,63,.08), transparent 50%),
    linear-gradient(180deg, #F7FBFF 0%, #F4F8FC 42%, #EEF4FA 100%);
}

.brand-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 42px;
  pointer-events: none;
  color: #F4F8FC;
}
.brand-wave svg { display: block; width: 100%; height: 100%; }

.auth-screen {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: 48px 20px 64px;
  justify-content: center;
  background:
    radial-gradient(circle at 88% 0%, rgba(69,165,255,.28), transparent 36%),
    radial-gradient(circle at 8% 100%, rgba(16,40,63,.1), transparent 42%),
    linear-gradient(180deg, #EAF2FF 0%, #F4F8FC 55%, #fff 100%);
}
.auth-screen::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 88px;
  background:
    linear-gradient(135deg, #10283F 0%, #1F6FEB 100%)
    no-repeat;
}
.auth-screen::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 72px;
  height: 28px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 80' preserveAspectRatio='none'%3E%3Cpath fill='%23EAF2FF' d='M0 40c180 24 360-24 540-8s360 40 540 8 360-32 360-8v48H0z'/%3E%3C/svg%3E") no-repeat bottom / 100% 28px;
}
.auth-screen > * { position: relative; z-index: 1; }
.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}
.auth-screen .auth-logo {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  border-radius: 22px;
  font-size: 34px;
  box-shadow: 0 16px 36px rgba(16,40,63,.22);
}
.auth-card {
  max-width: 420px;
  margin: 0 auto;
  border-radius: 22px;
  border-color: rgba(232,239,246,.9);
  box-shadow: 0 18px 50px rgba(16,40,63,.1);
  padding: 20px 18px;
}
.auth-screen .ui-btn--primary {
  min-height: 50px;
  border-radius: 12px;
}
.auth-screen .auth-title { color: #0E2238; letter-spacing: -.02em; }
.auth-screen .auth-copy { margin-bottom: 20px; }
.auth-screen .ui-card {
  border-radius: 22px;
  border-color: rgba(232,239,246,.9);
  box-shadow: 0 18px 50px rgba(16,40,63,.1);
  padding: 20px 18px;
}
.auth-screen .ui-btn--primary {
  min-height: 50px;
  border-radius: 14px;
}
.auth-screen a {
  color: var(--brand-on-soft);
  font-weight: 700;
  text-decoration: none;
}

.web-sidebar {
  overflow: auto;
  background:
    radial-gradient(220px 140px at 100% 0%, rgba(69,165,255,.28), transparent 72%),
    linear-gradient(180deg, #10283F 0%, #0D2134 72%, #0B1C2C 100%);
  padding-bottom: 56px;
}
.web-sidebar::after {
  content: none;
}
.sidebar-brand {
  padding: 6px 8px 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 14px;
}
.sidebar-brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  box-shadow: 0 10px 22px rgba(0,0,0,.24);
}
.sidebar-link {
  border-radius: 12px;
  padding: 10px 14px;
  color: #C5D4E2;
  font-weight: var(--weight-semibold);
}
.sidebar-link.is-active {
  background: linear-gradient(135deg, #1F6FEB, #175CD3);
  box-shadow: 0 8px 20px rgba(31,111,235,.32);
}
.web-topbar {
  background: rgba(247,251,255,.86);
}
.ui-card,
.kpi-card,
.chart-panel {
  border-radius: 18px;
}
.kpi-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, #fff 0%, #F8FBFE 100%);
}
.kpi-card::after {
  content: "";
  position: absolute;
  left: -20px;
  bottom: -28px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31,111,235,.1), transparent 68%);
}
.kpi-icon {
  border-radius: 14px;
}
/* The droplet is a real element (.drop in the dashboard markup), so it can
   take the tone colour from .kpi-icon.is-* and scale on its own. It used to
   be a ::before paired with `font-size: 0` on .kpi-icon, which painted the
   same drop twice, and the font-size reset would have swallowed any text the
   slot ever held. */
.drop {
  width: 16px;
  height: 22px;
  background-color: currentColor;
  clip-path: path("M8 0C8 0 0 9 0 14a8 8 0 0 0 16 0C16 9 8 0 8 0z");
}
.page-head .ui-title::before {
  width: 5px;
  background: linear-gradient(180deg, #45A5FF, #1F6FEB 55%, #10283F);
}
.ui-btn--primary {
  /* Top stop is the lightest pixel behind the white label. #3D8BFF gave
     3.31:1, which fails 4.5:1; #2A6FE0 gives 4.72:1 and keeps the ramp. */
  background: linear-gradient(180deg, #2A6FE0, #1F6FEB);
  border-radius: 12px;
}
.ui-input:focus,
.ui-select:focus,
.ui-textarea:focus {
  box-shadow: 0 0 0 4px rgba(31,111,235,.12);
}

.app-body {
  font-family: var(--font-body);
  background:
    radial-gradient(640px 260px at 100% -8%, rgba(31,111,235,.18), transparent 56%),
    #F4F8FC;
}
.app-shell {
  box-shadow: 0 0 0 1px #E8EFF6, 0 24px 60px rgba(16,40,63,.1);
}
.app-top {
  position: relative;
  overflow: hidden;
  padding: 22px 18px 28px;
  background:
    radial-gradient(220px 120px at 0% 0%, rgba(255,255,255,.2), transparent 62%),
    linear-gradient(135deg, #10283F 0%, #163E63 42%, #1F6FEB 100%);
}
.app-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 80' preserveAspectRatio='none'%3E%3Cpath fill='%23F4F8FC' d='M0 48c180 24 360-24 540-16s360 40 540 16 360-40 360-16v32H0z'/%3E%3C/svg%3E") no-repeat bottom / 100% 18px;
}
.app-card {
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(16,40,63,.05);
}
.app-nav {
  backdrop-filter: blur(16px);
}
.app-top-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.app-top-brand .sidebar-brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}
.app-top-brand h1 { margin: 0; }
.apps-stack { display: grid; gap: 12px; }
.apps-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #E8EFF6;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 10px 28px rgba(16,40,63,.06);
}
.apps-tile b { display: block; font-family: var(--font-display); }
.apps-tile span { color: var(--text-muted); font-size: 13px; }
.apps-tile-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(145deg, #45A5FF, #1F6FEB 58%, #10283F);
}

@media (prefers-reduced-motion: reduce) {
  .kpi-card, .ui-btn, .ui-card--clickable, .sidebar-link { transition: none; }
}
