/* =====================================================================
   Tender.sy | Ù…Ù†Ø§Ù‚ØµØ§Øª Ø³ÙˆØ±ÙŠØ§ â€” Design System v1
   White & deep-green identity Â· RTL-first Â· light/dark Â· zero frameworks
   Fonts: "Cairo" (display) + "Tajawal" (body), system fallbacks
   ===================================================================== */

/* ------------------------------------------------ Design tokens */
:root {
  /* Brand */
  --green-900: #0B3D2E;
  --green-800: #0E5138;
  --green-700: #0F6B47;   /* primary */
  --green-600: #128A5A;
  --green-500: #16A46B;
  --green-400: #34C186;
  --green-100: #DBF3E8;
  --green-050: #EDFAF3;

  /* Semantic */
  --color-primary: var(--green-700);
  --color-primary-hover: var(--green-800);
  --color-on-primary: #FFFFFF;
  --color-success: #128A5A;
  --color-warning: #B45309;
  --color-warning-bg: #FEF3E2;
  --color-danger: #B42318;
  --color-danger-bg: #FDECEA;
  --color-info: #175CD3;
  --color-info-bg: #EAF1FD;

  /* Neutral scale */
  --n-0: #FFFFFF;
  --n-25: #FAFCFB;
  --n-50: #F4F7F5;
  --n-100: #E8EEEA;
  --n-200: #D5DED9;
  --n-300: #B3C0B9;
  --n-500: #6B7A72;
  --n-700: #3C4843;
  --n-900: #1B2420;   /* charcoal text */

  --bg-page: var(--n-0);
  --bg-soft: var(--n-25);
  --bg-section: var(--green-050);
  --bg-card: var(--n-0);
  --text-main: var(--n-900);
  --text-muted: var(--n-500);
  --border: var(--n-100);
  --border-strong: var(--n-200);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Shadows â€” very subtle per brand */
  --shadow-xs: 0 1px 2px rgba(11, 61, 46, .05);
  --shadow-sm: 0 2px 8px rgba(11, 61, 46, .06);
  --shadow-md: 0 8px 24px rgba(11, 61, 46, .08);
  --shadow-lg: 0 16px 44px rgba(11, 61, 46, .12);

  /* Type scale */
  --font-display: "Cairo", "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --font-body: "Tajawal", "Cairo", "Segoe UI", Tahoma, sans-serif;
  --fs-xs: .78rem;
  --fs-sm: .875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;
  --fs-hero: clamp(1.9rem, 4.2vw, 3.1rem);

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  --header-h: 72px;
  --container: 1200px;
  --transition: 200ms cubic-bezier(.4, 0, .2, 1);
}

/* Dark mode â€” charcoal-green surfaces, same brand hue */
[data-theme="dark"] {
  --bg-page: #0F1613;
  --bg-soft: #131C18;
  --bg-section: #12211B;
  --bg-card: #16211C;
  --text-main: #E8F0EC;
  --text-muted: #93A69D;
  --border: #223129;
  --border-strong: #2C3F35;
  --n-50: #17221D;
  --n-100: #223129;
  --green-050: #12211B;
  --green-100: #17362A;
  --color-primary: #23B37A;
  --color-primary-hover: #34C186;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.45);
  --shadow-md: 0 8px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 16px 44px rgba(0,0,0,.6);
  --color-warning-bg: #33270F;
  --color-danger-bg: #351512;
  --color-info-bg: #10233D;
}

/* ------------------------------------------------ Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--text-main);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.3; margin: 0 0 var(--sp-3); }
h1 { font-size: var(--fs-3xl); } h2 { font-size: var(--fs-2xl); } h3 { font-size: var(--fs-xl); } h4 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--sp-4); }
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-hover); }
img, svg { max-width: 100%; vertical-align: middle; }
:focus-visible { outline: 3px solid var(--green-400); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--green-100); color: var(--green-900); }

.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--sp-5); }
.section { padding-block: var(--sp-16); }
.section--soft { background: var(--bg-section); }
.section-head { text-align: center; max-width: 640px; margin-inline: auto; margin-bottom: var(--sp-10); }
.section-head .eyebrow {
  display: inline-block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em;
  color: var(--color-primary); background: var(--green-100); border-radius: var(--r-full);
  padding: 4px 14px; margin-bottom: var(--sp-3);
}
.section-head p { color: var(--text-muted); }

/* ------------------------------------------------ Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm);
  min-height: 46px; padding: 0 var(--sp-6); border-radius: var(--r-md);
  border: 1.5px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--primary { background: linear-gradient(135deg, var(--green-600), var(--green-800)); color: var(--color-on-primary); box-shadow: var(--shadow-sm); }
.btn--primary:hover { box-shadow: var(--shadow-md); color: var(--color-on-primary); filter: brightness(1.06); }
.btn--secondary { background: var(--green-100); color: var(--green-800); }
.btn--secondary:hover { background: var(--green-050); color: var(--green-900); }
[data-theme="dark"] .btn--secondary { color: var(--green-400); }
[data-theme="dark"] .btn--secondary:hover { color: var(--green-400); background: var(--green-100); }
.btn--outline { background: transparent; color: var(--text-main); border-color: var(--border-strong); }
.btn--outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover { color: var(--color-primary); background: var(--green-050); }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--lg { min-height: 54px; padding-inline: var(--sp-8); font-size: var(--fs-md); }
.btn--sm { min-height: 38px; padding-inline: var(--sp-4); font-size: var(--fs-xs); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ------------------------------------------------ Forms */
.field { margin-bottom: var(--sp-5); }
.field label { display: block; font-weight: 700; font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.field .hint { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-1); }
.field .error-text { font-size: var(--fs-xs); color: var(--color-danger); margin-top: var(--sp-1); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: var(--sp-3) var(--sp-4);
  font: inherit; color: var(--text-main);
  background: var(--bg-card); border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md); transition: border-color var(--transition), box-shadow var(--transition);
}
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 4px var(--green-100); }
.input::placeholder { color: var(--n-300); }
.input.is-invalid { border-color: var(--color-danger); }
.checkbox { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-sm); cursor: pointer; }
.checkbox input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--color-primary); flex: none; }
.password-meter { height: 6px; border-radius: var(--r-full); background: var(--n-100); margin-top: var(--sp-2); overflow: hidden; }
.password-meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--color-danger); transition: width var(--transition), background var(--transition); }

/* ------------------------------------------------ Cards */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.card--hover:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--green-100); }
.card__body { padding: var(--sp-6); }

