:root {
  /* Light theme — matches the conventional job-board look (zangia.mn and
     most job boards use light backgrounds); previously a dark navy theme.
     Brand orange accent kept unchanged so the site still reads as MinePost. */
  --bg: #f5f7fa;
  --bg-alt: #eaeef2;
  --surface: #ffffff;
  --surface-hover: #f0f3f6;
  --border: #dde2e8;
  --text: #1c2733;
  --text-dim: #57636f;
  --text-faint: #8996a3;
  --accent: #e8952f;
  --accent-dark: #c97b1e;
  --accent-text: #1a1200;
  --ok: #2f9e57;
  --warn: #b9791a;
  --danger: #c53b37;
  --radius: 10px;
  --max-width: 1120px;
  font-size: 16px;
  color-scheme: light;
}

/* Dark theme — opt-in via the header's light/dark switcher (Theme module in
   theme.js), stored in localStorage and applied as [data-theme="dark"] on
   <html>. Every var from :root above is redefined here; nothing else needs
   to change since the rest of the stylesheet only ever reads var(--...). */
:root[data-theme="dark"] {
  --bg: #10151b;
  --bg-alt: #171d25;
  --surface: #1b222b;
  --surface-hover: #232b35;
  --border: #2b333e;
  --text: #e7ecf1;
  --text-dim: #a6b0bc;
  --text-faint: #78828e;
  --accent: #e8952f;
  --accent-dark: #f2a94d;
  --accent-text: #1a1200;
  --ok: #3fbf72;
  --warn: #d9a441;
  --danger: #e0645f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  /* Safety net: nothing on the site should need the page itself to scroll
     sideways (tables and a few grids handle their own horizontal overflow
     internally) — this just guards against any oversized child dragging
     the sticky header along with a page-wide horizontal scrollbar. */
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  /* Wider than the page's content column (var(--max-width), 1120px) on
     purpose: the header has to fit a logo, 5 nav links, both toggles, and
     (when signed in) a name + dashboard link + logout button all in one
     row — capping it at the same 1120px as body content left no room for
     that on any browser window, no matter how wide, and produced a
     wrapped/jumbled header even on large screens. 1420px (bumped from
     1320px when the "Зар сурталчилгаа" nav link was added, 2026-08-27) —
     measured empirically the same way: 1320px still wrapped the signed-in
     company state's nav onto two lines with 5 links, even at very wide
     viewports, since this max-width caps the row regardless of viewport. */
  max-width: 1420px;
  margin: 0 auto;
  position: relative;
}
/* Hamburger toggle — hidden on desktop, shown below the responsive breakpoint */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  flex-shrink: 0;
}
/* Nav links + toggles + auth actions, collapsible on narrow screens */
.header-collapse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  gap: 20px;
  min-width: 0;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo .mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-text);
  font-weight: 800;
}
nav.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
nav.main-nav a {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.95rem;
}
nav.main-nav a:hover, nav.main-nav a.active { color: var(--text); text-decoration: none; }
.nav-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* Responsive header: below this width the nav links + toggles + auth actions
   collapse behind a hamburger button instead of squeezing/wrapping onto the
   same line as the logo (which is what produced a broken, jumbled header on
   laptop/tablet widths before this existed). 1420px rather than a more
   typical ~900px tablet breakpoint because the uncollapsed row has to fit
   the logo + 5 nav links + theme toggle + lang toggle + up to two auth
   buttons (or a name + dashboard link + logout when signed in) all at once;
   measured empirically (screenshotting the actual rendered header across a
   sweep of widths) — the signed-in state, which is the longest, keeps
   wrapping onto two ragged lines all the way up to ~1385px. Bumped from
   1300px when the "Зар сурталчилгаа" nav link was added (2026-08-27) —
   re-measured the same way with 5 links instead of 4. */
