* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f6f8;
  color: #1a1a1a;
}
a { color: #1b6fd6; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }

.page-shell { max-width: 1560px; margin: 0 auto; display: flex; align-items: flex-start; gap: 16px; padding: 0 16px; }
.page-shell > .container { flex: 1 1 0; min-width: 0; margin: 0 auto; padding: 24px 0; }
.site-sidebar { flex: 0 0 160px; width: 160px; position: sticky; top: 16px; }
.site-sidebar .ad-banner { margin-bottom: 0; height: 100%; min-height: 300px; }
@media (max-width: 1400px) { .site-sidebar { display: none; } }

.site-header { background: #fff; border-bottom: 1px solid #e2e5e9; }
.top-bar {
  max-width: 1200px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; gap: 24px;
}
.logo { font-size: 22px; font-weight: 700; color: #1b6fd6; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a {
  color: #333; font-weight: 600; font-size: 14px;
  padding: 8px 14px; border-radius: 20px; transition: background .15s ease, color .15s ease;
}
.main-nav a:hover { background: #eaf2fd; color: #1b6fd6; text-decoration: none; }
.burger {
  display: none; background: none; border: 1px solid #e2e5e9; border-radius: 8px;
  font-size: 20px; padding: 4px 10px; cursor: pointer; margin-left: auto; transition: background .15s ease;
}
.burger:hover { background: #f0f2f5; }
.auth-block { display: flex; gap: 10px; align-items: center; }

.sub-bar {
  background: #eef6ec; border-top: 1px solid #e2e5e9;
  display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; font-size: 13px;
  max-width: 1200px; margin: 0 auto;
}
.sub-bar-link, .nav-dropdown-toggle {
  display: inline-block; color: #2c6b2f; background: #fff; border: 1px solid #d7e8d4; border-radius: 16px;
  padding: 6px 12px; font-weight: 600; font-size: 13px; font-family: inherit; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, transform .1s ease;
  white-space: nowrap;
}
.sub-bar-link:hover, .nav-dropdown-toggle:hover { background: #2c9d3f; color: #fff !important; border-color: #2c9d3f; text-decoration: none; box-shadow: 0 2px 6px rgba(44,157,63,.3); transform: translateY(-1px); }
.sub-bar-link-tariff { color: #c0272d !important; border-color: #f0b8ba; font-weight: 700; }
.sub-bar-link-tariff:hover { background: #c0272d; border-color: #c0272d; color: #fff !important; box-shadow: 0 2px 6px rgba(192,39,45,.35); }
.nav-dropdown { position: relative; }
.nav-dropdown.open .nav-dropdown-toggle { background: #2c9d3f; color: #fff; border-color: #2c9d3f; }
.nav-dropdown-menu {
  display: none; flex-direction: column; gap: 2px; position: absolute; top: 100%; left: 0; margin-top: 6px;
  background: #fff; border: 1px solid #e2e5e9; border-radius: 10px; box-shadow: 0 8px 22px rgba(0,0,0,.14);
  padding: 6px; min-width: 200px; z-index: 60;
}
.nav-dropdown.open .nav-dropdown-menu { display: flex; }
.nav-dropdown-menu a {
  color: #333; font-weight: 500; font-size: 14px; padding: 8px 10px; border-radius: 6px; white-space: nowrap;
  transition: background .15s ease;
}
.nav-dropdown-menu a:hover { background: #eef6ec; text-decoration: none; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 7px;
  font-weight: 600; font-size: 14px; border: 1px solid transparent; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, transform .1s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #2fa84f; color: #fff !important; text-decoration:none; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.btn-primary:hover { background: #278a41; text-decoration:none; box-shadow: 0 3px 10px rgba(47,168,79,.35); transform: translateY(-1px); }
.btn-outline { border-color: #1b6fd6; color: #1b6fd6 !important; text-decoration:none; background: #fff; }
.btn-outline:hover { background: #eaf2fd; text-decoration:none; box-shadow: 0 3px 10px rgba(27,111,214,.18); transform: translateY(-1px); }
.btn-ghost { color: #777 !important; text-decoration:none; }
.btn-ghost:hover { background: #f0f2f5; text-decoration:none; }
.btn-tariff {
  background: linear-gradient(135deg,#f0a500,#f5c34d); color: #2a1e00 !important; text-decoration:none;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.btn-tariff:hover { box-shadow: 0 3px 12px rgba(240,165,0,.45); transform: translateY(-1px); text-decoration:none; }

h1 { font-size: 26px; margin-bottom: 4px; }
.page-subtitle { color: #666; margin-top: 0; margin-bottom: 20px; }

.search-card {
  background: #fff; border: 1px solid #e2e5e9; border-radius: 8px;
  padding: 18px; margin-bottom: 24px;
}
.search-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 12px;
}
.search-row label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; font-weight: 600; }
.search-row input, .search-row select {
  width: 100%; padding: 8px 10px; border: 1px solid #ccd2d9; border-radius: 5px; font-size: 14px;
}
.search-actions { display: flex; justify-content: flex-end; gap: 10px; }

.results-info { margin-bottom: 12px; color: #444; font-weight: 600; }

table.listing-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e2e5e9; border-radius: 8px; overflow: hidden; }
table.listing-table th {
  background: #f0f2f5; text-align: left; padding: 10px 12px; font-size: 13px; color: #555; border-bottom: 1px solid #e2e5e9;
}
table.listing-table td { padding: 12px; border-bottom: 1px solid #eef0f2; font-size: 14px; vertical-align: top; }
table.listing-table tr:last-child td { border-bottom: none; }
table.listing-table tr:hover { background: #fafcff; }
.route { font-weight: 600; }
.route .arrow { color: #999; margin: 0 4px; }
.rate { font-weight: 700; color: #1a7d3a; white-space: nowrap; }
.muted { color: #888; font-size: 13px; }

.pagination { display: flex; gap: 6px; margin-top: 16px; }
.pagination a { padding: 6px 12px; border: 1px solid #ccd2d9; border-radius: 5px; color: #333; }
.pagination a.active { background: #1b6fd6; color: #fff; border-color: #1b6fd6; }

.card { background: #fff; border: 1px solid #e2e5e9; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.card h2 { margin-top: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 16px 0; }
.detail-grid div span { display: block; font-size: 12px; color: #888; }
.detail-grid div strong { font-size: 15px; }

form.form-card { background: #fff; border: 1px solid #e2e5e9; border-radius: 8px; padding: 24px; max-width: 640px; }
form.form-card label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: #444; }
form.form-card .field { margin-bottom: 16px; }
form.form-card input, form.form-card select, form.form-card textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #ccd2d9; border-radius: 5px; font-size: 14px; font-family: inherit;
}
form.form-card input[type="checkbox"] { width: auto; padding: 0; margin-right: 6px; vertical-align: middle; }
form.form-card label.checkbox-label { font-weight: normal; display: inline-flex; align-items: center; }
form.form-card .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fdecea; color: #b3261e; border: 1px solid #f5c2be; }
.alert-success { background: #e8f5e9; color: #256029; border: 1px solid #b9dfbd; }

.company-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.company-card { background: #fff; border: 1px solid #e2e5e9; border-radius: 8px; padding: 16px; }
.company-card form { margin-top: 10px; }
.company-card h3 { margin: 0 0 6px; font-size: 17px; }
.stars { color: #f5a623; font-weight: 700; }
.badge-verified { display: inline-block; background: #e3f2fd; color: #1565c0; font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }

.hero { background: linear-gradient(135deg,#1b6fd6,#2fa84f); color: #fff; border-radius: 10px; padding: 40px 32px; margin-bottom: 28px; }
.hero h1 { color: #fff; font-size: 32px; }
.hero p { font-size: 16px; opacity: .95; max-width: 640px; }
.hero-actions { margin-top: 18px; display: flex; gap: 12px; }
.hero-actions .btn-outline { background: #fff; border-color: #fff; }

.stats-row { display: flex; gap: 24px; margin: 24px 0; flex-wrap: wrap; }
.stat-box {
  display: block; background: #fff; border: 1px solid #e2e5e9; border-radius: 8px;
  padding: 16px 24px; text-align: center; min-width: 140px; text-decoration: none !important;
  transition: box-shadow .15s ease, transform .1s ease, border-color .15s ease; cursor: pointer;
}
.stat-box:hover { box-shadow: 0 4px 14px rgba(27,111,214,.18); transform: translateY(-2px); border-color: #c7dbf5; }
.stat-box .num { font-size: 26px; font-weight: 700; color: #1b6fd6; }
.stat-box .label { font-size: 13px; color: #777; }

.site-footer { background: #1c2733; color: #b7c0cb; padding: 24px 16px; margin-top: 40px; font-size: 13px; }
.site-footer .container { padding: 0; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs a { padding: 8px 16px; border-radius: 6px 6px 0 0; background: #eef0f2; color: #555; }
.tabs a.active { background: #fff; color: #1b6fd6; font-weight: 700; border: 1px solid #e2e5e9; border-bottom: 1px solid #fff; }

.rating-form select { width: auto; display: inline-block; }
.listing-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger { border-color: #d32f2f; color: #d32f2f !important; }

/* Кнопка «В избранное» — специально заметнее обычных btn-outline/btn-ghost,
   чтобы её было легко найти на странице груза/машины/компании. */
.btn-fav { border: 1px solid #f0a500; color: #8a6400 !important; background: #fff8e6; }
.btn-fav:hover { background: #fceec2; box-shadow: 0 3px 10px rgba(240,165,0,.25); transform: translateY(-1px); text-decoration: none; }
.btn-fav.is-active { background: #f0a500; color: #fff !important; border-color: #f0a500; }
.btn-fav.is-active:hover { background: #d89000; }
.btn-danger:hover { background: #fdecea; }
.btn-small { padding: 5px 10px; font-size: 12px; }
.sort-bar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.sort-bar select { padding: 6px 10px; border-radius: 5px; border: 1px solid #ccd2d9; }
.status-archived { color: #999; font-style: italic; }

/* Выпадающие чекбокс-фильтры в поиске (тип кузова / наименование груза / тип загрузки) — выглядят и ведут себя как <select> */
.check-item { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: normal; color: #333; padding: 3px 0; cursor: pointer; line-height: 1.3; }
.check-item input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }
.check-item-group { font-weight: 600; margin-top: 6px; }
.check-item-group:first-child { margin-top: 0; }
.check-item-sub { padding-left: 16px; }

.filter-dropdown { position: relative; }
.filter-dropdown > summary {
  width: 100%; padding: 8px 26px 8px 10px; border: 1px solid #ccd2d9; border-radius: 5px;
  font-size: 14px; color: #333; background: #fff; cursor: pointer; list-style: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative;
}
.filter-dropdown > summary::-webkit-details-marker { display: none; }
.filter-dropdown > summary::after { content: "▾"; position: absolute; right: 10px; top: 8px; color: #777; }
.filter-dropdown[open] > summary::after { content: "▴"; }
.filter-dropdown[open] > summary { border-color: #1b6fd6; }
.filter-dropdown-panel {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 280px; max-width: 360px;
  background: #fff; border: 1px solid #ccd2d9; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12);
  padding: 10px 12px; z-index: 20; max-height: 320px; overflow-y: auto;
}
.filter-dropdown-actions { position: sticky; bottom: -10px; margin: 8px -12px -10px; padding: 8px 12px; background: #fff; border-top: 1px solid #eef0f2; text-align: right; }

/* Автокомплит городов (текстовое поле вместо select) */
.city-ac-wrap { display: block; position: relative; }
.city-ac-panel {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; width: 100%;
  background: #fff; border: 1px solid #ccd2d9; border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12); z-index: 30; max-height: 280px; overflow-y: auto;
}
.city-ac-option { padding: 8px 12px; font-size: 14px; color: #333; cursor: pointer; white-space: normal; }
.city-ac-option:hover, .city-ac-option.active { background: #eaf2fd; }

/* Чекбоксы «Условия оплаты» / «Доп. параметры» в формах добавления/редактирования */
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2px 12px; }

/* Бейджи отмеченных условий на странице объявления (предоплата, ADR, кругорейс и т.д.) */
.flag-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.flag-badge { display: inline-block; background: #eef6ec; color: #2c6b2f; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; }

/* Фото объявлений */
.list-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 5px; margin-right: 8px; vertical-align: middle; }
.photo-gallery { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.photo-gallery img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid #e2e5e9; }
.photo-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.photo-thumb-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: normal; color: #666; cursor: pointer; }
.photo-thumb { width: 90px; height: 70px; object-fit: cover; border-radius: 5px; border: 1px solid #e2e5e9; }

/* Аватар пользователя (фото или заглушка с первой буквой имени) */
.avatar { border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; background: #dce6f5; color: #2f5fa3; font-weight: 700; }
.avatar-sm { width: 24px; height: 24px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 16px; }
.avatar-lg { width: 72px; height: 72px; font-size: 28px; }
.btn-with-avatar { display: inline-flex; align-items: center; gap: 8px; }
.avatar-edit-row { display: flex; align-items: center; gap: 16px; margin: 10px 0; }
.cabinet-heading { display: flex; align-items: center; gap: 14px; }
.poster-row { display: flex; align-items: center; gap: 8px; }
.cabinet-quicklinks { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 22px; }
.cabinet-quicklinks .btn { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.admin-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 10px 12px; background: #fff5f5; border: 1px solid #f3c6c6; border-radius: 6px; }

/* Ряд кнопок-меню в админке (главная админ-панели) */
.admin-menu { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.admin-menu .btn { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.05); }

/* Тарифы и лицензии */
.license-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 20px; }
.license-card { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid #e2e5e9; border-radius: 8px; padding: 14px 18px; }
.license-card-main { flex: 1; min-width: 0; }
.license-card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.license-card-price { text-align: right; white-space: nowrap; display: flex; flex-direction: column; }
.license-price { font-size: 18px; font-weight: 700; }
.license-old-price { text-decoration: line-through; color: #999; font-size: 13px; }
.license-card-action { white-space: nowrap; }
.license-active-tag { color: #1a7d3a; font-weight: 600; }
.ad-banner { background: #fff8e1; border: 1px solid #f0d98c; border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: #6b5900; display: flex; align-items: center; gap: 10px; }
.ad-banner a { font-weight: 600; }
.ad-banner-link { color: inherit; text-decoration: none; }
.ad-banner-link:hover { text-decoration: none; opacity: 0.94; }

/* Баннер-картинка занимает всё место слота целиком, без текста, без внутренних отступов —
   вся область кликабельна одной ссылкой (регистрация клика идёт через banner_click.php).
   По умолчанию (списки грузов/машин) картинка показывается в своём естественном размере
   (не растягивается и не обрезается) — вписывается в отведённое место и центрируется. */
.ad-banner-image { padding: 0; background: none; border: none; overflow: hidden; display: block; line-height: 0; text-align: center; }
.ad-banner-image .ad-banner-link { display: inline-block; max-width: 100%; line-height: 0; }
.ad-banner-image .ad-banner-img { display: inline-block; max-width: 100%; max-height: 120px; width: auto; height: auto; border-radius: 6px; }

/* Под главным меню сайта — два места рядом (шапка слева/справа), одинакового размера;
   картинки в них растягиваются на всю область места (без сохранения пропорций, как
   в боковых колонках), а не показываются в естественном размере. */
.ad-banner-header-row { display: flex; gap: 16px; margin-bottom: 14px; height: 150px; }
.ad-banner-header-row .ad-banner { flex: 1 1 0; min-width: 0; margin-bottom: 0; height: 100%; }
.ad-banner-header-row .ad-banner-link { display: block; width: 100%; height: 100%; }
.ad-banner-header-row .ad-banner-img { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
@media (max-width: 700px) { .ad-banner-header-row { flex-direction: column; height: auto; } .ad-banner-header-row .ad-banner { height: 150px; } }

/* Каждая позиция — своё отдельное место на странице, в ней всегда виден один баннер
   (карусель меняет его от захода к заходу, см. pickCarouselBanner() в functions.php). */
.site-sidebar > .ad-banner { margin-bottom: 0; height: 100%; min-height: 300px; }
.site-sidebar > .ad-banner + .ad-banner { margin-top: 16px; }
.site-sidebar .ad-banner-link { display: block; width: 100%; height: 100%; }
.site-sidebar .ad-banner-img { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.license-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; color: #fff; }
.license-badge-хит { background: #2c9d3f; }
.license-badge-pro { background: #f0a500; }
.license-badge-new { background: #2f6fd6; }

@media (max-width: 860px) {
  .license-card { flex-wrap: wrap; }
  .license-card-price { text-align: left; }
}

@media (max-width: 860px) {
  .top-bar { flex-wrap: wrap; gap: 12px; }
  .burger { display: block; order: 2; }
  .auth-block { order: 3; width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .main-nav { display: none; flex-direction: column; width: 100%; order: 4; gap: 4px; }
  .main-nav.open { display: flex; }
  .sub-bar { display: none; flex-direction: column; gap: 6px; }
  .sub-bar.open { display: flex; }
  .nav-dropdown, .sub-bar-link, .nav-dropdown-toggle { width: 100%; }
  .nav-dropdown-toggle { text-align: left; }
  .nav-dropdown-menu { position: static; box-shadow: none; border: none; background: transparent; margin: 2px 0 0; padding: 0 0 0 14px; width: 100%; }
  .search-row { grid-template-columns: 1fr 1fr; }
  form.form-card .grid2 { grid-template-columns: 1fr; }
  table.listing-table { display: block; overflow-x: auto; white-space: nowrap; }
  .stats-row { justify-content: center; }
}

@media (max-width: 520px) {
  .search-row { grid-template-columns: 1fr; }
  .hero { padding: 24px 18px; }
  .hero h1 { font-size: 24px; }
  .company-list { grid-template-columns: 1fr; }
}