/* ------------------------------------------------ Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); font-weight: 700; padding: 3px 10px; border-radius: var(--r-full);
}
.badge svg { width: 13px; height: 13px; }
.badge--success { background: var(--green-100); color: var(--green-800); }
[data-theme="dark"] .badge--success { color: var(--green-400); }
.badge--warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge--danger  { background: var(--color-danger-bg); color: var(--color-danger); }
.badge--info    { background: var(--color-info-bg); color: var(--color-info); }
.badge--neutral { background: var(--n-50); color: var(--text-muted); }
.badge--featured { background: linear-gradient(135deg, var(--green-600), var(--green-800)); color: #fff; }

/* ------------------------------------------------ Alerts */
.alert {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r-md);
  font-size: var(--fs-sm); margin-bottom: var(--sp-5); border: 1px solid transparent;
}
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.alert--success { background: var(--green-050); border-color: var(--green-100); color: var(--green-800); }
[data-theme="dark"] .alert--success { color: var(--green-400); }
.alert--error { background: var(--color-danger-bg); border-color: color-mix(in srgb, var(--color-danger) 25%, transparent); color: var(--color-danger); }
.alert--info { background: var(--color-info-bg); color: var(--color-info); }

/* ------------------------------------------------ Header */
.site-header {
  position: sticky; top: 0; z-index: 60; height: var(--header-h);
  background: color-mix(in srgb, var(--bg-page) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { height: 100%; display: flex; align-items: center; gap: var(--sp-6); }
.brand { display: flex; align-items: center; gap: var(--sp-3); font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg); color: var(--text-main); }
.brand:hover { color: var(--text-main); }
.brand__mark {
  width: 42px; height: 42px; border-radius: var(--r-md); flex: none;
  background: linear-gradient(135deg, var(--green-600), var(--green-900));
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-sm);
}
.brand__mark svg { width: 24px; height: 24px; }
.main-nav { display: flex; align-items: center; gap: var(--sp-1); margin-inline-start: var(--sp-4); }
.main-nav a {
  color: var(--text-muted); font-weight: 600; font-size: var(--fs-sm);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
}
.main-nav a:hover, .main-nav a.is-active { color: var(--color-primary); background: var(--green-050); }
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn {
  width: 42px; height: 42px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-muted); display: grid; place-items: center; cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.icon-btn:hover { color: var(--color-primary); border-color: var(--green-100); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.lang-switch { position: relative; }
.lang-switch select {
  appearance: none; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-main);
  min-height: 42px; padding: 0 var(--sp-4); border-radius: var(--r-md); font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.nav-burger { display: none; }

/* Mobile drawer */
.drawer {
  position: fixed; inset: 0; z-index: 90; visibility: hidden; pointer-events: none;
}
.drawer.is-open { visibility: visible; pointer-events: auto; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(10, 20, 16, .5); opacity: 0; transition: opacity var(--transition); }
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer__panel {
  position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(320px, 86vw);
  background: var(--bg-card); box-shadow: var(--shadow-lg);
  transform: translateX(-100%); transition: transform var(--transition);
  padding: var(--sp-6); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-2);
}
[dir="rtl"] .drawer__panel { transform: translateX(100%); }
.drawer.is-open .drawer__panel { transform: translateX(0); }
.drawer__panel a { display: block; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); color: var(--text-main); font-weight: 600; }
.drawer__panel a:hover { background: var(--green-050); color: var(--color-primary); }

/* ------------------------------------------------ Hero */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--green-050) 0%, var(--bg-page) 100%);
  padding-block: var(--sp-20) var(--sp-16);
}
/* Signature: faint "official seal" ring + document-check pattern */
.hero::before {
  content: ""; position: absolute; inset-inline-start: -120px; top: -120px;
  width: 420px; height: 420px; border-radius: 50%;
  border: 44px solid var(--green-100); opacity: .5; pointer-events: none;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2316A46B' stroke-opacity='0.10' stroke-width='1.4'%3E%3Crect x='18' y='14' width='34' height='44' rx='5'/%3E%3Cpath d='M25 26h20M25 34h20M25 42h12'/%3E%3Cpath d='M78 78l7 7 13-14' stroke-opacity='0.16' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
}
.hero .container { position: relative; z-index: 1; }
.hero__inner { max-width: 760px; margin-inline: auto; text-align: center; }
.hero h1 { font-size: var(--fs-hero); color: var(--green-900); margin-bottom: var(--sp-4); }
[data-theme="dark"] .hero h1 { color: var(--text-main); }
.hero h1 .accent { color: var(--color-primary); }
.hero p { color: var(--text-muted); font-size: var(--fs-lg); margin-bottom: var(--sp-8); }
.hero__cta { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; margin-top: var(--sp-6); }

.search-bar {
  display: flex; gap: var(--sp-2); background: var(--bg-card);
  border: 1.5px solid var(--border-strong); border-radius: var(--r-xl);
  padding: var(--sp-2); box-shadow: var(--shadow-md); max-width: 640px; margin-inline: auto;
}
.search-bar:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 4px var(--green-100), var(--shadow-md); }
.search-bar input { flex: 1; border: 0; background: transparent; font: inherit; padding-inline: var(--sp-4); color: var(--text-main); min-width: 0; }
.search-bar input:focus { outline: none; }

/* ------------------------------------------------ Stats strip */
.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); margin-top: var(--sp-12); }
.stat { text-align: center; padding: var(--sp-5); border-radius: var(--r-lg); background: var(--bg-card); border: 1px solid var(--border); }
.stat b { display: block; font-family: var(--font-display); font-size: var(--fs-2xl); color: var(--color-primary); }
.stat span { font-size: var(--fs-sm); color: var(--text-muted); }

/* ------------------------------------------------ Category grid */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.cat-card {
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg);
  color: var(--text-main); transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.cat-card:hover { border-color: var(--green-400); box-shadow: var(--shadow-sm); transform: translateY(-2px); color: var(--text-main); }
.cat-card__icon {
  width: 46px; height: 46px; flex: none; border-radius: var(--r-md);
  background: var(--green-050); color: var(--color-primary); display: grid; place-items: center;
}
.cat-card__icon svg { width: 22px; height: 22px; }
.cat-card b { display: block; font-size: var(--fs-sm); }
.cat-card small { color: var(--text-muted); font-size: var(--fs-xs); }

/* ------------------------------------------------ Tender cards */
.tender-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.tender-card { display: flex; flex-direction: column; }
.tender-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.tender-card h3 { font-size: var(--fs-md); margin: 0 0 var(--sp-1); }
.tender-card h3 a { color: var(--text-main); }
.tender-card h3 a:hover { color: var(--color-primary); }
.tender-card .ref { font-size: var(--fs-xs); color: var(--text-muted); }
.tender-card__meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); color: var(--text-muted); margin-block: var(--sp-3); }
.tender-card__meta span { display: inline-flex; align-items: center; gap: 5px; }
.tender-card__meta svg { width: 14px; height: 14px; color: var(--green-500); }
.tender-card__foot { margin-top: auto; padding-top: var(--sp-4); border-top: 1px dashed var(--border); display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }
.deadline-chip { font-size: var(--fs-xs); font-weight: 700; color: var(--green-800); background: var(--green-050); padding: 4px 10px; border-radius: var(--r-full); }
[data-theme="dark"] .deadline-chip { color: var(--green-400); }
.deadline-chip.is-urgent { color: var(--color-danger); background: var(--color-danger-bg); }