@media (max-width: 1420px) {
  .nav-toggle { display: flex; }
  .header-collapse {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px 20px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
  }
  .header-collapse.open { display: flex; }
  nav.main-nav { flex-direction: column; align-items: flex-start; gap: 14px; }
  .nav-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .nav-actions .theme-toggle, .nav-actions .lang-toggle { align-self: flex-start; }
  .nav-actions .btn { width: 100%; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Hero */
.hero {
  background:
    radial-gradient(circle at 15% 20%, rgba(232,149,47,0.14), transparent 40%),
    linear-gradient(180deg, #0d141b, #131f29);
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 2.4rem;
  margin: 0 0 12px;
  max-width: 700px;
}
.hero p.lead {
  color: var(--text-dim);
  font-size: 1.1rem;
  max-width: 620px;
  margin: 0 0 28px;
}
.search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 720px;
}
.search-bar input {
  flex: 1;
  min-width: 160px;
}
.hero-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.hero-tabs a {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 600;
}
.hero-tabs a.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Sections */
section.block { padding: 44px 0; }
section.block h2 { font-size: 1.5rem; margin: 0 0 4px; }
section.block p.section-sub { color: var(--text-faint); margin: 0 0 24px; }

/* Cards / grid */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; } }

/* Job detail page (job.html) tabs + layout — "Ажлын зар" is a 3-column
   layout (main / similar jobs / apply), "Бусад зар" and "Компанийн тухай"
   are single-column. See functions/api/jobs/[id]/similar.js and
   functions/api/companies/[id]/profile.js for the data these render. */
