/* Grantly — modern light theme: warm cream + soft violet, RTL. Everything derives from the tokens below.
   Token names are a contract: templates/upload.html and templates/admin/* read them inline. */
:root {
  /* surfaces */
  --bg:         #fdfaf4;   /* warm cream, the brand background */
  --bg-soft:    #f7f2ea;   /* alternate band */
  --surface:    #ffffff;   /* cards */
  --surface-2:  #fbf9ff;   /* faint violet-tinted card */

  /* brand */
  --violet:     #8b6fd6;   /* primary accent */
  --violet-2:   #b9a4ec;   /* light accent / gradients */
  --violet-ink: #6a4fc2;   /* text + primary buttons on light, AA-safe */
  --violet-deep:#553ca8;   /* primary hover */
  --lilac:      #efeafb;   /* pale fills */
  --lilac-2:    #f6f3fd;   /* palest hover fill */
  --magenta:    var(--violet-2);   /* back-compat: inline template gradients */

  /* text + lines */
  --text:       #231d30;
  --muted:      #686079;
  --line:       rgba(40, 30, 60, 0.09);
  --line-strong:rgba(40, 30, 60, 0.16);

  /* status */
  --danger:     #c0476b;
  --danger-bg:  #fdf0f3;
  --ok:         #2f9e6f;
  --ok-bg:      #ecf8f2;
  --warn-bg:    #fff6e8;
  --warn-ink:   #9a5b0c;
  --hot-1:      #ff7a59;
  --hot-2:      #e0457b;

  /* shape */
  --radius-sm:  10px;
  --radius:     14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* depth */
  --blur:       blur(14px) saturate(1.6);
  --glass-blur: blur(18px) saturate(1.4);
  --glass-hi:   inset 0 1px 0 rgba(255, 255, 255, 0.75);
  --shadow-xs:  0 1px 2px rgba(35, 25, 55, 0.06);
  --shadow-sm:  0 1px 2px rgba(35, 25, 55, 0.05), 0 4px 14px -8px rgba(70, 50, 130, 0.16);
  --shadow-md:  0 2px 4px rgba(35, 25, 55, 0.04), 0 18px 36px -18px rgba(70, 50, 130, 0.28);
  --shadow-lg:  0 30px 60px -28px rgba(70, 50, 130, 0.35);
  --shadow-glow:0 12px 28px -12px rgba(106, 79, 194, 0.45);
  --ring:       0 0 0 4px rgba(139, 111, 214, 0.18);

  /* type */
  --font-body:    "Heebo", system-ui, "Segoe UI", sans-serif;
  --font-display: "Rubik", "Heebo", system-ui, sans-serif;
  --step--2: 0.78rem;
  --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0:  clamp(1rem, 0.97rem + 0.15vw, 1.06rem);
  --step-1:  clamp(1.15rem, 1.08rem + 0.35vw, 1.3rem);
  --step-2:  clamp(1.4rem, 1.25rem + 0.75vw, 1.8rem);
  --step-3:  clamp(1.8rem, 1.5rem + 1.5vw, 2.5rem);
  --step-4:  clamp(2.2rem, 1.75rem + 2.3vw, 3.3rem);
  --step-5:  clamp(2.5rem, 1.8rem + 3.6vw, 4.2rem);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --topbar-h: 68px;
}