/* ------------------------------------------------ How it works */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); counter-reset: step; }
.step { position: relative; padding: var(--sp-6); }
.step__num {
  width: 46px; height: 46px; border-radius: var(--r-full); margin-bottom: var(--sp-4);
  background: linear-gradient(135deg, var(--green-600), var(--green-800));
  color: #fff; font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg);
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.step p { color: var(--text-muted); font-size: var(--fs-sm); margin: 0; }

/* ------------------------------------------------ FAQ */
.faq-list { max-width: 760px; margin-inline: auto; display: grid; gap: var(--sp-3); }
.faq-item { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-card); overflow: hidden; }
.faq-item summary {
  cursor: pointer; list-style: none; padding: var(--sp-4) var(--sp-5);
  font-weight: 700; font-size: var(--fs-sm); display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: var(--fs-lg); color: var(--color-primary); transition: transform var(--transition); }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-body { padding: 0 var(--sp-5) var(--sp-4); color: var(--text-muted); font-size: var(--fs-sm); }

/* ------------------------------------------------ Footer */
.site-footer { background: var(--green-900); color: #CBE4D8; margin-top: var(--sp-16); }
[data-theme="dark"] .site-footer { background: #0A120E; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: var(--sp-8); padding-block: var(--sp-12); }
.site-footer h4 { color: #fff; font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.site-footer a { color: #CBE4D8; font-size: var(--fs-sm); display: block; padding-block: 4px; }
.site-footer a:hover { color: #fff; }
.footer-note { font-size: var(--fs-xs); opacity: .75; line-height: 1.8; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding-block: var(--sp-5); display: flex; justify-content: space-between; gap: var(--sp-4); font-size: var(--fs-xs); flex-wrap: wrap; }
.newsletter-form { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.newsletter-form input {
  flex: 1; min-height: 44px; border-radius: var(--r-md); border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08); color: #fff; padding-inline: var(--sp-4); font: inherit; min-width: 0;
}
.newsletter-form input::placeholder { color: rgba(255,255,255,.5); }

/* ------------------------------------------------ Auth pages */
.auth-shell { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(160deg, var(--green-800), var(--green-900)); color: #fff; padding: var(--sp-10);
}
.auth-side::after {
  content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg width='140' height='140' viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.07' stroke-width='1.5'%3E%3Crect x='20' y='18' width='40' height='52' rx='6'/%3E%3Cpath d='M28 32h24M28 42h24M28 52h14'/%3E%3Cpath d='M92 96l8 8 15-16' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
}
.auth-side > * { position: relative; z-index: 1; }
.auth-side .brand { color: #fff; }
.auth-side .brand__mark { background: rgba(255,255,255,.14); }
.auth-side h2 { color: #fff; font-size: var(--fs-2xl); }
.auth-side p { color: rgba(255,255,255,.75); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: var(--sp-8); background: var(--bg-page); overflow-y: auto; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: var(--fs-2xl); margin-bottom: var(--sp-2); }
.auth-card .sub { color: var(--text-muted); margin-bottom: var(--sp-6); }
.auth-foot { text-align: center; margin-top: var(--sp-6); font-size: var(--fs-sm); color: var(--text-muted); }
.account-types { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.account-type { position: relative; }
.account-type input { position: absolute; opacity: 0; }
.account-type label {
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--border-strong); border-radius: var(--r-md);
  font-size: var(--fs-xs); font-weight: 700; cursor: pointer; transition: all var(--transition);
}
.account-type input:checked + label { border-color: var(--color-primary); background: var(--green-050); color: var(--green-800); }
[data-theme="dark"] .account-type input:checked + label { color: var(--green-400); }
.account-type input:focus-visible + label { outline: 3px solid var(--green-400); outline-offset: 2px; }

/* ------------------------------------------------ Dashboard shell */
.dash-shell { display: grid; grid-template-columns: 264px 1fr; min-height: calc(100dvh - var(--header-h)); }
.dash-side {
  border-inline-end: 1px solid var(--border); background: var(--bg-soft);
  padding: var(--sp-6) var(--sp-4); position: sticky; top: var(--header-h);
  height: calc(100dvh - var(--header-h)); overflow-y: auto;
}
.dash-nav { display: grid; gap: 2px; }
.dash-nav a {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); color: var(--text-muted); font-weight: 600; font-size: var(--fs-sm);
}
.dash-nav a svg { width: 19px; height: 19px; flex: none; }
.dash-nav a:hover { background: var(--green-050); color: var(--color-primary); }
.dash-nav a.is-active { background: var(--green-100); color: var(--green-800); }
[data-theme="dark"] .dash-nav a.is-active { color: var(--green-400); }
.dash-nav .nav-label { font-size: var(--fs-xs); font-weight: 700; color: var(--n-300); margin: var(--sp-5) var(--sp-4) var(--sp-2); letter-spacing: .05em; }
.dash-main { padding: var(--sp-8); min-width: 0; }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-8); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-8); }
.kpi { padding: var(--sp-5); }
.kpi__icon { width: 42px; height: 42px; border-radius: var(--r-md); background: var(--green-050); color: var(--color-primary); display: grid; place-items: center; margin-bottom: var(--sp-3); }
.kpi__icon svg { width: 21px; height: 21px; }
.kpi b { display: block; font-family: var(--font-display); font-size: var(--fs-2xl); }
.kpi span { font-size: var(--fs-sm); color: var(--text-muted); }

/* ------------------------------------------------ Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-card); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); min-width: 560px; }
.table th { text-align: start; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 700; padding: var(--sp-3) var(--sp-5); background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.table td { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-soft); }

/* ------------------------------------------------ Empty / loading states */
.empty-state { text-align: center; padding: var(--sp-12) var(--sp-6); color: var(--text-muted); }
.empty-state svg { width: 56px; height: 56px; color: var(--n-200); margin-bottom: var(--sp-4); }
.skeleton { position: relative; overflow: hidden; background: var(--n-50); border-radius: var(--r-md); min-height: 14px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bg-card) 60%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
[dir="rtl"] .skeleton::after { animation-name: shimmer-rtl; }
@keyframes shimmer-rtl { from { transform: translateX(100%); } to { transform: translateX(-100%); } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--green-100); border-top-color: var(--color-primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------ Error pages */
.error-page { text-align: center; padding: var(--sp-20) var(--sp-5); }
.error-page .code { font-family: var(--font-display); font-size: clamp(4rem, 12vw, 7rem); font-weight: 800; color: var(--green-100); line-height: 1; }
[data-theme="dark"] .error-page .code { color: var(--green-800); }

/* ------------------------------------------------ Utilities */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--sp-4); } .mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); } .gap-4 { gap: var(--sp-4); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------ Responsive */
@media (max-width: 1024px) {
  .tender-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .dash-shell { grid-template-columns: 1fr; }
  .dash-side { position: fixed; z-index: 80; inset-inline-start: 0; top: var(--header-h); width: min(280px, 84vw); transform: translateX(100%); transition: transform var(--transition); box-shadow: var(--shadow-lg); }
  [dir="ltr"] .dash-side { transform: translateX(-100%); }
  .dash-side.is-open { transform: translateX(0) !important; }
  .dash-toggle { display: grid !important; }
}
@media (max-width: 768px) {
  .main-nav { display: none; }
  .nav-burger { display: grid; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .hero { padding-block: var(--sp-12); }
  .section { padding-block: var(--sp-12); }
  .dash-main { padding: var(--sp-5); }
}
@media (max-width: 560px) {
  .tender-grid, .cat-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .search-bar { flex-direction: column; border-radius: var(--r-lg); }
  .search-bar .btn { width: 100%; }
  .hero__cta .btn { flex: 1 1 100%; }
  .account-types { grid-template-columns: 1fr; }
  .footer-bottom { justify-content: center; text-align: center; }
}
.dash-toggle { display: none; }

/* =====================================================================
   Phase 2 â€” Profiles, Tender Wizard, Browse & Details
   ===================================================================== */

/* Generic helpers */
.muted { color: var(--text-muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.sep { border: 0; border-top: 1px dashed var(--border); margin-block: var(--sp-6); }
.section-title { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
.btn-row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.btn--sm { padding: 6px 12px; font-size: var(--fs-xs); }
.btn--block { width: 100%; justify-content: center; }
.btn--outline { background: transparent; border: 1px solid var(--color-primary); color: var(--color-primary); }
.btn--outline:hover { background: var(--green-050); }
[data-theme="dark"] .btn--outline:hover { background: var(--n-800, rgba(255,255,255,.06)); }
.btn.danger, .btn--ghost.danger { color: var(--color-danger); }
.field--narrow { max-width: 320px; }
.input--sm { padding-block: 6px; font-size: var(--fs-xs); }
.input--file { padding: 8px; }

/* Page head inside dashboard */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-6); }
.page-title { font-size: var(--fs-xl); margin: 0; }
.page-sub { color: var(--text-muted); font-size: var(--fs-sm); margin: var(--sp-1) 0 0; }

/* Wizard */
.wizard-steps { list-style: none; display: flex; gap: var(--sp-2); padding: 0; margin: 0 0 var(--sp-6); flex-wrap: wrap; }
.wizard-steps li { flex: 1 1 auto; min-width: 96px; }
.wizard-steps a, .wizard-steps li > span { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 700; }
.wizard-steps a:hover { border-color: var(--color-primary); color: var(--color-primary); }
.wizard-steps__n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--n-50); font-size: 11px; flex: none; }
.wizard-steps .is-current > span, .wizard-steps .is-current a { border-color: var(--color-primary); color: var(--color-primary); background: var(--green-050); }
[data-theme="dark"] .wizard-steps .is-current > span { background: transparent; }
.wizard-steps .is-current .wizard-steps__n { background: var(--color-primary); color: #fff; }
.wizard-steps .is-done .wizard-steps__n { background: var(--green-100); color: var(--green-800); }
.wizard-card { max-width: 900px; }
.wizard-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid var(--border); }

/* Checkboxes */
.check { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--color-primary); flex: none; }
.check--inline { white-space: nowrap; }
.check-stack { display: flex; flex-direction: column; gap: var(--sp-2); justify-content: flex-end; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-bottom: var(--sp-5); }

