@font-face {
  font-family: "Vazirmatn";
  src: url("/assets/fonts/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1f1a2e;
  --ink-soft: #5b5670;
  --line: #e7e1d3;
  --paper: #faf7f0;
  --card: #ffffff;
  --brand: #2a1b4d;
  --brand-2: #3d2a6b;
  --gold: #c9a24b;
  --gold-deep: #a9812e;
  --gold-soft: #f6eddc;
  --ok: #2f7d5b;
  --warn: #b5562a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 26, 46, .06), 0 8px 24px rgba(31, 26, 46, .07);
  --font: "Vazirmatn", "Tahoma", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--paper);
}
img { max-width: 100%; display: block; }
a { color: var(--brand-2); }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

.container { width: min(1140px, 92vw); margin-inline: auto; }

/* Header */
.site-header {
  background: var(--brand);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand-text { line-height: 1.3; }
.brand-text strong { display: block; font-size: 15px; font-weight: 700; }
.brand-text span { font-size: 12px; opacity: .75; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: #fff; text-decoration: none; opacity: .9; font-size: 14px; }
.nav a:hover { opacity: 1; color: var(--gold); }
.lang-switch {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .4);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}
.lang-switch:hover { border-color: var(--gold); color: var(--gold); }

/* Hero */
.hero {
  background:
    radial-gradient(900px 300px at 85% -10%, rgba(201, 162, 75, .28), transparent 60%),
    linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 72px 0 96px;
}
.hero h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.35; margin: 0 0 14px; font-weight: 800; }
.hero p { font-size: clamp(16px, 1.6vw, 18px); opacity: .88; max-width: 62ch; margin: 0 0 28px; }
.eyebrow {
  display: inline-block;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: .04em;
  font-weight: 700;
  margin-bottom: 12px;
}
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 8px; }
.hero-stats div { font-size: 14px; opacity: .85; }
.hero-stats strong { display: block; font-size: 26px; color: var(--gold); font-weight: 800; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 3px solid rgba(201, 162, 75, .55); outline-offset: 2px; }
.btn-gold { background: var(--gold); color: var(--brand); box-shadow: 0 6px 18px rgba(201, 162, 75, .35); }
.btn-gold:hover { background: #d6b260; }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-2); }
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* Sections and cards */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { margin: 0; font-size: 26px; font-weight: 800; color: var(--brand); }
.section-head p { margin: 4px 0 0; color: var(--ink-soft); }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.opp-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; transition: transform .2s ease, box-shadow .2s ease; }
.opp-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(31, 26, 46, .12); }
.opp-card h3 { margin: 0; font-size: 19px; color: var(--brand); line-height: 1.5; }
.opp-card p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.opp-card .meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.opp-card .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--brand-2); font-weight: 700; }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold-deep);
}
.badge.invite { background: #ece6f7; color: var(--brand-2); }
.badge.closed { background: #efedf3; color: var(--ink-soft); }
.chip {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Filters */
.filters {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: 2fr repeat(3, 1fr);
  margin-top: -56px;
  position: relative;
  box-shadow: var(--shadow);
}
.filters label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.control {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 75, .2); }
.empty { text-align: center; padding: 48px 16px; color: var(--ink-soft); grid-column: 1 / -1; }

/* Opportunity detail */
.page-hero { background: var(--brand); color: #fff; padding: 48px 0 72px; }
.page-hero h1 { margin: 8px 0 10px; font-size: clamp(24px, 3.4vw, 36px); line-height: 1.4; }
.page-hero p { margin: 0; opacity: .85; max-width: 70ch; }
.crumbs { font-size: 14px; opacity: .85; }
.crumbs a { color: #fff; }
.layout { display: grid; gap: 24px; grid-template-columns: 2fr 1fr; margin-top: -40px; align-items: start; }
.prose { color: var(--ink); white-space: pre-line; font-size: 16px; }
.prose-block + .prose-block { margin-top: 24px; }
.prose-block h3 { margin: 0 0 8px; font-size: 18px; color: var(--brand); }
.facts { display: grid; gap: 14px; margin: 0; }
.fact dt { font-size: 13px; color: var(--ink-soft); }
.fact dd { margin: 2px 0 0; font-weight: 600; }
.share { display: grid; gap: 10px; }
.share .btn { width: 100%; }
.share-note { font-size: 13px; color: var(--ink-soft); margin: 0; }
.sticky { position: sticky; top: 90px; }

/* Forms */
.form-wrap { margin-top: -40px; display: grid; gap: 24px; grid-template-columns: 1fr 300px; align-items: start; }
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.form-section { border: 0; padding: 0; margin: 0 0 32px; min-width: 0; }
.form-section legend { font-size: 18px; font-weight: 800; color: var(--brand); padding: 0 0 10px; margin-bottom: 16px; border-bottom: 2px solid var(--gold-soft); width: 100%; }
.fields { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.field .req { color: var(--warn); }
.field .error { display: none; color: var(--warn); font-size: 13px; margin-top: 4px; }
.field.invalid .control { border-color: var(--warn); background: #fff8f5; }
.field.invalid .error { display: block; }
.ltr { direction: ltr; text-align: left; }
textarea.control { min-height: 110px; resize: vertical; }
.checks { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.check {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: #fff; font-size: 15px;
}
.check:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.check input { accent-color: var(--brand); width: 18px; height: 18px; flex-shrink: 0; }
.upload { border: 2px dashed #d6cdb7; border-radius: 12px; padding: 18px; background: #fdfbf6; }
.upload input[type="file"] { width: 100%; }
.upload small { display: block; color: var(--ink-soft); margin-top: 6px; font-size: 12px; }
.consent { display: grid; gap: 10px; }
.consent .check { align-items: flex-start; }
.honeypot { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.alert { padding: 14px 16px; border-radius: 12px; font-size: 15px; margin-bottom: 16px; }
.alert.error { background: #fbeee8; color: var(--warn); border: 1px solid #f1cdbd; }
.alert.ok { background: #e8f4ee; color: var(--ok); border: 1px solid #bfe0cf; }
.success-box { text-align: center; padding: 40px 20px; }
.success-box .ref {
  display: inline-block; margin: 12px 0; padding: 10px 18px; background: var(--gold-soft);
  border-radius: 10px; font-weight: 800; letter-spacing: .05em; font-size: 18px; color: var(--brand); direction: ltr;
}
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); transition: width .3s ease; }

/* Footer */
.site-footer { background: var(--brand); color: rgba(255, 255, 255, .8); padding: 36px 0; margin-top: 64px; font-size: 14px; }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--gold); }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 70px); }
.admin-side { background: #fff; border-inline-end: 1px solid var(--line); padding: 20px 14px; }
.admin-side button {
  display: block; width: 100%; text-align: start; background: transparent; border: 0; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; color: var(--ink); font-size: 15px; margin-bottom: 4px;
}
.admin-side button.active, .admin-side button:hover { background: var(--gold-soft); color: var(--brand); font-weight: 700; }
.admin-main { padding: 28px; min-width: 0; }
.admin-main h2 { margin: 0 0 16px; color: var(--brand); font-size: 22px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
th { background: #fbf9f4; color: var(--ink-soft); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fcfaf5; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .control { width: auto; min-width: 180px; }
.login-box { max-width: 380px; margin: 80px auto; }
.detail-grid { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
.detail-grid dl { margin: 0; display: grid; gap: 12px; }
.detail-grid dt { font-size: 13px; color: var(--ink-soft); }
.detail-grid dd { margin: 2px 0 0; white-space: pre-line; word-break: break-word; }
.file-link {
  display: inline-flex; gap: 6px; align-items: center; padding: 8px 12px; margin: 4px 4px 4px 0;
  border: 1px solid var(--line); border-radius: 10px; text-decoration: none; background: #fff; color: var(--brand);
}

@media (max-width: 900px) {
  .layout, .form-wrap, .detail-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; margin-top: -40px; }
  .sticky { position: static; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { display: flex; gap: 6px; overflow-x: auto; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .admin-side button { white-space: nowrap; width: auto; margin: 0; }
}
@media (max-width: 640px) {
  .nav a.hide-sm { display: none; }
  .fields { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .form-card { padding: 20px; }
  .hero { padding: 48px 0 80px; }
  .brand-text span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* v3 additions: date picker, notices, wide checkboxes */
.datepicker { display: block; }
.datepicker .dp-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1.4fr 1fr 1fr; direction: rtl; }
.datepicker select.control { padding-inline: 10px; }
.check-wide { width: 100%; }
.notice {
  background: #fbf6e9; border: 1px solid #ecdcb0; color: #6b4f14; border-radius: 12px;
  padding: 12px 14px; font-size: 14px; line-height: 1.8; margin-bottom: 12px;
}
.teaching-block { border-top: 2px dashed var(--line); padding-top: 20px; }
@media (max-width: 640px) {
  .datepicker .dp-grid { grid-template-columns: 1fr 1fr; }
}

/* Admin login */
.login-box { max-width: 380px; margin: 72px auto; padding: 32px 28px; }
.login-title { margin: 0 0 22px; color: var(--brand); font-size: 22px; font-weight: 800; }
.login-field { margin-bottom: 16px; }
.login-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.login-submit { width: 100%; margin-top: 8px; padding: 13px; }

/* Print dialog */
.modal-backdrop { position: fixed; inset: 0; background: rgba(31, 26, 46, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { background: #fff; border-radius: 18px; width: min(560px, 100%); padding: 26px 26px 22px; box-shadow: 0 24px 60px rgba(31, 26, 46, .25); border: 1px solid var(--line); }
.modal-card h3 { margin: 0; color: var(--brand); font-size: 20px; font-weight: 800; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }
#print-groups .check { font-size: 14px; padding: 9px 11px; }

/* ==========================================================================
   v4 · Responsive and visual polish
   Later rules override earlier ones. Breakpoints: 1100 / 900 / 640 px.
   ========================================================================== */

/* Tokens and touch targets */
:root { --control-h: 44px; --space-1: 8px; --space-2: 16px; --space-3: 24px; }
.btn { min-height: var(--control-h); white-space: nowrap; }
.control { min-height: var(--control-h); }
.badge, .chip { white-space: nowrap; }
.nw { white-space: nowrap; }
.card { min-width: 0; }

/* Public: card grid fills the row instead of leaving an empty track */
.grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.brand-text strong { white-space: nowrap; }

/* Admin shell */
.admin-shell { align-content: start; }
.admin-side { align-self: start; position: sticky; top: 68px; height: calc(100vh - 68px); overflow-y: auto; }
.admin-side button { min-height: var(--control-h); }
.admin-main { min-width: 0; padding: 28px 32px; }
.admin-main h2 { font-size: 22px; line-height: 1.5; }

/* Admin toolbars */
.toolbar { gap: 12px; margin-bottom: 20px; }
.toolbar .control { min-height: var(--control-h); width: auto; min-width: 200px; }
.toolbar .btn { min-width: 132px; }
.toolbar h2 { min-width: 0; }

/* Detail screen */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.detail-opp { margin-bottom: 18px; padding: 10px 14px; background: #fbf9f4; border: 1px solid var(--line); border-radius: 12px; }
.detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.detail-fields > div { min-width: 0; }
.detail-fields dt { font-size: 13px; color: var(--ink-soft); }
.detail-fields dd { margin: 2px 0 0; font-weight: 600; white-space: pre-line; word-break: break-word; }
.detail-fields dd { font-size: 15px; }

/* Users and tables */
.table-wrap { border-radius: 16px; }
th, td { padding: 12px 14px; }
td { font-size: 14px; }

/* Print dialog */
.modal-card { max-height: calc(100vh - 32px); overflow-y: auto; }

/* ---------- Tablet and below ---------- */
@media (max-width: 1100px) {
  .admin-main { padding: 24px; }
}

@media (max-width: 900px) {
  .layout, .form-wrap, .detail-layout { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side {
    position: static; height: auto; overflow: visible;
    display: flex; gap: 6px; padding: 8px 12px; border-inline-end: 0; border-bottom: 1px solid var(--line);
  }
  .admin-side button { flex: 1 1 0; width: auto; text-align: center; margin: 0; padding: 10px 8px; }
  .detail-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  .container { width: min(1140px, 92vw); }

  /* Public header */
  .site-header .container { padding: 10px 0; gap: 10px; }
  .brand { gap: 10px; min-width: 0; }
  .brand img { width: 38px; height: 38px; }
  .brand-text strong { font-size: 14px; white-space: normal; line-height: 1.35; }
  .nav { gap: 10px; flex-shrink: 0; }
  .lang-switch { padding: 6px 12px; }

  /* Public sections */
  .hero { padding: 44px 0 84px; }
  .section { padding: 40px 0; }
  .section-head h2 { font-size: 22px; }
  .filters { padding: 14px; }
  .card { padding: 18px; }
  .page-hero { padding: 36px 0 60px; }
  .page-hero h1 { font-size: 24px; }
  .form-card { padding: 18px; }
  .form-section legend { font-size: 16px; }
  .fields { gap: 14px; }
  .datepicker .dp-grid { gap: 8px; }
  .notice { font-size: 13px; }

  /* Admin layout */
  .admin-main { padding: 18px 14px 32px; }
  .admin-side button { padding: 10px 6px; font-size: 14px; }
  .login-box { margin: 36px auto; padding: 26px 20px; }

  /* Admin toolbars become a tidy grid */
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .toolbar > h2 { grid-column: 1 / -1; font-size: 20px; margin: 0; }
  .toolbar > .control { grid-column: 1 / -1; min-width: 0; width: 100%; }
  .toolbar > .btn { width: 100%; min-width: 0; grid-column: auto; }
  .toolbar > .btn.full-sm { grid-column: 1 / -1; }
  .toolbar > .btn:first-child:not(.full-sm) { grid-column: 1 / -1; }

  /* Admin tables: keep the essentials visible */
  .col-sm-hide { display: none; }
  th, td { padding: 10px 10px; font-size: 13px; }
  .table-wrap { border-radius: 14px; }

  /* Detail */
  .detail-fields { grid-template-columns: 1fr; }
  .detail-layout { gap: 22px; }

  /* Print dialog stacks its actions */
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal-card { border-radius: 18px 18px 14px 14px; padding: 22px 18px 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

@media (max-width: 380px) {
  .nav a { font-size: 13px; }
  .brand-text strong { font-size: 13px; }
}

/* v4b: table helpers */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ref { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .ref { white-space: normal; word-break: normal; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
  .row-actions { flex-direction: column; gap: 6px; align-items: stretch; }
  .row-actions .btn { padding: 6px 10px !important; min-height: 34px; font-size: 12px; width: 100%; }
  .table-wrap td:nth-child(2) { min-width: 0; }
}

/* v4c: toolbar titles never sit under controls */
.toolbar > h2 { flex: 1 1 200px; margin: 0; }
.toolbar > .control, .toolbar > .btn { flex: 0 0 auto; }

/* v4d: toolbar controls keep a consistent width and stay on one row on desktop */
.toolbar .control { flex: 0 1 220px; width: auto; min-width: 180px; max-width: 260px; }
.toolbar .btn { flex: 0 0 auto; min-width: 128px; }
@media (max-width: 640px) {
  .toolbar .control { flex: none; max-width: none; width: 100%; }
}

/* v4e: tablet table density, compact print options on phones */
@media (max-width: 1100px) { .col-md-hide { display: none; } }
@media (max-width: 640px) {
  #print-groups { grid-template-columns: 1fr 1fr; gap: 8px; }
  #print-groups .check { padding: 8px 9px; font-size: 13px; }
  .modal-card h3 { font-size: 18px; }
}

/* ==========================================================================
   v5 · Motion and performance
   Animations use only transform and opacity. Everything is disabled when the
   visitor prefers reduced motion.
   ========================================================================== */

/* Keyframes */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes ripple { from { transform: scale(0); opacity: .45; } to { transform: scale(1); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes shakeX { 0%,100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes orbA { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-30px,20px) scale(1.08); } }
@keyframes orbB { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(24px,-18px) scale(1.05); } }

/* Page enter / leave */
body.page-enter { animation: fade .35s ease both; }
body.page-leave { opacity: 0; transition: opacity .17s ease; }

/* Hero: staggered entrance and floating light */
.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none; z-index: -1;
  filter: blur(40px); opacity: .55;
}
.hero::before { width: 420px; height: 420px; background: radial-gradient(circle, rgba(201,162,75,.45), transparent 70%); top: -140px; inset-inline-end: -120px; animation: orbA 14s ease-in-out infinite; }
.hero::after { width: 360px; height: 360px; background: radial-gradient(circle, rgba(120,90,200,.55), transparent 70%); bottom: -160px; inset-inline-start: -100px; animation: orbB 17s ease-in-out infinite; }
.hero .container > * { animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
.hero .container > *:nth-child(1) { animation-delay: .05s; }
.hero .container > *:nth-child(2) { animation-delay: .14s; }
.hero .container > *:nth-child(3) { animation-delay: .22s; }
.hero .container > *:nth-child(4) { animation-delay: .3s; }
.hero .container > *:nth-child(5) { animation-delay: .38s; }

/* Scroll reveal (only when motion.js is active) */
html.motion .reveal:not(.in) { opacity: 0; transform: translateY(18px); }
.reveal { transition: opacity .6s cubic-bezier(.2,.7,.2,1), transform .6s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }

/* Buttons: press feedback and ripple */
.btn { position: relative; overflow: hidden; transition: transform .15s ease, background .2s ease, box-shadow .25s ease, color .2s ease; }
.btn:hover { box-shadow: 0 8px 22px rgba(31,26,46,.14); }
.btn:active:not([disabled]) { transform: scale(.97); }
.btn-gold:hover { box-shadow: 0 10px 26px rgba(201,162,75,.45); }
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.4); transform: scale(0); animation: ripple .6s ease-out forwards; pointer-events: none; }
.btn-gold .ripple, .btn-ghost .ripple { background: rgba(42,27,77,.16); }
.btn.is-loading { cursor: progress; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-inline-end: 8px; }

/* Navigation underline */
.nav a { position: relative; }
.nav a::after { content: ""; position: absolute; inset-inline: 0; bottom: -7px; height: 2px; background: var(--gold); transform: scaleX(0); transform-origin: right; transition: transform .25s ease; }
.nav a:hover::after { transform: scaleX(1); }

/* Cards and inputs */
.opp-card { transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.opp-card:hover { border-color: rgba(201,162,75,.5); }
.opp-card:active { transform: translateY(-1px) scale(.99); }
.control { transition: border-color .2s ease, box-shadow .2s ease, background .2s ease; }
.check { transition: border-color .2s ease, background .2s ease, transform .15s ease; }
.check:active { transform: scale(.98); }
.field.shake { animation: shakeX .45s ease; }
.progress span { transition: width .45s cubic-bezier(.2,.7,.2,1); }

/* Skeleton placeholders while data loads */
.skeleton {
  background: linear-gradient(90deg, #efe9dc 25%, #faf6ec 37%, #efe9dc 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 12px;
}
.skeleton-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 22px; display: grid; gap: 12px; min-height: 220px; }
.skeleton-card .skeleton { height: 14px; }
.skeleton-card .sk-badge { width: 84px; height: 24px; border-radius: 999px; }
.skeleton-card .sk-title { height: 22px; width: 80%; }
.skeleton-card .sk-line { width: 60%; }

/* Success state with a drawn checkmark */
.success-box { animation: pop .5s cubic-bezier(.2,.8,.2,1) both; }
.check-svg { width: 84px; height: 84px; margin: 0 auto 6px; display: block; }
.check-svg circle { fill: none; stroke: var(--ok); stroke-width: 3; stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .7s ease forwards; }
.check-svg path { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .45s .55s ease forwards; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 10px; width: min(92vw, 380px); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; background: #1f1a2e; color: #fff; border-radius: 14px;
  padding: 12px 16px; box-shadow: 0 14px 34px rgba(31,26,46,.28); font-size: 14px; line-height: 1.6;
  opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .3s ease, transform .35s cubic-bezier(.2,.8,.2,1);
}
.toast.show { opacity: 1; transform: none; }
.toast.hide { opacity: 0; transform: translateY(8px); }
.toast-icon { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.toast.error .toast-icon { background: var(--warn); }

/* Admin: view transitions, table rows, modals */
.view-enter { animation: fadeUp .35s ease both; }
.table-wrap tbody tr { animation: fadeUp .35s ease both; }
.table-wrap tbody tr:nth-child(2) { animation-delay: .03s; }
.table-wrap tbody tr:nth-child(3) { animation-delay: .06s; }
.table-wrap tbody tr:nth-child(4) { animation-delay: .09s; }
.table-wrap tbody tr:nth-child(5) { animation-delay: .12s; }
.table-wrap tbody tr:nth-child(n+6) { animation-delay: .15s; }
tr.clickable { transition: background .2s ease; }
.admin-side button { transition: background .2s ease, color .2s ease, transform .2s ease; }
.admin-side button:hover { transform: translateX(-3px); }
.modal-backdrop { animation: fade .22s ease both; }
.modal-card { animation: pop .3s cubic-bezier(.2,.8,.2,1) both; }

/* Respect reduced motion: show everything, animate nothing */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.motion .reveal:not(.in) { opacity: 1; transform: none; }
  body.page-enter { animation: none; }
}

/* Reports */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpis .card span { display: block; font-size: 13px; color: var(--ink-soft); }
.kpis .card b { font-size: 30px; color: var(--brand); }
.bar-row { display: grid; grid-template-columns: 140px 1fr 48px; gap: 12px; align-items: center; margin: 8px 0; font-size: 14px; }
.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); border-radius: 999px; transition: width .6s ease; }
.days { display: flex; align-items: flex-end; gap: 4px; height: 140px; margin-top: 12px; }
.days div { flex: 1; background: var(--brand-2); border-radius: 4px 4px 0 0; min-height: 2px; }

/* ==========================================================================
   v6 · Header, footer, tracking band, admin redesign
   ========================================================================== */

/* ---- Header: glass bar with a clear call to action ---- */
.site-header {
  background: rgba(42, 27, 77, .92);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(201, 162, 75, .18);
  box-shadow: 0 8px 30px rgba(20, 12, 45, .18);
}
.header-inner { padding: 12px 0 !important; }
.brand img { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); transition: transform .4s ease; }
.brand:hover img { transform: rotate(-6deg) scale(1.05); }
.brand-text strong { font-size: 15px; letter-spacing: .01em; }
.nav { gap: 22px; }
.nav a:not(.nav-cta) { padding: 6px 2px; font-weight: 500; }
.nav-cta {
  background: linear-gradient(135deg, var(--gold), #d9b35f);
  color: var(--brand) !important;
  padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 18px rgba(201, 162, 75, .35);
  transition: transform .2s ease, box-shadow .2s ease;
}
.nav-cta::after { display: none !important; }
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(201, 162, 75, .5); color: var(--brand) !important; }
.lang-switch { border-color: rgba(255,255,255,.3); transition: background .2s ease, color .2s ease, border-color .2s ease; }
.lang-switch:hover { background: rgba(255,255,255,.08); }

/* ---- Footer: four columns and a quiet bottom bar ---- */
.site-footer {
  margin-top: 80px; padding: 0; color: rgba(255,255,255,.78);
  background: linear-gradient(180deg, #2a1b4d 0%, #1f1438 100%);
  border-top: 1px solid rgba(201,162,75,.2);
}
.footer-grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.4fr; gap: 40px;
  padding: 56px 0 40px;
}
.foot-brand img { border-radius: 14px; background: rgba(255,255,255,.06); padding: 6px; }
.foot-brand strong { display: block; margin-top: 12px; color: #fff; font-size: 16px; }
.foot-brand p { margin: 8px 0 0; font-size: 14px; line-height: 1.8; max-width: 36ch; }
.site-footer h4 { margin: 0 0 14px; color: var(--gold); font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.foot-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.foot-links a { color: rgba(255,255,255,.85); text-decoration: none; font-size: 14px; transition: color .2s ease, padding .2s ease; }
.foot-links a:hover { color: var(--gold); padding-inline-start: 4px; }
.foot-note { margin: 0; font-size: 14px; line-height: 1.9; background: rgba(255,255,255,.05); border: 1px solid rgba(201,162,75,.2); border-radius: 14px; padding: 14px 16px; }
.foot-bottom {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,.08); padding: 18px 0 26px; font-size: 13px; color: rgba(255,255,255,.6);
}

/* ---- Home: tracking band ---- */
.track-band {
  background: linear-gradient(135deg, #fbf6e9 0%, #f3ead2 100%);
  border-top: 1px solid #ecdcb0; border-bottom: 1px solid #ecdcb0;
  padding: 56px 0;
}
.track-inner { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: center; }
.track-copy h2 { margin: 6px 0 10px; font-size: clamp(22px, 2.6vw, 30px); color: var(--brand); font-weight: 800; }
.track-copy p { margin: 0; color: var(--ink-soft); max-width: 52ch; }
.track-link { display: inline-block; margin-top: 14px; color: var(--brand-2); font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--gold); padding-bottom: 2px; }
.track-card {
  background: #fff; border: 1px solid rgba(201,162,75,.35); border-radius: 22px; padding: 26px;
  box-shadow: 0 20px 50px rgba(42,27,77,.10);
}
.track-form { display: grid; gap: 14px; }
.track-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.track-field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.track-submit { width: 100%; }
.track-result { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 18px; animation: pop .4s cubic-bezier(.2,.8,.2,1) both; }
.track-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.track-head strong { color: var(--brand); font-size: 17px; }
.track-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin: 14px 0 0; }
.track-grid dt { font-size: 12px; color: var(--ink-soft); }
.track-grid dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; word-break: break-word; }

/* ---- Status badges (shared by public and admin) ---- */
.st { font-weight: 700; }
.st-new { background: #e6f0fa; color: #2f6fa8; }
.st-review { background: #f6eddc; color: #8a6418; }
.st-shortlisted { background: #ece6f7; color: #6b3fa0; }
.st-accepted { background: #e4f3ec; color: #2f7d5b; }
.st-rejected { background: #fbeee8; color: #b5562a; }
.st-archived { background: #efedf3; color: #5b5670; }

/* ---- Admin: dark sidebar with icons ---- */
.admin-shell { background: linear-gradient(180deg, #f6f1e4 0%, var(--paper) 40%); }
.admin-side {
  background: linear-gradient(180deg, #2a1b4d 0%, #1f1438 100%);
  color: #fff; border-inline-end: 0; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px;
  box-shadow: 4px 0 24px rgba(20,12,45,.12);
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand img { border-radius: 12px; background: rgba(255,255,255,.07); padding: 4px; }
.side-brand strong { display: block; font-size: 15px; color: #fff; }
.side-brand span { display: block; font-size: 12px; color: rgba(255,255,255,.6); margin-top: 2px; }
.side-nav { display: grid; gap: 6px; }
.admin-side .side-nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; background: transparent; border: 0; color: rgba(255,255,255,.78);
  padding: 11px 12px; border-radius: 12px; cursor: pointer; font-size: 15px; text-align: start; position: relative;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.admin-side .side-nav button:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(-3px); }
.admin-side .side-nav button.active { background: linear-gradient(135deg, rgba(201,162,75,.25), rgba(201,162,75,.10)); color: #fff; font-weight: 700; }
.admin-side .side-nav button.active::before {
  content: ""; position: absolute; inset-inline-end: -16px; top: 10px; bottom: 10px; width: 4px; border-radius: 4px; background: var(--gold);
}
.admin-side .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.07); flex: 0 0 auto; }
.admin-side .ico svg { width: 18px; height: 18px; }
.admin-side .side-nav button.active .ico { background: var(--gold); color: var(--brand); }
.side-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot a { color: rgba(255,255,255,.7); text-decoration: none; font-size: 13px; }
.side-foot a:hover { color: var(--gold); }

/* Admin content */
.admin-main { padding: 32px 36px; }
.admin-main h2 { font-size: 24px; font-weight: 800; color: var(--brand); letter-spacing: -.01em; }
.toolbar { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.toolbar > h2 { margin: 0; }
.toolbar .control { border-radius: 12px; }
.table-wrap { border-radius: 20px; box-shadow: var(--shadow); border-color: #ece6d6; }
.table-wrap thead th { position: sticky; top: 0; z-index: 1; }
tr.clickable td { transition: background .2s ease; }
tr.clickable:hover td { background: #faf6ec; }
.badge { border-radius: 999px; padding: 5px 12px; font-size: 12px; }
.btn-brand { background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 20px rgba(42,27,77,.22); }
.btn-brand:hover { box-shadow: 0 12px 26px rgba(42,27,77,.3); }

/* KPI cards */
.kpis-admin { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 22px; }
.kpi {
  display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line);
  border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  animation: fadeUp .45s cubic-bezier(.2,.8,.2,1) var(--d, 0ms) both;
}
.kpi::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--tone, var(--brand)); }
.kpi span { display: block; font-size: 13px; color: var(--ink-soft); }
.kpi b { display: block; font-size: 28px; font-weight: 800; color: var(--tone, var(--brand)); line-height: 1.2; margin-top: 2px; }
.kpi-ico { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 18px; flex: 0 0 auto; background: color-mix(in srgb, var(--tone, var(--brand)) 14%, #fff); color: var(--tone, var(--brand)); }
.kpi-brand { --tone: var(--brand); }
.kpi-blue { --tone: #2f6fa8; }
.kpi-gold { --tone: var(--gold-deep); }
.kpi-green { --tone: var(--ok); }
.kpi-rust { --tone: var(--warn); }

/* Login: calmer backdrop and gold accent */
#login-view { position: relative; }
.login-box { border-radius: 22px; border-top: 4px solid var(--gold); box-shadow: 0 30px 70px rgba(42,27,77,.14); }

/* Phones: horizontal tabs with icons */
@media (max-width: 900px) {
  .admin-side { flex-direction: column; padding: 12px 12px 0; gap: 10px; }
  .side-brand { display: none; }
  .side-nav { display: flex; gap: 6px; overflow-x: auto; }
  .admin-side .side-nav button { flex: 1 0 auto; justify-content: center; padding: 10px 12px; font-size: 14px; }
  .admin-side .side-nav button.active::before { display: none; }
  .admin-side .ico { width: 28px; height: 28px; }
  .side-foot { display: none; }
  .admin-main { padding: 22px 18px; }
}
@media (max-width: 640px) {
  .kpis-admin { grid-template-columns: 1fr 1fr; }
  .admin-side .lbl { font-size: 13px; }
  .admin-side .side-nav button { padding: 9px 8px; }
}

/* Footer, header and tracking on phones */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
  .track-inner { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr; padding: 40px 0 26px; }
  .track-band { padding: 40px 0; }
  .track-card { padding: 20px; }
  .track-fields { grid-template-columns: 1fr; }
  .track-grid { grid-template-columns: 1fr 1fr; }
  .nav-cta { padding: 7px 14px; font-size: 13px; }
  .header-inner { padding: 10px 0 !important; }
  .nav { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .kpi, .track-result { animation: none; }
}

/* v6b: keep the admin grid inside the viewport on phones */
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-shell > * { min-width: 0; max-width: 100%; }
  .admin-side { width: 100%; }
  .side-nav { width: 100%; min-width: 0; }
}

/* v6c: the filter bar sits below the tracking band, not over it */
.track-band + main .filters { margin-top: 36px; }
@media (max-width: 640px) { .track-band + main .filters { margin-top: 28px; } }