#job-content.layout-3col { grid-template-columns: 2fr 1.1fr 1fr; }
#job-content.layout-1col { grid-template-columns: 1fr; }
@media (max-width: 1080px) { #job-content.layout-3col { grid-template-columns: 1.6fr 1fr; } }
@media (max-width: 760px) { #job-content.layout-3col { grid-template-columns: 1fr; } }
/* Grid items default to min-width:auto, which stops them shrinking below
   their content's unwrapped intrinsic width (e.g. the fact table's nowrap
   labels) — that blows out the whole page horizontally on narrow screens
   instead of letting the column (or the table's own overflow-x rule) contain
   it. min-width:0 here is what makes the responsive column rules above and
   the table's own mobile scroll rule actually take effect. */
#job-content.layout-3col > *, #job-content.layout-1col > * { min-width: 0; }

.job-tabs-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.job-tabs-row .breadcrumb { margin-bottom: 0; }
.job-tabs-row .breadcrumb button {
  background: none; border: none; padding: 0; font: inherit; color: var(--text-faint); cursor: pointer;
}
.job-tabs-row .breadcrumb button.active { color: var(--text); font-weight: 700; }
.job-side-tabs { display: flex; gap: 8px; }

.similar-jobs-list { display: flex; flex-direction: column; gap: 12px; }
.similar-job-row { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.similar-job-row:last-child { border-bottom: none; padding-bottom: 0; }
.similar-job-row .title { font-weight: 700; display: block; }
.similar-job-row .company { font-size: 0.85rem; }
.similar-job-row .meta-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-top: 4px; }
.similar-job-row .salary { font-weight: 700; font-size: 0.9rem; }
.similar-job-row .posted { font-size: 0.72rem; color: var(--text-faint); text-align: right; white-space: nowrap; }

.company-logo-circle {
  width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
  background: var(--bg-alt); font-weight: 800; color: var(--text-faint);
}
.company-logo-circle img { width: 100%; height: 100%; object-fit: cover; }
.company-social-icons { display: flex; gap: 10px; }
.company-social-icons a {
  width: 34px; height: 34px; border-radius: 50%; background: var(--bg-alt); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 0.95rem; color: var(--text-dim);
}
.star-rating { display: flex; gap: 4px; font-size: 1.5rem; cursor: pointer; line-height: 1; }
.star-rating .star { color: var(--border); }
.star-rating .star.filled { color: #f5a623; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--accent-dark); }
.card h3 { margin: 0 0 6px; font-size: 1.08rem; }
.card .company { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 10px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 600;
}
.badge.accent { background: rgba(232,149,47,0.15); border-color: var(--accent-dark); color: var(--accent); }
.badge.ok { background: rgba(63,174,98,0.15); border-color: var(--ok); color: var(--ok); }
.badge.warn { background: rgba(217,164,65,0.15); border-color: var(--warn); color: var(--warn); }
.badge.danger { background: rgba(217,83,79,0.15); border-color: var(--danger); color: var(--danger); }

/* Forms */
form.stack { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.86rem; color: var(--text-dim); font-weight: 600; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .row-2 { grid-template-columns: 1fr; } }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 110px; gap: 14px; }
@media (max-width: 640px) { .row-3 { grid-template-columns: 1fr; } }

input, textarea, select {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.94rem;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 90px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.auth-shell {
  max-width: 460px;
  margin: 56px auto;
}
/* flex-wrap + min-width (rather than a hard "shrink to fit on one line")
   means a 2-button switcher (login/register) still fills the row evenly,
   while a many-button tab bar (dashboard/admin panels, up to 9 tabs) wraps
   onto a second or third row instead of squeezing every button down to
   two-line, barely-readable text on laptop/tablet/phone widths. */
.auth-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.auth-tabs button {
  flex: 1 1 auto;
  min-width: 110px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.auth-tabs button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.alert.error { background: rgba(197,59,55,0.10); border: 1px solid var(--danger); color: var(--danger); }
.alert.success { background: rgba(47,158,87,0.10); border: 1px solid var(--ok); color: var(--ok); }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:hover { color: var(--accent-hover, var(--accent)); }

/* Language toggle (About / Pricing / Terms / Contact) */
.lang-toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 24px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.lang-btn.active { background: var(--accent); color: var(--accent-text); }

/* Light/dark theme switcher — same pill styling as the language toggle */
.theme-toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 24px;
}
.theme-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}
.theme-btn.active { background: var(--accent); color: var(--accent-text); }

/* Pricing cards */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 800px) { .pricing-grid { grid-template-columns: 1fr; } }
.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.price-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); position: relative; }
.price-card .badge-recommended {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700;
  padding: 3px 12px; border-radius: 999px; letter-spacing: 0.02em; white-space: nowrap;
}
.price-card h3 { margin: 0 0 4px; font-size: 1.1rem; }
.price-card .price { font-size: 1.6rem; font-weight: 800; margin: 6px 0 18px; }
.price-card .price small { font-size: 0.85rem; font-weight: 500; color: var(--text-faint); }
.price-card ul { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.price-card ul li { display: flex; gap: 8px; font-size: 0.9rem; color: var(--text-dim); }
.price-card ul li::before { content: "✓"; color: var(--accent); font-weight: 700; }
/* "Бүтээгдэхүүн нийлүүлэгч — L1" (2026-08-30) — visually separated from the
   mining-tier grid per the policy screenshot: a distinct double border
   instead of the mining tiers' single border / accent-outline "featured" style. */
.supplier-package-card { border: 2px solid var(--warn); }

.prose h2 { margin-top: 32px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--text-dim); line-height: 1.7; }
.prose ul { padding-left: 20px; }
.legal-note { color: var(--text-faint); font-size: 0.85rem; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
/* On phones a data-dense table (dashboard/admin lists routinely have 6-9
   columns) is wider than the screen. Rather than letting the whole page
   scroll sideways (which drags the sticky header along with it), the table
   itself becomes the horizontally-scrollable element. */
@media (max-width: 700px) {
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}
/* Same idea, opted into at any screen width — for the admin panel's widest
   tables (Компаниуд, Нэхэмжлэл, Ажлын зар, Бүтээгдэхүүн, Зар сурталчилгаа),
   which grew past what fits in the .panel box on a normal desktop window
   once ID/date columns were added (2026-08-29, "no longer fits its box"
   report). Wrap a <table> in <div class="admin-table-scroll"> to give it
   its own horizontal scrollbar instead of squeezing/overflowing the panel. */
.admin-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-table-scroll table { white-space: nowrap; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-faint); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-faint);
}

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 40px;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.site-footer a.active { color: var(--accent); font-weight: 600; }
.private-banner {
  background: #2a1f0c;
  border-bottom: 1px solid var(--accent-dark);
  color: var(--accent);
  text-align: center;
  font-size: 0.82rem;
  padding: 6px 10px;
}

.detail-title { font-size: 1.7rem; margin: 0 0 6px; }
.breadcrumb { color: var(--text-faint); font-size: 0.85rem; margin-bottom: 14px; }
.breadcrumb a { color: var(--text-faint); }