/* Repeater rows */
.repeater-row { display: grid; grid-template-columns: 160px 1fr 1fr 130px 40px; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-2); }
.repeater-row--docs { grid-template-columns: 1fr 1fr 130px 40px; }
.repeater-row--crit { grid-template-columns: 2fr 1fr 1fr 40px; }
.repeater-row .icon-btn { color: var(--text-muted); }
.repeater-row .icon-btn:hover { color: var(--color-danger); }

/* File list */
.file-list { list-style: none; padding: 0; margin: 0 0 var(--sp-4); }
.file-list li { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px dashed var(--border); border-radius: var(--r-md); margin-bottom: var(--sp-2); font-size: var(--fs-sm); }
.file-list svg { width: 16px; height: 16px; color: var(--green-500); flex: none; }
.file-list small { color: var(--text-muted); margin-inline-start: auto; }

/* Review grid (step 8) */
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3) var(--sp-6); margin: var(--sp-5) 0; padding: 0; }
.review-grid > div { display: flex; justify-content: space-between; gap: var(--sp-3); border-bottom: 1px dashed var(--border); padding-bottom: var(--sp-2); }
.review-grid dt { color: var(--text-muted); font-size: var(--fs-xs); }
.review-grid dd { margin: 0; font-weight: 700; font-size: var(--fs-sm); text-align: end; }
.review-desc { background: var(--bg-soft); border-radius: var(--r-md); padding: var(--sp-4); margin-bottom: var(--sp-5); }
.review-desc h3 { font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.review-desc p { font-size: var(--fs-sm); color: var(--text-muted); }

/* Profile */
.profile-grid { display: grid; grid-template-columns: 280px 1fr; gap: var(--sp-6); align-items: start; }
.completion { min-width: 220px; text-align: end; }
.completion__pct { font-family: var(--font-head, inherit); font-weight: 800; font-size: var(--fs-lg); color: var(--color-primary); }
.completion__bar { height: 8px; background: var(--n-50); border-radius: var(--r-full); overflow: hidden; margin: var(--sp-1) 0; }
.completion__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-500), var(--green-700)); border-radius: var(--r-full); }
.completion small { color: var(--text-muted); font-size: var(--fs-xs); }
.avatar-box { display: grid; place-items: center; margin-bottom: var(--sp-4); }
.avatar-img { width: 132px; height: 132px; border-radius: var(--r-lg); object-fit: cover; border: 3px solid var(--green-100); }
.avatar-img--empty { display: grid; place-items: center; background: var(--bg-soft); color: var(--n-200); }
.avatar-img--empty svg { width: 48px; height: 48px; }