/* ---- base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.7;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 50% -140px, rgba(185, 164, 236, 0.30), transparent 70%),
    radial-gradient(600px 400px at 100% 30%, rgba(185, 164, 236, 0.10), transparent 70%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .brand {
  font-family: var(--font-display);
  font-weight: 700; line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--step-3); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); font-weight: 600; }
p { margin: 0 0 1em; text-wrap: pretty; }

a { color: var(--violet-ink); text-decoration: none; transition: color .15s; }
a:hover { color: var(--violet-deep); }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 8px; }

.skip {
  position: absolute; inset-inline-start: -999px; top: 0; z-index: 100;
  background: var(--violet-ink); color: #fff; padding: 10px 16px; border-end-start-radius: 12px;
}
.skip:focus { inset-inline-start: 0; color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ico { flex: none; display: inline-block; vertical-align: -0.2em; }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
code {
  background: var(--lilac); color: var(--violet-ink); padding: 2px 8px; border-radius: 6px;
  font-size: .92em; direction: ltr; unicode-bidi: isolate;
}

/* ---- top bar -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(253, 250, 244, 0.78);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  max-width: 1120px; height: var(--topbar-h); margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px);
}
/* Small logo pinned to the right (RTL first child). NOT a hero image: capped height, never stretched. */
.topbar .brand { display: inline-flex; align-items: center; flex: 0 0 auto; margin: 0; }
.brand-logo { display: block; height: auto; max-height: 38px; width: auto; }
.topbar nav { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; }
.topbar nav a:not(.cta) {
  position: relative; color: var(--muted); font-weight: 500; font-size: .96rem;
  padding: 8px 14px; border-radius: 999px; transition: background .2s, color .2s;
}
.topbar nav a:not(.cta):hover { color: var(--text); background: rgba(139, 111, 214, 0.08); }
.topbar nav a[aria-current="page"] { color: var(--violet-ink); background: var(--lilac); font-weight: 600; }
.topbar nav .nav-quiet { opacity: .85; }
.topbar nav .cta { margin-inline-start: 8px; }

/* ---- layout --------------------------------------------------------------- */
.container {
  width: 100%; max-width: 1120px; margin: 0 auto; flex: 1;
  padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 32px) clamp(48px, 7vw, 88px);
}

/* ---- buttons -------------------------------------------------------------- */
.cta, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 22px; border-radius: 999px;
  font: inherit; font-size: .98rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, color .2s;
}
/* primary: solid violet, white text */
.cta {
  background: var(--violet-ink); color: #fff; border: 1px solid var(--violet-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 16px -8px rgba(85, 60, 168, 0.7);
}
.cta:hover {
  color: #fff; background: var(--violet-deep); border-color: var(--violet-deep);
  transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--shadow-glow);
}
.cta:active, .btn:active { transform: translateY(0); }
/* secondary: white with a hairline */
.btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.btn:hover {
  color: var(--violet-ink); background: var(--lilac-2); border-color: var(--violet-2);
  transform: translateY(-1px);
}
.btn-quiet { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--lilac-2); border-color: transparent; }
.cta-sm { min-height: 38px; padding: 7px 18px; font-size: .92rem; }
.cta-lg, .btn-lg { min-height: 52px; padding: 13px 28px; font-size: 1.04rem; }
.btn.danger { color: var(--danger); border-color: rgba(192, 71, 107, 0.4); }
.btn.danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
button:disabled, .cta:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- flash ---------------------------------------------------------------- */
.flash {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-xs);
  border-inline-start: 4px solid var(--violet);
}
.flash.error { border-color: rgba(192, 71, 107, 0.35); border-inline-start-color: var(--danger); background: var(--danger-bg); color: #8a2f49; }
.flash.success { border-color: rgba(47, 158, 111, 0.35); border-inline-start-color: var(--ok); background: var(--ok-bg); color: #1f6f4d; }

/* ---- shared section headings --------------------------------------------- */
.kicker {
  display: inline-block; margin-bottom: 8px;
  font-family: var(--font-display); font-size: var(--step--1); font-weight: 600;
  color: var(--violet-ink); letter-spacing: .01em;
}
.page-head { margin: 0 0 clamp(20px, 3vw, 32px); max-width: 760px; }
.page-head h1 { margin-bottom: 8px; }
.page-sub { color: var(--muted); font-size: var(--step-1); line-height: 1.55; margin: 0; }
.sub-title { display: flex; align-items: center; gap: 8px; font-size: var(--step-1); margin: 0 0 4px; }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: clamp(48px, 8vw, 88px) 0 22px;
}
.section-head h2 { margin: 0; }
.section-head-center { flex-direction: column; align-items: center; text-align: center; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.link-arrow .ico { transition: transform .2s var(--ease); }
.link-arrow:hover .ico { transform: translateX(-3px); }

/* ---- hero ----------------------------------------------------------------- */
.hero { position: relative; text-align: center; padding: clamp(24px, 6vw, 72px) 0 clamp(8px, 2vw, 16px); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.8); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
  color: var(--text); font-weight: 500; font-size: var(--step--1);
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(47, 158, 111, 0.16); }
.hero h1 {
  font-size: var(--step-5); line-height: 1.08; letter-spacing: -0.035em;
  max-width: 15ch; margin: 22px auto 0;
}
.hero h1 .accent {
  background: linear-gradient(100deg, var(--violet-ink) 10%, var(--violet) 60%, #a78bf0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lead {
  font-size: var(--step-1); line-height: 1.6; color: var(--muted);
  max-width: 52ch; margin: 20px auto 0;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }
.trust-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px;
  list-style: none; padding: 0; margin: 26px 0 0; color: var(--muted); font-size: var(--step--1);
}
.trust-row li { display: inline-flex; align-items: center; gap: 6px; }
.trust-row .ico { color: var(--ok); }

/* ---- how it works --------------------------------------------------------- */
.how { margin-top: clamp(40px, 7vw, 72px); }
.steps {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  list-style: none; padding: 0; margin: 0 auto; max-width: 880px; position: relative;
}
.steps li {
  position: relative; display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  padding: 18px 20px; border-radius: var(--radius-lg); font-weight: 500;
}
.step-num {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, var(--violet-ink), var(--violet));
  color: #fff; font-family: var(--font-display); font-weight: 700;
  box-shadow: 0 6px 14px -6px rgba(85, 60, 168, 0.7);
}