.qa-block { border: 1px solid var(--border); border-radius: 8px; padding: 14px; background: var(--bg-alt); }
.qa-block + .qa-block { margin-top: 12px; }
.option-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

.stat-tile { text-align: center; }
.stat-tile .stat-num { font-size: 2rem; font-weight: 800; color: var(--accent); }
.stat-tile .stat-label { color: var(--text-dim); font-size: 0.85rem; margin-top: 4px; }

.admin-topbar {
  background: linear-gradient(180deg, #0d141b, #101b24);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.admin-topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-topbar .logo { font-weight: 700; font-size: 1.15rem; }

.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--text-faint); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }

/* Jobs listing page: ad banners */
.ad-banner {
  border: 1px dashed var(--accent-dark);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(232,149,47,0.10), rgba(232,149,47,0.03));
  color: var(--text-dim);
  text-align: center;
}
.ad-banner-top { padding: 18px 20px; margin-bottom: 20px; }
.ad-banner-top strong { color: var(--accent); display: block; font-size: 1rem; margin-bottom: 4px; }
.ad-banner-top p { margin: 0 0 10px; font-size: 0.86rem; }
/* Sized for a 250x500 sidebar banner image (updated 2026-08-30, shrunk down
   from 300x600 — the sidebar ad was reading as oversized next to a more
   compact reference layout) — the 16px padding on each side is included in
   the 282px column width (.jobs-layout/.products-layout/.home-ad-row
   below), so a 250px-wide image renders at its true native width instead of
   being scaled down. */
.ad-banner-side { padding: 20px 16px; position: sticky; top: 16px; }
.ad-banner-side strong { color: var(--accent); display: block; font-size: 0.92rem; margin-bottom: 6px; }
.ad-banner-side p { margin: 0 0 12px; font-size: 0.82rem; }
.ad-banner .btn { font-size: 0.8rem; }
.ad-banner.ad-banner-live {
  border-style: solid;
  background: var(--surface);
  text-align: left;
}
.ad-banner.ad-banner-live a { color: inherit; text-decoration: none; }
.ad-banner.ad-banner-live strong { color: var(--text); }

/* Live ad image (App.js's loadAdSlot injects this class on both the top and
   side placements). The top banner is left to scale freely with the page
   width — any wide image works there (recommended 1200x120, see
   adsPage.banner1Size / admin.adImageSizeHint in lang.js). The side
   placement is hard-capped to the 250x500 frame regardless of what the
   advertiser actually uploads, so an oversized source image can never blow
   up the sidebar column height; object-fit: cover fills the frame without
   distorting the image. */
.ad-banner-img { display: block; margin: 0 auto; border-radius: 8px; max-width: 100%; }
.ad-banner-top .ad-banner-img { width: 100%; }
.ad-banner-side .ad-banner-img { width: 100%; aspect-ratio: 1 / 2; max-height: 500px; object-fit: cover; }

/* Jobs listing page: 3-column layout (filters | main | ad) */
.jobs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 282px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1080px) { .jobs-layout { grid-template-columns: 260px minmax(0, 1fr); } .jobs-layout .ad-banner-side { display: none; } }
@media (max-width: 760px) { .jobs-layout { grid-template-columns: 1fr; } }

.filter-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}
.filter-sidebar h3 { margin: 0; font-size: 0.98rem; }
.filter-group { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 14px; }
.filter-group:first-of-type { border-top: none; padding-top: 0; }
.filter-group > label.group-title { font-size: 0.82rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.02em; }
.filter-group select,
.filter-group input:not([type="checkbox"]) { width: 100%; }
.filter-range { display: flex; align-items: center; gap: 8px; }
.filter-range input { min-width: 0; }