/* Status tabs */
.status-tabs { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.status-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--r-full); border: 1px solid var(--border); font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); background: var(--bg-card); }
.status-tabs a:hover { border-color: var(--color-primary); color: var(--color-primary); }
.status-tabs a.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.status-tabs .count { background: rgba(0,0,0,.08); border-radius: var(--r-full); padding: 1px 8px; font-size: 11px; }
.status-tabs a.is-active .count { background: rgba(255,255,255,.22); }

/* Tables */
.table-card { padding: 0; overflow-x: auto; }
.table--compact th, .table--compact td { padding: var(--sp-2) var(--sp-3); }
.table-title { font-weight: 700; color: var(--text-main); }
.table-title:hover { color: var(--color-primary); }
.row-actions { display: flex; gap: var(--sp-1); flex-wrap: wrap; align-items: center; }
.row-actions form { margin: 0; }

/* Browse layout */
.page-hero { background: linear-gradient(160deg, var(--green-050), transparent 65%); padding-block: var(--sp-10); }
.page-hero--slim { padding-block: var(--sp-8); }
.page-hero h1 { font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.page-hero p { color: var(--text-muted); }
.browse-layout { display: grid; grid-template-columns: 290px 1fr; gap: var(--sp-6); align-items: start; padding-block: var(--sp-8); }
.filter-panel { position: sticky; top: 88px; }
.results-line { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.tender-card__summary { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }
.badge-col { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.icon-btn.is-saved { color: var(--color-primary); background: var(--green-050); border-color: var(--color-primary); }
.pagination { display: flex; align-items: center; justify-content: center; gap: var(--sp-4); margin-top: var(--sp-6); }

/* Details page */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; }
.detail-badges { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); flex-wrap: wrap; }
.detail-sub { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--sp-2); }
.detail-layout { display: grid; grid-template-columns: 1fr 340px; gap: var(--sp-6); align-items: start; padding-block: var(--sp-8); }
.detail-main { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }
.detail-side { display: flex; flex-direction: column; gap: var(--sp-5); position: sticky; top: 88px; }
.rich-text { font-size: var(--fs-sm); line-height: 1.9; color: var(--text-main); word-wrap: break-word; }
.req-list { list-style: none; padding: 0; margin: 0; }
.req-list li { display: flex; gap: var(--sp-3); align-items: flex-start; padding-block: var(--sp-3); border-bottom: 1px dashed var(--border); font-size: var(--fs-sm); }
.req-list li:last-child { border-bottom: 0; }
.req-list li > svg { width: 18px; height: 18px; color: var(--green-500); flex: none; margin-top: 3px; }
.req-list .badge { flex: none; }
.req-list p { margin: var(--sp-1) 0 0; }
.info-list { margin: 0; padding: 0; }
.info-list > div { display: flex; justify-content: space-between; gap: var(--sp-3); padding-block: var(--sp-2); border-bottom: 1px dashed var(--border); font-size: var(--fs-sm); }
.info-list > div:last-child { border-bottom: 0; }
.info-list dt { color: var(--text-muted); }
.info-list dd { margin: 0; font-weight: 700; text-align: end; }
.deadline-big { display: flex; align-items: baseline; gap: var(--sp-2); background: var(--green-050); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); color: var(--green-800); font-weight: 700; }
[data-theme="dark"] .deadline-big { background: transparent; border: 1px solid var(--green-700); color: var(--green-400); }
.deadline-big.is-urgent { background: var(--color-danger-bg); color: var(--color-danger); }
.deadline-big__n { font-size: 2rem; font-family: var(--font-head, inherit); }
.owner-box { display: flex; align-items: center; gap: var(--sp-3); }
.owner-logo { width: 52px; height: 52px; border-radius: var(--r-md); object-fit: cover; border: 1px solid var(--border); }
.bid-cta { text-align: center; }
.bid-cta p { margin-bottom: var(--sp-3); font-size: var(--fs-sm); }

/* Responsive */
@media (max-width: 980px) {
  .browse-layout, .detail-layout, .profile-grid { grid-template-columns: 1fr; }
  .filter-panel, .detail-side { position: static; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .check-grid, .review-grid { grid-template-columns: 1fr; }
  .repeater-row, .repeater-row--docs, .repeater-row--crit { grid-template-columns: 1fr; border: 1px dashed var(--border); border-radius: var(--r-md); padding: var(--sp-3); }
  .wizard-steps__t { display: none; }
  .wizard-steps li { min-width: 0; flex: 0 0 auto; }
  .page-head { flex-direction: column; }
  .completion { text-align: start; }
}

/* =====================================================================
   Phase 3 â€” Bids & Q&A
   ===================================================================== */
.mini-title { font-size: var(--fs-sm); font-weight: 800; margin: var(--sp-4) 0 var(--sp-2); color: var(--green-800); }
[data-theme="dark"] .mini-title { color: var(--green-400); }
.detail-layout--dash { padding-block: 0; }
.doc-upload { display: grid; grid-template-columns: 1fr 280px; gap: var(--sp-4); align-items: center; border: 1px dashed var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); }
.doc-upload__info strong { display: inline-block; margin-inline-end: var(--sp-2); }
.doc-upload__info p { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); }
.qa-card { margin-bottom: var(--sp-4); }
.qa-card__head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.qa-question { font-size: var(--fs-sm); margin: 0 0 var(--sp-3); }
.qa-answer { background: var(--bg-soft); border-inline-start: 3px solid var(--color-primary); border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.qa-answer small { display: block; margin-top: var(--sp-1); }
.qa-item { padding-block: var(--sp-3); border-bottom: 1px dashed var(--border); }
.qa-item:last-of-type { border-bottom: 0; }
.qa-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
@media (max-width: 720px) {
  .doc-upload { grid-template-columns: 1fr; }
}

/* =====================================================================
   Phase 4 â€” Evaluation & Award
   ===================================================================== */
.committee-form { display: flex; gap: var(--sp-3); align-items: flex-end; flex-wrap: wrap; margin-top: var(--sp-4); }
.crit-row { display: grid; grid-template-columns: 1fr 140px 1fr; gap: var(--sp-3); align-items: end; padding-block: var(--sp-3); border-bottom: 1px dashed var(--border); }
.crit-row:last-of-type { border-bottom: 0; }
.crit-row__info strong { display: block; }
.crit-row__info p { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); }
.award-banner { border: 1px solid var(--green-500); background: linear-gradient(160deg, var(--green-050), transparent 70%); }
[data-theme="dark"] .award-banner { background: transparent; }
@media (max-width: 720px) {
  .crit-row { grid-template-columns: 1fr; }
  .committee-form { flex-direction: column; align-items: stretch; }
}