/* ---- features ------------------------------------------------------------- */
.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.feature-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px 24px; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(139, 111, 214, 0.3); }
.feature-card h3 { margin: 16px 0 6px; font-size: 1.1rem; }
.feature-card p { color: var(--muted); margin: 0; font-size: var(--step--1); line-height: 1.65; }
.feature-ico {
  display: inline-grid; place-items: center; width: 48px; height: 48px;
  background: var(--lilac); color: var(--violet-ink); border-radius: 14px;
}

/* ---- closing CTA band ----------------------------------------------------- */
.cta-band {
  display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap;
  margin-top: clamp(56px, 9vw, 96px); padding: clamp(28px, 5vw, 44px);
  border-radius: var(--radius-xl); color: #fff;
  background:
    radial-gradient(420px 220px at 12% 0%, rgba(255, 255, 255, 0.22), transparent 70%),
    linear-gradient(125deg, var(--violet-deep), var(--violet-ink) 45%, var(--violet));
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { margin: 0 0 6px; color: #fff; }
.cta-band p { margin: 0; color: rgba(255, 255, 255, 0.85); max-width: 48ch; }
.cta-band .cta { background: #fff; color: var(--violet-deep); border-color: #fff; }
.cta-band .cta:hover { background: var(--lilac); color: var(--violet-deep); }

/* ---- cards ---------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }

.card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
a.card:hover { color: var(--text); transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(139, 111, 214, 0.35); }
.card h3 { margin: 4px 0 0; font-size: 1.14rem; line-height: 1.35; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--violet-ink); }
.card .provider { color: var(--muted); margin: 0; font-size: var(--step--1); }
.card .desc { color: var(--muted); font-size: var(--step--1); line-height: 1.6; margin: 6px 0 0; }
.card > p:not([class]) { margin: 0; }
.card-top { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line);
}
.card-link { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; color: var(--violet-ink); font-weight: 600; font-size: var(--step--1); }
a.card:hover .card-link .ico { transform: translateX(-3px); }
.card-link .ico { transition: transform .2s var(--ease); }
.card-actions, .detail-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card-actions { margin-top: auto; padding-top: 16px; }
.card-actions form, .detail-actions form { margin: 0; }

/* Fixed-size scholarship cards (doc 17): uniform height, clamped text. Scoped to a.card. */
a.card { min-height: 250px; }
a.card h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
a.card .provider { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.card .desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ₪ amount pill + big number */
.amount-badge {
  align-self: flex-start; display: inline-flex; align-items: center;
  background: var(--lilac); color: var(--violet-ink);
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  padding: 4px 12px; border-radius: 999px; direction: ltr; unicode-bidi: isolate;
}
.amount {
  font-family: var(--font-display); font-weight: 800; font-size: var(--step-3); letter-spacing: -0.02em;
  color: var(--violet-ink); margin: 2px 0;
}
/* ₪ amounts and link codes read LTR; right-aligned so they sit on the RTL start edge.
   Not on bare .amount: admin KPI tiles mix RTL markup inside it. */
.side-card .amount, .code-display { direction: ltr; unicode-bidi: isolate; }
.side-card .amount { text-align: right; }
.score {
  position: absolute; inset-inline-end: 16px; top: 16px;
  font-family: var(--font-display); font-weight: 700; color: var(--violet-ink);
  background: var(--lilac); border-radius: 999px; padding: 2px 12px;
}
.reasons, .missing, .status { font-size: var(--step--1); color: var(--muted); margin: 4px 0 0; }
.missing { color: var(--warn-ink); }

/* agent-fillable ("hot") cards: warm top accent line + soft glow (doc 21.9 / 23.3 / 24) */
.card.agent-card { background: linear-gradient(170deg, #ffffff 55%, #f6f2ff); }
.card.hot { border-color: rgba(224, 69, 123, 0.28); box-shadow: var(--shadow-sm), 0 14px 30px -18px rgba(224, 69, 123, 0.45); }
.card.hot::before {
  content: ""; position: absolute; inset: -1px -1px auto -1px; height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(90deg, var(--hot-1), var(--hot-2));
}
a.card.hot:hover { border-color: rgba(224, 69, 123, 0.45); }
.hot-badge {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, var(--hot-1), var(--hot-2)); color: #fff;
  font-family: var(--font-display); font-weight: 600; font-size: .76rem; line-height: 1.35;
  padding: 4px 11px; border-radius: 10px; text-wrap: balance;
  box-shadow: 0 6px 16px -8px rgba(224, 69, 123, 0.8);
}
.agent-badge {
  align-self: flex-start; margin-bottom: 4px;
  background: linear-gradient(135deg, var(--violet), var(--violet-2));
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: .78rem;
  padding: 4px 12px; border-radius: 999px;
}
.closed-card { opacity: .88; }
.closed-card:hover { opacity: 1; }

.date-pill {
  align-self: flex-start; display: inline-flex; align-items: center;
  background: var(--lilac); color: var(--violet-ink);
  font-size: var(--step--1); font-weight: 600; line-height: 1.4; padding: 3px 12px; border-radius: 999px;
}
.date-pill.urgent { background: #fdeef2; color: var(--danger); }
.date-pill.closed { background: #f1eef4; color: var(--muted); }

.scope-sub { font-size: .82rem; color: var(--violet-ink); margin: 6px 0 0; line-height: 1.55; }
.scope-sub.muted { color: var(--muted); }

.tg-indication { font-size: var(--step--1); color: var(--muted); }

/* ---- status chips (dashboard / my scholarships) --------------------------- */
.status-chip {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--step--1); font-weight: 600; line-height: 1.4; padding: 3px 12px; border-radius: 999px;
}
.status-chip.done { background: var(--ok-bg); color: #1f6f4d; }
.status-chip.todo { background: var(--warn-bg); color: var(--warn-ink); }
.status-chip.info { background: var(--lilac); color: var(--violet-ink); }

/* ---- empty state ---------------------------------------------------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center; color: var(--muted); padding: clamp(36px, 6vw, 56px) 20px;
  background: var(--surface); border: 1px dashed var(--violet-2); border-radius: var(--radius-lg);
}
.empty p { max-width: 48ch; margin: 0; }
.empty .hero-actions { margin-top: 8px; }
.empty-ico {
  display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px;
  background: var(--lilac); color: var(--violet-ink);
}
.empty + .btn, .empty + .cta { margin-top: 16px; }

/* ---- catalog filters ------------------------------------------------------ */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; margin: 0 0 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 10px; box-shadow: var(--shadow-sm);
}
.filters label { display: block; margin: 0; }
.filters .search-field { position: relative; flex: 2 1 240px; }
.filters .search-field .ico { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filters .search-field input { padding-inline-start: 42px; }
.filters .select-field { flex: 1 1 170px; }
.filters input, .filters select { height: 44px; background-color: var(--lilac-2); border-color: transparent; }
.filters input:focus, .filters select:focus { background-color: #fff; }
.filters button { flex: 0 0 auto; padding-inline: 26px; }
.result-count { color: var(--muted); font-size: var(--step--1); margin: 0 0 14px; }

/* ---- forms ---------------------------------------------------------------- */
.form-grid, .auth-card form { display: grid; gap: 16px; }
.form-grid { grid-template-columns: 1fr 1fr; }
.form-grid .full, fieldset.full { grid-column: 1 / -1; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

label { display: grid; gap: 6px; color: var(--text); font-size: var(--step--1); font-weight: 500; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin-inline-end: 16px; font-weight: 400; }

input, select, textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px; min-height: 46px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  font: inherit; font-size: 1rem; font-weight: 400;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
textarea { min-height: 0; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #a39cb3; }
input:hover, select:hover, textarea:hover { border-color: rgba(139, 111, 214, 0.45); }
input:focus, select:focus, textarea:focus { border-color: var(--violet); box-shadow: var(--ring); outline: none; }
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--violet-ink); }

/* selects: custom chevron, no native arrow crowding the RTL text */
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236a4fc2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center; padding-inline-start: 36px;
}

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { color: var(--text); font-size: var(--step--1); font-weight: 600; padding: 0; margin-bottom: 10px; }

/* toggle switch (a styled checkbox inside label.switch) */
label.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
label.switch input {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; cursor: pointer;
  width: 42px; height: 24px; min-height: 0; padding: 0; border: 0; border-radius: 999px;
  background: var(--line-strong); transition: background .2s;
}
label.switch input::before {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: inset-inline-start .2s var(--ease);
}
label.switch input:checked { background: var(--violet-ink); }
label.switch input:checked::before { inset-inline-start: 21px; }

/* ---- auth / contact / telegram cards -------------------------------------- */
.auth-card {
  max-width: 460px; margin: clamp(0px, 3vw, 24px) auto 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl);
  padding: clamp(24px, 5vw, 40px); box-shadow: var(--shadow-md);
}
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head h1 { font-size: var(--step-2); margin: 14px 0 6px; }
.auth-head p { margin: 0; }
.auth-ico {
  display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px;
  background: var(--lilac); color: var(--violet-ink);
}
.auth-card form .cta, .auth-card > .cta { width: 100%; margin-top: 4px; min-height: 48px; }
.auth-foot { text-align: center; margin: 20px 0 0; font-size: var(--step--1); }
.auth-card .back { margin-bottom: 18px; }
.tg-card .auth-head .side-label { margin-top: 14px; }
.code-display {
  text-align: center; font-size: var(--step-2); letter-spacing: .04em; overflow-wrap: anywhere;
  background: var(--lilac-2); border: 1px dashed var(--violet-2); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0 0;
}
.privacy-note { display: flex; align-items: flex-start; justify-content: center; gap: 8px; text-align: center; max-width: 56ch; margin: 22px auto 0; font-size: var(--step--1); }
.privacy-note .ico { margin-top: 3px; }

/* ---- scholarship detail --------------------------------------------------- */
.back {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px;
  color: var(--muted); font-size: var(--step--1); font-weight: 500;
}
.back:hover { color: var(--violet-ink); }
.detail-head { max-width: 760px; margin-bottom: 24px; }
.detail-head h1 { font-size: var(--step-4); line-height: 1.12; margin: 12px 0 8px; }
.detail-head .provider { color: var(--muted); font-size: var(--step-1); margin: 0; }
.detail-hot { font-size: .85rem; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.detail {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(22px, 4vw, 36px); box-shadow: var(--shadow-sm);
}
.detail-section + .detail-section { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.detail-section h2 { font-size: 1.1rem; margin: 0 0 10px; }
.detail-section p:last-child { margin-bottom: 0; }
.detail h3 { margin-top: 22px; }

.meta-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin: 0; }
.meta-list > div { background: var(--lilac-2); border-radius: var(--radius); padding: 12px 14px; }
.meta-list dt { color: var(--muted); font-size: var(--step--2); font-weight: 600; margin-bottom: 2px; }
.meta-list dd { margin: 0; font-weight: 500; }

.doc-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.doc-list li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.doc-list .ico { color: var(--violet-ink); }
.detail-section .muted.small { display: flex; align-items: flex-start; gap: 6px; }
.detail-section .muted.small .ico { margin-top: 3px; }

.detail-side { position: sticky; top: calc(var(--topbar-h) + 20px); }
.side-card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-md);
}
.side-label { color: var(--muted); font-size: var(--step--1); font-weight: 600; margin: 0; }
.side-card .amount { margin: -6px 0 0; }
.side-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.side-pills:empty { display: none; }
.side-card .muted.small { margin: 0; }
.side-actions { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.side-actions > .cta, .side-actions > .btn, .side-actions form .cta, .side-actions form .btn, .side-apply .cta { width: 100%; }
.side-actions form { margin: 0; }
.side-apply { display: grid; gap: 6px; text-align: center; }

.fill-note {
  display: flex; align-items: flex-start; gap: 10px; margin: 0;
  background: var(--lilac-2); color: var(--violet-ink);
  border-radius: var(--radius); padding: 12px 14px; font-weight: 600; font-size: var(--step--1); line-height: 1.55;
}
.saved-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 999px;
  background: var(--ok-bg); color: #1f6f4d; font-weight: 700; font-family: var(--font-display);
}

/* ---- urgency: countdown + scope note ------------------------------------- */
.countdown-banner {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 16px; padding: 8px 16px; line-height: 1.5;
  background: #fdeef2; border: 1px solid rgba(224, 69, 123, 0.3); border-radius: 999px;
  color: var(--danger); font-weight: 600; font-size: var(--step--1);
}
.countdown-banner strong { font-weight: 800; }
.hero-countdown { margin: 22px auto 0; }
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--hot-2); flex: none; }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--hot-2);
  animation: pulse 1.8s var(--ease) infinite;
}
@keyframes pulse { from { transform: scale(1); opacity: .6; } to { transform: scale(3); opacity: 0; } }

.scope-note {
  display: flex; align-items: flex-start; gap: 12px; max-width: 860px;
  margin: 0 0 22px; padding: 14px 18px; line-height: 1.65;
  background: var(--surface-2); border: 1px solid rgba(139, 111, 214, 0.22); border-radius: var(--radius);
  color: var(--text); font-size: var(--step--1);
}
.scope-note .ico { color: var(--violet-ink); margin-top: 2px; }
.scope-note p { margin: 0; }

/* ---- 404 ------------------------------------------------------------------ */
.notfound { text-align: center; padding: clamp(40px, 8vw, 96px) 20px; }
.notfound .big {
  font-family: var(--font-display); font-size: clamp(4rem, 3rem + 6vw, 7.5rem); font-weight: 800; line-height: 1;
  letter-spacing: -0.04em; margin-bottom: 12px;
  background: linear-gradient(120deg, var(--violet-ink), var(--violet-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- footer --------------------------------------------------------------- */
.footer { border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.5); color: var(--muted); font-size: var(--step--1); }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap;
  max-width: 1120px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 32px) 18px;
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand img { height: 28px; width: auto; }
.footer-brand p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer-links a { color: var(--muted); font-weight: 500; }
.footer-links a:hover { color: var(--violet-ink); }
.footer-note { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px) 24px; font-size: var(--step--2); opacity: .85; }

/* ---- profile + questionnaire forms (doc 19) ------------------------------- */
.profile-head { max-width: 760px; }

/* sticky completion meter */
.progress-card {
  position: sticky; top: calc(var(--topbar-h) + 10px); z-index: 20; max-width: 760px;
  background: rgba(255, 255, 255, 0.88); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow-sm); margin: 0 0 22px;
}
.progress-top { display: flex; justify-content: space-between; font-size: var(--step--1); color: var(--muted); margin-bottom: 8px; }
.progress-top #progressPct { font-family: var(--font-display); font-weight: 700; color: var(--violet-ink); }
.progress-track { height: 8px; border-radius: 999px; background: var(--lilac); overflow: hidden; }
.progress-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--violet-2), var(--violet-ink));
  transition: width .35s var(--ease);
}