.category-tree { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.category-node { border-bottom: 1px solid var(--border); }
.category-node:last-child { border-bottom: none; }
.category-head { display: flex; align-items: flex-start; gap: 6px; padding: 6px 0; cursor: pointer; user-select: none; }
.category-head .arrow { font-size: 0.7rem; color: var(--text-faint); transition: transform 0.15s ease; width: 10px; flex-shrink: 0; display: inline-block; margin-top: 4px; }
.category-node.open .category-head .arrow { transform: rotate(90deg); }
.category-head input.cat-all { flex-shrink: 0; margin-top: 4px; }
.category-head span.label { font-size: 0.86rem; font-weight: 600; line-height: 1.35; flex: 1; }
.category-head .count { font-size: 0.72rem; color: var(--text-faint); font-weight: 500; white-space: nowrap; }
.category-children { display: none; flex-direction: column; gap: 2px; padding: 2px 0 8px 22px; }
.category-node.open .category-children { display: flex; }
.category-children label { display: flex; align-items: flex-start; gap: 6px; font-size: 0.82rem; color: var(--text-dim); padding: 2px 0; line-height: 1.35; }
.category-children label input { flex-shrink: 0; margin-top: 3px; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 10px 5px 12px; font-size: 0.8rem; color: var(--text);
}
.filter-chip button {
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  font-size: 0.9rem; line-height: 1; padding: 0;
}
.filter-chip button:hover { color: var(--danger); }

.tabs-bar { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs-bar button {
  background: none; border: none; color: var(--text-dim); font-size: 0.88rem; font-weight: 600;
  padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: flex; align-items: center; gap: 6px;
}
.tabs-bar button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs-bar button.disabled { color: var(--text-faint); cursor: default; }
.tabs-bar button .soon-badge {
  font-size: 0.65rem; font-weight: 700; background: var(--bg-alt); color: var(--text-faint);
  border-radius: 999px; padding: 1px 6px; border: 1px solid var(--border);
}

.jobs-list { display: flex; flex-direction: column; gap: 12px; }
.job-card-v2 {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; position: relative; transition: border-color 0.15s ease;
}
.job-card-v2:hover { border-color: var(--accent-dark); }
.job-card-v2 .logo-box {
  width: 52px; height: 52px; border-radius: 10px; background: var(--bg-alt);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--accent); font-size: 1.2rem; flex-shrink: 0;
}
.job-card-v2 .job-card-body { flex: 1; min-width: 0; }
.job-card-v2 h3 { margin: 0 0 4px; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.01em; }
.job-card-v2 .company { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 8px; }
.job-card-v2 .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.job-card-v2 .meta .salary { color: var(--accent); font-weight: 700; font-size: 0.88rem; }
.job-card-v2 .meta .location-date { color: var(--text-faint); font-size: 0.8rem; }
.job-card-v2 .bookmark-btn {
  position: absolute; top: 14px; right: 14px; background: none; border: none; cursor: pointer;
  color: var(--text-faint); font-size: 1.05rem; padding: 4px;
}
.job-card-v2 .bookmark-btn.saved { color: var(--accent); }

/* Home page: jobs preview row (list + side ad), simpler than the full
   jobs.html filter layout — just a main column and one ad slot. */
.home-ad-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 282px;
  gap: 20px;
  align-items: start;
}
.home-ad-row .ad-banner-side { position: static; top: auto; }
@media (max-width: 900px) {
  .home-ad-row { grid-template-columns: 1fr; }
  .home-ad-row .ad-banner-side { display: none; }
}

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.pagination button {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 8px; padding: 7px 12px; font-size: 0.85rem; cursor: pointer; min-width: 36px;
}
.pagination button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination .ellipsis { color: var(--text-faint); padding: 0 4px; }

/* M-Market (products) browse page: same 3-column filter-sidebar / main /
   ad-rail pattern as .jobs-layout. */
.products-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 282px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1080px) { .products-layout { grid-template-columns: 260px minmax(0, 1fr); } .products-layout .ad-banner-side { display: none; } }
@media (max-width: 760px) { .products-layout { grid-template-columns: 1fr; } }