/* =====================================================================
   Phase 5 â€” Notifications & Messages
   ===================================================================== */
.bell-btn { position: relative; }
.bell-badge { position: absolute; top: -4px; inset-inline-end: -4px; background: var(--color-danger); color: #fff; font-size: 10px; font-weight: 800; line-height: 1; padding: 3px 5px; border-radius: var(--r-full); min-width: 16px; text-align: center; }
.notif-list, .conv-list { list-style: none; margin: 0; padding: 0; }
.notif-item { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: 0; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-top: 7px; flex: none; }
.notif-item.is-unread { background: var(--bg-soft); }
.notif-item.is-unread .notif-dot { background: var(--color-primary); }
.notif-body { flex: 1; min-width: 0; }
.notif-body p { margin: 2px 0; font-size: var(--fs-sm); }
.conv-item { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); color: var(--text-main); }
.conv-list li:last-child .conv-item { border-bottom: 0; }
.conv-item:hover { background: var(--bg-soft); }
.conv-item.is-unread strong { color: var(--color-primary); }
.conv-item__main { min-width: 0; }
.conv-item__main small { display: block; margin-top: 2px; }
.conv-item__main p { margin: var(--sp-1) 0 0; font-size: var(--fs-sm); }
.conv-item__meta { text-align: end; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-1); }
.thread-card { display: flex; flex-direction: column; max-height: 72vh; }
.thread { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-3); padding-bottom: var(--sp-4); }
.msg { display: flex; }
.msg--mine { justify-content: flex-end; }
.msg__bubble { max-width: 78%; background: var(--bg-soft); border-radius: var(--r-lg); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); }
.msg--mine .msg__bubble { background: var(--green-050); }
[data-theme="dark"] .msg--mine .msg__bubble { background: transparent; border: 1px solid var(--green-700); }
.msg__bubble p { margin: 0 0 var(--sp-1); line-height: 1.8; word-wrap: break-word; }
.msg__time { color: var(--text-muted); font-size: 11px; }
.msg__file { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--r-md); padding: 6px 10px; margin: var(--sp-1) 0; font-size: var(--fs-xs); color: var(--text-main); }
.msg__file svg { width: 14px; height: 14px; color: var(--green-500); }
.thread-reply { display: flex; gap: var(--sp-3); align-items: flex-end; border-top: 1px solid var(--border); padding-top: var(--sp-4); }
.thread-reply__side { display: flex; flex-direction: column; gap: var(--sp-2); flex: none; }
.file-btn { cursor: pointer; }
.prefs-table td, .prefs-table th { text-align: center; }
.prefs-table td:first-child, .prefs-table th:first-child { text-align: start; }
@media (max-width: 720px) {
  .thread-reply { flex-direction: column; align-items: stretch; }
  .thread-reply__side { flex-direction: row; justify-content: flex-end; }
}

/* =====================================================================
   Phase 6 â€” Verification & Reviews
   ===================================================================== */
.stars { display: inline-flex; gap: 1px; font-size: 15px; line-height: 1; }
.star { color: var(--border); }
.star.is-on { color: #E8A93C; }
.rating-row { display: inline-flex; align-items: center; gap: var(--sp-2); }
.review-item { padding-block: var(--sp-4); border-bottom: 1px dashed var(--border); }
.review-item:last-of-type { border-bottom: 0; }
.review-item__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); flex-wrap: wrap; }
.review-item__head small { display: block; margin-top: 2px; }
.review-text { margin: var(--sp-2) 0; font-size: var(--fs-sm); line-height: 1.9; }
.review-inline-form { display: flex; gap: var(--sp-2); align-items: flex-start; margin: var(--sp-2) 0; flex-wrap: wrap; }
.review-inline-form .input { flex: 1; min-width: 200px; }
.review-report summary { cursor: pointer; font-size: var(--fs-xs); }
.overall-score { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.overall-score__num { font-size: 40px; font-weight: 800; color: var(--green-800); line-height: 1; }
[data-theme="dark"] .overall-score__num { color: var(--green-400); }

/* =====================================================================
   Phase 7 â€” Subscriptions & Billing
   ===================================================================== */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-5); margin-block: var(--sp-6) var(--sp-8); align-items: start; }