.profile-form { max-width: 760px; display: grid; gap: 20px; }
.form-section {
  display: grid; gap: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow-sm);
}
.form-section h2 { display: flex; align-items: center; gap: 10px; font-size: var(--step-1); margin: 0; }
.form-section .sec-num {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 10px; background: var(--lilac); color: var(--violet-ink);
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
}
.form-section .form-grid { gap: 18px 16px; }

/* phone: fixed +972 chip + LTR number input */
.phone-row { display: flex; align-items: stretch; gap: 8px; direction: ltr; }
.phone-cc {
  display: inline-grid; place-items: center; padding: 0 12px; flex: none;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--lilac-2);
  color: var(--violet-ink); font-family: var(--font-display); font-weight: 700;
}
.phone-row input { flex: 1; }

input[type="date"] { font: inherit; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; }
input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: 1; }

.field-hint { font-size: var(--step--2); color: var(--muted); font-weight: 400; }
.field-error { font-size: var(--step--2); color: var(--danger); min-height: 0; }
.field-error:empty { display: none; }
label.has-error input, label.has-error select { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192, 71, 107, 0.15); }

/* selectable chips (checkbox inside a pill) */
.chip-set { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--text);
  border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 7px 14px;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s; font-size: var(--step--1); font-weight: 400;
}
.chip:hover { background: var(--lilac-2); border-color: var(--violet-2); }
.chip:has(input:checked) { background: var(--lilac); border-color: var(--violet); color: var(--violet-ink); font-weight: 600; }