.product-grid { gap: 16px; }
.product-card-v2 {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: border-color 0.15s ease;
}
.product-card-v2:hover { border-color: var(--accent-dark); }
.product-thumb {
  width: 100%; aspect-ratio: 4 / 3; background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-thumb .thumb-fallback { font-weight: 800; color: var(--accent); font-size: 1.8rem; }
.product-card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.product-card-body h3 { margin: 2px 0 0; font-size: 1rem; }
.product-card-body .company { color: var(--text-dim); font-size: 0.85rem; }
.product-card-body .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.product-card-body .location-date { color: var(--text-faint); font-size: 0.8rem; }

/* Product detail page: main photo + thumbnail strip */
.product-gallery { margin-bottom: 16px; }
.product-gallery-main {
  width: 100%; max-height: 420px; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-alt); border: 1px solid var(--border);
}
.product-gallery-main img { width: 100%; height: 100%; max-height: 420px; object-fit: contain; display: block; margin: 0 auto; }
.product-gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; }
.product-gallery-thumbs img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; opacity: 0.75;
}
.product-gallery-thumbs img.active { border-color: var(--accent); opacity: 1; }

/* Newsroom ("Мэдээ", 2026-08-30): main column (hero card + card grid) +
   the same 282px ad-rail sidebar used by .home-ad-row / .products-layout. */
.news-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 282px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1080px) { .news-layout { grid-template-columns: 1fr; } .news-layout .ad-banner-side { display: none; } }