.pricing-card { position: relative; display: flex; flex-direction: column; gap: var(--sp-4); }
.pricing-card--featured { border-color: var(--color-primary); box-shadow: 0 12px 34px rgba(15,107,71,.14); }
.pricing-card__flag { position: absolute; top: calc(-1 * var(--sp-3)); inset-inline-start: var(--sp-5); }
.pricing-card__name { margin: 0; font-size: var(--fs-lg); color: var(--green-800); }
[data-theme="dark"] .pricing-card__name { color: var(--green-400); }
.pricing-card__price { display: flex; align-items: baseline; gap: var(--sp-2); }
.pricing-card__price span { font-size: 34px; font-weight: 800; line-height: 1; }
.pricing-card__price small { color: var(--text-muted); }
.pricing-card__yearly { margin: calc(-1 * var(--sp-2)) 0 0; font-size: var(--fs-sm); }
.pricing-card__features { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.pricing-card__features li { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-sm); }
.pricing-card__features svg { width: 16px; height: 16px; color: var(--green-500); flex: none; margin-top: 2px; }
.pricing-card__cta { margin-top: auto; }
.invoice-card { max-width: 760px; }
.invoice-head { display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.invoice-brand { font-size: var(--fs-lg); color: var(--green-800); }
[data-theme="dark"] .invoice-brand { color: var(--green-400); }
.invoice-meta { text-align: end; display: grid; gap: var(--sp-1); font-size: var(--fs-sm); }
@media print {
  .no-print, .dash-side, .dash-head, .site-header, .site-footer, .flash { display: none !important; }
  body { background: #fff; }
  .invoice-card, .card { box-shadow: none; border: 1px solid #ddd; }
  .dash-main, .dash-content { margin: 0 !important; padding: 0 !important; }
}

/* =====================================================================
   Phase 8 â€” Admin panel & support
   ===================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.stat-card { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); }
.stat-card > svg { width: 26px; height: 26px; color: var(--green-500); flex: none; }
.stat-card__num { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-card .muted { font-size: var(--fs-xs); }
.queue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.queue-list li { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px dashed var(--border); }
.queue-list li:last-child { border-bottom: 0; }
.queue-list li > span:nth-child(2) { flex: 1; }
.filter-bar { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--sp-5); }
.nav-label--admin { color: var(--color-primary); font-weight: 800; }
.mod-actions { display: grid; gap: var(--sp-2); min-width: 220px; }
.btn-col { display: grid; gap: var(--sp-2); }
.msg__bubble--internal { background: #FFF7E8; border: 1px dashed #E8A93C; }
[data-theme="dark"] .msg__bubble--internal { background: transparent; border: 1px dashed #8a6420; }
@media (max-width: 720px) {
  .filter-bar { flex-direction: column; align-items: stretch; }
}

/* Final polish â€” public content pages */
.faq-item { border-bottom: 1px dashed var(--border); padding-block: var(--sp-3); }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary { cursor: pointer; font-weight: 700; }
.faq-item p { margin: var(--sp-2) 0 0; color: var(--text-muted); line-height: 1.9; }
.how-step { display: flex; gap: var(--sp-4); align-items: flex-start; }
.how-step > svg { width: 30px; height: 30px; color: var(--green-500); flex: none; margin-top: 4px; }
.how-step p { margin: 0; color: var(--text-muted); line-height: 1.9; }
.cat-card { display: flex; flex-direction: column; gap: var(--sp-2); color: var(--text-main); }
.cat-card:hover { border-color: var(--color-primary); }
.cat-card .btn { align-self: flex-start; margin-top: var(--sp-1); }


/* =====================================================================
   Mobile & Tablet Hardening Patch â€” Tender.sy
   Fixes overflow, cramped layouts, dashboard drawer, forms, tables,
   cards, hero, navigation and touch targets on small screens.
   ===================================================================== */

/* Global overflow safeguards */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-width: 0;
}

.container,
.dash-main,
.detail-main,
.detail-side,
.browse-layout > *,
.profile-grid > *,
.grid-2 > *,
.grid-3 > *,
.tender-grid > *,
.cat-grid > *,
.kpi-grid > *,
.footer-grid > * {
  min-width: 0;
}

img,
video,
iframe,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

pre,
code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Better long-text handling */
h1, h2, h3, h4,
p, a, span, strong, small,
.table td, .table th,
.rich-text,
.tender-card__summary,
.notif-body,
.conv-item__main,
.msg__bubble {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Touch-friendly controls */
@media (hover: none), (pointer: coarse) {
  .btn,
  .icon-btn,
  .main-nav a,
  .dash-nav a,
  .status-tabs a,
  .faq-item summary {
    min-height: 44px;
  }

  .card--hover:hover,
  .cat-card:hover {
    transform: none;
  }
}

/* Large tablets and smaller laptops */
@media (max-width: 1180px) {
  :root {
    --container: 100%;
  }

  .container {
    padding-inline: clamp(16px, 3vw, 28px);
  }

  .main-nav {
    gap: 0;
    margin-inline-start: 0;
  }

  .main-nav a {
    padding-inline: 9px;
  }

  .header-actions {
    gap: 6px;
  }

  .detail-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .browse-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .repeater-row {
    grid-template-columns: 135px minmax(0, 1fr) minmax(0, 1fr) 110px 40px;
  }
}

/* Tablets */
@media (max-width: 1024px) {
  :root {
    --header-h: 66px;
  }

  .site-header {
    height: var(--header-h);
  }

  .site-header .container {
    gap: 10px;
  }

  .brand {
    min-width: 0;
    font-size: 1rem;
  }

  .brand__mark {
    width: 38px;
    height: 38px;
  }

  .brand__mark svg {
    width: 21px;
    height: 21px;
  }

  .main-nav {
    display: none;
  }

  .nav-burger {
    display: grid;
    flex: none;
  }

  .header-actions .btn:not(.nav-burger) {
    padding-inline: 14px;
  }

  .hero {
    padding-block: 56px 48px;
  }

  .hero::before {
    width: 300px;
    height: 300px;
    inset-inline-start: -120px;
    top: -100px;
    border-width: 32px;
  }

  .hero__inner {
    max-width: 680px;
  }

  .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tender-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .browse-layout,
  .detail-layout,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .filter-panel,
  .detail-side {
    position: static;
  }

  .detail-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-shell {
    display: block;
  }

  .dash-main {
    width: 100%;
    padding: 26px;
  }

  .dash-side {
    display: block;
    position: fixed;
    top: var(--header-h);
    bottom: 0;
    height: calc(100dvh - var(--header-h));
    width: min(320px, 88vw);
    z-index: 85;
    overflow-y: auto;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    visibility: hidden;
    pointer-events: none;
  }

  [dir="rtl"] .dash-side {
    right: 0;
    left: auto;
    transform: translateX(105%);
  }

  [dir="ltr"] .dash-side {
    left: 0;
    right: auto;
    transform: translateX(-105%);
  }

  .dash-side.is-open {
    transform: translateX(0) !important;
    visibility: visible;
    pointer-events: auto;
  }

  .dash-toggle {
    display: grid !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-shell {
    display: block;
    min-height: 100dvh;
  }

  .auth-side {
    display: none;
  }

  .auth-main {
    min-height: 100dvh;
    padding: 30px 20px;
  }

  .wizard-card {
    max-width: 100%;
  }

  .invoice-card {
    max-width: 100%;
  }
}

/* Mobile landscape and standard tablets */
@media (max-width: 768px) {
  :root {
    --fs-3xl: 1.75rem;
    --fs-2xl: 1.5rem;
    --fs-xl: 1.25rem;
    --sp-16: 48px;
    --sp-20: 56px;
  }

  .container {
    padding-inline: 16px;
  }

  .section {
    padding-block: 42px;
  }

  .section-head {
    margin-bottom: 26px;
  }

  .site-header .container {
    padding-inline: 12px;
  }

  .brand__text {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions {
    gap: 5px;
  }

  .header-actions .lang-switch,
  .header-actions > .btn--outline,
  .header-actions > .btn--secondary {
    display: none;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .drawer__panel {
    width: min(330px, 92vw);
    padding: 20px 16px;
  }

  .hero {
    padding-block: 44px 38px;
  }

  .hero h1 {
    font-size: clamp(1.7rem, 8vw, 2.45rem);
  }

  .hero p {
    font-size: 1rem;
    line-height: 1.8;
  }

  .search-bar {
    width: 100%;
    max-width: 100%;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 30px;
  }

  .stat {
    padding: 16px 10px;
  }

  .stat b {
    font-size: 1.45rem;
  }

  .cat-grid,
  .tender-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .step {
    padding: 20px;
  }

  .card__body {
    padding: 20px;
  }

  .tender-card__top,
  .tender-card__foot,
  .detail-head,
  .invoice-head,
  .review-item__head {
    align-items: flex-start;
  }

  .tender-card__foot {
    flex-wrap: wrap;
  }

  .detail-side {
    grid-template-columns: 1fr;
  }

  .page-hero {
    padding-block: 30px;
  }

  .page-head {
    align-items: stretch;
  }

  .page-head .btn-row,
  .dash-head .btn-row {
    width: 100%;
  }

  .page-head .btn-row .btn,
  .dash-head .btn-row .btn {
    flex: 1 1 auto;
  }

  .grid-2,
  .grid-3,
  .check-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .wizard-steps {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 8px;
    margin-inline: -4px;
  }

  .wizard-steps li {
    flex: 0 0 auto;
    min-width: 46px;
  }

  .wizard-steps a,
  .wizard-steps li > span {
    min-width: 44px;
    justify-content: center;
    padding: 9px;
  }

  .wizard-steps__t {
    display: none;
  }

  .wizard-actions {
    flex-wrap: wrap;
  }

  .wizard-actions .btn {
    flex: 1 1 140px;
  }

  .repeater-row,
  .repeater-row--docs,
  .repeater-row--crit,
  .crit-row,
  .doc-upload {
    grid-template-columns: 1fr;
  }

  .repeater-row,
  .repeater-row--docs,
  .repeater-row--crit {
    border: 1px dashed var(--border);
    border-radius: var(--r-md);
    padding: 14px;
    margin-bottom: 14px;
  }

  .repeater-row .icon-btn {
    justify-self: end;
  }

  .completion {
    min-width: 0;
    width: 100%;
    text-align: start;
  }

  .profile-grid {
    gap: 18px;
  }

  .status-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 7px;
  }

  .status-tabs a {
    flex: 0 0 auto;
  }

  .filter-bar,
  .committee-form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar > *,
  .committee-form > * {
    width: 100%;
    max-width: 100%;
  }

  .notif-item,
  .conv-item {
    padding: 14px;
  }

  .conv-item {
    flex-direction: column;
  }

  .conv-item__meta {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: start;
  }

  .thread-card {
    max-height: none;
  }

  .thread {
    max-height: 55dvh;
  }

  .msg__bubble {
    max-width: 90%;
  }

  .thread-reply {
    flex-direction: column;
    align-items: stretch;
  }

  .thread-reply__side {
    flex-direction: row;
    justify-content: flex-end;
  }

  .invoice-meta {
    width: 100%;
    text-align: start;
  }

  .table-wrap,
  .table-card {
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  table.table {
    min-width: 700px;
  }

  .dash-main {
    padding: 20px 16px;
  }

  .dash-head {
    align-items: stretch;
    margin-bottom: 22px;
  }

  .kpi-grid,
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 26px 20px;
  }
}

/* Small phones */
@media (max-width: 560px) {
  :root {
    --header-h: 62px;
  }

  body {
    font-size: 0.95rem;
  }

  .container {
    padding-inline: 13px;
  }

  .site-header .container {
    padding-inline: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand__mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .brand__text {
    max-width: 95px;
    font-size: 0.92rem;
  }

  .header-actions .theme-toggle {
    display: none;
  }

  .hero {
    padding-block: 36px 30px;
  }

  .hero::before {
    width: 220px;
    height: 220px;
    border-width: 24px;
  }

  .hero__inner {
    text-align: center;
  }

  .hero p {
    margin-bottom: 22px;
  }

  .search-bar {
    flex-direction: column;
    gap: 8px;
    padding: 9px;
    border-radius: 16px;
  }

  .search-bar input {
    width: 100%;
    min-height: 46px;
    padding-inline: 12px;
  }

  .search-bar .btn,
  .hero__cta .btn {
    width: 100%;
  }

  .hero__cta {
    flex-direction: column;
  }

  .stats-strip,
  .cat-grid,
  .tender-grid,
  .kpi-grid,
  .stat-grid,
  .footer-grid,
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .stats-strip {
    gap: 9px;
  }

  .stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: start;
    gap: 12px;
  }

  .stat b {
    font-size: 1.35rem;
  }

  .cat-card {
    align-items: flex-start;
  }

  .tender-card__top,
  .tender-card__foot,
  .owner-box,
  .overall-score {
    flex-direction: column;
    align-items: flex-start;
  }

  .badge-col {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .card__body {
    padding: 16px;
  }

  .btn,
  .btn--lg {
    min-height: 46px;
    padding-inline: 16px;
  }

  .btn-row {
    width: 100%;
  }

  .btn-row .btn {
    flex: 1 1 100%;
  }

  .input,
  .select,
  .textarea {
    font-size: 16px; /* Prevents iOS zoom */
  }

  .account-types {
    grid-template-columns: 1fr;
  }

  .auth-main {
    padding: 22px 14px;
    align-items: flex-start;
  }

  .auth-card h1 {
    font-size: 1.55rem;
  }

  .wizard-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .wizard-actions .btn {
    width: 100%;
    flex: none;
  }

  .review-grid > div,
  .info-list > div {
    flex-direction: column;
    gap: 4px;
  }

  .review-grid dd,
  .info-list dd {
    text-align: start;
  }

  .detail-badges {
    gap: 6px;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .completion {
    text-align: start;
  }

  .avatar-img {
    width: 108px;
    height: 108px;
  }

  .file-list li {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .file-list small {
    width: 100%;
    margin-inline-start: 0;
  }

  .qa-card__head,
  .qa-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .review-inline-form {
    flex-direction: column;
  }

  .review-inline-form .input,
  .review-inline-form .btn {
    width: 100%;
    min-width: 0;
  }

  .notif-item {
    gap: 9px;
  }

  .msg__bubble {
    max-width: 96%;
    padding: 10px 12px;
  }

  .thread-reply__side {
    width: 100%;
  }

  .thread-reply__side .btn,
  .thread-reply__side .icon-btn {
    flex: 1;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .newsletter-form .btn {
    width: 100%;
  }

  .footer-bottom {
    justify-content: center;
    text-align: center;
  }

  .dash-main {
    padding: 16px 12px;
  }

  .dash-head {
    flex-direction: column;
  }

  .dash-head > * {
    width: 100%;
  }

  .kpi {
    padding: 16px;
  }

  .table-wrap,
  .table-card {
    border-radius: 12px;
  }

  table.table {
    min-width: 640px;
  }

  .pagination {
    gap: 8px;
    flex-wrap: wrap;
  }

  .pagination .btn {
    flex: 1 1 auto;
  }

  .error-page {
    padding: 60px 16px;
  }
}

/* Extra-small phones */
@media (max-width: 390px) {
  .brand__text {
    display: none;
  }

  .header-actions {
    margin-inline-start: auto;
  }

  .hero h1 {
    font-size: 1.55rem;
  }

  .hero p {
    font-size: 0.92rem;
  }

  .section-head h2 {
    font-size: 1.35rem;
  }

  .badge {
    white-space: normal;
  }

  .kpi b,
  .stat-card__num {
    font-size: 1.5rem;
  }
}