/* sticky save bar */
.save-bar {
  position: sticky; bottom: 12px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 12px; padding-inline-start: 16px; box-shadow: var(--shadow-md);
}
.save-bar .save-note { font-size: var(--step--1); padding-inline-start: 4px; }
.save-bar .cta { padding-inline: 32px; }

/* ---- dashboard (doc 20.2) -------------------------------------------------- */
.notif-list { display: grid; gap: 10px; margin-bottom: 28px; max-width: 760px; }
.notif {
  background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--violet);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-xs);
}
.notif p { margin: 4px 0 2px; }
.notif-time { color: var(--muted); font-size: var(--step--2); }

.dash-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.dash-card { gap: 10px; }
.dash-card h3 { margin: 6px 0 0; }
.dash-card p { margin: 0; }
.dash-card .btn, .dash-card .cta { margin-top: auto; align-self: flex-start; }
.dash-ico {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
  background: var(--lilac); color: var(--violet-ink);
}

/* ---- my scholarships: reminder toggle (doc 21) ---------------------------- */
.reminder-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 10px 0 0; padding: 10px 12px; border-radius: var(--radius); background: var(--lilac-2);
}
.reminder-row > span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--step--1); }
.toggle {
  border-radius: 999px; padding: 5px 14px; font: inherit; font-size: var(--step--1); font-weight: 600;
  cursor: pointer; border: 1px solid var(--line-strong); background: #fff; color: var(--muted); transition: background .15s, color .15s;
}
.toggle.on { background: var(--violet-ink); border-color: var(--violet-ink); color: #fff; }

/* ---- admin: tables, key/value, scrape progress (docs 20.2 / 22) ----------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.admin-table th, .admin-table td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table thead th { color: var(--muted); font-weight: 600; background: var(--lilac-2); }
.admin-table tbody tr:hover { background: #faf8ff; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px 20px; }
.kv-grid > div { display: flex; flex-direction: column; gap: 2px; }
.kv-k { color: var(--muted); font-size: var(--step--2); }
.msg-form { display: grid; gap: 10px; }
.row-actions { display: flex; gap: 8px; align-items: center; }
.row-actions form { margin: 0; }

.scrape-progress {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-xs); margin: 0 0 18px;
}
.scrape-progress.done { border-color: rgba(47, 158, 111, 0.5); background: var(--ok-bg); }
.scrape-progress.error { border-color: rgba(192, 71, 107, 0.5); background: var(--danger-bg); }
.scrape-progress .progress-track { height: 10px; }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 960px) {
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-side { position: static; order: -1; }   /* price + actions right under the title */
}
@media (max-width: 720px) {
  .steps { grid-template-columns: 1fr; max-width: 420px; }
  .cta-band { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  :root { --topbar-h: 58px; }
  .form-grid, .form-row, .feature-grid { grid-template-columns: 1fr; }
  /* Stay a slim single-row bar on mobile; nav scrolls horizontally if it can't all fit. */
  .topbar-inner { gap: 8px; padding-inline-end: 0; }
  .brand-logo { max-height: 30px; }
  .topbar nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-inline-end: 16px; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a:not(.cta) { white-space: nowrap; padding: 6px 10px; font-size: .92rem; }
  .hero-actions .cta, .hero-actions .btn { width: 100%; }
  .filters button { width: 100%; }
  .progress-card { top: calc(var(--topbar-h) + 6px); }
  .save-bar { flex-direction: column-reverse; align-items: stretch; bottom: 8px; }
  .save-bar .cta { width: 100%; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

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

/* T060: a scholarship page's eligibility rules + multi-paragraph text */
.rule-list { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 6px; }
.rule-list li::marker { color: var(--violet); }
.pre-line { white-space: pre-line; }
.grid + .sub-title { margin-top: clamp(28px, 4vw, 44px); }