.news-hero-card {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 20px;
}
.news-hero-card:hover { border-color: var(--accent-dark); }
.news-hero-thumb { width: 100%; height: 100%; min-height: 220px; background: var(--bg-alt); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.news-hero-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-hero-thumb .thumb-fallback { font-weight: 800; color: var(--accent); font-size: 2.4rem; }
.news-hero-body { order: -1; padding: 20px 0 20px 20px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
@media (max-width: 720px) { .news-hero-card { grid-template-columns: 1fr; } .news-hero-body { order: 0; padding: 16px 16px 0; } }

.news-grid { gap: 16px; }
.news-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: border-color 0.15s ease;
}
.news-card:hover { border-color: var(--accent-dark); }
.news-card-thumb { width: 100%; aspect-ratio: 16 / 10; background: var(--bg-alt); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.news-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card-thumb .thumb-fallback { font-weight: 800; color: var(--accent); font-size: 1.6rem; }
.news-card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.news-card-body h3 { margin: 2px 0 0; font-size: 0.95rem; }
.news-card-body .excerpt { color: var(--text-dim); font-size: 0.83rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.news-card-body .meta { color: var(--text-faint); font-size: 0.76rem; }

/* Image-upload preview thumbnails (post-a-product form) */
.image-upload-preview { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.image-upload-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* Modal (job-seeker CV builder's add/edit forms) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 24, 28, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 100;
}
.modal-panel {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  width: 100%; max-width: 520px; padding: 24px; box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.modal-panel h3 { margin: 0 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 2px 4px; }
.modal-close:hover { color: var(--text); }
.modal-desc { color: var(--text-faint); font-size: 0.82rem; margin: -12px 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* CV builder (job seeker dashboard) */
.cv-header { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.cv-avatar-wrap { position: relative; flex-shrink: 0; }
.cv-avatar {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: var(--bg-alt); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 1.6rem;
}
.cv-icon-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-dim); flex-shrink: 0;
}
.cv-icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.cv-icon-btn.cv-avatar-edit { position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; }
.cv-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cv-section-title h3 { margin: 0; font-size: 1rem; }
.cv-item { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; position: relative; }
.cv-item:last-child { margin-bottom: 0; }
.cv-item-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
.cv-item-title { font-weight: 600; margin: 0 0 2px; padding-right: 60px; }
.cv-item-sub { color: var(--text-dim); font-size: 0.86rem; margin: 0 0 2px; }
.cv-item-meta { color: var(--text-faint); font-size: 0.8rem; }
.cv-item-desc { margin-top: 8px; font-size: 0.88rem; white-space: pre-wrap; }
.cv-skill-group { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin-bottom: 10px; }
.cv-skill-group:last-child { margin-bottom: 0; }
.cv-skill-group-label { font-weight: 600; font-size: 0.86rem; margin-bottom: 8px; }
.cv-skill-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-skill-pill {
  display: inline-flex; align-items: center; gap: 6px; background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 0.84rem;
}
.cv-skill-pill button { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 2px 4px; }
.cv-skill-pill button:hover { color: var(--danger); }
.cv-skill-empty { color: var(--text-faint); font-size: 0.84rem; }
.cv-tag-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cv-tag-picker button {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: 0.84rem; cursor: pointer; color: var(--text);
}
.cv-tag-picker button:hover { border-color: var(--accent); color: var(--accent); }
.cv-tag-picker button.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* Contact page ("Санал хүсэлт" feedback form): file dropzone — dashed box
   with an upload icon + a "Сонгох" (Choose) button. Click-to-browse and
   drag-and-drop are both wired up in contact.html's inline script. */
.file-dropzone {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-dropzone:hover, .file-dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(232, 149, 47, 0.06);
}
.file-dropzone-icon { font-size: 1.4rem; margin-bottom: 6px; color: var(--text-dim); }
.file-dropzone-name { margin-top: 8px; font-size: 0.85rem; color: var(--text-dim); word-break: break-all; }

/* Support chat widget (2026-08-29) — floating bubble + panel, injected by
   App.initSupportChat() in app.js, logged-in companies only.
   (2026-08-30: a brief WhatsApp click-to-chat replacement was tried and
   reverted — WhatsApp's free wa.me links always hand off to the WhatsApp
   app/web in a new tab, with no free way to keep the visitor on-site,
   which is what's wanted here. Back to this in-house panel.) */
.support-chat-bubble {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--accent-text); font-size: 1.5rem; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
}
.support-chat-bubble:hover { filter: brightness(1.05); }
.support-chat-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 91;
  width: min(340px, calc(100vw - 32px)); height: min(460px, calc(100vh - 140px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
  flex-direction: column; overflow: hidden;
}
/* The panel's own `display: flex` must only apply while it's NOT hidden —
   an unconditional `display` here has the same specificity as the
   browser's built-in `[hidden] { display: none }` rule, and since author
   CSS is applied after the UA stylesheet, it would win the tie and make
   the hidden attribute do nothing visually (2026-08-29 bug report: the ✕
   close button correctly set `panel.hidden = true`, but the panel stayed
   on screen because of exactly this). */
.support-chat-panel:not([hidden]) { display: flex; }
.support-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 700;
}
.support-chat-close { background: none; border: none; color: var(--text-dim); font-size: 1rem; cursor: pointer; line-height: 1; padding: 2px 4px; }
.support-chat-close:hover { color: var(--text); }
.support-chat-messages { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.support-chat-empty { color: var(--text-faint); font-size: 0.85rem; text-align: center; margin-top: 20px; }
.support-chat-msg { display: flex; }
.support-chat-msg.me { justify-content: flex-end; }
.support-chat-msg.them { justify-content: flex-start; }
.support-chat-bubble-text {
  max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: 0.86rem; line-height: 1.4;
  overflow-wrap: break-word; white-space: pre-wrap;
}
.support-chat-msg.me .support-chat-bubble-text { background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.support-chat-msg.them .support-chat-bubble-text { background: var(--bg-alt); color: var(--text); border-bottom-left-radius: 4px; }
.support-chat-input-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.support-chat-input-row input {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 0.85rem;
}
/* ✕ button confirmation ("finish the chat?", 2026-08-29) — an overlay
   inside the same panel (`.support-chat-panel` is already `position:
   fixed`, so it's the positioning context for this `absolute` overlay),
   not a native browser confirm(). Same [hidden]-attribute rule as
   .support-chat-panel above: don't declare `display` unconditionally on
   the base selector, only under :not([hidden]) — see that rule's comment
   for why an unconditional `display` here would silently defeat `hidden`. */
.support-chat-confirm-overlay {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(0, 0, 0, 0.35);
  align-items: center; justify-content: center; padding: 16px;
}
.support-chat-confirm-overlay:not([hidden]) { display: flex; }
.support-chat-confirm-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; max-width: 240px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.support-chat-confirm-box p { margin: 0; font-size: 0.86rem; color: var(--text); }
.support-chat-confirm-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
@media (max-width: 480px) {
  .support-chat-bubble { right: 14px; bottom: 14px; }
  .support-chat-panel { right: 14px; bottom: 78px; }
}
