:root { --accent: #2c5f2d; --accent-light: #97d077; }
html { height: 100%; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f8f9fa; min-height: 100%; display: flex; flex-direction: column; }
.navbar { background: #fff !important; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.navbar-brand { font-weight: 600; color: var(--accent) !important; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #234a24; border-color: #234a24; }
.table-hover tbody tr:hover { background: rgba(44, 95, 45, .06); }
/* Главная: LEAD-стиль таблицы объявлений */
.posts-table { border-collapse: separate; border-spacing: 0; }
.posts-table thead th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; padding: 0.875rem 1rem; border-bottom: 1px solid #e5e7eb; background: #fafafa; }
.posts-table tbody td { padding: 1rem; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.posts-table tbody tr { transition: background 0.2s ease, box-shadow 0.2s ease; }
.posts-table tbody tr:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.posts-table .post-row-clickable { cursor: pointer; }
.posts-table .post-row-clickable td:first-child { border-radius: 8px 0 0 8px; }
.posts-table .post-row-clickable td:last-child { border-radius: 0 8px 8px 0; }
.posts-table tbody tr.post-row-clickable:hover .post-thumb { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.posts-table .cost { font-weight: 700; color: var(--accent); font-size: 1rem; }
.posts-table td[data-label="Объект"] { font-weight: 500; color: #111; }
.posts-table .col-address { min-width: 180px; width: 22%; }
.posts-mobile .table-responsive { border-radius: 12px; overflow: hidden; }
.posts-mobile .posts-table tbody tr.post-row-clickable { cursor: pointer; }
.posts-mobile .posts-table .col-address { min-width: 0; width: auto; }
.posts-mobile.card { border-radius: 12px; overflow: hidden; }
#filterFormCard.card { border-radius: 12px; }
.main-content { min-height: 60vh; flex: 1 0 auto; }
.modal-header { border-bottom: 1px solid #eee; }
.table thead th { font-weight: 600; color: #333; background: #fff; }
.cost { font-weight: 600; white-space: nowrap; }
a.text-dark:hover { color: var(--accent) !important; }
.btn-loading { pointer-events: none; opacity: 0.8; }
.btn-loading .btn-spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: -0.15em; margin-right: 0.35em; }
@keyframes spin { to { transform: rotate(360deg); } }
#toastContainer { position: fixed; bottom: 1rem; right: 1rem; z-index: 1100; }
/* Яндекс.Метрика: debug/вебвизор не должны влиять на раскладку */
.__ymDebugger.__ym_wv_ign { position: fixed !important; inset: 0 !important; width: 0 !important; height: 0 !important; overflow: hidden !important; pointer-events: none !important; }

/* Skeleton / lazy */
.skeleton-row { opacity: 0; animation: skeletonFadeIn 0.35s ease forwards; }
.skeleton-row:nth-child(1) { animation-delay: 0.02s; }
.skeleton-row:nth-child(2) { animation-delay: 0.04s; }
.skeleton-row:nth-child(3) { animation-delay: 0.06s; }
.skeleton-row:nth-child(4) { animation-delay: 0.08s; }
.skeleton-row:nth-child(5) { animation-delay: 0.1s; }
.skeleton-row:nth-child(n+6) { animation-delay: 0.12s; }
@keyframes skeletonFadeIn { to { opacity: 1; } }
.img-loading { background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%); background-size: 200% 100%; animation: skeletonShimmer 1s infinite; }
@keyframes skeletonShimmer { to { background-position: 200% 0; } }

/* Photo preview */
.photo-preview-area, .photo-preview-area-edit { margin-bottom: 0.75rem; }
.photo-preview-list { display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 80px; padding: 0.5rem; background: #f8f9fa; border-radius: 8px; }
.photo-preview-item { position: relative; width: 80px; height: 60px; flex-shrink: 0; border-radius: 6px; overflow: hidden; cursor: grab; border: 2px solid transparent; transition: border-color 0.2s; }
.photo-preview-item:hover { border-color: var(--accent); }
.photo-preview-item.dragging { opacity: 0.5; cursor: grabbing; }
.photo-preview-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-preview-remove { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0; border: none; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.photo-preview-remove:hover { background: #dc3545; }
.photo-preview-delete { position: absolute; bottom: 0; left: 0; right: 0; margin: 0; padding: 2px 4px; background: rgba(0,0,0,0.6); font-size: 11px; color: #fff; }
.photo-preview-delete input { margin-right: 4px; }

/* Copy phone */
.copy-phone-btn { padding: 0.2rem 0.5rem; font-size: 0.8rem; }

/* Мобильный блок фильтров: сворачивание с запоминанием */
@media (max-width: 991.98px) {
    #filterFormCard.filter-form-collapsed .filter-form-collapse-body { display: none !important; }
    #filterForm.filter-form-row .col-filter-field { flex: 0 0 25% !important; max-width: 25% !important; min-width: 0 !important; }
    #filterForm.filter-form-row .col-filter-submit { flex: 0 0 100%; margin-left: auto; margin-top: 0.25rem; display: flex; justify-content: flex-end; align-items: flex-end; }
    #filterForm.filter-form-row .btn-filter-submit { width: auto; min-width: 5rem; }
}
@media (min-width: 992px) {
    .filter-form-collapse-body { display: block !important; }
    #filterForm.filter-form-row {
        display: grid;
        grid-template-columns: repeat(4, minmax(5.5rem, 1fr)) minmax(4.5rem, 0.7fr) minmax(4.5rem, 0.7fr) minmax(4rem, 0.5fr) minmax(6rem, 1fr) auto;
        gap: 0.5rem;
        align-items: end;
        margin-left: 0;
        margin-right: 0;
    }
    #filterForm.filter-form-row:not(:has(.col-id)) {
        grid-template-columns: repeat(4, minmax(5.5rem, 1fr)) minmax(4.5rem, 0.7fr) minmax(4.5rem, 0.7fr) minmax(6rem, 1fr) auto;
    }
    #filterForm.filter-form-row .col-filter-field { min-width: 0; overflow: visible; }
    #filterForm.filter-form-row .col-filter-field .form-control,
    #filterForm.filter-form-row .col-filter-field .form-select { min-width: 0; width: 100%; }
    #filterForm.filter-form-row .col-filter-submit { display: flex; align-items: flex-end; justify-content: flex-end; }
    #filterForm.filter-form-row .btn-filter-submit { padding-left: 1rem; padding-right: 1rem; white-space: nowrap; }
}
@media (max-width: 991.98px) {
    .navbar .dropdown .dropdown-menu {
        left: 0;
        right: auto;
    }
}
@media (max-width: 768px) {
    .navbar .container { padding-left: 0.75rem; padding-right: 0.75rem; }
    .main-content .container { padding-left: 0.75rem; padding-right: 0.75rem; }
    .table-responsive { margin: 0 -0.75rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { font-size: 0.9rem; }
    .table th, .table td { padding: 0.5rem 0.4rem; }
    .posts-mobile.card { background: #f8f9fa; }
    .posts-mobile .table thead { display: none; }
    .posts-mobile .table,
    .posts-mobile .table tbody { background: #f8f9fa; }
    .posts-mobile .table tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .posts-mobile .table tbody tr { display: block; margin-bottom: 0; border: 1px solid #dee2e6; border-radius: 8px; padding: 0.75rem; background: #fff; }
    .posts-mobile .table tbody td { display: block; border: none; padding: 0.25rem 0; }
    .posts-mobile .table tbody td::before { content: attr(data-label); font-weight: 600; display: inline-block; min-width: 90px; }
    .posts-mobile .table tbody td[data-label="Фото"]::before,
    .posts-mobile .table tbody td[data-label="Дата"]::before { display: none; }
    .posts-mobile .table tbody td[data-label="Дата"] { display: none; }
    .posts-mobile .table tbody td.cost { font-size: 1.1rem; }
    .detail-photo-wrap { border-radius: 8px; overflow: hidden; }
    .detail-photo-wrap img { max-height: 280px; }
    .photo-preview-item { width: 70px; height: 52px; }
}
@media (max-width: 576px) {
    .btn-group-mobile { flex-direction: column; width: 100%; }
    .btn-group-mobile .btn { width: 100%; }
    .pagination { flex-wrap: wrap; justify-content: center; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    .aside-blocks-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
    .aside-blocks-wrapper .aside-popular { margin-bottom: 0 !important; }
    .aside-blocks-wrapper #recentHistoryCol { margin-bottom: 0 !important; }
    .btn-filter-submit { min-width: 7rem; padding-left: 1rem; padding-right: 1rem; }
}
/* Планшет и мобильный: карточный режим */
@media (max-width: 1199.98px) {
    .posts-mobile.card { background: #f8f9fa; }
    .posts-mobile .table thead { display: none; }
    .posts-mobile .table,
    .posts-mobile .table tbody { background: #f8f9fa; }
    .posts-mobile .table tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .posts-mobile .table tbody tr { display: block; margin-bottom: 0; border: 1px solid #dee2e6; border-radius: 8px; padding: 0.75rem; background: #fff; }
    .posts-mobile .table tbody td { display: block; border: none; padding: 0.25rem 0; }
    .posts-mobile .table tbody td::before { content: attr(data-label); font-weight: 600; display: inline-block; min-width: 90px; }
    .posts-mobile .table tbody td[data-label="Фото"]::before,
    .posts-mobile .table tbody td[data-label="Дата"]::before { display: none; }
    .posts-mobile .table tbody td[data-label="Дата"] { display: none; }
    .posts-mobile .table tbody td.cost { font-size: 1.1rem; }
    .posts-mobile .table-responsive { overflow-x: visible; background: #f8f9fa; }
}
